import{r as O,j as l,u as aa,d as aG,R as fe,b as UA,e as lG,L as oG,f as cG,g as Gr,h as uG,k as dG,O as WA,l as hG}from"./router-SinpzM5S.js";import{a as fG,b as mG,g as qS}from"./react-vendor-Dtc2IqVY.js";import{c as GA,R as pG,T as gG,L as xG,a as vG,C as mg,X as pg,Y as jf,b as yG,B as o2,d as gg,P as bG,e as wG,f as SG,_ as kG,g as OG,i as jG,h as S8,j as NG,k as k8,l as CG,m as TG,n as EG,r as XA,o as _G,p as FS,q as YA,s as xu,t as $S,u as MG,v as AG,w as ZA,x as KA,y as JA,z as QS,A as HS,D as VS,E as RG,F as DG,G as zG,H as PG,I as LG,J as BG,K as IG,M as US,N as F1,O as qG,Q as FG,S as WS,U as $G,V as QG,W as eR,Z as tR,$ as nR,a0 as rR,a1 as $1,a2 as sR,a3 as iR,a4 as HG,a5 as VG,a6 as UG,a7 as WG,a8 as GG,a9 as XG,aa as YG,ab as ZG,ac as aR,ad as lR,ae as KG,af as JG,ag as eX,ah as tX,ai as nX,aj as rX,ak as sX,al as iX,am as aX,an as lX,ao as oX,ap as cX,aq as uX,ar as dX,as as hX,at as fX}from"./charts-BH1Uno6i.js";import{c as la,a as Q1,u as Li,P as fn,b as Xe,d as Pn,e as n0,f as ac,g as us,h as Ws,i as oR,j as GS,k as XS,S as mX,l as cR,m as uR,R as dR,O as H1,n as YS,C as V1,o as ZS,T as KS,D as JS,p as ek,q as hR,r as fR,W as pX,s as mR,I as gX,t as pR,v as gR,w as xX,x as xR,V as vX,L as vR,y as yR,z as yX,A as bX,B as bR,E as wX,F as SX,G as Uo,H as U1,J as ph,K as wR,M as SR,N as kR,Q as OR,U as tk,X as nk,Y as W1,Z as G1,_ as rk,$ as jR,a0 as kX,a1 as NR,a2 as OX,a3 as jX,a4 as CR,a5 as NX}from"./ui-vendor-BLBhIcJ8.js";import{R as hi,A as CX,D as TX,a as R5,Z as pm,C as Yc,M as r0,T as EX,X as s0,P as TR,S as _X,b as Zc,I as Il,c as Rd,d as Kc,e as D5,E as z5,f as na,g as Ea,h as P5,i as MX,j as L5,k as B5,L as O8,K as AX,l as su,m as RX,n as DX,F as Dl,o as zX,B as PX,U as ER,p as sk,q as LX,r as BX,s as js,H as Hx,t as _R,u as gm,v as I5,w as xm,x as IX,y as qX,z as X1,G as ik,J as is,N as Kt,O as Vx,Q as Wd,V as i0,W as vu,Y as yu,_ as a0,$ as FX,a0 as j8,a1 as $X,a2 as Jc,a3 as q5,a4 as Gd,a5 as N8,a6 as Ux,a7 as QX,a8 as MR,a9 as C8,aa as HX,ab as VX,ac as zo,ad as c2,ae as T8,af as UX,ag as nm,ah as Wx,ai as AR,aj as RR,ak as DR,al as WX,am as GX,an as E8,ao as XX,ap as YX,aq as _8,ar as ZX}from"./icons-COIni9ke.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var u2={exports:{}},Nf={},d2={exports:{}},h2={};var M8;function KX(){return M8||(M8=1,(function(t){function e(q,J){var ee=q.length;q.push(J);e:for(;0>>1,R=q[Y];if(0>>1;Ys(I,ee))Qs($,I)?(q[Y]=$,q[Q]=ee,Y=Q):(q[Y]=I,q[K]=ee,Y=K);else if(Qs($,ee))q[Y]=$,q[Q]=ee,Y=Q;else break e}}return J}function s(q,J){var ee=q.sortIndex-J.sortIndex;return ee!==0?ee:q.id-J.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var u=[],h=[],f=1,m=null,g=3,x=!1,y=!1,w=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function T(q){for(var J=n(h);J!==null;){if(J.callback===null)r(h);else if(J.startTime<=q)r(h),J.sortIndex=J.expirationTime,e(u,J);else break;J=n(h)}}function E(q){if(w=!1,T(q),!y)if(n(u)!==null)y=!0,_||(_=!0,U());else{var J=n(h);J!==null&&W(E,J.startTime-q)}}var _=!1,A=-1,F=5,B=-1;function P(){return b?!0:!(t.unstable_now()-Bq&&P());){var Y=m.callback;if(typeof Y=="function"){m.callback=null,g=m.priorityLevel;var R=Y(m.expirationTime<=q);if(q=t.unstable_now(),typeof R=="function"){m.callback=R,T(q),J=!0;break t}m===n(u)&&r(u),T(q)}else r(u);m=n(u)}if(m!==null)J=!0;else{var re=n(h);re!==null&&W(E,re.startTime-q),J=!1}}break e}finally{m=null,g=ee,x=!1}J=void 0}}finally{J?U():_=!1}}}var U;if(typeof C=="function")U=function(){C(H)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,z=te.port2;te.port1.onmessage=H,U=function(){z.postMessage(null)}}else U=function(){k(H,0)};function W(q,J){A=k(function(){q(t.unstable_now())},J)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(q){q.callback=null},t.unstable_forceFrameRate=function(q){0>q||125Y?(q.sortIndex=ee,e(h,q),n(u)===null&&q===n(h)&&(w?(N(A),A=-1):w=!0,W(E,ee-Y))):(q.sortIndex=R,e(u,q),y||x||(y=!0,_||(_=!0,U()))),q},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(q){var J=g;return function(){var ee=g;g=J;try{return q.apply(this,arguments)}finally{g=ee}}}})(h2)),h2}var A8;function JX(){return A8||(A8=1,d2.exports=KX()),d2.exports}var R8;function eY(){if(R8)return Nf;R8=1;var t=JX(),e=fG(),n=mG();function r(c){var d="https://react.dev/errors/"+c;if(1R||(c.current=Y[R],Y[R]=null,R--)}function I(c,d){R++,Y[R]=c.current,c.current=d}var Q=re(null),$=re(null),Z=re(null),ne=re(null);function ge(c,d){switch(I(Z,d),I($,c),I(Q,null),d.nodeType){case 9:case 11:c=(c=d.documentElement)&&(c=c.namespaceURI)?VN(c):0;break;default:if(c=d.tagName,d=d.namespaceURI)d=VN(d),c=UN(d,c);else switch(c){case"svg":c=1;break;case"math":c=2;break;default:c=0}}K(Q),I(Q,c)}function se(){K(Q),K($),K(Z)}function Te(c){c.memoizedState!==null&&I(ne,c);var d=Q.current,p=UN(d,c.type);d!==p&&(I($,c),I(Q,p))}function qe(c){$.current===c&&(K(Q),K($)),ne.current===c&&(K(ne),wf._currentValue=ee)}var ve,Fe;function Qe(c){if(ve===void 0)try{throw Error()}catch(p){var d=p.stack.trim().match(/\n( *(at )?)/);ve=d&&d[1]||"",Fe=-1)":-1S||oe[v]!==we[S]){var Ee=` `+oe[v].replace(" at new "," at ");return c.displayName&&Ee.includes("")&&(Ee=Ee.replace("",c.displayName)),Ee}while(1<=v&&0<=S);break}}}finally{Ke=!1,Error.prepareStackTrace=p}return(p=c?c.displayName||c.name:"")?Qe(p):""}function st(c,d){switch(c.tag){case 26:case 27:case 5:return Qe(c.type);case 16:return Qe("Lazy");case 13:return c.child!==d&&d!==null?Qe("Suspense Fallback"):Qe("Suspense");case 19:return Qe("SuspenseList");case 0:case 15:return Tt(c.type,!1);case 11:return Tt(c.type.render,!1);case 1:return Tt(c.type,!0);case 31:return Qe("Activity");default:return""}}function He(c){try{var d="",p=null;do d+=st(c,p),p=c,c=c.return;while(c);return d}catch(v){return` Error generating stack: `+v.message+` `+v.stack}}var St=Object.prototype.hasOwnProperty,bt=t.unstable_scheduleCallback,nr=t.unstable_cancelCallback,mn=t.unstable_shouldYield,Hn=t.unstable_requestPaint,$t=t.unstable_now,ht=t.unstable_getCurrentPriorityLevel,le=t.unstable_ImmediatePriority,Oe=t.unstable_UserBlockingPriority,Le=t.unstable_NormalPriority,nt=t.unstable_LowPriority,Ot=t.unstable_IdlePriority,Vt=t.log,Ln=t.unstable_setDisableYieldValue,ue=null,Ce=null;function lt(c){if(typeof Vt=="function"&&Ln(c),Ce&&typeof Ce.setStrictMode=="function")try{Ce.setStrictMode(ue,c)}catch{}}var ut=Math.clz32?Math.clz32:On,or=Math.log,ft=Math.LN2;function On(c){return c>>>=0,c===0?32:31-(or(c)/ft|0)|0}var mt=256,Jt=262144,fr=4194304;function kt(c){var d=c&42;if(d!==0)return d;switch(c&-c){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return c&261888;case 262144:case 524288:case 1048576:case 2097152:return c&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return c&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return c}}function eo(c,d,p){var v=c.pendingLanes;if(v===0)return 0;var S=0,j=c.suspendedLanes,L=c.pingedLanes;c=c.warmLanes;var G=v&134217727;return G!==0?(v=G&~j,v!==0?S=kt(v):(L&=G,L!==0?S=kt(L):p||(p=G&~c,p!==0&&(S=kt(p))))):(G=v&~j,G!==0?S=kt(G):L!==0?S=kt(L):p||(p=v&~c,p!==0&&(S=kt(p)))),S===0?0:d!==0&&d!==S&&(d&j)===0&&(j=S&-S,p=d&-d,j>=p||j===32&&(p&4194048)!==0)?d:S}function Xa(c,d){return(c.pendingLanes&~(c.suspendedLanes&~c.pingedLanes)&d)===0}function Mh(c,d){switch(c){case 1:case 2:case 4:case 8:case 64:return d+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function to(){var c=fr;return fr<<=1,(fr&62914560)===0&&(fr=4194304),c}function Ya(c){for(var d=[],p=0;31>p;p++)d.push(c);return d}function pc(c,d){c.pendingLanes|=d,d!==268435456&&(c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0)}function Zv(c,d,p,v,S,j){var L=c.pendingLanes;c.pendingLanes=p,c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0,c.expiredLanes&=p,c.entangledLanes&=p,c.errorRecoveryDisabledLanes&=p,c.shellSuspendCounter=0;var G=c.entanglements,oe=c.expirationTimes,we=c.hiddenUpdates;for(p=L&~p;0"u")return null;try{return c.activeElement||c.body}catch{return c.body}}var eU=/[\n"\\]/g;function yi(c){return c.replace(eU,function(d){return"\\"+d.charCodeAt(0).toString(16)+" "})}function ny(c,d,p,v,S,j,L,G){c.name="",L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"?c.type=L:c.removeAttribute("type"),d!=null?L==="number"?(d===0&&c.value===""||c.value!=d)&&(c.value=""+vi(d)):c.value!==""+vi(d)&&(c.value=""+vi(d)):L!=="submit"&&L!=="reset"||c.removeAttribute("value"),d!=null?ry(c,L,vi(d)):p!=null?ry(c,L,vi(p)):v!=null&&c.removeAttribute("value"),S==null&&j!=null&&(c.defaultChecked=!!j),S!=null&&(c.checked=S&&typeof S!="function"&&typeof S!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?c.name=""+vi(G):c.removeAttribute("name")}function IO(c,d,p,v,S,j,L,G){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(c.type=j),d!=null||p!=null){if(!(j!=="submit"&&j!=="reset"||d!=null)){ty(c);return}p=p!=null?""+vi(p):"",d=d!=null?""+vi(d):p,G||d===c.value||(c.value=d),c.defaultValue=d}v=v??S,v=typeof v!="function"&&typeof v!="symbol"&&!!v,c.checked=G?c.checked:!!v,c.defaultChecked=!!v,L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"&&(c.name=L),ty(c)}function ry(c,d,p){d==="number"&&sp(c.ownerDocument)===c||c.defaultValue===""+p||(c.defaultValue=""+p)}function Eu(c,d,p,v){if(c=c.options,d){d={};for(var S=0;S"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oy=!1;if(nl)try{var Bh={};Object.defineProperty(Bh,"passive",{get:function(){oy=!0}}),window.addEventListener("test",Bh,Bh),window.removeEventListener("test",Bh,Bh)}catch{oy=!1}var io=null,cy=null,ap=null;function UO(){if(ap)return ap;var c,d=cy,p=d.length,v,S="value"in io?io.value:io.textContent,j=S.length;for(c=0;c=Fh),KO=" ",JO=!1;function ej(c,d){switch(c){case"keyup":return TU.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tj(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var Ru=!1;function _U(c,d){switch(c){case"compositionend":return tj(d);case"keypress":return d.which!==32?null:(JO=!0,KO);case"textInput":return c=d.data,c===KO&&JO?null:c;default:return null}}function MU(c,d){if(Ru)return c==="compositionend"||!my&&ej(c,d)?(c=UO(),ap=cy=io=null,Ru=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-c};c=v}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=cj(p)}}function dj(c,d){return c&&d?c===d?!0:c&&c.nodeType===3?!1:d&&d.nodeType===3?dj(c,d.parentNode):"contains"in c?c.contains(d):c.compareDocumentPosition?!!(c.compareDocumentPosition(d)&16):!1:!1}function hj(c){c=c!=null&&c.ownerDocument!=null&&c.ownerDocument.defaultView!=null?c.ownerDocument.defaultView:window;for(var d=sp(c.document);d instanceof c.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)c=d.contentWindow;else break;d=sp(c.document)}return d}function xy(c){var d=c&&c.nodeName&&c.nodeName.toLowerCase();return d&&(d==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||d==="textarea"||c.contentEditable==="true")}var IU=nl&&"documentMode"in document&&11>=document.documentMode,Du=null,vy=null,Vh=null,yy=!1;function fj(c,d,p){var v=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;yy||Du==null||Du!==sp(v)||(v=Du,"selectionStart"in v&&xy(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),Vh&&Hh(Vh,v)||(Vh=v,v=Jp(vy,"onSelect"),0>=L,S-=L,fa=1<<32-ut(d)+S|p<At?(Yt=rt,rt=null):Yt=rt.sibling;var gn=ke(pe,rt,ye[At],_e);if(gn===null){rt===null&&(rt=Yt);break}c&&rt&&gn.alternate===null&&d(pe,rt),he=j(gn,he,At),pn===null?dt=gn:pn.sibling=gn,pn=gn,rt=Yt}if(At===ye.length)return p(pe,rt),en&&sl(pe,At),dt;if(rt===null){for(;AtAt?(Yt=rt,rt=null):Yt=rt.sibling;var To=ke(pe,rt,gn.value,_e);if(To===null){rt===null&&(rt=Yt);break}c&&rt&&To.alternate===null&&d(pe,rt),he=j(To,he,At),pn===null?dt=To:pn.sibling=To,pn=To,rt=Yt}if(gn.done)return p(pe,rt),en&&sl(pe,At),dt;if(rt===null){for(;!gn.done;At++,gn=ye.next())gn=Ae(pe,gn.value,_e),gn!==null&&(he=j(gn,he,At),pn===null?dt=gn:pn.sibling=gn,pn=gn);return en&&sl(pe,At),dt}for(rt=v(rt);!gn.done;At++,gn=ye.next())gn=Ne(rt,pe,At,gn.value,_e),gn!==null&&(c&&gn.alternate!==null&&rt.delete(gn.key===null?At:gn.key),he=j(gn,he,At),pn===null?dt=gn:pn.sibling=gn,pn=gn);return c&&rt.forEach(function(iG){return d(pe,iG)}),en&&sl(pe,At),dt}function Mn(pe,he,ye,_e){if(typeof ye=="object"&&ye!==null&&ye.type===w&&ye.key===null&&(ye=ye.props.children),typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case x:e:{for(var dt=ye.key;he!==null;){if(he.key===dt){if(dt=ye.type,dt===w){if(he.tag===7){p(pe,he.sibling),_e=S(he,ye.props.children),_e.return=pe,pe=_e;break e}}else if(he.elementType===dt||typeof dt=="object"&&dt!==null&&dt.$$typeof===F&&Cc(dt)===he.type){p(pe,he.sibling),_e=S(he,ye.props),Zh(_e,ye),_e.return=pe,pe=_e;break e}p(pe,he);break}else d(pe,he);he=he.sibling}ye.type===w?(_e=Sc(ye.props.children,pe.mode,_e,ye.key),_e.return=pe,pe=_e):(_e=gp(ye.type,ye.key,ye.props,null,pe.mode,_e),Zh(_e,ye),_e.return=pe,pe=_e)}return L(pe);case y:e:{for(dt=ye.key;he!==null;){if(he.key===dt)if(he.tag===4&&he.stateNode.containerInfo===ye.containerInfo&&he.stateNode.implementation===ye.implementation){p(pe,he.sibling),_e=S(he,ye.children||[]),_e.return=pe,pe=_e;break e}else{p(pe,he);break}else d(pe,he);he=he.sibling}_e=Ny(ye,pe.mode,_e),_e.return=pe,pe=_e}return L(pe);case F:return ye=Cc(ye),Mn(pe,he,ye,_e)}if(W(ye))return Je(pe,he,ye,_e);if(U(ye)){if(dt=U(ye),typeof dt!="function")throw Error(r(150));return ye=dt.call(ye),vt(pe,he,ye,_e)}if(typeof ye.then=="function")return Mn(pe,he,kp(ye),_e);if(ye.$$typeof===C)return Mn(pe,he,yp(pe,ye),_e);Op(pe,ye)}return typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint"?(ye=""+ye,he!==null&&he.tag===6?(p(pe,he.sibling),_e=S(he,ye),_e.return=pe,pe=_e):(p(pe,he),_e=jy(ye,pe.mode,_e),_e.return=pe,pe=_e),L(pe)):p(pe,he)}return function(pe,he,ye,_e){try{Yh=0;var dt=Mn(pe,he,ye,_e);return Vu=null,dt}catch(rt){if(rt===Hu||rt===wp)throw rt;var pn=Ks(29,rt,null,pe.mode);return pn.lanes=_e,pn.return=pe,pn}finally{}}}var Ec=Pj(!0),Lj=Pj(!1),uo=!1;function By(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Iy(c,d){c=c.updateQueue,d.updateQueue===c&&(d.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,callbacks:null})}function ho(c){return{lane:c,tag:0,payload:null,callback:null,next:null}}function fo(c,d,p){var v=c.updateQueue;if(v===null)return null;if(v=v.shared,(Sn&2)!==0){var S=v.pending;return S===null?d.next=d:(d.next=S.next,S.next=d),v.pending=d,d=pp(c),bj(c,null,p),d}return mp(c,v,d,p),pp(c)}function Kh(c,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194048)!==0)){var v=d.lanes;v&=c.pendingLanes,p|=v,d.lanes=p,W0(c,p)}}function qy(c,d){var p=c.updateQueue,v=c.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var S=null,j=null;if(p=p.firstBaseUpdate,p!==null){do{var L={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};j===null?S=j=L:j=j.next=L,p=p.next}while(p!==null);j===null?S=j=d:j=j.next=d}else S=j=d;p={baseState:v.baseState,firstBaseUpdate:S,lastBaseUpdate:j,shared:v.shared,callbacks:v.callbacks},c.updateQueue=p;return}c=p.lastBaseUpdate,c===null?p.firstBaseUpdate=d:c.next=d,p.lastBaseUpdate=d}var Fy=!1;function Jh(){if(Fy){var c=Qu;if(c!==null)throw c}}function ef(c,d,p,v){Fy=!1;var S=c.updateQueue;uo=!1;var j=S.firstBaseUpdate,L=S.lastBaseUpdate,G=S.shared.pending;if(G!==null){S.shared.pending=null;var oe=G,we=oe.next;oe.next=null,L===null?j=we:L.next=we,L=oe;var Ee=c.alternate;Ee!==null&&(Ee=Ee.updateQueue,G=Ee.lastBaseUpdate,G!==L&&(G===null?Ee.firstBaseUpdate=we:G.next=we,Ee.lastBaseUpdate=oe))}if(j!==null){var Ae=S.baseState;L=0,Ee=we=oe=null,G=j;do{var ke=G.lane&-536870913,Ne=ke!==G.lane;if(Ne?(Xt&ke)===ke:(v&ke)===ke){ke!==0&&ke===$u&&(Fy=!0),Ee!==null&&(Ee=Ee.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var Je=c,vt=G;ke=d;var Mn=p;switch(vt.tag){case 1:if(Je=vt.payload,typeof Je=="function"){Ae=Je.call(Mn,Ae,ke);break e}Ae=Je;break e;case 3:Je.flags=Je.flags&-65537|128;case 0:if(Je=vt.payload,ke=typeof Je=="function"?Je.call(Mn,Ae,ke):Je,ke==null)break e;Ae=m({},Ae,ke);break e;case 2:uo=!0}}ke=G.callback,ke!==null&&(c.flags|=64,Ne&&(c.flags|=8192),Ne=S.callbacks,Ne===null?S.callbacks=[ke]:Ne.push(ke))}else Ne={lane:ke,tag:G.tag,payload:G.payload,callback:G.callback,next:null},Ee===null?(we=Ee=Ne,oe=Ae):Ee=Ee.next=Ne,L|=ke;if(G=G.next,G===null){if(G=S.shared.pending,G===null)break;Ne=G,G=Ne.next,Ne.next=null,S.lastBaseUpdate=Ne,S.shared.pending=null}}while(!0);Ee===null&&(oe=Ae),S.baseState=oe,S.firstBaseUpdate=we,S.lastBaseUpdate=Ee,j===null&&(S.shared.lanes=0),vo|=L,c.lanes=L,c.memoizedState=Ae}}function Bj(c,d){if(typeof c!="function")throw Error(r(191,c));c.call(d)}function Ij(c,d){var p=c.callbacks;if(p!==null)for(c.callbacks=null,c=0;cj?j:8;var L=q.T,G={};q.T=G,ab(c,!1,d,p);try{var oe=S(),we=q.S;if(we!==null&&we(G,oe),oe!==null&&typeof oe=="object"&&typeof oe.then=="function"){var Ee=GU(oe,v);rf(c,d,Ee,ri(c))}else rf(c,d,v,ri(c))}catch(Ae){rf(c,d,{then:function(){},status:"rejected",reason:Ae},ri())}finally{J.p=j,L!==null&&G.types!==null&&(L.types=G.types),q.T=L}}function eW(){}function sb(c,d,p,v){if(c.tag!==5)throw Error(r(476));var S=x7(c).queue;g7(c,S,d,ee,p===null?eW:function(){return v7(c),p(v)})}function x7(c){var d=c.memoizedState;if(d!==null)return d;d={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:ee},next:null};var p={};return d.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:p},next:null},c.memoizedState=d,c=c.alternate,c!==null&&(c.memoizedState=d),d}function v7(c){var d=x7(c);d.next===null&&(d=c.alternate.memoizedState),rf(c,d.next.queue,{},ri())}function ib(){return Kr(wf)}function y7(){return pr().memoizedState}function b7(){return pr().memoizedState}function tW(c){for(var d=c.return;d!==null;){switch(d.tag){case 24:case 3:var p=ri();c=ho(p);var v=fo(d,c,p);v!==null&&(zs(v,d,p),Kh(v,d,p)),d={cache:Dy()},c.payload=d;return}d=d.return}}function nW(c,d,p){var v=ri();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Dp(c)?S7(d,p):(p=ky(c,d,p,v),p!==null&&(zs(p,c,v),k7(p,d,v)))}function w7(c,d,p){var v=ri();rf(c,d,p,v)}function rf(c,d,p,v){var S={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(Dp(c))S7(d,S);else{var j=c.alternate;if(c.lanes===0&&(j===null||j.lanes===0)&&(j=d.lastRenderedReducer,j!==null))try{var L=d.lastRenderedState,G=j(L,p);if(S.hasEagerState=!0,S.eagerState=G,Zs(G,L))return mp(c,d,S,0),Bn===null&&fp(),!1}catch{}finally{}if(p=ky(c,d,S,v),p!==null)return zs(p,c,v),k7(p,d,v),!0}return!1}function ab(c,d,p,v){if(v={lane:2,revertLane:Bb(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},Dp(c)){if(d)throw Error(r(479))}else d=ky(c,p,v,2),d!==null&&zs(d,c,2)}function Dp(c){var d=c.alternate;return c===_t||d!==null&&d===_t}function S7(c,d){Wu=Cp=!0;var p=c.pending;p===null?d.next=d:(d.next=p.next,p.next=d),c.pending=d}function k7(c,d,p){if((p&4194048)!==0){var v=d.lanes;v&=c.pendingLanes,p|=v,d.lanes=p,W0(c,p)}}var sf={readContext:Kr,use:_p,useCallback:cr,useContext:cr,useEffect:cr,useImperativeHandle:cr,useLayoutEffect:cr,useInsertionEffect:cr,useMemo:cr,useReducer:cr,useRef:cr,useState:cr,useDebugValue:cr,useDeferredValue:cr,useTransition:cr,useSyncExternalStore:cr,useId:cr,useHostTransitionStatus:cr,useFormState:cr,useActionState:cr,useOptimistic:cr,useMemoCache:cr,useCacheRefresh:cr};sf.useEffectEvent=cr;var O7={readContext:Kr,use:_p,useCallback:function(c,d){return vs().memoizedState=[c,d===void 0?null:d],c},useContext:Kr,useEffect:l7,useImperativeHandle:function(c,d,p){p=p!=null?p.concat([c]):null,Ap(4194308,4,d7.bind(null,d,c),p)},useLayoutEffect:function(c,d){return Ap(4194308,4,c,d)},useInsertionEffect:function(c,d){Ap(4,2,c,d)},useMemo:function(c,d){var p=vs();d=d===void 0?null:d;var v=c();if(_c){lt(!0);try{c()}finally{lt(!1)}}return p.memoizedState=[v,d],v},useReducer:function(c,d,p){var v=vs();if(p!==void 0){var S=p(d);if(_c){lt(!0);try{p(d)}finally{lt(!1)}}}else S=d;return v.memoizedState=v.baseState=S,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:S},v.queue=c,c=c.dispatch=nW.bind(null,_t,c),[v.memoizedState,c]},useRef:function(c){var d=vs();return c={current:c},d.memoizedState=c},useState:function(c){c=Jy(c);var d=c.queue,p=w7.bind(null,_t,d);return d.dispatch=p,[c.memoizedState,p]},useDebugValue:nb,useDeferredValue:function(c,d){var p=vs();return rb(p,c,d)},useTransition:function(){var c=Jy(!1);return c=g7.bind(null,_t,c.queue,!0,!1),vs().memoizedState=c,[!1,c]},useSyncExternalStore:function(c,d,p){var v=_t,S=vs();if(en){if(p===void 0)throw Error(r(407));p=p()}else{if(p=d(),Bn===null)throw Error(r(349));(Xt&127)!==0||Vj(v,d,p)}S.memoizedState=p;var j={value:p,getSnapshot:d};return S.queue=j,l7(Wj.bind(null,v,j,c),[c]),v.flags|=2048,Xu(9,{destroy:void 0},Uj.bind(null,v,j,p,d),null),p},useId:function(){var c=vs(),d=Bn.identifierPrefix;if(en){var p=ma,v=fa;p=(v&~(1<<32-ut(v)-1)).toString(32)+p,d="_"+d+"R_"+p,p=Tp++,0<\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof v.is=="string"?L.createElement("select",{is:v.is}):L.createElement("select"),v.multiple?j.multiple=!0:v.size&&(j.size=v.size);break;default:j=typeof v.is=="string"?L.createElement(S,{is:v.is}):L.createElement(S)}}j[Dr]=d,j[Yr]=v;e:for(L=d.child;L!==null;){if(L.tag===5||L.tag===6)j.appendChild(L.stateNode);else if(L.tag!==4&&L.tag!==27&&L.child!==null){L.child.return=L,L=L.child;continue}if(L===d)break e;for(;L.sibling===null;){if(L.return===null||L.return===d)break e;L=L.return}L.sibling.return=L.return,L=L.sibling}d.stateNode=j;e:switch(es(j,S,v),S){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&ul(d)}}return Xn(d),bb(d,d.type,c===null?null:c.memoizedProps,d.pendingProps,p),null;case 6:if(c&&d.stateNode!=null)c.memoizedProps!==v&&ul(d);else{if(typeof v!="string"&&d.stateNode===null)throw Error(r(166));if(c=Z.current,qu(d)){if(c=d.stateNode,p=d.memoizedProps,v=null,S=Zr,S!==null)switch(S.tag){case 27:case 5:v=S.memoizedProps}c[Dr]=d,c=!!(c.nodeValue===p||v!==null&&v.suppressHydrationWarning===!0||QN(c.nodeValue,p)),c||oo(d,!0)}else c=eg(c).createTextNode(v),c[Dr]=d,d.stateNode=c}return Xn(d),null;case 31:if(p=d.memoizedState,c===null||c.memoizedState!==null){if(v=qu(d),p!==null){if(c===null){if(!v)throw Error(r(318));if(c=d.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(r(557));c[Dr]=d}else kc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Xn(d),c=!1}else p=_y(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=p),c=!0;if(!c)return d.flags&256?(ei(d),d):(ei(d),null);if((d.flags&128)!==0)throw Error(r(558))}return Xn(d),null;case 13:if(v=d.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(S=qu(d),v!==null&&v.dehydrated!==null){if(c===null){if(!S)throw Error(r(318));if(S=d.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(r(317));S[Dr]=d}else kc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Xn(d),S=!1}else S=_y(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=S),S=!0;if(!S)return d.flags&256?(ei(d),d):(ei(d),null)}return ei(d),(d.flags&128)!==0?(d.lanes=p,d):(p=v!==null,c=c!==null&&c.memoizedState!==null,p&&(v=d.child,S=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(S=v.alternate.memoizedState.cachePool.pool),j=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(j=v.memoizedState.cachePool.pool),j!==S&&(v.flags|=2048)),p!==c&&p&&(d.child.flags|=8192),Ip(d,d.updateQueue),Xn(d),null);case 4:return se(),c===null&&$b(d.stateNode.containerInfo),Xn(d),null;case 10:return al(d.type),Xn(d),null;case 19:if(K(mr),v=d.memoizedState,v===null)return Xn(d),null;if(S=(d.flags&128)!==0,j=v.rendering,j===null)if(S)lf(v,!1);else{if(ur!==0||c!==null&&(c.flags&128)!==0)for(c=d.child;c!==null;){if(j=Np(c),j!==null){for(d.flags|=128,lf(v,!1),c=j.updateQueue,d.updateQueue=c,Ip(d,c),d.subtreeFlags=0,c=p,p=d.child;p!==null;)wj(p,c),p=p.sibling;return I(mr,mr.current&1|2),en&&sl(d,v.treeForkCount),d.child}c=c.sibling}v.tail!==null&&$t()>Hp&&(d.flags|=128,S=!0,lf(v,!1),d.lanes=4194304)}else{if(!S)if(c=Np(j),c!==null){if(d.flags|=128,S=!0,c=c.updateQueue,d.updateQueue=c,Ip(d,c),lf(v,!0),v.tail===null&&v.tailMode==="hidden"&&!j.alternate&&!en)return Xn(d),null}else 2*$t()-v.renderingStartTime>Hp&&p!==536870912&&(d.flags|=128,S=!0,lf(v,!1),d.lanes=4194304);v.isBackwards?(j.sibling=d.child,d.child=j):(c=v.last,c!==null?c.sibling=j:d.child=j,v.last=j)}return v.tail!==null?(c=v.tail,v.rendering=c,v.tail=c.sibling,v.renderingStartTime=$t(),c.sibling=null,p=mr.current,I(mr,S?p&1|2:p&1),en&&sl(d,v.treeForkCount),c):(Xn(d),null);case 22:case 23:return ei(d),Qy(),v=d.memoizedState!==null,c!==null?c.memoizedState!==null!==v&&(d.flags|=8192):v&&(d.flags|=8192),v?(p&536870912)!==0&&(d.flags&128)===0&&(Xn(d),d.subtreeFlags&6&&(d.flags|=8192)):Xn(d),p=d.updateQueue,p!==null&&Ip(d,p.retryQueue),p=null,c!==null&&c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==p&&(d.flags|=2048),c!==null&&K(Nc),null;case 24:return p=null,c!==null&&(p=c.memoizedState.cache),d.memoizedState.cache!==p&&(d.flags|=2048),al(kr),Xn(d),null;case 25:return null;case 30:return null}throw Error(r(156,d.tag))}function lW(c,d){switch(Ty(d),d.tag){case 1:return c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 3:return al(kr),se(),c=d.flags,(c&65536)!==0&&(c&128)===0?(d.flags=c&-65537|128,d):null;case 26:case 27:case 5:return qe(d),null;case 31:if(d.memoizedState!==null){if(ei(d),d.alternate===null)throw Error(r(340));kc()}return c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 13:if(ei(d),c=d.memoizedState,c!==null&&c.dehydrated!==null){if(d.alternate===null)throw Error(r(340));kc()}return c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 19:return K(mr),null;case 4:return se(),null;case 10:return al(d.type),null;case 22:case 23:return ei(d),Qy(),c!==null&&K(Nc),c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 24:return al(kr),null;case 25:return null;default:return null}}function G7(c,d){switch(Ty(d),d.tag){case 3:al(kr),se();break;case 26:case 27:case 5:qe(d);break;case 4:se();break;case 31:d.memoizedState!==null&&ei(d);break;case 13:ei(d);break;case 19:K(mr);break;case 10:al(d.type);break;case 22:case 23:ei(d),Qy(),c!==null&&K(Nc);break;case 24:al(kr)}}function of(c,d){try{var p=d.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var S=v.next;p=S;do{if((p.tag&c)===c){v=void 0;var j=p.create,L=p.inst;v=j(),L.destroy=v}p=p.next}while(p!==S)}}catch(G){Nn(d,d.return,G)}}function go(c,d,p){try{var v=d.updateQueue,S=v!==null?v.lastEffect:null;if(S!==null){var j=S.next;v=j;do{if((v.tag&c)===c){var L=v.inst,G=L.destroy;if(G!==void 0){L.destroy=void 0,S=d;var oe=p,we=G;try{we()}catch(Ee){Nn(S,oe,Ee)}}}v=v.next}while(v!==j)}}catch(Ee){Nn(d,d.return,Ee)}}function X7(c){var d=c.updateQueue;if(d!==null){var p=c.stateNode;try{Ij(d,p)}catch(v){Nn(c,c.return,v)}}}function Y7(c,d,p){p.props=Mc(c.type,c.memoizedProps),p.state=c.memoizedState;try{p.componentWillUnmount()}catch(v){Nn(c,d,v)}}function cf(c,d){try{var p=c.ref;if(p!==null){switch(c.tag){case 26:case 27:case 5:var v=c.stateNode;break;case 30:v=c.stateNode;break;default:v=c.stateNode}typeof p=="function"?c.refCleanup=p(v):p.current=v}}catch(S){Nn(c,d,S)}}function pa(c,d){var p=c.ref,v=c.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(S){Nn(c,d,S)}finally{c.refCleanup=null,c=c.alternate,c!=null&&(c.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(S){Nn(c,d,S)}else p.current=null}function Z7(c){var d=c.type,p=c.memoizedProps,v=c.stateNode;try{e:switch(d){case"button":case"input":case"select":case"textarea":p.autoFocus&&v.focus();break e;case"img":p.src?v.src=p.src:p.srcSet&&(v.srcset=p.srcSet)}}catch(S){Nn(c,c.return,S)}}function wb(c,d,p){try{var v=c.stateNode;EW(v,c.type,p,d),v[Yr]=d}catch(S){Nn(c,c.return,S)}}function K7(c){return c.tag===5||c.tag===3||c.tag===26||c.tag===27&&ko(c.type)||c.tag===4}function Sb(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||K7(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.tag===27&&ko(c.type)||c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function kb(c,d,p){var v=c.tag;if(v===5||v===6)c=c.stateNode,d?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(c,d):(d=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,d.appendChild(c),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=tl));else if(v!==4&&(v===27&&ko(c.type)&&(p=c.stateNode,d=null),c=c.child,c!==null))for(kb(c,d,p),c=c.sibling;c!==null;)kb(c,d,p),c=c.sibling}function qp(c,d,p){var v=c.tag;if(v===5||v===6)c=c.stateNode,d?p.insertBefore(c,d):p.appendChild(c);else if(v!==4&&(v===27&&ko(c.type)&&(p=c.stateNode),c=c.child,c!==null))for(qp(c,d,p),c=c.sibling;c!==null;)qp(c,d,p),c=c.sibling}function J7(c){var d=c.stateNode,p=c.memoizedProps;try{for(var v=c.type,S=d.attributes;S.length;)d.removeAttributeNode(S[0]);es(d,v,p),d[Dr]=c,d[Yr]=p}catch(j){Nn(c,c.return,j)}}var dl=!1,Nr=!1,Ob=!1,eN=typeof WeakSet=="function"?WeakSet:Set,Hr=null;function oW(c,d){if(c=c.containerInfo,Vb=lg,c=hj(c),xy(c)){if("selectionStart"in c)var p={start:c.selectionStart,end:c.selectionEnd};else e:{p=(p=c.ownerDocument)&&p.defaultView||window;var v=p.getSelection&&p.getSelection();if(v&&v.rangeCount!==0){p=v.anchorNode;var S=v.anchorOffset,j=v.focusNode;v=v.focusOffset;try{p.nodeType,j.nodeType}catch{p=null;break e}var L=0,G=-1,oe=-1,we=0,Ee=0,Ae=c,ke=null;t:for(;;){for(var Ne;Ae!==p||S!==0&&Ae.nodeType!==3||(G=L+S),Ae!==j||v!==0&&Ae.nodeType!==3||(oe=L+v),Ae.nodeType===3&&(L+=Ae.nodeValue.length),(Ne=Ae.firstChild)!==null;)ke=Ae,Ae=Ne;for(;;){if(Ae===c)break t;if(ke===p&&++we===S&&(G=L),ke===j&&++Ee===v&&(oe=L),(Ne=Ae.nextSibling)!==null)break;Ae=ke,ke=Ae.parentNode}Ae=Ne}p=G===-1||oe===-1?null:{start:G,end:oe}}else p=null}p=p||{start:0,end:0}}else p=null;for(Ub={focusedElem:c,selectionRange:p},lg=!1,Hr=d;Hr!==null;)if(d=Hr,c=d.child,(d.subtreeFlags&1028)!==0&&c!==null)c.return=d,Hr=c;else for(;Hr!==null;){switch(d=Hr,j=d.alternate,c=d.flags,d.tag){case 0:if((c&4)!==0&&(c=d.updateQueue,c=c!==null?c.events:null,c!==null))for(p=0;p title"))),es(j,v,p),j[Dr]=c,Sr(j),v=j;break e;case"link":var L=a8("link","href",S).get(v+(p.href||""));if(L){for(var G=0;GMn&&(L=Mn,Mn=vt,vt=L);var pe=uj(G,vt),he=uj(G,Mn);if(pe&&he&&(Ne.rangeCount!==1||Ne.anchorNode!==pe.node||Ne.anchorOffset!==pe.offset||Ne.focusNode!==he.node||Ne.focusOffset!==he.offset)){var ye=Ae.createRange();ye.setStart(pe.node,pe.offset),Ne.removeAllRanges(),vt>Mn?(Ne.addRange(ye),Ne.extend(he.node,he.offset)):(ye.setEnd(he.node,he.offset),Ne.addRange(ye))}}}}for(Ae=[],Ne=G;Ne=Ne.parentNode;)Ne.nodeType===1&&Ae.push({element:Ne,left:Ne.scrollLeft,top:Ne.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;Gp?32:p,q.T=null,p=Mb,Mb=null;var j=bo,L=gl;if(zr=0,ed=bo=null,gl=0,(Sn&6)!==0)throw Error(r(331));var G=Sn;if(Sn|=4,dN(j.current),oN(j,j.current,L,p),Sn=G,pf(0,!1),Ce&&typeof Ce.onPostCommitFiberRoot=="function")try{Ce.onPostCommitFiberRoot(ue,j)}catch{}return!0}finally{J.p=S,q.T=v,EN(c,d)}}function MN(c,d,p){d=wi(p,d),d=ub(c.stateNode,d,2),c=fo(c,d,2),c!==null&&(pc(c,2),ga(c))}function Nn(c,d,p){if(c.tag===3)MN(c,c,p);else for(;d!==null;){if(d.tag===3){MN(d,c,p);break}else if(d.tag===1){var v=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(yo===null||!yo.has(v))){c=wi(p,c),p=A7(2),v=fo(d,p,2),v!==null&&(R7(p,v,d,c),pc(v,2),ga(v));break}}d=d.return}}function zb(c,d,p){var v=c.pingCache;if(v===null){v=c.pingCache=new dW;var S=new Set;v.set(d,S)}else S=v.get(d),S===void 0&&(S=new Set,v.set(d,S));S.has(p)||(Cb=!0,S.add(p),c=gW.bind(null,c,d,p),d.then(c,c))}function gW(c,d,p){var v=c.pingCache;v!==null&&v.delete(d),c.pingedLanes|=c.suspendedLanes&p,c.warmLanes&=~p,Bn===c&&(Xt&p)===p&&(ur===4||ur===3&&(Xt&62914560)===Xt&&300>$t()-Qp?(Sn&2)===0&&td(c,0):Tb|=p,Ju===Xt&&(Ju=0)),ga(c)}function AN(c,d){d===0&&(d=to()),c=wc(c,d),c!==null&&(pc(c,d),ga(c))}function xW(c){var d=c.memoizedState,p=0;d!==null&&(p=d.retryLane),AN(c,p)}function vW(c,d){var p=0;switch(c.tag){case 31:case 13:var v=c.stateNode,S=c.memoizedState;S!==null&&(p=S.retryLane);break;case 19:v=c.stateNode;break;case 22:v=c.stateNode._retryCache;break;default:throw Error(r(314))}v!==null&&v.delete(d),AN(c,p)}function yW(c,d){return bt(c,d)}var Yp=null,rd=null,Pb=!1,Zp=!1,Lb=!1,So=0;function ga(c){c!==rd&&c.next===null&&(rd===null?Yp=rd=c:rd=rd.next=c),Zp=!0,Pb||(Pb=!0,wW())}function pf(c,d){if(!Lb&&Zp){Lb=!0;do for(var p=!1,v=Yp;v!==null;){if(c!==0){var S=v.pendingLanes;if(S===0)var j=0;else{var L=v.suspendedLanes,G=v.pingedLanes;j=(1<<31-ut(42|c)+1)-1,j&=S&~(L&~G),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(p=!0,PN(v,j))}else j=Xt,j=eo(v,v===Bn?j:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(j&3)===0||Xa(v,j)||(p=!0,PN(v,j));v=v.next}while(p);Lb=!1}}function bW(){RN()}function RN(){Zp=Pb=!1;var c=0;So!==0&&MW()&&(c=So);for(var d=$t(),p=null,v=Yp;v!==null;){var S=v.next,j=DN(v,d);j===0?(v.next=null,p===null?Yp=S:p.next=S,S===null&&(rd=p)):(p=v,(c!==0||(j&3)!==0)&&(Zp=!0)),v=S}zr!==0&&zr!==5||pf(c),So!==0&&(So=0)}function DN(c,d){for(var p=c.suspendedLanes,v=c.pingedLanes,S=c.expirationTimes,j=c.pendingLanes&-62914561;0G)break;var Ee=oe.transferSize,Ae=oe.initiatorType;Ee&&HN(Ae)&&(oe=oe.responseEnd,L+=Ee*(oe"u"?null:document;function n8(c,d,p){var v=sd;if(v&&typeof d=="string"&&d){var S=yi(d);S='link[rel="'+c+'"][href="'+S+'"]',typeof p=="string"&&(S+='[crossorigin="'+p+'"]'),t8.has(S)||(t8.add(S),c={rel:c,crossOrigin:p,href:d},v.querySelector(S)===null&&(d=v.createElement("link"),es(d,"link",c),Sr(d),v.head.appendChild(d)))}}function qW(c){xl.D(c),n8("dns-prefetch",c,null)}function FW(c,d){xl.C(c,d),n8("preconnect",c,d)}function $W(c,d,p){xl.L(c,d,p);var v=sd;if(v&&c&&d){var S='link[rel="preload"][as="'+yi(d)+'"]';d==="image"&&p&&p.imageSrcSet?(S+='[imagesrcset="'+yi(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(S+='[imagesizes="'+yi(p.imageSizes)+'"]')):S+='[href="'+yi(c)+'"]';var j=S;switch(d){case"style":j=id(c);break;case"script":j=ad(c)}Ci.has(j)||(c=m({rel:"preload",href:d==="image"&&p&&p.imageSrcSet?void 0:c,as:d},p),Ci.set(j,c),v.querySelector(S)!==null||d==="style"&&v.querySelector(yf(j))||d==="script"&&v.querySelector(bf(j))||(d=v.createElement("link"),es(d,"link",c),Sr(d),v.head.appendChild(d)))}}function QW(c,d){xl.m(c,d);var p=sd;if(p&&c){var v=d&&typeof d.as=="string"?d.as:"script",S='link[rel="modulepreload"][as="'+yi(v)+'"][href="'+yi(c)+'"]',j=S;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=ad(c)}if(!Ci.has(j)&&(c=m({rel:"modulepreload",href:c},d),Ci.set(j,c),p.querySelector(S)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(bf(j)))return}v=p.createElement("link"),es(v,"link",c),Sr(v),p.head.appendChild(v)}}}function HW(c,d,p){xl.S(c,d,p);var v=sd;if(v&&c){var S=so(v).hoistableStyles,j=id(c);d=d||"default";var L=S.get(j);if(!L){var G={loading:0,preload:null};if(L=v.querySelector(yf(j)))G.loading=5;else{c=m({rel:"stylesheet",href:c,"data-precedence":d},p),(p=Ci.get(j))&&Jb(c,p);var oe=L=v.createElement("link");Sr(oe),es(oe,"link",c),oe._p=new Promise(function(we,Ee){oe.onload=we,oe.onerror=Ee}),oe.addEventListener("load",function(){G.loading|=1}),oe.addEventListener("error",function(){G.loading|=2}),G.loading|=4,ng(L,d,v)}L={type:"stylesheet",instance:L,count:1,state:G},S.set(j,L)}}}function VW(c,d){xl.X(c,d);var p=sd;if(p&&c){var v=so(p).hoistableScripts,S=ad(c),j=v.get(S);j||(j=p.querySelector(bf(S)),j||(c=m({src:c,async:!0},d),(d=Ci.get(S))&&e2(c,d),j=p.createElement("script"),Sr(j),es(j,"link",c),p.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},v.set(S,j))}}function UW(c,d){xl.M(c,d);var p=sd;if(p&&c){var v=so(p).hoistableScripts,S=ad(c),j=v.get(S);j||(j=p.querySelector(bf(S)),j||(c=m({src:c,async:!0,type:"module"},d),(d=Ci.get(S))&&e2(c,d),j=p.createElement("script"),Sr(j),es(j,"link",c),p.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},v.set(S,j))}}function r8(c,d,p,v){var S=(S=Z.current)?tg(S):null;if(!S)throw Error(r(446));switch(c){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(d=id(p.href),p=so(S).hoistableStyles,v=p.get(d),v||(v={type:"style",instance:null,count:0,state:null},p.set(d,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){c=id(p.href);var j=so(S).hoistableStyles,L=j.get(c);if(L||(S=S.ownerDocument||S,L={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(c,L),(j=S.querySelector(yf(c)))&&!j._p&&(L.instance=j,L.state.loading=5),Ci.has(c)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},Ci.set(c,p),j||WW(S,c,p,L.state))),d&&v===null)throw Error(r(528,""));return L}if(d&&v!==null)throw Error(r(529,""));return null;case"script":return d=p.async,p=p.src,typeof p=="string"&&d&&typeof d!="function"&&typeof d!="symbol"?(d=ad(p),p=so(S).hoistableScripts,v=p.get(d),v||(v={type:"script",instance:null,count:0,state:null},p.set(d,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,c))}}function id(c){return'href="'+yi(c)+'"'}function yf(c){return'link[rel="stylesheet"]['+c+"]"}function s8(c){return m({},c,{"data-precedence":c.precedence,precedence:null})}function WW(c,d,p,v){c.querySelector('link[rel="preload"][as="style"]['+d+"]")?v.loading=1:(d=c.createElement("link"),v.preload=d,d.addEventListener("load",function(){return v.loading|=1}),d.addEventListener("error",function(){return v.loading|=2}),es(d,"link",p),Sr(d),c.head.appendChild(d))}function ad(c){return'[src="'+yi(c)+'"]'}function bf(c){return"script[async]"+c}function i8(c,d,p){if(d.count++,d.instance===null)switch(d.type){case"style":var v=c.querySelector('style[data-href~="'+yi(p.href)+'"]');if(v)return d.instance=v,Sr(v),v;var S=m({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return v=(c.ownerDocument||c).createElement("style"),Sr(v),es(v,"style",S),ng(v,p.precedence,c),d.instance=v;case"stylesheet":S=id(p.href);var j=c.querySelector(yf(S));if(j)return d.state.loading|=4,d.instance=j,Sr(j),j;v=s8(p),(S=Ci.get(S))&&Jb(v,S),j=(c.ownerDocument||c).createElement("link"),Sr(j);var L=j;return L._p=new Promise(function(G,oe){L.onload=G,L.onerror=oe}),es(j,"link",v),d.state.loading|=4,ng(j,p.precedence,c),d.instance=j;case"script":return j=ad(p.src),(S=c.querySelector(bf(j)))?(d.instance=S,Sr(S),S):(v=p,(S=Ci.get(j))&&(v=m({},p),e2(v,S)),c=c.ownerDocument||c,S=c.createElement("script"),Sr(S),es(S,"link",v),c.head.appendChild(S),d.instance=S);case"void":return null;default:throw Error(r(443,d.type))}else d.type==="stylesheet"&&(d.state.loading&4)===0&&(v=d.instance,d.state.loading|=4,ng(v,p.precedence,c));return d.instance}function ng(c,d,p){for(var v=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),S=v.length?v[v.length-1]:null,j=S,L=0;L title"):null)}function GW(c,d,p){if(p===1||d.itemProp!=null)return!1;switch(c){case"meta":case"title":return!0;case"style":if(typeof d.precedence!="string"||typeof d.href!="string"||d.href==="")break;return!0;case"link":if(typeof d.rel!="string"||typeof d.href!="string"||d.href===""||d.onLoad||d.onError)break;switch(d.rel){case"stylesheet":return c=d.disabled,typeof d.precedence=="string"&&c==null;default:return!0}case"script":if(d.async&&typeof d.async!="function"&&typeof d.async!="symbol"&&!d.onLoad&&!d.onError&&d.src&&typeof d.src=="string")return!0}return!1}function o8(c){return!(c.type==="stylesheet"&&(c.state.loading&3)===0)}function XW(c,d,p,v){if(p.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var S=id(v.href),j=d.querySelector(yf(S));if(j){d=j._p,d!==null&&typeof d=="object"&&typeof d.then=="function"&&(c.count++,c=sg.bind(c),d.then(c,c)),p.state.loading|=4,p.instance=j,Sr(j);return}j=d.ownerDocument||d,v=s8(v),(S=Ci.get(S))&&Jb(v,S),j=j.createElement("link"),Sr(j);var L=j;L._p=new Promise(function(G,oe){L.onload=G,L.onerror=oe}),es(j,"link",v),p.instance=j}c.stylesheets===null&&(c.stylesheets=new Map),c.stylesheets.set(p,d),(d=p.state.preload)&&(p.state.loading&3)===0&&(c.count++,p=sg.bind(c),d.addEventListener("load",p),d.addEventListener("error",p))}}var t2=0;function YW(c,d){return c.stylesheets&&c.count===0&&ag(c,c.stylesheets),0t2?50:800)+d);return c.unsuspend=p,function(){c.unsuspend=null,clearTimeout(v),clearTimeout(S)}}:null}function sg(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ag(this,this.stylesheets);else if(this.unsuspend){var c=this.unsuspend;this.unsuspend=null,c()}}}var ig=null;function ag(c,d){c.stylesheets=null,c.unsuspend!==null&&(c.count++,ig=new Map,d.forEach(ZW,c),ig=null,sg.call(c))}function ZW(c,d){if(!(d.state.loading&4)){var p=ig.get(c);if(p)var v=p.get(null);else{p=new Map,ig.set(c,p);for(var S=c.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),u2.exports=eY(),u2.exports}var nY=tY();function zR(t,e){return function(){return t.apply(e,arguments)}}const{toString:rY}=Object.prototype,{getPrototypeOf:ak}=Object,{iterator:Y1,toStringTag:PR}=Symbol,Z1=(t=>e=>{const n=rY.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),oa=t=>(t=t.toLowerCase(),e=>Z1(e)===t),K1=t=>e=>typeof e===t,{isArray:gh}=Array,Xd=K1("undefined");function l0(t){return t!==null&&!Xd(t)&&t.constructor!==null&&!Xd(t.constructor)&&Qs(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const LR=oa("ArrayBuffer");function sY(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&LR(t.buffer),e}const iY=K1("string"),Qs=K1("function"),BR=K1("number"),o0=t=>t!==null&&typeof t=="object",aY=t=>t===!0||t===!1,xx=t=>{if(Z1(t)!=="object")return!1;const e=ak(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(PR in t)&&!(Y1 in t)},lY=t=>{if(!o0(t)||l0(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},oY=oa("Date"),cY=oa("File"),uY=oa("Blob"),dY=oa("FileList"),hY=t=>o0(t)&&Qs(t.pipe),fY=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Qs(t.append)&&((e=Z1(t))==="formdata"||e==="object"&&Qs(t.toString)&&t.toString()==="[object FormData]"))},mY=oa("URLSearchParams"),[pY,gY,xY,vY]=["ReadableStream","Request","Response","Headers"].map(oa),yY=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function c0(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),gh(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const Hc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,qR=t=>!Xd(t)&&t!==Hc;function F5(){const{caseless:t,skipUndefined:e}=qR(this)&&this||{},n={},r=(s,i)=>{const a=t&&IR(n,i)||i;xx(n[a])&&xx(s)?n[a]=F5(n[a],s):xx(s)?n[a]=F5({},s):gh(s)?n[a]=s.slice():(!e||!Xd(s))&&(n[a]=s)};for(let s=0,i=arguments.length;s(c0(e,(s,i)=>{n&&Qs(s)?t[i]=zR(s,n):t[i]=s},{allOwnKeys:r}),t),wY=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),SY=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},kY=(t,e,n,r)=>{let s,i,a;const o={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)a=s[i],(!r||r(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=n!==!1&&ak(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},OY=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},jY=t=>{if(!t)return null;if(gh(t))return t;let e=t.length;if(!BR(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},NY=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&ak(Uint8Array)),CY=(t,e)=>{const r=(t&&t[Y1]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},TY=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},EY=oa("HTMLFormElement"),_Y=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),z8=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),MY=oa("RegExp"),FR=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};c0(n,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(r[i]=a||s)}),Object.defineProperties(t,r)},AY=t=>{FR(t,(e,n)=>{if(Qs(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Qs(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},RY=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return gh(t)?r(t):r(String(t).split(e)),n},DY=()=>{},zY=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function PY(t){return!!(t&&Qs(t.append)&&t[PR]==="FormData"&&t[Y1])}const LY=t=>{const e=new Array(10),n=(r,s)=>{if(o0(r)){if(e.indexOf(r)>=0)return;if(l0(r))return r;if(!("toJSON"in r)){e[s]=r;const i=gh(r)?[]:{};return c0(r,(a,o)=>{const u=n(a,s+1);!Xd(u)&&(i[o]=u)}),e[s]=void 0,i}}return r};return n(t,0)},BY=oa("AsyncFunction"),IY=t=>t&&(o0(t)||Qs(t))&&Qs(t.then)&&Qs(t.catch),$R=((t,e)=>t?setImmediate:e?((n,r)=>(Hc.addEventListener("message",({source:s,data:i})=>{s===Hc&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),Hc.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Qs(Hc.postMessage)),qY=typeof queueMicrotask<"u"?queueMicrotask.bind(Hc):typeof process<"u"&&process.nextTick||$R,FY=t=>t!=null&&Qs(t[Y1]),je={isArray:gh,isArrayBuffer:LR,isBuffer:l0,isFormData:fY,isArrayBufferView:sY,isString:iY,isNumber:BR,isBoolean:aY,isObject:o0,isPlainObject:xx,isEmptyObject:lY,isReadableStream:pY,isRequest:gY,isResponse:xY,isHeaders:vY,isUndefined:Xd,isDate:oY,isFile:cY,isBlob:uY,isRegExp:MY,isFunction:Qs,isStream:hY,isURLSearchParams:mY,isTypedArray:NY,isFileList:dY,forEach:c0,merge:F5,extend:bY,trim:yY,stripBOM:wY,inherits:SY,toFlatObject:kY,kindOf:Z1,kindOfTest:oa,endsWith:OY,toArray:jY,forEachEntry:CY,matchAll:TY,isHTMLForm:EY,hasOwnProperty:z8,hasOwnProp:z8,reduceDescriptors:FR,freezeMethods:AY,toObjectSet:RY,toCamelCase:_Y,noop:DY,toFiniteNumber:zY,findKey:IR,global:Hc,isContextDefined:qR,isSpecCompliantForm:PY,toJSONObject:LY,isAsyncFn:BY,isThenable:IY,setImmediate:$R,asap:qY,isIterable:FY};function Mt(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}je.inherits(Mt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:je.toJSONObject(this.config),code:this.code,status:this.status}}});const QR=Mt.prototype,HR={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{HR[t]={value:t}});Object.defineProperties(Mt,HR);Object.defineProperty(QR,"isAxiosError",{value:!0});Mt.from=(t,e,n,r,s,i)=>{const a=Object.create(QR);je.toFlatObject(t,a,function(f){return f!==Error.prototype},h=>h!=="isAxiosError");const o=t&&t.message?t.message:"Error",u=e==null&&t?t.code:e;return Mt.call(a,o,u,n,r,s),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",i&&Object.assign(a,i),a};const $Y=null;function $5(t){return je.isPlainObject(t)||je.isArray(t)}function VR(t){return je.endsWith(t,"[]")?t.slice(0,-2):t}function P8(t,e,n){return t?t.concat(e).map(function(s,i){return s=VR(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function QY(t){return je.isArray(t)&&!t.some($5)}const HY=je.toFlatObject(je,{},null,function(e){return/^is[A-Z]/.test(e)});function J1(t,e,n){if(!je.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=je.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,b){return!je.isUndefined(b[w])});const r=n.metaTokens,s=n.visitor||f,i=n.dots,a=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&je.isSpecCompliantForm(e);if(!je.isFunction(s))throw new TypeError("visitor must be a function");function h(y){if(y===null)return"";if(je.isDate(y))return y.toISOString();if(je.isBoolean(y))return y.toString();if(!u&&je.isBlob(y))throw new Mt("Blob is not supported. Use a Buffer instead.");return je.isArrayBuffer(y)||je.isTypedArray(y)?u&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function f(y,w,b){let k=y;if(y&&!b&&typeof y=="object"){if(je.endsWith(w,"{}"))w=r?w:w.slice(0,-2),y=JSON.stringify(y);else if(je.isArray(y)&&QY(y)||(je.isFileList(y)||je.endsWith(w,"[]"))&&(k=je.toArray(y)))return w=VR(w),k.forEach(function(C,T){!(je.isUndefined(C)||C===null)&&e.append(a===!0?P8([w],T,i):a===null?w:w+"[]",h(C))}),!1}return $5(y)?!0:(e.append(P8(b,w,i),h(y)),!1)}const m=[],g=Object.assign(HY,{defaultVisitor:f,convertValue:h,isVisitable:$5});function x(y,w){if(!je.isUndefined(y)){if(m.indexOf(y)!==-1)throw Error("Circular reference detected in "+w.join("."));m.push(y),je.forEach(y,function(k,N){(!(je.isUndefined(k)||k===null)&&s.call(e,k,je.isString(N)?N.trim():N,w,g))===!0&&x(k,w?w.concat(N):[N])}),m.pop()}}if(!je.isObject(t))throw new TypeError("data must be an object");return x(t),e}function L8(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function lk(t,e){this._pairs=[],t&&J1(t,this,e)}const UR=lk.prototype;UR.append=function(e,n){this._pairs.push([e,n])};UR.toString=function(e){const n=e?function(r){return e.call(this,r,L8)}:L8;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function VY(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function WR(t,e,n){if(!e)return t;const r=n&&n.encode||VY;je.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=je.isURLSearchParams(e)?e.toString():new lk(e,n).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class B8{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){je.forEach(this.handlers,function(r){r!==null&&e(r)})}}const GR={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},UY=typeof URLSearchParams<"u"?URLSearchParams:lk,WY=typeof FormData<"u"?FormData:null,GY=typeof Blob<"u"?Blob:null,XY={isBrowser:!0,classes:{URLSearchParams:UY,FormData:WY,Blob:GY},protocols:["http","https","file","blob","url","data"]},ok=typeof window<"u"&&typeof document<"u",Q5=typeof navigator=="object"&&navigator||void 0,YY=ok&&(!Q5||["ReactNative","NativeScript","NS"].indexOf(Q5.product)<0),ZY=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",KY=ok&&window.location.href||"http://localhost",JY=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ok,hasStandardBrowserEnv:YY,hasStandardBrowserWebWorkerEnv:ZY,navigator:Q5,origin:KY},Symbol.toStringTag,{value:"Module"})),ds={...JY,...XY};function eZ(t,e){return J1(t,new ds.classes.URLSearchParams,{visitor:function(n,r,s,i){return ds.isNode&&je.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function tZ(t){return je.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function nZ(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return a=!a&&je.isArray(s)?s.length:a,u?(je.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!o):((!s[a]||!je.isObject(s[a]))&&(s[a]=[]),e(n,r,s[a],i)&&je.isArray(s[a])&&(s[a]=nZ(s[a])),!o)}if(je.isFormData(t)&&je.isFunction(t.entries)){const n={};return je.forEachEntry(t,(r,s)=>{e(tZ(r),s,n,0)}),n}return null}function rZ(t,e,n){if(je.isString(t))try{return(e||JSON.parse)(t),je.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const u0={transitional:GR,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=je.isObject(e);if(i&&je.isHTMLForm(e)&&(e=new FormData(e)),je.isFormData(e))return s?JSON.stringify(XR(e)):e;if(je.isArrayBuffer(e)||je.isBuffer(e)||je.isStream(e)||je.isFile(e)||je.isBlob(e)||je.isReadableStream(e))return e;if(je.isArrayBufferView(e))return e.buffer;if(je.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return eZ(e,this.formSerializer).toString();if((o=je.isFileList(e))||r.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return J1(o?{"files[]":e}:e,u&&new u,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),rZ(e)):e}],transformResponse:[function(e){const n=this.transitional||u0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(je.isResponse(e)||je.isReadableStream(e))return e;if(e&&je.isString(e)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(o){if(a)throw o.name==="SyntaxError"?Mt.from(o,Mt.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ds.classes.FormData,Blob:ds.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};je.forEach(["delete","get","head","post","put","patch"],t=>{u0.headers[t]={}});const sZ=je.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),iZ=t=>{const e={};let n,r,s;return t&&t.split(` `).forEach(function(a){s=a.indexOf(":"),n=a.substring(0,s).trim().toLowerCase(),r=a.substring(s+1).trim(),!(!n||e[n]&&sZ[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},I8=Symbol("internals");function Cf(t){return t&&String(t).trim().toLowerCase()}function vx(t){return t===!1||t==null?t:je.isArray(t)?t.map(vx):String(t)}function aZ(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const lZ=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function f2(t,e,n,r,s){if(je.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!je.isString(e)){if(je.isString(r))return e.indexOf(r)!==-1;if(je.isRegExp(r))return r.test(e)}}function oZ(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function cZ(t,e){const n=je.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,a){return this[r].call(this,e,s,i,a)},configurable:!0})})}let Hs=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(o,u,h){const f=Cf(u);if(!f)throw new Error("header name must be a non-empty string");const m=je.findKey(s,f);(!m||s[m]===void 0||h===!0||h===void 0&&s[m]!==!1)&&(s[m||u]=vx(o))}const a=(o,u)=>je.forEach(o,(h,f)=>i(h,f,u));if(je.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(je.isString(e)&&(e=e.trim())&&!lZ(e))a(iZ(e),n);else if(je.isObject(e)&&je.isIterable(e)){let o={},u,h;for(const f of e){if(!je.isArray(f))throw TypeError("Object iterator must return a key-value pair");o[h=f[0]]=(u=o[h])?je.isArray(u)?[...u,f[1]]:[u,f[1]]:f[1]}a(o,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Cf(e),e){const r=je.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return aZ(s);if(je.isFunction(n))return n.call(this,s,r);if(je.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Cf(e),e){const r=je.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||f2(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(a){if(a=Cf(a),a){const o=je.findKey(r,a);o&&(!n||f2(r,r[o],o,n))&&(delete r[o],s=!0)}}return je.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||f2(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return je.forEach(this,(s,i)=>{const a=je.findKey(r,i);if(a){n[a]=vx(s),delete n[i];return}const o=e?oZ(i):String(i).trim();o!==i&&delete n[i],n[o]=vx(s),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return je.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&je.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[I8]=this[I8]={accessors:{}}).accessors,s=this.prototype;function i(a){const o=Cf(a);r[o]||(cZ(s,a),r[o]=!0)}return je.isArray(e)?e.forEach(i):i(e),this}};Hs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);je.reduceDescriptors(Hs.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});je.freezeMethods(Hs);function m2(t,e){const n=this||u0,r=e||n,s=Hs.from(r.headers);let i=r.data;return je.forEach(t,function(o){i=o.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function YR(t){return!!(t&&t.__CANCEL__)}function xh(t,e,n){Mt.call(this,t??"canceled",Mt.ERR_CANCELED,e,n),this.name="CanceledError"}je.inherits(xh,Mt,{__CANCEL__:!0});function ZR(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Mt("Request failed with status code "+n.status,[Mt.ERR_BAD_REQUEST,Mt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function uZ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function dZ(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,a;return e=e!==void 0?e:1e3,function(u){const h=Date.now(),f=r[i];a||(a=h),n[s]=u,r[s]=h;let m=i,g=0;for(;m!==s;)g+=n[m++],m=m%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-a{n=f,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const f=Date.now(),m=f-n;m>=r?a(h,f):(s=h,i||(i=setTimeout(()=>{i=null,a(s)},r-m)))},()=>s&&a(s)]}const Gx=(t,e,n=3)=>{let r=0;const s=dZ(50,250);return hZ(i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,u=a-r,h=s(u),f=a<=o;r=a;const m={loaded:a,total:o,progress:o?a/o:void 0,bytes:u,rate:h||void 0,estimated:h&&o&&f?(o-a)/h:void 0,event:i,lengthComputable:o!=null,[e?"download":"upload"]:!0};t(m)},n)},q8=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},F8=t=>(...e)=>je.asap(()=>t(...e)),fZ=ds.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ds.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ds.origin),ds.navigator&&/(msie|trident)/i.test(ds.navigator.userAgent)):()=>!0,mZ=ds.hasStandardBrowserEnv?{write(t,e,n,r,s,i,a){if(typeof document>"u")return;const o=[`${t}=${encodeURIComponent(e)}`];je.isNumber(n)&&o.push(`expires=${new Date(n).toUTCString()}`),je.isString(r)&&o.push(`path=${r}`),je.isString(s)&&o.push(`domain=${s}`),i===!0&&o.push("secure"),je.isString(a)&&o.push(`SameSite=${a}`),document.cookie=o.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function pZ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function gZ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function KR(t,e,n){let r=!pZ(e);return t&&(r||n==!1)?gZ(t,e):e}const $8=t=>t instanceof Hs?{...t}:t;function iu(t,e){e=e||{};const n={};function r(h,f,m,g){return je.isPlainObject(h)&&je.isPlainObject(f)?je.merge.call({caseless:g},h,f):je.isPlainObject(f)?je.merge({},f):je.isArray(f)?f.slice():f}function s(h,f,m,g){if(je.isUndefined(f)){if(!je.isUndefined(h))return r(void 0,h,m,g)}else return r(h,f,m,g)}function i(h,f){if(!je.isUndefined(f))return r(void 0,f)}function a(h,f){if(je.isUndefined(f)){if(!je.isUndefined(h))return r(void 0,h)}else return r(void 0,f)}function o(h,f,m){if(m in e)return r(h,f);if(m in t)return r(void 0,h)}const u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(h,f,m)=>s($8(h),$8(f),m,!0)};return je.forEach(Object.keys({...t,...e}),function(f){const m=u[f]||s,g=m(t[f],e[f],f);je.isUndefined(g)&&m!==o||(n[f]=g)}),n}const JR=t=>{const e=iu({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:o}=e;if(e.headers=a=Hs.from(a),e.url=WR(KR(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),je.isFormData(n)){if(ds.hasStandardBrowserEnv||ds.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(je.isFunction(n.getHeaders)){const u=n.getHeaders(),h=["content-type","content-length"];Object.entries(u).forEach(([f,m])=>{h.includes(f.toLowerCase())&&a.set(f,m)})}}if(ds.hasStandardBrowserEnv&&(r&&je.isFunction(r)&&(r=r(e)),r||r!==!1&&fZ(e.url))){const u=s&&i&&mZ.read(i);u&&a.set(s,u)}return e},xZ=typeof XMLHttpRequest<"u",vZ=xZ&&function(t){return new Promise(function(n,r){const s=JR(t);let i=s.data;const a=Hs.from(s.headers).normalize();let{responseType:o,onUploadProgress:u,onDownloadProgress:h}=s,f,m,g,x,y;function w(){x&&x(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let b=new XMLHttpRequest;b.open(s.method.toUpperCase(),s.url,!0),b.timeout=s.timeout;function k(){if(!b)return;const C=Hs.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),E={data:!o||o==="text"||o==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:C,config:t,request:b};ZR(function(A){n(A),w()},function(A){r(A),w()},E),b=null}"onloadend"in b?b.onloadend=k:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(k)},b.onabort=function(){b&&(r(new Mt("Request aborted",Mt.ECONNABORTED,t,b)),b=null)},b.onerror=function(T){const E=T&&T.message?T.message:"Network Error",_=new Mt(E,Mt.ERR_NETWORK,t,b);_.event=T||null,r(_),b=null},b.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||GR;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new Mt(T,E.clarifyTimeoutError?Mt.ETIMEDOUT:Mt.ECONNABORTED,t,b)),b=null},i===void 0&&a.setContentType(null),"setRequestHeader"in b&&je.forEach(a.toJSON(),function(T,E){b.setRequestHeader(E,T)}),je.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),o&&o!=="json"&&(b.responseType=s.responseType),h&&([g,y]=Gx(h,!0),b.addEventListener("progress",g)),u&&b.upload&&([m,x]=Gx(u),b.upload.addEventListener("progress",m),b.upload.addEventListener("loadend",x)),(s.cancelToken||s.signal)&&(f=C=>{b&&(r(!C||C.type?new xh(null,t,b):C),b.abort(),b=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const N=uZ(s.url);if(N&&ds.protocols.indexOf(N)===-1){r(new Mt("Unsupported protocol "+N+":",Mt.ERR_BAD_REQUEST,t));return}b.send(i||null)})},yZ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(h){if(!s){s=!0,o();const f=h instanceof Error?h:this.reason;r.abort(f instanceof Mt?f:new xh(f instanceof Error?f.message:f))}};let a=e&&setTimeout(()=>{a=null,i(new Mt(`timeout ${e} of ms exceeded`,Mt.ETIMEDOUT))},e);const o=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:u}=r;return u.unsubscribe=()=>je.asap(o),u}},bZ=function*(t,e){let n=t.byteLength;if(n{const s=wZ(t,e);let i=0,a,o=u=>{a||(a=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:h,value:f}=await s.next();if(h){o(),u.close();return}let m=f.byteLength;if(n){let g=i+=m;n(g)}u.enqueue(new Uint8Array(f))}catch(h){throw o(h),h}},cancel(u){return o(u),s.return()}},{highWaterMark:2})},H8=64*1024,{isFunction:xg}=je,kZ=(({Request:t,Response:e})=>({Request:t,Response:e}))(je.global),{ReadableStream:V8,TextEncoder:U8}=je.global,W8=(t,...e)=>{try{return!!t(...e)}catch{return!1}},OZ=t=>{t=je.merge.call({skipUndefined:!0},kZ,t);const{fetch:e,Request:n,Response:r}=t,s=e?xg(e):typeof fetch=="function",i=xg(n),a=xg(r);if(!s)return!1;const o=s&&xg(V8),u=s&&(typeof U8=="function"?(y=>w=>y.encode(w))(new U8):async y=>new Uint8Array(await new n(y).arrayBuffer())),h=i&&o&&W8(()=>{let y=!1;const w=new n(ds.origin,{body:new V8,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!w}),f=a&&o&&W8(()=>je.isReadableStream(new r("").body)),m={stream:f&&(y=>y.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!m[y]&&(m[y]=(w,b)=>{let k=w&&w[y];if(k)return k.call(w);throw new Mt(`Response type '${y}' is not supported`,Mt.ERR_NOT_SUPPORT,b)})});const g=async y=>{if(y==null)return 0;if(je.isBlob(y))return y.size;if(je.isSpecCompliantForm(y))return(await new n(ds.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(je.isArrayBufferView(y)||je.isArrayBuffer(y))return y.byteLength;if(je.isURLSearchParams(y)&&(y=y+""),je.isString(y))return(await u(y)).byteLength},x=async(y,w)=>{const b=je.toFiniteNumber(y.getContentLength());return b??g(w)};return async y=>{let{url:w,method:b,data:k,signal:N,cancelToken:C,timeout:T,onDownloadProgress:E,onUploadProgress:_,responseType:A,headers:F,withCredentials:B="same-origin",fetchOptions:P}=JR(y),H=e||fetch;A=A?(A+"").toLowerCase():"text";let U=yZ([N,C&&C.toAbortSignal()],T),te=null;const z=U&&U.unsubscribe&&(()=>{U.unsubscribe()});let W;try{if(_&&h&&b!=="get"&&b!=="head"&&(W=await x(F,k))!==0){let re=new n(w,{method:"POST",body:k,duplex:"half"}),K;if(je.isFormData(k)&&(K=re.headers.get("content-type"))&&F.setContentType(K),re.body){const[I,Q]=q8(W,Gx(F8(_)));k=Q8(re.body,H8,I,Q)}}je.isString(B)||(B=B?"include":"omit");const q=i&&"credentials"in n.prototype,J={...P,signal:U,method:b.toUpperCase(),headers:F.normalize().toJSON(),body:k,duplex:"half",credentials:q?B:void 0};te=i&&new n(w,J);let ee=await(i?H(te,P):H(w,J));const Y=f&&(A==="stream"||A==="response");if(f&&(E||Y&&z)){const re={};["status","statusText","headers"].forEach($=>{re[$]=ee[$]});const K=je.toFiniteNumber(ee.headers.get("content-length")),[I,Q]=E&&q8(K,Gx(F8(E),!0))||[];ee=new r(Q8(ee.body,H8,I,()=>{Q&&Q(),z&&z()}),re)}A=A||"text";let R=await m[je.findKey(m,A)||"text"](ee,y);return!Y&&z&&z(),await new Promise((re,K)=>{ZR(re,K,{data:R,headers:Hs.from(ee.headers),status:ee.status,statusText:ee.statusText,config:y,request:te})})}catch(q){throw z&&z(),q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new Mt("Network Error",Mt.ERR_NETWORK,y,te),{cause:q.cause||q}):Mt.from(q,q&&q.code,y,te)}}},jZ=new Map,eD=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let a=i.length,o=a,u,h,f=jZ;for(;o--;)u=i[o],h=f.get(u),h===void 0&&f.set(u,h=o?new Map:OZ(e)),f=h;return h};eD();const ck={http:$Y,xhr:vZ,fetch:{get:eD}};je.forEach(ck,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const G8=t=>`- ${t}`,NZ=t=>je.isFunction(t)||t===null||t===!1;function CZ(t,e){t=je.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let a=0;a`adapter ${u} `+(h===!1?"is not supported by the environment":"is not available in the build"));let o=n?a.length>1?`since : `+a.map(G8).join(` `):" "+G8(a[0]):"as no adapter specified";throw new Mt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return s}const tD={getAdapter:CZ,adapters:ck};function p2(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new xh(null,t)}function X8(t){return p2(t),t.headers=Hs.from(t.headers),t.data=m2.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),tD.getAdapter(t.adapter||u0.adapter,t)(t).then(function(r){return p2(t),r.data=m2.call(t,t.transformResponse,r),r.headers=Hs.from(r.headers),r},function(r){return YR(r)||(p2(t),r&&r.response&&(r.response.data=m2.call(t,t.transformResponse,r.response),r.response.headers=Hs.from(r.response.headers))),Promise.reject(r)})}const nD="1.13.2",ev={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{ev[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const Y8={};ev.transitional=function(e,n,r){function s(i,a){return"[Axios v"+nD+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,o)=>{if(e===!1)throw new Mt(s(a," has been removed"+(n?" in "+n:"")),Mt.ERR_DEPRECATED);return n&&!Y8[a]&&(Y8[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,a,o):!0}};ev.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function TZ(t,e,n){if(typeof t!="object")throw new Mt("options must be an object",Mt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],a=e[i];if(a){const o=t[i],u=o===void 0||a(o,i,t);if(u!==!0)throw new Mt("option "+i+" must be "+u,Mt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Mt("Unknown option "+i,Mt.ERR_BAD_OPTION)}}const yx={assertOptions:TZ,validators:ev},xa=yx.validators;let eu=class{constructor(e){this.defaults=e||{},this.interceptors={request:new B8,response:new B8}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` `+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=iu(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&yx.assertOptions(r,{silentJSONParsing:xa.transitional(xa.boolean),forcedJSONParsing:xa.transitional(xa.boolean),clarifyTimeoutError:xa.transitional(xa.boolean)},!1),s!=null&&(je.isFunction(s)?n.paramsSerializer={serialize:s}:yx.assertOptions(s,{encode:xa.function,serialize:xa.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),yx.assertOptions(n,{baseUrl:xa.spelling("baseURL"),withXsrfToken:xa.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&je.merge(i.common,i[n.method]);i&&je.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=Hs.concat(a,i);const o=[];let u=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(u=u&&w.synchronous,o.unshift(w.fulfilled,w.rejected))});const h=[];this.interceptors.response.forEach(function(w){h.push(w.fulfilled,w.rejected)});let f,m=0,g;if(!u){const y=[X8.bind(this),void 0];for(y.unshift(...o),y.push(...h),g=y.length,f=Promise.resolve(n);m{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(o=>{r.subscribe(o),i=o}).then(s);return a.cancel=function(){r.unsubscribe(i)},a},e(function(i,a,o){r.reason||(r.reason=new xh(i,a,o),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new rD(function(s){e=s}),cancel:e}}};function _Z(t){return function(n){return t.apply(null,n)}}function MZ(t){return je.isObject(t)&&t.isAxiosError===!0}const H5={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(H5).forEach(([t,e])=>{H5[e]=t});function sD(t){const e=new eu(t),n=zR(eu.prototype.request,e);return je.extend(n,eu.prototype,e,{allOwnKeys:!0}),je.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return sD(iu(t,s))},n}const lr=sD(u0);lr.Axios=eu;lr.CanceledError=xh;lr.CancelToken=EZ;lr.isCancel=YR;lr.VERSION=nD;lr.toFormData=J1;lr.AxiosError=Mt;lr.Cancel=lr.CanceledError;lr.all=function(e){return Promise.all(e)};lr.spread=_Z;lr.isAxiosError=MZ;lr.mergeConfig=iu;lr.AxiosHeaders=Hs;lr.formToJSON=t=>XR(je.isHTMLForm(t)?new FormData(t):t);lr.getAdapter=tD.getAdapter;lr.HttpStatusCode=H5;lr.default=lr;const{Axios:VNe,AxiosError:UNe,CanceledError:WNe,isCancel:GNe,CancelToken:XNe,VERSION:YNe,all:ZNe,Cancel:KNe,isAxiosError:JNe,spread:e8e,toFormData:t8e,AxiosHeaders:n8e,HttpStatusCode:r8e,formToJSON:s8e,getAdapter:i8e,mergeConfig:a8e}=lr,AZ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),iD=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Xx="-",Z8=[],DZ="arbitrary..",zZ=t=>{const e=LZ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return PZ(a);const o=a.split(Xx),u=o[0]===""&&o.length>1?1:0;return aD(o,u,e)},getConflictingClassGroupIds:(a,o)=>{if(o){const u=r[a],h=n[a];return u?h?AZ(h,u):u:h||Z8}return n[a]||Z8}}},aD=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=aD(t,e+1,i);if(h)return h}const a=n.validators;if(a===null)return;const o=e===0?t.join(Xx):t.slice(e).join(Xx),u=a.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?DZ+r:void 0})(),LZ=t=>{const{theme:e,classGroups:n}=t;return BZ(n,e)},BZ=(t,e)=>{const n=iD();for(const r in t){const s=t[r];uk(s,n,r,e)}return n},uk=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){qZ(t,e,n);return}if(typeof t=="function"){FZ(t,e,n,r);return}$Z(t,e,n,r)},qZ=(t,e,n)=>{const r=t===""?e:lD(e,t);r.classGroupId=n},FZ=(t,e,n,r)=>{if(QZ(t)){uk(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(RZ(n,t))},$Z=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let a=0;a{let n=t;const r=e.split(Xx),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,HZ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,a)=>{n[i]=a,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return s(i,a),a},set(i,a){i in n?n[i]=a:s(i,a)}}},V5="!",K8=":",VZ=[],J8=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),UZ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let a=0,o=0,u=0,h;const f=s.length;for(let w=0;wu?h-u:void 0;return J8(i,x,g,y)};if(e){const s=e+K8,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):J8(VZ,!1,a,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},WZ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},GZ=t=>({cache:HZ(t.cacheSize),parseClassName:UZ(t),sortModifiers:WZ(t),...zZ(t)}),XZ=/\s+/,YZ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,a=[],o=t.trim().split(XZ);let u="";for(let h=o.length-1;h>=0;h-=1){const f=o[h],{isExternal:m,modifiers:g,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:w}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let b=!!w,k=r(b?y.substring(0,w):y);if(!k){if(!b){u=f+(u.length>0?" "+u:u);continue}if(k=r(y),!k){u=f+(u.length>0?" "+u:u);continue}b=!1}const N=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=x?N+V5:N,T=C+k;if(a.indexOf(T)>-1)continue;a.push(T);const E=s(k,b);for(let _=0;_0?" "+u:u)}return u},ZZ=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const a=u=>{const h=e.reduce((f,m)=>m(f),t());return n=GZ(h),r=n.cache.get,s=n.cache.set,i=o,o(u)},o=u=>{const h=r(u);if(h)return h;const f=YZ(u,n);return s(u,f),f};return i=a,(...u)=>i(ZZ(...u))},JZ=[],Pr=t=>{const e=n=>n[t]||JZ;return e.isThemeGetter=!0,e},cD=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,uD=/^\((?:(\w[\w-]*):)?(.+)\)$/i,eK=/^\d+\/\d+$/,tK=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nK=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,rK=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,sK=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,iK=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,od=t=>eK.test(t),Bt=t=>!!t&&!Number.isNaN(Number(t)),Eo=t=>!!t&&Number.isInteger(Number(t)),g2=t=>t.endsWith("%")&&Bt(t.slice(0,-1)),vl=t=>tK.test(t),aK=()=>!0,lK=t=>nK.test(t)&&!rK.test(t),dD=()=>!1,oK=t=>sK.test(t),cK=t=>iK.test(t),uK=t=>!et(t)&&!tt(t),dK=t=>vh(t,mD,dD),et=t=>cD.test(t),Dc=t=>vh(t,pD,lK),x2=t=>vh(t,gK,Bt),eC=t=>vh(t,hD,dD),hK=t=>vh(t,fD,cK),vg=t=>vh(t,gD,oK),tt=t=>uD.test(t),Tf=t=>yh(t,pD),fK=t=>yh(t,xK),tC=t=>yh(t,hD),mK=t=>yh(t,mD),pK=t=>yh(t,fD),yg=t=>yh(t,gD,!0),vh=(t,e,n)=>{const r=cD.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},yh=(t,e,n=!1)=>{const r=uD.exec(t);return r?r[1]?e(r[1]):n:!1},hD=t=>t==="position"||t==="percentage",fD=t=>t==="image"||t==="url",mD=t=>t==="length"||t==="size"||t==="bg-size",pD=t=>t==="length",gK=t=>t==="number",xK=t=>t==="family-name",gD=t=>t==="shadow",vK=()=>{const t=Pr("color"),e=Pr("font"),n=Pr("text"),r=Pr("font-weight"),s=Pr("tracking"),i=Pr("leading"),a=Pr("breakpoint"),o=Pr("container"),u=Pr("spacing"),h=Pr("radius"),f=Pr("shadow"),m=Pr("inset-shadow"),g=Pr("text-shadow"),x=Pr("drop-shadow"),y=Pr("blur"),w=Pr("perspective"),b=Pr("aspect"),k=Pr("ease"),N=Pr("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...T(),tt,et],_=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],F=()=>[tt,et,u],B=()=>[od,"full","auto",...F()],P=()=>[Eo,"none","subgrid",tt,et],H=()=>["auto",{span:["full",Eo,tt,et]},Eo,tt,et],U=()=>[Eo,"auto",tt,et],te=()=>["auto","min","max","fr",tt,et],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...F()],J=()=>[od,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...F()],ee=()=>[t,tt,et],Y=()=>[...T(),tC,eC,{position:[tt,et]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],re=()=>["auto","cover","contain",mK,dK,{size:[tt,et]}],K=()=>[g2,Tf,Dc],I=()=>["","none","full",h,tt,et],Q=()=>["",Bt,Tf,Dc],$=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[Bt,g2,tC,eC],ge=()=>["","none",y,tt,et],se=()=>["none",Bt,tt,et],Te=()=>["none",Bt,tt,et],qe=()=>[Bt,tt,et],ve=()=>[od,"full",...F()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[vl],breakpoint:[vl],color:[aK],container:[vl],"drop-shadow":[vl],ease:["in","out","in-out"],font:[uK],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[vl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[vl],shadow:[vl],spacing:["px",Bt],text:[vl],"text-shadow":[vl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",od,et,tt,b]}],container:["container"],columns:[{columns:[Bt,et,tt,o]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:B()}],"inset-x":[{"inset-x":B()}],"inset-y":[{"inset-y":B()}],start:[{start:B()}],end:[{end:B()}],top:[{top:B()}],right:[{right:B()}],bottom:[{bottom:B()}],left:[{left:B()}],visibility:["visible","invisible","collapse"],z:[{z:[Eo,"auto",tt,et]}],basis:[{basis:[od,"full","auto",o,...F()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Bt,od,"auto","initial","none",et]}],grow:[{grow:["",Bt,tt,et]}],shrink:[{shrink:["",Bt,tt,et]}],order:[{order:[Eo,"first","last","none",tt,et]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:F()}],"gap-x":[{"gap-x":F()}],"gap-y":[{"gap-y":F()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:F()}],px:[{px:F()}],py:[{py:F()}],ps:[{ps:F()}],pe:[{pe:F()}],pt:[{pt:F()}],pr:[{pr:F()}],pb:[{pb:F()}],pl:[{pl:F()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":F()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":F()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],w:[{w:[o,"screen",...J()]}],"min-w":[{"min-w":[o,"screen","none",...J()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",n,Tf,Dc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tt,x2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",g2,et]}],"font-family":[{font:[fK,et,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,tt,et]}],"line-clamp":[{"line-clamp":[Bt,"none",tt,x2]}],leading:[{leading:[i,...F()]}],"list-image":[{"list-image":["none",tt,et]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",tt,et]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ee()}],"text-color":[{text:ee()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:[Bt,"from-font","auto",tt,Dc]}],"text-decoration-color":[{decoration:ee()}],"underline-offset":[{"underline-offset":[Bt,"auto",tt,et]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",tt,et]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",tt,et]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Eo,tt,et],radial:["",tt,et],conic:[Eo,tt,et]},pK,hK]}],"bg-color":[{bg:ee()}],"gradient-from-pos":[{from:K()}],"gradient-via-pos":[{via:K()}],"gradient-to-pos":[{to:K()}],"gradient-from":[{from:ee()}],"gradient-via":[{via:ee()}],"gradient-to":[{to:ee()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...$(),"hidden","none"]}],"divide-style":[{divide:[...$(),"hidden","none"]}],"border-color":[{border:ee()}],"border-color-x":[{"border-x":ee()}],"border-color-y":[{"border-y":ee()}],"border-color-s":[{"border-s":ee()}],"border-color-e":[{"border-e":ee()}],"border-color-t":[{"border-t":ee()}],"border-color-r":[{"border-r":ee()}],"border-color-b":[{"border-b":ee()}],"border-color-l":[{"border-l":ee()}],"divide-color":[{divide:ee()}],"outline-style":[{outline:[...$(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Bt,tt,et]}],"outline-w":[{outline:["",Bt,Tf,Dc]}],"outline-color":[{outline:ee()}],shadow:[{shadow:["","none",f,yg,vg]}],"shadow-color":[{shadow:ee()}],"inset-shadow":[{"inset-shadow":["none",m,yg,vg]}],"inset-shadow-color":[{"inset-shadow":ee()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ee()}],"ring-offset-w":[{"ring-offset":[Bt,Dc]}],"ring-offset-color":[{"ring-offset":ee()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":ee()}],"text-shadow":[{"text-shadow":["none",g,yg,vg]}],"text-shadow-color":[{"text-shadow":ee()}],opacity:[{opacity:[Bt,tt,et]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Bt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":ee()}],"mask-image-linear-to-color":[{"mask-linear-to":ee()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":ee()}],"mask-image-t-to-color":[{"mask-t-to":ee()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":ee()}],"mask-image-r-to-color":[{"mask-r-to":ee()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":ee()}],"mask-image-b-to-color":[{"mask-b-to":ee()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":ee()}],"mask-image-l-to-color":[{"mask-l-to":ee()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":ee()}],"mask-image-x-to-color":[{"mask-x-to":ee()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":ee()}],"mask-image-y-to-color":[{"mask-y-to":ee()}],"mask-image-radial":[{"mask-radial":[tt,et]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":ee()}],"mask-image-radial-to-color":[{"mask-radial-to":ee()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Bt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":ee()}],"mask-image-conic-to-color":[{"mask-conic-to":ee()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",tt,et]}],filter:[{filter:["","none",tt,et]}],blur:[{blur:ge()}],brightness:[{brightness:[Bt,tt,et]}],contrast:[{contrast:[Bt,tt,et]}],"drop-shadow":[{"drop-shadow":["","none",x,yg,vg]}],"drop-shadow-color":[{"drop-shadow":ee()}],grayscale:[{grayscale:["",Bt,tt,et]}],"hue-rotate":[{"hue-rotate":[Bt,tt,et]}],invert:[{invert:["",Bt,tt,et]}],saturate:[{saturate:[Bt,tt,et]}],sepia:[{sepia:["",Bt,tt,et]}],"backdrop-filter":[{"backdrop-filter":["","none",tt,et]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[Bt,tt,et]}],"backdrop-contrast":[{"backdrop-contrast":[Bt,tt,et]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Bt,tt,et]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Bt,tt,et]}],"backdrop-invert":[{"backdrop-invert":["",Bt,tt,et]}],"backdrop-opacity":[{"backdrop-opacity":[Bt,tt,et]}],"backdrop-saturate":[{"backdrop-saturate":[Bt,tt,et]}],"backdrop-sepia":[{"backdrop-sepia":["",Bt,tt,et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":F()}],"border-spacing-x":[{"border-spacing-x":F()}],"border-spacing-y":[{"border-spacing-y":F()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",tt,et]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Bt,"initial",tt,et]}],ease:[{ease:["linear","initial",k,tt,et]}],delay:[{delay:[Bt,tt,et]}],animate:[{animate:["none",N,tt,et]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,tt,et]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:se()}],"rotate-x":[{"rotate-x":se()}],"rotate-y":[{"rotate-y":se()}],"rotate-z":[{"rotate-z":se()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:qe()}],"skew-x":[{"skew-x":qe()}],"skew-y":[{"skew-y":qe()}],transform:[{transform:[tt,et,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:ee()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ee()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",tt,et]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",tt,et]}],fill:[{fill:["none",...ee()]}],"stroke-w":[{stroke:[Bt,Tf,Dc,x2]}],stroke:[{stroke:["none",...ee()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},yK=KZ(vK);function Se(...t){return yK(GA(t))}const Ct=O.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:Se("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Ct.displayName="Card";const xn=O.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:Se("flex flex-col space-y-1.5 p-6",t),...e}));xn.displayName="CardHeader";const vn=O.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:Se("font-semibold leading-none tracking-tight",t),...e}));vn.displayName="CardTitle";const Lr=O.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:Se("text-sm text-muted-foreground",t),...e}));Lr.displayName="CardDescription";const Tn=O.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:Se("p-6 pt-0",t),...e}));Tn.displayName="CardContent";const xD=O.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:Se("flex items-center p-6 pt-0",t),...e}));xD.displayName="CardFooter";var v2="rovingFocusGroup.onEntryFocus",bK={bubbles:!1,cancelable:!0},d0="RovingFocusGroup",[U5,vD,wK]=Q1(d0),[SK,tv]=la(d0,[wK]),[kK,OK]=SK(d0),yD=O.forwardRef((t,e)=>l.jsx(U5.Provider,{scope:t.__scopeRovingFocusGroup,children:l.jsx(U5.Slot,{scope:t.__scopeRovingFocusGroup,children:l.jsx(jK,{...t,ref:e})})}));yD.displayName=d0;var jK=O.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=O.useRef(null),x=Pn(e,g),y=n0(i),[w,b]=ac({prop:a,defaultProp:o??null,onChange:u,caller:d0}),[k,N]=O.useState(!1),C=us(h),T=vD(n),E=O.useRef(!1),[_,A]=O.useState(0);return O.useEffect(()=>{const F=g.current;if(F)return F.addEventListener(v2,C),()=>F.removeEventListener(v2,C)},[C]),l.jsx(kK,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:w,onItemFocus:O.useCallback(F=>b(F),[b]),onItemShiftTab:O.useCallback(()=>N(!0),[]),onFocusableItemAdd:O.useCallback(()=>A(F=>F+1),[]),onFocusableItemRemove:O.useCallback(()=>A(F=>F-1),[]),children:l.jsx(fn.div,{tabIndex:k||_===0?-1:0,"data-orientation":r,...m,ref:x,style:{outline:"none",...t.style},onMouseDown:Xe(t.onMouseDown,()=>{E.current=!0}),onFocus:Xe(t.onFocus,F=>{const B=!E.current;if(F.target===F.currentTarget&&B&&!k){const P=new CustomEvent(v2,bK);if(F.currentTarget.dispatchEvent(P),!P.defaultPrevented){const H=T().filter(q=>q.focusable),U=H.find(q=>q.active),te=H.find(q=>q.id===w),W=[U,te,...H].filter(Boolean).map(q=>q.ref.current);SD(W,f)}}E.current=!1}),onBlur:Xe(t.onBlur,()=>N(!1))})})}),bD="RovingFocusGroupItem",wD=O.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...o}=t,u=Li(),h=i||u,f=OK(bD,n),m=f.currentTabStopId===h,g=vD(n),{onFocusableItemAdd:x,onFocusableItemRemove:y,currentTabStopId:w}=f;return O.useEffect(()=>{if(r)return x(),()=>y()},[r,x,y]),l.jsx(U5.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:l.jsx(fn.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...o,ref:e,onMouseDown:Xe(t.onMouseDown,b=>{r?f.onItemFocus(h):b.preventDefault()}),onFocus:Xe(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:Xe(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){f.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const k=TK(b,f.orientation,f.dir);if(k!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let C=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const T=C.indexOf(b.currentTarget);C=f.loop?EK(C,T+1):C.slice(T+1)}setTimeout(()=>SD(C))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:w!=null}):a})})});wD.displayName=bD;var NK={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function CK(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function TK(t,e,n){const r=CK(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return NK[r]}function SD(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function EK(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var kD=yD,OD=wD,nv="Tabs",[_K]=la(nv,[tv]),jD=tv(),[MK,dk]=_K(nv),ND=O.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:o,activationMode:u="automatic",...h}=t,f=n0(o),[m,g]=ac({prop:r,onChange:s,defaultProp:i??"",caller:nv});return l.jsx(MK,{scope:n,baseId:Li(),value:m,onValueChange:g,orientation:a,dir:f,activationMode:u,children:l.jsx(fn.div,{dir:f,"data-orientation":a,...h,ref:e})})});ND.displayName=nv;var CD="TabsList",TD=O.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=dk(CD,n),a=jD(n);return l.jsx(kD,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(fn.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});TD.displayName=CD;var ED="TabsTrigger",_D=O.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,a=dk(ED,n),o=jD(n),u=RD(a.baseId,r),h=DD(a.baseId,r),f=r===a.value;return l.jsx(OD,{asChild:!0,...o,focusable:!s,active:f,children:l.jsx(fn.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:u,...i,ref:e,onMouseDown:Xe(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?a.onValueChange(r):m.preventDefault()}),onKeyDown:Xe(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&a.onValueChange(r)}),onFocus:Xe(t.onFocus,()=>{const m=a.activationMode!=="manual";!f&&!s&&m&&a.onValueChange(r)})})})});_D.displayName=ED;var MD="TabsContent",AD=O.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...a}=t,o=dk(MD,n),u=RD(o.baseId,r),h=DD(o.baseId,r),f=r===o.value,m=O.useRef(f);return O.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(Ws,{present:s||f,children:({present:g})=>l.jsx(fn.div,{"data-state":f?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});AD.displayName=MD;function RD(t,e){return`${t}-trigger-${e}`}function DD(t,e){return`${t}-content-${e}`}var AK=ND,zD=TD,PD=_D,LD=AD;const ql=AK,La=O.forwardRef(({className:t,...e},n)=>l.jsx(zD,{ref:n,className:Se("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));La.displayName=zD.displayName;const Zt=O.forwardRef(({className:t,...e},n)=>l.jsx(PD,{ref:n,className:Se("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));Zt.displayName=PD.displayName;const An=O.forwardRef(({className:t,...e},n)=>l.jsx(LD,{ref:n,className:Se("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",t),...e}));An.displayName=LD.displayName;function RK(t,e){return O.useReducer((n,r)=>e[n][r]??n,t)}var hk="ScrollArea",[BD]=la(hk),[DK,Hi]=BD(hk),ID=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...a}=t,[o,u]=O.useState(null),[h,f]=O.useState(null),[m,g]=O.useState(null),[x,y]=O.useState(null),[w,b]=O.useState(null),[k,N]=O.useState(0),[C,T]=O.useState(0),[E,_]=O.useState(!1),[A,F]=O.useState(!1),B=Pn(e,H=>u(H)),P=n0(s);return l.jsx(DK,{scope:n,type:r,dir:P,scrollHideDelay:i,scrollArea:o,viewport:h,onViewportChange:f,content:m,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:E,onScrollbarXEnabledChange:_,scrollbarY:w,onScrollbarYChange:b,scrollbarYEnabled:A,onScrollbarYEnabledChange:F,onCornerWidthChange:N,onCornerHeightChange:T,children:l.jsx(fn.div,{dir:P,...a,ref:B,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":C+"px",...t.style}})})});ID.displayName=hk;var qD="ScrollAreaViewport",FD=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,a=Hi(qD,n),o=O.useRef(null),u=Pn(e,o,a.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(fn.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:l.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});FD.displayName=qD;var Ia="ScrollAreaScrollbar",fk=O.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Hi(Ia,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=s,o=t.orientation==="horizontal";return O.useEffect(()=>(o?i(!0):a(!0),()=>{o?i(!1):a(!1)}),[o,i,a]),s.type==="hover"?l.jsx(zK,{...r,ref:e,forceMount:n}):s.type==="scroll"?l.jsx(PK,{...r,ref:e,forceMount:n}):s.type==="auto"?l.jsx($D,{...r,ref:e,forceMount:n}):s.type==="always"?l.jsx(mk,{...r,ref:e}):null});fk.displayName=Ia;var zK=O.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Hi(Ia,t.__scopeScrollArea),[i,a]=O.useState(!1);return O.useEffect(()=>{const o=s.scrollArea;let u=0;if(o){const h=()=>{window.clearTimeout(u),a(!0)},f=()=>{u=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return o.addEventListener("pointerenter",h),o.addEventListener("pointerleave",f),()=>{window.clearTimeout(u),o.removeEventListener("pointerenter",h),o.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(Ws,{present:n||i,children:l.jsx($D,{"data-state":i?"visible":"hidden",...r,ref:e})})}),PK=O.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Hi(Ia,t.__scopeScrollArea),i=t.orientation==="horizontal",a=sv(()=>u("SCROLL_END"),100),[o,u]=RK("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return O.useEffect(()=>{if(o==="idle"){const h=window.setTimeout(()=>u("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[o,s.scrollHideDelay,u]),O.useEffect(()=>{const h=s.viewport,f=i?"scrollLeft":"scrollTop";if(h){let m=h[f];const g=()=>{const x=h[f];m!==x&&(u("SCROLL"),a()),m=x};return h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,i,u,a]),l.jsx(Ws,{present:n||o!=="hidden",children:l.jsx(mk,{"data-state":o==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Xe(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:Xe(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),$D=O.forwardRef((t,e)=>{const n=Hi(Ia,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,a]=O.useState(!1),o=t.orientation==="horizontal",u=sv(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=Hi(Ia,t.__scopeScrollArea),i=O.useRef(null),a=O.useRef(0),[o,u]=O.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=WD(o.viewport,o.content),f={...r,sizes:o,onSizesChange:u,hasThumb:h>0&&h<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:g=>a.current=g};function m(g,x){return $K(g,a.current,o,x)}return n==="horizontal"?l.jsx(LK,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollLeft,x=nC(g,o,s.dir);i.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollLeft=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollLeft=m(g,s.dir))}}):n==="vertical"?l.jsx(BK,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollTop,x=nC(g,o);i.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollTop=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollTop=m(g))}}):null}),LK=O.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Hi(Ia,t.__scopeScrollArea),[a,o]=O.useState(),u=O.useRef(null),h=Pn(e,u,i.onScrollbarXChange);return O.useEffect(()=>{u.current&&o(getComputedStyle(u.current))},[u]),l.jsx(HD,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":rv(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.x),onDragScroll:f=>t.onDragScroll(f.x),onWheelScroll:(f,m)=>{if(i.viewport){const g=i.viewport.scrollLeft+f.deltaX;t.onWheelScroll(g),XD(g,m)&&f.preventDefault()}},onResize:()=>{u.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Zx(a.paddingLeft),paddingEnd:Zx(a.paddingRight)}})}})}),BK=O.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Hi(Ia,t.__scopeScrollArea),[a,o]=O.useState(),u=O.useRef(null),h=Pn(e,u,i.onScrollbarYChange);return O.useEffect(()=>{u.current&&o(getComputedStyle(u.current))},[u]),l.jsx(HD,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":rv(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.y),onDragScroll:f=>t.onDragScroll(f.y),onWheelScroll:(f,m)=>{if(i.viewport){const g=i.viewport.scrollTop+f.deltaY;t.onWheelScroll(g),XD(g,m)&&f.preventDefault()}},onResize:()=>{u.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Zx(a.paddingTop),paddingEnd:Zx(a.paddingBottom)}})}})}),[IK,QD]=BD(Ia),HD=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:o,onThumbPositionChange:u,onDragScroll:h,onWheelScroll:f,onResize:m,...g}=t,x=Hi(Ia,n),[y,w]=O.useState(null),b=Pn(e,B=>w(B)),k=O.useRef(null),N=O.useRef(""),C=x.viewport,T=r.content-r.viewport,E=us(f),_=us(u),A=sv(m,10);function F(B){if(k.current){const P=B.clientX-k.current.left,H=B.clientY-k.current.top;h({x:P,y:H})}}return O.useEffect(()=>{const B=P=>{const H=P.target;y?.contains(H)&&E(P,T)};return document.addEventListener("wheel",B,{passive:!1}),()=>document.removeEventListener("wheel",B,{passive:!1})},[C,y,T,E]),O.useEffect(_,[r,_]),Yd(y,A),Yd(x.content,A),l.jsx(IK,{scope:n,scrollbar:y,hasThumb:s,onThumbChange:us(i),onThumbPointerUp:us(a),onThumbPositionChange:_,onThumbPointerDown:us(o),children:l.jsx(fn.div,{...g,ref:b,style:{position:"absolute",...g.style},onPointerDown:Xe(t.onPointerDown,B=>{B.button===0&&(B.target.setPointerCapture(B.pointerId),k.current=y.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),F(B))}),onPointerMove:Xe(t.onPointerMove,F),onPointerUp:Xe(t.onPointerUp,B=>{const P=B.target;P.hasPointerCapture(B.pointerId)&&P.releasePointerCapture(B.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),k.current=null})})})}),Yx="ScrollAreaThumb",VD=O.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=QD(Yx,t.__scopeScrollArea);return l.jsx(Ws,{present:n||s.hasThumb,children:l.jsx(qK,{ref:e,...r})})}),qK=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Hi(Yx,n),a=QD(Yx,n),{onThumbPositionChange:o}=a,u=Pn(e,m=>a.onThumbChange(m)),h=O.useRef(void 0),f=sv(()=>{h.current&&(h.current(),h.current=void 0)},100);return O.useEffect(()=>{const m=i.viewport;if(m){const g=()=>{if(f(),!h.current){const x=QK(m,o);h.current=x,o()}};return o(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[i.viewport,f,o]),l.jsx(fn.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Xe(t.onPointerDownCapture,m=>{const x=m.target.getBoundingClientRect(),y=m.clientX-x.left,w=m.clientY-x.top;a.onThumbPointerDown({x:y,y:w})}),onPointerUp:Xe(t.onPointerUp,a.onThumbPointerUp)})});VD.displayName=Yx;var pk="ScrollAreaCorner",UD=O.forwardRef((t,e)=>{const n=Hi(pk,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(FK,{...t,ref:e}):null});UD.displayName=pk;var FK=O.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Hi(pk,n),[i,a]=O.useState(0),[o,u]=O.useState(0),h=!!(i&&o);return Yd(s.scrollbarX,()=>{const f=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(f),u(f)}),Yd(s.scrollbarY,()=>{const f=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(f),a(f)}),h?l.jsx(fn.div,{...r,ref:e,style:{width:i,height:o,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Zx(t){return t?parseInt(t,10):0}function WD(t,e){const n=t/e;return isNaN(n)?0:n}function rv(t){const e=WD(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function $K(t,e,n,r="ltr"){const s=rv(n),i=s/2,a=e||i,o=s-a,u=n.scrollbar.paddingStart+a,h=n.scrollbar.size-n.scrollbar.paddingEnd-o,f=n.content-n.viewport,m=r==="ltr"?[0,f]:[f*-1,0];return GD([u,h],m)(t)}function nC(t,e,n="ltr"){const r=rv(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,a=e.content-e.viewport,o=i-r,u=n==="ltr"?[0,a]:[a*-1,0],h=GS(t,u);return GD([0,a],[0,o])(h)}function GD(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function XD(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},a=n.left!==i.left,o=n.top!==i.top;(a||o)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function sv(t,e){const n=us(t),r=O.useRef(0);return O.useEffect(()=>()=>window.clearTimeout(r.current),[]),O.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Yd(t,e){const n=us(e);oR(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var YD=ID,HK=FD,VK=UD;const yn=O.forwardRef(({className:t,children:e,viewportRef:n,...r},s)=>l.jsxs(YD,{ref:s,className:Se("relative overflow-hidden",t),...r,children:[l.jsx(HK,{ref:n,className:"h-full w-full rounded-[inherit]",children:e}),l.jsx(W5,{}),l.jsx(W5,{orientation:"horizontal"}),l.jsx(VK,{})]}));yn.displayName=YD.displayName;const W5=O.forwardRef(({className:t,orientation:e="vertical",...n},r)=>l.jsx(fk,{ref:r,orientation:e,className:Se("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:l.jsx(VD,{className:"relative flex-1 rounded-full bg-border"})}));W5.displayName=fk.displayName;function rC({className:t,...e}){return l.jsx("div",{className:Se("animate-pulse rounded-md bg-primary/10",t),...e})}function UK(t,e=[]){let n=[];function r(i,a){const o=O.createContext(a);o.displayName=i+"Context";const u=n.length;n=[...n,a];const h=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[u]||o,b=O.useMemo(()=>y,Object.values(y));return l.jsx(w.Provider,{value:b,children:x})};h.displayName=i+"Provider";function f(m,g){const x=g?.[t]?.[u]||o,y=O.useContext(x);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const s=()=>{const i=n.map(a=>O.createContext(a));return function(o){const u=o?.[t]||i;return O.useMemo(()=>({[`__scope${t}`]:{...o,[t]:u}}),[o,u])}};return s.scopeName=t,[r,WK(s,...e)]}function WK(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((o,{useScope:u,scopeName:h})=>{const m=u(i)[`__scope${h}`];return{...o,...m}},{});return O.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var GK=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ZD=GK.reduce((t,e)=>{const n=XS(`Primitive.${e}`),r=O.forwardRef((s,i)=>{const{asChild:a,...o}=s,u=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(u,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),gk="Progress",xk=100,[XK]=UK(gk),[YK,ZK]=XK(gk),KD=O.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=KK,...a}=t;(s||s===0)&&!sC(s)&&console.error(JK(`${s}`,"Progress"));const o=sC(s)?s:xk;r!==null&&!iC(r,o)&&console.error(eJ(`${r}`,"Progress"));const u=iC(r,o)?r:null,h=Kx(u)?i(u,o):void 0;return l.jsx(YK,{scope:n,value:u,max:o,children:l.jsx(ZD.div,{"aria-valuemax":o,"aria-valuemin":0,"aria-valuenow":Kx(u)?u:void 0,"aria-valuetext":h,role:"progressbar","data-state":tz(u,o),"data-value":u??void 0,"data-max":o,...a,ref:e})})});KD.displayName=gk;var JD="ProgressIndicator",ez=O.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=ZK(JD,n);return l.jsx(ZD.div,{"data-state":tz(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});ez.displayName=JD;function KK(t,e){return`${Math.round(t/e*100)}%`}function tz(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function Kx(t){return typeof t=="number"}function sC(t){return Kx(t)&&!isNaN(t)&&t>0}function iC(t,e){return Kx(t)&&!isNaN(t)&&t<=e&&t>=0}function JK(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${xk}\`.`}function eJ(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${xk} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var nz=KD,tJ=ez;const h0=O.forwardRef(({className:t,value:e,...n},r)=>l.jsx(nz,{ref:r,className:Se("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:l.jsx(tJ,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));h0.displayName=nz.displayName;const nJ={light:"",dark:".dark"},rz=O.createContext(null);function sz(){const t=O.useContext(rz);if(!t)throw new Error("useChart must be used within a ");return t}const yd=O.forwardRef(({id:t,className:e,children:n,config:r,...s},i)=>{const a=O.useId(),o=`chart-${t||a.replace(/:/g,"")}`;return l.jsx(rz.Provider,{value:{config:r},children:l.jsxs("div",{"data-chart":o,ref:i,className:Se("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...s,children:[l.jsx(rJ,{id:o,config:r}),l.jsx(pG,{children:n})]})})});yd.displayName="Chart";const rJ=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?l.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(nJ).map(([r,s])=>` ${s} [data-chart=${t}] { ${n.map(([i,a])=>{const o=a.theme?.[r]||a.color;return o?` --color-${i}: ${o};`:null}).join(` `)} } `).join(` `)}}):null},Ef=gG,bd=O.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:a,labelFormatter:o,labelClassName:u,formatter:h,color:f,nameKey:m,labelKey:g},x)=>{const{config:y}=sz(),w=O.useMemo(()=>{if(s||!e?.length)return null;const[k]=e,N=`${g||k?.dataKey||k?.name||"value"}`,C=G5(y,k,N),T=!g&&typeof a=="string"?y[a]?.label||a:C?.label;return o?l.jsx("div",{className:Se("font-medium",u),children:o(T,e)}):T?l.jsx("div",{className:Se("font-medium",u),children:T}):null},[a,o,e,s,u,y,g]);if(!t||!e?.length)return null;const b=e.length===1&&r!=="dot";return l.jsxs("div",{ref:x,className:Se("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[b?null:w,l.jsx("div",{className:"grid gap-1.5",children:e.filter(k=>k.type!=="none").map((k,N)=>{const C=`${m||k.name||k.dataKey||"value"}`,T=G5(y,k,C),E=f||k.payload.fill||k.color;return l.jsx("div",{className:Se("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:h&&k?.value!==void 0&&k.name?h(k.value,k.name,k,N,k.payload):l.jsxs(l.Fragment,{children:[T?.icon?l.jsx(T.icon,{}):!i&&l.jsx("div",{className:Se("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":b&&r==="dashed"}),style:{"--color-bg":E,"--color-border":E}}),l.jsxs("div",{className:Se("flex flex-1 justify-between leading-none",b?"items-end":"items-center"),children:[l.jsxs("div",{className:"grid gap-1.5",children:[b?w:null,l.jsx("span",{className:"text-muted-foreground",children:T?.label||k.name})]}),k.value&&l.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:k.value.toLocaleString()})]})]})},k.dataKey)})})]})});bd.displayName="ChartTooltip";const sJ=xG,iz=O.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:a}=sz();return n?.length?l.jsx("div",{ref:i,className:Se("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(o=>o.type!=="none").map(o=>{const u=`${s||o.dataKey||"value"}`,h=G5(a,o,u);return l.jsxs("div",{className:Se("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?l.jsx(h.icon,{}):l.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:o.color}}),h?.label]},o.value)})}):null});iz.displayName="ChartLegend";function G5(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let s=n;return n in e&&typeof e[n]=="string"?s=e[n]:r&&n in r&&typeof r[n]=="string"&&(s=r[n]),s in t?t[s]:t[n]}const aC=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,lC=GA,bh=(t,e)=>n=>{var r;if(e?.variants==null)return lC(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(h=>{const f=n?.[h],m=i?.[h];if(f===null)return null;const g=aC(f)||aC(m);return s[h][g]}),o=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...x}=f;return Object.entries(x).every(y=>{let[w,b]=y;return Array.isArray(b)?b.includes({...i,...o}[w]):{...i,...o}[w]===b})?[...h,m,g]:h},[]);return lC(t,a,u,n?.class,n?.className)},vm=bh("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),de=O.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const a=r?mX:"button";return l.jsx(a,{className:Se(vm({variant:e,size:n,className:t})),ref:i,...s})});de.displayName="Button";function iJ(){const[t,e]=O.useState(null),[n,r]=O.useState(!0),[s,i]=O.useState(0),[a,o]=O.useState(24),[u,h]=O.useState(!0),[f,m]=O.useState(null),[g,x]=O.useState(!0),y=O.useCallback(async()=>{try{x(!0);const B=await lr.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");m({hitokoto:B.data.hitokoto,from:B.data.from||B.data.from_who||"未知"})}catch(B){console.error("获取一言失败:",B),m({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{x(!1)}},[]),w=O.useCallback(async()=>{try{const B=localStorage.getItem("access-token"),P=await lr.get(`/api/webui/statistics/dashboard?hours=${a}`,{headers:{Authorization:`Bearer ${B}`}});e(P.data),r(!1),i(100)}catch(B){console.error("Failed to fetch dashboard data:",B),r(!1),i(100)}},[a]);if(O.useEffect(()=>{if(!n)return;i(0);const B=setTimeout(()=>i(15),200),P=setTimeout(()=>i(30),800),H=setTimeout(()=>i(45),2e3),U=setTimeout(()=>i(60),4e3),te=setTimeout(()=>i(75),6500),z=setTimeout(()=>i(85),9e3),W=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(B),clearTimeout(P),clearTimeout(H),clearTimeout(U),clearTimeout(te),clearTimeout(z),clearTimeout(W)}},[n]),O.useEffect(()=>{w(),y()},[w,y]),O.useEffect(()=>{if(!u)return;const B=setInterval(()=>{w()},3e4);return()=>clearInterval(B)},[u,w]),n||!t)return l.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:l.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[l.jsx(hi,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(h0,{value:s,className:"h-2"}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:b,model_stats:k,hourly_data:N,daily_data:C,recent_activity:T}=t,E=B=>{const P=Math.floor(B/3600),H=Math.floor(B%3600/60);return`${P}小时${H}分钟`},_=B=>new Date(B).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),A=k.slice(0,6).map(B=>({name:B.model_name,value:B.request_count,fill:`hsl(var(--chart-${k.indexOf(B)%5+1}))`})),F={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return l.jsx(yn,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(ql,{value:a.toString(),onValueChange:B=>o(Number(B)),children:l.jsxs(La,{className:"grid grid-cols-3 w-full sm:w-auto",children:[l.jsx(Zt,{value:"24",children:"24小时"}),l.jsx(Zt,{value:"168",children:"7天"}),l.jsx(Zt,{value:"720",children:"30天"})]})}),l.jsxs(de,{variant:u?"default":"outline",size:"sm",onClick:()=>h(!u),className:"gap-2",children:[l.jsx(hi,{className:`h-4 w-4 ${u?"animate-spin":""}`}),l.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:w,children:l.jsx(hi,{className:"h-4 w-4"})})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[l.jsxs(Ct,{children:[l.jsxs(xn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(vn,{className:"text-sm font-medium",children:"总请求数"}),l.jsx(CX,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Tn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:b.total_requests.toLocaleString()}),l.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",a<48?a+"小时":Math.floor(a/24)+"天"]})]})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(vn,{className:"text-sm font-medium",children:"总花费"}),l.jsx(TX,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Tn,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:["¥",b.total_cost.toFixed(2)]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:b.cost_per_hour>0?`¥${b.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(vn,{className:"text-sm font-medium",children:"Token消耗"}),l.jsx(R5,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Tn,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:[(b.total_tokens/1e3).toFixed(1),"K"]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:b.tokens_per_hour>0?`${(b.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(vn,{className:"text-sm font-medium",children:"平均响应"}),l.jsx(pm,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Tn,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:[b.avg_response_time.toFixed(2),"s"]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[l.jsxs(Ct,{children:[l.jsxs(xn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(vn,{className:"text-sm font-medium",children:"在线时长"}),l.jsx(Yc,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsx(Tn,{children:l.jsx("div",{className:"text-xl font-bold",children:E(b.online_time)})})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(vn,{className:"text-sm font-medium",children:"消息处理"}),l.jsx(r0,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Tn,{children:[l.jsx("div",{className:"text-xl font-bold",children:b.total_messages.toLocaleString()}),l.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",b.total_replies.toLocaleString()," 条"]})]})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(vn,{className:"text-sm font-medium",children:"成本效率"}),l.jsx(EX,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Tn,{children:[l.jsx("div",{className:"text-xl font-bold",children:b.total_messages>0?`¥${(b.total_cost/b.total_messages*100).toFixed(2)}`:"¥0.00"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),l.jsxs(ql,{defaultValue:"trends",className:"space-y-4",children:[l.jsxs(La,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[l.jsx(Zt,{value:"trends",children:"趋势"}),l.jsx(Zt,{value:"models",children:"模型"}),l.jsx(Zt,{value:"activity",children:"活动"}),l.jsx(Zt,{value:"daily",children:"日统计"})]}),l.jsxs(An,{value:"trends",className:"space-y-4",children:[l.jsxs(Ct,{children:[l.jsxs(xn,{children:[l.jsx(vn,{children:"请求趋势"}),l.jsxs(Lr,{children:["最近",a,"小时的请求量变化"]})]}),l.jsx(Tn,{children:l.jsx(yd,{config:F,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:l.jsxs(vG,{data:N,children:[l.jsx(mg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(pg,{dataKey:"timestamp",tickFormatter:B=>_(B),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(jf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Ef,{content:l.jsx(bd,{labelFormatter:B=>_(B)})}),l.jsx(yG,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[l.jsxs(Ct,{children:[l.jsxs(xn,{children:[l.jsx(vn,{children:"花费趋势"}),l.jsx(Lr,{children:"API调用成本变化"})]}),l.jsx(Tn,{children:l.jsx(yd,{config:F,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:l.jsxs(o2,{data:N,children:[l.jsx(mg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(pg,{dataKey:"timestamp",tickFormatter:B=>_(B),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(jf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Ef,{content:l.jsx(bd,{labelFormatter:B=>_(B)})}),l.jsx(gg,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{children:[l.jsx(vn,{children:"Token消耗"}),l.jsx(Lr,{children:"Token使用量变化"})]}),l.jsx(Tn,{children:l.jsx(yd,{config:F,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:l.jsxs(o2,{data:N,children:[l.jsx(mg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(pg,{dataKey:"timestamp",tickFormatter:B=>_(B),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(jf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Ef,{content:l.jsx(bd,{labelFormatter:B=>_(B)})}),l.jsx(gg,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),l.jsx(An,{value:"models",className:"space-y-4",children:l.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[l.jsxs(Ct,{children:[l.jsxs(xn,{children:[l.jsx(vn,{children:"模型请求分布"}),l.jsx(Lr,{children:"各模型使用占比"})]}),l.jsx(Tn,{children:l.jsx(yd,{config:Object.fromEntries(k.slice(0,6).map((B,P)=>[B.model_name,{label:B.model_name,color:`hsl(var(--chart-${P%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:l.jsxs(bG,{children:[l.jsx(Ef,{content:l.jsx(bd,{})}),l.jsx(wG,{data:A,cx:"50%",cy:"50%",labelLine:!1,label:({name:B,percent:P})=>`${B} ${P?(P*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:A.map((B,P)=>l.jsx(SG,{fill:B.fill},`cell-${P}`))})]})})})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{children:[l.jsx(vn,{children:"模型详细统计"}),l.jsx(Lr,{children:"请求数、花费和性能"})]}),l.jsx(Tn,{children:l.jsx(yn,{className:"h-[300px] sm:h-[400px]",children:l.jsx("div",{className:"space-y-3",children:k.map((B,P)=>l.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:B.model_name}),l.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${P%5+1}))`}})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),l.jsx("span",{className:"ml-1 font-medium",children:B.request_count.toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"花费:"}),l.jsxs("span",{className:"ml-1 font-medium",children:["¥",B.total_cost.toFixed(2)]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),l.jsxs("span",{className:"ml-1 font-medium",children:[(B.total_tokens/1e3).toFixed(1),"K"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),l.jsxs("span",{className:"ml-1 font-medium",children:[B.avg_response_time.toFixed(2),"s"]})]})]})]},P))})})})]})]})}),l.jsx(An,{value:"activity",children:l.jsxs(Ct,{children:[l.jsxs(xn,{children:[l.jsx(vn,{children:"最近活动"}),l.jsx(Lr,{children:"最新的API调用记录"})]}),l.jsx(Tn,{children:l.jsx(yn,{className:"h-[400px] sm:h-[500px]",children:l.jsx("div",{className:"space-y-2",children:T.map((B,P)=>l.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-sm truncate",children:B.model}),l.jsx("div",{className:"text-xs text-muted-foreground",children:B.request_type})]}),l.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:_(B.timestamp)})]}),l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),l.jsx("span",{className:"ml-1",children:B.tokens})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"花费:"}),l.jsxs("span",{className:"ml-1",children:["¥",B.cost.toFixed(4)]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),l.jsxs("span",{className:"ml-1",children:[B.time_cost.toFixed(2),"s"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"状态:"}),l.jsx("span",{className:`ml-1 ${B.status==="success"?"text-green-600":"text-red-600"}`,children:B.status})]})]})]},P))})})})]})}),l.jsx(An,{value:"daily",children:l.jsxs(Ct,{children:[l.jsxs(xn,{children:[l.jsx(vn,{children:"每日统计"}),l.jsx(Lr,{children:"最近7天的数据汇总"})]}),l.jsx(Tn,{children:l.jsx(yd,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:l.jsxs(o2,{data:C,children:[l.jsx(mg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(pg,{dataKey:"timestamp",tickFormatter:B=>{const P=new Date(B);return`${P.getMonth()+1}/${P.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(jf,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(jf,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Ef,{content:l.jsx(bd,{labelFormatter:B=>new Date(B).toLocaleDateString("zh-CN")})}),l.jsx(sJ,{content:l.jsx(iz,{})}),l.jsx(gg,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),l.jsx(gg,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),l.jsxs(Ct,{className:"border-2 border-primary/20",children:[l.jsx(xn,{className:"pb-3",children:l.jsx(vn,{className:"text-lg",children:"每日一言"})}),l.jsx(Tn,{children:g?l.jsxs("div",{className:"space-y-2",children:[l.jsx(rC,{className:"h-6 w-3/4"}),l.jsx(rC,{className:"h-4 w-1/4"})]}):f?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',f.hitokoto,'"']}),l.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",f.from]})]}):null})]})]})})}const aJ={theme:"system",setTheme:()=>null},az=O.createContext(aJ),vk=()=>{const t=O.useContext(az);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},lJ=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,a=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${a}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},lz=O.createContext(void 0),oz=()=>{const t=O.useContext(lz);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var iv="Switch",[oJ]=la(iv),[cJ,uJ]=oJ(iv),cz=O.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:a,disabled:o,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,x]=O.useState(null),y=Pn(e,C=>x(C)),w=O.useRef(!1),b=g?f||!!g.closest("form"):!0,[k,N]=ac({prop:s,defaultProp:i??!1,onChange:h,caller:iv});return l.jsxs(cJ,{scope:n,checked:k,disabled:o,children:[l.jsx(fn.button,{type:"button",role:"switch","aria-checked":k,"aria-required":a,"data-state":fz(k),"data-disabled":o?"":void 0,disabled:o,value:u,...m,ref:y,onClick:Xe(t.onClick,C=>{N(T=>!T),b&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})}),b&&l.jsx(hz,{control:g,bubbles:!w.current,name:r,value:u,checked:k,required:a,disabled:o,form:f,style:{transform:"translateX(-100%)"}})]})});cz.displayName=iv;var uz="SwitchThumb",dz=O.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=uJ(uz,n);return l.jsx(fn.span,{"data-state":fz(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});dz.displayName=uz;var dJ="SwitchBubbleInput",hz=O.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const a=O.useRef(null),o=Pn(a,i),u=cR(n),h=uR(e);return O.useEffect(()=>{const f=a.current;if(!f)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&x){const y=new Event("click",{bubbles:r});x.call(f,n),f.dispatchEvent(y)}},[u,n,r]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:o,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});hz.displayName=dJ;function fz(t){return t?"checked":"unchecked"}var mz=cz,hJ=dz;const Dt=O.forwardRef(({className:t,...e},n)=>l.jsx(mz,{className:Se("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:l.jsx(hJ,{className:Se("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Dt.displayName=mz.displayName;const fJ=bh("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ce=O.forwardRef(({className:t,...e},n)=>l.jsx(dR,{ref:n,className:Se(fJ(),t),...e}));ce.displayName=dR.displayName;const Re=O.forwardRef(({className:t,type:e,...n},r)=>l.jsx("input",{type:e,className:Se("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Re.displayName="Input";const mJ=5,pJ=5e3;let y2=0;function gJ(){return y2=(y2+1)%Number.MAX_SAFE_INTEGER,y2.toString()}const b2=new Map,oC=t=>{if(b2.has(t))return;const e=setTimeout(()=>{b2.delete(t),rm({type:"REMOVE_TOAST",toastId:t})},pJ);b2.set(t,e)},xJ=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,mJ)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?oC(n):t.toasts.forEach(r=>{oC(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},bx=[];let wx={toasts:[]};function rm(t){wx=xJ(wx,t),bx.forEach(e=>{e(wx)})}function vJ({...t}){const e=gJ(),n=s=>rm({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>rm({type:"DISMISS_TOAST",toastId:e});return rm({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function $r(){const[t,e]=O.useState(wx);return O.useEffect(()=>(bx.push(e),()=>{const n=bx.indexOf(e);n>-1&&bx.splice(n,1)}),[t]),{...t,toast:vJ,dismiss:n=>rm({type:"DISMISS_TOAST",toastId:n})}}const yJ=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:t=>t.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:t=>/[A-Z]/.test(t)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:t=>/[a-z]/.test(t)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:t=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(t)}];function bJ(t){const e=yJ.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(t)}));return{isValid:e.every(r=>r.passed),rules:e}}const yk="0.11.5",bk="MaiBot Dashboard",wJ=`${bk} v${yk}`,SJ=(t="v")=>`${t}${yk}`,Mr=ek,wk=hR,kJ=YS,pz=O.forwardRef(({className:t,...e},n)=>l.jsx(H1,{ref:n,className:Se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));pz.displayName=H1.displayName;const vr=O.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(kJ,{children:[l.jsx(pz,{}),l.jsxs(V1,{ref:r,className:Se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,l.jsxs(ZS,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(s0,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));vr.displayName=V1.displayName;const yr=({className:t,...e})=>l.jsx("div",{className:Se("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});yr.displayName="DialogHeader";const Ns=({className:t,...e})=>l.jsx("div",{className:Se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Ns.displayName="DialogFooter";const br=O.forwardRef(({className:t,...e},n)=>l.jsx(KS,{ref:n,className:Se("text-lg font-semibold leading-none tracking-tight",t),...e}));br.displayName=KS.displayName;const as=O.forwardRef(({className:t,...e},n)=>l.jsx(JS,{ref:n,className:Se("text-sm text-muted-foreground",t),...e}));as.displayName=JS.displayName;var OJ=Symbol("radix.slottable");function jJ(t){const e=({children:n})=>l.jsx(l.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=OJ,e}var gz="AlertDialog",[NJ]=la(gz,[fR]),Yl=fR(),xz=t=>{const{__scopeAlertDialog:e,...n}=t,r=Yl(e);return l.jsx(ek,{...r,...n,modal:!0})};xz.displayName=gz;var CJ="AlertDialogTrigger",vz=O.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return l.jsx(hR,{...s,...r,ref:e})});vz.displayName=CJ;var TJ="AlertDialogPortal",yz=t=>{const{__scopeAlertDialog:e,...n}=t,r=Yl(e);return l.jsx(YS,{...r,...n})};yz.displayName=TJ;var EJ="AlertDialogOverlay",bz=O.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return l.jsx(H1,{...s,...r,ref:e})});bz.displayName=EJ;var Dd="AlertDialogContent",[_J,MJ]=NJ(Dd),AJ=jJ("AlertDialogContent"),wz=O.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=Yl(n),a=O.useRef(null),o=Pn(e,a),u=O.useRef(null);return l.jsx(pX,{contentName:Dd,titleName:Sz,docsSlug:"alert-dialog",children:l.jsx(_J,{scope:n,cancelRef:u,children:l.jsxs(V1,{role:"alertdialog",...i,...s,ref:o,onOpenAutoFocus:Xe(s.onOpenAutoFocus,h=>{h.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[l.jsx(AJ,{children:r}),l.jsx(DJ,{contentRef:a})]})})})});wz.displayName=Dd;var Sz="AlertDialogTitle",kz=O.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return l.jsx(KS,{...s,...r,ref:e})});kz.displayName=Sz;var Oz="AlertDialogDescription",jz=O.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return l.jsx(JS,{...s,...r,ref:e})});jz.displayName=Oz;var RJ="AlertDialogAction",Nz=O.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return l.jsx(ZS,{...s,...r,ref:e})});Nz.displayName=RJ;var Cz="AlertDialogCancel",Tz=O.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=MJ(Cz,n),i=Yl(n),a=Pn(e,s);return l.jsx(ZS,{...i,...r,ref:a})});Tz.displayName=Cz;var DJ=({contentRef:t})=>{const e=`\`${Dd}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${Dd}\` by passing a \`${Oz}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Dd}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return O.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},zJ=xz,PJ=vz,LJ=yz,Ez=bz,_z=wz,Mz=Nz,Az=Tz,Rz=kz,Dz=jz;const wn=zJ,qr=PJ,BJ=LJ,zz=O.forwardRef(({className:t,...e},n)=>l.jsx(Ez,{className:Se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));zz.displayName=Ez.displayName;const sn=O.forwardRef(({className:t,...e},n)=>l.jsxs(BJ,{children:[l.jsx(zz,{}),l.jsx(_z,{ref:n,className:Se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));sn.displayName=_z.displayName;const an=({className:t,...e})=>l.jsx("div",{className:Se("flex flex-col space-y-2 text-center sm:text-left",t),...e});an.displayName="AlertDialogHeader";const ln=({className:t,...e})=>l.jsx("div",{className:Se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ln.displayName="AlertDialogFooter";const on=O.forwardRef(({className:t,...e},n)=>l.jsx(Rz,{ref:n,className:Se("text-lg font-semibold",t),...e}));on.displayName=Rz.displayName;const cn=O.forwardRef(({className:t,...e},n)=>l.jsx(Dz,{ref:n,className:Se("text-sm text-muted-foreground",t),...e}));cn.displayName=Dz.displayName;const un=O.forwardRef(({className:t,...e},n)=>l.jsx(Mz,{ref:n,className:Se(vm(),t),...e}));un.displayName=Mz.displayName;const dn=O.forwardRef(({className:t,...e},n)=>l.jsx(Az,{ref:n,className:Se(vm({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));dn.displayName=Az.displayName;function IJ(){return l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),l.jsxs(ql,{defaultValue:"appearance",className:"w-full",children:[l.jsxs(La,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[l.jsxs(Zt,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(TR,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"外观"})]}),l.jsxs(Zt,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(_X,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"安全"})]}),l.jsxs(Zt,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(Zc,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"其他"})]}),l.jsxs(Zt,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(Il,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"关于"})]})]}),l.jsxs(yn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[l.jsx(An,{value:"appearance",className:"mt-0",children:l.jsx(qJ,{})}),l.jsx(An,{value:"security",className:"mt-0",children:l.jsx(FJ,{})}),l.jsx(An,{value:"other",className:"mt-0",children:l.jsx($J,{})}),l.jsx(An,{value:"about",className:"mt-0",children:l.jsx(QJ,{})})]})]})]})}function cC(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const a=parseInt(i.substring(0,2),16)/255,o=parseInt(i.substring(2,4),16)/255,u=parseInt(i.substring(4,6),16)/255,h=Math.max(a,o,u),f=Math.min(a,o,u);let m=0,g=0;const x=(h+f)/2;if(h!==f){const y=h-f;switch(g=x>.5?y/(2-h-f):y/(h+f),h){case a:m=((o-u)/y+(olocalStorage.getItem("accent-color")||"blue");O.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";cC(h)},[]);const u=h=>{o(h),localStorage.setItem("accent-color",h),cC(h)};return l.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[l.jsx(w2,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),l.jsx(w2,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),l.jsx(w2,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),l.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[l.jsx(Ti,{value:"blue",current:a,onChange:u,label:"蓝色",colorClass:"bg-blue-500"}),l.jsx(Ti,{value:"purple",current:a,onChange:u,label:"紫色",colorClass:"bg-purple-500"}),l.jsx(Ti,{value:"green",current:a,onChange:u,label:"绿色",colorClass:"bg-green-500"}),l.jsx(Ti,{value:"orange",current:a,onChange:u,label:"橙色",colorClass:"bg-orange-500"}),l.jsx(Ti,{value:"pink",current:a,onChange:u,label:"粉色",colorClass:"bg-pink-500"}),l.jsx(Ti,{value:"red",current:a,onChange:u,label:"红色",colorClass:"bg-red-500"})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),l.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[l.jsx(Ti,{value:"gradient-sunset",current:a,onChange:u,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),l.jsx(Ti,{value:"gradient-ocean",current:a,onChange:u,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),l.jsx(Ti,{value:"gradient-forest",current:a,onChange:u,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),l.jsx(Ti,{value:"gradient-aurora",current:a,onChange:u,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),l.jsx(Ti,{value:"gradient-fire",current:a,onChange:u,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),l.jsx(Ti,{value:"gradient-twilight",current:a,onChange:u,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[l.jsx("div",{className:"flex-1",children:l.jsx("input",{type:"color",value:a.startsWith("#")?a:"#3b82f6",onChange:h=>u(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),l.jsx("div",{className:"flex-1",children:l.jsx(Re,{type:"text",value:a,onChange:h=>u(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),l.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),l.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[l.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5 flex-1",children:[l.jsx(ce,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),l.jsx(Dt,{id:"animations",checked:n,onCheckedChange:r})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5 flex-1",children:[l.jsx(ce,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),l.jsx(Dt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function FJ(){const t=aa(),[e,n]=O.useState(""),[r,s]=O.useState(""),[i,a]=O.useState(!1),[o,u]=O.useState(!1),[h,f]=O.useState(!1),[m,g]=O.useState(!1),[x,y]=O.useState(!1),[w,b]=O.useState(!1),[k,N]=O.useState(""),[C,T]=O.useState(!1),{toast:E}=$r(),_=O.useMemo(()=>bJ(r),[r]),A=()=>localStorage.getItem("access-token")||"",F=async z=>{try{await navigator.clipboard.writeText(z),y(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},B=async()=>{if(!r.trim()){E({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!_.isValid){const z=_.rules.filter(W=>!W.passed).map(W=>W.label).join(", ");E({title:"格式错误",description:`Token 不符合要求: ${z}`,variant:"destructive"});return}f(!0);try{const z=A(),W=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({new_token:r.trim()})}),q=await W.json();W.ok&&q.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),E({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):E({title:"更新失败",description:q.message||"无法更新 Token",variant:"destructive"})}catch(z){console.error("更新 Token 错误:",z),E({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{f(!1)}},P=async()=>{g(!0);try{const z=A(),W=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}}),q=await W.json();W.ok&&q.success?(localStorage.setItem("access-token",q.token),n(q.token),N(q.token),b(!0),T(!1),E({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):E({title:"生成失败",description:q.message||"无法生成新 Token",variant:"destructive"})}catch(z){console.error("生成 Token 错误:",z),E({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{g(!1)}},H=async()=>{try{await navigator.clipboard.writeText(k),T(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},U=()=>{b(!1),setTimeout(()=>{N(""),T(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},te=z=>{z||U()};return l.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[l.jsx(Mr,{open:w,onOpenChange:te,children:l.jsxs(vr,{className:"sm:max-w-md",children:[l.jsxs(yr,{children:[l.jsxs(br,{className:"flex items-center gap-2",children:[l.jsx(Rd,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),l.jsx(as,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[l.jsx(ce,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),l.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:k})]}),l.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Rd,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),l.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[l.jsx("p",{className:"font-semibold",children:"重要提示"}),l.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[l.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),l.jsx("li",{children:"请立即复制并保存到安全的位置"}),l.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),l.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),l.jsxs(Ns,{className:"gap-2 sm:gap-0",children:[l.jsx(de,{variant:"outline",onClick:H,className:"gap-2",children:C?l.jsxs(l.Fragment,{children:[l.jsx(Kc,{className:"h-4 w-4 text-green-500"}),"已复制"]}):l.jsxs(l.Fragment,{children:[l.jsx(D5,{className:"h-4 w-4"}),"复制 Token"]})}),l.jsx(de,{onClick:U,children:"我已保存,关闭"})]})]})}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),l.jsx("div",{className:"space-y-3 sm:space-y-4",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx(Re,{id:"current-token",type:i?"text":"password",value:e||A(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),l.jsx("button",{onClick:()=>{e||n(A()),a(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?l.jsx(z5,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(na,{className:"h-4 w-4 text-muted-foreground"})})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[l.jsx(de,{variant:"outline",size:"icon",onClick:()=>F(A()),title:"复制到剪贴板",className:"flex-shrink-0",children:x?l.jsx(Kc,{className:"h-4 w-4 text-green-500"}):l.jsx(D5,{className:"h-4 w-4"})}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsxs(de,{variant:"outline",disabled:m,className:"gap-2 flex-1 sm:flex-none",children:[l.jsx(hi,{className:Se("h-4 w-4",m&&"animate-spin")}),l.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),l.jsx("span",{className:"sm:hidden",children:"生成"})]})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认重新生成 Token"}),l.jsx(cn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:P,children:"确认生成"})]})]})]})]})]}),l.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),l.jsxs("div",{className:"relative",children:[l.jsx(Re,{id:"new-token",type:o?"text":"password",value:r,onChange:z=>s(z.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),l.jsx("button",{onClick:()=>u(!o),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:o?"隐藏":"显示",children:o?l.jsx(z5,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(na,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&l.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),l.jsx("div",{className:"space-y-1.5",children:_.rules.map(z=>l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[z.passed?l.jsx(Ea,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):l.jsx(P5,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),l.jsx("span",{className:Se(z.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:z.label})]},z.id))}),_.isValid&&l.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:l.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[l.jsx(Kc,{className:"h-4 w-4"}),l.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),l.jsx(de,{onClick:B,disabled:h||!_.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),l.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[l.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),l.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),l.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),l.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),l.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),l.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),l.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function $J(){const t=aa(),{toast:e}=$r(),[n,r]=O.useState(!1),s=async()=>{r(!0);try{const i=localStorage.getItem("access-token"),a=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${i}`}}),o=await a.json();a.ok&&o.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:o.message||"无法重置配置状态",variant:"destructive"})}catch(i){console.error("重置配置状态错误:",i),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return l.jsx("div",{className:"space-y-4 sm:space-y-6",children:l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsx("div",{className:"space-y-2",children:l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsxs(de,{variant:"outline",disabled:n,className:"gap-2",children:[l.jsx(MX,{className:Se("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认重新配置"}),l.jsx(cn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:s,children:"确认重置"})]})]})]})]})]})})}function QJ(){return l.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[l.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:l.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[l.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:l.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),l.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),l.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:Se("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[l.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",bk]}),l.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[l.jsxs("p",{children:["版本: ",yk]}),l.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),l.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",l.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"React 19.2.0"}),l.jsx("li",{children:"TypeScript 5.7.2"}),l.jsx("li",{children:"Vite 6.0.7"}),l.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"shadcn/ui"}),l.jsx("li",{children:"Radix UI"}),l.jsx("li",{children:"Tailwind CSS 3.4.17"}),l.jsx("li",{children:"Lucide Icons"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"后端"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"Python 3.12+"}),l.jsx("li",{children:"FastAPI"}),l.jsx("li",{children:"Uvicorn"}),l.jsx("li",{children:"WebSocket"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"Bun / npm"}),l.jsx("li",{children:"ESLint 9.17.0"}),l.jsx("li",{children:"PostCSS"})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),l.jsx(yn,{className:"h-[300px] sm:h-[400px]",children:l.jsxs("div",{className:"space-y-4 pr-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(rr,{name:"React",description:"用户界面构建库",license:"MIT"}),l.jsx(rr,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),l.jsx(rr,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),l.jsx(rr,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),l.jsx(rr,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(rr,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),l.jsx(rr,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(rr,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),l.jsx(rr,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(rr,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),l.jsx(rr,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),l.jsx(rr,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),l.jsx(rr,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(rr,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),l.jsx(rr,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(rr,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),l.jsx(rr,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),l.jsx(rr,{name:"Pydantic",description:"数据验证库",license:"MIT"}),l.jsx(rr,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(rr,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),l.jsx(rr,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),l.jsx(rr,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),l.jsx(rr,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:l.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[l.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:l.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function rr({name:t,description:e,license:n}){return l.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-foreground truncate",children:t}),l.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),l.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function w2({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return l.jsxs("button",{onClick:()=>n(t),className:Se("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&l.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),l.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),l.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Ti({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return l.jsxs("button",{onClick:()=>n(t),className:Se("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&l.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),l.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[l.jsx("div",{className:Se("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),l.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class HJ{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),a=this.fade(n),o=this.perm[r]+s,u=this.perm[o],h=this.perm[o+1],f=this.perm[r+1]+s,m=this.perm[f],g=this.perm[f+1];return this.mix(this.mix(this.dot(this.grad3[u%12],e,n),this.dot(this.grad3[m%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[g%12],e-1,n-1),i),a)}}function VJ(){const t=O.useRef(null),e=O.useRef(null),n=O.useRef(void 0),r=O.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new HJ(Math.random()),bounding:null});return O.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const a=r.current,o=()=>{const w=s.getBoundingClientRect();a.bounding=w,i.style.width=`${w.width}px`,i.style.height=`${w.height}px`},u=()=>{if(!a.bounding)return;const{width:w,height:b}=a.bounding;a.lines=[],a.paths.forEach(B=>B.remove()),a.paths=[];const k=10,N=32,C=w+200,T=b+30,E=Math.ceil(C/k),_=Math.ceil(T/N),A=(w-k*E)/2,F=(b-N*_)/2;for(let B=0;B<=E;B++){const P=[];for(let U=0;U<=_;U++){const te={x:A+k*B,y:F+N*U,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};P.push(te)}const H=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(H),a.paths.push(H),a.lines.push(P)}},h=w=>{const{lines:b,mouse:k,noise:N}=a;b.forEach(C=>{C.forEach(T=>{const E=N.perlin2((T.x+w*.0125)*.002,(T.y+w*.005)*.0015)*12;T.wave.x=Math.cos(E)*32,T.wave.y=Math.sin(E)*16;const _=T.x-k.sx,A=T.y-k.sy,F=Math.hypot(_,A),B=Math.max(175,k.vs);if(F{const k={x:w.x+w.wave.x+(b?w.cursor.x:0),y:w.y+w.wave.y+(b?w.cursor.y:0)};return k.x=Math.round(k.x*10)/10,k.y=Math.round(k.y*10)/10,k},m=()=>{const{lines:w,paths:b}=a;w.forEach((k,N)=>{let C=f(k[0],!1),T=`M ${C.x} ${C.y}`;k.forEach((E,_)=>{const A=_===k.length-1;C=f(E,!A),T+=`L ${C.x} ${C.y}`}),b[N].setAttribute("d",T)})},g=w=>{const{mouse:b}=a;b.sx+=(b.x-b.sx)*.1,b.sy+=(b.y-b.sy)*.1;const k=b.x-b.lx,N=b.y-b.ly,C=Math.hypot(k,N);b.v=C,b.vs+=(C-b.vs)*.1,b.vs=Math.min(100,b.vs),b.lx=b.x,b.ly=b.y,b.a=Math.atan2(N,k),s&&(s.style.setProperty("--x",`${b.sx}px`),s.style.setProperty("--y",`${b.sy}px`)),h(w),m(),n.current=requestAnimationFrame(g)},x=w=>{if(!a.bounding)return;const{mouse:b}=a;b.x=w.pageX-a.bounding.left,b.y=w.pageY-a.bounding.top+window.scrollY,b.set||(b.sx=b.x,b.sy=b.y,b.lx=b.x,b.ly=b.y,b.set=!0)},y=()=>{o(),u()};return o(),u(),window.addEventListener("resize",y),window.addEventListener("mousemove",x),n.current=requestAnimationFrame(g),()=>{window.removeEventListener("resize",y),window.removeEventListener("mousemove",x),n.current&&cancelAnimationFrame(n.current)}},[]),l.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[l.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),l.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:l.jsx("style",{children:` path { fill: none; stroke: hsl(var(--primary) / 0.20); stroke-width: 1px; } `})})]})}function UJ(){const t=aa();O.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function Pz(){return!!localStorage.getItem("access-token")}function WJ(){const[t,e]=O.useState(""),[n,r]=O.useState(!1),[s,i]=O.useState(""),a=aa(),{enableWavesBackground:o,setEnableWavesBackground:u}=oz(),{theme:h,setTheme:f}=vk();O.useEffect(()=>{Pz()&&a({to:"/"})},[a]);const g=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,x=()=>{f(g==="dark"?"light":"dark")},y=async w=>{if(w.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const b=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),k=await b.json();if(b.ok&&k.valid){localStorage.setItem("access-token",t.trim());const N=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),C=await N.json();N.ok&&C.is_first_setup?a({to:"/setup"}):a({to:"/"})}else i(k.message||"Token 验证失败,请检查后重试")}catch(b){console.error("Token 验证错误:",b),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return l.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[o&&l.jsx(VJ,{}),l.jsxs(Ct,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[l.jsx("button",{onClick:x,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:g==="dark"?"切换到浅色模式":"切换到深色模式",children:g==="dark"?l.jsx(L5,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):l.jsx(B5,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),l.jsxs(xn,{className:"space-y-4 text-center",children:[l.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:l.jsx(O8,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(vn,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),l.jsx(Lr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),l.jsx(Tn,{children:l.jsxs("form",{onSubmit:y,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),l.jsxs("div",{className:"relative",children:[l.jsx(AX,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),l.jsx(Re,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:w=>e(w.target.value),className:Se("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&l.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[l.jsx(su,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),l.jsx("span",{children:s})]}),l.jsx(de,{type:"submit",className:"w-full",disabled:n,children:n?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),l.jsxs(Mr,{children:[l.jsx(wk,{asChild:!0,children:l.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[l.jsx(RX,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),l.jsxs(vr,{className:"sm:max-w-md",children:[l.jsxs(yr,{children:[l.jsxs(br,{className:"flex items-center gap-2",children:[l.jsx(O8,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),l.jsx(as,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(DX,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),l.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[l.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),l.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Dl,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),l.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:l.jsx("code",{className:"text-primary",children:"data/webui.json"})}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",l.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),l.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx(su,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[l.jsx("p",{className:"font-semibold",children:"安全提示"}),l.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[l.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),l.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[l.jsx(pm,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsxs(on,{className:"flex items-center gap-2",children:[l.jsx(pm,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),l.jsx(cn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>u(!1),children:"关闭动画"})]})]})]})]})})]}),l.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:l.jsx("p",{children:wJ})})]})}const Rn=O.forwardRef(({className:t,...e},n)=>l.jsx("textarea",{className:Se("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));Rn.displayName="Textarea";var GJ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],XJ=GJ.reduce((t,e)=>{const n=XS(`Primitive.${e}`),r=O.forwardRef((s,i)=>{const{asChild:a,...o}=s,u=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(u,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),YJ="Separator",uC="horizontal",ZJ=["horizontal","vertical"],Lz=O.forwardRef((t,e)=>{const{decorative:n,orientation:r=uC,...s}=t,i=KJ(r)?r:uC,o=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return l.jsx(XJ.div,{"data-orientation":i,...o,...s,ref:e})});Lz.displayName=YJ;function KJ(t){return ZJ.includes(t)}var Bz=Lz;const ym=O.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>l.jsx(Bz,{ref:s,decorative:n,orientation:e,className:Se("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));ym.displayName=Bz.displayName;const JJ=bh("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function kn({className:t,variant:e,...n}){return l.jsx("div",{className:Se(JJ({variant:e}),t),...n})}function eee({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,a)=>a!==s)})};return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"qq_account",children:"QQ账号 *"}),l.jsx(Re,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"nickname",children:"昵称 *"}),l.jsx(Re,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{children:"别名"}),l.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>l.jsxs(kn,{variant:"secondary",className:"gap-1",children:[s,l.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:l.jsx(s0,{className:"h-3 w-3"})})]},i))}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Re,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),l.jsx(de,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function tee({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"personality",children:"人格特征 *"}),l.jsx(Rn,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"reply_style",children:"表达风格 *"}),l.jsx(Rn,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"interest",children:"兴趣 *"}),l.jsx(Rn,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),l.jsx(ym,{}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"plan_style",children:"群聊说话规则 *"}),l.jsx(Rn,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),l.jsx(Rn,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function nee({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ce,{htmlFor:"emoji_chance",children:"表情包激活概率"}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),l.jsx(Re,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"max_reg_num",children:"最大表情包数量"}),l.jsx(Re,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ce,{htmlFor:"do_replace",children:"达到最大数量时替换"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),l.jsx(Dt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),l.jsx(Re,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),l.jsx(ym,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ce,{htmlFor:"steal_emoji",children:"偷取表情包"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),l.jsx(Dt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ce,{htmlFor:"content_filtration",children:"启用表情包过滤"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),l.jsx(Dt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"filtration_prompt",children:"过滤要求"}),l.jsx(Re,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function ree({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ce,{htmlFor:"enable_tool",children:"启用工具系统"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),l.jsx(Dt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),l.jsx(ym,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ce,{htmlFor:"enable_mood",children:"启用情绪系统"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),l.jsx(Dt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&l.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),l.jsx(Re,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(ce,{htmlFor:"emotion_style",children:"情感特征"}),l.jsx(Rn,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),l.jsx(ym,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(ce,{htmlFor:"all_global",children:"启用全局黑话模式"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),l.jsx(Dt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}async function yt(t,e){const n=await fetch(t,e);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function Et(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function see(){const t=await yt("/api/webui/config/bot",{method:"GET",headers:Et()});if(!t.ok)throw new Error("读取Bot配置失败");const n=(await t.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function iee(){const t=await yt("/api/webui/config/bot",{method:"GET",headers:Et()});if(!t.ok)throw new Error("读取人格配置失败");const n=(await t.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function aee(){const t=await yt("/api/webui/config/bot",{method:"GET",headers:Et()});if(!t.ok)throw new Error("读取表情包配置失败");const n=(await t.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function lee(){const t=await yt("/api/webui/config/bot",{method:"GET",headers:Et()});if(!t.ok)throw new Error("读取其他配置失败");const n=(await t.json()).config,r=n.tool||{},s=n.mood||{},i=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:s.enable_mood??!1,mood_update_threshold:s.mood_update_threshold,emotion_style:s.emotion_style,all_global:i.all_global??!0}}async function oee(t){const e=await yt("/api/webui/config/bot/section/bot",{method:"POST",headers:Et(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function cee(t){const e=await yt("/api/webui/config/bot/section/personality",{method:"POST",headers:Et(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function uee(t){const e=await yt("/api/webui/config/bot/section/emoji",{method:"POST",headers:Et(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function dee(t){const e=[];e.push(yt("/api/webui/config/bot/section/tool",{method:"POST",headers:Et(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(yt("/api/webui/config/bot/section/jargon",{method:"POST",headers:Et(),body:JSON.stringify({all_global:t.all_global})}));const n={enable_mood:t.enable_mood};t.enable_mood&&(n.mood_update_threshold=t.mood_update_threshold||1,n.emotion_style=t.emotion_style||""),e.push(yt("/api/webui/config/bot/section/mood",{method:"POST",headers:Et(),body:JSON.stringify(n)}));const r=await Promise.all(e);for(const s of r)if(!s.ok){const i=await s.json();throw new Error(i.detail||"保存其他配置失败")}return{success:!0}}async function dC(){const t=localStorage.getItem("access-token"),e=await yt("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}function hee(){const t=aa(),{toast:e}=$r(),[n,r]=O.useState(0),[s,i]=O.useState(!1),[a,o]=O.useState(!1),[u,h]=O.useState(!0),[f,m]=O.useState({qq_account:0,nickname:"",alias_names:[]}),[g,x]=O.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.请控制你的发言频率,不要太过频繁的发言 4.如果有人对你感到厌烦,请减少回复 5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.某句话如果已经被回复过,不要重复回复`}),[y,w]=O.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[b,k]=O.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),N=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:PX},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:ER},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:sk},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Zc},{id:"complete",title:"完成设置",description:"后续配置提示",icon:pm}],C=(n+1)/N.length*100;O.useEffect(()=>{(async()=>{try{h(!0);const[H,U,te,z]=await Promise.all([see(),iee(),aee(),lee()]);m(H),x(U),w(te),k(z)}catch(H){e({title:"加载配置失败",description:H instanceof Error?H.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const T=async()=>{o(!0);try{switch(n){case 0:await oee(f);break;case 1:await cee(g);break;case 2:await uee(y);break;case 3:await dee(b);break}return e({title:"保存成功",description:`${N[n].title}配置已保存`}),!0}catch(P){return e({title:"保存失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"}),!1}finally{o(!1)}},E=async()=>{await T()&&n{n>0&&r(n-1)},A=async()=>{i(!0);try{if(!await T()){i(!1);return}await dC(),e({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{t({to:"/"})},500)}catch(P){e({title:"完成失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}finally{i(!1)}},F=async()=>{try{await dC(),t({to:"/"})}catch(P){e({title:"跳过失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}},B=()=>{switch(n){case 0:return l.jsx(eee,{config:f,onChange:m});case 1:return l.jsx(tee,{config:g,onChange:x});case 2:return l.jsx(nee,{config:y,onChange:w});case 3:return l.jsx(ree,{config:b,onChange:k});case 4:return l.jsxs("div",{className:"space-y-6 text-center py-8",children:[l.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:l.jsx(pm,{className:"h-8 w-8 text-primary",strokeWidth:2})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),l.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"mt-0.5",children:l.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),l.jsxs("div",{children:[l.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"mt-0.5",children:l.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),l.jsxs("div",{children:[l.jsx("p",{className:"font-medium",children:"添加模型"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"mt-0.5",children:l.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),l.jsxs("div",{children:[l.jsx("p",{className:"font-medium",children:"配置模型任务"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return l.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[l.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[l.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),l.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),u?l.jsxs("div",{className:"relative z-10 text-center",children:[l.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:l.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),l.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),l.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[l.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[l.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:l.jsx(zX,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),l.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),l.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",bk," 的初始配置"]})]}),l.jsxs("div",{className:"mb-6 md:mb-8",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[l.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",N.length]}),l.jsxs("span",{className:"font-medium text-primary",children:[Math.round(C),"%"]})]}),l.jsx(h0,{value:C,className:"h-2"})]}),l.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:N.map((P,H)=>{const U=P.icon;return l.jsxs("div",{className:Se("flex flex-1 flex-col items-center gap-1 md:gap-2",Ht({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[l.jsx(Hx,{className:"h-4 w-4"}),"返回首页"]}),l.jsxs(de,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[l.jsx(_R,{className:"h-4 w-4"}),"返回上一页"]})]}),l.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:l.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var qz=["PageUp","PageDown"],Fz=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],$z={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},wh="Slider",[X5,fee,mee]=Q1(wh),[Qz]=la(wh,[mee]),[pee,av]=Qz(wh),Hz=O.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:a="horizontal",disabled:o=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:y,...w}=t,b=O.useRef(new Set),k=O.useRef(0),C=a==="horizontal"?gee:xee,[T=[],E]=ac({prop:f,defaultProp:h,onChange:H=>{[...b.current][k.current]?.focus(),m(H)}}),_=O.useRef(T);function A(H){const U=See(T,H);P(H,U)}function F(H){P(H,k.current)}function B(){const H=_.current[k.current];T[k.current]!==H&&g(T)}function P(H,U,{commit:te}={commit:!1}){const z=Nee(i),W=Cee(Math.round((H-r)/i)*i+r,z),q=GS(W,[r,s]);E((J=[])=>{const ee=bee(J,q,U);if(jee(ee,u*i)){k.current=ee.indexOf(q);const Y=String(ee)!==String(J);return Y&&te&&g(ee),Y?ee:J}else return J})}return l.jsx(pee,{scope:t.__scopeSlider,name:n,disabled:o,min:r,max:s,valueIndexToChangeRef:k,thumbs:b.current,values:T,orientation:a,form:y,children:l.jsx(X5.Provider,{scope:t.__scopeSlider,children:l.jsx(X5.Slot,{scope:t.__scopeSlider,children:l.jsx(C,{"aria-disabled":o,"data-disabled":o?"":void 0,...w,ref:e,onPointerDown:Xe(w.onPointerDown,()=>{o||(_.current=T)}),min:r,max:s,inverted:x,onSlideStart:o?void 0:A,onSlideMove:o?void 0:F,onSlideEnd:o?void 0:B,onHomeKeyDown:()=>!o&&P(r,0,{commit:!0}),onEndKeyDown:()=>!o&&P(s,T.length-1,{commit:!0}),onStepKeyDown:({event:H,direction:U})=>{if(!o){const W=qz.includes(H.key)||H.shiftKey&&Fz.includes(H.key)?10:1,q=k.current,J=T[q],ee=i*W*U;P(J+ee,q,{commit:!0})}}})})})})});Hz.displayName=wh;var[Vz,Uz]=Qz(wh,{startEdge:"left",endEdge:"right",size:"width",direction:1}),gee=O.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=O.useState(null),x=Pn(e,C=>g(C)),y=O.useRef(void 0),w=n0(s),b=w==="ltr",k=b&&!i||!b&&i;function N(C){const T=y.current||m.getBoundingClientRect(),E=[0,T.width],A=Sk(E,k?[n,r]:[r,n]);return y.current=T,A(C-T.left)}return l.jsx(Vz,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:l.jsx(Wz,{dir:w,"data-orientation":"horizontal",...f,ref:x,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const T=N(C.clientX);a?.(T)},onSlideMove:C=>{const T=N(C.clientX);o?.(T)},onSlideEnd:()=>{y.current=void 0,u?.()},onStepKeyDown:C=>{const E=$z[k?"from-left":"from-right"].includes(C.key);h?.({event:C,direction:E?-1:1})}})})}),xee=O.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:o,onStepKeyDown:u,...h}=t,f=O.useRef(null),m=Pn(e,f),g=O.useRef(void 0),x=!s;function y(w){const b=g.current||f.current.getBoundingClientRect(),k=[0,b.height],C=Sk(k,x?[r,n]:[n,r]);return g.current=b,C(w-b.top)}return l.jsx(Vz,{scope:t.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:l.jsx(Wz,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const b=y(w.clientY);i?.(b)},onSlideMove:w=>{const b=y(w.clientY);a?.(b)},onSlideEnd:()=>{g.current=void 0,o?.()},onStepKeyDown:w=>{const k=$z[x?"from-bottom":"from-top"].includes(w.key);u?.({event:w,direction:k?-1:1})}})})}),Wz=O.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:o,onStepKeyDown:u,...h}=t,f=av(wh,n);return l.jsx(fn.span,{...h,ref:e,onKeyDown:Xe(t.onKeyDown,m=>{m.key==="Home"?(a(m),m.preventDefault()):m.key==="End"?(o(m),m.preventDefault()):qz.concat(Fz).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:Xe(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:Xe(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:Xe(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),Gz="SliderTrack",Xz=O.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=av(Gz,n);return l.jsx(fn.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});Xz.displayName=Gz;var Y5="SliderRange",Yz=O.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=av(Y5,n),i=Uz(Y5,n),a=O.useRef(null),o=Pn(e,a),u=s.values.length,h=s.values.map(g=>Jz(g,s.min,s.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return l.jsx(fn.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:o,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});Yz.displayName=Y5;var Z5="SliderThumb",Zz=O.forwardRef((t,e)=>{const n=fee(t.__scopeSlider),[r,s]=O.useState(null),i=Pn(e,o=>s(o)),a=O.useMemo(()=>r?n().findIndex(o=>o.ref.current===r):-1,[n,r]);return l.jsx(vee,{...t,ref:i,index:a})}),vee=O.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,a=av(Z5,n),o=Uz(Z5,n),[u,h]=O.useState(null),f=Pn(e,N=>h(N)),m=u?a.form||!!u.closest("form"):!0,g=uR(u),x=a.values[r],y=x===void 0?0:Jz(x,a.min,a.max),w=wee(r,a.values.length),b=g?.[o.size],k=b?kee(b,y,o.direction):0;return O.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),l.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[o.startEdge]:`calc(${y}% + ${k}px)`},children:[l.jsx(X5.ItemSlot,{scope:t.__scopeSlider,children:l.jsx(fn.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":a.min,"aria-valuenow":x,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:f,style:x===void 0?{display:"none"}:t.style,onFocus:Xe(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),m&&l.jsx(Kz,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:x},r)]})});Zz.displayName=Z5;var yee="RadioBubbleInput",Kz=O.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=O.useRef(null),i=Pn(s,r),a=cR(e);return O.useEffect(()=>{const o=s.current;if(!o)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==e&&f){const m=new Event("input",{bubbles:!0});f.call(o,e),o.dispatchEvent(m)}},[a,e]),l.jsx(fn.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});Kz.displayName=yee;function bee(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function Jz(t,e,n){const i=100/(n-e)*(t-e);return GS(i,[0,100])}function wee(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function See(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function kee(t,e,n){const r=t/2,i=Sk([0,50],[0,r]);return(r-i(e)*n)*n}function Oee(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function jee(t,e){if(e>0){const n=Oee(t);return Math.min(...n)>=e}return!0}function Sk(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function Nee(t){return(String(t).split(".")[1]||"").length}function Cee(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var eP=Hz,Tee=Xz,Eee=Yz,_ee=Zz;const lv=O.forwardRef(({className:t,...e},n)=>l.jsxs(eP,{ref:n,className:Se("relative flex w-full touch-none select-none items-center",t),...e,children:[l.jsx(Tee,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:l.jsx(Eee,{className:"absolute h-full bg-primary"})}),l.jsx(_ee,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));lv.displayName=eP.displayName;const It=wX,qt=SX,Pt=O.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(mR,{ref:r,className:Se("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,l.jsx(gX,{asChild:!0,children:l.jsx(gm,{className:"h-4 w-4 opacity-50"})})]}));Pt.displayName=mR.displayName;const tP=O.forwardRef(({className:t,...e},n)=>l.jsx(pR,{ref:n,className:Se("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(I5,{className:"h-4 w-4"})}));tP.displayName=pR.displayName;const nP=O.forwardRef(({className:t,...e},n)=>l.jsx(gR,{ref:n,className:Se("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(gm,{className:"h-4 w-4"})}));nP.displayName=gR.displayName;const Lt=O.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>l.jsx(xX,{children:l.jsxs(xR,{ref:s,className:Se("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[l.jsx(tP,{}),l.jsx(vX,{className:Se("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(nP,{})]})}));Lt.displayName=xR.displayName;const Mee=O.forwardRef(({className:t,...e},n)=>l.jsx(vR,{ref:n,className:Se("px-2 py-1.5 text-sm font-semibold",t),...e}));Mee.displayName=vR.displayName;const ze=O.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(yR,{ref:r,className:Se("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(yX,{children:l.jsx(Kc,{className:"h-4 w-4"})})}),l.jsx(bX,{children:e})]}));ze.displayName=yR.displayName;const Aee=O.forwardRef(({className:t,...e},n)=>l.jsx(bR,{ref:n,className:Se("-mx-1 my-1 h-px bg-muted",t),...e}));Aee.displayName=bR.displayName;function Ree(t){const e=Dee(t),n=O.forwardRef((r,s)=>{const{children:i,...a}=r,o=O.Children.toArray(i),u=o.find(Pee);if(u){const h=u.props.children,f=o.map(m=>m===u?O.Children.count(h)>1?O.Children.only(null):O.isValidElement(h)?h.props.children:null:m);return l.jsx(e,{...a,ref:s,children:O.isValidElement(h)?O.cloneElement(h,void 0,f):null})}return l.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function Dee(t){const e=O.forwardRef((n,r)=>{const{children:s,...i}=n;if(O.isValidElement(s)){const a=Bee(s),o=Lee(i,s.props);return s.type!==O.Fragment&&(o.ref=r?Uo(r,a):a),O.cloneElement(s,o)}return O.Children.count(s)>1?O.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var zee=Symbol("radix.slottable");function Pee(t){return O.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===zee}function Lee(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...o)=>{const u=i(...o);return s(...o),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Bee(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var ov="Popover",[rP]=la(ov,[ph]),f0=ph(),[Iee,lc]=rP(ov),sP=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=t,o=f0(e),u=O.useRef(null),[h,f]=O.useState(!1),[m,g]=ac({prop:r,defaultProp:s??!1,onChange:i,caller:ov});return l.jsx(W1,{...o,children:l.jsx(Iee,{scope:e,contentId:Li(),triggerRef:u,open:m,onOpenChange:g,onOpenToggle:O.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:h,onCustomAnchorAdd:O.useCallback(()=>f(!0),[]),onCustomAnchorRemove:O.useCallback(()=>f(!1),[]),modal:a,children:n})})};sP.displayName=ov;var iP="PopoverAnchor",qee=O.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=lc(iP,n),i=f0(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=s;return O.useEffect(()=>(a(),()=>o()),[a,o]),l.jsx(G1,{...i,...r,ref:e})});qee.displayName=iP;var aP="PopoverTrigger",lP=O.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=lc(aP,n),i=f0(n),a=Pn(e,s.triggerRef),o=l.jsx(fn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":hP(s.open),...r,ref:a,onClick:Xe(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?o:l.jsx(G1,{asChild:!0,...i,children:o})});lP.displayName=aP;var kk="PopoverPortal",[Fee,$ee]=rP(kk,{forceMount:void 0}),oP=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=lc(kk,e);return l.jsx(Fee,{scope:e,forceMount:n,children:l.jsx(Ws,{present:n||i.open,children:l.jsx(U1,{asChild:!0,container:s,children:r})})})};oP.displayName=kk;var Zd="PopoverContent",cP=O.forwardRef((t,e)=>{const n=$ee(Zd,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=lc(Zd,t.__scopePopover);return l.jsx(Ws,{present:r||i.open,children:i.modal?l.jsx(Hee,{...s,ref:e}):l.jsx(Vee,{...s,ref:e})})});cP.displayName=Zd;var Qee=Ree("PopoverContent.RemoveScroll"),Hee=O.forwardRef((t,e)=>{const n=lc(Zd,t.__scopePopover),r=O.useRef(null),s=Pn(e,r),i=O.useRef(!1);return O.useEffect(()=>{const a=r.current;if(a)return wR(a)},[]),l.jsx(SR,{as:Qee,allowPinchZoom:!0,children:l.jsx(uP,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Xe(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Xe(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,u=o.button===0&&o.ctrlKey===!0,h=o.button===2||u;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:Xe(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Vee=O.forwardRef((t,e)=>{const n=lc(Zd,t.__scopePopover),r=O.useRef(!1),s=O.useRef(!1);return l.jsx(uP,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;n.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),uP=O.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:h,onInteractOutside:f,...m}=t,g=lc(Zd,n),x=f0(n);return kR(),l.jsx(OR,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:l.jsx(tk,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:f,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:h,onDismiss:()=>g.onOpenChange(!1),children:l.jsx(nk,{"data-state":hP(g.open),role:"dialog",id:g.contentId,...x,...m,ref:e,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),dP="PopoverClose",Uee=O.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=lc(dP,n);return l.jsx(fn.button,{type:"button",...r,ref:e,onClick:Xe(t.onClick,()=>s.onOpenChange(!1))})});Uee.displayName=dP;var Wee="PopoverArrow",Gee=O.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=f0(n);return l.jsx(rk,{...s,...r,ref:e})});Gee.displayName=Wee;function hP(t){return t?"open":"closed"}var Xee=sP,Yee=lP,Zee=oP,fP=cP;const Wo=Xee,Go=Yee,Fl=O.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>l.jsx(Zee,{children:l.jsx(fP,{ref:s,align:e,sideOffset:n,className:Se("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",t),...r})}));Fl.displayName=fP.displayName;const oc="/api/webui/config";async function hC(){const e=await(await yt(`${oc}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function zd(){const e=await(await yt(`${oc}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function fC(t){const n=await(await yt(`${oc}/bot`,{method:"POST",headers:Et(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function Kee(){const e=await(await yt(`${oc}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function Jee(t){const n=await(await yt(`${oc}/bot/raw`,{method:"POST",headers:Et(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function Jx(t){const n=await(await yt(`${oc}/model`,{method:"POST",headers:Et(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function ete(t,e){const r=await(await yt(`${oc}/bot/section/${t}`,{method:"POST",headers:Et(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function K5(t,e){const r=await(await yt(`${oc}/model/section/${t}`,{method:"POST",headers:Et(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const tte=lr.create({baseURL:"",timeout:1e4});async function Ok(){try{return(await tte.post("/api/webui/system/restart")).data}catch(t){throw console.error("重启麦麦失败:",t),t}}const nte=bh("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Kd=O.forwardRef(({className:t,variant:e,...n},r)=>l.jsx("div",{ref:r,role:"alert",className:Se(nte({variant:e}),t),...n}));Kd.displayName="Alert";const rte=O.forwardRef(({className:t,...e},n)=>l.jsx("h5",{ref:n,className:Se("mb-1 font-medium leading-none tracking-tight",t),...e}));rte.displayName="AlertTitle";const Jd=O.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:Se("text-sm [&_p]:leading-relaxed",t),...e}));Jd.displayName="AlertDescription";function jk({onRestartComplete:t,onRestartFailed:e}){const[n,r]=O.useState(0),[s,i]=O.useState("restarting"),[a,o]=O.useState(0),[u,h]=O.useState(0);O.useEffect(()=>{const g=setInterval(()=>{r(w=>w>=90?w:w+1)},200),x=setInterval(()=>{o(w=>w+1)},1e3),y=setTimeout(()=>{i("checking"),f()},3e3);return()=>{clearInterval(g),clearInterval(x),clearTimeout(y)}},[]);const f=()=>{const x=async()=>{try{if(h(w=>w+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{u<60?setTimeout(x,2e3):(i("failed"),e?.())}};x()},m=g=>{const x=Math.floor(g/60),y=g%60;return`${x}:${y.toString().padStart(2,"0")}`};return l.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:l.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[l.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&l.jsxs(l.Fragment,{children:[l.jsx(xm,{className:"h-16 w-16 text-primary animate-spin"}),l.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&l.jsxs(l.Fragment,{children:[l.jsx(xm,{className:"h-16 w-16 text-primary animate-spin"}),l.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),l.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",u,"/60)"]})]}),s==="success"&&l.jsxs(l.Fragment,{children:[l.jsx(Ea,{className:"h-16 w-16 text-green-500"}),l.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&l.jsxs(l.Fragment,{children:[l.jsx(su,{className:"h-16 w-16 text-destructive"}),l.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(h0,{value:n,className:"h-2"}),l.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[l.jsxs("span",{children:[n,"%"]}),l.jsxs("span",{children:["已用时: ",m(a)]})]})]}),l.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:l.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),s==="failed"&&l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),l.jsx("button",{onClick:()=>{i("checking"),h(0),f()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let J5=[],mP=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=mP[r])e=r+1;else return!0;if(e==n)return!1}}function mC(t){return t>=127462&&t<=127487}const pC=8205;function ite(t,e,n=!0,r=!0){return(n?pP:ate)(t,e,r)}function pP(t,e,n){if(e==t.length)return e;e&&gP(t.charCodeAt(e))&&xP(t.charCodeAt(e-1))&&e--;let r=S2(t,e);for(e+=gC(r);e=0&&mC(S2(t,a));)i++,a-=2;if(i%2==0)break;e+=2}else break}return e}function ate(t,e,n){for(;e>0;){let r=pP(t,e-2,n);if(r=56320&&t<57344}function xP(t){return t>=55296&&t<56320}function gC(t){return t<65536?1:2}class nn{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=eh(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),Sx.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=eh(this,e,n);let r=[];return this.decompose(e,n,r,0),Sx.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new sm(this),i=new sm(e);for(let a=n,o=n;;){if(s.next(a),i.next(a),a=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(o+=s.value.length,s.done||o>=r)return!0}}iter(e=1){return new sm(this,e)}iterRange(e,n=this.length){return new vP(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new yP(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?nn.empty:e.length<=32?new gr(e):Sx.from(gr.split(e,[]))}}class gr extends nn{constructor(e,n=lte(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.text[i],o=s+a.length;if((n?r:o)>=e)return new ote(s,o,r,a);s=o+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new gr(xC(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let a=r.pop(),o=kx(i.text,a.text.slice(),0,i.length);if(o.length<=32)r.push(new gr(o,a.length+i.length));else{let u=o.length>>1;r.push(new gr(o.slice(0,u)),new gr(o.slice(u)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof gr))return super.replace(e,n,r);[e,n]=eh(this,e,n);let s=kx(this.text,kx(r.text,xC(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new gr(s,i):Sx.from(gr.split(s,[]),i)}sliceString(e,n=this.length,r=` `){[e,n]=eh(this,e,n);let s="";for(let i=0,a=0;i<=n&&ae&&a&&(s+=r),ei&&(s+=o.slice(Math.max(0,e-i),n-i)),i=u+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new gr(r,s)),r=[],s=-1);return s>-1&&n.push(new gr(r,s)),n}}let Sx=class wd extends nn{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.children[i],o=s+a.length,u=r+a.lines-1;if((n?u:o)>=e)return a.lineInner(e,n,r,s);s=o+1,r=u+1}}decompose(e,n,r,s){for(let i=0,a=0;a<=n&&i=a){let h=s&((a<=e?1:0)|(u>=n?2:0));a>=e&&u<=n&&!h?r.push(o):o.decompose(e-a,n-a,r,h)}a=u+1}}replace(e,n,r){if([e,n]=eh(this,e,n),r.lines=i&&n<=o){let u=a.replace(e-i,n-i,r),h=this.lines-a.lines+u.lines;if(u.lines>4&&u.lines>h>>6){let f=this.children.slice();return f[s]=u,new wd(f,this.length-(n-e)+r.length)}return super.replace(i,o,u)}i=o+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` `){[e,n]=eh(this,e,n);let s="";for(let i=0,a=0;ie&&i&&(s+=r),ea&&(s+=o.sliceString(e-a,n-a,r)),a=u+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof wd))return 0;let r=0,[s,i,a,o]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==a||i==o)return r;let u=this.children[s],h=e.children[i];if(u!=h)return r+u.scanIdentical(h,n);r+=u.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let x of e)r+=x.lines;if(r<32){let x=[];for(let y of e)y.flatten(x);return new gr(x,n)}let s=Math.max(32,r>>5),i=s<<1,a=s>>1,o=[],u=0,h=-1,f=[];function m(x){let y;if(x.lines>i&&x instanceof wd)for(let w of x.children)m(w);else x.lines>a&&(u>a||!u)?(g(),o.push(x)):x instanceof gr&&u&&(y=f[f.length-1])instanceof gr&&x.lines+y.lines<=32?(u+=x.lines,h+=x.length+1,f[f.length-1]=new gr(y.text.concat(x.text),y.length+1+x.length)):(u+x.lines>s&&g(),u+=x.lines,h+=x.length+1,f.push(x))}function g(){u!=0&&(o.push(f.length==1?f[0]:wd.from(f,h)),h=-1,u=f.length=0)}for(let x of e)m(x);return g(),o.length==1?o[0]:new wd(o,n)}};nn.empty=new gr([""],0);function lte(t){let e=-1;for(let n of t)e+=n.length+1;return e}function kx(t,e,n=0,r=1e9){for(let s=0,i=0,a=!0;i=n&&(u>r&&(o=o.slice(0,r-s)),s0?1:(e instanceof gr?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],a=i>>1,o=s instanceof gr?s.text.length:s.children.length;if(a==(n>0?o:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(s instanceof gr){let u=s.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,u.length>Math.max(0,e))return this.value=e==0?u:n>0?u.slice(e):u.slice(0,u.length-e),this;e-=u.length}else{let u=s.children[a+(n<0?-1:0)];e>u.length?(e-=u.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(u),this.offsets.push(n>0?1:(u instanceof gr?u.text.length:u.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class vP{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new sm(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class yP{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(nn.prototype[Symbol.iterator]=function(){return this.iter()},sm.prototype[Symbol.iterator]=vP.prototype[Symbol.iterator]=yP.prototype[Symbol.iterator]=function(){return this});class ote{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function eh(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function ss(t,e,n=!0,r=!0){return ite(t,e,n,r)}function cte(t){return t>=56320&&t<57344}function ute(t){return t>=55296&&t<56320}function Is(t,e){let n=t.charCodeAt(e);if(!ute(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return cte(r)?(n-55296<<10)+(r-56320)+65536:n}function Nk(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function ja(t){return t<65536?1:2}const e3=/\r\n?|\n/;var rs=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(rs||(rs={}));class Pa{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=o}else{if(r!=rs.Simple&&h>=e&&(r==rs.TrackDel&&se||r==rs.TrackBefore&&se))return null;if(h>e||h==e&&n<0&&!o)return e==s||n<0?i:i+u;i+=u}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r=0&&s<=n&&o>=e)return sn?"cover":!0;s=o}return!1}toString(){let e="";for(let n=0;n=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Pa(e)}static create(e){return new Pa(e)}}class Br extends Pa{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return t3(this,(n,r,s,i,a)=>e=e.replace(s,s+(r-n),a),!1),e}mapDesc(e,n=!1){return n3(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=o,n[s+1]=a;let u=s>>1;for(;r.length0&&Fo(r,n,i.text),i.forward(f),o+=f}let h=e[a++];for(;o>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],a=0,o=null;function u(f=!1){if(!f&&!s.length)return;ag||m<0||g>n)throw new RangeError(`Invalid change range ${m} to ${g} (in doc of length ${n})`);let y=x?typeof x=="string"?nn.of(x.split(r||e3)):x:nn.empty,w=y.length;if(m==g&&w==0)return;ma&&cs(s,m-a,-1),cs(s,g-m,w),Fo(i,s,y),a=g}}return h(e),u(!o),o}static empty(e){return new Br(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;so&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function Fo(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||a==t.sections.length||t.sections[a+1]<0);)o=t.sections[a++],u=t.sections[a++];e(s,h,i,f,m),s=h,i=f}}}function n3(t,e,n,r=!1){let s=[],i=r?[]:null,a=new bm(t),o=new bm(e);for(let u=-1;;){if(a.done&&o.len||o.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&o.ins==-1){let h=Math.min(a.len,o.len);cs(s,h,-1),a.forward(h),o.forward(h)}else if(o.ins>=0&&(a.ins<0||u==a.i||a.off==0&&(o.len=0&&u=0){let h=0,f=a.len;for(;f;)if(o.ins==-1){let m=Math.min(f,o.len);h+=m,f-=m,o.forward(m)}else if(o.ins==0&&o.lenu||a.ins>=0&&a.len>u)&&(o||r.length>h),i.forward2(u),a.forward(u)}}}}class bm{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?nn.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?nn.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Vc{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new Vc(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Me.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Me.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Me.range(e.anchor,e.head)}static create(e,n,r){return new Vc(e,n,r)}}class Me{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Me.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Me(e.ranges.map(n=>Vc.fromJSON(n)),e.main)}static single(e,n=e){return new Me([Me.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Me.range(u,o):Me.range(o,u))}}return new Me(e,n)}}function wP(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Ck=0;class Ye{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=Ck++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new Ye(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Tk),!!e.static,e.enables)}of(e){return new Ox([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ox(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ox(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Tk(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Ox{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=Ck++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,a=e[i]>>1,o=this.type==2,u=!1,h=!1,f=[];for(let m of this.dependencies)m=="doc"?u=!0:m=="selection"?h=!0:(((n=e[m.id])!==null&&n!==void 0?n:1)&1)==0&&f.push(e[m.id]);return{create(m){return m.values[a]=r(m),1},update(m,g){if(u&&g.docChanged||h&&(g.docChanged||g.selection)||r3(m,f)){let x=r(m);if(o?!vC(x,m.values[a],s):!s(x,m.values[a]))return m.values[a]=x,1}return 0},reconfigure:(m,g)=>{let x,y=g.config.address[i];if(y!=null){let w=t1(g,y);if(this.dependencies.every(b=>b instanceof Ye?g.facet(b)===m.facet(b):b instanceof Xr?g.field(b,!1)==m.field(b,!1):!0)||(o?vC(x=r(m),w,s):s(x=r(m),w)))return m.values[a]=w,0}else x=r(m);return m.values[a]=x,1}}}}function vC(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[u.id]),s=n.map(u=>u.type),i=r.filter(u=>!(u&1)),a=t[e.id]>>1;function o(u){let h=[];for(let f=0;fr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(bg).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],a=this.updateF(i,s);return this.compareF(i,a)?0:(r.values[n]=a,1)},reconfigure:(r,s)=>{let i=r.facet(bg),a=s.facet(bg),o;return(o=i.find(u=>u.field==this))&&o!=a.find(u=>u.field==this)?(r.values[n]=o.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,bg.of({field:this,create:e})]}get extension(){return this}}const $c={lowest:4,low:3,default:2,high:1,highest:0};function _f(t){return e=>new SP(e,t)}const cc={highest:_f($c.highest),high:_f($c.high),default:_f($c.default),low:_f($c.low),lowest:_f($c.lowest)};class SP{constructor(e,n){this.inner=e,this.prec=n}}class cv{of(e){return new s3(this,e)}reconfigure(e){return cv.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class s3{constructor(e,n){this.compartment=e,this.inner=n}}class e1{constructor(e,n,r,s,i,a){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),a=new Map;for(let g of hte(e,n,a))g instanceof Xr?s.push(g):(i[g.facet.id]||(i[g.facet.id]=[])).push(g);let o=Object.create(null),u=[],h=[];for(let g of s)o[g.id]=h.length<<1,h.push(x=>g.slot(x));let f=r?.config.facets;for(let g in i){let x=i[g],y=x[0].facet,w=f&&f[g]||[];if(x.every(b=>b.type==0))if(o[y.id]=u.length<<1|1,Tk(w,x))u.push(r.facet(y));else{let b=y.combine(x.map(k=>k.value));u.push(r&&y.compare(b,r.facet(y))?r.facet(y):b)}else{for(let b of x)b.type==0?(o[b.id]=u.length<<1|1,u.push(b.value)):(o[b.id]=h.length<<1,h.push(k=>b.dynamicSlot(k)));o[y.id]=h.length<<1,h.push(b=>dte(b,y,x))}}let m=h.map(g=>g(o));return new e1(e,a,m,o,u,i)}}function hte(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(a,o){let u=s.get(a);if(u!=null){if(u<=o)return;let h=r[u].indexOf(a);h>-1&&r[u].splice(h,1),a instanceof s3&&n.delete(a.compartment)}if(s.set(a,o),Array.isArray(a))for(let h of a)i(h,o);else if(a instanceof s3){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(a.compartment)||a.inner;n.set(a.compartment,h),i(h,o)}else if(a instanceof SP)i(a.inner,a.prec);else if(a instanceof Xr)r[o].push(a),a.provides&&i(a.provides,o);else if(a instanceof Ox)r[o].push(a),a.facet.extensions&&i(a.facet.extensions,$c.default);else{let h=a.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(h,o)}}return i(t,$c.default),r.reduce((a,o)=>a.concat(o))}function im(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function t1(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const kP=Ye.define(),i3=Ye.define({combine:t=>t.some(e=>e),static:!0}),OP=Ye.define({combine:t=>t.length?t[0]:void 0,static:!0}),jP=Ye.define(),NP=Ye.define(),CP=Ye.define(),TP=Ye.define({combine:t=>t.length?t[0]:!1});class qa{constructor(e,n){this.type=e,this.value=n}static define(){return new fte}}class fte{of(e){return new qa(this,e)}}class mte{constructor(e){this.map=e}of(e){return new Nt(this,e)}}class Nt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Nt(this.type,n)}is(e){return this.type==e}static define(e={}){return new mte(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}Nt.reconfigure=Nt.define();Nt.appendConfig=Nt.define();class Er{constructor(e,n,r,s,i,a){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=a,this._doc=null,this._state=null,r&&wP(r,n.newLength),i.some(o=>o.type==Er.time)||(this.annotations=i.concat(Er.time.of(Date.now())))}static create(e,n,r,s,i,a){return new Er(e,n,r,s,i,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Er.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Er.time=qa.define();Er.userEvent=qa.define();Er.addToHistory=qa.define();Er.remote=qa.define();function pte(t,e){let n=[];for(let r=0,s=0;;){let i,a;if(r=t[r]))i=t[r++],a=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof Er?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Er?t=i[0]:t=_P(e,Pd(i),!1)}return t}function xte(t){let e=t.startState,n=e.facet(CP),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=EP(r,a3(e,i,t.changes.newLength),!0))}return r==t?t:Er.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const vte=[];function Pd(t){return t==null?vte:Array.isArray(t)?t:[t]}var Jn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Jn||(Jn={}));const yte=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let l3;try{l3=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function bte(t){if(l3)return l3.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||yte.test(n)))return!0}return!1}function wte(t){return e=>{if(!/\S/.test(e))return Jn.Space;if(bte(e))return Jn.Word;for(let n=0;n-1)return Jn.Word;return Jn.Other}}class tn{constructor(e,n,r,s,i,a){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let o=0;os.set(h,u)),n=null),s.set(o.value.compartment,o.value.extension)):o.is(Nt.reconfigure)?(n=null,r=o.value):o.is(Nt.appendConfig)&&(n=null,r=Pd(r).concat(o.value));let i;n?i=e.startState.values.slice():(n=e1.resolve(r,s,this),i=new tn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(u,h)=>h.reconfigure(u,this),null).values);let a=e.startState.facet(i3)?e.newSelection:e.newSelection.asSingle();new tn(n,e.newDoc,a,i,(o,u)=>u.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Me.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],a=Pd(r.effects);for(let o=1;oa.spec.fromJSON(o,u)))}}return tn.create({doc:e.doc,selection:Me.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=e1.resolve(e.extensions||[],new Map),r=e.doc instanceof nn?e.doc:nn.of((e.doc||"").split(n.staticFacet(tn.lineSeparator)||e3)),s=e.selection?e.selection instanceof Me?e.selection:Me.single(e.selection.anchor,e.selection.head):Me.single(0);return wP(s,r.length),n.staticFacet(i3)||(s=s.asSingle()),new tn(n,r,s,n.dynamicSlots.map(()=>null),(i,a)=>a.create(i),null)}get tabSize(){return this.facet(tn.tabSize)}get lineBreak(){return this.facet(tn.lineSeparator)||` `}get readOnly(){return this.facet(TP)}phrase(e,...n){for(let r of this.facet(tn.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(kP))for(let a of i(this,n,r))Object.prototype.hasOwnProperty.call(a,e)&&s.push(a[e]);return s}charCategorizer(e){return wte(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-r,o=e-r;for(;a>0;){let u=ss(n,a,!1);if(i(n.slice(u,a))!=Jn.Word)break;a=u}for(;ot.length?t[0]:4});tn.lineSeparator=OP;tn.readOnly=TP;tn.phrases=Ye.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});tn.languageData=kP;tn.changeFilter=jP;tn.transactionFilter=NP;tn.transactionExtender=CP;cv.reconfigure=Nt.define();function Fa(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let a=s[i],o=r[i];if(o===void 0)r[i]=a;else if(!(o===a||a===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](o,a);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class au{eq(e){return this==e}range(e,n=e){return o3.create(e,n,this)}}au.prototype.startSide=au.prototype.endSide=0;au.prototype.point=!1;au.prototype.mapMode=rs.TrackDel;let o3=class MP{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new MP(e,n,r)}};function c3(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ek{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let a=s,o=i.length;;){if(a==o)return a;let u=a+o>>1,h=i[u]-e||(r?this.value[u].endSide:this.value[u].startSide)-n;if(u==a)return h>=0?a:o;h>=0?o=u:a=u+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,i);ix||g==x&&h.startSide>0&&h.endSide<=0)continue;(x-g||h.endSide-h.startSide)<0||(a<0&&(a=g),h.point&&(o=Math.max(o,x-g)),r.push(h),s.push(g-a),i.push(x-a))}return{mapped:r.length?new Ek(s,i,r,o):null,pos:a}}}class rn{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new rn(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,a=e.filter;if(n.length==0&&!a)return this;if(r&&(n=n.slice().sort(c3)),this.isEmpty)return n.length?rn.of(n):this;let o=new AP(this,null,-1).goto(0),u=0,h=[],f=new $l;for(;o.value||u=0){let m=n[u++];f.addInner(m.from,m.to,m.value)||h.push(m)}else o.rangeIndex==1&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||io.to||i=i&&e<=i+a.length&&a.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return wm.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return wm.from(e).goto(n)}static compare(e,n,r,s,i=-1){let a=e.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),o=n.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),u=yC(a,o,r),h=new Mf(a,u,i),f=new Mf(o,u,i);r.iterGaps((m,g,x)=>bC(h,m,f,g,x,s)),r.empty&&r.length==0&&bC(h,0,f,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(f=>!f.isEmpty&&n.indexOf(f)<0),a=n.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=yC(i,a),u=new Mf(i,o,0).goto(r),h=new Mf(a,o,0).goto(r);for(;;){if(u.to!=h.to||!u3(u.active,h.active)||u.point&&(!h.point||!u.point.eq(h.point)))return!1;if(u.to>s)return!0;u.next(),h.next()}}static spans(e,n,r,s,i=-1){let a=new Mf(e,null,i).goto(n),o=n,u=a.openStart;for(;;){let h=Math.min(a.to,r);if(a.point){let f=a.activeForPoint(a.to),m=a.pointFromo&&(s.span(o,h,a.active,u),u=a.openEnd(h));if(a.to>r)return u+(a.point&&a.to>r?1:0);o=a.to,a.next()}}static of(e,n=!1){let r=new $l;for(let s of e instanceof o3?[e]:n?Ste(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return rn.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=rn.empty;s=s.nextLayer)n=new rn(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}rn.empty=new rn([],[],null,-1);function Ste(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(c3);e=r}return t}rn.empty.nextLayer=rn.empty;class $l{finishChunk(e){this.chunks.push(new Ek(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new $l)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(rn.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=rn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function yC(t,e,n){let r=new Map;for(let i of t)for(let a=0;a=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&s.push(new AP(a,n,r,i));return s.length==1?s[0]:new wm(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)k2(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)k2(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),k2(this.heap,0)}}}function k2(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Mf{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=wm.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){wg(this.active,e),wg(this.activeTo,e),wg(this.activeRank,e),this.minActive=wC(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n0;)n++;Sg(this.active,n,r),Sg(this.activeTo,n,s),Sg(this.activeRank,n,i),e&&Sg(e,n,this.cursor.from),this.minActive=wC(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&wg(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[s]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function bC(t,e,n,r,s,i){t.goto(e),n.goto(r);let a=r+s,o=r,u=r-e;for(;;){let h=t.to+u-n.to,f=h||t.endSide-n.endSide,m=f<0?t.to+u:n.to,g=Math.min(m,a);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&u3(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(o,g,t.point,n.point):g>o&&!u3(t.active,n.active)&&i.compareRange(o,g,t.active,n.active),m>a)break;(h||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(m),o=m,f<=0&&t.next(),f>=0&&n.next()}}function u3(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function wC(t,e){let n=-1,r=1e9;for(let s=0;s=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=ss(t,s)}return r===!0?-1:t.length}const h3="ͼ",SC=typeof Symbol>"u"?"__"+h3:Symbol.for(h3),f3=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),kC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Xo{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function i(a,o,u,h){let f=[],m=/^@(\w+)\b/.exec(a[0]),g=m&&m[1]=="keyframes";if(m&&o==null)return u.push(a[0]+";");for(let x in o){let y=o[x];if(/&/.test(x))i(x.split(/,\s*/).map(w=>a.map(b=>w.replace(/&/,b))).reduce((w,b)=>w.concat(b)),y,u);else if(y&&typeof y=="object"){if(!m)throw new RangeError("The value of a property ("+x+") should be a primitive value.");i(s(x),y,f,g)}else y!=null&&f.push(x.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+y+";")}(f.length||g)&&u.push((r&&!m&&!h?a.map(r):a).join(", ")+" {"+f.join(" ")+"}")}for(let a in e)i(s(a),e[a],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let e=kC[SC]||1;return kC[SC]=e+1,h3+e.toString(36)}static mount(e,n,r){let s=e[f3],i=r&&r.nonce;s?i&&s.setNonce(i):s=new kte(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let OC=new Map;class kte{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=OC.get(r);if(i)return e[f3]=i;this.sheet=new s.CSSStyleSheet,OC.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[f3]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let a=0;a-1&&(this.modules.splice(u,1),i--,u=-1),u==-1){if(this.modules.splice(i++,0,o),r)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ote=typeof navigator<"u"&&/Mac/.test(navigator.platform),jte=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ns=0;ns<10;ns++)Yo[48+ns]=Yo[96+ns]=String(ns);for(var ns=1;ns<=24;ns++)Yo[ns+111]="F"+ns;for(var ns=65;ns<=90;ns++)Yo[ns]=String.fromCharCode(ns+32),Sm[ns]=String.fromCharCode(ns);for(var O2 in Yo)Sm.hasOwnProperty(O2)||(Sm[O2]=Yo[O2]);function Nte(t){var e=Ote&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||jte&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Sm:Yo)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function In(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e2);var We={mac:NC||/Mac/.test(bs.platform),windows:/Win/.test(bs.platform),linux:/Linux|X11/.test(bs.platform),ie:uv,ie_version:DP?m3.documentMode||6:g3?+g3[1]:p3?+p3[1]:0,gecko:jC,gecko_version:jC?+(/Firefox\/(\d+)/.exec(bs.userAgent)||[0,0])[1]:0,chrome:!!j2,chrome_version:j2?+j2[1]:0,ios:NC,android:/Android\b/.test(bs.userAgent),webkit_version:Cte?+(/\bAppleWebKit\/(\d+)/.exec(bs.userAgent)||[0,0])[1]:0,safari:x3,safari_version:x3?+(/\bVersion\/(\d+(\.\d+)?)/.exec(bs.userAgent)||[0,0])[1]:0,tabSize:m3.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function km(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function v3(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function jx(t,e){if(!e.anchorNode)return!1;try{return v3(t,e.anchorNode)}catch{return!1}}function th(t){return t.nodeType==3?ou(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function am(t,e,n,r){return n?CC(t,e,n,r,-1)||CC(t,e,n,r,1):!1}function lu(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function n1(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function CC(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Ba(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=lu(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?Ba(t):0}else return!1}}function Ba(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function m0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function Tte(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function zP(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Ete(t,e,n,r,s,i,a,o){let u=t.ownerDocument,h=u.defaultView||window;for(let f=t,m=!1;f&&!m;)if(f.nodeType==1){let g,x=f==u.body,y=1,w=1;if(x)g=Tte(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(m=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let N=f.getBoundingClientRect();({scaleX:y,scaleY:w}=zP(f,N)),g={left:N.left,right:N.left+f.clientWidth*y,top:N.top,bottom:N.top+f.clientHeight*w}}let b=0,k=0;if(s=="nearest")e.top0&&e.bottom>g.bottom+k&&(k=e.bottom-g.bottom+a)):e.bottom>g.bottom&&(k=e.bottom-g.bottom+a,n<0&&e.top-k0&&e.right>g.right+b&&(b=e.right-g.right+i)):e.right>g.right&&(b=e.right-g.right+i,n<0&&e.leftg.bottom||e.leftg.right)&&(e={left:Math.max(e.left,g.left),right:Math.min(e.right,g.right),top:Math.max(e.top,g.top),bottom:Math.min(e.bottom,g.bottom)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function _te(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class Mte{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?Ba(n):0),r,Math.min(e.focusOffset,r?Ba(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let Ic=null;We.safari&&We.safari_version>=26&&(Ic=!1);function PP(t){if(t.setActive)return t.setActive();if(Ic)return t.focus(Ic);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Ic==null?{get preventScroll(){return Ic={preventScroll:!0},!0}}:void 0),!Ic){Ic=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function IP(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=Ba(n)}else if(n.parentNode&&!n1(n))r=lu(n),n=n.parentNode;else return null}}function qP(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return m.domBoundsAround(e,n,h);if(g>=e&&s==-1&&(s=u,i=h),h>n&&m.dom.parentNode==this.dom){a=u,o=f;break}f=g,h=g+m.breakAfter}return{from:i,to:o<0?r+this.length:o,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a=0?this.children[a].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=_k){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function $P(t,e,n,r,s,i,a,o,u){let{children:h}=t,f=h.length?h[e]:null,m=i.length?i[i.length-1]:null,g=m?m.breakAfter:a;if(!(e==r&&f&&!a&&!g&&i.length<2&&f.merge(n,s,i.length?m:null,n==0,o,u))){if(r0&&(!a&&i.length&&f.merge(n,f.length,i[0],!1,o,0)?f.breakAfter=i.shift().breakAfter:(nDte||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new ra(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new hs(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return zte(this.dom,e,n)}}class Ql extends Dn{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let s of n)s.setParent(this)}setAttrs(e){if(LP(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,a){return r&&(!(r instanceof Ql&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=u,i++}let a=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new Ql(this.mark,n,a)}domAtPos(e){return HP(this,e)}coordsAt(e,n){return UP(this,e,n)}}function zte(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,a=0;e==0&&n<0||e==r&&n>=0?We.chrome||We.gecko||(e?(s--,a=1):i=0)?0:o.length-1];return We.safari&&!a&&u.width==0&&(u=Array.prototype.find.call(o,h=>h.width)||u),a?m0(u,a<0):u||null}class _l extends Dn{static create(e,n,r){return new _l(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=_l.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,s,i,a){return r&&(!(r instanceof _l)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?hs.before(this.dom):hs.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let a=this.side?this.side<0:e>0;for(let o=a?s.length-1:0;i=s[o],!(e>0?o==0:o==s.length-1||i.top0?hs.before(this.dom):hs.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return nn.empty}get isHidden(){return!0}}ra.prototype.children=_l.prototype.children=nh.prototype.children=_k;function HP(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let a=r[i-1];if(a.dom.parentNode==n)return a.domAtPos(a.length)}for(let i=s;i0&&e instanceof Ql&&s.length&&(r=s[s.length-1])instanceof Ql&&r.mark.eq(e.mark)?VP(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function UP(t,e,n){let r=null,s=-1,i=null,a=-1;function o(h,f){for(let m=0,g=0;m=f&&(x.children.length?o(x,f-g):(!i||i.isHidden&&(n>0||Lte(i,x)))&&(y>f||g==y&&x.getSide()>0)?(i=x,a=f-g):(g-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function b3(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function Bte(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new Zo(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:a}=WP(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(a?n?2e8:1:-6e8)+1}return new Zo(e,r,s,n,e.widget||null,!0)}static line(e){return new g0(e)}static set(e,n=!1){return rn.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ot.none=rn.empty;class p0 extends ot{constructor(e){let{start:n,end:r}=WP(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof p0&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&r1(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}p0.prototype.point=!1;class g0 extends ot{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof g0&&this.spec.class==e.spec.class&&r1(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}g0.prototype.mapMode=rs.TrackBefore;g0.prototype.point=!0;class Zo extends ot{constructor(e,n,r,s,i,a){super(n,r,i,e),this.block=s,this.isReplace=a,this.mapMode=s?n<=0?rs.TrackBefore:rs.TrackAfter:rs.TrackDel}get type(){return this.startSide!=this.endSide?ks.WidgetRange:this.startSide<=0?ks.WidgetBefore:ks.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Zo&&Ite(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}Zo.prototype.point=!0;function WP(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function Ite(t,e){return t==e||!!(t&&e&&t.compare(e))}function Nx(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class Tr extends Dn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,a){if(r){if(!(r instanceof Tr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),QP(this,e,n,r?r.children.slice():[],i,a),!0}split(e){let n=new Tr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:s}=this.childPos(e);s&&(n.append(this.children[r].split(s),0),this.children[r].merge(s,this.children[r].length,null,!1,0,0),r++);for(let i=r;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){r1(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){VP(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=y3(n,this.attrs||{})),r&&(this.attrs=y3({class:r},this.attrs||{}))}domAtPos(e){return HP(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(LP(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(b3(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let s=this.dom.lastChild;for(;s&&Dn.get(s)instanceof Ql;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=Dn.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!We.ios||!this.children.some(i=>i instanceof ra))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof ra)||/[^ -~]/.test(r.text))return null;let s=th(r.dom);if(s.length!=1)return null;e+=s[0].width,n=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=UP(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:s}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-s.lineHeight)<2&&s.textHeight=n){if(i instanceof Tr)return i;if(a>n)break}s=a+i.breakAfter}return null}}class zl extends Dn{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,a){return r&&(!(r instanceof zl)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class w3 extends $a{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class lm{constructor(e,n,r,s){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof zl&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Tr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(kg(new nh(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof zl)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:a,lineBreak:o,done:u}=this.cursor.next(this.skip);if(this.skip=0,u)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=a,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(kg(new ra(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,a){if(this.disallowBlockEffectsFor[a]&&r instanceof Zo){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=n-e;if(r instanceof Zo)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new zl(r.widget||rh.block,o,r));else{let u=_l.create(r.widget||rh.inline,o,o?0:r.startSide),h=this.atCursorPos&&!u.isEditable&&i<=s.length&&(e0),f=!u.isEditable&&(es.length||r.startSide<=0),m=this.getLine();this.pendingBuffer==2&&!h&&!u.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(m.append(kg(new nh(1),s),i),i=s.length+Math.max(0,i-s.length)),m.append(kg(u,s),i),this.atCursorPos=f,this.pendingBuffer=f?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let a=new lm(e,n,r,i);return a.openEnd=rn.spans(s,n,r,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function kg(t,e){for(let n of e)t=new Ql(n,[t],t.length);return t}class rh extends $a{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}rh.inline=new rh("span");rh.block=new rh("div");var Zn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Zn||(Zn={}));const cu=Zn.LTR,Mk=Zn.RTL;function GP(t){let e=[];for(let n=0;n=n){if(o.level==r)return a;(i<0||(s!=0?s<0?o.fromn:e[i].level>o.level))&&(i=a)}}if(i<0)throw new RangeError("Index out of range");return i}}function YP(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;w-=3)if(va[w+1]==-x){let b=va[w+2],k=b&2?s:b&4?b&1?i:s:0;k&&(qn[m]=qn[va[w]]=k),o=w;break}}else{if(va.length==189)break;va[o++]=m,va[o++]=g,va[o++]=u}else if((y=qn[m])==2||y==1){let w=y==s;u=w?0:1;for(let b=o-3;b>=0;b-=3){let k=va[b+2];if(k&2)break;if(w)va[b+2]|=2;else{if(k&4)break;va[b+2]|=4}}}}}function Vte(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let a=s?n[s-1].to:t,o=su;)y==b&&(y=n[--w].from,b=w?n[w-1].to:t),qn[--y]=x;u=f}else i=h,u++}}}function k3(t,e,n,r,s,i,a){let o=r%2?2:1;if(r%2==s%2)for(let u=e,h=0;uu&&a.push(new $o(u,w.from,x));let b=w.direction==cu!=!(x%2);O3(t,b?r+1:r,s,w.inner,w.from,w.to,a),u=w.to}y=w.to}else{if(y==n||(f?qn[y]!=o:qn[y]==o))break;y++}g?k3(t,u,y,r+1,s,g,a):ue;){let f=!0,m=!1;if(!h||u>i[h-1].to){let w=qn[u-1];w!=o&&(f=!1,m=w==16)}let g=!f&&o==1?[]:null,x=f?r:r+1,y=u;e:for(;;)if(h&&y==i[h-1].to){if(m)break e;let w=i[--h];if(!f)for(let b=w.from,k=h;;){if(b==e)break e;if(k&&i[k-1].to==b)b=i[--k].from;else{if(qn[b-1]==o)break e;break}}if(g)g.push(w);else{w.toqn.length;)qn[qn.length]=256;let r=[],s=e==cu?0:1;return O3(t,s,s,n,0,t.length,r),r}function ZP(t){return[new $o(0,t,0)]}let KP="";function Wte(t,e,n,r,s){var i;let a=r.head-t.from,o=$o.find(e,a,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),u=e[o],h=u.side(s,n);if(a==h){let g=o+=s?1:-1;if(g<0||g>=e.length)return null;u=e[o=g],a=u.side(!s,n),h=u.side(s,n)}let f=ss(t.text,a,u.forward(s,n));(fu.to)&&(f=h),KP=t.text.slice(Math.min(a,f),Math.max(a,f));let m=o==(s?e.length-1:0)?null:e[o+(s?1:-1)];return m&&f==h&&m.level+(s?0:1)t.some(e=>e)}),aL=Ye.define({combine:t=>t.some(e=>e)}),lL=Ye.define();class Bd{constructor(e,n="nearest",r="nearest",s=5,i=5,a=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=a}map(e){return e.empty?this:new Bd(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Bd(Me.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Og=Nt.define({map:(t,e)=>t.map(e)}),oL=Nt.define();function Fs(t,e,n){let r=t.facet(nL);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const El=Ye.define({combine:t=>t.length?t[0]:!0});let Xte=0;const Ed=Ye.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let u=[];return a&&u.push(Om.of(h=>{let f=h.plugin(o);return f?a(f):ot.none})),i&&u.push(i(o)),u})}static fromClass(e,n){return wr.define((r,s)=>new e(r,s),n)}}class N2{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Fs(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){Fs(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Fs(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const cL=Ye.define(),Dk=Ye.define(),Om=Ye.define(),uL=Ye.define(),x0=Ye.define(),dL=Ye.define();function MC(t,e){let n=t.state.facet(dL);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return rn.spans(r,e.from,e.to,{point(){},span(i,a,o,u){let h=i-e.from,f=a-e.from,m=s;for(let g=o.length-1;g>=0;g--,u--){let x=o[g].spec.bidiIsolate,y;if(x==null&&(x=Gte(e.text,h,f)),u>0&&m.length&&(y=m[m.length-1]).to==h&&y.direction==x)y.to=f,m=y.inner;else{let w={from:h,to:f,direction:x,inner:[]};m.push(w),m=w.inner}}}}),s}const hL=Ye.define();function zk(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(hL)){let a=i(t);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(n=Math.max(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(s=Math.max(s,a.bottom)))}return{left:e,right:n,top:r,bottom:s}}const Vf=Ye.define();class Bi{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new Bi(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toAf)break;i+=2}if(!u)return r;new Bi(u.fromA,u.toA,u.fromB,u.toB).addToSet(r),a=u.toA,o=u.toB}}}class s1{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Br.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,a,o,u)=>s.push(new Bi(i,a,o,u))),this.changedRanges=s}static create(e,n,r){return new s1(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class AC extends Dn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=ot.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new Tr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Bi(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!nne(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?Zte(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;r=new Bi(h,f,e.changes.mapPos(h,-1),e.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(We.ie||We.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,o=this.updateDeco(),u=ene(a,o,e.changes);return r=Bi.extendWithRanges(r,u),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=We.chrome||We.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||s.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[a]:null;if(!o)break;let{fromA:u,toA:h,fromB:f,toB:m}=o,g,x,y,w;if(r&&r.range.fromBf){let T=lm.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),E=lm.build(this.view.state.doc,r.range.toB,m,this.decorations,this.dynamicDecorationMap);x=T.breakAtStart,y=T.openStart,w=E.openEnd;let _=this.compositionView(r);E.breakAtStart?_.breakAfter=1:E.content.length&&_.merge(_.length,_.length,E.content[0],!1,E.openStart,0)&&(_.breakAfter=E.content[0].breakAfter,E.content.shift()),T.content.length&&_.merge(0,0,T.content[T.content.length-1],!0,0,T.openEnd)&&T.content.pop(),g=T.content.concat(_).concat(E.content)}else({content:g,breakAtStart:x,openStart:y,openEnd:w}=lm.build(this.view.state.doc,f,m,this.decorations,this.dynamicDecorationMap));let{i:b,off:k}=i.findPos(h,1),{i:N,off:C}=i.findPos(u,-1);$P(this,N,C,b,k,g,x,y,w)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(oL)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new ra(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new Ql(s,[n],n.length);let r=new Tr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,a)=>{a.flags|=8|(a.children.some(u=>u.flags&7)?1:0),this.markedForComposition.add(a);let o=Dn.get(i);o&&o!=a&&(o.dom=null),a.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(El)||this.dom.tabIndex>-1)&&jx(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let a=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,u=this.moveToLine(this.domAtPos(o.anchor)),h=o.empty?u:this.moveToLine(this.domAtPos(o.head));if(We.gecko&&o.empty&&!this.hasComposition&&Yte(u)){let m=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(m,u.node.childNodes[u.offset]||null)),u=h=new hs(m,0),a=!0}let f=this.view.observer.selectionRange;(a||!f.focusNode||(!am(u.node,u.offset,f.anchorNode,f.anchorOffset)||!am(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,o))&&(this.view.observer.ignore(()=>{We.android&&We.chrome&&this.dom.contains(f.focusNode)&&tne(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let m=km(this.view.root);if(m)if(o.empty){if(We.gecko){let g=Kte(u.node,u.offset);if(g&&g!=3){let x=(g==1?IP:qP)(u.node,u.offset);x&&(u=new hs(x.node,x.offset))}}m.collapse(u.node,u.offset),o.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=o.bidiLevel)}else if(m.extend){m.collapse(u.node,u.offset);try{m.extend(h.node,h.offset)}catch{}}else{let g=document.createRange();o.anchor>o.head&&([u,h]=[h,u]),g.setEnd(h.node,h.offset),g.setStart(u.node,u.offset),m.removeAllRanges(),m.addRange(g)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(u,h)),this.impreciseAnchor=u.precise?null:new hs(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new hs(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&am(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=km(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=Tr.find(this,n.head);if(!a)return;let o=a.posAtStart;if(n.head==o||n.head==o+a.length)return;let u=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!u||!h||u.bottom>h.top)return;let f=this.domAtPos(n.head+n.assoc);r.collapse(f.node,f.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let m=e.observer.selectionRange;e.docView.posFromDOM(m.anchorNode,m.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=Dn.get(n.childNodes[s]);i instanceof Tr&&(r=i.domAtPos(i.length))}return r?new hs(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=Dn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;a--){let o=this.children[a],u=i-o.breakAfter,h=u-o.length;if(ue||o.covers(1))&&(!r||o instanceof Tr&&!(r instanceof Tr&&n>=0)))r=o,s=h;else if(r&&h==e&&u==e&&o instanceof zl&&Math.abs(n)<2){if(o.deco.startSide<0)break;a&&(r=null)}i=h}return r?r.coordsAt(e-s,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),s=this.children[n];if(!(s instanceof Tr))return null;for(;s.children.length;){let{i:o,off:u}=s.childPos(r,1);for(;;o++){if(o==s.children.length)return null;if((s=s.children[o]).length)break}r=u}if(!(s instanceof ra))return null;let i=ss(s.text,r);if(i==r)return null;let a=ou(s.dom,r,i).getClientRects();for(let o=0;oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,u=this.view.textDirection==Zn.LTR;for(let h=0,f=0;fs)break;if(h>=r){let x=m.dom.getBoundingClientRect();if(n.push(x.height),a){let y=m.dom.lastChild,w=y?th(y):[];if(w.length){let b=w[w.length-1],k=u?b.right-x.left:x.right-b.left;k>o&&(o=k,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=g)}}}h=g+m.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Zn.RTL:Zn.LTR}measureTextSize(){for(let i of this.children)if(i instanceof Tr){let a=i.measureTextSize();if(a)return a}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=th(e.firstChild)[0];n=e.getBoundingClientRect().height,r=i?i.width/27:7,s=i?i.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new FP(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],a=i?i.from-1:this.length;if(a>r){let o=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(ot.replace({widget:new w3(o),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!i)break;r=i.to+1}return ot.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Om).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(uL).map((i,a)=>{let o=typeof i=="function";return o&&(r=!0),o?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(rn.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=zk(this.view),a={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:o,offsetHeight:u}=this.view.scrollDOM;Ete(this.view.scrollDOM,a,n.heads instanceof _l||s.children.some(r);return r(this.children[n])}}function Yte(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function fL(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=IP(n.focusNode,n.focusOffset),s=qP(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let o=Dn.get(s.node);if(!o||o instanceof ra&&o.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let u=Dn.get(r.node);!u||u instanceof ra&&u.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let a=e-i.offset;return{from:a,to:a+i.node.nodeValue.length,node:i.node}}function Zte(t,e,n){let r=fL(t,n);if(!r)return null;let{node:s,from:i,to:a}=r,o=s.nodeValue;if(/[\n\r]/.test(o)||t.state.doc.sliceString(r.from,r.to)!=o)return null;let u=e.invertedDesc,h=new Bi(u.mapPos(i),u.mapPos(a),i,a),f=[];for(let m=s.parentNode;;m=m.parentNode){let g=Dn.get(m);if(g instanceof Ql)f.push({node:m,deco:g.mark});else{if(g instanceof Tr||m.nodeName=="DIV"&&m.parentNode==t.contentDOM)return{range:h,text:s,marks:f,line:m};if(m!=t.contentDOM)f.push({node:m,deco:new p0({inclusive:!0,attributes:Bte(m),tagName:m.tagName.toLowerCase()})});else return null}}}function Kte(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function rne(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Me.cursor(e);i==0?n=1:i==s.length&&(n=-1);let a=i,o=i;n<0?a=ss(s.text,i,!1):o=ss(s.text,i);let u=r(s.text.slice(a,o));for(;a>0;){let h=ss(s.text,a,!1);if(r(s.text.slice(h,a))!=u)break;a=h}for(;ot?e.left-t:Math.max(0,t-e.right)}function ine(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function C2(t,e){return t.tope.top+1}function RC(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function N3(t,e,n){let r,s,i,a,o=!1,u,h,f,m;for(let y=t.firstChild;y;y=y.nextSibling){let w=th(y);for(let b=0;bC||a==C&&i>N)&&(r=y,s=k,i=N,a=C,o=N?e0:bk.bottom&&(!f||f.bottomk.top)&&(h=y,m=k):f&&C2(f,k)?f=DC(f,k.bottom):m&&C2(m,k)&&(m=RC(m,k.top))}}if(f&&f.bottom>=n?(r=u,s=f):m&&m.top<=n&&(r=h,s=m),!r)return{node:t,offset:0};let g=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return zC(r,g,n);if(o&&r.contentEditable!="false")return N3(r,g,n);let x=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:x}}function zC(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,a=0;for(let o=0;on?f.top-n:n-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&m=(f.left+f.right)/2,x=g;if(We.chrome||We.gecko){let y=ou(t,o).getBoundingClientRect();Math.abs(y.left-f.right)<.1&&(x=!g)}if(m<=0)return{node:t,offset:o+(x?1:0)};s=o+(x?1:0),i=m}}}return{node:t,offset:s>-1?s:a>0?t.nodeValue.length:0}}function mL(t,e,n,r=-1){var s,i;let a=t.contentDOM.getBoundingClientRect(),o=a.top+t.viewState.paddingTop,u,{docHeight:h}=t.viewState,{x:f,y:m}=e,g=m-o;if(g<0)return 0;if(g>h)return t.state.doc.length;for(let T=t.viewState.heightOracle.textHeight/2,E=!1;u=t.elementAtHeight(g),u.type!=ks.Text;)for(;g=r>0?u.bottom+T:u.top-T,!(g>=0&&g<=h);){if(E)return n?null:0;E=!0,r=-r}m=o+g;let x=u.from;if(xt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:PC(t,a,u,f,m);let y=t.dom.ownerDocument,w=t.root.elementFromPoint?t.root:y,b=w.elementFromPoint(f,m);b&&!t.contentDOM.contains(b)&&(b=null),b||(f=Math.max(a.left+1,Math.min(a.right-1,f)),b=w.elementFromPoint(f,m),b&&!t.contentDOM.contains(b)&&(b=null));let k,N=-1;if(b&&((s=t.docView.nearest(b))===null||s===void 0?void 0:s.isEditable)!=!1){if(y.caretPositionFromPoint){let T=y.caretPositionFromPoint(f,m);T&&({offsetNode:k,offset:N}=T)}else if(y.caretRangeFromPoint){let T=y.caretRangeFromPoint(f,m);T&&({startContainer:k,startOffset:N}=T)}k&&(!t.contentDOM.contains(k)||We.safari&&ane(k,N,f)||We.chrome&&lne(k,N,f))&&(k=void 0),k&&(N=Math.min(Ba(k),N))}if(!k||!t.docView.dom.contains(k)){let T=Tr.find(t.docView,x);if(!T)return g>u.top+u.height/2?u.to:u.from;({node:k,offset:N}=N3(T.dom,f,m))}let C=t.docView.nearest(k);if(!C)return null;if(C.isWidget&&((i=C.dom)===null||i===void 0?void 0:i.nodeType)==1){let T=C.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let o=t.viewState.heightOracle.textHeight,u=Math.floor((s-n.top-(t.defaultLineHeight-o)*.5)/o);i+=u*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(n.from,n.to);return n.from+d3(a,i,t.state.tabSize)}function pL(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let a=s.parentNode;if(!a||a.nodeName=="DIV")break;s=a}}return ou(t,r-1,r).getBoundingClientRect().right>n}function ane(t,e,n){return pL(t,e,n)}function lne(t,e,n){if(e!=0)return pL(t,e,n);for(let s=t;;){let i=s.parentNode;if(!i||i.nodeType!=1||i.firstChild!=s)return!1;if(i.classList.contains("cm-line"))break;s=i}let r=t.nodeType==1?t.getBoundingClientRect():ou(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function C3(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.toe)return i;(!s||i.type==ks.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function one(t,e,n,r){let s=C3(t,e.head,e.assoc||-1),i=!r||s.type!=ks.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let a=t.dom.getBoundingClientRect(),o=t.textDirectionAt(s.from),u=t.posAtCoords({x:n==(o==Zn.LTR)?a.right-1:a.left+1,y:(i.top+i.bottom)/2});if(u!=null)return Me.cursor(u,n?-1:1)}return Me.cursor(n?s.to:s.from,n?-1:1)}function LC(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),a=t.textDirectionAt(s.from);for(let o=e,u=null;;){let h=Wte(s,i,a,o,n),f=KP;if(!h){if(s.number==(n?t.state.doc.lines:1))return o;f=` `,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(u){if(!u(f))return o}else{if(!r)return h;u=r(f)}o=h}}function cne(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let a=r(i);return s==Jn.Space&&(s=a),s==a}}function une(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Me.cursor(s,e.assoc);let a=e.goalColumn,o,u=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),f=t.documentTop;if(h)a==null&&(a=h.left-u.left),o=i<0?h.top:h.bottom;else{let x=t.viewState.lineBlockAt(s);a==null&&(a=Math.min(u.right-u.left,t.defaultCharacterWidth*(s-x.from))),o=(i<0?x.top:x.bottom)+f}let m=u.left+a,g=r??t.viewState.heightOracle.textHeight>>1;for(let x=0;;x+=10){let y=o+(g+x)*i,w=mL(t,{x:m,y},!1,i);if(yu.bottom||(i<0?ws)){let b=t.docView.coordsForChar(w),k=!b||y{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Me.cursor(r,ri)&&!fne(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(o=s.exec(n))&&(i=o.index,a=o[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let u of this.points)u.node==e&&u.pos>this.text.length&&(u.pos-=a-1);r=i+a}}readNode(e){if(e.cmIgnore)return;let n=Dn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(hne(e,r.node,r.offset)?n:0))}}function hne(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let o=i||a?[]:gne(e),u=new dne(o,e.state);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=xne(o,this.bounds.from)}else{let o=e.observer.selectionRange,u=i&&i.node==o.focusNode&&i.offset==o.focusOffset||!v3(e.contentDOM,o.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(o.focusNode,o.focusOffset),h=a&&a.node==o.anchorNode&&a.offset==o.anchorOffset||!v3(e.contentDOM,o.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(o.anchorNode,o.anchorOffset),f=e.viewport;if((We.ios||We.chrome)&&e.state.selection.main.empty&&u!=h&&(f.from>0||f.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Me.range(h,u)):this.newSel=Me.single(h,u)}}}function xL(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:o}=e.bounds,u=s.from,h=null;(i===8||We.android&&e.text.length=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:We.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` `&&t.lineWrapping&&(r&&(r=Me.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:nn.of([" "])}),n)return Pk(t,n,r,i);if(r&&!r.main.eq(s)){let a=!1,o="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),o=t.inputState.lastSelectionOrigin,o=="select.pointer"&&(r=gL(t.state.facet(x0).map(u=>u(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:o}),!0}else return!1}function Pk(t,e,n,r=-1){if(We.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(We.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Ld(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&Ld(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Ld(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,o=()=>a||(a=pne(t,e,n));return t.state.facet(rL).some(u=>u(t,e.from,e.to,i,o))||t.dispatch(o()),!0}function pne(t,e,n){let r,s=t.state,i=s.selection.main,a=-1;if(e.from==e.to&&e.fromi.to){let u=e.fromm(t)),h,u);e.from==f&&(a=f)}if(a>-1)r={changes:e,selection:Me.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let u=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(u+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let u=s.changes(e),h=n&&n.main.to<=u.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let f=t.state.sliceDoc(e.from,e.to),m,g=n&&fL(t,n.main.head);if(g){let y=e.insert.length-(e.to-e.from);m={from:g.from,to:g.to-y}}else m=t.state.doc.lineAt(i.head);let x=i.to-e.to;r=s.changeByRange(y=>{if(y.from==i.from&&y.to==i.to)return{changes:u,range:h||y.map(u)};let w=y.to-x,b=w-f.length;if(t.state.sliceDoc(b,w)!=f||w>=m.from&&b<=m.to)return{range:y};let k=s.changes({from:b,to:w,insert:e.insert}),N=y.to-i.to;return{changes:k,range:h?Me.range(Math.max(0,h.anchor+N),Math.max(0,h.head+N)):y.map(k)}})}else r={changes:u,selection:h&&s.selection.replaceRange(h)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:o,scrollIntoView:!0})}function vL(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&o>0&&t.charCodeAt(a-1)==e.charCodeAt(o-1);)a--,o--;if(r=="end"){let u=Math.max(0,i-Math.min(a,o));n-=a+u-i}if(a=a?i-n:0;i-=u,o=i+(o-a),a=i}else if(o=o?i-n:0;i-=u,a=i+(a-o),o=i}return{from:i,toA:a,toB:o}}function gne(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new BC(n,r)),(s!=n||i!=r)&&e.push(new BC(s,i))),e}function xne(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Me.single(n+e,r+e):null}class vne{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,We.safari&&e.contentDOM.addEventListener("input",()=>null),We.gecko&&Dne(e.contentDOM.ownerDocument)}handleEvent(e){!Nne(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=yne(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let a=!n[i].handlers.length,o=r[i];o&&a!=!o.handlers.length&&(s.removeEventListener(i,this.handleEvent),o=null),o||s.addEventListener(i,this.handleEvent,{passive:a})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&bL.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),We.android&&We.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return We.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=yL.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||bne.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:We.safari&&!We.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function IC(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){Fs(n.state,s)}}}function yne(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,a=s&&s.plugin.domEventObservers;if(i)for(let o in i){let u=i[o];u&&n(o).handlers.push(IC(r.value,u))}if(a)for(let o in a){let u=a[o];u&&n(o).observers.push(IC(r.value,u))}}for(let r in sa)n(r).handlers.push(sa[r]);for(let r in Fi)n(r).observers.push(Fi[r]);return e}const yL=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],bne="dthko",bL=[16,17,18,20,91,92,224,225],jg=6;function Ng(t){return Math.max(0,t)*.7+8}function wne(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class Sne{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=_te(e.contentDOM),this.atoms=e.state.facet(x0).map(a=>a(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(tn.allowMultipleSelections)&&kne(e,n),this.dragging=jne(e,n)&&kL(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&wne(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let u=zk(this.view);e.clientX-u.left<=s+jg?n=-Ng(s-e.clientX):e.clientX+u.right>=a-jg&&(n=Ng(e.clientX-a)),e.clientY-u.top<=i+jg?r=-Ng(i-e.clientY):e.clientY+u.bottom>=o-jg&&(r=Ng(e.clientY-o)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=gL(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function kne(t,e){let n=t.state.facet(JP);return n.length?n[0](e):We.mac?e.metaKey:e.ctrlKey}function One(t,e){let n=t.state.facet(eL);return n.length?n[0](e):We.mac?!e.altKey:!e.ctrlKey}function jne(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=km(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Nne(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Dn.get(n))&&r.ignoreEvent(e))return!1;return!0}const sa=Object.create(null),Fi=Object.create(null),wL=We.ie&&We.ie_version<15||We.ios&&We.webkit_version<604;function Cne(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),SL(t,n.value)},50)}function dv(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function SL(t,e){e=dv(t.state,Ak,e);let{state:n}=t,r,s=1,i=n.toText(e),a=i.lines==n.selection.ranges.length;if(T3!=null&&n.selection.ranges.every(u=>u.empty)&&T3==i.toString()){let u=-1;r=n.changeByRange(h=>{let f=n.doc.lineAt(h.from);if(f.from==u)return{range:h};u=f.from;let m=n.toText((a?i.line(s++).text:e)+n.lineBreak);return{changes:{from:f.from,insert:m},range:Me.cursor(h.from+m.length)}})}else a?r=n.changeByRange(u=>{let h=i.line(s++);return{changes:{from:u.from,to:u.to,insert:h.text},range:Me.cursor(u.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Fi.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};sa.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Fi.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Fi.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};sa.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(tL))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=_ne(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new Sne(t,e,n,r)),r&&t.observer.ignore(()=>{PP(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function qC(t,e,n,r){if(r==1)return Me.cursor(e,n);if(r==2)return rne(t.state,e,n);{let s=Tr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),a=s?s.posAtStart:i.from,o=s?s.posAtEnd:i.to;return oe>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function Tne(t,e,n,r){let s=Tr.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let a=s.coordsAt(i,-1);if(a&&FC(n,r,a))return-1;let o=s.coordsAt(i,1);return o&&FC(n,r,o)?1:a&&a.bottom>=r?-1:1}function $C(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Tne(t,n,e.clientX,e.clientY)}}const Ene=We.ie&&We.ie_version<=11;let QC=null,HC=0,VC=0;function kL(t){if(!Ene)return t.detail;let e=QC,n=VC;return QC=t,VC=Date.now(),HC=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(HC+1)%3:1}function _ne(t,e){let n=$C(t,e),r=kL(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,a,o){let u=$C(t,i),h,f=qC(t,u.pos,u.bias,r);if(n.pos!=u.pos&&!a){let m=qC(t,n.pos,n.bias,r),g=Math.min(m.from,f.from),x=Math.max(m.to,f.to);f=g1&&(h=Mne(s,u.pos))?h:o?s.addRange(f):Me.create([f])}}}function Mne(t,e){for(let n=0;n=e)return Me.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}sa.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,a=i+s.length;(i>=n.to||a<=n.from)&&(n=Me.range(i,a))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",dv(t.state,Rk,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};sa.dragend=t=>(t.inputState.draggedContent=null,!1);function UC(t,e,n,r){if(n=dv(t.state,Ak,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,a=r&&i&&One(t,e)?{from:i.from,to:i.to}:null,o={from:s,insert:n},u=t.state.changes(a?[a,o]:o);t.focus(),t.dispatch({changes:u,selection:{anchor:u.mapPos(s,-1),head:u.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}sa.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&UC(t,e,r.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(o.result)||(r[a]=o.result),i()},o.readAsText(n[a])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return UC(t,e,r,!0),!0}return!1};sa.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=wL?null:e.clipboardData;return n?(SL(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Cne(t),!1)};function Ane(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function Rne(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let a=t.doc.lineAt(i);a.number>s&&(e.push(a.text),n.push({from:a.from,to:Math.min(t.doc.length,a.to+1)})),s=a.number}r=!0}return{text:dv(t,Rk,e.join(t.lineBreak)),ranges:n,linewise:r}}let T3=null;sa.copy=sa.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=Rne(t.state);if(!n&&!s)return!1;T3=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=wL?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(Ane(t,n),!1)};const OL=qa.define();function jL(t,e){let n=[];for(let r of t.facet(sL)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:OL.of(!0)}):null}function NL(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=jL(t.state,e);n?t.dispatch(n):t.update([])}},10)}Fi.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),NL(t)};Fi.blur=t=>{t.observer.clearSelectionRange(),NL(t)};Fi.compositionstart=Fi.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Fi.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,We.chrome&&We.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Fi.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};sa.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),a=e.getTargetRanges();if(i&&a.length){let o=a[0],u=t.posAtDOM(o.startContainer,o.startOffset),h=t.posAtDOM(o.endContainer,o.endOffset);return Pk(t,{from:u,to:h,insert:t.state.toText(i)},null),!0}}let s;if(We.chrome&&We.android&&(s=yL.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return We.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),We.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Fi.compositionend(t,e),20),!1};const WC=new Set;function Dne(t){WC.has(t)||(WC.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const GC=["pre-wrap","normal","pre-line","break-spaces"];let sh=!1;function XC(){sh=!1}class zne{constructor(e){this.lineWrapping=e,this.doc=nn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return GC.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,u=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,u){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Cx&&(sh=!0),this.height=e)}replace(e,n,r){return Os.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,a=r.doc;for(let o=s.length-1;o>=0;o--){let{fromA:u,toA:h,fromB:f,toB:m}=s[o],g=i.lineAt(u,Yn.ByPosNoHeight,r.setDoc(n),0,0),x=g.to>=h?g:i.lineAt(h,Yn.ByPosNoHeight,r,0,0);for(m+=x.to-h,h=x.to;o>0&&g.from<=s[o-1].toA;)u=s[o-1].fromA,f=s[o-1].fromB,o--,ui*2){let o=e[n-1];o.break?e.splice(--n,1,o.left,null,o.right):e.splice(--n,1,o.left,o.right),r+=1+o.break,s-=o.size}else if(i>s*2){let o=e[r];o.break?e.splice(r,1,o.left,null,o.right):e.splice(r,1,o.left,o.right),r+=2+o.break,i-=o.size}else break;else if(s=i&&a(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class oi extends CL{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new Na(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof oi||s instanceof ts&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof ts?s=new oi(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):Os.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setHeight(s.heights[s.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ts extends Os{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,a,o=0;if(e.lineWrapping){let u=Math.min(this.height,e.lineHeight*i);a=u/i,this.length>i+1&&(o=(this.height-u)/(this.length-i-1))}else a=this.height/i;return{firstLine:r,lastLine:s,perLine:a,perChar:o}}blockAt(e,n,r,s){let{firstLine:i,lastLine:a,perLine:o,perChar:u}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof ts?r[r.length-1]=new ts(i.length+s):r.push(null,new ts(s-1))}if(e>0){let i=r[0];i instanceof ts?r[0]=new ts(e+i.length):r.unshift(new ts(e-1),null)}return Os.of(r)}decomposeLeft(e,n){n.push(new ts(e-1),null)}decomposeRight(e,n){n.push(null,new ts(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let a=[],o=Math.max(n,s.from),u=-1;for(s.from>n&&a.push(new ts(s.from-n-1).updateHeight(e,n));o<=i&&s.more;){let f=e.doc.lineAt(o).length;a.length&&a.push(null);let m=s.heights[s.index++];u==-1?u=m:Math.abs(m-u)>=Cx&&(u=-2);let g=new oi(f,m);g.outdated=!1,a.push(g),o+=f+1}o<=i&&a.push(null,new ts(i-o).updateHeight(e,o));let h=Os.of(a);return(u<0||Math.abs(h.height-this.height)>=Cx||Math.abs(u-this.heightMetrics(e,n).perLine)>=Cx)&&(sh=!0),i1(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Lne extends Os{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return eo))return h;let f=n==Yn.ByPosNoHeight?Yn.ByPosNoHeight:Yn.ByPos;return u?h.join(this.right.lineAt(o,f,r,a,o)):this.left.lineAt(o,f,r,s,i).join(h)}forEachLine(e,n,r,s,i,a){let o=s+this.left.height,u=i+this.left.length+this.break;if(this.break)e=u&&this.right.forEachLine(e,n,r,o,u,a);else{let h=this.lineAt(u,Yn.ByPos,r,s,i);e=e&&h.from<=n&&a(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,o,u,a)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let o of r)i.push(o);if(e>0&&YC(i,a-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?Os.of(this.break?[e,null,n]:[e,n]):(this.left=i1(this.left,e),this.right=i1(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:a}=this,o=n+i.length+this.break,u=null;return s&&s.from<=n+i.length&&s.more?u=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=o+a.length&&s.more?u=a=a.updateHeight(e,o,r,s):a.updateHeight(e,o,r),u?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function YC(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof ts&&(r=t[e+1])instanceof ts&&t.splice(e-1,3,new ts(n.length+1+r.length))}const Bne=5;class Lk{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof oi?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new oi(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=Bne)&&this.addLineDeco(s,i,a)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new oi(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new ts(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof oi)return e;let n=new oi(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof oi)&&!this.isCovered?this.nodes.push(new oi(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&m.overflow!="visible"){let g=f.getBoundingClientRect();i=Math.max(i,g.left),a=Math.min(a,g.right),o=Math.max(o,g.top),u=Math.min(h==t.parentNode?s.innerHeight:u,g.bottom)}h=m.position=="absolute"||m.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,a)-n.left,top:o-(n.top+e),bottom:Math.max(o,u)-(n.top+e)}}function $ne(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function Qne(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class E2{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new zne(n),this.stateDeco=e.facet(Om).filter(r=>typeof r!="function"),this.heightMap=Os.empty().applyChanges(this.stateDeco,nn.empty,this.heightOracle.setDoc(e.doc),[new Bi(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ot.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:a})=>s>=i&&s<=a)){let{from:i,to:a}=this.lineBlockAt(s);e.push(new Cg(i,a))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?KC:new Bk(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Wf(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Om).filter(f=>typeof f!="function");let s=e.changedRanges,i=Bi.extendWithRanges(s,Ine(r,this.stateDeco,e?e.changes:Br.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);XC(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||sh)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let u=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headu.to)||!this.viewportIsAppropriate(u))&&(u=this.getViewport(0,n));let h=u.from!=this.viewport.from||u.to!=this.viewport.to;this.viewport=u,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(aL)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Zn.RTL:Zn.LTR;let a=this.heightOracle.mustRefreshForWrapping(i),o=n.getBoundingClientRect(),u=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let h=0,f=0;if(o.width&&o.height){let{scaleX:T,scaleY:E}=zP(n,o);(T>.005&&Math.abs(this.scaleX-T)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=T,this.scaleY=E,h|=16,a=u=!0)}let m=(parseInt(r.paddingTop)||0)*this.scaleY,g=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=m||this.paddingBottom!=g)&&(this.paddingTop=m,this.paddingBottom=g,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(u=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let x=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=x&&(this.scrollAnchorHeight=-1,this.scrollTop=x),this.scrolledToBottom=BP(e.scrollDOM);let y=(this.printing?Qne:Fne)(n,this.paddingTop),w=y.top-this.pixelViewport.top,b=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let k=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(k!=this.inView&&(this.inView=k,k&&(u=!0)),!this.inView&&!this.scrollTarget&&!$ne(e.dom))return 0;let N=o.width;if((this.contentDOMWidth!=N||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),u){let T=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(a=!0),a||s.lineWrapping&&Math.abs(N-this.contentDOMWidth)>s.charWidth){let{lineHeight:E,charWidth:_,textHeight:A}=e.docView.measureTextSize();a=E>0&&s.refresh(i,E,_,A,Math.max(5,N/_),T),a&&(e.docView.minWidth=0,h|=16)}w>0&&b>0?f=Math.max(w,b):w<0&&b<0&&(f=Math.min(w,b)),XC();for(let E of this.viewports){let _=E.from==this.viewport.from?T:e.docView.measureVisibleLineHeights(E);this.heightMap=(a?Os.empty().applyChanges(this.stateDeco,nn.empty,this.heightOracle,[new Bi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new Pne(E.from,_))}sh&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,u=new Cg(s.lineAt(a-r*1e3,Yn.ByHeight,i,0,0).from,s.lineAt(o+(1-r)*1e3,Yn.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hu.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),m=s.lineAt(h,Yn.ByPos,i,0,0),g;n.y=="center"?g=(m.top+m.bottom)/2-f/2:n.y=="start"||n.y=="nearest"&&h=o+Math.max(10,Math.min(r,250)))&&s>a-2*1e3&&i>1,a=s<<1;if(this.defaultTextDirection!=Zn.LTR&&!r)return[];let o=[],u=(f,m,g,x)=>{if(m-ff&&kk.from>=g.from&&k.to<=g.to&&Math.abs(k.from-f)k.fromN));if(!b){if(mC.from<=m&&C.to>=m)){let C=n.moveToLineBoundary(Me.cursor(m),!1,!0).head;C>f&&(m=C)}let k=this.gapSize(g,f,m,x),N=r||k<2e6?k:2e6;b=new E2(f,m,k,N)}o.push(b)},h=f=>{if(f.length2e6)for(let _ of e)_.from>=f.from&&_.fromf.from&&u(f.from,x,f,m),yn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];rn.spans(n,this.viewport.from,this.viewport.to,{span(i,a){r.push({from:i,to:a})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Wf(this.heightMap.lineAt(e,Yn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||Wf(this.heightMap.lineAt(this.scaler.fromDOM(e),Yn.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Wf(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let Cg=class{constructor(e,n){this.from=e,this.to=n}};function Vne(t,e,n){let r=[],s=t,i=0;return rn.spans(n,t,e,{span(){},point(a,o){a>s&&(r.push({from:s,to:a}),i+=a-s),s=o}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:a}=e[s],o=a-i;if(r<=o)return i+r;r-=o}}function Eg(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function Une(t,e){for(let n of t)if(e(n))return n}const KC={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class Bk{constructor(e,n,r){let s=0,i=0,a=0;this.viewports=r.map(({from:o,to:u})=>{let h=n.lineAt(o,Yn.ByPos,e,0,0).top,f=n.lineAt(u,Yn.ByPos,e,0,0).bottom;return s+=f-h,{from:o,to:u,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let o of this.viewports)o.domTop=a+(o.top-i)*this.scale,a=o.domBottom=o.domTop+(o.bottom-o.top),i=o.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Wf(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Na(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>Wf(s,e)):t._content)}const _g=Ye.define({combine:t=>t.join(" ")}),E3=Ye.define({combine:t=>t.indexOf(!0)>-1}),_3=Xo.newName(),TL=Xo.newName(),EL=Xo.newName(),_L={"&light":"."+TL,"&dark":"."+EL};function M3(t,e,n){return new Xo(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const Wne=M3("."+_3,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},_L),Gne={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},_2=We.ie&&We.ie_version<=11;class Xne{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Mte,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(We.ie&&We.ie_version<=11||We.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&We.android&&e.constructor.EDIT_CONTEXT!==!1&&!(We.chrome&&We.chrome_version<126)&&(this.editContext=new Zne(e),e.state.facet(El)&&(e.contentDOM.editContext=this.editContext.editContext)),_2&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(El)?r.root.activeElement!=this.dom:!jx(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(We.ie&&We.ie_version<=11||We.android&&We.chrome)&&!r.state.selection.main.empty&&s.focusNode&&am(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=km(e.root);if(!n)return!1;let r=We.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Yne(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=jx(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Ld(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let a=this.readMutation(i);a&&(a.typeOver&&(s=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&jx(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new mne(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=xL(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=JC(n,e.previousSibling||e.target.previousSibling,-1),s=JC(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(El)!=e.state.facet(El)&&(e.view.contentDOM.editContext=e.state.facet(El)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function JC(t,e,n){for(;e;){let r=Dn.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function e9(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return am(a.node,a.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function Yne(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return e9(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?e9(t,n):null}class Zne{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:a}=s,o=this.toEditorPos(r.updateRangeStart),u=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:o,drifted:!1});let h=u-o>r.text.length;o==this.from&&ithis.to&&(u=i);let f=vL(e.state.sliceDoc(o,u),r.text,(h?s.from:s.to)-o,h?"end":null);if(!f){let g=Me.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));g.main.eq(s)||e.dispatch({selection:g,userEvent:"select"});return}let m={from:f.from+o,to:f.toA+o,insert:nn.of(r.text.slice(f.from,f.toB).split(` `))};if((We.mac||We.android)&&m.from==a-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(m={from:o,to:u,insert:nn.of([r.text.replace("."," ")])}),this.pendingContextChange=m,!e.state.readOnly){let g=this.to-this.from+(m.to-m.from+m.insert.length);Pk(e,m,Me.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),m.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let a=this.toEditorPos(r.rangeStart),o=this.toEditorPos(r.rangeEnd);a{let s=[];for(let i of r.getTextFormats()){let a=i.underlineStyle,o=i.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(o)){let u=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(u{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=km(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,a,o,u,h)=>{if(r)return;let f=h.length-(a-i);if(s&&a>=s.to)if(s.from==i&&s.to==a&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=f,this.to+=f;return}else s=null,this.revertPending(e.state);if(i+=n,a+=n,a<=this.from)this.from+=f,this.to+=f;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),h.toString()),this.to+=f}n+=f}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Ue{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Ate(e.parent)||document,this.viewState=new ZC(e.state||tn.create(e)),e.scrollTo&&e.scrollTo.is(Og)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ed).map(s=>new N2(s));for(let s of this.plugins)s.update(this);this.observer=new Xne(this),this.inputState=new vne(this),this.inputState.ensureHandlers(this.plugins),this.docView=new AC(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof Er?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let g of e){if(g.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=g.state}if(this.destroyed){this.viewState.state=i;return}let a=this.hasFocus,o=0,u=null;e.some(g=>g.annotation(OL))?(this.inputState.notifiedFocused=a,o=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,u=jL(i,a),u||(o=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(f=null)):this.observer.clear(),i.facet(tn.phrases)!=this.state.facet(tn.phrases))return this.setState(i);s=s1.create(this,i,e),s.flags|=o;let m=this.viewState.scrollTarget;try{this.updateState=2;for(let g of e){if(m&&(m=m.map(g.changes)),g.scrollIntoView){let{main:x}=g.state.selection;m=new Bd(x.empty?x:Me.cursor(x.head,x.head>x.anchor?-1:1))}for(let x of g.effects)x.is(Og)&&(m=x.value.clip(this.state))}this.viewState.update(s,m),this.bidiCache=a1.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Vf)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(_g)!=s.state.facet(_g)&&(this.viewState.mustMeasureContent=!0),(n||r||m||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let g of this.state.facet(j3))try{g(s)}catch(x){Fs(this.state,x,"update listener")}(u||f)&&Promise.resolve().then(()=>{u&&this.state==u.startState&&this.dispatch(u),f&&!xL(this,f)&&h.force&&Ld(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new ZC(e),this.plugins=e.facet(Ed).map(r=>new N2(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new AC(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Ed),r=e.state.facet(Ed);if(n!=r){let s=[];for(let i of r){let a=n.indexOf(i);if(a<0)s.push(new N2(i));else{let o=this.plugins[a];o.mustUpdate=e,s.push(o)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:a}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let o=0;;o++){if(a<0)if(BP(r))i=-1,a=this.viewState.heightMap.height;else{let x=this.viewState.scrollAnchorAt(s);i=x.from,a=x.top}this.updateState=1;let u=this.viewState.measure(this);if(!u&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(o>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];u&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(x=>{try{return x.read(this)}catch(y){return Fs(this.state,y),t9}}),m=s1.create(this,this.state,[]),g=!1;m.flags|=u,n?n.flags|=u:n=m,this.updateState=2,m.empty||(this.updatePlugins(m),this.inputState.update(m),this.updateAttrs(),g=this.docView.update(m),g&&this.docViewUpdate());for(let x=0;x1||y<-1){s=s+y,r.scrollTop=s/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let o of this.state.facet(j3))o(n)}get themeClasses(){return _3+" "+(this.state.facet(E3)?EL:TL)+" "+this.state.facet(_g)}updateAttrs(){let e=n9(this,cL,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(El)?"true":"false",class:"cm-content",style:`${We.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),n9(this,Dk,n);let r=this.observer.ignore(()=>{let s=b3(this.contentDOM,this.contentAttrs,n),i=b3(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(Ue.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Vf);let e=this.state.facet(Ue.cspNonce);Xo.mount(this.root,this.styleModules.concat(Wne).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return T2(this,e,LC(this,e,n,r))}moveByGroup(e,n){return T2(this,e,LC(this,e,n,r=>cne(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Me.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return one(this,e,n,r)}moveVertically(e,n,r){return T2(this,e,une(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),mL(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),a=i[$o.find(i,e-s.from,-1,n)];return m0(r,a.dir==Zn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(iL)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Kne)return ZP(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||YP(i.isolates,r=MC(this,e))))return i.order;r||(r=MC(this,e));let s=Ute(e.text,n,r);return this.bidiCache.push(new a1(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||We.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{PP(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return Og.of(new Bd(typeof e=="number"?Me.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Og.of(new Bd(Me.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return wr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return wr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Xo.newName(),s=[_g.of(r),Vf.of(M3(`.${r}`,e))];return n&&n.dark&&s.push(E3.of(!0)),s}static baseTheme(e){return cc.lowest(Vf.of(M3("."+_3,e,_L)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&Dn.get(r)||Dn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}Ue.styleModule=Vf;Ue.inputHandler=rL;Ue.clipboardInputFilter=Ak;Ue.clipboardOutputFilter=Rk;Ue.scrollHandler=lL;Ue.focusChangeEffect=sL;Ue.perLineTextDirection=iL;Ue.exceptionSink=nL;Ue.updateListener=j3;Ue.editable=El;Ue.mouseSelectionStyle=tL;Ue.dragMovesSelection=eL;Ue.clickAddsSelectionRange=JP;Ue.decorations=Om;Ue.outerDecorations=uL;Ue.atomicRanges=x0;Ue.bidiIsolatedRanges=dL;Ue.scrollMargins=hL;Ue.darkTheme=E3;Ue.cspNonce=Ye.define({combine:t=>t.length?t[0]:""});Ue.contentAttributes=Dk;Ue.editorAttributes=cL;Ue.lineWrapping=Ue.contentAttributes.of({class:"cm-lineWrapping"});Ue.announce=Nt.define();const Kne=4096,t9={};class a1{constructor(e,n,r,s,i,a){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=a}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Zn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],a=typeof i=="function"?i(t):i;a&&y3(a,n)}return n}const Jne=We.mac?"mac":We.windows?"win":We.linux?"linux":"key";function ere(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,a,o;for(let u=0;ur.concat(s),[]))),n}function nre(t,e,n){return AL(ML(t.state),e,t,n)}let Io=null;const rre=4e3;function sre(t,e=Jne){let n=Object.create(null),r=Object.create(null),s=(a,o)=>{let u=r[a];if(u==null)r[a]=o;else if(u!=o)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},i=(a,o,u,h,f)=>{var m,g;let x=n[a]||(n[a]=Object.create(null)),y=o.split(/ (?!$)/).map(k=>ere(k,e));for(let k=1;k{let T=Io={view:C,prefix:N,scope:a};return setTimeout(()=>{Io==T&&(Io=null)},rre),!0}]})}let w=y.join(" ");s(w,!1);let b=x[w]||(x[w]={preventDefault:!1,stopPropagation:!1,run:((g=(m=x._any)===null||m===void 0?void 0:m.run)===null||g===void 0?void 0:g.slice())||[]});u&&b.run.push(u),h&&(b.preventDefault=!0),f&&(b.stopPropagation=!0)};for(let a of t){let o=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let h of o){let f=n[h]||(n[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:m}=a;for(let g in f)f[g].run.push(x=>m(x,A3))}let u=a[e]||a.key;if(u)for(let h of o)i(h,u,a.run,a.preventDefault,a.stopPropagation),a.shift&&i(h,"Shift-"+u,a.shift,a.preventDefault,a.stopPropagation)}return n}let A3=null;function AL(t,e,n,r){A3=e;let s=Nte(e),i=Is(s,0),a=ja(i)==s.length&&s!=" ",o="",u=!1,h=!1,f=!1;Io&&Io.view==n&&Io.scope==r&&(o=Io.prefix+" ",bL.indexOf(e.keyCode)<0&&(h=!0,Io=null));let m=new Set,g=b=>{if(b){for(let k of b.run)if(!m.has(k)&&(m.add(k),k(n)))return b.stopPropagation&&(f=!0),!0;b.preventDefault&&(b.stopPropagation&&(f=!0),h=!0)}return!1},x=t[r],y,w;return x&&(g(x[o+Mg(s,e,!a)])?u=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(We.windows&&e.ctrlKey&&e.altKey)&&!(We.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(y=Yo[e.keyCode])&&y!=s?(g(x[o+Mg(y,e,!0)])||e.shiftKey&&(w=Sm[e.keyCode])!=s&&w!=y&&g(x[o+Mg(w,e,!1)]))&&(u=!0):a&&e.shiftKey&&g(x[o+Mg(s,e,!0)])&&(u=!0),!u&&g(x._any)&&(u=!0)),h&&(u=!0),u&&f&&e.stopPropagation(),A3=null,u}class y0{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=RL(e);return[new y0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return ire(e,n,r)}}function RL(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Zn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function s9(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),a=(s.top+s.bottom)/2,o=t.posAtCoords({x:i.left+1,y:a}),u=t.posAtCoords({x:i.right-1,y:a});return o==null||u==null?r:{from:Math.max(r.from,Math.min(o,u)),to:Math.min(r.to,Math.max(o,u))}}function ire(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Zn.LTR,a=t.contentDOM,o=a.getBoundingClientRect(),u=RL(t),h=a.querySelector(".cm-line"),f=h&&window.getComputedStyle(h),m=o.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),g=o.right-(f?parseInt(f.paddingRight):0),x=C3(t,r,1),y=C3(t,s,-1),w=x.type==ks.Text?x:null,b=y.type==ks.Text?y:null;if(w&&(t.lineWrapping||x.widgetLineBreaks)&&(w=s9(t,r,1,w)),b&&(t.lineWrapping||y.widgetLineBreaks)&&(b=s9(t,s,-1,b)),w&&b&&w.from==b.from&&w.to==b.to)return N(C(n.from,n.to,w));{let E=w?C(n.from,null,w):T(x,!1),_=b?C(null,n.to,b):T(y,!0),A=[];return(w||x).to<(b||y).from-(w&&b?1:0)||x.widgetLineBreaks>1&&E.bottom+t.defaultLineHeight/2<_.top?A.push(k(m,E.bottom,g,_.top)):E.bottom<_.top&&t.elementAtHeight((E.bottom+_.top)/2).type==ks.Text&&(E.bottom=_.top=(E.bottom+_.top)/2),N(E).concat(A).concat(N(_))}function k(E,_,A,F){return new y0(e,E-u.left,_-u.top,A-E,F-_)}function N({top:E,bottom:_,horizontal:A}){let F=[];for(let B=0;BU&&z.from=q)break;R>W&&H(Math.max(Y,W),E==null&&Y<=U,Math.min(R,q),_==null&&R>=te,ee.dir)}if(W=J.to+1,W>=q)break}return P.length==0&&H(U,E==null,te,_==null,t.textDirection),{top:F,bottom:B,horizontal:P}}function T(E,_){let A=o.top+(_?E.top:E.bottom);return{top:A,bottom:A,horizontal:[]}}}function are(t,e){return t.constructor==e.constructor&&t.eq(e)}class lre{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Tx)!=e.state.facet(Tx)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Tx);for(;n!are(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,We.safari&&We.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Tx=Ye.define();function DL(t){return[wr.define(e=>new lre(e,t)),Tx.of(t)]}const jm=Ye.define({combine(t){return Fa(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function ore(t={}){return[jm.of(t),cre,ure,dre,aL.of(!0)]}function zL(t){return t.startState.facet(jm)!=t.state.facet(jm)}const cre=DL({above:!0,markers(t){let{state:e}=t,n=e.facet(jm),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let a=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",o=s.empty?s:Me.cursor(s.head,s.head>s.anchor?-1:1);for(let u of y0.forRange(t,a,o))r.push(u)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=zL(t);return n&&i9(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){i9(e.state,t)},class:"cm-cursorLayer"});function i9(t,e){e.style.animationDuration=t.facet(jm).cursorBlinkRate+"ms"}const ure=DL({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:y0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||zL(t)},class:"cm-selectionLayer"}),dre=cc.highest(Ue.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),PL=Nt.define({map(t,e){return t==null?null:e.mapPos(t)}}),Gf=Xr.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(PL)?r.value:n,t)}}),hre=wr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Gf);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Gf)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Gf),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Gf)!=t&&this.view.dispatch({effects:PL.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function fre(){return[Gf,hre]}function a9(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),a=n,o;!i.next().done;a+=i.value.length)if(!i.lineBreak)for(;o=e.exec(i.value);)s(a+o.index,o)}function mre(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class pre{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:a=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(o,u,h,f)=>s(f,h,h+o[0].length,o,u);else if(typeof r=="function")this.addMatch=(o,u,h,f)=>{let m=r(o,u,h);m&&f(h,h+o[0].length,m)};else if(r)this.addMatch=(o,u,h,f)=>f(h,h+o[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=a}createDeco(e){let n=new $l,r=n.add.bind(n);for(let{from:s,to:i}of mre(e,this.maxLength))a9(e.state.doc,this.regexp,s,i,(a,o)=>this.addMatch(o,e,a,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,a,o,u)=>{u>=e.view.viewport.from&&o<=e.view.viewport.to&&(r=Math.min(o,r),s=Math.max(u,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let a=Math.max(i.from,r),o=Math.min(i.to,s);if(o>=a){let u=e.state.doc.lineAt(a),h=u.tou.from;a--)if(this.boundary.test(u.text[a-1-u.from])){f=a;break}for(;og.push(k.range(w,b));if(u==h)for(this.regexp.lastIndex=f-u.from;(x=this.regexp.exec(u.text))&&x.indexthis.addMatch(b,e,w,y));n=n.update({filterFrom:f,filterTo:m,filter:(w,b)=>wm,add:g})}}return n}}const R3=/x/.unicode!=null?"gu":"g",gre=new RegExp(`[\0-\b --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,R3),xre={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let M2=null;function vre(){var t;if(M2==null&&typeof document<"u"&&document.body){let e=document.body.style;M2=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return M2||!1}const Ex=Ye.define({combine(t){let e=Fa(t,{render:null,specialChars:gre,addSpecialChars:null});return(e.replaceTabs=!vre())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,R3)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,R3)),e}});function yre(t={}){return[Ex.of(t),bre()]}let l9=null;function bre(){return l9||(l9=wr.fromClass(class{constructor(t){this.view=t,this.decorations=ot.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Ex)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pre({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=Is(e[0],0);if(i==9){let a=s.lineAt(r),o=n.state.tabSize,u=Sh(a.text,o,r-a.from);return ot.replace({widget:new Ore((o-u%o)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=ot.replace({widget:new kre(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Ex);t.startState.facet(Ex)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const wre="•";function Sre(t){return t>=32?wre:t==10?"␤":String.fromCharCode(9216+t)}class kre extends $a{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=Sre(this.code),r=e.state.phrase("Control character")+" "+(xre[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class Ore extends $a{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function jre(){return Cre}const Nre=ot.line({class:"cm-activeLine"}),Cre=wr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(Nre.range(s.from)),e=s.from)}return ot.set(n)}},{decorations:t=>t.decorations});class Tre extends $a{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?th(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=m0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function Ere(t){let e=wr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?ot.set([ot.widget({widget:new Tre(t),side:1}).range(0)]):ot.none}get decorations(){return this.view.state.doc.length?ot.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,Ue.contentAttributes.of({"aria-placeholder":t})]:e}const D3=2e3;function _re(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>D3||n.off>D3||e.col<0||n.col<0){let a=Math.min(e.off,n.off),o=Math.max(e.off,n.off);for(let u=r;u<=s;u++){let h=t.doc.line(u);h.length<=o&&i.push(Me.range(h.from+a,h.to+o))}}else{let a=Math.min(e.col,n.col),o=Math.max(e.col,n.col);for(let u=r;u<=s;u++){let h=t.doc.line(u),f=d3(h.text,a,t.tabSize,!0);if(f<0)i.push(Me.cursor(h.to));else{let m=d3(h.text,o,t.tabSize);i.push(Me.range(h.from+f,h.from+m))}}}return i}function Mre(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function o9(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>D3?-1:s==r.length?Mre(t,e.clientX):Sh(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function Are(t,e){let n=o9(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),a=s.state.doc.lineAt(i);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},r=r.map(s.changes)}},get(s,i,a){let o=o9(t,s);if(!o)return r;let u=_re(t.state,n,o);return u.length?a?Me.create(u.concat(r.ranges)):Me.create(u):r}}:null}function Rre(t){let e=(n=>n.altKey&&n.button==0);return Ue.mouseSelectionStyle.of((n,r)=>e(r)?Are(n,r):null)}const Dre={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},zre={style:"cursor: crosshair"};function Pre(t={}){let[e,n]=Dre[t.key||"Alt"],r=wr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,Ue.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?zre:null})]}const Ag="-10000px";class LL{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(a=>a);let i=null;this.tooltipViews=this.tooltips.map(a=>i=r(a,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(u=>u);if(s===this.input){for(let u of this.tooltipViews)u.update&&u.update(e);return!1}let a=[],o=n?[]:null;for(let u=0;un[h]=u),n.length=o.length),this.input=s,this.tooltips=i,this.tooltipViews=a,!0}}function Lre(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const A2=Ye.define({combine:t=>{var e,n,r;return{position:We.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||Lre}}}),c9=new WeakMap,Ik=wr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(A2);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new LL(t,qk,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(A2);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=Ag,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(We.safari){let a=i.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=zk(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,a)=>{let o=this.manager.tooltipViews[a];return o.getCoords?o.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(A2).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let o of this.manager.tooltipViews)o.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,a=[];for(let o=0;o=Math.min(n.bottom,r.bottom)||m.rightMath.min(n.right,r.right)+.1)){f.style.top=Ag;continue}let x=u.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,y=x?7:0,w=g.right-g.left,b=(e=c9.get(h))!==null&&e!==void 0?e:g.bottom-g.top,k=h.offset||Ire,N=this.view.textDirection==Zn.LTR,C=g.width>r.right-r.left?N?r.left:r.right-g.width:N?Math.max(r.left,Math.min(m.left-(x?14:0)+k.x,r.right-w)):Math.min(Math.max(r.left,m.left-w+(x?14:0)-k.x),r.right-w),T=this.above[o];!u.strictSide&&(T?m.top-b-y-k.yr.bottom)&&T==r.bottom-m.bottom>m.top-r.top&&(T=this.above[o]=!T);let E=(T?m.top-r.top:r.bottom-m.bottom)-y;if(EC&&F.top<_+b&&F.bottom>_&&(_=T?F.top-b-2-y:F.bottom+y+2);if(this.position=="absolute"?(f.style.top=(_-t.parent.top)/i+"px",u9(f,(C-t.parent.left)/s)):(f.style.top=_/i+"px",u9(f,C/s)),x){let F=m.left+(N?k.x:-k.x)-(C+14-7);x.style.left=F/s+"px"}h.overlap!==!0&&a.push({left:C,top:_,right:A,bottom:_+b}),f.classList.toggle("cm-tooltip-above",T),f.classList.toggle("cm-tooltip-below",!T),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Ag}},{eventObservers:{scroll(){this.maybeMeasure()}}});function u9(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const Bre=Ue.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ire={x:0,y:0},qk=Ye.define({enables:[Ik,Bre]}),l1=Ye.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class hv{static create(e){return new hv(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new LL(e,l1,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const qre=qk.compute([l1],t=>{let e=t.facet(l1);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:hv.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class Fre{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;eo.bottom||n.xo.right+e.defaultCharacterWidth)return;let u=e.bidiSpans(e.state.doc.lineAt(s)).find(f=>f.from<=s&&f.to>=s),h=u&&u.dir==Zn.RTL?-1:1;i=n.x{this.pending==o&&(this.pending=null,u&&!(Array.isArray(u)&&!u.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(u)?u:[u])}))},u=>Fs(e.state,u,"hover tooltip"))}else a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(Ik),n=e?e.manager.tooltips.findIndex(r=>r.create==hv.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!$re(i.dom,e)||this.pending){let{pos:a}=s[0]||this.pending,o=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==o?this.view.posAtCoords(this.lastMove)!=a:!Qre(this.view,a,o,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Rg=4;function $re(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let o=a.getBoundingClientRect();s=Math.min(o.top,s),i=Math.max(o.bottom,i)}return e.clientX>=n-Rg&&e.clientX<=r+Rg&&e.clientY>=s-Rg&&e.clientY<=i+Rg}function Qre(t,e,n,r,s,i){let a=t.scrollDOM.getBoundingClientRect(),o=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>r||a.rights||Math.min(a.bottom,o)=e&&u<=n}function Hre(t,e={}){let n=Nt.define(),r=Xr.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(a=>!e.hideOn(i,a))),i.docChanged)){let a=[];for(let o of s){let u=i.changes.mapPos(o.pos,-1,rs.TrackDel);if(u!=null){let h=Object.assign(Object.create(null),o);h.pos=u,h.end!=null&&(h.end=i.changes.mapPos(h.end)),a.push(h)}}s=a}for(let a of i.effects)a.is(n)&&(s=a.value),a.is(Vre)&&(s=[]);return s},provide:s=>l1.from(s)});return{active:r,extension:[r,wr.define(s=>new Fre(s,t,r,n,e.hoverTime||300)),qre]}}function BL(t,e){let n=t.plugin(Ik);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const Vre=Nt.define(),d9=Ye.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function Nm(t,e){let n=t.plugin(IL),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const IL=wr.fromClass(class{constructor(t){this.input=t.state.facet(Cm),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(d9);this.top=new Dg(t,!0,e.topContainer),this.bottom=new Dg(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(d9);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dg(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dg(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Cm);if(n!=this.input){let r=n.filter(u=>u),s=[],i=[],a=[],o=[];for(let u of r){let h=this.specs.indexOf(u),f;h<0?(f=u(t.view),o.push(f)):(f=this.panels[h],f.update&&f.update(t)),s.push(f),(f.top?i:a).push(f)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(a);for(let u of o)u.dom.classList.add("cm-panel"),u.mount&&u.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Ue.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Dg{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=h9(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=h9(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function h9(t){let e=t.nextSibling;return t.remove(),e}const Cm=Ye.define({enables:IL});class Hl extends au{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Hl.prototype.elementClass="";Hl.prototype.toDOM=void 0;Hl.prototype.mapMode=rs.TrackBefore;Hl.prototype.startSide=Hl.prototype.endSide=-1;Hl.prototype.point=!0;const _x=Ye.define(),Ure=Ye.define(),Wre={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>rn.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},cm=Ye.define();function Gre(t){return[qL(),cm.of({...Wre,...t})]}const f9=Ye.define({combine:t=>t.some(e=>e)});function qL(t){return[Xre]}const Xre=wr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(cm).map(e=>new p9(t,e)),this.fixed=!t.state.facet(f9);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(f9)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=rn.iter(this.view.state.facet(_x),this.view.viewport.from),r=[],s=this.gutters.map(i=>new Yre(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let a=!0;for(let o of i.type)if(o.type==ks.Text&&a){z3(n,r,o.from);for(let u of s)u.line(this.view,o,r);a=!1}else if(o.widget)for(let u of s)u.widget(this.view,o)}else if(i.type==ks.Text){z3(n,r,i.from);for(let a of s)a.line(this.view,i,r)}else if(i.widget)for(let a of s)a.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(cm),n=t.state.facet(cm),r=t.docChanged||t.heightChanged||t.viewportChanged||!rn.eq(t.startState.facet(_x),t.state.facet(_x),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let a=e.indexOf(i);a<0?s.push(new p9(this.view,i)):(this.gutters[a].update(t),s.push(this.gutters[a]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>Ue.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Zn.LTR?{left:r,right:s}:{right:r,left:s}})});function m9(t){return Array.isArray(t)?t:[t]}function z3(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class Yre{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=rn.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,a=n.height/e.scaleY;if(this.i==s.elements.length){let o=new FL(e,a,i,r);s.elements.push(o),s.dom.appendChild(o.dom)}else s.elements[this.i].update(e,a,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];z3(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let a=this.gutter;s.length==0&&!a.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(Ure)){let a=i(e,n.widget,n);a&&(s||(s=[])).push(a)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class p9{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let u=i.getBoundingClientRect();a=(u.top+u.bottom)/2}else a=s.clientY;let o=e.lineBlockAtHeight(a-e.documentTop);n.domEventHandlers[r](e,o,s)&&s.preventDefault()});this.markers=m9(n.markers(e)),n.initialSpacer&&(this.spacer=new FL(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=m9(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!rn.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class FL{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),Zre(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,a=0;;){let o=a,u=ii(o,u,h)||a(o,u,h):a}return r}})}});class R2 extends Hl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function D2(t,e){return t.state.facet(_d).formatNumber(e,t.state)}const ese=cm.compute([_d],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Kre)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new R2(D2(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(Jre)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(_d)!=e.state.facet(_d),initialSpacer(e){return new R2(D2(e,g9(e.state.doc.lines)))},updateSpacer(e,n){let r=D2(n.view,g9(n.view.state.doc.lines));return r==e.number?e:new R2(r)},domEventHandlers:t.facet(_d).domEventHandlers,side:"before"}));function tse(t={}){return[_d.of(t),qL(),ese]}function g9(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(nse.range(s)))}return rn.of(e)});function sse(){return rse}const $L=1024;let ise=0;class z2{constructor(e,n){this.from=e,this.to=n}}class Ft{constructor(e={}){this.id=ise++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Cs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Ft.closedBy=new Ft({deserialize:t=>t.split(" ")});Ft.openedBy=new Ft({deserialize:t=>t.split(" ")});Ft.group=new Ft({deserialize:t=>t.split(" ")});Ft.isolate=new Ft({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Ft.contextHash=new Ft({perNode:!0});Ft.lookAhead=new Ft({perNode:!0});Ft.mounted=new Ft({perNode:!0});class o1{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Ft.mounted.id]}}const ase=Object.create(null);class Cs{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):ase,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Cs(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Ft.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(Ft.group),i=-1;i<(s?s.length:0);i++){let a=n[i<0?r.name:s[i]];if(a)return a}}}}Cs.none=new Cs("",Object.create(null),0,8);class fv{constructor(e){this.types=e;for(let n=0;n0;for(let u=this.cursor(a|Ir.IncludeAnonymous);;){let h=!1;if(u.from<=i&&u.to>=s&&(!o&&u.type.isAnonymous||n(u)!==!1)){if(u.firstChild())continue;h=!0}for(;h&&r&&(o||!u.type.isAnonymous)&&r(u),!u.nextSibling();){if(!u.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Qk(Cs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Fn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Fn(Cs.none,n,r,s)))}static build(e){return use(e)}}Fn.empty=new Fn(Cs.none,[],[],0);class Fk{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Fk(this.buffer,this.index)}}class Ko{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Cs.none}toString(){let e=[];for(let n=0;n0));u=a[u+3]);return o}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),a=0;for(let o=e,u=0;o=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Tm(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?o.length:-1;e!=h;e+=n){let f=o[e],m=u[e]+a.from;if(QL(s,r,m,m+f.length)){if(f instanceof Ko){if(i&Ir.ExcludeBuffers)continue;let g=f.findChild(0,f.buffer.length,n,r-m,s);if(g>-1)return new _a(new lse(a,f,e,m),null,g)}else if(i&Ir.IncludeAnonymous||!f.type.isAnonymous||$k(f)){let g;if(!(i&Ir.IgnoreMounts)&&(g=o1.get(f))&&!g.overlay)return new Vs(g.tree,m,e,a);let x=new Vs(f,m,e,a);return i&Ir.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(n<0?f.children.length-1:0,n,r,s)}}}if(i&Ir.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&Ir.IgnoreOverlays)&&(s=o1.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:a,to:o}of s.overlay)if((n>0?a<=i:a=i:o>i))return new Vs(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function v9(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let a=!1;!a;)if(a=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function P3(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class lse{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class _a extends HL{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new _a(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Ir.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new _a(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new _a(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new _a(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let a=r.buffer[this.index+1];e.push(r.slice(s,i,a)),n.push(0)}return new Fn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function VL(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||a.to=e){let o=new Vs(a.tree,a.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Tm(o,e,n,!1))}}return s?VL(s):r}class L3{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Vs)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof Vs?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Ir.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ir.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ir.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,a=e<0?-1:r._tree.children.length;i!=a;i+=e){let o=r._tree.children[i];if(this.mode&Ir.IncludeAnonymous||o instanceof Ko||!o.type.isAnonymous||$k(o))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let a=e;a;a=a._parent)if(a.index==s){if(s==this.index)return a;n=a,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return P3(this._tree,e,s);let a=r[n.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[s]&&e[s]!=a.name)return!1;s--}}return!0}}function $k(t){return t.children.some(e=>e instanceof Ko||!e.type.isAnonymous||$k(e))}function use(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=$L,reused:i=[],minRepeatType:a=r.types.length}=t,o=Array.isArray(n)?new Fk(n,n.length):n,u=r.types,h=0,f=0;function m(E,_,A,F,B,P){let{id:H,start:U,end:te,size:z}=o,W=f,q=h;if(z<0)if(o.next(),z==-1){let re=i[H];A.push(re),F.push(U-E);return}else if(z==-3){h=H;return}else if(z==-4){f=H;return}else throw new RangeError(`Unrecognized record size: ${z}`);let J=u[H],ee,Y,R=U-E;if(te-U<=s&&(Y=b(o.pos-_,B))){let re=new Uint16Array(Y.size-Y.skip),K=o.pos-Y.size,I=re.length;for(;o.pos>K;)I=k(Y.start,re,I);ee=new Ko(re,te-Y.start,r),R=Y.start-E}else{let re=o.pos-z;o.next();let K=[],I=[],Q=H>=a?H:-1,$=0,Z=te;for(;o.pos>re;)Q>=0&&o.id==Q&&o.size>=0?(o.end<=Z-s&&(y(K,I,U,$,o.end,Z,Q,W,q),$=K.length,Z=o.end),o.next()):P>2500?g(U,re,K,I):m(U,re,K,I,Q,P+1);if(Q>=0&&$>0&&$-1&&$>0){let ne=x(J,q);ee=Qk(J,K,I,0,K.length,0,te-U,ne,ne)}else ee=w(J,K,I,te-U,W-te,q)}A.push(ee),F.push(R)}function g(E,_,A,F){let B=[],P=0,H=-1;for(;o.pos>_;){let{id:U,start:te,end:z,size:W}=o;if(W>4)o.next();else{if(H>-1&&te=0;z-=3)U[W++]=B[z],U[W++]=B[z+1]-te,U[W++]=B[z+2]-te,U[W++]=W;A.push(new Ko(U,B[2]-te,r)),F.push(te-E)}}function x(E,_){return(A,F,B)=>{let P=0,H=A.length-1,U,te;if(H>=0&&(U=A[H])instanceof Fn){if(!H&&U.type==E&&U.length==B)return U;(te=U.prop(Ft.lookAhead))&&(P=F[H]+U.length+te)}return w(E,A,F,B,P,_)}}function y(E,_,A,F,B,P,H,U,te){let z=[],W=[];for(;E.length>F;)z.push(E.pop()),W.push(_.pop()+A-B);E.push(w(r.types[H],z,W,P-B,U-P,te)),_.push(B-A)}function w(E,_,A,F,B,P,H){if(P){let U=[Ft.contextHash,P];H=H?[U].concat(H):[U]}if(B>25){let U=[Ft.lookAhead,B];H=H?[U].concat(H):[U]}return new Fn(E,_,A,F,H)}function b(E,_){let A=o.fork(),F=0,B=0,P=0,H=A.end-s,U={size:0,start:0,skip:0};e:for(let te=A.pos-E;A.pos>te;){let z=A.size;if(A.id==_&&z>=0){U.size=F,U.start=B,U.skip=P,P+=4,F+=4,A.next();continue}let W=A.pos-z;if(z<0||W=a?4:0,J=A.start;for(A.next();A.pos>W;){if(A.size<0)if(A.size==-3)q+=4;else break e;else A.id>=a&&(q+=4);A.next()}B=J,F+=z,P+=q}return(_<0||F==E)&&(U.size=F,U.start=B,U.skip=P),U.size>4?U:void 0}function k(E,_,A){let{id:F,start:B,end:P,size:H}=o;if(o.next(),H>=0&&F4){let te=o.pos-(H-4);for(;o.pos>te;)A=k(E,_,A)}_[--A]=U,_[--A]=P-E,_[--A]=B-E,_[--A]=F}else H==-3?h=F:H==-4&&(f=F);return A}let N=[],C=[];for(;o.pos>0;)m(t.start||0,t.bufferStart||0,N,C,-1,0);let T=(e=t.length)!==null&&e!==void 0?e:N.length?C[0]+N[0].length:0;return new Fn(u[t.topID],N.reverse(),C.reverse(),T)}const y9=new WeakMap;function Mx(t,e){if(!t.isAnonymous||e instanceof Ko||e.type!=t)return 1;let n=y9.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Fn)){n=1;break}n+=Mx(t,r)}y9.set(e,n)}return n}function Qk(t,e,n,r,s,i,a,o,u){let h=0;for(let y=r;y=f)break;_+=A}if(C==T+1){if(_>f){let A=y[T];x(A.children,A.positions,0,A.children.length,w[T]+N);continue}m.push(y[T])}else{let A=w[C-1]+y[C-1].length-E;m.push(Qk(t,y,w,T,C,E,A,null,u))}g.push(E+N-i)}}return x(e,n,r,s,0),(o||u)(m,g,a)}class dse{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof _a?this.setBuffer(e.context.buffer,e.index,n):e instanceof Vs&&this.map.set(e.tree,n)}get(e){return e instanceof _a?this.getBuffer(e.context.buffer,e.index):e instanceof Vs?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class tu{constructor(e,n,r,s,i=!1,a=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new tu(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,a=e.length?e[0]:null;for(let o=0,u=0,h=0;;o++){let f=o=r)for(;a&&a.from=g.from||m<=g.to||h){let x=Math.max(g.from,u)-h,y=Math.min(g.to,m)-h;g=x>=y?null:new tu(x,y,g.tree,g.offset+h,o>0,!!f)}if(g&&s.push(g),a.to>m)break;a=inew z2(s.from,s.to)):[new z2(0,0)]:[new z2(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}};class hse{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Ft({perNode:!0});let fse=0;class Ei{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=fse++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Ei&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new Ei(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new c1(e);return r=>r.modified.indexOf(n)>-1?r:c1.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let mse=0;class c1{constructor(e){this.name=e,this.instances=[],this.id=mse++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(o=>o.base==e&&pse(n,o.modified));if(r)return r;let s=[],i=new Ei(e.name,s,e,n);for(let o of n)o.instances.push(i);let a=gse(n);for(let o of e.set)if(!o.modified.length)for(let u of a)s.push(c1.get(o,u));return i}}function pse(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function gse(t){let e=[[]];for(let n=0;nr.length-n.length)}function Vk(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],a=2,o=s;for(let m=0;;){if(o=="..."&&m>0&&m+3==s.length){a=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!g)throw new RangeError("Invalid path: "+s);if(i.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),m+=g[0].length,m==s.length)break;let x=s[m++];if(m==s.length&&x=="!"){a=0;break}if(x!="/")throw new RangeError("Invalid path: "+s);o=s.slice(m)}let u=i.length-1,h=i[u];if(!h)throw new RangeError("Invalid path: "+s);let f=new Em(r,a,u>0?i.slice(0,u):null);e[h]=f.sort(e[h])}}return UL.add(e)}const UL=new Ft({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Em(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Em{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let a=s;for(let o of i)for(let u of o.set){let h=n[u.id];if(h){a=a?a+" "+h:h;break}}return a},scope:r}}function xse(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function vse(t,e,n,r=0,s=t.length){let i=new yse(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class yse{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:a,from:o,to:u}=e;if(o>=r||u<=n)return;a.isTop&&(i=this.highlighters.filter(x=>!x.scope||x.scope(a)));let h=s,f=bse(e)||Em.empty,m=xse(i,f.tags);if(m&&(h&&(h+=" "),h+=m,f.mode==1&&(s+=(s?" ":"")+m)),this.startSpan(Math.max(n,o),h),f.opaque)return;let g=e.tree&&e.tree.prop(Ft.mounted);if(g&&g.overlay){let x=e.node.enter(g.overlay[0].from+o,1),y=this.highlighters.filter(b=>!b.scope||b.scope(g.tree.type)),w=e.firstChild();for(let b=0,k=o;;b++){let N=b=C||!e.nextSibling())););if(!N||C>r)break;k=N.to+o,k>n&&(this.highlightRange(x.cursor(),Math.max(n,N.from+o),Math.min(r,k),"",y),this.startSpan(Math.min(r,k),h))}w&&e.parent()}else if(e.firstChild()){g&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function bse(t){let e=t.type.prop(UL);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ve=Ei.define,Pg=Ve(),Po=Ve(),b9=Ve(Po),w9=Ve(Po),Lo=Ve(),Lg=Ve(Lo),P2=Ve(Lo),wa=Ve(),zc=Ve(wa),ya=Ve(),ba=Ve(),B3=Ve(),Af=Ve(B3),Bg=Ve(),xe={comment:Pg,lineComment:Ve(Pg),blockComment:Ve(Pg),docComment:Ve(Pg),name:Po,variableName:Ve(Po),typeName:b9,tagName:Ve(b9),propertyName:w9,attributeName:Ve(w9),className:Ve(Po),labelName:Ve(Po),namespace:Ve(Po),macroName:Ve(Po),literal:Lo,string:Lg,docString:Ve(Lg),character:Ve(Lg),attributeValue:Ve(Lg),number:P2,integer:Ve(P2),float:Ve(P2),bool:Ve(Lo),regexp:Ve(Lo),escape:Ve(Lo),color:Ve(Lo),url:Ve(Lo),keyword:ya,self:Ve(ya),null:Ve(ya),atom:Ve(ya),unit:Ve(ya),modifier:Ve(ya),operatorKeyword:Ve(ya),controlKeyword:Ve(ya),definitionKeyword:Ve(ya),moduleKeyword:Ve(ya),operator:ba,derefOperator:Ve(ba),arithmeticOperator:Ve(ba),logicOperator:Ve(ba),bitwiseOperator:Ve(ba),compareOperator:Ve(ba),updateOperator:Ve(ba),definitionOperator:Ve(ba),typeOperator:Ve(ba),controlOperator:Ve(ba),punctuation:B3,separator:Ve(B3),bracket:Af,angleBracket:Ve(Af),squareBracket:Ve(Af),paren:Ve(Af),brace:Ve(Af),content:wa,heading:zc,heading1:Ve(zc),heading2:Ve(zc),heading3:Ve(zc),heading4:Ve(zc),heading5:Ve(zc),heading6:Ve(zc),contentSeparator:Ve(wa),list:Ve(wa),quote:Ve(wa),emphasis:Ve(wa),strong:Ve(wa),link:Ve(wa),monospace:Ve(wa),strikethrough:Ve(wa),inserted:Ve(),deleted:Ve(),changed:Ve(),invalid:Ve(),meta:Bg,documentMeta:Ve(Bg),annotation:Ve(Bg),processingInstruction:Ve(Bg),definition:Ei.defineModifier("definition"),constant:Ei.defineModifier("constant"),function:Ei.defineModifier("function"),standard:Ei.defineModifier("standard"),local:Ei.defineModifier("local"),special:Ei.defineModifier("special")};for(let t in xe){let e=xe[t];e instanceof Ei&&(e.name=t)}WL([{tag:xe.link,class:"tok-link"},{tag:xe.heading,class:"tok-heading"},{tag:xe.emphasis,class:"tok-emphasis"},{tag:xe.strong,class:"tok-strong"},{tag:xe.keyword,class:"tok-keyword"},{tag:xe.atom,class:"tok-atom"},{tag:xe.bool,class:"tok-bool"},{tag:xe.url,class:"tok-url"},{tag:xe.labelName,class:"tok-labelName"},{tag:xe.inserted,class:"tok-inserted"},{tag:xe.deleted,class:"tok-deleted"},{tag:xe.literal,class:"tok-literal"},{tag:xe.string,class:"tok-string"},{tag:xe.number,class:"tok-number"},{tag:[xe.regexp,xe.escape,xe.special(xe.string)],class:"tok-string2"},{tag:xe.variableName,class:"tok-variableName"},{tag:xe.local(xe.variableName),class:"tok-variableName tok-local"},{tag:xe.definition(xe.variableName),class:"tok-variableName tok-definition"},{tag:xe.special(xe.variableName),class:"tok-variableName2"},{tag:xe.definition(xe.propertyName),class:"tok-propertyName tok-definition"},{tag:xe.typeName,class:"tok-typeName"},{tag:xe.namespace,class:"tok-namespace"},{tag:xe.className,class:"tok-className"},{tag:xe.macroName,class:"tok-macroName"},{tag:xe.propertyName,class:"tok-propertyName"},{tag:xe.operator,class:"tok-operator"},{tag:xe.comment,class:"tok-comment"},{tag:xe.meta,class:"tok-meta"},{tag:xe.invalid,class:"tok-invalid"},{tag:xe.punctuation,class:"tok-punctuation"}]);var L2;const Uc=new Ft;function GL(t){return Ye.define({combine:t?e=>e.concat(t):void 0})}const wse=new Ft;class Ai{constructor(e,n,r=[],s=""){this.data=e,this.name=s,tn.prototype.hasOwnProperty("tree")||Object.defineProperty(tn.prototype,"tree",{get(){return Ur(this)}}),this.parser=n,this.extension=[Jo.of(this),tn.languageData.of((i,a,o)=>{let u=S9(i,a,o),h=u.type.prop(Uc);if(!h)return[];let f=i.facet(h),m=u.type.prop(wse);if(m){let g=u.resolve(a-u.from,o);for(let x of m)if(x.test(g,i)){let y=i.facet(x.facet);return x.type=="replace"?y:y.concat(f)}}return f})].concat(r)}isActiveAt(e,n,r=-1){return S9(e,n,r).type.prop(Uc)==this.data}findRegions(e){let n=e.facet(Jo);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,a)=>{if(i.prop(Uc)==this.data){r.push({from:a,to:a+i.length});return}let o=i.prop(Ft.mounted);if(o){if(o.tree.prop(Uc)==this.data){if(o.overlay)for(let u of o.overlay)r.push({from:u.from+a,to:u.to+a});else r.push({from:a,to:a+i.length});return}else if(o.overlay){let u=r.length;if(s(o.tree,o.overlay[0].from+a),r.length>u)return}}for(let u=0;ur.isTop?n:void 0)]}),e.name)}configure(e,n){return new _m(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ur(t){let e=t.field(Ai.state,!1);return e?e.tree:Fn.empty}class Sse{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Rf=null;class ih{constructor(e,n,r=[],s,i,a,o,u){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=u,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new ih(e,n,[],Fn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Sse(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Fn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(tu.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Rf;Rf=this;try{return e()}finally{Rf=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=k9(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:a,skipped:o}=this;if(this.takeTree(),!e.empty){let u=[];if(e.iterChangedRanges((h,f,m,g)=>u.push({fromA:h,toA:f,fromB:m,toB:g})),r=tu.applyChanges(r,u),s=Fn.empty,i=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){o=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),m=e.mapPos(h.to,-1);fe.from&&(this.fragments=k9(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends Hk{createParse(n,r,s){let i=s[0].from,a=s[s.length-1].to;return{parsedPos:i,advance(){let u=Rf;if(u){for(let h of s)u.tempSkipped.push(h);e&&(u.scheduleOn=u.scheduleOn?Promise.all([u.scheduleOn,e]):e)}return this.parsedPos=a,new Fn(Cs.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Rf}}function k9(t,e,n){return tu.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class ah{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new ah(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=ih.create(e.facet(Jo).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new ah(r)}}Ai.state=Xr.define({create:ah.init,update(t,e){for(let n of e.effects)if(n.is(Ai.setState))return n.value;return e.startState.facet(Jo)!=e.state.facet(Jo)?ah.init(e.state):t.apply(e)}});let XL=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(XL=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const B2=typeof navigator<"u"&&(!((L2=navigator.scheduling)===null||L2===void 0)&&L2.isInputPending)?()=>navigator.scheduling.isInputPending():null,kse=wr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Ai.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Ai.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=XL(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,u=i.context.work(()=>B2&&B2()||Date.now()>a,s+(o?0:1e5));this.chunkBudget-=Date.now()-n,(u||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Ai.setState.of(new ah(i.context))})),this.chunkBudget>0&&!(u&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Fs(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Jo=Ye.define({combine(t){return t.length?t[0]:null},enables:t=>[Ai.state,kse,Ue.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class YL{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const Ose=Ye.define(),b0=Ye.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function uu(t){let e=t.facet(b0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Mm(t,e){let n="",r=t.tabSize,s=t.facet(b0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?jse(t,n,e):null}class mv{constructor(e,n={}){this.state=e,this.options=n,this.unit=uu(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=a-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Sh(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let a=i(s);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const pv=new Ft;function jse(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let a=s;a&&!(a.fromr.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)i.push(a);for(let a=i.length-1;a>=0;a--)r={node:i[a],next:r}}return ZL(r,t,n)}function ZL(t,e,n){for(let r=t;r;r=r.next){let s=Cse(r.node);if(s)return s(Wk.create(e,n,r))}return 0}function Nse(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Cse(t){let e=t.type.prop(pv);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Ft.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return a=>KL(a,!0,1,void 0,i&&!Nse(a)?s.from:void 0)}return t.parent==null?Tse:null}function Tse(){return 0}class Wk extends mv{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new Wk(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Ese(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return ZL(this.context.next,this.base,this.pos)}}function Ese(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function _se(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),a=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let o=n.to;;){let u=e.childAfter(o);if(!u||u==r)return null;if(!u.type.isSkipped){if(u.from>=a)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}o=u.to}}function I2({closing:t,align:e=!0,units:n=1}){return r=>KL(r,e,n,t)}function KL(t,e,n,r,s){let i=t.textAfter,a=i.match(/^\s*/)[0].length,o=r&&i.slice(a,a+r.length)==r||s==t.pos+a,u=e?_se(t):null;return u?o?t.column(u.from):t.column(u.to):t.baseIndent+(o?0:t.unit*n)}function O9({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const Mse=200;function Ase(){return tn.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+Mse)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:a}=t,o=-1,u=[];for(let{head:h}of a.selection.ranges){let f=a.doc.lineAt(h);if(f.from==o)continue;o=f.from;let m=Uk(a,f.from);if(m==null)continue;let g=/^\s*/.exec(f.text)[0],x=Mm(a,m);g!=x&&u.push({from:f.from,to:f.from+g.length,insert:x})}return u.length?[t,{changes:u,sequential:!0}]:t})}const Rse=Ye.define(),Gk=new Ft;function JL(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&o.from=e&&h.to>n&&(i=h)}}return i}function zse(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function u1(t,e,n){for(let r of t.facet(Rse)){let s=r(t,e,n);if(s)return s}return Dse(t,e,n)}function eB(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const gv=Nt.define({map:eB}),w0=Nt.define({map:eB});function tB(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const du=Xr.define({create(){return ot.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=j9(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(gv)&&!Pse(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(sB),s=r?ot.replace({widget:new Qse(r(e.state,n.value))}):N9;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(w0)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=j9(t,e.selection.main.head)),t},provide:t=>Ue.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function d1(t,e,n){var r;let s=null;return(r=t.field(du,!1))===null||r===void 0||r.between(e,n,(i,a)=>{(!s||s.from>i)&&(s={from:i,to:a})}),s}function Pse(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function nB(t,e){return t.field(du,!1)?e:e.concat(Nt.appendConfig.of(iB()))}const Lse=t=>{for(let e of tB(t)){let n=u1(t.state,e.from,e.to);if(n)return t.dispatch({effects:nB(t.state,[gv.of(n),rB(t,n)])}),!0}return!1},Bse=t=>{if(!t.state.field(du,!1))return!1;let e=[];for(let n of tB(t)){let r=d1(t.state,n.from,n.to);r&&e.push(w0.of(r),rB(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function rB(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return Ue.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const Ise=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(du,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(w0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},Fse=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Lse},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Bse},{key:"Ctrl-Alt-[",run:Ise},{key:"Ctrl-Alt-]",run:qse}],$se={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},sB=Ye.define({combine(t){return Fa(t,$se)}});function iB(t){return[du,Use]}function aB(t,e){let{state:n}=t,r=n.facet(sB),s=a=>{let o=t.lineBlockAt(t.posAtDOM(a.target)),u=d1(t.state,o.from,o.to);u&&t.dispatch({effects:w0.of(u)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const N9=ot.replace({widget:new class extends $a{toDOM(t){return aB(t,null)}}});class Qse extends $a{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return aB(e,this.value)}}const Hse={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class q2 extends Hl{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function Vse(t={}){let e={...Hse,...t},n=new q2(e,!0),r=new q2(e,!1),s=wr.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(Jo)!=a.state.facet(Jo)||a.startState.field(du,!1)!=a.state.field(du,!1)||Ur(a.startState)!=Ur(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let o=new $l;for(let u of a.viewportLineBlocks){let h=d1(a.state,u.from,u.to)?r:u1(a.state,u.from,u.to)?n:null;h&&o.add(u.from,u.from,h)}return o.finish()}}),{domEventHandlers:i}=e;return[s,Gre({class:"cm-foldGutter",markers(a){var o;return((o=a.plugin(s))===null||o===void 0?void 0:o.markers)||rn.empty},initialSpacer(){return new q2(e,!1)},domEventHandlers:{...i,click:(a,o,u)=>{if(i.click&&i.click(a,o,u))return!0;let h=d1(a.state,o.from,o.to);if(h)return a.dispatch({effects:w0.of(h)}),!0;let f=u1(a.state,o.from,o.to);return f?(a.dispatch({effects:gv.of(f)}),!0):!1}}}),iB()]}const Use=Ue.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class S0{constructor(e,n){this.specs=e;let r;function s(o){let u=Xo.newName();return(r||(r=Object.create(null)))["."+u]=o,u}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,a=n.scope;this.scope=a instanceof Ai?o=>o.prop(Uc)==a.data:a?o=>o==a:void 0,this.style=WL(e.map(o=>({tag:o.tag,class:o.class||s(Object.assign({},o,{tag:null}))})),{all:i}).style,this.module=r?new Xo(r):null,this.themeType=n.themeType}static define(e,n){return new S0(e,n||{})}}const I3=Ye.define(),lB=Ye.define({combine(t){return t.length?[t[0]]:null}});function F2(t){let e=t.facet(I3);return e.length?e:t.facet(lB)}function oB(t,e){let n=[Gse],r;return t instanceof S0&&(t.module&&n.push(Ue.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(lB.of(t)):r?n.push(I3.computeN([Ue.darkTheme],s=>s.facet(Ue.darkTheme)==(r=="dark")?[t]:[])):n.push(I3.of(t)),n}class Wse{constructor(e){this.markCache=Object.create(null),this.tree=Ur(e.state),this.decorations=this.buildDeco(e,F2(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Ur(e.state),r=F2(e.state),s=r!=F2(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return ot.none;let r=new $l;for(let{from:s,to:i}of e.visibleRanges)vse(this.tree,n,(a,o,u)=>{r.add(a,o,this.markCache[u]||(this.markCache[u]=ot.mark({class:u})))},s,i);return r.finish()}}const Gse=cc.high(wr.fromClass(Wse,{decorations:t=>t.decorations})),Xse=S0.define([{tag:xe.meta,color:"#404740"},{tag:xe.link,textDecoration:"underline"},{tag:xe.heading,textDecoration:"underline",fontWeight:"bold"},{tag:xe.emphasis,fontStyle:"italic"},{tag:xe.strong,fontWeight:"bold"},{tag:xe.strikethrough,textDecoration:"line-through"},{tag:xe.keyword,color:"#708"},{tag:[xe.atom,xe.bool,xe.url,xe.contentSeparator,xe.labelName],color:"#219"},{tag:[xe.literal,xe.inserted],color:"#164"},{tag:[xe.string,xe.deleted],color:"#a11"},{tag:[xe.regexp,xe.escape,xe.special(xe.string)],color:"#e40"},{tag:xe.definition(xe.variableName),color:"#00f"},{tag:xe.local(xe.variableName),color:"#30a"},{tag:[xe.typeName,xe.namespace],color:"#085"},{tag:xe.className,color:"#167"},{tag:[xe.special(xe.variableName),xe.macroName],color:"#256"},{tag:xe.definition(xe.propertyName),color:"#00c"},{tag:xe.comment,color:"#940"},{tag:xe.invalid,color:"#f00"}]),Yse=Ue.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),cB=1e4,uB="()[]{}",dB=Ye.define({combine(t){return Fa(t,{afterCursor:!0,brackets:uB,maxScanDistance:cB,renderMatch:Jse})}}),Zse=ot.mark({class:"cm-matchingBracket"}),Kse=ot.mark({class:"cm-nonmatchingBracket"});function Jse(t){let e=[],n=t.matched?Zse:Kse;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const eie=Xr.define({create(){return ot.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(dB);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=Ma(e.state,s.head,-1,r)||s.head>0&&Ma(e.state,s.head-1,1,r)||r.afterCursor&&(Ma(e.state,s.head,1,r)||s.headUe.decorations.from(t)}),tie=[eie,Yse];function nie(t={}){return[dB.of(t),tie]}const rie=new Ft;function q3(t,e,n){let r=t.prop(e<0?Ft.openedBy:Ft.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function F3(t){let e=t.type.prop(rie);return e?e(t.node):t}function Ma(t,e,n,r={}){let s=r.maxScanDistance||cB,i=r.brackets||uB,a=Ur(t),o=a.resolveInner(e,n);for(let u=o;u;u=u.parent){let h=q3(u.type,n,i);if(h&&u.from0?e>=f.from&&ef.from&&e<=f.to))return sie(t,e,n,u,f,h,i)}}return iie(t,e,n,a,o.type,s,i)}function sie(t,e,n,r,s,i,a){let o=r.parent,u={from:s.from,to:s.to},h=0,f=o?.cursor();if(f&&(n<0?f.childBefore(r.from):f.childAfter(r.to)))do if(n<0?f.to<=r.from:f.from>=r.to){if(h==0&&i.indexOf(f.type.name)>-1&&f.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},f=t.doc.iterRange(e,n>0?t.doc.length:0),m=0;for(let g=0;!f.next().done&&g<=i;){let x=f.value;n<0&&(g+=x.length);let y=e+g*n;for(let w=n>0?0:x.length-1,b=n>0?x.length:-1;w!=b;w+=n){let k=a.indexOf(x[w]);if(!(k<0||r.resolveInner(y+w,1).type!=s))if(k%2==0==n>0)m++;else{if(m==1)return{start:h,end:{from:y+w,to:y+w+1},matched:k>>1==u>>1};m--}}n>0&&(g+=x.length)}return f.done?{start:h,matched:!1}:null}function C9(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let a=r;a=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?a.toLowerCase():a,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function aie(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||lie,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||Zk,mergeTokens:t.mergeTokens!==!1}}function lie(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const T9=new WeakMap;class Xk extends Ai{constructor(e){let n=GL(e.languageData),r=aie(e),s,i=new class extends Hk{createParse(a,o,u){return new cie(s,a,o,u)}};super(n,i,[],e.name),this.topNode=hie(n,this),s=this,this.streamParser=r,this.stateAfter=new Ft({perNode:!0}),this.tokenTable=e.tokenTable?new gB(r.tokenTable):die}static define(e){return new Xk(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=T9.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let a=e.children.length-1;a>=0;a--){let o=e.children[a],u=n+e.positions[a],h=o instanceof Fn&&u=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let a=e.positions[i],o=e.children[i],u;if(an&&Yk(t,i.tree,0-i.offset,n,o),h;if(u&&u.pos<=r&&(h=fB(t,i.tree,n+i.offset,u.pos+i.offset,!1)))return{state:u.state,tree:h}}return{state:t.streamParser.startState(s?uu(s):4),tree:Fn.empty}}let cie=class{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=ih.get(),a=s[0].from,{state:o,tree:u}=oie(e,r,a,this.to,i?.state);this.state=o,this.parsedPos=this.chunkStart=a+u.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(uu(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=ih.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` `&&(n="");else{let r=n.indexOf(` `);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let a=this.ranges[s].from,o=this.lineAfter(a);n+=o,r=a+o.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let a=this.ranges[++this.rangeIndex].from;n+=a-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let o=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-o}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&a>=0&&this.chunk[a]==e&&this.chunk[a+2]==n?this.chunk[a+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,a=new hB(n,e?e.state.tabSize:4,e?uu(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let o=mB(i.token,a,this.state);if(o&&(s=this.emitToken(this.lang.tokenTable.resolve(o),this.parsedPos+a.start,this.parsedPos+a.pos,s)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Zk=Object.create(null),Am=[Cs.none],uie=new fv(Am),E9=[],_9=Object.create(null),pB=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])pB[t]=xB(Zk,e);class gB{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),pB)}resolve(e){return e?this.table[e]||(this.table[e]=xB(this.extra,e)):0}}const die=new gB(Zk);function $2(t,e){E9.indexOf(t)>-1||(E9.push(t),console.warn(e))}function xB(t,e){let n=[];for(let o of e.split(" ")){let u=[];for(let h of o.split(".")){let f=t[h]||xe[h];f?typeof f=="function"?u.length?u=u.map(f):$2(h,`Modifier ${h} used at start of tag`):u.length?$2(h,`Tag ${h} used as modifier`):u=Array.isArray(f)?f:[f]:$2(h,`Unknown highlighting tag ${h}`)}for(let h of u)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(o=>o.id),i=_9[s];if(i)return i.id;let a=_9[s]=Cs.define({id:Am.length,name:r,props:[Vk({[r]:n})]});return Am.push(a),a.id}function hie(t,e){let n=Cs.define({id:Am.length,name:"Document",props:[Uc.add(()=>t),pv.add(()=>r=>e.getIndent(r))],top:!0});return Am.push(n),n}Zn.RTL,Zn.LTR;const fie=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Jk(t.state,n.from);return r.line?mie(t):r.block?gie(t):!1};function Kk(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const mie=Kk(yie,0),pie=Kk(vB,0),gie=Kk((t,e)=>vB(t,e,vie(e)),0);function Jk(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Df=50;function xie(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-Df,r),a=t.sliceDoc(s,s+Df),o=/\s*$/.exec(i)[0].length,u=/^\s*/.exec(a)[0].length,h=i.length-o;if(i.slice(h-e.length,h)==e&&a.slice(u,u+n.length)==n)return{open:{pos:r-o,margin:o&&1},close:{pos:s+u,margin:u&&1}};let f,m;s-r<=2*Df?f=m=t.sliceDoc(r,s):(f=t.sliceDoc(r,r+Df),m=t.sliceDoc(s-Df,s));let g=/^\s*/.exec(f)[0].length,x=/\s*$/.exec(m)[0].length,y=m.length-x-n.length;return f.slice(g,g+e.length)==e&&m.slice(y,y+n.length)==n?{open:{pos:r+g+e.length,margin:/\s/.test(f.charAt(g+e.length))?1:0},close:{pos:s-x-n.length,margin:/\s/.test(m.charAt(y-1))?1:0}}:null}function vie(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function vB(t,e,n=e.selection.ranges){let r=n.map(i=>Jk(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,a)=>xie(e,r[a],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,a)=>s[a]?[]:[{from:i.from,insert:r[a].open+" "},{from:i.to,insert:" "+r[a].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let a=0,o;as&&(i==a||a>m.from)){s=m.from;let g=/^\s*/.exec(m.text)[0].length,x=g==m.length,y=m.text.slice(g,g+h.length)==h?g:-1;gi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:o,token:u,indent:h,empty:f,single:m}of r)(m||!f)&&i.push({from:o.from+h,insert:u+" "});let a=e.changes(i);return{changes:a,selection:e.selection.map(a,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:a,comment:o,token:u}of r)if(o>=0){let h=a.from+o,f=h+u.length;a.text[f-a.from]==" "&&f++,i.push({from:h,to:f})}return{changes:i}}return null}const $3=qa.define(),bie=qa.define(),wie=Ye.define(),yB=Ye.define({combine(t){return Fa(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),bB=Xr.define({create(){return Aa.empty},update(t,e){let n=e.state.facet(yB),r=e.annotation($3);if(r){let u=$s.fromTransaction(e,r.selection),h=r.side,f=h==0?t.undone:t.done;return u?f=h1(f,f.length,n.minDepth,u):f=kB(f,e.startState.selection),new Aa(h==0?r.rest:f,h==0?f:r.rest)}let s=e.annotation(bie);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(Er.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=$s.fromTransaction(e),a=e.annotation(Er.time),o=e.annotation(Er.userEvent);return i?t=t.addChanges(i,a,o,n,e):e.selection&&(t=t.addSelection(e.startState.selection,a,o,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Aa(t.done.map($s.fromJSON),t.undone.map($s.fromJSON))}});function Sie(t={}){return[bB,yB.of(t),Ue.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?wB:e.inputType=="historyRedo"?Q3:null;return r?(e.preventDefault(),r(n)):!1}})]}function xv(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(bB,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const wB=xv(0,!1),Q3=xv(1,!1),kie=xv(0,!0),Oie=xv(1,!0);class $s{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new $s(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new $s(e.changes&&Br.fromJSON(e.changes),[],e.mapped&&Pa.fromJSON(e.mapped),e.startSelection&&Me.fromJSON(e.startSelection),e.selectionsAfter.map(Me.fromJSON))}static fromTransaction(e,n){let r=Ri;for(let s of e.startState.facet(wie)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new $s(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Ri)}static selection(e){return new $s(void 0,Ri,void 0,void 0,e)}}function h1(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function jie(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,a,o)=>{for(let u=0;u=h&&a<=f&&(r=!0)}}),r}function Nie(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function SB(t,e){return t.length?e.length?t.concat(e):t:e}const Ri=[],Cie=200;function kB(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Cie));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),h1(t,t.length-1,1e9,n.setSelAfter(r)))}else return[$s.selection([e])]}function Tie(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Q2(t,e){if(!t.length)return t;let n=t.length,r=Ri;for(;n;){let s=Eie(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[$s.selection(r)]:Ri}function Eie(t,e,n){let r=SB(t.selectionsAfter.length?t.selectionsAfter.map(o=>o.map(e)):Ri,n);if(!t.changes)return $s.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(i):i;return new $s(s,Nt.mapEffects(t.effects,e),a,t.startSelection.map(i),r)}const _ie=/^(input\.type|delete)($|\.)/;class Aa{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new Aa(this.done,this.undone):this}addChanges(e,n,r,s,i){let a=this.done,o=a[a.length-1];return o&&o.changes&&!o.changes.empty&&e.changes&&(!r||_ie.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):vv(n,e))}function ps(t){return t.textDirectionAt(t.state.selection.main.head)==Zn.LTR}const jB=t=>OB(t,!ps(t)),NB=t=>OB(t,ps(t));function CB(t,e){return ua(t,n=>n.empty?t.moveByGroup(n,e):vv(n,e))}const Aie=t=>CB(t,!ps(t)),Rie=t=>CB(t,ps(t));function Die(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function yv(t,e,n){let r=Ur(t).resolveInner(e.head),s=n?Ft.closedBy:Ft.openedBy;for(let u=e.head;;){let h=n?r.childAfter(u):r.childBefore(u);if(!h)break;Die(t,h,s)?r=h:u=n?h.to:h.from}let i=r.type.prop(s),a,o;return i&&(a=n?Ma(t,r.from,1):Ma(t,r.to,-1))&&a.matched?o=n?a.end.to:a.end.from:o=n?r.to:r.from,Me.cursor(o,n?-1:1)}const zie=t=>ua(t,e=>yv(t.state,e,!ps(t))),Pie=t=>ua(t,e=>yv(t.state,e,ps(t)));function TB(t,e){return ua(t,n=>{if(!n.empty)return vv(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const EB=t=>TB(t,!1),_B=t=>TB(t,!0);function MB(t){let e=t.scrollDOM.clientHeighta.empty?t.moveVertically(a,e,n.height):vv(a,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let a=t.coordsAtPos(r.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),u=o.top+n.marginTop,h=o.bottom-n.marginBottom;a&&a.top>u&&a.bottomAB(t,!1),H3=t=>AB(t,!0);function uc(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Me.cursor(r.from+i))}return s}const Lie=t=>ua(t,e=>uc(t,e,!0)),Bie=t=>ua(t,e=>uc(t,e,!1)),Iie=t=>ua(t,e=>uc(t,e,!ps(t))),qie=t=>ua(t,e=>uc(t,e,ps(t))),Fie=t=>ua(t,e=>Me.cursor(t.lineBlockAt(e.head).from,1)),$ie=t=>ua(t,e=>Me.cursor(t.lineBlockAt(e.head).to,-1));function Qie(t,e,n){let r=!1,s=kh(t.selection,i=>{let a=Ma(t,i.head,-1)||Ma(t,i.head,1)||i.head>0&&Ma(t,i.head-1,1)||i.headQie(t,e);function Vi(t,e){let n=kh(t.state.selection,r=>{let s=e(r);return Me.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(ca(t.state,n)),!0)}function RB(t,e){return Vi(t,n=>t.moveByChar(n,e))}const DB=t=>RB(t,!ps(t)),zB=t=>RB(t,ps(t));function PB(t,e){return Vi(t,n=>t.moveByGroup(n,e))}const Vie=t=>PB(t,!ps(t)),Uie=t=>PB(t,ps(t)),Wie=t=>Vi(t,e=>yv(t.state,e,!ps(t))),Gie=t=>Vi(t,e=>yv(t.state,e,ps(t)));function LB(t,e){return Vi(t,n=>t.moveVertically(n,e))}const BB=t=>LB(t,!1),IB=t=>LB(t,!0);function qB(t,e){return Vi(t,n=>t.moveVertically(n,e,MB(t).height))}const A9=t=>qB(t,!1),R9=t=>qB(t,!0),Xie=t=>Vi(t,e=>uc(t,e,!0)),Yie=t=>Vi(t,e=>uc(t,e,!1)),Zie=t=>Vi(t,e=>uc(t,e,!ps(t))),Kie=t=>Vi(t,e=>uc(t,e,ps(t))),Jie=t=>Vi(t,e=>Me.cursor(t.lineBlockAt(e.head).from)),eae=t=>Vi(t,e=>Me.cursor(t.lineBlockAt(e.head).to)),D9=({state:t,dispatch:e})=>(e(ca(t,{anchor:0})),!0),z9=({state:t,dispatch:e})=>(e(ca(t,{anchor:t.doc.length})),!0),P9=({state:t,dispatch:e})=>(e(ca(t,{anchor:t.selection.main.anchor,head:0})),!0),L9=({state:t,dispatch:e})=>(e(ca(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),tae=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),nae=({state:t,dispatch:e})=>{let n=bv(t).map(({from:r,to:s})=>Me.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Me.create(n),userEvent:"select"})),!0},rae=({state:t,dispatch:e})=>{let n=kh(t.selection,r=>{let s=Ur(t),i=s.resolveStack(r.from,1);if(r.empty){let a=s.resolveStack(r.from,-1);a.node.from>=i.node.from&&a.node.to<=i.node.to&&(i=a)}for(let a=i;a;a=a.next){let{node:o}=a;if((o.from=r.to||o.to>r.to&&o.from<=r.from)&&a.next)return Me.range(o.to,o.from)}return r});return n.eq(t.selection)?!1:(e(ca(t,n)),!0)};function FB(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let a=n.doc.lineAt(i.head);if(e?a.to0)for(let o=i;;){let u=t.moveVertically(o,e);if(u.heada.to){s.some(h=>h.head==u.head)||s.push(u);break}else{if(u.head==o.head)break;o=u}}}return s.length==r.ranges.length?!1:(t.dispatch(ca(n,Me.create(s,s.length-1))),!0)}const sae=t=>FB(t,!1),iae=t=>FB(t,!0),aae=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Me.create([n.main]):n.main.empty||(r=Me.create([Me.cursor(n.main.head)])),r?(e(ca(t,r)),!0):!1};function k0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let u=e(i);ua&&(n="delete.forward",u=Ig(t,u,!0)),a=Math.min(a,u),o=Math.max(o,u)}else a=Ig(t,a,!1),o=Ig(t,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:Me.cursor(a,as(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const $B=(t,e,n)=>k0(t,r=>{let s=r.from,{state:i}=t,a=i.doc.lineAt(s),o,u;if(n&&!e&&s>a.from&&s$B(t,!1,!0),QB=t=>$B(t,!0,!1),HB=(t,e)=>k0(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),a=s.charCategorizer(r);for(let o=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let u=ss(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,u)-i.from,Math.max(r,u)-i.from),f=a(h);if(o!=null&&f!=o)break;(h!=" "||r!=n.head)&&(o=f),r=u}return r}),VB=t=>HB(t,!1),lae=t=>HB(t,!0),oae=t=>k0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headk0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),uae=t=>k0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:nn.of(["",""])},range:Me.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},hae=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),a=s==i.from?s-1:ss(i.text,s-i.from,!1)+i.from,o=s==i.to?s+1:ss(i.text,s-i.from,!0)+i.from;return{changes:{from:a,to:o,insert:t.doc.slice(s,o).append(t.doc.slice(a,s))},range:Me.cursor(o)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function bv(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let a=e[e.length-1];a.to=i.to,a.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function UB(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of bv(t)){if(n?i.to==t.doc.length:i.from==0)continue;let a=t.doc.lineAt(n?i.to+1:i.from-1),o=a.length+1;if(n){r.push({from:i.to,to:a.to},{from:i.from,insert:a.text+t.lineBreak});for(let u of i.ranges)s.push(Me.range(Math.min(t.doc.length,u.anchor+o),Math.min(t.doc.length,u.head+o)))}else{r.push({from:a.from,to:i.from},{from:i.to,insert:t.lineBreak+a.text});for(let u of i.ranges)s.push(Me.range(u.anchor-o,u.head-o))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Me.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const fae=({state:t,dispatch:e})=>UB(t,e,!1),mae=({state:t,dispatch:e})=>UB(t,e,!0);function WB(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of bv(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const pae=({state:t,dispatch:e})=>WB(t,e,!1),gae=({state:t,dispatch:e})=>WB(t,e,!0),xae=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(bv(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let a=t.lineBlockAt(s.head),o=t.coordsAtPos(s.head,s.assoc||1);o&&(i=a.bottom+t.documentTop-o.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function vae(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Ur(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Ft.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const B9=GB(!1),yae=GB(!0);function GB(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:a}=s,o=e.doc.lineAt(i),u=!t&&i==a&&vae(e,i);t&&(i=a=(a<=o.to?o:e.doc.lineAt(a)).to);let h=new mv(e,{simulateBreak:i,simulateDoubleBreak:!!u}),f=Uk(h,i);for(f==null&&(f=Sh(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));ao.from&&i{let s=[];for(let a=r.from;a<=r.to;){let o=t.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(e(o,s,r),n=o.number),a=o.to+1}let i=t.changes(s);return{changes:s,range:Me.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const bae=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new mv(t,{overrideIndentation:i=>{let a=n[i];return a??-1}}),s=e6(t,(i,a,o)=>{let u=Uk(r,i.from);if(u==null)return;/\S/.test(i.text)||(u=0);let h=/^\s*/.exec(i.text)[0],f=Mm(t,u);(h!=f||o.fromt.readOnly?!1:(e(t.update(e6(t,(n,r)=>{r.push({from:n.from,insert:t.facet(b0)})}),{userEvent:"input.indent"})),!0),YB=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(e6(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Sh(s,t.tabSize),a=0,o=Mm(t,Math.max(0,i-uu(t)));for(;a(t.setTabFocusMode(),!0),Sae=[{key:"Ctrl-b",run:jB,shift:DB,preventDefault:!0},{key:"Ctrl-f",run:NB,shift:zB},{key:"Ctrl-p",run:EB,shift:BB},{key:"Ctrl-n",run:_B,shift:IB},{key:"Ctrl-a",run:Fie,shift:Jie},{key:"Ctrl-e",run:$ie,shift:eae},{key:"Ctrl-d",run:QB},{key:"Ctrl-h",run:V3},{key:"Ctrl-k",run:oae},{key:"Ctrl-Alt-h",run:VB},{key:"Ctrl-o",run:dae},{key:"Ctrl-t",run:hae},{key:"Ctrl-v",run:H3}],kae=[{key:"ArrowLeft",run:jB,shift:DB,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Aie,shift:Vie,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Iie,shift:Zie,preventDefault:!0},{key:"ArrowRight",run:NB,shift:zB,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Rie,shift:Uie,preventDefault:!0},{mac:"Cmd-ArrowRight",run:qie,shift:Kie,preventDefault:!0},{key:"ArrowUp",run:EB,shift:BB,preventDefault:!0},{mac:"Cmd-ArrowUp",run:D9,shift:P9},{mac:"Ctrl-ArrowUp",run:M9,shift:A9},{key:"ArrowDown",run:_B,shift:IB,preventDefault:!0},{mac:"Cmd-ArrowDown",run:z9,shift:L9},{mac:"Ctrl-ArrowDown",run:H3,shift:R9},{key:"PageUp",run:M9,shift:A9},{key:"PageDown",run:H3,shift:R9},{key:"Home",run:Bie,shift:Yie,preventDefault:!0},{key:"Mod-Home",run:D9,shift:P9},{key:"End",run:Lie,shift:Xie,preventDefault:!0},{key:"Mod-End",run:z9,shift:L9},{key:"Enter",run:B9,shift:B9},{key:"Mod-a",run:tae},{key:"Backspace",run:V3,shift:V3,preventDefault:!0},{key:"Delete",run:QB,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:VB,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:lae,preventDefault:!0},{mac:"Mod-Backspace",run:cae,preventDefault:!0},{mac:"Mod-Delete",run:uae,preventDefault:!0}].concat(Sae.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Oae=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:zie,shift:Wie},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Pie,shift:Gie},{key:"Alt-ArrowUp",run:fae},{key:"Shift-Alt-ArrowUp",run:pae},{key:"Alt-ArrowDown",run:mae},{key:"Shift-Alt-ArrowDown",run:gae},{key:"Mod-Alt-ArrowUp",run:sae},{key:"Mod-Alt-ArrowDown",run:iae},{key:"Escape",run:aae},{key:"Mod-Enter",run:yae},{key:"Alt-l",mac:"Ctrl-l",run:nae},{key:"Mod-i",run:rae,preventDefault:!0},{key:"Mod-[",run:YB},{key:"Mod-]",run:XB},{key:"Mod-Alt-\\",run:bae},{key:"Shift-Mod-k",run:xae},{key:"Shift-Mod-\\",run:Hie},{key:"Mod-/",run:fie},{key:"Alt-A",run:pie},{key:"Ctrl-m",mac:"Shift-Alt-m",run:wae}].concat(kae),jae={key:"Tab",run:XB,shift:YB},I9=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class lh{constructor(e,n,r=0,s=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?o=>i(I9(o)):I9,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Is(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=Nk(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=ja(e);let s=this.normalize(n);if(s.length)for(let i=0,a=r;;i++){let o=s.charCodeAt(i),u=this.match(o,a,this.bufferPos+this.bufferStart);if(i==s.length-1){if(u)return this.value=u,this;break}a==r&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=f1(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let o=new Id(n,e.sliceString(n,r));return H2.set(e,o),o}if(s.from==n&&s.to==r)return s;let{text:i,from:a}=s;return a>n&&(i=e.sliceString(n,a)+i,a=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=f1(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Id.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(KB.prototype[Symbol.iterator]=JB.prototype[Symbol.iterator]=function(){return this});function Nae(t){try{return new RegExp(t,t6),!0}catch{return!1}}function f1(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function U3(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=In("input",{class:"cm-textfield",name:"line",value:e}),r=In("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:um.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},In("label",t.state.phrase("Go to line"),": ",n)," ",In("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),In("button",{name:"close",onclick:()=>{t.dispatch({effects:um.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:a}=t,o=a.doc.lineAt(a.selection.main.head),[,u,h,f,m]=i,g=f?+f.slice(1):0,x=h?+h:o.number;if(h&&m){let b=x/100;u&&(b=b*(u=="-"?-1:1)+o.number/a.doc.lines),x=Math.round(a.doc.lines*b)}else h&&u&&(x=x*(u=="-"?-1:1)+o.number);let y=a.doc.line(Math.max(1,Math.min(a.doc.lines,x))),w=Me.cursor(y.from+Math.max(0,Math.min(g,y.length)));t.dispatch({effects:[um.of(!1),Ue.scrollIntoView(w.from,{y:"center"})],selection:w}),t.focus()}return{dom:r}}const um=Nt.define(),q9=Xr.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(um)&&(t=n.value);return t},provide:t=>Cm.from(t,e=>e?U3:null)}),Cae=t=>{let e=Nm(t,U3);if(!e){let n=[um.of(!0)];t.state.field(q9,!1)==null&&n.push(Nt.appendConfig.of([q9,Tae])),t.dispatch({effects:n}),e=Nm(t,U3)}return e&&e.dom.querySelector("input").select(),!0},Tae=Ue.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Eae={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},_ae=Ye.define({combine(t){return Fa(t,Eae,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Mae(t){return[Pae,zae]}const Aae=ot.mark({class:"cm-selectionMatch"}),Rae=ot.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function F9(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Jn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Jn.Word)}function Dae(t,e,n,r){return t(e.sliceDoc(n,n+1))==Jn.Word&&t(e.sliceDoc(r-1,r))==Jn.Word}const zae=wr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(_ae),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ot.none;let s=r.main,i,a=null;if(s.empty){if(!e.highlightWordAroundCursor)return ot.none;let u=n.wordAt(s.head);if(!u)return ot.none;a=n.charCategorizer(s.head),i=n.sliceDoc(u.from,u.to)}else{let u=s.to-s.from;if(u200)return ot.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),a=n.charCategorizer(s.head),!(F9(a,n,s.from,s.to)&&Dae(a,n,s.from,s.to)))return ot.none}else if(i=n.sliceDoc(s.from,s.to),!i)return ot.none}let o=[];for(let u of t.visibleRanges){let h=new lh(n.doc,i,u.from,u.to);for(;!h.next().done;){let{from:f,to:m}=h.value;if((!a||F9(a,n,f,m))&&(s.empty&&f<=s.from&&m>=s.to?o.push(Rae.range(f,m)):(f>=s.to||m<=s.from)&&o.push(Aae.range(f,m)),o.length>e.maxMatches))return ot.none}}return ot.set(o)}},{decorations:t=>t.decorations}),Pae=Ue.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Lae=({state:t,dispatch:e})=>{let{selection:n}=t,r=Me.create(n.ranges.map(s=>t.wordAt(s.head)||Me.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Bae(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let a=!1,o=new lh(t.doc,e,r[r.length-1].to);;)if(o.next(),o.done){if(a)return null;o=new lh(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(u=>u.from==o.value.from))continue;if(i){let u=t.wordAt(o.value.from);if(!u||u.from!=o.value.from||u.to!=o.value.to)continue}return o.value}}const Iae=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return Lae({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=Bae(t,r);return s?(e(t.update({selection:t.selection.addRange(Me.range(s.from,s.to),!1),effects:Ue.scrollIntoView(s.to)})),!0):!1},Oh=Ye.define({combine(t){return Fa(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Zae(e),scrollToMatch:e=>Ue.scrollIntoView(e)})}});class eI{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Nae(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` `:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Qae(this):new Fae(this)}getCursor(e,n=0,r){let s=e.doc?e:tn.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?kd(this,s,n,r):Sd(this,s,n,r)}}class tI{constructor(e){this.spec=e}}function Sd(t,e,n,r){return new lh(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?qae(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function qae(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Sd(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function kd(t,e,n,r){return new KB(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?$ae(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function m1(t,e){return t.slice(ss(t,e,!1),e)}function p1(t,e){return t.slice(e,ss(t,e))}function $ae(t){return(e,n,r)=>!r[0].length||(t(m1(r.input,r.index))!=Jn.Word||t(p1(r.input,r.index))!=Jn.Word)&&(t(p1(r.input,r.index+r[0].length))!=Jn.Word||t(m1(r.input,r.index+r[0].length))!=Jn.Word)}class Qae extends tI{nextMatch(e,n,r){let s=kd(this.spec,e,r,e.doc.length).next();return s.done&&(s=kd(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),a=kd(this.spec,e,i,r),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==n||o.from>i+10))return o;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=kd(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const Rm=Nt.define(),n6=Nt.define(),Ho=Xr.define({create(t){return new V2(W3(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Rm)?t=new V2(n.value.create(),t.panel):n.is(n6)&&(t=new V2(t.query,n.value?r6:null));return t},provide:t=>Cm.from(t,e=>e.panel)});class V2{constructor(e,n){this.query=e,this.panel=n}}const Hae=ot.mark({class:"cm-searchMatch"}),Vae=ot.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Uae=wr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Ho))}update(t){let e=t.state.field(Ho);(e!=t.startState.field(Ho)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ot.none;let{view:n}=this,r=new $l;for(let s=0,i=n.visibleRanges,a=i.length;si[s+1].from-500;)u=i[++s].to;t.highlight(n.state,o,u,(h,f)=>{let m=n.state.selection.ranges.some(g=>g.from==h&&g.to==f);r.add(h,f,m?Vae:Hae)})}return r.finish()}},{decorations:t=>t.decorations});function O0(t){return e=>{let n=e.state.field(Ho,!1);return n&&n.query.spec.valid?t(e,n):sI(e)}}const g1=O0((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Me.single(r.from,r.to),i=t.state.facet(Oh);return t.dispatch({selection:s,effects:[s6(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),rI(t),!0}),x1=O0((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Me.single(s.from,s.to),a=t.state.facet(Oh);return t.dispatch({selection:i,effects:[s6(t,s),a.scrollToMatch(i.main,t)],userEvent:"select.search"}),rI(t),!0}),Wae=O0((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Me.create(n.map(r=>Me.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),Gae=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],a=0;for(let o=new lh(t.doc,t.sliceDoc(r,s));!o.next().done;){if(i.length>1e3)return!1;o.value.from==r&&(a=i.length),i.push(Me.range(o.value.from,o.value.to))}return e(t.update({selection:Me.create(i,a),userEvent:"select.search.matches"})),!0},$9=O0((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let a=i,o=[],u,h,f=[];a.from==r&&a.to==s&&(h=n.toText(e.getReplacement(a)),o.push({from:a.from,to:a.to,insert:h}),a=e.nextMatch(n,a.from,a.to),f.push(Ue.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let m=t.state.changes(o);return a&&(u=Me.single(a.from,a.to).map(m),f.push(s6(t,a)),f.push(n.facet(Oh).scrollToMatch(u.main,t))),t.dispatch({changes:m,selection:u,effects:f,userEvent:"input.replace"}),!0}),Xae=O0((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:a}=s;return{from:i,to:a,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:Ue.announce.of(r),userEvent:"input.replace.all"}),!0});function r6(t){return t.state.facet(Oh).createPanel(t)}function W3(t,e){var n,r,s,i,a;let o=t.selection.main,u=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!u)return e;let h=t.facet(Oh);return new eI({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:h.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:h.wholeWord})}function nI(t){let e=Nm(t,r6);return e&&e.dom.querySelector("[main-field]")}function rI(t){let e=nI(t);e&&e==t.root.activeElement&&e.select()}const sI=t=>{let e=t.state.field(Ho,!1);if(e&&e.panel){let n=nI(t);if(n&&n!=t.root.activeElement){let r=W3(t.state,e.query.spec);r.valid&&t.dispatch({effects:Rm.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[n6.of(!0),e?Rm.of(W3(t.state,e.query.spec)):Nt.appendConfig.of(Jae)]});return!0},iI=t=>{let e=t.state.field(Ho,!1);if(!e||!e.panel)return!1;let n=Nm(t,r6);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:n6.of(!1)}),!0},Yae=[{key:"Mod-f",run:sI,scope:"editor search-panel"},{key:"F3",run:g1,shift:x1,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:g1,shift:x1,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:iI,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Gae},{key:"Mod-Alt-g",run:Cae},{key:"Mod-d",run:Iae,preventDefault:!0}];class Zae{constructor(e){this.view=e;let n=this.query=e.state.field(Ho).query.spec;this.commit=this.commit.bind(this),this.searchField=In("input",{value:n.search,placeholder:si(e,"Find"),"aria-label":si(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=In("input",{value:n.replace,placeholder:si(e,"Replace"),"aria-label":si(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=In("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=In("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=In("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,a){return In("button",{class:"cm-button",name:s,onclick:i,type:"button"},a)}this.dom=In("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>g1(e),[si(e,"next")]),r("prev",()=>x1(e),[si(e,"previous")]),r("select",()=>Wae(e),[si(e,"all")]),In("label",null,[this.caseField,si(e,"match case")]),In("label",null,[this.reField,si(e,"regexp")]),In("label",null,[this.wordField,si(e,"by word")]),...e.state.readOnly?[]:[In("br"),this.replaceField,r("replace",()=>$9(e),[si(e,"replace")]),r("replaceAll",()=>Xae(e),[si(e,"replace all")])],In("button",{name:"close",onclick:()=>iI(e),"aria-label":si(e,"close"),type:"button"},["×"])])}commit(){let e=new eI({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Rm.of(e)}))}keydown(e){nre(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?x1:g1)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),$9(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Rm)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Oh).top}}function si(t,e){return t.state.phrase(e)}const qg=30,Fg=/[\s\.,:;?!]/;function s6(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-qg),a=Math.min(s,n+qg),o=t.state.sliceDoc(i,a);if(i!=r.from){for(let u=0;uo.length-qg;u--)if(!Fg.test(o[u-1])&&Fg.test(o[u])){o=o.slice(0,u);break}}return Ue.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${r.number}.`)}const Kae=Ue.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Jae=[Ho,cc.low(Uae),Kae];class aI{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=Ur(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(oI(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function Q9(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function ele(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:ele(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function tle(t,e){return n=>{for(let r=Ur(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}let H9=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function nu(t){return t.selection.main.from}function oI(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const i6=qa.define();function nle(t,e,n,r){let{main:s}=t.selection,i=n-s.from,a=r-s.from;return{...t.changeByRange(o=>{if(o!=s&&n!=r&&t.sliceDoc(o.from+i,o.from+a)!=t.sliceDoc(n,r))return{range:o};let u=t.toText(e);return{changes:{from:o.from+i,to:r==s.from?o.to:o.from+a,insert:u},range:Me.cursor(o.from+i+u.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const V9=new WeakMap;function rle(t){if(!Array.isArray(t))return t;let e=V9.get(t);return e||V9.set(t,e=lI(t)),e}const v1=Nt.define(),Dm=Nt.define();class sle{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&E<=57||E>=97&&E<=122?2:E>=65&&E<=90?1:0:(_=Nk(E))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!N||A==1&&b||T==0&&A!=0)&&(n[m]==E||r[m]==E&&(g=!0)?a[m++]=N:a.length&&(k=!1)),T=A,N+=ja(E)}return m==u&&a[0]==0&&k?this.result(-100+(g?-200:0),a,e):x==u&&y==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):x==u?this.ret(-900-e.length,[y,w]):m==u?this.result(-100+(g?-200:0)+-700+(k?0:-1100),a,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let a of n){let o=a+(this.astral?ja(Is(r,a)):1);i&&s[i-1]==a?s[i-1]=o:(s[i++]=a,s[i++]=o)}return this.ret(e-r.length,s)}}class ile{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:ale,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>U9(e(r),n(r)),optionClass:(e,n)=>r=>U9(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function U9(t,e){return t?e?t+" "+e:t:e}function ale(t,e,n,r,s,i){let a=t.textDirection==Zn.RTL,o=a,u=!1,h="top",f,m,g=e.left-s.left,x=s.right-e.right,y=r.right-r.left,w=r.bottom-r.top;if(o&&g=w||N>e.top?f=n.bottom-e.top:(h="bottom",f=e.bottom-n.top)}let b=(e.bottom-e.top)/i.offsetHeight,k=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${f/b}px; max-width: ${m/k}px`,class:"cm-completionInfo-"+(u?a?"left-narrow":"right-narrow":o?"left":"right")}}function lle(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let a=document.createElement("span");a.className="cm-completionLabel";let o=n.displayLabel||n.label,u=0;for(let h=0;hu&&a.appendChild(document.createTextNode(o.slice(u,f)));let g=a.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(o.slice(f,m))),g.className="cm-completionMatchedText",u=m}return un.position-r.position).map(n=>n.render)}function U2(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class ole{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:u=>this.placeInfo(u),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:a}=s.open,o=e.state.facet(Vr);this.optionContent=lle(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=U2(i.length,a,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",u=>{let{options:h}=e.state.field(n).open;for(let f=u.target,m;f&&f!=this.dom;f=f.parentNode)if(f.nodeName=="LI"&&(m=/-(\d+)$/.exec(f.id))&&+m[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Vr).closeOnBlur&&u.relatedTarget!=e.contentDOM&&e.dispatch({effects:Dm.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:a,disabled:o}=r.open;(!s.open||s.open.options!=i)&&(this.range=U2(i.length,a,e.state.facet(Vr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),o!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=U2(n.options.length,n.selected,this.view.state.facet(Vr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let a=typeof i=="string"?document.createTextNode(i):i(s);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,s)}).catch(o=>Fs(this.view.state,o,"completion info")):(this.addInfoPane(a,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&ule(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let a=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{a.target==s&&a.preventDefault()});let i=null;for(let a=r.from;ar.from||r.from==0))if(i=g,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let x=s.appendChild(document.createElement("completion-section"));x.textContent=g}}const f=s.appendChild(document.createElement("li"));f.id=n+"-"+a,f.setAttribute("role","option");let m=this.optionClass(o);m&&(f.className=m);for(let g of this.optionContent){let x=g(o,this.view.state,this.view,u);x&&f.appendChild(x)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew ole(n,t,e)}function ule(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function W9(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function dle(t,e){let n=[],r=null,s=null,i=f=>{n.push(f);let{section:m}=f.completion;if(m){r||(r=[]);let g=typeof m=="string"?m:m.name;r.some(x=>x.name==g)||r.push(typeof m=="string"?{name:g}:m)}},a=e.facet(Vr);for(let f of t)if(f.hasResult()){let m=f.result.getMatch;if(f.result.filter===!1)for(let g of f.result.options)i(new H9(g,f.source,m?m(g):[],1e9-n.length));else{let g=e.sliceDoc(f.from,f.to),x,y=a.filterStrict?new ile(g):new sle(g);for(let w of f.result.options)if(x=y.match(w.label)){let b=w.displayLabel?m?m(w,x.matched):[]:x.matched,k=x.score+(w.boost||0);if(i(new H9(w,f.source,b,k)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:N}=w.section;s||(s=Object.create(null)),s[N]=Math.max(k,s[N]||-1e9)}}}}if(r){let f=Object.create(null),m=0,g=(x,y)=>(x.rank==="dynamic"&&y.rank==="dynamic"?s[y.name]-s[x.name]:0)||(typeof x.rank=="number"?x.rank:1e9)-(typeof y.rank=="number"?y.rank:1e9)||(x.nameg.score-m.score||h(m.completion,g.completion))){let m=f.completion;!u||u.label!=m.label||u.detail!=m.detail||u.type!=null&&m.type!=null&&u.type!=m.type||u.apply!=m.apply||u.boost!=m.boost?o.push(f):W9(f.completion)>W9(u)&&(o[o.length-1]=f),u=f.completion}return o}class Md{constructor(e,n,r,s,i,a){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=a}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Md(this.options,G9(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,a){if(s&&!a&&e.some(h=>h.isPending))return s.setDisabled();let o=dle(e,n);if(!o.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let u=n.facet(Vr).selectOnOpen?0:-1;if(s&&s.selected!=u&&s.selected!=-1){let h=s.options[s.selected].completion;for(let f=0;ff.hasResult()?Math.min(h,f.from):h,1e8),create:xle,above:i.aboveCursor},s?s.timestamp:Date.now(),u,!1)}map(e){return new Md(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Md(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class y1{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new y1(ple,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Vr),i=(r.override||n.languageDataAt("autocomplete",nu(n)).map(rle)).map(u=>(this.active.find(f=>f.source==u)||new Di(u,this.active.some(f=>f.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((u,h)=>u==this.active[h])&&(i=this.active);let a=this.open,o=e.effects.some(u=>u.is(a6));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||i.some(u=>u.hasResult()&&e.changes.touchesRange(u.from,u.to))||!hle(i,this.active)||o?a=Md.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(u=>u.isPending)&&(a=null),!a&&i.every(u=>!u.isPending)&&i.some(u=>u.hasResult())&&(i=i.map(u=>u.hasResult()?new Di(u.source,0):u));for(let u of e.effects)u.is(uI)&&(a=a&&a.setSelected(u.value,this.id));return i==this.active&&a==this.open?this:new y1(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?fle:mle}}function hle(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const ple=[];function cI(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(i6);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Di{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=cI(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new Di(s.source,0)),r&4&&s.state==0&&(s=new Di(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(v1))s=new Di(s.source,1,i.value);else if(i.is(Dm))s=new Di(s.source,0);else if(i.is(a6))for(let a of i.value)a.source==s.source&&(s=a);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(nu(e.state))}}class qd extends Di{constructor(e,n,r,s,i,a){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=a}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),o=nu(e.state);if(o>a||!s||n&2&&(nu(e.startState)==this.from||on.map(e))}}),uI=Nt.define(),qs=Xr.define({create(){return y1.start()},update(t,e){return t.update(e)},provide:t=>[qk.from(t,e=>e.tooltip),Ue.contentAttributes.from(t,e=>e.attrs)]});function l6(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(qs).active.find(s=>s.source==e.source);return r instanceof qd?(typeof n=="string"?t.dispatch({...nle(t.state,n,r.from,r.to),annotations:i6.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const xle=cle(qs,l6);function $g(t,e="option"){return n=>{let r=n.state.field(qs,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:a-1;return o<0?o=e=="page"?0:a-1:o>=a&&(o=e=="page"?a-1:0),n.dispatch({effects:uI.of(o)}),!0}}const vle=t=>{let e=t.state.field(qs,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(qs,!1)?(t.dispatch({effects:v1.of(!0)}),!0):!1,yle=t=>{let e=t.state.field(qs,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Dm.of(null)}),!0)};class ble{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const wle=50,Sle=1e3,kle=wr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(qs).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(qs),n=t.state.facet(Vr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(qs)==e)return;let r=t.transactions.some(i=>{let a=cI(i,n);return a&8||(i.selection||i.docChanged)&&!(a&3)});for(let i=0;iwle&&Date.now()-a.time>Sle){for(let o of a.context.abortListeners)try{o()}catch(u){Fs(this.view.state,u)}a.context.abortListeners=null,this.running.splice(i--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(a=>a.is(v1)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(a=>a.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(qs);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Vr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=nu(e),r=new aI(e,n,t.explicit,this.view),s=new ble(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Dm.of(null)}),Fs(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Vr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Vr),r=this.view.state.field(qs);for(let s=0;so.source==i.active.source);if(a&&a.isPending)if(i.done==null){let o=new Di(i.active.source,0);for(let u of i.updates)o=o.update(u,n);o.isPending||e.push(o)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:a6.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(qs,!1);if(e&&e.tooltip&&this.view.state.facet(Vr).closeOnBlur){let n=e.open&&BL(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Dm.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:v1.of(!1)}),20),this.composing=0}}}),Ole=typeof navigator=="object"&&/Win/.test(navigator.platform),jle=cc.highest(Ue.domEventHandlers({keydown(t,e){let n=e.state.field(qs,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Ole&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(a=>a.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&l6(e,r),!1}})),dI=Ue.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Nle{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class o6{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,rs.TrackDel),r=e.mapPos(this.to,1,rs.TrackDel);return n==null||r==null?null:new o6(this.field,n,r)}}class c6{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),a=/^\s*/.exec(i.text)[0];for(let u of this.lines){if(r.length){let h=a,f=/^\t*/.exec(u)[0].length;for(let m=0;mnew o6(u.field,s[u.line]+u.from,s[u.line]+u.to));return{text:r,ranges:o}}static parse(e){let n=[],r=[],s=[],i;for(let a of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let o=i[1]?+i[1]:null,u=i[2]||i[3]||"",h=-1,f=u.replace(/\\[{}]/g,m=>m[1]);for(let m=0;m=h&&g.field++}for(let m of s)if(m.line==r.length&&m.from>i.index){let g=i[2]?3+(i[1]||"").length:2;m.from-=g,m.to-=g}s.push(new Nle(h,r.length,i.index,i.index+f.length)),a=a.slice(0,i.index)+u+a.slice(i.index+i[0].length)}a=a.replace(/\\([{}])/g,(o,u,h)=>{for(let f of s)f.line==r.length&&f.from>h&&(f.from--,f.to--);return u}),r.push(a)}return new c6(r,s)}}let Cle=ot.widget({widget:new class extends $a{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Tle=ot.mark({class:"cm-snippetField"});class jh{constructor(e,n){this.ranges=e,this.active=n,this.deco=ot.set(e.map(r=>(r.from==r.to?Cle:Tle).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new jh(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const j0=Nt.define({map(t,e){return t&&t.map(e)}}),Ele=Nt.define(),zm=Xr.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(j0))return n.value;if(n.is(Ele)&&t)return new jh(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ue.decorations.from(t,e=>e?e.deco:ot.none)});function u6(t,e){return Me.create(t.filter(n=>n.field==e).map(n=>Me.range(n.from,n.to)))}function _le(t){let e=c6.parse(t);return(n,r,s,i)=>{let{text:a,ranges:o}=e.instantiate(n.state,s),{main:u}=n.state.selection,h={changes:{from:s,to:i==u.from?u.to:i,insert:nn.of(a)},scrollIntoView:!0,annotations:r?[i6.of(r),Er.userEvent.of("input.complete")]:void 0};if(o.length&&(h.selection=u6(o,0)),o.some(f=>f.field>0)){let f=new jh(o,0),m=h.effects=[j0.of(f)];n.state.field(zm,!1)===void 0&&m.push(Nt.appendConfig.of([zm,zle,Ple,dI]))}n.dispatch(n.state.update(h))}}function hI(t){return({state:e,dispatch:n})=>{let r=e.field(zm,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(a=>a.field==s+t);return n(e.update({selection:u6(r.ranges,s),effects:j0.of(i?null:new jh(r.ranges,s)),scrollIntoView:!0})),!0}}const Mle=({state:t,dispatch:e})=>t.field(zm,!1)?(e(t.update({effects:j0.of(null)})),!0):!1,Ale=hI(1),Rle=hI(-1),Dle=[{key:"Tab",run:Ale,shift:Rle},{key:"Escape",run:Mle}],X9=Ye.define({combine(t){return t.length?t[0]:Dle}}),zle=cc.highest(v0.compute([X9],t=>t.facet(X9)));function yl(t,e){return{...e,apply:_le(t)}}const Ple=Ue.domEventHandlers({mousedown(t,e){let n=e.state.field(zm,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:u6(n.ranges,s.field),effects:j0.of(n.ranges.some(i=>i.field>s.field)?new jh(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Pm={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Wc=Nt.define({map(t,e){let n=e.mapPos(t,-1,rs.TrackAfter);return n??void 0}}),d6=new class extends au{};d6.startSide=1;d6.endSide=-1;const fI=Xr.define({create(){return rn.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Wc)&&(t=t.update({add:[d6.range(n.value,n.value+1)]}));return t}});function Lle(){return[Ile,fI]}const G2="()[]{}<>«»»«[]{}";function mI(t){for(let e=0;e{if((Ble?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&ja(Is(r,0))==1||e!=s.from||n!=s.to)return!1;let i=$le(t.state,r);return i?(t.dispatch(i),!0):!1}),qle=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=pI(t,t.selection.main.head).brackets||Pm.brackets,s=null,i=t.changeByRange(a=>{if(a.empty){let o=Qle(t.doc,a.head);for(let u of r)if(u==o&&wv(t.doc,a.head)==mI(Is(u,0)))return{changes:{from:a.head-u.length,to:a.head+u.length},range:Me.cursor(a.head-u.length)}}return{range:s=a}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Fle=[{key:"Backspace",run:qle}];function $le(t,e){let n=pI(t,t.selection.main.head),r=n.brackets||Pm.brackets;for(let s of r){let i=mI(Is(s,0));if(e==s)return i==s?Ule(t,s,r.indexOf(s+s+s)>-1,n):Hle(t,s,i,n.before||Pm.before);if(e==i&&gI(t,t.selection.main.from))return Vle(t,s,i)}return null}function gI(t,e){let n=!1;return t.field(fI).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function wv(t,e){let n=t.sliceString(e,e+2);return n.slice(0,ja(Is(n,0)))}function Qle(t,e){let n=t.sliceString(e-2,e);return ja(Is(n,0))==n.length?n:n.slice(1)}function Hle(t,e,n,r){let s=null,i=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:n,from:a.to}],effects:Wc.of(a.to+e.length),range:Me.range(a.anchor+e.length,a.head+e.length)};let o=wv(t.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:e+n,from:a.head},effects:Wc.of(a.head+e.length),range:Me.cursor(a.head+e.length)}:{range:s=a}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Vle(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&wv(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Me.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Ule(t,e,n,r){let s=r.stringPrefixes||Pm.stringPrefixes,i=null,a=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:e,from:o.to}],effects:Wc.of(o.to+e.length),range:Me.range(o.anchor+e.length,o.head+e.length)};let u=o.head,h=wv(t.doc,u),f;if(h==e){if(Y9(t,u))return{changes:{insert:e+e,from:u},effects:Wc.of(u+e.length),range:Me.cursor(u+e.length)};if(gI(t,u)){let g=n&&t.sliceDoc(u,u+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:u,to:u+g.length,insert:g},range:Me.cursor(u+g.length)}}}else{if(n&&t.sliceDoc(u-2*e.length,u)==e+e&&(f=Z9(t,u-2*e.length,s))>-1&&Y9(t,f))return{changes:{insert:e+e+e+e,from:u},effects:Wc.of(u+e.length),range:Me.cursor(u+e.length)};if(t.charCategorizer(u)(h)!=Jn.Word&&Z9(t,u,s)>-1&&!Wle(t,u,e,s))return{changes:{insert:e+e,from:u},effects:Wc.of(u+e.length),range:Me.cursor(u+e.length)}}return{range:i=o}});return i?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function Y9(t,e){let n=Ur(t).resolveInner(e+1);return n.parent&&n.from==e}function Wle(t,e,n,r){let s=Ur(t).resolveInner(e,-1),i=r.reduce((a,o)=>Math.max(a,o.length),0);for(let a=0;a<5;a++){let o=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),u=o.indexOf(n);if(!u||u>-1&&r.indexOf(o.slice(0,u))>-1){let f=s.firstChild;for(;f&&f.from==s.from&&f.to-f.from>n.length+u;){if(t.sliceDoc(f.to-n.length,f.to)==n)return!1;f=f.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function Z9(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Jn.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=Jn.Word)return i}return-1}function Gle(t={}){return[jle,qs,Vr.of(t),kle,Xle,dI]}const xI=[{key:"Ctrl-Space",run:W2},{mac:"Alt-`",run:W2},{mac:"Alt-i",run:W2},{key:"Escape",run:yle},{key:"ArrowDown",run:$g(!0)},{key:"ArrowUp",run:$g(!1)},{key:"PageDown",run:$g(!0,"page")},{key:"PageUp",run:$g(!1,"page")},{key:"Enter",run:vle}],Xle=cc.highest(v0.computeN([Vr],t=>t.facet(Vr).defaultKeymap?[xI]:[]));class K9{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Qc{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(Lm).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((x,y)=>x.from-y.from||x.to-y.to),a=new $l,o=[],u=0,h=r.doc.iter(),f=0,m=r.doc.length;for(let x=0;;){let y=x==i.length?null:i[x];if(!y&&!o.length)break;let w,b;if(o.length)w=u,b=o.reduce((C,T)=>Math.min(C,T.to),y&&y.from>w?y.from:1e8);else{if(w=y.from,w>m)break;b=y.to,o.push(y),x++}for(;xC.from||C.to==w))o.push(C),x++,b=Math.min(C.to,b);else{b=Math.min(C.from,b);break}}b=Math.min(b,m);let k=!1;if(o.some(C=>C.from==w&&(C.to==b||b==m))&&(k=w==b,!k&&b-w<10)){let C=w-(f+h.value.length);C>0&&(h.next(C),f=w);for(let T=w;;){if(T>=b){k=!0;break}if(!h.lineBreak&&f+h.value.length>T)break;T=f+h.value.length,f+=h.value.length,h.next()}}let N=ooe(o);if(k)a.add(w,w,ot.widget({widget:new soe(N),diagnostics:o.slice()}));else{let C=o.reduce((T,E)=>E.markClass?T+" "+E.markClass:T,"");a.add(w,b,ot.mark({class:"cm-lintRange cm-lintRange-"+N+C,diagnostics:o.slice(),inclusiveEnd:o.some(T=>T.to>b)}))}if(u=b,u==m)break;for(let C=0;C{if(!(e&&a.diagnostics.indexOf(e)<0))if(!r)r=new K9(s,i,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new K9(r.from,i,r.diagnostic)}}),r}function Yle(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(Lm).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is(vI))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function Zle(t,e){return t.field(di,!1)?e:e.concat(Nt.appendConfig.of(coe))}const vI=Nt.define(),h6=Nt.define(),yI=Nt.define(),di=Xr.define({create(){return new Qc(ot.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=oh(n,t.selected.diagnostic,i)||oh(n,null,i)}!n.size&&s&&e.state.facet(Lm).autoPanel&&(s=null),t=new Qc(n,s,r)}for(let n of e.effects)if(n.is(vI)){let r=e.state.facet(Lm).autoPanel?n.value.length?Bm.open:null:t.panel;t=Qc.init(n.value,r,e.state)}else n.is(h6)?t=new Qc(t.diagnostics,n.value?Bm.open:null,t.selected):n.is(yI)&&(t=new Qc(t.diagnostics,t.panel,n.value));return t},provide:t=>[Cm.from(t,e=>e.panel),Ue.decorations.from(t,e=>e.diagnostics)]}),Kle=ot.mark({class:"cm-lintRange cm-lintRange-active"});function Jle(t,e,n){let{diagnostics:r}=t.state.field(di),s,i=-1,a=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(u,h,{spec:f})=>{if(e>=u&&e<=h&&(u==h||(e>u||n>0)&&(ewI(t,n,!1)))}const toe=t=>{let e=t.state.field(di,!1);(!e||!e.panel)&&t.dispatch({effects:Zle(t.state,[h6.of(!0)])});let n=Nm(t,Bm.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},J9=t=>{let e=t.state.field(di,!1);return!e||!e.panel?!1:(t.dispatch({effects:h6.of(!1)}),!0)},noe=t=>{let e=t.state.field(di,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},roe=[{key:"Mod-Shift-m",run:toe,preventDefault:!0},{key:"F8",run:noe}],Lm=Ye.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Fa(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:eT,tooltipFilter:eT,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function eT(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function bI(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function wI(t,e,n){var r;let s=n?bI(e.actions):[];return In("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},In("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,a)=>{let o=!1,u=x=>{if(x.preventDefault(),o)return;o=!0;let y=oh(t.state.field(di).diagnostics,e);y&&i.apply(t,y.from,y.to)},{name:h}=i,f=s[a]?h.indexOf(s[a]):-1,m=f<0?h:[h.slice(0,f),In("u",h.slice(f,f+1)),h.slice(f+1)],g=i.markClass?" "+i.markClass:"";return In("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:u,onmousedown:u,"aria-label":` Action: ${h}${f<0?"":` (access key "${s[a]})"`}.`},m)}),e.source&&In("div",{class:"cm-diagnosticSource"},e.source))}class soe extends $a{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return In("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class tT{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=wI(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Bm{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)J9(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],a=bI(i.actions);for(let o=0;o{for(let i=0;iJ9(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(di).selected;if(!e)return-1;for(let n=0;n{for(let f of h.diagnostics){if(a.has(f))continue;a.add(f);let m=-1,g;for(let x=r;xr&&(this.items.splice(r,m-r),s=!0)),n&&g.diagnostic==n.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),i=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:u})=>{let h=u.height/this.list.offsetHeight;o.topu.bottom&&(this.list.scrollTop+=(o.bottom-u.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(di),r=oh(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:yI.of(r)})}static open(e){return new Bm(e)}}function ioe(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function Qg(t){return ioe(``,'width="6" height="3"')}const aoe=Ue.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Qg("#d11")},".cm-lintRange-warning":{backgroundImage:Qg("orange")},".cm-lintRange-info":{backgroundImage:Qg("#999")},".cm-lintRange-hint":{backgroundImage:Qg("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function loe(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function ooe(t){let e="hint",n=1;for(let r of t){let s=loe(r.severity);s>n&&(n=s,e=r.severity)}return e}const coe=[di,Ue.decorations.compute([di],t=>{let{selected:e,panel:n}=t.field(di);return!e||!n||e.from==e.to?ot.none:ot.set([Kle.range(e.from,e.to)])}),Hre(Jle,{hideOn:Yle}),aoe];var nT=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(Fle)),e.defaultKeymap!==!1&&(r=r.concat(Oae)),e.searchKeymap!==!1&&(r=r.concat(Yae)),e.historyKeymap!==!1&&(r=r.concat(Mie)),e.foldKeymap!==!1&&(r=r.concat(Fse)),e.completionKeymap!==!1&&(r=r.concat(xI)),e.lintKeymap!==!1&&(r=r.concat(roe));var s=[];return e.lineNumbers!==!1&&s.push(tse()),e.highlightActiveLineGutter!==!1&&s.push(sse()),e.highlightSpecialChars!==!1&&s.push(yre()),e.history!==!1&&s.push(Sie()),e.foldGutter!==!1&&s.push(Vse()),e.drawSelection!==!1&&s.push(ore()),e.dropCursor!==!1&&s.push(fre()),e.allowMultipleSelections!==!1&&s.push(tn.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(Ase()),e.syntaxHighlighting!==!1&&s.push(oB(Xse,{fallback:!0})),e.bracketMatching!==!1&&s.push(nie()),e.closeBrackets!==!1&&s.push(Lle()),e.autocompletion!==!1&&s.push(Gle()),e.rectangularSelection!==!1&&s.push(Rre()),n!==!1&&s.push(Pre()),e.highlightActiveLine!==!1&&s.push(jre()),e.highlightSelectionMatches!==!1&&s.push(Mae()),e.tabSize&&typeof e.tabSize=="number"&&s.push(b0.of(" ".repeat(e.tabSize))),s.concat([v0.of(r.flat())]).filter(Boolean)};const uoe="#e5c07b",rT="#e06c75",doe="#56b6c2",hoe="#ffffff",Ax="#abb2bf",G3="#7d8799",foe="#61afef",moe="#98c379",sT="#d19a66",poe="#c678dd",goe="#21252b",iT="#2c313a",aT="#282c34",X2="#353a42",xoe="#3E4451",lT="#528bff",voe=Ue.theme({"&":{color:Ax,backgroundColor:aT},".cm-content":{caretColor:lT},".cm-cursor, .cm-dropCursor":{borderLeftColor:lT},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:xoe},".cm-panels":{backgroundColor:goe,color:Ax},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:aT,color:G3,border:"none"},".cm-activeLineGutter":{backgroundColor:iT},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:X2},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:X2,borderBottomColor:X2},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:iT,color:Ax}}},{dark:!0}),yoe=S0.define([{tag:xe.keyword,color:poe},{tag:[xe.name,xe.deleted,xe.character,xe.propertyName,xe.macroName],color:rT},{tag:[xe.function(xe.variableName),xe.labelName],color:foe},{tag:[xe.color,xe.constant(xe.name),xe.standard(xe.name)],color:sT},{tag:[xe.definition(xe.name),xe.separator],color:Ax},{tag:[xe.typeName,xe.className,xe.number,xe.changed,xe.annotation,xe.modifier,xe.self,xe.namespace],color:uoe},{tag:[xe.operator,xe.operatorKeyword,xe.url,xe.escape,xe.regexp,xe.link,xe.special(xe.string)],color:doe},{tag:[xe.meta,xe.comment],color:G3},{tag:xe.strong,fontWeight:"bold"},{tag:xe.emphasis,fontStyle:"italic"},{tag:xe.strikethrough,textDecoration:"line-through"},{tag:xe.link,color:G3,textDecoration:"underline"},{tag:xe.heading,fontWeight:"bold",color:rT},{tag:[xe.atom,xe.bool,xe.special(xe.variableName)],color:sT},{tag:[xe.processingInstruction,xe.string,xe.inserted],color:moe},{tag:xe.invalid,color:hoe}]),SI=[voe,oB(yoe)];var boe=Ue.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),woe=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:a="",basicSetup:o=!0}=e,u=[];switch(n&&u.unshift(v0.of([jae])),o&&(typeof o=="boolean"?u.unshift(nT()):u.unshift(nT(o))),a&&u.unshift(Ere(a)),i){case"light":u.push(boe);break;case"dark":u.push(SI);break;case"none":break;default:u.push(i);break}return r===!1&&u.push(Ue.editable.of(!1)),s&&u.push(tn.readOnly.of(!0)),[...u]},Soe=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class koe{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class oT{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var Y2=null,Ooe=()=>typeof window>"u"?new oT:(Y2||(Y2=new oT),Y2),cT=qa.define(),joe=200,Noe=[];function Coe(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:a,extensions:o=Noe,autoFocus:u,theme:h="light",height:f=null,minHeight:m=null,maxHeight:g=null,width:x=null,minWidth:y=null,maxWidth:w=null,placeholder:b="",editable:k=!0,readOnly:N=!1,indentWithTab:C=!0,basicSetup:T=!0,root:E,initialState:_}=t,[A,F]=O.useState(),[B,P]=O.useState(),[H,U]=O.useState(),te=O.useState(()=>({current:null}))[0],z=O.useState(()=>({current:null}))[0],W=Ue.theme({"&":{height:f,minHeight:m,maxHeight:g,width:x,minWidth:y,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),q=Ue.updateListener.of(Y=>{if(Y.docChanged&&typeof r=="function"&&!Y.transactions.some(K=>K.annotation(cT))){te.current?te.current.reset():(te.current=new koe(()=>{if(z.current){var K=z.current;z.current=null,K()}te.current=null},joe),Ooe().add(te.current));var R=Y.state.doc,re=R.toString();r(re,Y)}s&&s(Soe(Y))}),J=woe({theme:h,editable:k,readOnly:N,placeholder:b,indentWithTab:C,basicSetup:T}),ee=[q,W,...J];return a&&typeof a=="function"&&ee.push(Ue.updateListener.of(a)),ee=ee.concat(o),O.useLayoutEffect(()=>{if(A&&!H){var Y={doc:e,selection:n,extensions:ee},R=_?tn.fromJSON(_.json,Y,_.fields):tn.create(Y);if(U(R),!B){var re=new Ue({state:R,parent:A,root:E});P(re),i&&i(re,R)}}return()=>{B&&(U(void 0),P(void 0))}},[A,H]),O.useEffect(()=>{t.container&&F(t.container)},[t.container]),O.useEffect(()=>()=>{B&&(B.destroy(),P(void 0)),te.current&&(te.current.cancel(),te.current=null)},[B]),O.useEffect(()=>{u&&B&&B.focus()},[u,B]),O.useEffect(()=>{B&&B.dispatch({effects:Nt.reconfigure.of(ee)})},[h,o,f,m,g,x,y,w,b,k,N,C,T,r,a]),O.useEffect(()=>{if(e!==void 0){var Y=B?B.state.doc.toString():"";if(B&&e!==Y){var R=te.current&&!te.current.isDone,re=()=>{B&&e!==B.state.doc.toString()&&B.dispatch({changes:{from:0,to:B.state.doc.toString().length,insert:e||""},annotations:[cT.of(!0)]})};R?z.current=re:re()}}},[e,B]),{state:H,setState:U,view:B,setView:P,container:A,setContainer:F}}var Toe=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],kI=O.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:a,onStatistics:o,onCreateEditor:u,onUpdate:h,autoFocus:f,theme:m="light",height:g,minHeight:x,maxHeight:y,width:w,minWidth:b,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:E,readOnly:_,root:A,initialState:F}=t,B=kG(t,Toe),P=O.useRef(null),{state:H,view:U,container:te,setContainer:z}=Coe({root:A,value:r,autoFocus:f,theme:m,height:g,minHeight:x,maxHeight:y,width:w,minWidth:b,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:E,readOnly:_,selection:s,onChange:a,onStatistics:o,onCreateEditor:u,onUpdate:h,extensions:i,initialState:F});O.useImperativeHandle(e,()=>({editor:P.current,state:H,view:U}),[P,te,H,U]);var W=O.useCallback(J=>{P.current=J,z(J)},[z]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var q=typeof m=="string"?"cm-theme-"+m:"cm-theme";return l.jsx("div",OG({ref:W,className:""+q+(n?" "+n:"")},B))});kI.displayName="CodeMirror";var uT={};class b1{constructor(e,n,r,s,i,a,o,u,h,f=0,m){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=u,this.curContext=h,this.lookAhead=f,this.parent=m}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new b1(e,[],n,r,r,0,[],0,s?new dT(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,a=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSizeu;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&a.buffer[o-4]==0&&a.buffer[o-1]>-1){if(n==r)return;if(a.buffer[o-2]>=n){a.buffer[o-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let o=!1;for(let u=a;u>0&&this.buffer[u-2]>r;u-=4)if(this.buffer[u-1]>=0){o=!0;break}if(o)for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,s>4&&(s-=4)}this.buffer[a]=e,this.buffer[a+1]=n,this.buffer[a+2]=r,this.buffer[a+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:a}=this.p;(s>this.pos||n<=a.maxNode)&&(this.pos=s,a.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=a.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new b1(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Eoe(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,a;iu&1&&o==a)||s.push(n[i],a)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;n=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,a=>{if(!(a&393216))if(a&65536){let o=(a>>19)-i;if(o>1){let u=a&65535,h=this.stack.length-o*3;if(h>=0&&e.getGoto(this.stack[h],u,!1)>=0)return o<<19|65536|u}}else{let o=r(a,i+1);if(o!=null)return o}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class dT{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Eoe{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class w1{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new w1(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new w1(this.stack,this.pos,this.index)}}function Hg(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&a--,a>=34&&a--;let u=a-32;if(u>=46&&(u-=46,o=!0),i+=u,o)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class Rx{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const hT=new Rx;class _oe{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=hT,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let a=this.ranges[++s];i+=a.from-r.to,r=a}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&ro.to&&(this.chunk2=this.chunk2.slice(0,o.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=hT,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class Fd{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Moe(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Fd.prototype.contextual=Fd.prototype.fallback=Fd.prototype.extend=!1;Fd.prototype.fallback=Fd.prototype.extend=!1;class Sv{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Moe(t,e,n,r,s,i){let a=0,o=1<0){let y=t[x];if(u.allows(y)&&(e.token.value==-1||e.token.value==y||Aoe(y,e.token.value,s,i))){e.acceptToken(y);break}}let f=e.next,m=0,g=t[a+2];if(e.next<0&&g>m&&t[h+g*3-3]==65535){a=t[h+g*3-1];continue e}for(;m>1,y=h+x+(x<<1),w=t[y],b=t[y+1]||65536;if(f=b)m=x+1;else{a=t[y+2],e.advance();continue e}}break}}function fT(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function Aoe(t,e,n,r){let s=fT(n,r,e);return s<0||fT(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class Roe{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?mT(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?mT(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(i instanceof Fn){if(a==e){if(a=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+i.length}}}class Doe{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Rx)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,a=s.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,u=0;for(let h=0;hm.end+25&&(u=Math.max(m.lookAhead,u)),m.value!=0)){let g=n;if(m.extended>-1&&(n=this.addActions(e,m.extended,m.end,n)),n=this.addActions(e,m.value,m.end,n),!f.extend&&(r=m,n>g))break}}for(;this.actions.length>n;)this.actions.pop();return u&&e.setLookAhead(u),!r&&e.pos==this.stream.end&&(r=new Rx,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Rx,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let a=0;a=0&&r.p.parser.dialect.allows(o>>1)){(o&1)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new Roe(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)r.push(o);else{if(this.advanceStack(o,r,e))continue;{s||(s=[],i=[]),s.push(o);let u=this.tokens.getMainToken(o);i.push(u.value,u.end)}}break}}if(!r.length){let a=s&&Boe(s);if(a)return ii&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw ii&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let a=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(a)return ii&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(r.length>a)for(r.sort((o,u)=>u.score-o.score);r.length>a;)r.pop();r.some(o=>o.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a500&&h.buffer.length>500)if((o.score-h.score||o.buffer.length-h.buffer.length)>0)r.splice(u--,1);else{r.splice(a--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let a=1;a ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,f=h?e.curContext.hash:0;for(let m=this.fragments.nodeAt(s);m;){let g=this.parser.nodeSet.types[m.type.id]==m.type?i.getGoto(e.state,m.type.id):-1;if(g>-1&&m.length&&(!h||(m.prop(Ft.contextHash)||0)==f))return e.useNode(m,g),ii&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(m.type.id)})`),!0;if(!(m instanceof Fn)||m.children.length==0||m.positions[0]>0)break;let x=m.children[0];if(x instanceof Fn&&m.positions[0]==0)m=x;else break}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),ii&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let u=this.tokens.getActions(e);for(let h=0;hs?n.push(y):r.push(y)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return pT(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let a=0;a ":"";if(o.deadEnd&&(i||(i=!0,o.restart(),ii&&console.log(f+this.stackID(o)+" (restarted)"),this.advanceFully(o,r))))continue;let m=o.split(),g=f;for(let x=0;x<10&&m.forceReduce()&&(ii&&console.log(g+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,r));x++)ii&&(g=this.stackID(m)+" -> ");for(let x of o.recoverByInsert(u))ii&&console.log(f+this.stackID(x)+" (via recover-insert)"),this.advanceFully(x,r);this.stream.end>o.pos?(h==o.pos&&(h++,u=0),o.recoverByDelete(u,h),ii&&console.log(f+this.stackID(o)+` (via recover-delete ${this.parser.getName(u)})`),pT(o,r)):(!s||s.scoret;class Loe{constructor(e){this.start=e.start,this.shift=e.shift||K2,this.reduce=e.reduce||K2,this.reuse=e.reuse||K2,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Im extends Hk{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let o=0;oe.topRules[o][1]),s=[];for(let o=0;o=0)i(f,u,o[h++]);else{let m=o[h+-f];for(let g=-f;g>0;g--)i(o[h++],u,m);h++}}}this.nodeSet=new fv(n.map((o,u)=>Cs.define({name:u>=this.minRepeatTerm?void 0:o,id:u,props:s[u],top:r.indexOf(u)>-1,error:u==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(u)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=$L;let a=Hg(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;otypeof o=="number"?new Fd(a,o):o),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new zoe(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let a=s[i++],o=a&1,u=s[i++];if(o&&r)return u;for(let h=i+(a>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Cl(this.data,i+2);else break;s=n(Cl(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Cl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,a)=>a&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(Im.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(o=>o.from==r.external);if(!i)return r;let a=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=gT(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let a=n.indexOf(i);a>=0&&(r[a]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const Ioe=1,OI=194,jI=195,qoe=196,xT=197,Foe=198,$oe=199,Qoe=200,Hoe=2,NI=3,vT=201,Voe=24,Uoe=25,Woe=49,Goe=50,Xoe=55,Yoe=56,Zoe=57,Koe=59,Joe=60,ece=61,tce=62,nce=63,rce=65,sce=238,ice=71,ace=241,lce=242,oce=243,cce=244,uce=245,dce=246,hce=247,fce=248,CI=72,mce=249,pce=250,gce=251,xce=252,vce=253,yce=254,bce=255,wce=256,Sce=73,kce=77,Oce=263,jce=112,Nce=130,Cce=151,Tce=152,Ece=155,hu=10,qm=13,f6=32,kv=9,m6=35,_ce=40,Mce=46,X3=123,yT=125,TI=39,EI=34,bT=92,Ace=111,Rce=120,Dce=78,zce=117,Pce=85,Lce=new Set([Uoe,Woe,Goe,Oce,rce,Nce,Yoe,Zoe,sce,tce,nce,CI,Sce,kce,Joe,ece,Cce,Tce,Ece,jce]);function J2(t){return t==hu||t==qm}function e4(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const Bce=new Sv((t,e)=>{let n;if(t.next<0)t.acceptToken($oe);else if(e.context.flags&Dx)J2(t.next)&&t.acceptToken(Foe,1);else if(((n=t.peek(-1))<0||J2(n))&&e.canShift(xT)){let r=0;for(;t.next==f6||t.next==kv;)t.advance(),r++;(t.next==hu||t.next==qm||t.next==m6)&&t.acceptToken(xT,-r)}else J2(t.next)&&t.acceptToken(qoe,1)},{contextual:!0}),Ice=new Sv((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==hu||r==qm){let s=0,i=0;for(;;){if(t.next==f6)s++;else if(t.next==kv)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=hu&&t.next!=qm&&t.next!=m6&&(s[t,e|_I])),$ce=new Loe({start:qce,reduce(t,e,n,r){return t.flags&Dx&&Lce.has(e)||(e==ice||e==CI)&&t.flags&_I?t.parent:t},shift(t,e,n,r){return e==OI?new zx(t,Fce(r.read(r.pos,n.pos)),0):e==jI?t.parent:e==Voe||e==Xoe||e==Koe||e==NI?new zx(t,0,Dx):wT.has(e)?new zx(t,0,wT.get(e)|t.flags&Dx):t},hash(t){return t.hash}}),Qce=new Sv(t=>{for(let e=0;e<5;e++){if(t.next!="print".charCodeAt(e))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let e=0;;e++){let n=t.peek(e);if(!(n==f6||n==kv)){n!=_ce&&n!=Mce&&n!=hu&&n!=qm&&n!=m6&&t.acceptToken(Ioe);return}}}),Hce=new Sv((t,e)=>{let{flags:n}=e.context,r=n&kl?EI:TI,s=(n&Ol)>0,i=!(n&jl),a=(n&Nl)>0,o=t.pos;for(;!(t.next<0);)if(a&&t.next==X3)if(t.peek(1)==X3)t.advance(2);else{if(t.pos==o){t.acceptToken(NI,1);return}break}else if(i&&t.next==bT){if(t.pos==o){t.advance();let u=t.next;u>=0&&(t.advance(),Vce(t,u)),t.acceptToken(Hoe);return}break}else if(t.next==bT&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==o){t.acceptToken(vT,s?3:1);return}break}else if(t.next==hu){if(s)t.advance();else if(t.pos==o){t.acceptToken(vT);return}break}else t.advance();t.pos>o&&t.acceptToken(Qoe)});function Vce(t,e){if(e==Ace)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==Rce)for(let n=0;n<2&&e4(t.next);n++)t.advance();else if(e==zce)for(let n=0;n<4&&e4(t.next);n++)t.advance();else if(e==Pce)for(let n=0;n<8&&e4(t.next);n++)t.advance();else if(e==Dce&&t.next==X3){for(t.advance();t.next>=0&&t.next!=yT&&t.next!=TI&&t.next!=EI&&t.next!=hu;)t.advance();t.next==yT&&t.advance()}}const Uce=Vk({'async "*" "**" FormatConversion FormatSpec':xe.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":xe.controlKeyword,"in not and or is del":xe.operatorKeyword,"from def class global nonlocal lambda":xe.definitionKeyword,import:xe.moduleKeyword,"with as print":xe.keyword,Boolean:xe.bool,None:xe.null,VariableName:xe.variableName,"CallExpression/VariableName":xe.function(xe.variableName),"FunctionDefinition/VariableName":xe.function(xe.definition(xe.variableName)),"ClassDefinition/VariableName":xe.definition(xe.className),PropertyName:xe.propertyName,"CallExpression/MemberExpression/PropertyName":xe.function(xe.propertyName),Comment:xe.lineComment,Number:xe.number,String:xe.string,FormatString:xe.special(xe.string),Escape:xe.escape,UpdateOp:xe.updateOperator,"ArithOp!":xe.arithmeticOperator,BitOp:xe.bitwiseOperator,CompareOp:xe.compareOperator,AssignOp:xe.definitionOperator,Ellipsis:xe.punctuation,At:xe.meta,"( )":xe.paren,"[ ]":xe.squareBracket,"{ }":xe.brace,".":xe.derefOperator,", ;":xe.separator}),Wce={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Gce=Im.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[Qce,Ice,Bce,Hce,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Wce[t]||-1}],tokenPrec:7668}),ST=new dse,MI=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function Vg(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const Xce={FunctionDefinition:Vg("function"),ClassDefinition:Vg("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let a=s.getChild("import");a;a=a.nextSibling)a.name=="VariableName"&&((r=a.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(a,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:Vg("variable"),AsPattern:Vg("variable"),__proto__:null};function AI(t,e){let n=ST.get(e);if(n)return n;let r=[],s=!0;function i(a,o){let u=t.sliceString(a.from,a.to);r.push({label:u,type:o})}return e.cursor(Ir.IncludeAnonymous).iterate(a=>{if(a.name){let o=Xce[a.name];if(o&&o(a,i,s)||!s&&MI.has(a.name))return!1;s=!1}else if(a.to-a.from>8192){for(let o of AI(t,a.node))r.push(o);return!1}}),ST.set(e,r),r}const kT=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,RI=["String","FormatString","Comment","PropertyName"];function Yce(t){let e=Ur(t.state).resolveInner(t.pos,-1);if(RI.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&kT.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)MI.has(s.name)&&(r=r.concat(AI(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:kT}}const Zce=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),Kce=[yl("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),yl("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),yl("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),yl("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),yl(`if \${}: `,{label:"if",detail:"block",type:"keyword"}),yl("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),yl("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),yl("import ${module}",{label:"import",detail:"statement",type:"keyword"}),yl("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],Jce=tle(RI,lI(Zce.concat(Kce)));function t4(t){let{node:e,pos:n}=t,r=t.lineIndent(n,-1),s=null;for(;;){let i=e.childBefore(n);if(i)if(i.name=="Comment")n=i.from;else if(i.name=="Body"||i.name=="MatchBody")t.baseIndentFor(i)+t.unit<=r&&(s=i),e=i;else if(i.name=="MatchClause")e=i;else if(i.type.is("Statement"))e=i;else break;else break}return s}function n4(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const r4=_m.define({name:"python",parser:Gce.configure({props:[pv.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&t4(t)||t.node;return(e=n4(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=t4(t);return(e=n4(t,n||t.node))!==null&&e!==void 0?e:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":I2({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":I2({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":I2({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=t4(t);return(e=n&&n4(t,n))!==null&&e!==void 0?e:t.continue()}}),Gk.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":JL,Body:(t,e)=>({from:t.from+1,to:t.to-(t.to==e.doc.length?0:1)}),"String FormatString":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function eue(){return new YL(r4,[r4.data.of({autocomplete:Yce}),r4.data.of({autocomplete:Jce})])}const tue=Vk({String:xe.string,Number:xe.number,"True False":xe.bool,PropertyName:xe.propertyName,Null:xe.null,", :":xe.separator,"[ ]":xe.squareBracket,"{ }":xe.brace}),nue=Im.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[tue],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),rue=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=sue(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function sue(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const iue=_m.define({name:"json",parser:nue.configure({props:[pv.add({Object:O9({except:/^\s*\}/}),Array:O9({except:/^\s*\]/})}),Gk.add({"Object Array":JL})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function aue(){return new YL(iue)}const lue={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,e){let n;if(!e.inString&&(n=t.match(/^('''|"""|'|")/))&&(e.stringType=n[0],e.inString=!0),t.sol()&&!e.inString&&e.inArray===0&&(e.lhs=!0),e.inString){for(;e.inString;)if(t.match(e.stringType))e.inString=!1;else if(t.peek()==="\\")t.next(),t.next();else{if(t.eol())break;t.match(/^.[^\\\"\']*/)}return e.lhs?"property":"string"}else{if(e.inArray&&t.peek()==="]")return t.next(),e.inArray--,"bracket";if(e.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(e.lhs&&t.eatWhile(function(r){return r!="="&&r!=" "}))return"property";if(e.lhs&&t.peek()==="=")return t.next(),e.lhs=!1,null;if(!e.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!e.lhs&&(t.match("true")||t.match("false")))return"atom";if(!e.lhs&&t.peek()==="[")return e.inArray++,t.next(),"bracket";if(!e.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}},oue={python:[eue()],json:[aue(),rue()],toml:[Xk.define(lue)],text:[]};function cue({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:a,placeholder:o,theme:u="dark",className:h=""}){const[f,m]=O.useState(!1);if(O.useEffect(()=>{m(!0)},[]),!f)return l.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:a}});const g=[...oue[n]||[],Ue.lineWrapping];return r&&g.push(Ue.editable.of(!1)),l.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:l.jsx(kI,{value:t,height:s,minHeight:i,maxHeight:a,theme:u==="dark"?SI:void 0,extensions:g,onChange:e,placeholder:o,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function uue(){const[t,e]=O.useState(!0),[n,r]=O.useState(!1),[s,i]=O.useState(!1),[a,o]=O.useState(!1),[u,h]=O.useState(!1),[f,m]=O.useState(!1),[g,x]=O.useState("visual"),[y,w]=O.useState(""),[b,k]=O.useState(!1),{toast:N}=$r(),[C,T]=O.useState(null),[E,_]=O.useState(null),[A,F]=O.useState(null),[B,P]=O.useState(null),[H,U]=O.useState(null),[te,z]=O.useState(null),[W,q]=O.useState(null),[J,ee]=O.useState(null),[Y,R]=O.useState(null),[re,K]=O.useState(null),[I,Q]=O.useState(null),[$,Z]=O.useState(null),[ne,ge]=O.useState(null),[se,Te]=O.useState(null),[qe,ve]=O.useState(null),[Fe,Qe]=O.useState(null),[Ke,Tt]=O.useState(null),[st,He]=O.useState(null),St=O.useRef(null),bt=O.useRef(!0),nr=O.useRef({}),mn=O.useCallback(async()=>{try{const ue=await Kee();w(ue),k(!1)}catch(ue){N({variant:"destructive",title:"加载失败",description:ue instanceof Error?ue.message:"加载源代码失败"})}},[N]),Hn=O.useCallback(async()=>{try{e(!0);const ue=await hC();nr.current=ue,T(ue.bot),_(ue.personality);const Ce=ue.chat;Ce.talk_value_rules||(Ce.talk_value_rules=[]),F(Ce),P(ue.expression),U(ue.emoji),z(ue.memory),q(ue.tool),ee(ue.mood),R(ue.voice),K(ue.lpmm_knowledge),Q(ue.keyword_reaction),Z(ue.response_post_process),ge(ue.chinese_typo),Te(ue.response_splitter),ve(ue.log),Qe(ue.debug),Tt(ue.maim_message),He(ue.telemetry),o(!1),bt.current=!1,await mn()}catch(ue){console.error("加载配置失败:",ue),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[N,mn]);O.useEffect(()=>{Hn()},[Hn]);const $t=O.useCallback(async(ue,Ce)=>{if(!bt.current)try{i(!0),await ete(ue,Ce),o(!1)}catch(lt){console.error(`自动保存 ${ue} 失败:`,lt),o(!0)}finally{i(!1)}},[]),ht=O.useCallback((ue,Ce)=>{bt.current||(o(!0),St.current&&clearTimeout(St.current),St.current=setTimeout(()=>{$t(ue,Ce)},2e3))},[$t]);O.useEffect(()=>{C&&!bt.current&&ht("bot",C)},[C,ht]),O.useEffect(()=>{E&&!bt.current&&ht("personality",E)},[E,ht]),O.useEffect(()=>{A&&!bt.current&&ht("chat",A)},[A,ht]),O.useEffect(()=>{B&&!bt.current&&ht("expression",B)},[B,ht]),O.useEffect(()=>{H&&!bt.current&&ht("emoji",H)},[H,ht]),O.useEffect(()=>{te&&!bt.current&&ht("memory",te)},[te,ht]),O.useEffect(()=>{W&&!bt.current&&ht("tool",W)},[W,ht]),O.useEffect(()=>{J&&!bt.current&&ht("mood",J)},[J,ht]),O.useEffect(()=>{Y&&!bt.current&&ht("voice",Y)},[Y,ht]),O.useEffect(()=>{re&&!bt.current&&ht("lpmm_knowledge",re)},[re,ht]),O.useEffect(()=>{I&&!bt.current&&ht("keyword_reaction",I)},[I,ht]),O.useEffect(()=>{$&&!bt.current&&ht("response_post_process",$)},[$,ht]),O.useEffect(()=>{ne&&!bt.current&&ht("chinese_typo",ne)},[ne,ht]),O.useEffect(()=>{se&&!bt.current&&ht("response_splitter",se)},[se,ht]),O.useEffect(()=>{qe&&!bt.current&&ht("log",qe)},[qe,ht]),O.useEffect(()=>{Fe&&!bt.current&&ht("debug",Fe)},[Fe,ht]),O.useEffect(()=>{Ke&&!bt.current&&ht("maim_message",Ke)},[Ke,ht]),O.useEffect(()=>{st&&!bt.current&&ht("telemetry",st)},[st,ht]);const le=async()=>{try{r(!0),await Jee(y),o(!1),k(!1),N({title:"保存成功",description:"配置已保存"}),await Hn()}catch(ue){k(!0),N({variant:"destructive",title:"保存失败",description:ue instanceof Error?ue.message:"保存配置失败"})}finally{r(!1)}},Oe=async ue=>{if(a){N({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(x(ue),ue==="source")await mn();else try{const Ce=await hC();nr.current=Ce,T(Ce.bot),_(Ce.personality);const lt=Ce.chat;lt.talk_value_rules||(lt.talk_value_rules=[]),F(lt),P(Ce.expression),U(Ce.emoji),z(Ce.memory),q(Ce.tool),ee(Ce.mood),R(Ce.voice),K(Ce.lpmm_knowledge),Q(Ce.keyword_reaction),Z(Ce.response_post_process),ge(Ce.chinese_typo),Te(Ce.response_splitter),ve(Ce.log),Qe(Ce.debug),Tt(Ce.maim_message),He(Ce.telemetry),o(!1)}catch(Ce){console.error("加载配置失败:",Ce),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},Le=async()=>{try{r(!0),St.current&&clearTimeout(St.current);const ue={...nr.current,bot:C,personality:E,chat:A,expression:B,emoji:H,memory:te,tool:W,mood:J,voice:Y,lpmm_knowledge:re,keyword_reaction:I,response_post_process:$,chinese_typo:ne,response_splitter:se,log:qe,debug:Fe,maim_message:Ke,telemetry:st};await fC(ue),o(!1),N({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(ue){console.error("保存配置失败:",ue),N({title:"保存失败",description:ue.message,variant:"destructive"})}finally{r(!1)}},nt=async()=>{try{h(!0),Ok().catch(()=>{}),m(!0)}catch(ue){console.error("重启失败:",ue),m(!1),N({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},Ot=async()=>{try{r(!0),St.current&&clearTimeout(St.current);const ue={...nr.current,bot:C,personality:E,chat:A,expression:B,emoji:H,memory:te,tool:W,mood:J,voice:Y,lpmm_knowledge:re,keyword_reaction:I,response_post_process:$,chinese_typo:ne,response_splitter:se,log:qe,debug:Fe,maim_message:Ke,telemetry:st};await fC(ue),o(!1),N({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ce=>setTimeout(Ce,500)),await nt()}catch(ue){console.error("保存失败:",ue),N({title:"保存失败",description:ue.message,variant:"destructive"})}finally{r(!1)}},Vt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ln=()=>{m(!1),h(!1),N({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?l.jsx(yn,{className:"h-full",children:l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):l.jsx(yn,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[l.jsx(ql,{value:g,onValueChange:ue=>Oe(ue),className:"w-auto",children:l.jsxs(La,{className:"h-9",children:[l.jsxs(Zt,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[l.jsx(IX,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),l.jsxs(Zt,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[l.jsx(qX,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),l.jsxs(de,{onClick:g==="visual"?Le:le,disabled:n||s||!a||u,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[l.jsx(X1,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":a?"保存配置":"已保存"]}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsxs(de,{disabled:n||s||u,size:"sm",className:"flex-1 sm:flex-none",children:[l.jsx(ik,{className:"mr-2 h-4 w-4"}),u?"重启中...":a?"保存并重启":"重启麦麦"]})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认重启麦麦?"}),l.jsx(cn,{children:a?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:a?Ot:nt,children:a?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(Kd,{children:[l.jsx(Il,{className:"h-4 w-4"}),l.jsxs(Jd,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),g==="source"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs(Kd,{children:[l.jsx(Il,{className:"h-4 w-4"}),l.jsxs(Jd,{children:[l.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",b&&l.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),l.jsx(cue,{value:y,onChange:ue=>{w(ue),o(!0),b&&k(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),g==="visual"&&l.jsx(l.Fragment,{children:l.jsxs(ql,{defaultValue:"bot",className:"w-full",children:[l.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:l.jsxs(La,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[l.jsx(Zt,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),l.jsx(Zt,{value:"personality",className:"flex-shrink-0",children:"人格"}),l.jsx(Zt,{value:"chat",className:"flex-shrink-0",children:"聊天"}),l.jsx(Zt,{value:"expression",className:"flex-shrink-0",children:"表达"}),l.jsx(Zt,{value:"features",className:"flex-shrink-0",children:"功能"}),l.jsx(Zt,{value:"processing",className:"flex-shrink-0",children:"处理"}),l.jsx(Zt,{value:"mood",className:"flex-shrink-0",children:"情绪"}),l.jsx(Zt,{value:"voice",className:"flex-shrink-0",children:"语音"}),l.jsx(Zt,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),l.jsx(Zt,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),l.jsx(An,{value:"bot",className:"space-y-4",children:C&&l.jsx(due,{config:C,onChange:T})}),l.jsx(An,{value:"personality",className:"space-y-4",children:E&&l.jsx(hue,{config:E,onChange:_})}),l.jsx(An,{value:"chat",className:"space-y-4",children:A&&l.jsx(fue,{config:A,onChange:F})}),l.jsx(An,{value:"expression",className:"space-y-4",children:B&&l.jsx(mue,{config:B,onChange:P})}),l.jsx(An,{value:"features",className:"space-y-4",children:H&&te&&W&&l.jsx(pue,{emojiConfig:H,memoryConfig:te,toolConfig:W,onEmojiChange:U,onMemoryChange:z,onToolChange:q})}),l.jsx(An,{value:"processing",className:"space-y-4",children:I&&$&&ne&&se&&l.jsx(gue,{keywordReactionConfig:I,responsePostProcessConfig:$,chineseTypoConfig:ne,responseSplitterConfig:se,onKeywordReactionChange:Q,onResponsePostProcessChange:Z,onChineseTypoChange:ge,onResponseSplitterChange:Te})}),l.jsx(An,{value:"mood",className:"space-y-4",children:J&&l.jsx(xue,{config:J,onChange:ee})}),l.jsx(An,{value:"voice",className:"space-y-4",children:Y&&l.jsx(vue,{config:Y,onChange:R})}),l.jsx(An,{value:"lpmm",className:"space-y-4",children:re&&l.jsx(yue,{config:re,onChange:K})}),l.jsxs(An,{value:"other",className:"space-y-4",children:[qe&&l.jsx(bue,{config:qe,onChange:ve}),Fe&&l.jsx(wue,{config:Fe,onChange:Qe}),Ke&&l.jsx(Sue,{config:Ke,onChange:Tt}),st&&l.jsx(kue,{config:st,onChange:He})]})]})}),f&&l.jsx(jk,{onRestartComplete:Vt,onRestartFailed:Ln})]})})}function due({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=u=>{e({...t,platforms:t.platforms.filter((h,f)=>f!==u)})},s=(u,h)=>{const f=[...t.platforms];f[u]=h,e({...t,platforms:f})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},a=u=>{e({...t,alias_names:t.alias_names.filter((h,f)=>f!==u)})},o=(u,h)=>{const f=[...t.alias_names];f[u]=h,e({...t,alias_names:f})};return l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"platform",children:"平台"}),l.jsx(Re,{id:"platform",value:t.platform,onChange:u=>e({...t,platform:u.target.value}),placeholder:"qq"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"qq_account",children:"QQ账号"}),l.jsx(Re,{id:"qq_account",value:t.qq_account,onChange:u=>e({...t,qq_account:u.target.value}),placeholder:"123456789"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"nickname",children:"昵称"}),l.jsx(Re,{id:"nickname",value:t.nickname,onChange:u=>e({...t,nickname:u.target.value}),placeholder:"麦麦"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ce,{children:"其他平台账号"}),l.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(is,{className:"h-4 w-4 mr-1"}),"添加"]})]}),l.jsxs("div",{className:"space-y-2",children:[t.platforms.map((u,h)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Re,{value:u,onChange:f=>s(h,f.target.value),placeholder:"wx:114514"}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(Kt,{className:"h-4 w-4"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:['确定要删除平台账号 "',u||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ce,{children:"别名"}),l.jsxs(de,{onClick:i,size:"sm",variant:"outline",children:[l.jsx(is,{className:"h-4 w-4 mr-1"}),"添加"]})]}),l.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((u,h)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Re,{value:u,onChange:f=>o(h,f.target.value),placeholder:"小麦"}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(Kt,{className:"h-4 w-4"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:['确定要删除别名 "',u||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>a(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function hue({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((a,o)=>o!==i)})},s=(i,a)=>{const o=[...t.states];o[i]=a,e({...t,states:o})};return l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"personality",children:"人格特质"}),l.jsx(Rn,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"reply_style",children:"表达风格"}),l.jsx(Rn,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"interest",children:"兴趣"}),l.jsx(Rn,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"plan_style",children:"说话规则与行为风格"}),l.jsx(Rn,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"visual_style",children:"识图规则"}),l.jsx(Rn,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"private_plan_style",children:"私聊规则"}),l.jsx(Rn,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ce,{children:"状态列表(人格多样性)"}),l.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(is,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),l.jsx("div",{className:"space-y-2",children:t.states.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Rn,{value:i,onChange:o=>s(a,o.target.value),placeholder:"描述一个人格状态",rows:2}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(Kt,{className:"h-4 w-4"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsx(cn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>r(a),children:"删除"})]})]})]})]},a))})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"state_probability",children:"状态替换概率"}),l.jsx(Re,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function fue({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=o=>{e({...t,talk_value_rules:t.talk_value_rules.filter((u,h)=>h!==o)})},s=(o,u,h)=>{const f=[...t.talk_value_rules];f[o]={...f[o],[u]:h},e({...t,talk_value_rules:f})},i=({value:o,onChange:u})=>{const[h,f]=O.useState("00"),[m,g]=O.useState("00"),[x,y]=O.useState("23"),[w,b]=O.useState("59");O.useEffect(()=>{const N=o.split("-");if(N.length===2){const[C,T]=N,[E,_]=C.split(":"),[A,F]=T.split(":");E&&f(E.padStart(2,"0")),_&&g(_.padStart(2,"0")),A&&y(A.padStart(2,"0")),F&&b(F.padStart(2,"0"))}},[o]);const k=(N,C,T,E)=>{const _=`${N}:${C}-${T}:${E}`;u(_)};return l.jsxs(Wo,{children:[l.jsx(Go,{asChild:!0,children:l.jsxs(de,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[l.jsx(Yc,{className:"h-4 w-4 mr-2"}),o||"选择时间段"]})}),l.jsx(Fl,{className:"w-80",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[l.jsxs("div",{children:[l.jsx(ce,{className:"text-xs",children:"小时"}),l.jsxs(It,{value:h,onValueChange:N=>{f(N),k(N,m,x,w)},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsx(Lt,{children:Array.from({length:24},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"text-xs",children:"分钟"}),l.jsxs(It,{value:m,onValueChange:N=>{g(N),k(h,N,x,w)},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsx(Lt,{children:Array.from({length:60},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[l.jsxs("div",{children:[l.jsx(ce,{className:"text-xs",children:"小时"}),l.jsxs(It,{value:x,onValueChange:N=>{y(N),k(h,m,N,w)},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsx(Lt,{children:Array.from({length:24},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"text-xs",children:"分钟"}),l.jsxs(It,{value:w,onValueChange:N=>{b(N),k(h,m,x,N)},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsx(Lt,{children:Array.from({length:60},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]})]})})]})},a=({rule:o})=>{const u=`{ target = "${o.target}", time = "${o.time}", value = ${o.value.toFixed(1)} }`;return l.jsxs(Wo,{children:[l.jsx(Go,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(na,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(Fl,{className:"w-96",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:u}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),l.jsx(Re,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:o=>e({...t,talk_value:parseFloat(o.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),l.jsx(Re,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:t.mentioned_bot_reply,onChange:o=>e({...t,mentioned_bot_reply:parseFloat(o.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"max_context_size",children:"上下文长度"}),l.jsx(Re,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:o=>e({...t,max_context_size:parseInt(o.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"planner_smooth",children:"规划器平滑"}),l.jsx(Re,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:o=>e({...t,planner_smooth:parseFloat(o.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:o=>e({...t,enable_talk_value_rules:o})}),l.jsx(ce,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:o=>e({...t,include_planner_reasoning:o})}),l.jsx(ce,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&l.jsxs("div",{className:"border-t pt-6",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),l.jsxs(de,{onClick:n,size:"sm",children:[l.jsx(is,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?l.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((o,u)=>l.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",u+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(a,{rule:o}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{variant:"ghost",size:"sm",children:l.jsx(Kt,{className:"h-4 w-4 text-destructive"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:["确定要删除规则 #",u+1," 吗?此操作无法撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>r(u),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"配置类型"}),l.jsxs(It,{value:o.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(u,"target",""):s(u,"target","qq::group")},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"global",children:"全局配置"}),l.jsx(ze,{value:"specific",children:"详细配置"})]})]})]}),o.target!==""&&(()=>{const h=o.target.split(":"),f=h[0]||"qq",m=h[1]||"",g=h[2]||"group";return l.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"平台"}),l.jsxs(It,{value:f,onValueChange:x=>{s(u,"target",`${x}:${m}:${g}`)},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"qq",children:"QQ"}),l.jsx(ze,{value:"wx",children:"微信"})]})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"群 ID"}),l.jsx(Re,{value:m,onChange:x=>{s(u,"target",`${f}:${x.target.value}:${g}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"类型"}),l.jsxs(It,{value:g,onValueChange:x=>{s(u,"target",`${f}:${m}:${x}`)},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"group",children:"群组(group)"}),l.jsx(ze,{value:"private",children:"私聊(private)"})]})]})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",o.target||"(未设置)"]})]})})(),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"时间段 (Time)"}),l.jsx(i,{value:o.time,onChange:h=>s(u,"time",h)}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ce,{htmlFor:`rule-value-${u}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),l.jsx(Re,{id:`rule-value-${u}`,type:"number",step:"0.01",min:"0",max:"1",value:o.value,onChange:h=>{const f=parseFloat(h.target.value);isNaN(f)||s(u,"value",Math.max(0,Math.min(1,f)))},className:"w-20 h-8 text-xs"})]}),l.jsx(lv,{value:[o.value],onValueChange:h=>s(u,"value",h[0]),min:0,max:1,step:.01,className:"w-full"}),l.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[l.jsx("span",{children:"0 (完全沉默)"}),l.jsx("span",{children:"0.5"}),l.jsx("span",{children:"1.0 (正常)"})]})]})]})]},u))}):l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:l.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),l.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[l.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),l.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[l.jsxs("li",{children:["• ",l.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function mue({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=g=>{e({...t,learning_list:t.learning_list.filter((x,y)=>y!==g)})},s=(g,x,y)=>{const w=[...t.learning_list];w[g][x]=y,e({...t,learning_list:w})},i=({rule:g})=>{const x=`["${g[0]}", "${g[1]}", "${g[2]}", "${g[3]}"]`;return l.jsxs(Wo,{children:[l.jsx(Go,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(na,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(Fl,{className:"w-96",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:x}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},a=({member:g,groupIndex:x,memberIndex:y,availableChatIds:w})=>{const b=w.includes(g)||g==="*",[k,N]=O.useState(!b);return l.jsxs("div",{className:"flex gap-2",children:[l.jsx("div",{className:"flex-1 flex gap-2",children:k?l.jsxs(l.Fragment,{children:[l.jsx(Re,{value:g,onChange:C=>m(x,y,C.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),w.length>0&&l.jsx(de,{size:"sm",variant:"outline",onClick:()=>N(!1),title:"切换到下拉选择",children:"下拉"})]}):l.jsxs(l.Fragment,{children:[l.jsxs(It,{value:g,onValueChange:C=>m(x,y,C),children:[l.jsx(Pt,{className:"flex-1",children:l.jsx(qt,{placeholder:"选择聊天流"})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"*",children:"* (全局共享)"}),w.map((C,T)=>l.jsx(ze,{value:C,children:C},T))]})]}),l.jsx(de,{size:"sm",variant:"outline",onClick:()=>N(!0),title:"切换到手动输入",children:"输入"})]})}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(Kt,{className:"h-4 w-4"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:['确定要删除组成员 "',g||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>f(x,y),children:"删除"})]})]})]})]})},o=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},u=g=>{e({...t,expression_groups:t.expression_groups.filter((x,y)=>y!==g)})},h=g=>{const x=[...t.expression_groups];x[g]=[...x[g],""],e({...t,expression_groups:x})},f=(g,x)=>{const y=[...t.expression_groups];y[g]=y[g].filter((w,b)=>b!==x),e({...t,expression_groups:y})},m=(g,x,y)=>{const w=[...t.expression_groups];w[g][x]=y,e({...t,expression_groups:w})};return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),l.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(is,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),l.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((g,x)=>{const y=t.learning_list.some((T,E)=>E!==x&&T[0]===""),w=g[0]==="",b=g[0].split(":"),k=b[0]||"qq",N=b[1]||"",C=b[2]||"group";return l.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["规则 ",x+1," ",w&&"(全局配置)"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(i,{rule:g}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{size:"sm",variant:"ghost",children:l.jsx(Kt,{className:"h-4 w-4"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:["确定要删除学习规则 ",x+1," 吗?此操作无法撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>r(x),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"配置类型"}),l.jsxs(It,{value:w?"global":"specific",onValueChange:T=>{T==="global"?s(x,0,""):s(x,0,"qq::group")},disabled:y&&!w,children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"global",children:"全局配置"}),l.jsx(ze,{value:"specific",disabled:y&&!w,children:"详细配置"})]})]}),y&&!w&&l.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!w&&l.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"平台"}),l.jsxs(It,{value:k,onValueChange:T=>{s(x,0,`${T}:${N}:${C}`)},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"qq",children:"QQ"}),l.jsx(ze,{value:"wx",children:"微信"})]})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"群 ID"}),l.jsx(Re,{value:N,onChange:T=>{s(x,0,`${k}:${T.target.value}:${C}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"类型"}),l.jsxs(It,{value:C,onValueChange:T=>{s(x,0,`${k}:${N}:${T}`)},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"group",children:"群组(group)"}),l.jsx(ze,{value:"private",children:"私聊(private)"})]})]})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",g[0]||"(未设置)"]})]}),l.jsx("div",{className:"grid gap-2",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(ce,{className:"text-xs font-medium",children:"使用学到的表达"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),l.jsx(Dt,{checked:g[1]==="enable",onCheckedChange:T=>s(x,1,T?"enable":"disable")})]})}),l.jsx("div",{className:"grid gap-2",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(ce,{className:"text-xs font-medium",children:"学习表达"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),l.jsx(Dt,{checked:g[2]==="enable",onCheckedChange:T=>s(x,2,T?"enable":"disable")})]})}),l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ce,{className:"text-xs font-medium",children:"学习强度"}),l.jsx(Re,{type:"number",step:"0.1",min:"0",max:"5",value:g[3],onChange:T=>{const E=parseFloat(T.target.value);isNaN(E)||s(x,3,Math.max(0,Math.min(5,E)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),l.jsx(lv,{value:[parseFloat(g[3])||1],onValueChange:T=>s(x,3,T[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),l.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[l.jsx("span",{children:"0 (不学习)"}),l.jsx("span",{children:"2.5"}),l.jsx("span",{children:"5.0 (快速学习)"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},x)}),t.learning_list.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),l.jsxs(de,{onClick:o,size:"sm",variant:"outline",children:[l.jsx(is,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),l.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((g,x)=>{const y=t.learning_list.map(w=>w[0]).filter(w=>w!=="");return l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",x+1,g.length===1&&g[0]==="*"&&"(全局共享)"]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(de,{onClick:()=>h(x),size:"sm",variant:"outline",children:l.jsx(is,{className:"h-4 w-4"})}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{size:"sm",variant:"ghost",children:l.jsx(Kt,{className:"h-4 w-4"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:["确定要删除共享组 ",x+1," 吗?此操作无法撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>u(x),children:"删除"})]})]})]})]})]}),l.jsx("div",{className:"space-y-2",children:g.map((w,b)=>l.jsx(a,{member:w,groupIndex:x,memberIndex:b,availableChatIds:y},b))}),l.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},x)}),t.expression_groups.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function pue({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:a=>i({...n,enable_tool:a})}),l.jsx(ce,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),l.jsx(Re,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:a=>s({...e,max_agent_iterations:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"emoji_chance",children:"表情包激活概率"}),l.jsx(Re,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:a=>r({...t,emoji_chance:parseFloat(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"max_reg_num",children:"最大注册数量"}),l.jsx(Re,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:a=>r({...t,max_reg_num:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),l.jsx(Re,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:a=>r({...t,check_interval:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"do_replace",checked:t.do_replace,onCheckedChange:a=>r({...t,do_replace:a})}),l.jsx(ce,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:a=>r({...t,steal_emoji:a})}),l.jsx(ce,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),l.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:a=>r({...t,content_filtration:a})}),l.jsx(ce,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&l.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[l.jsx(ce,{htmlFor:"filtration_prompt",children:"过滤要求"}),l.jsx(Re,{id:"filtration_prompt",value:t.filtration_prompt,onChange:a=>r({...t,filtration_prompt:a.target.value}),placeholder:"符合公序良俗"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function gue({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:a,onResponseSplitterChange:o}){const u=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=T=>{s({...t,regex_rules:t.regex_rules.filter((E,_)=>_!==T)})},f=(T,E,_)=>{const A=[...t.regex_rules];E==="regex"&&typeof _=="string"?A[T]={...A[T],regex:[_]}:E==="reaction"&&typeof _=="string"&&(A[T]={...A[T],reaction:_}),s({...t,regex_rules:A})},m=({regex:T,reaction:E,onRegexChange:_,onReactionChange:A})=>{const[F,B]=O.useState(!1),[P,H]=O.useState(""),[U,te]=O.useState(null),[z,W]=O.useState(""),[q,J]=O.useState({}),[ee,Y]=O.useState(""),R=O.useRef(null),[re,K]=O.useState("build"),I=ne=>ne.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),Q=(ne,ge=0)=>{const se=R.current;if(!se)return;const Te=se.selectionStart||0,qe=se.selectionEnd||0,ve=T.substring(0,Te)+ne+T.substring(qe);_(ve),setTimeout(()=>{const Fe=Te+ne.length+ge;se.setSelectionRange(Fe,Fe),se.focus()},0)};O.useEffect(()=>{if(!T||!P){te(null),J({}),Y(E),W("");return}try{const ne=I(T),ge=new RegExp(ne,"g"),se=P.match(ge);te(se),W("");const qe=new RegExp(ne).exec(P);if(qe&&qe.groups){J(qe.groups);let ve=E;Object.entries(qe.groups).forEach(([Fe,Qe])=>{ve=ve.replace(new RegExp(`\\[${Fe}\\]`,"g"),Qe||"")}),Y(ve)}else J({}),Y(E)}catch(ne){W(ne.message),te(null),J({}),Y(E)}},[T,P,E]);const $=()=>{if(!P||!U||U.length===0)return l.jsx("span",{className:"text-muted-foreground",children:P||"请输入测试文本"});try{const ne=I(T),ge=new RegExp(ne,"g");let se=0;const Te=[];let qe;for(;(qe=ge.exec(P))!==null;)qe.index>se&&Te.push(l.jsx("span",{children:P.substring(se,qe.index)},`text-${se}`)),Te.push(l.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:qe[0]},`match-${qe.index}`)),se=qe.index+qe[0].length;return se)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return l.jsxs(Mr,{open:F,onOpenChange:B,children:[l.jsx(wk,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(Vx,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),l.jsxs(vr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[l.jsxs(yr,{children:[l.jsx(br,{children:"正则表达式编辑器"}),l.jsx(as,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),l.jsx(yn,{className:"max-h-[calc(90vh-120px)]",children:l.jsxs(ql,{value:re,onValueChange:ne=>K(ne),className:"w-full",children:[l.jsxs(La,{className:"grid w-full grid-cols-2",children:[l.jsx(Zt,{value:"build",children:"🔧 构建器"}),l.jsx(Zt,{value:"test",children:"🧪 测试器"})]}),l.jsxs(An,{value:"build",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{className:"text-sm font-medium",children:"正则表达式"}),l.jsx(Re,{ref:R,value:T,onChange:ne=>_(ne.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{className:"text-sm font-medium",children:"Reaction 内容"}),l.jsx(Rn,{value:E,onChange:ne=>A(ne.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),l.jsxs("div",{className:"space-y-4 border-t pt-4",children:[Z.map(ne=>l.jsxs("div",{className:"space-y-2",children:[l.jsx("h5",{className:"text-xs font-semibold text-primary",children:ne.category}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ne.items.map(ge=>l.jsx(de,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>Q(ge.pattern,ge.moveCursor||0),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsxs("div",{className:"flex items-center gap-2 w-full",children:[l.jsx("span",{className:"text-xs font-medium",children:ge.label}),l.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:ge.pattern})]}),l.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:ge.desc})]})},ge.label))})]},ne.category)),l.jsxs("div",{className:"space-y-2 border-t pt-4",children:[l.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("^(?P\\S{1,20})是这样的$"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),l.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),l.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("(?P.+?)(?:是|为什么|怎么)"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),l.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[l.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),l.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),l.jsxs("li",{children:["命名捕获组格式:",l.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),l.jsxs("li",{children:["在 reaction 中使用 ",l.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),l.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),l.jsxs(An,{value:"test",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{className:"text-sm font-medium",children:"当前正则表达式"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:T||"(未设置)"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),l.jsx(Rn,{id:"test-text",value:P,onChange:ne=>H(ne.target.value),placeholder:`在此输入要测试的文本... 例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),z&&l.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[l.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),l.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:z})]}),!z&&P&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"flex items-center gap-2",children:U&&U.length>0?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),l.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",U.length," 处)"]})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),l.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{className:"text-sm font-medium",children:"匹配高亮"}),l.jsx(yn,{className:"h-40 rounded-md bg-muted p-3",children:l.jsx("div",{className:"text-sm break-words",children:$()})})]}),Object.keys(q).length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{className:"text-sm font-medium",children:"命名捕获组"}),l.jsx(yn,{className:"h-32 rounded-md border p-3",children:l.jsx("div",{className:"space-y-2",children:Object.entries(q).map(([ne,ge])=>l.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[l.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",ne,"]"]}),l.jsx("span",{className:"text-muted-foreground",children:"="}),l.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:ge})]},ne))})})]}),Object.keys(q).length>0&&E&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{className:"text-sm font-medium",children:"Reaction 替换预览"}),l.jsx(yn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:l.jsx("div",{className:"text-sm break-words",children:ee})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),l.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[l.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),l.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),l.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),l.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),l.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},g=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},x=T=>{s({...t,keyword_rules:t.keyword_rules.filter((E,_)=>_!==T)})},y=(T,E,_)=>{const A=[...t.keyword_rules];typeof _=="string"&&(A[T]={...A[T],reaction:_}),s({...t,keyword_rules:A})},w=T=>{const E=[...t.keyword_rules];E[T]={...E[T],keywords:[...E[T].keywords||[],""]},s({...t,keyword_rules:E})},b=(T,E)=>{const _=[...t.keyword_rules];_[T]={..._[T],keywords:(_[T].keywords||[]).filter((A,F)=>F!==E)},s({...t,keyword_rules:_})},k=(T,E,_)=>{const A=[...t.keyword_rules],F=[...A[T].keywords||[]];F[E]=_,A[T]={...A[T],keywords:F},s({...t,keyword_rules:A})},N=({rule:T})=>{const E=`{ regex = [${(T.regex||[]).map(_=>`"${_}"`).join(", ")}], reaction = "${T.reaction}" }`;return l.jsxs(Wo,{children:[l.jsx(Go,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(na,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(Fl,{className:"w-[95vw] sm:w-[500px]",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx(yn,{className:"h-60 rounded-md bg-muted p-3",children:l.jsx("pre",{className:"font-mono text-xs break-all",children:E})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},C=({rule:T})=>{const E=`[[keyword_reaction.keyword_rules]] keywords = [${(T.keywords||[]).map(_=>`"${_}"`).join(", ")}] reaction = "${T.reaction}"`;return l.jsxs(Wo,{children:[l.jsx(Go,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(na,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(Fl,{className:"w-[95vw] sm:w-[500px]",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx(yn,{className:"h-60 rounded-md bg-muted p-3",children:l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:E})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),l.jsxs(de,{onClick:u,size:"sm",variant:"outline",children:[l.jsx(is,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),l.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((T,E)=>l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",E+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(m,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:_=>f(E,"regex",_),onReactionChange:_=>f(E,"reaction",_)}),l.jsx(N,{rule:T}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{size:"sm",variant:"ghost",children:l.jsx(Kt,{className:"h-4 w-4"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:["确定要删除正则规则 ",E+1," 吗?此操作无法撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>h(E),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),l.jsx(Re,{value:T.regex&&T.regex[0]||"",onChange:_=>f(E,"regex",_.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"反应内容"}),l.jsx(Rn,{value:T.reaction,onChange:_=>f(E,"reaction",_.target.value),placeholder:`触发后麦麦的反应... 可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},E)),t.regex_rules.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),l.jsxs("div",{className:"space-y-4 border-t pt-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),l.jsxs(de,{onClick:g,size:"sm",variant:"outline",children:[l.jsx(is,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),l.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((T,E)=>l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",E+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(C,{rule:T}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{size:"sm",variant:"ghost",children:l.jsx(Kt,{className:"h-4 w-4"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:["确定要删除关键词规则 ",E+1," 吗?此操作无法撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>x(E),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ce,{className:"text-xs font-medium",children:"关键词列表"}),l.jsxs(de,{onClick:()=>w(E),size:"sm",variant:"ghost",children:[l.jsx(is,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),l.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((_,A)=>l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Re,{value:_,onChange:F=>k(E,A,F.target.value),placeholder:"关键词",className:"flex-1"}),l.jsx(de,{onClick:()=>b(E,A),size:"sm",variant:"ghost",children:l.jsx(Kt,{className:"h-4 w-4"})})]},A)),(!T.keywords||T.keywords.length===0)&&l.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-xs font-medium",children:"反应内容"}),l.jsx(Rn,{value:T.reaction,onChange:_=>y(E,"reaction",_.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},E)),t.keyword_rules.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:T=>i({...e,enable_response_post_process:T})}),l.jsx(ce,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"border-t pt-6 space-y-4",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[l.jsx(Dt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:T=>a({...n,enable:T})}),l.jsx(ce,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&l.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),l.jsx(Re,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:T=>a({...n,error_rate:parseFloat(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),l.jsx(Re,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:T=>a({...n,min_freq:parseInt(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),l.jsx(Re,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:T=>a({...n,tone_error_rate:parseFloat(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),l.jsx(Re,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:T=>a({...n,word_replace_rate:parseFloat(T.target.value)})})]})]})]})}),l.jsx("div",{className:"border-t pt-6 space-y-4",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[l.jsx(Dt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:T=>o({...r,enable:T})}),l.jsx(ce,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&l.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),l.jsx(Re,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:T=>o({...r,max_length:parseInt(T.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),l.jsx(Re,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:T=>o({...r,max_sentence_num:parseInt(T.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:T=>o({...r,enable_kaomoji_protection:T})}),l.jsx(ce,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:T=>o({...r,enable_overflow_return_all:T})}),l.jsx(ce,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),l.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function xue({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),l.jsx(ce,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"情绪更新阈值"}),l.jsx(Re,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"情感特征"}),l.jsx(Rn,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function vue({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),l.jsx(ce,{className:"cursor-pointer",children:"启用语音识别"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function yue({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),l.jsx(ce,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"LPMM 模式"}),l.jsxs(It,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[l.jsx(Pt,{children:l.jsx(qt,{placeholder:"选择 LPMM 模式"})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"classic",children:"经典模式"}),l.jsx(ze,{value:"agent",children:"Agent 模式"})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"同义词搜索 TopK"}),l.jsx(Re,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"同义词阈值"}),l.jsx(Re,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"实体提取线程数"}),l.jsx(Re,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"嵌入向量维度"}),l.jsx(Re,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function bue({config:t,onChange:e}){const[n,r]=O.useState(""),[s,i]=O.useState("WARNING"),a=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},o=x=>{e({...t,suppress_libraries:t.suppress_libraries.filter(y=>y!==x)})},u=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=x=>{const y={...t.library_log_levels};delete y[x],e({...t,library_log_levels:y})},f=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],m=["FULL","compact","lite"],g=["none","title","full"];return l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"日期格式"}),l.jsx(Re,{value:t.date_style,onChange:x=>e({...t,date_style:x.target.value}),placeholder:"例如: m-d H:i:s"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"日志级别样式"}),l.jsxs(It,{value:t.log_level_style,onValueChange:x=>e({...t,log_level_style:x}),children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsx(Lt,{children:m.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"日志文本颜色"}),l.jsxs(It,{value:t.color_text,onValueChange:x=>e({...t,color_text:x}),children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsx(Lt,{children:g.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"全局日志级别"}),l.jsxs(It,{value:t.log_level,onValueChange:x=>e({...t,log_level:x}),children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsx(Lt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"控制台日志级别"}),l.jsxs(It,{value:t.console_log_level,onValueChange:x=>e({...t,console_log_level:x}),children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsx(Lt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"文件日志级别"}),l.jsxs(It,{value:t.file_log_level,onValueChange:x=>e({...t,file_log_level:x}),children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsx(Lt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]})]})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"mb-2 block",children:"完全屏蔽的库"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Re,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),a())}}),l.jsx(de,{onClick:a,size:"sm",className:"flex-shrink-0",children:l.jsx(is,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(x=>l.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[l.jsx("span",{className:"text-sm",children:x}),l.jsx(de,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>o(x),children:l.jsx(Kt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},x))})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"mb-2 block",children:"特定库的日志级别"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Re,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1"}),l.jsxs(It,{value:s,onValueChange:i,children:[l.jsx(Pt,{className:"w-32",children:l.jsx(qt,{})}),l.jsx(Lt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]}),l.jsx(de,{onClick:u,size:"sm",children:l.jsx(is,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([x,y])=>l.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[l.jsx("span",{className:"text-sm font-medium",children:x}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-muted-foreground",children:y}),l.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(x),children:l.jsx(Kt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},x))})]})]})}function wue({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ce,{children:"显示 Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),l.jsx(Dt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ce,{children:"显示回复器 Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),l.jsx(Dt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ce,{children:"显示回复器推理"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),l.jsx(Dt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ce,{children:"显示 Jargon Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),l.jsx(Dt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]})]})]})}function Sue({config:t,onChange:e}){const[n,r]=O.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=a=>{e({...t,auth_token:t.auth_token.filter((o,u)=>u!==a)})};return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ce,{children:"启用自定义服务器"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),l.jsx(Dt,{checked:t.use_custom,onCheckedChange:a=>e({...t,use_custom:a})})]}),t.use_custom&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"主机地址"}),l.jsx(Re,{value:t.host,onChange:a=>e({...t,host:a.target.value}),placeholder:"127.0.0.1"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"端口号"}),l.jsx(Re,{type:"number",value:t.port,onChange:a=>e({...t,port:parseInt(a.target.value)}),placeholder:"8090"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"连接模式"}),l.jsxs(It,{value:t.mode,onValueChange:a=>e({...t,mode:a}),children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"ws",children:"WebSocket (ws)"}),l.jsx(ze,{value:"tcp",children:"TCP"})]})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{checked:t.use_wss,onCheckedChange:a=>e({...t,use_wss:a}),disabled:t.mode!=="ws"}),l.jsx(ce,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"SSL 证书文件路径"}),l.jsx(Re,{value:t.cert_file,onChange:a=>e({...t,cert_file:a.target.value}),placeholder:"cert.pem"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"SSL 密钥文件路径"}),l.jsx(Re,{value:t.key_file,onChange:a=>e({...t,key_file:a.target.value}),placeholder:"key.pem"})]})]})]})]})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"mb-2 block",children:"认证令牌"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Re,{value:n,onChange:a=>r(a.target.value),placeholder:"输入认证令牌",onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),s())}}),l.jsx(de,{onClick:s,size:"sm",children:l.jsx(is,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"space-y-2",children:t.auth_token.map((a,o)=>l.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[l.jsx("span",{className:"text-sm font-mono",children:a}),l.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(o),children:l.jsx(Kt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},o))})]})]})}function kue({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(ce,{children:"启用统计信息发送"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),l.jsx(Dt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const bu=O.forwardRef(({className:t,...e},n)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:n,className:Se("w-full caption-bottom text-sm",t),...e})}));bu.displayName="Table";const wu=O.forwardRef(({className:t,...e},n)=>l.jsx("thead",{ref:n,className:Se("[&_tr]:border-b",t),...e}));wu.displayName="TableHeader";const Su=O.forwardRef(({className:t,...e},n)=>l.jsx("tbody",{ref:n,className:Se("[&_tr:last-child]:border-0",t),...e}));Su.displayName="TableBody";const Oue=O.forwardRef(({className:t,...e},n)=>l.jsx("tfoot",{ref:n,className:Se("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));Oue.displayName="TableFooter";const _r=O.forwardRef(({className:t,...e},n)=>l.jsx("tr",{ref:n,className:Se("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));_r.displayName="TableRow";const jt=O.forwardRef(({className:t,...e},n)=>l.jsx("th",{ref:n,className:Se("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));jt.displayName="TableHead";const gt=O.forwardRef(({className:t,...e},n)=>l.jsx("td",{ref:n,className:Se("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));gt.displayName="TableCell";const jue=O.forwardRef(({className:t,...e},n)=>l.jsx("caption",{ref:n,className:Se("mt-4 text-sm text-muted-foreground",t),...e}));jue.displayName="TableCaption";const ms=O.forwardRef(({className:t,...e},n)=>l.jsx(jR,{ref:n,className:Se("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:l.jsx(kX,{className:Se("grid place-content-center text-current"),children:l.jsx(Kc,{className:"h-4 w-4"})})}));ms.displayName=jR.displayName;function Nue(){const[t,e]=O.useState([]),[n,r]=O.useState(!0),[s,i]=O.useState(!1),[a,o]=O.useState(!1),[u,h]=O.useState(!1),[f,m]=O.useState(!1),[g,x]=O.useState(!1),[y,w]=O.useState(!1),[b,k]=O.useState(null),[N,C]=O.useState(null),[T,E]=O.useState(!1),[_,A]=O.useState(null),[F,B]=O.useState(!1),[P,H]=O.useState(""),[U,te]=O.useState(new Set),[z,W]=O.useState(!1),[q,J]=O.useState(1),[ee,Y]=O.useState(20),[R,re]=O.useState(""),{toast:K}=$r(),I=O.useRef(null),Q=O.useRef(!0);O.useEffect(()=>{$()},[]);const $=async()=>{try{r(!0);const le=await zd();e(le.api_providers||[]),h(!1),Q.current=!1}catch(le){console.error("加载配置失败:",le)}finally{r(!1)}},Z=async()=>{try{m(!0),Ok().catch(()=>{}),x(!0)}catch(le){console.error("重启失败:",le),x(!1),K({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),m(!1)}},ne=async()=>{try{i(!0),I.current&&clearTimeout(I.current);const le=await zd();le.api_providers=t,await Jx(le),h(!1),K({title:"保存成功",description:"正在重启麦麦..."}),await Z()}catch(le){console.error("保存配置失败:",le),K({title:"保存失败",description:le.message,variant:"destructive"}),i(!1)}},ge=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},se=()=>{x(!1),m(!1),K({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Te=O.useCallback(async le=>{if(!Q.current)try{o(!0),await K5("api_providers",le),h(!1)}catch(Oe){console.error("自动保存失败:",Oe),h(!0)}finally{o(!1)}},[]);O.useEffect(()=>{if(!Q.current)return h(!0),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{Te(t)},2e3),()=>{I.current&&clearTimeout(I.current)}},[t,Te]);const qe=async()=>{try{i(!0),I.current&&clearTimeout(I.current);const le=await zd();le.api_providers=t,await Jx(le),h(!1),K({title:"保存成功",description:"模型提供商配置已保存"})}catch(le){console.error("保存配置失败:",le),K({title:"保存失败",description:le.message,variant:"destructive"})}finally{i(!1)}},ve=(le,Oe)=>{k(le||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),C(Oe),B(!1),w(!0)},Fe=async()=>{if(b?.api_key)try{await navigator.clipboard.writeText(b.api_key),K({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{K({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},Qe=()=>{if(!b)return;const le={...b,max_retry:b.max_retry??2,timeout:b.timeout??30,retry_interval:b.retry_interval??10};if(N!==null){const Oe=[...t];Oe[N]=le,e(Oe)}else e([...t,le]);w(!1),k(null),C(null)},Ke=le=>{if(!le&&b){const Oe={...b,max_retry:b.max_retry??2,timeout:b.timeout??30,retry_interval:b.retry_interval??10};k(Oe)}w(le)},Tt=le=>{A(le),E(!0)},st=()=>{if(_!==null){const le=t.filter((Oe,Le)=>Le!==_);e(le),K({title:"删除成功",description:"提供商已从列表中移除"})}E(!1),A(null)},He=le=>{const Oe=new Set(U);Oe.has(le)?Oe.delete(le):Oe.add(le),te(Oe)},St=()=>{if(U.size===mn.length)te(new Set);else{const le=mn.map((Oe,Le)=>t.findIndex(nt=>nt===mn[Le]));te(new Set(le))}},bt=()=>{if(U.size===0){K({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}W(!0)},nr=()=>{const le=t.filter((Oe,Le)=>!U.has(Le));e(le),te(new Set),W(!1),K({title:"批量删除成功",description:`已删除 ${U.size} 个提供商`})},mn=t.filter(le=>{if(!P)return!0;const Oe=P.toLowerCase();return le.name.toLowerCase().includes(Oe)||le.base_url.toLowerCase().includes(Oe)||le.client_type.toLowerCase().includes(Oe)}),Hn=Math.ceil(mn.length/ee),$t=mn.slice((q-1)*ee,q*ee),ht=()=>{const le=parseInt(R);le>=1&&le<=Hn&&(J(le),re(""))};return n?l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[U.size>0&&l.jsxs(de,{onClick:bt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(Kt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",U.size,")"]}),l.jsxs(de,{onClick:()=>ve(null,null),size:"sm",className:"w-full sm:w-auto",children:[l.jsx(is,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),l.jsxs(de,{onClick:qe,disabled:s||a||!u||f,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(X1,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":a?"自动保存中...":u?"保存配置":"已保存"]}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsxs(de,{disabled:s||a||f,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(ik,{className:"mr-2 h-4 w-4"}),f?"重启中...":u?"保存并重启":"重启麦麦"]})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认重启麦麦?"}),l.jsx(cn,{children:u?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:u?ne:Z,children:u?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(Kd,{children:[l.jsx(Il,{className:"h-4 w-4"}),l.jsxs(Jd,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),l.jsxs(yn,{className:"h-[calc(100vh-260px)]",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[l.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[l.jsx(js,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Re,{placeholder:"搜索提供商名称、URL 或类型...",value:P,onChange:le=>H(le.target.value),className:"pl-9"})]}),P&&l.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",mn.length," 个结果"]})]}),l.jsx("div",{className:"md:hidden space-y-3",children:mn.length===0?l.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:P?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):$t.map((le,Oe)=>{const Le=t.findIndex(nt=>nt===le);return l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"font-semibold text-base truncate",children:le.name}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:le.base_url})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>ve(le,Le),children:[l.jsx(Wd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(de,{size:"sm",onClick:()=>Tt(Le),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(Kt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),l.jsx("p",{className:"font-medium",children:le.client_type})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),l.jsx("p",{className:"font-medium",children:le.max_retry})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),l.jsx("p",{className:"font-medium",children:le.timeout})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),l.jsx("p",{className:"font-medium",children:le.retry_interval})]})]})]},Oe)})}),l.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(bu,{children:[l.jsx(wu,{children:l.jsxs(_r,{children:[l.jsx(jt,{className:"w-12",children:l.jsx(ms,{checked:U.size===mn.length&&mn.length>0,onCheckedChange:St})}),l.jsx(jt,{children:"名称"}),l.jsx(jt,{children:"基础URL"}),l.jsx(jt,{children:"客户端类型"}),l.jsx(jt,{className:"text-right",children:"最大重试"}),l.jsx(jt,{className:"text-right",children:"超时(秒)"}),l.jsx(jt,{className:"text-right",children:"重试间隔(秒)"}),l.jsx(jt,{className:"text-right",children:"操作"})]})}),l.jsx(Su,{children:$t.length===0?l.jsx(_r,{children:l.jsx(gt,{colSpan:8,className:"text-center text-muted-foreground py-8",children:P?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):$t.map((le,Oe)=>{const Le=t.findIndex(nt=>nt===le);return l.jsxs(_r,{children:[l.jsx(gt,{children:l.jsx(ms,{checked:U.has(Le),onCheckedChange:()=>He(Le)})}),l.jsx(gt,{className:"font-medium",children:le.name}),l.jsx(gt,{className:"max-w-xs truncate",title:le.base_url,children:le.base_url}),l.jsx(gt,{children:le.client_type}),l.jsx(gt,{className:"text-right",children:le.max_retry}),l.jsx(gt,{className:"text-right",children:le.timeout}),l.jsx(gt,{className:"text-right",children:le.retry_interval}),l.jsx(gt,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>ve(le,Le),children:[l.jsx(Wd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(de,{size:"sm",onClick:()=>Tt(Le),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(Kt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Oe)})})]})})}),mn.length>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ce,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(It,{value:ee.toString(),onValueChange:le=>{Y(parseInt(le)),J(1),te(new Set)},children:[l.jsx(Pt,{id:"page-size-provider",className:"w-20",children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(q-1)*ee+1," 到"," ",Math.min(q*ee,mn.length)," 条,共 ",mn.length," 条"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>J(1),disabled:q===1,className:"hidden sm:flex",children:l.jsx(i0,{className:"h-4 w-4"})}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>J(le=>Math.max(1,le-1)),disabled:q===1,children:[l.jsx(vu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Re,{type:"number",value:R,onChange:le=>re(le.target.value),onKeyDown:le=>le.key==="Enter"&&ht(),placeholder:q.toString(),className:"w-16 h-8 text-center",min:1,max:Hn}),l.jsx(de,{variant:"outline",size:"sm",onClick:ht,disabled:!R,className:"h-8",children:"跳转"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>J(le=>le+1),disabled:q>=Hn,children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(yu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>J(Hn),disabled:q>=Hn,className:"hidden sm:flex",children:l.jsx(a0,{className:"h-4 w-4"})})]})]})]}),l.jsx(Mr,{open:y,onOpenChange:Ke,children:l.jsxs(vr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[l.jsxs(yr,{children:[l.jsx(br,{children:N!==null?"编辑提供商":"添加提供商"}),l.jsx(as,{children:"配置 API 提供商的连接信息和参数"})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"name",children:"名称 *"}),l.jsx(Re,{id:"name",value:b?.name||"",onChange:le=>k(Oe=>Oe?{...Oe,name:le.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"base_url",children:"基础 URL *"}),l.jsx(Re,{id:"base_url",value:b?.base_url||"",onChange:le=>k(Oe=>Oe?{...Oe,base_url:le.target.value}:null),placeholder:"https://api.example.com/v1"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"api_key",children:"API Key *"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Re,{id:"api_key",type:F?"text":"password",value:b?.api_key||"",onChange:le=>k(Oe=>Oe?{...Oe,api_key:le.target.value}:null),placeholder:"sk-...",className:"flex-1"}),l.jsx(de,{type:"button",variant:"outline",size:"icon",onClick:()=>B(!F),title:F?"隐藏密钥":"显示密钥",children:F?l.jsx(z5,{className:"h-4 w-4"}):l.jsx(na,{className:"h-4 w-4"})}),l.jsx(de,{type:"button",variant:"outline",size:"icon",onClick:Fe,title:"复制密钥",children:l.jsx(D5,{className:"h-4 w-4"})})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"client_type",children:"客户端类型"}),l.jsxs(It,{value:b?.client_type||"openai",onValueChange:le=>k(Oe=>Oe?{...Oe,client_type:le}:null),children:[l.jsx(Pt,{id:"client_type",children:l.jsx(qt,{placeholder:"选择客户端类型"})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"openai",children:"OpenAI"}),l.jsx(ze,{value:"gemini",children:"Gemini"})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"max_retry",children:"最大重试"}),l.jsx(Re,{id:"max_retry",type:"number",min:"0",value:b?.max_retry??"",onChange:le=>{const Oe=le.target.value===""?null:parseInt(le.target.value);k(Le=>Le?{...Le,max_retry:Oe}:null)},placeholder:"默认: 2"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"timeout",children:"超时(秒)"}),l.jsx(Re,{id:"timeout",type:"number",min:"1",value:b?.timeout??"",onChange:le=>{const Oe=le.target.value===""?null:parseInt(le.target.value);k(Le=>Le?{...Le,timeout:Oe}:null)},placeholder:"默认: 30"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),l.jsx(Re,{id:"retry_interval",type:"number",min:"1",value:b?.retry_interval??"",onChange:le=>{const Oe=le.target.value===""?null:parseInt(le.target.value);k(Le=>Le?{...Le,retry_interval:Oe}:null)},placeholder:"默认: 10"})]})]})]}),l.jsxs(Ns,{children:[l.jsx(de,{variant:"outline",onClick:()=>w(!1),children:"取消"}),l.jsx(de,{onClick:Qe,children:"保存"})]})]})}),l.jsx(wn,{open:T,onOpenChange:E,children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:['确定要删除提供商 "',_!==null?t[_]?.name:"",'" 吗? 此操作无法撤销。']})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:st,children:"删除"})]})]})}),l.jsx(wn,{open:z,onOpenChange:W,children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认批量删除"}),l.jsxs(cn,{children:["确定要删除选中的 ",U.size," 个提供商吗? 此操作无法撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:nr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),g&&l.jsx(jk,{onRestartComplete:ge,onRestartFailed:se})]})}var OT=1,Cue=.9,Tue=.8,Eue=.17,s4=.1,i4=.999,_ue=.9999,Mue=.99,Aue=/[\\\/_+.#"@\[\(\{&]/,Rue=/[\\\/_+.#"@\[\(\{&]/g,Due=/[\s-]/,DI=/[\s-]/g;function Y3(t,e,n,r,s,i,a){if(i===e.length)return s===t.length?OT:Mue;var o=`${s},${i}`;if(a[o]!==void 0)return a[o];for(var u=r.charAt(i),h=n.indexOf(u,s),f=0,m,g,x,y;h>=0;)m=Y3(t,e,n,r,h+1,i+1,a),m>f&&(h===s?m*=OT:Aue.test(t.charAt(h-1))?(m*=Tue,x=t.slice(s,h-1).match(Rue),x&&s>0&&(m*=Math.pow(i4,x.length))):Due.test(t.charAt(h-1))?(m*=Cue,y=t.slice(s,h-1).match(DI),y&&s>0&&(m*=Math.pow(i4,y.length))):(m*=Eue,s>0&&(m*=Math.pow(i4,h-s))),t.charAt(h)!==e.charAt(i)&&(m*=_ue)),(mm&&(m=g*s4)),m>f&&(f=m),h=n.indexOf(u,h+1);return a[o]=f,f}function jT(t){return t.toLowerCase().replace(DI," ")}function zue(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,Y3(t,e,jT(t),jT(e),0,0,{})}var Pue=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dc=Pue.reduce((t,e)=>{const n=XS(`Primitive.${e}`),r=O.forwardRef((s,i)=>{const{asChild:a,...o}=s,u=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(u,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),zf='[cmdk-group=""]',a4='[cmdk-group-items=""]',Lue='[cmdk-group-heading=""]',zI='[cmdk-item=""]',NT=`${zI}:not([aria-disabled="true"])`,Z3="cmdk-item-select",Od="data-value",Bue=(t,e,n)=>zue(t,e,n),PI=O.createContext(void 0),N0=()=>O.useContext(PI),LI=O.createContext(void 0),p6=()=>O.useContext(LI),BI=O.createContext(void 0),II=O.forwardRef((t,e)=>{let n=jd(()=>{var K,I;return{search:"",value:(I=(K=t.value)!=null?K:t.defaultValue)!=null?I:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=jd(()=>new Set),s=jd(()=>new Map),i=jd(()=>new Map),a=jd(()=>new Set),o=qI(t),{label:u,children:h,value:f,onValueChange:m,filter:g,shouldFilter:x,loop:y,disablePointerSelection:w=!1,vimBindings:b=!0,...k}=t,N=Li(),C=Li(),T=Li(),E=O.useRef(null),_=Xue();fu(()=>{if(f!==void 0){let K=f.trim();n.current.value=K,A.emit()}},[f]),fu(()=>{_(6,te)},[]);let A=O.useMemo(()=>({subscribe:K=>(a.current.add(K),()=>a.current.delete(K)),snapshot:()=>n.current,setState:(K,I,Q)=>{var $,Z,ne,ge;if(!Object.is(n.current[K],I)){if(n.current[K]=I,K==="search")U(),P(),_(1,H);else if(K==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(T);se?se.focus():($=document.getElementById(N))==null||$.focus()}if(_(7,()=>{var se;n.current.selectedItemId=(se=z())==null?void 0:se.id,A.emit()}),Q||_(5,te),((Z=o.current)==null?void 0:Z.value)!==void 0){let se=I??"";(ge=(ne=o.current).onValueChange)==null||ge.call(ne,se);return}}A.emit()}},emit:()=>{a.current.forEach(K=>K())}}),[]),F=O.useMemo(()=>({value:(K,I,Q)=>{var $;I!==(($=i.current.get(K))==null?void 0:$.value)&&(i.current.set(K,{value:I,keywords:Q}),n.current.filtered.items.set(K,B(I,Q)),_(2,()=>{P(),A.emit()}))},item:(K,I)=>(r.current.add(K),I&&(s.current.has(I)?s.current.get(I).add(K):s.current.set(I,new Set([K]))),_(3,()=>{U(),P(),n.current.value||H(),A.emit()}),()=>{i.current.delete(K),r.current.delete(K),n.current.filtered.items.delete(K);let Q=z();_(4,()=>{U(),Q?.getAttribute("id")===K&&H(),A.emit()})}),group:K=>(s.current.has(K)||s.current.set(K,new Set),()=>{i.current.delete(K),s.current.delete(K)}),filter:()=>o.current.shouldFilter,label:u||t["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:N,inputId:T,labelId:C,listInnerRef:E}),[]);function B(K,I){var Q,$;let Z=($=(Q=o.current)==null?void 0:Q.filter)!=null?$:Bue;return K?Z(K,n.current.search,I):0}function P(){if(!n.current.search||o.current.shouldFilter===!1)return;let K=n.current.filtered.items,I=[];n.current.filtered.groups.forEach($=>{let Z=s.current.get($),ne=0;Z.forEach(ge=>{let se=K.get(ge);ne=Math.max(se,ne)}),I.push([$,ne])});let Q=E.current;W().sort(($,Z)=>{var ne,ge;let se=$.getAttribute("id"),Te=Z.getAttribute("id");return((ne=K.get(Te))!=null?ne:0)-((ge=K.get(se))!=null?ge:0)}).forEach($=>{let Z=$.closest(a4);Z?Z.appendChild($.parentElement===Z?$:$.closest(`${a4} > *`)):Q.appendChild($.parentElement===Q?$:$.closest(`${a4} > *`))}),I.sort(($,Z)=>Z[1]-$[1]).forEach($=>{var Z;let ne=(Z=E.current)==null?void 0:Z.querySelector(`${zf}[${Od}="${encodeURIComponent($[0])}"]`);ne?.parentElement.appendChild(ne)})}function H(){let K=W().find(Q=>Q.getAttribute("aria-disabled")!=="true"),I=K?.getAttribute(Od);A.setState("value",I||void 0)}function U(){var K,I,Q,$;if(!n.current.search||o.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let Z=0;for(let ne of r.current){let ge=(I=(K=i.current.get(ne))==null?void 0:K.value)!=null?I:"",se=($=(Q=i.current.get(ne))==null?void 0:Q.keywords)!=null?$:[],Te=B(ge,se);n.current.filtered.items.set(ne,Te),Te>0&&Z++}for(let[ne,ge]of s.current)for(let se of ge)if(n.current.filtered.items.get(se)>0){n.current.filtered.groups.add(ne);break}n.current.filtered.count=Z}function te(){var K,I,Q;let $=z();$&&(((K=$.parentElement)==null?void 0:K.firstChild)===$&&((Q=(I=$.closest(zf))==null?void 0:I.querySelector(Lue))==null||Q.scrollIntoView({block:"nearest"})),$.scrollIntoView({block:"nearest"}))}function z(){var K;return(K=E.current)==null?void 0:K.querySelector(`${zI}[aria-selected="true"]`)}function W(){var K;return Array.from(((K=E.current)==null?void 0:K.querySelectorAll(NT))||[])}function q(K){let I=W()[K];I&&A.setState("value",I.getAttribute(Od))}function J(K){var I;let Q=z(),$=W(),Z=$.findIndex(ge=>ge===Q),ne=$[Z+K];(I=o.current)!=null&&I.loop&&(ne=Z+K<0?$[$.length-1]:Z+K===$.length?$[0]:$[Z+K]),ne&&A.setState("value",ne.getAttribute(Od))}function ee(K){let I=z(),Q=I?.closest(zf),$;for(;Q&&!$;)Q=K>0?Wue(Q,zf):Gue(Q,zf),$=Q?.querySelector(NT);$?A.setState("value",$.getAttribute(Od)):J(K)}let Y=()=>q(W().length-1),R=K=>{K.preventDefault(),K.metaKey?Y():K.altKey?ee(1):J(1)},re=K=>{K.preventDefault(),K.metaKey?q(0):K.altKey?ee(-1):J(-1)};return O.createElement(dc.div,{ref:e,tabIndex:-1,...k,"cmdk-root":"",onKeyDown:K=>{var I;(I=k.onKeyDown)==null||I.call(k,K);let Q=K.nativeEvent.isComposing||K.keyCode===229;if(!(K.defaultPrevented||Q))switch(K.key){case"n":case"j":{b&&K.ctrlKey&&R(K);break}case"ArrowDown":{R(K);break}case"p":case"k":{b&&K.ctrlKey&&re(K);break}case"ArrowUp":{re(K);break}case"Home":{K.preventDefault(),q(0);break}case"End":{K.preventDefault(),Y();break}case"Enter":{K.preventDefault();let $=z();if($){let Z=new Event(Z3);$.dispatchEvent(Z)}}}}},O.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:Zue},u),Ov(t,K=>O.createElement(LI.Provider,{value:A},O.createElement(PI.Provider,{value:F},K))))}),Iue=O.forwardRef((t,e)=>{var n,r;let s=Li(),i=O.useRef(null),a=O.useContext(BI),o=N0(),u=qI(t),h=(r=(n=u.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;fu(()=>{if(!h)return o.item(s,a?.id)},[h]);let f=FI(s,i,[t.value,t.children,i],t.keywords),m=p6(),g=ec(_=>_.value&&_.value===f.current),x=ec(_=>h||o.filter()===!1?!0:_.search?_.filtered.items.get(s)>0:!0);O.useEffect(()=>{let _=i.current;if(!(!_||t.disabled))return _.addEventListener(Z3,y),()=>_.removeEventListener(Z3,y)},[x,t.onSelect,t.disabled]);function y(){var _,A;w(),(A=(_=u.current).onSelect)==null||A.call(_,f.current)}function w(){m.setState("value",f.current,!0)}if(!x)return null;let{disabled:b,value:k,onSelect:N,forceMount:C,keywords:T,...E}=t;return O.createElement(dc.div,{ref:Uo(i,e),...E,id:s,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!g,"data-disabled":!!b,"data-selected":!!g,onPointerMove:b||o.getDisablePointerSelection()?void 0:w,onClick:b?void 0:y},t.children)}),que=O.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,a=Li(),o=O.useRef(null),u=O.useRef(null),h=Li(),f=N0(),m=ec(x=>s||f.filter()===!1?!0:x.search?x.filtered.groups.has(a):!0);fu(()=>f.group(a),[]),FI(a,o,[t.value,t.heading,u]);let g=O.useMemo(()=>({id:a,forceMount:s}),[s]);return O.createElement(dc.div,{ref:Uo(o,e),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&O.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),Ov(t,x=>O.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},O.createElement(BI.Provider,{value:g},x))))}),Fue=O.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=O.useRef(null),i=ec(a=>!a.search);return!n&&!i?null:O.createElement(dc.div,{ref:Uo(s,e),...r,"cmdk-separator":"",role:"separator"})}),$ue=O.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=p6(),a=ec(h=>h.search),o=ec(h=>h.selectedItemId),u=N0();return O.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),O.createElement(dc.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":o,id:u.inputId,type:"text",value:s?t.value:a,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),Que=O.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=O.useRef(null),a=O.useRef(null),o=ec(h=>h.selectedItemId),u=N0();return O.useEffect(()=>{if(a.current&&i.current){let h=a.current,f=i.current,m,g=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let x=h.offsetHeight;f.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return g.observe(h),()=>{cancelAnimationFrame(m),g.unobserve(h)}}},[]),O.createElement(dc.div,{ref:Uo(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:u.listId},Ov(t,h=>O.createElement("div",{ref:Uo(a,u.listInnerRef),"cmdk-list-sizer":""},h)))}),Hue=O.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:a,...o}=t;return O.createElement(ek,{open:n,onOpenChange:r},O.createElement(YS,{container:a},O.createElement(H1,{"cmdk-overlay":"",className:s}),O.createElement(V1,{"aria-label":t.label,"cmdk-dialog":"",className:i},O.createElement(II,{ref:e,...o}))))}),Vue=O.forwardRef((t,e)=>ec(n=>n.filtered.count===0)?O.createElement(dc.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Uue=O.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return O.createElement(dc.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Ov(t,a=>O.createElement("div",{"aria-hidden":!0},a)))}),Gs=Object.assign(II,{List:Que,Item:Iue,Input:$ue,Group:que,Separator:Fue,Dialog:Hue,Empty:Vue,Loading:Uue});function Wue(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Gue(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function qI(t){let e=O.useRef(t);return fu(()=>{e.current=t}),e}var fu=typeof window>"u"?O.useEffect:O.useLayoutEffect;function jd(t){let e=O.useRef();return e.current===void 0&&(e.current=t()),e}function ec(t){let e=p6(),n=()=>t(e.snapshot());return O.useSyncExternalStore(e.subscribe,n,n)}function FI(t,e,n,r=[]){let s=O.useRef(),i=N0();return fu(()=>{var a;let o=(()=>{var h;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(h=f.current.textContent)==null?void 0:h.trim():s.current}})(),u=r.map(h=>h.trim());i.value(t,o,u),(a=e.current)==null||a.setAttribute(Od,o),s.current=o}),s}var Xue=()=>{let[t,e]=O.useState(),n=jd(()=>new Map);return fu(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function Yue(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Ov({asChild:t,children:e},n){return t&&O.isValidElement(e)?O.cloneElement(Yue(e),{ref:e.ref},n(e.props.children)):n(e)}var Zue={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const $I=O.forwardRef(({className:t,...e},n)=>l.jsx(Gs,{ref:n,className:Se("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));$I.displayName=Gs.displayName;const QI=O.forwardRef(({className:t,...e},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(js,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(Gs.Input,{ref:n,className:Se("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));QI.displayName=Gs.Input.displayName;const HI=O.forwardRef(({className:t,...e},n)=>l.jsx(Gs.List,{ref:n,className:Se("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));HI.displayName=Gs.List.displayName;const VI=O.forwardRef((t,e)=>l.jsx(Gs.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));VI.displayName=Gs.Empty.displayName;const UI=O.forwardRef(({className:t,...e},n)=>l.jsx(Gs.Group,{ref:n,className:Se("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));UI.displayName=Gs.Group.displayName;const Kue=O.forwardRef(({className:t,...e},n)=>l.jsx(Gs.Separator,{ref:n,className:Se("-mx-1 h-px bg-border",t),...e}));Kue.displayName=Gs.Separator.displayName;const WI=O.forwardRef(({className:t,...e},n)=>l.jsx(Gs.Item,{ref:n,className:Se("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));WI.displayName=Gs.Item.displayName;function Jue({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[a,o]=O.useState(!1),u=f=>{e.includes(f)?n(e.filter(m=>m!==f)):n([...e,f])},h=f=>{n(e.filter(m=>m!==f))};return l.jsxs(Wo,{open:a,onOpenChange:o,children:[l.jsx(Go,{asChild:!0,children:l.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":a,className:Se("w-full justify-between min-h-10 h-auto",i),children:[l.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?l.jsx("span",{className:"text-muted-foreground",children:r}):e.map(f=>{const m=t.find(g=>g.value===f);return l.jsxs(kn,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:g=>{g.stopPropagation(),h(f)},children:[m?.label||f,l.jsx(s0,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},f)})}),l.jsx(FX,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),l.jsx(Fl,{className:"w-full p-0",align:"start",children:l.jsxs($I,{children:[l.jsx(QI,{placeholder:"搜索...",className:"h-9"}),l.jsxs(HI,{children:[l.jsx(VI,{children:s}),l.jsx(UI,{children:t.map(f=>{const m=e.includes(f.value);return l.jsxs(WI,{value:f.value,onSelect:()=>u(f.value),children:[l.jsx("div",{className:Se("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",m?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:l.jsx(Kc,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),l.jsx("span",{children:f.label})]},f.value)})})]})]})})]})}function ede(){const[t,e]=O.useState([]),[n,r]=O.useState([]),[s,i]=O.useState([]),[a,o]=O.useState(null),[u,h]=O.useState(!0),[f,m]=O.useState(!1),[g,x]=O.useState(!1),[y,w]=O.useState(!1),[b,k]=O.useState(!1),[N,C]=O.useState(!1),[T,E]=O.useState(!1),[_,A]=O.useState(null),[F,B]=O.useState(null),[P,H]=O.useState(!1),[U,te]=O.useState(null),[z,W]=O.useState(""),[q,J]=O.useState(new Set),[ee,Y]=O.useState(!1),[R,re]=O.useState(1),[K,I]=O.useState(20),[Q,$]=O.useState(""),{toast:Z}=$r(),ne=O.useRef(null),ge=O.useRef(null),se=O.useRef(!0);O.useEffect(()=>{Te()},[]);const Te=async()=>{try{h(!0);const ue=await zd(),Ce=ue.models||[];e(Ce),i(Ce.map(ut=>ut.name));const lt=ue.api_providers||[];r(lt.map(ut=>ut.name)),o(ue.model_task_config||null),w(!1),se.current=!1}catch(ue){console.error("加载配置失败:",ue)}finally{h(!1)}},qe=async()=>{try{k(!0),Ok().catch(()=>{}),C(!0)}catch(ue){console.error("重启失败:",ue),C(!1),Z({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),k(!1)}},ve=async()=>{try{m(!0),ne.current&&clearTimeout(ne.current),ge.current&&clearTimeout(ge.current);const ue=await zd();ue.models=t,ue.model_task_config=a,await Jx(ue),w(!1),Z({title:"保存成功",description:"正在重启麦麦..."}),await qe()}catch(ue){console.error("保存配置失败:",ue),Z({title:"保存失败",description:ue.message,variant:"destructive"}),m(!1)}},Fe=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Qe=()=>{C(!1),k(!1),Z({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ke=O.useCallback(async ue=>{if(!se.current)try{x(!0),await K5("models",ue),w(!1)}catch(Ce){console.error("自动保存模型列表失败:",Ce),w(!0)}finally{x(!1)}},[]),Tt=O.useCallback(async ue=>{if(!se.current)try{x(!0),await K5("model_task_config",ue),w(!1)}catch(Ce){console.error("自动保存任务配置失败:",Ce),w(!0)}finally{x(!1)}},[]);O.useEffect(()=>{if(!se.current)return w(!0),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>{Ke(t)},2e3),()=>{ne.current&&clearTimeout(ne.current)}},[t,Ke]),O.useEffect(()=>{if(!(se.current||!a))return w(!0),ge.current&&clearTimeout(ge.current),ge.current=setTimeout(()=>{Tt(a)},2e3),()=>{ge.current&&clearTimeout(ge.current)}},[a,Tt]);const st=async()=>{try{m(!0),ne.current&&clearTimeout(ne.current),ge.current&&clearTimeout(ge.current);const ue=await zd();ue.models=t,ue.model_task_config=a,await Jx(ue),w(!1),Z({title:"保存成功",description:"模型配置已保存"}),await Te()}catch(ue){console.error("保存配置失败:",ue),Z({title:"保存失败",description:ue.message,variant:"destructive"})}finally{m(!1)}},He=(ue,Ce)=>{A(ue||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),B(Ce),E(!0)},St=()=>{if(!_)return;const ue={..._,price_in:_.price_in??0,price_out:_.price_out??0};let Ce;F!==null?(Ce=[...t],Ce[F]=ue):Ce=[...t,ue],e(Ce),i(Ce.map(lt=>lt.name)),E(!1),A(null),B(null)},bt=ue=>{if(!ue&&_){const Ce={..._,price_in:_.price_in??0,price_out:_.price_out??0};A(Ce)}E(ue)},nr=ue=>{te(ue),H(!0)},mn=()=>{if(U!==null){const ue=t.filter((Ce,lt)=>lt!==U);e(ue),i(ue.map(Ce=>Ce.name)),Z({title:"删除成功",description:"模型已从列表中移除"})}H(!1),te(null)},Hn=ue=>{const Ce=new Set(q);Ce.has(ue)?Ce.delete(ue):Ce.add(ue),J(Ce)},$t=()=>{if(q.size===Le.length)J(new Set);else{const ue=Le.map((Ce,lt)=>t.findIndex(ut=>ut===Le[lt]));J(new Set(ue))}},ht=()=>{if(q.size===0){Z({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}Y(!0)},le=()=>{const ue=t.filter((Ce,lt)=>!q.has(lt));e(ue),i(ue.map(Ce=>Ce.name)),J(new Set),Y(!1),Z({title:"批量删除成功",description:`已删除 ${q.size} 个模型`})},Oe=(ue,Ce,lt)=>{a&&o({...a,[ue]:{...a[ue],[Ce]:lt}})},Le=t.filter(ue=>{if(!z)return!0;const Ce=z.toLowerCase();return ue.name.toLowerCase().includes(Ce)||ue.model_identifier.toLowerCase().includes(Ce)||ue.api_provider.toLowerCase().includes(Ce)}),nt=Math.ceil(Le.length/K),Ot=Le.slice((R-1)*K,R*K),Vt=()=>{const ue=parseInt(Q);ue>=1&&ue<=nt&&(re(ue),$(""))},Ln=ue=>a?[a.utils?.model_list||[],a.utils_small?.model_list||[],a.tool_use?.model_list||[],a.replyer?.model_list||[],a.planner?.model_list||[],a.vlm?.model_list||[],a.voice?.model_list||[],a.embedding?.model_list||[],a.lpmm_entity_extract?.model_list||[],a.lpmm_rdf_build?.model_list||[],a.lpmm_qa?.model_list||[]].some(lt=>lt.includes(ue)):!1;return u?l.jsx(yn,{className:"h-full",children:l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):l.jsx(yn,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[l.jsxs(de,{onClick:st,disabled:f||g||!y||b,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[l.jsx(X1,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),f?"保存中...":g?"自动保存中...":y?"保存配置":"已保存"]}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsxs(de,{disabled:f||g||b,size:"sm",className:"flex-1 sm:flex-none",children:[l.jsx(ik,{className:"mr-2 h-4 w-4"}),b?"重启中...":y?"保存并重启":"重启麦麦"]})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认重启麦麦?"}),l.jsx(cn,{children:y?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:y?ve:qe,children:y?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(Kd,{children:[l.jsx(Il,{className:"h-4 w-4"}),l.jsxs(Jd,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),l.jsxs(ql,{defaultValue:"models",className:"w-full",children:[l.jsxs(La,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[l.jsx(Zt,{value:"models",children:"模型配置"}),l.jsx(Zt,{value:"tasks",children:"模型任务配置"})]}),l.jsxs(An,{value:"models",className:"space-y-4 mt-0",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[q.size>0&&l.jsxs(de,{onClick:ht,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(Kt,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",q.size,")"]}),l.jsxs(de,{onClick:()=>He(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(is,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[l.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[l.jsx(js,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Re,{placeholder:"搜索模型名称、标识符或提供商...",value:z,onChange:ue=>W(ue.target.value),className:"pl-9"})]}),z&&l.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Le.length," 个结果"]})]}),l.jsx("div",{className:"md:hidden space-y-3",children:Ot.length===0?l.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的模型":"暂无模型配置"}):Ot.map((ue,Ce)=>{const lt=t.findIndex(or=>or===ue),ut=Ln(ue.name);return l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("h3",{className:"font-semibold text-base",children:ue.name}),l.jsx(kn,{variant:ut?"default":"secondary",className:ut?"bg-green-600 hover:bg-green-700":"",children:ut?"已使用":"未使用"})]}),l.jsx("p",{className:"text-xs text-muted-foreground break-all",title:ue.model_identifier,children:ue.model_identifier})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>He(ue,lt),children:[l.jsx(Wd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(de,{size:"sm",onClick:()=>nr(lt),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(Kt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),l.jsx("p",{className:"font-medium",children:ue.api_provider})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),l.jsx("p",{className:"font-medium",children:ue.force_stream_mode?"是":"否"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),l.jsxs("p",{className:"font-medium",children:["¥",ue.price_in,"/M"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),l.jsxs("p",{className:"font-medium",children:["¥",ue.price_out,"/M"]})]})]})]},Ce)})}),l.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(bu,{children:[l.jsx(wu,{children:l.jsxs(_r,{children:[l.jsx(jt,{className:"w-12",children:l.jsx(ms,{checked:q.size===Le.length&&Le.length>0,onCheckedChange:$t})}),l.jsx(jt,{className:"w-24",children:"使用状态"}),l.jsx(jt,{children:"模型名称"}),l.jsx(jt,{children:"模型标识符"}),l.jsx(jt,{children:"提供商"}),l.jsx(jt,{className:"text-right",children:"输入价格"}),l.jsx(jt,{className:"text-right",children:"输出价格"}),l.jsx(jt,{className:"text-center",children:"强制流式"}),l.jsx(jt,{className:"text-right",children:"操作"})]})}),l.jsx(Su,{children:Ot.length===0?l.jsx(_r,{children:l.jsx(gt,{colSpan:9,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的模型":"暂无模型配置"})}):Ot.map((ue,Ce)=>{const lt=t.findIndex(or=>or===ue),ut=Ln(ue.name);return l.jsxs(_r,{children:[l.jsx(gt,{children:l.jsx(ms,{checked:q.has(lt),onCheckedChange:()=>Hn(lt)})}),l.jsx(gt,{children:l.jsx(kn,{variant:ut?"default":"secondary",className:ut?"bg-green-600 hover:bg-green-700":"",children:ut?"已使用":"未使用"})}),l.jsx(gt,{className:"font-medium",children:ue.name}),l.jsx(gt,{className:"max-w-xs truncate",title:ue.model_identifier,children:ue.model_identifier}),l.jsx(gt,{children:ue.api_provider}),l.jsxs(gt,{className:"text-right",children:["¥",ue.price_in,"/M"]}),l.jsxs(gt,{className:"text-right",children:["¥",ue.price_out,"/M"]}),l.jsx(gt,{className:"text-center",children:ue.force_stream_mode?"是":"否"}),l.jsx(gt,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>He(ue,lt),children:[l.jsx(Wd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(de,{size:"sm",onClick:()=>nr(lt),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(Kt,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Ce)})})]})})}),Le.length>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ce,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(It,{value:K.toString(),onValueChange:ue=>{I(parseInt(ue)),re(1),J(new Set)},children:[l.jsx(Pt,{id:"page-size-model",className:"w-20",children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*K+1," 到"," ",Math.min(R*K,Le.length)," 条,共 ",Le.length," 条"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>re(1),disabled:R===1,className:"hidden sm:flex",children:l.jsx(i0,{className:"h-4 w-4"})}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>re(ue=>Math.max(1,ue-1)),disabled:R===1,children:[l.jsx(vu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Re,{type:"number",value:Q,onChange:ue=>$(ue.target.value),onKeyDown:ue=>ue.key==="Enter"&&Vt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:nt}),l.jsx(de,{variant:"outline",size:"sm",onClick:Vt,disabled:!Q,className:"h-8",children:"跳转"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>re(ue=>ue+1),disabled:R>=nt,children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(yu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>re(nt),disabled:R>=nt,className:"hidden sm:flex",children:l.jsx(a0,{className:"h-4 w-4"})})]})]})]}),l.jsxs(An,{value:"tasks",className:"space-y-6 mt-0",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),a&&l.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[l.jsx(Yi,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:a.utils,modelNames:s,onChange:(ue,Ce)=>Oe("utils",ue,Ce)}),l.jsx(Yi,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:a.utils_small,modelNames:s,onChange:(ue,Ce)=>Oe("utils_small",ue,Ce)}),l.jsx(Yi,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:a.tool_use,modelNames:s,onChange:(ue,Ce)=>Oe("tool_use",ue,Ce)}),l.jsx(Yi,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:a.replyer,modelNames:s,onChange:(ue,Ce)=>Oe("replyer",ue,Ce)}),l.jsx(Yi,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:a.planner,modelNames:s,onChange:(ue,Ce)=>Oe("planner",ue,Ce)}),l.jsx(Yi,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:a.vlm,modelNames:s,onChange:(ue,Ce)=>Oe("vlm",ue,Ce),hideTemperature:!0}),l.jsx(Yi,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:a.voice,modelNames:s,onChange:(ue,Ce)=>Oe("voice",ue,Ce),hideTemperature:!0,hideMaxTokens:!0}),l.jsx(Yi,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:a.embedding,modelNames:s,onChange:(ue,Ce)=>Oe("embedding",ue,Ce),hideTemperature:!0,hideMaxTokens:!0}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),l.jsx(Yi,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:a.lpmm_entity_extract,modelNames:s,onChange:(ue,Ce)=>Oe("lpmm_entity_extract",ue,Ce)}),l.jsx(Yi,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:a.lpmm_rdf_build,modelNames:s,onChange:(ue,Ce)=>Oe("lpmm_rdf_build",ue,Ce)}),l.jsx(Yi,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:a.lpmm_qa,modelNames:s,onChange:(ue,Ce)=>Oe("lpmm_qa",ue,Ce)})]})]})]})]}),l.jsx(Mr,{open:T,onOpenChange:bt,children:l.jsxs(vr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[l.jsxs(yr,{children:[l.jsx(br,{children:F!==null?"编辑模型":"添加模型"}),l.jsx(as,{children:"配置模型的基本信息和参数"})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"model_name",children:"模型名称 *"}),l.jsx(Re,{id:"model_name",value:_?.name||"",onChange:ue=>A(Ce=>Ce?{...Ce,name:ue.target.value}:null),placeholder:"例如: qwen3-30b"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"model_identifier",children:"模型标识符 *"}),l.jsx(Re,{id:"model_identifier",value:_?.model_identifier||"",onChange:ue=>A(Ce=>Ce?{...Ce,model_identifier:ue.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"api_provider",children:"API 提供商 *"}),l.jsxs(It,{value:_?.api_provider||"",onValueChange:ue=>A(Ce=>Ce?{...Ce,api_provider:ue}:null),children:[l.jsx(Pt,{id:"api_provider",children:l.jsx(qt,{placeholder:"选择提供商"})}),l.jsx(Lt,{children:n.map(ue=>l.jsx(ze,{value:ue,children:ue},ue))})]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),l.jsx(Re,{id:"price_in",type:"number",step:"0.1",min:"0",value:_?.price_in??"",onChange:ue=>{const Ce=ue.target.value===""?null:parseFloat(ue.target.value);A(lt=>lt?{...lt,price_in:Ce}:null)},placeholder:"默认: 0"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),l.jsx(Re,{id:"price_out",type:"number",step:"0.1",min:"0",value:_?.price_out??"",onChange:ue=>{const Ce=ue.target.value===""?null:parseFloat(ue.target.value);A(lt=>lt?{...lt,price_out:Ce}:null)},placeholder:"默认: 0"})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"force_stream_mode",checked:_?.force_stream_mode||!1,onCheckedChange:ue=>A(Ce=>Ce?{...Ce,force_stream_mode:ue}:null)}),l.jsx(ce,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),l.jsxs(Ns,{children:[l.jsx(de,{variant:"outline",onClick:()=>E(!1),children:"取消"}),l.jsx(de,{onClick:St,children:"保存"})]})]})}),l.jsx(wn,{open:P,onOpenChange:H,children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:['确定要删除模型 "',U!==null?t[U]?.name:"",'" 吗? 此操作无法撤销。']})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:mn,children:"删除"})]})]})}),l.jsx(wn,{open:ee,onOpenChange:Y,children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认批量删除"}),l.jsxs(cn,{children:["确定要删除选中的 ",q.size," 个模型吗? 此操作无法撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:le,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),N&&l.jsx(jk,{onRestartComplete:Fe,onRestartFailed:Qe})]})})}function Yi({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:a=!1}){const o=u=>{s("model_list",u)};return l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"模型列表"}),l.jsx(Jue,{options:r.map(u=>({label:u,value:u})),selected:n.model_list||[],onChange:o,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(ce,{children:"温度"}),l.jsx(Re,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:u=>{const h=parseFloat(u.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),l.jsx(lv,{value:[n.temperature??.3],onValueChange:u=>s("temperature",u[0]),min:0,max:1,step:.1,className:"w-full"})]}),!a&&l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{children:"最大 Token"}),l.jsx(Re,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:u=>s("max_tokens",parseInt(u.target.value))})]})]})]})]})}const jv="/api/webui/config";async function tde(){const e=await(await yt(`${jv}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function nde(t){const n=await(await yt(`${jv}/adapter-config/path`,{method:"POST",headers:Et(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function rde(t){const n=await(await yt(`${jv}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function CT(t,e){const r=await(await yt(`${jv}/adapter-config`,{method:"POST",headers:Et(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const ai={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function sde(){const[t,e]=O.useState("upload"),[n,r]=O.useState(null),[s,i]=O.useState(""),[a,o]=O.useState(""),[u,h]=O.useState(""),[f,m]=O.useState(!1),[g,x]=O.useState(!1),[y,w]=O.useState(!1),[b,k]=O.useState(!1),[N,C]=O.useState(null),T=O.useRef(null),{toast:E}=$r(),_=O.useRef(null),A=Q=>{if(!Q.trim())return{valid:!1,error:"路径不能为空"};const $=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,Z=/^(\/|~\/).+\.toml$/i,ne=$.test(Q),ge=Z.test(Q);return!ne&&!ge?{valid:!1,error:"路径格式错误。Windows: C:\\path\\file.toml,Linux: /path/file.toml"}:Q.toLowerCase().endsWith(".toml")?/[<>"|?*\x00-\x1F]/.test(Q)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}:{valid:!1,error:"文件必须是 .toml 格式"}},F=Q=>{if(o(Q),Q.trim()){const $=A(Q);h($.error)}else h("")};O.useEffect(()=>{(async()=>{try{const $=await tde();$&&$.path&&(o($.path),e("path"),await B($.path))}catch($){console.error("加载保存的路径失败:",$)}})()},[]);const B=async Q=>{const $=A(Q);if(!$.valid){h($.error),E({title:"路径无效",description:$.error,variant:"destructive"});return}h(""),x(!0);try{const Z=await rde(Q),ne=Y(Z);r(ne),o(Q),await nde(Q),E({title:"加载成功",description:"已从配置文件加载"})}catch(Z){console.error("加载配置失败:",Z),E({title:"加载失败",description:Z instanceof Error?Z.message:"无法读取配置文件",variant:"destructive"})}finally{x(!1)}},P=O.useCallback(Q=>{t!=="path"||!a||(_.current&&clearTimeout(_.current),_.current=setTimeout(async()=>{m(!0);try{const $=R(Q);await CT(a,$),E({title:"自动保存成功",description:"配置已保存到文件"})}catch($){console.error("自动保存失败:",$),E({title:"自动保存失败",description:$ instanceof Error?$.message:"保存配置失败",variant:"destructive"})}finally{m(!1)}},1e3))},[t,a,E]),H=async()=>{if(!n||!a)return;const Q=A(a);if(!Q.valid){E({title:"保存失败",description:Q.error,variant:"destructive"});return}m(!0);try{const $=R(n);await CT(a,$),E({title:"保存成功",description:"配置已保存到文件"})}catch($){console.error("保存失败:",$),E({title:"保存失败",description:$ instanceof Error?$.message:"保存配置失败",variant:"destructive"})}finally{m(!1)}},U=async()=>{a&&await B(a)},te=Q=>{if(Q!==t){if(n){C(Q),w(!0);return}z(Q)}},z=Q=>{r(null),i(""),h(""),e(Q),E({title:"已切换模式",description:Q==="upload"?"现在可以上传配置文件":"现在可以指定配置文件路径"})},W=()=>{N&&(z(N),C(null)),w(!1)},q=()=>{if(n){k(!0);return}J()},J=()=>{o(""),r(null),h(""),E({title:"已清空",description:"路径和配置已清空"})},ee=()=>{J(),k(!1)},Y=Q=>{const $=JSON.parse(JSON.stringify(ai)),Z=Q.split(` `);let ne="";for(const ge of Z){const se=ge.trim();if(!se||se.startsWith("#"))continue;const Te=se.match(/^\[(\w+)\]$/);if(Te){ne=Te[1];continue}const qe=se.match(/^(\w+)\s*=\s*(.+)$/);if(qe&&ne){const[,ve,Fe]=qe,Qe=Fe.trim();let Ke;if(Qe==="true")Ke=!0;else if(Qe==="false")Ke=!1;else if(Qe.startsWith("[")&&Qe.endsWith("]")){const Tt=Qe.slice(1,-1).trim();if(Tt){const st=Tt.split(",").map(St=>{const bt=St.trim();return isNaN(Number(bt))?bt.replace(/"/g,""):Number(bt)}),He=typeof st[0];Ke=st.every(St=>typeof St===He)?st:st.filter(St=>typeof St=="number")}else Ke=[]}else Qe.startsWith('"')&&Qe.endsWith('"')?Ke=Qe.slice(1,-1):isNaN(Number(Qe))?Ke=Qe.replace(/"/g,""):Ke=Number(Qe);if(ne in $){const Tt=$[ne];Tt[ve]=Ke}}}return $},R=Q=>{const $=[],Z=(ne,ge)=>ne===""||ne===null||ne===void 0?ge:ne;return $.push("[inner]"),$.push(`version = "${Z(Q.inner.version,ai.inner.version)}" # 版本号`),$.push("# 请勿修改版本号,除非你知道自己在做什么"),$.push(""),$.push("[nickname] # 现在没用"),$.push(`nickname = "${Z(Q.nickname.nickname,ai.nickname.nickname)}"`),$.push(""),$.push("[napcat_server] # Napcat连接的ws服务设置"),$.push(`host = "${Z(Q.napcat_server.host,ai.napcat_server.host)}" # Napcat设定的主机地址`),$.push(`port = ${Z(Q.napcat_server.port||0,ai.napcat_server.port)} # Napcat设定的端口`),$.push(`token = "${Z(Q.napcat_server.token,ai.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),$.push(`heartbeat_interval = ${Z(Q.napcat_server.heartbeat_interval||0,ai.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),$.push(""),$.push("[maibot_server] # 连接麦麦的ws服务设置"),$.push(`host = "${Z(Q.maibot_server.host,ai.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),$.push(`port = ${Z(Q.maibot_server.port||0,ai.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),$.push(""),$.push("[chat] # 黑白名单功能"),$.push(`group_list_type = "${Z(Q.chat.group_list_type,ai.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),$.push(`group_list = [${Q.chat.group_list.join(", ")}] # 群组名单`),$.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),$.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),$.push(`private_list_type = "${Z(Q.chat.private_list_type,ai.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),$.push(`private_list = [${Q.chat.private_list.join(", ")}] # 私聊名单`),$.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),$.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),$.push(`ban_user_id = [${Q.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),$.push(`ban_qq_bot = ${Q.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),$.push(`enable_poke = ${Q.chat.enable_poke} # 是否启用戳一戳功能`),$.push(""),$.push("[voice] # 发送语音设置"),$.push(`use_tts = ${Q.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),$.push(""),$.push("[debug]"),$.push(`level = "${Z(Q.debug.level,ai.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),$.join(` `)},re=Q=>{const $=Q.target.files?.[0];if(!$)return;const Z=new FileReader;Z.onload=ne=>{try{const ge=ne.target?.result,se=Y(ge);r(se),i($.name),E({title:"上传成功",description:`已加载配置文件:${$.name}`})}catch(ge){console.error("解析配置文件失败:",ge),E({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},Z.readAsText($)},K=()=>{if(!n)return;const Q=R(n),$=new Blob([Q],{type:"text/plain;charset=utf-8"}),Z=URL.createObjectURL($),ne=document.createElement("a");ne.href=Z,ne.download=s||"config.toml",document.body.appendChild(ne),ne.click(),document.body.removeChild(ne),URL.revokeObjectURL(Z),E({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},I=()=>{r(JSON.parse(JSON.stringify(ai))),i("config.toml"),E({title:"已加载默认配置",description:"可以开始编辑配置"})};return l.jsx(yn,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),l.jsxs(Ct,{children:[l.jsxs(xn,{children:[l.jsx(vn,{children:"工作模式"}),l.jsx(Lr,{children:"选择配置文件的管理方式"})]}),l.jsxs(Tn,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4",children:[l.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>te("upload"),children:l.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[l.jsx(j8,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),l.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>te("path"),children:l.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[l.jsx($X,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="path"&&l.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs("div",{className:"flex-1 space-y-1",children:[l.jsx(Re,{id:"config-path",value:a,onChange:Q=>F(Q.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${u?"border-destructive":""}`}),u&&l.jsx("p",{className:"text-xs text-destructive",children:u})]}),l.jsx(de,{onClick:()=>B(a),disabled:g||!a||!!u,className:"w-full sm:w-auto",children:g?l.jsxs(l.Fragment,{children:[l.jsx(hi,{className:"h-4 w-4 animate-spin mr-2"}),l.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"sm:hidden",children:"加载配置"}),l.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),l.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[l.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[l.jsx("span",{children:"路径格式说明"}),l.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),l.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),l.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[l.jsx("div",{children:"C:\\Adapter\\config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),l.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[l.jsx("div",{children:"/opt/adapter/config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),l.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),l.jsxs(Kd,{children:[l.jsx(Il,{className:"h-4 w-4"}),l.jsx(Jd,{children:t==="upload"?l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",f&&" (正在保存...)"]})})]}),t==="upload"&&!n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[l.jsx("input",{ref:T,type:"file",accept:".toml",className:"hidden",onChange:re}),l.jsxs(de,{onClick:()=>T.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(j8,{className:"mr-2 h-4 w-4"}),"上传配置"]}),l.jsxs(de,{onClick:I,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(Dl,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&l.jsx("div",{className:"flex gap-2",children:l.jsxs(de,{onClick:K,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(Jc,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),t==="path"&&n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs(de,{onClick:H,size:"sm",disabled:f||!!u,className:"w-full sm:w-auto",children:[l.jsx(X1,{className:"mr-2 h-4 w-4"}),f?"保存中...":"立即保存"]}),l.jsxs(de,{onClick:U,size:"sm",variant:"outline",disabled:g,className:"w-full sm:w-auto",children:[l.jsx(hi,{className:`mr-2 h-4 w-4 ${g?"animate-spin":""}`}),"刷新"]}),l.jsxs(de,{onClick:q,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(Kt,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?l.jsxs(ql,{defaultValue:"napcat",className:"w-full",children:[l.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:l.jsxs(La,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[l.jsxs(Zt,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),l.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),l.jsxs(Zt,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),l.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),l.jsxs(Zt,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),l.jsx("span",{className:"sm:hidden",children:"聊天"})]}),l.jsxs(Zt,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),l.jsx("span",{className:"sm:hidden",children:"语音"})]}),l.jsx(Zt,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),l.jsx(An,{value:"napcat",className:"space-y-4",children:l.jsx(ide,{config:n,onChange:Q=>{r(Q),P(Q)}})}),l.jsx(An,{value:"maibot",className:"space-y-4",children:l.jsx(ade,{config:n,onChange:Q=>{r(Q),P(Q)}})}),l.jsx(An,{value:"chat",className:"space-y-4",children:l.jsx(lde,{config:n,onChange:Q=>{r(Q),P(Q)}})}),l.jsx(An,{value:"voice",className:"space-y-4",children:l.jsx(ode,{config:n,onChange:Q=>{r(Q),P(Q)}})}),l.jsx(An,{value:"debug",className:"space-y-4",children:l.jsx(cde,{config:n,onChange:Q=>{r(Q),P(Q)}})})]}):l.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:l.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[l.jsx(Dl,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),l.jsx(wn,{open:y,onOpenChange:w,children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认切换模式"}),l.jsxs(cn,{children:["切换模式将清空当前配置,确定要继续吗?",l.jsx("br",{}),l.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),l.jsxs(ln,{children:[l.jsx(dn,{onClick:()=>{w(!1),C(null)},children:"取消"}),l.jsx(un,{onClick:W,children:"确认切换"})]})]})}),l.jsx(wn,{open:b,onOpenChange:k,children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认清空路径"}),l.jsxs(cn,{children:["清空路径将清除当前配置,确定要继续吗?",l.jsx("br",{}),l.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),l.jsxs(ln,{children:[l.jsx(dn,{onClick:()=>k(!1),children:"取消"}),l.jsx(un,{onClick:ee,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function ide({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),l.jsxs("div",{className:"grid gap-3 md:gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),l.jsx(Re,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),l.jsx(Re,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),l.jsx(Re,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),l.jsx(Re,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function ade({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),l.jsxs("div",{className:"grid gap-3 md:gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),l.jsx(Re,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),l.jsx(Re,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function lde({config:t,onChange:e}){const n=i=>{const a={...t};i==="group"?a.chat.group_list=[...a.chat.group_list,0]:i==="private"?a.chat.private_list=[...a.chat.private_list,0]:a.chat.ban_user_id=[...a.chat.ban_user_id,0],e(a)},r=(i,a)=>{const o={...t};i==="group"?o.chat.group_list=o.chat.group_list.filter((u,h)=>h!==a):i==="private"?o.chat.private_list=o.chat.private_list.filter((u,h)=>h!==a):o.chat.ban_user_id=o.chat.ban_user_id.filter((u,h)=>h!==a),e(o)},s=(i,a,o)=>{const u={...t};i==="group"?u.chat.group_list[a]=o:i==="private"?u.chat.private_list[a]=o:u.chat.ban_user_id[a]=o,e(u)};return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),l.jsxs("div",{className:"grid gap-4 md:gap-6",children:[l.jsxs("div",{className:"space-y-3 md:space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-sm md:text-base",children:"群组名单类型"}),l.jsxs(It,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),l.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsx(ce,{className:"text-sm md:text-base",children:"群组列表"}),l.jsxs(de,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(Dl,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Re,{type:"number",value:i,onChange:o=>s("group",a,parseInt(o.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(Kt,{className:"h-4 w-4"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>r("group",a),children:"删除"})]})]})]})]},a)),t.chat.group_list.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),l.jsxs("div",{className:"space-y-3 md:space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-sm md:text-base",children:"私聊名单类型"}),l.jsxs(It,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),l.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsx(ce,{className:"text-sm md:text-base",children:"私聊列表"}),l.jsxs(de,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(Dl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Re,{type:"number",value:i,onChange:o=>s("private",a,parseInt(o.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(Kt,{className:"h-4 w-4"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>r("private",a),children:"删除"})]})]})]})]},a)),t.chat.private_list.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsxs("div",{children:[l.jsx(ce,{className:"text-sm md:text-base",children:"全局禁止名单"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),l.jsxs(de,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(Dl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Re,{type:"number",value:i,onChange:o=>s("ban",a,parseInt(o.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),l.jsxs(wn,{children:[l.jsx(qr,{asChild:!0,children:l.jsx(de,{size:"icon",variant:"outline",children:l.jsx(Kt,{className:"h-4 w-4"})})}),l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>r("ban",a),children:"删除"})]})]})]})]},a)),t.chat.ban_user_id.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(ce,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),l.jsx(Dt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(ce,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),l.jsx(Dt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function ode({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(ce,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),l.jsx(Dt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function cde({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),l.jsx("div",{className:"grid gap-3 md:gap-4",children:l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ce,{className:"text-sm md:text-base",children:"日志等级"}),l.jsxs(It,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"DEBUG",children:"DEBUG(调试)"}),l.jsx(ze,{value:"INFO",children:"INFO(信息)"}),l.jsx(ze,{value:"WARNING",children:"WARNING(警告)"}),l.jsx(ze,{value:"ERROR",children:"ERROR(错误)"}),l.jsx(ze,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function TT(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&e.push(a),s=r+1,r=n.indexOf(",",s)}return e}function ude(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const dde=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hde=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fde={};function ET(t,e){return(fde.jsx?hde:dde).test(t)}const mde=/[ \t\n\f\r]/g;function pde(t){return typeof t=="object"?t.type==="text"?_T(t.value):!1:_T(t)}function _T(t){return t.replace(mde,"")===""}class C0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}C0.prototype.normal={};C0.prototype.property={};C0.prototype.space=void 0;function GI(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new C0(n,r,e)}function Fm(t){return t.toLowerCase()}class Xs{constructor(e,n){this.attribute=n,this.property=e}}Xs.prototype.attribute="";Xs.prototype.booleanish=!1;Xs.prototype.boolean=!1;Xs.prototype.commaOrSpaceSeparated=!1;Xs.prototype.commaSeparated=!1;Xs.prototype.defined=!1;Xs.prototype.mustUseProperty=!1;Xs.prototype.number=!1;Xs.prototype.overloadedBoolean=!1;Xs.prototype.property="";Xs.prototype.spaceSeparated=!1;Xs.prototype.space=void 0;let gde=0;const Rt=ku(),Cr=ku(),K3=ku(),Ie=ku(),Vn=ku(),$d=ku(),li=ku();function ku(){return 2**++gde}const J3=Object.freeze(Object.defineProperty({__proto__:null,boolean:Rt,booleanish:Cr,commaOrSpaceSeparated:li,commaSeparated:$d,number:Ie,overloadedBoolean:K3,spaceSeparated:Vn},Symbol.toStringTag,{value:"Module"})),l4=Object.keys(J3);class g6 extends Xs{constructor(e,n,r,s){let i=-1;if(super(e,n),MT(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&wde.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(AT,kde);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!AT.test(i)){let a=i.replace(bde,Sde);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=g6}return new s(r,e)}function Sde(t){return"-"+t.toLowerCase()}function kde(t){return t.charAt(1).toUpperCase()}const nq=GI([XI,xde,KI,JI,eq],"html"),Nv=GI([XI,vde,KI,JI,eq],"svg");function RT(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function Ode(t){return t.join(" ").trim()}var cd={},o4,DT;function jde(){if(DT)return o4;DT=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,u=` `,h="/",f="*",m="",g="comment",x="declaration";function y(b,k){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];k=k||{};var N=1,C=1;function T(z){var W=z.match(e);W&&(N+=W.length);var q=z.lastIndexOf(u);C=~q?z.length-q:C+z.length}function E(){var z={line:N,column:C};return function(W){return W.position=new _(z),B(),W}}function _(z){this.start=z,this.end={line:N,column:C},this.source=k.source}_.prototype.content=b;function A(z){var W=new Error(k.source+":"+N+":"+C+": "+z);if(W.reason=z,W.filename=k.source,W.line=N,W.column=C,W.source=b,!k.silent)throw W}function F(z){var W=z.exec(b);if(W){var q=W[0];return T(q),b=b.slice(q.length),W}}function B(){F(n)}function P(z){var W;for(z=z||[];W=H();)W!==!1&&z.push(W);return z}function H(){var z=E();if(!(h!=b.charAt(0)||f!=b.charAt(1))){for(var W=2;m!=b.charAt(W)&&(f!=b.charAt(W)||h!=b.charAt(W+1));)++W;if(W+=2,m===b.charAt(W-1))return A("End of comment missing");var q=b.slice(2,W-2);return C+=2,T(q),b=b.slice(W),C+=2,z({type:g,comment:q})}}function U(){var z=E(),W=F(r);if(W){if(H(),!F(s))return A("property missing ':'");var q=F(i),J=z({type:x,property:w(W[0].replace(t,m)),value:q?w(q[0].replace(t,m)):m});return F(a),J}}function te(){var z=[];P(z);for(var W;W=U();)W!==!1&&(z.push(W),P(z));return z}return B(),te()}function w(b){return b?b.replace(o,m):m}return o4=y,o4}var zT;function Nde(){if(zT)return cd;zT=1;var t=cd&&cd.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(cd,"__esModule",{value:!0}),cd.default=n;const e=t(jde());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,e.default)(r),o=typeof s=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:h,value:f}=u;o?s(h,f,u):f&&(i=i||{},i[h]=f)}),i}return cd}var Pf={},PT;function Cde(){if(PT)return Pf;PT=1,Object.defineProperty(Pf,"__esModule",{value:!0}),Pf.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(h){return!h||n.test(h)||t.test(h)},a=function(h,f){return f.toUpperCase()},o=function(h,f){return"".concat(f,"-")},u=function(h,f){return f===void 0&&(f={}),i(h)?h:(h=h.toLowerCase(),f.reactCompat?h=h.replace(s,o):h=h.replace(r,o),h.replace(e,a))};return Pf.camelCase=u,Pf}var Lf,LT;function Tde(){if(LT)return Lf;LT=1;var t=Lf&&Lf.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(Nde()),n=Cde();function r(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(o,u){o&&u&&(a[(0,n.camelCase)(o,i)]=u)}),a}return r.default=r,Lf=r,Lf}var Ede=Tde();const _de=qS(Ede),rq=sq("end"),x6=sq("start");function sq(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Mde(t){const e=x6(t),n=rq(t);if(e&&n)return{start:e,end:n}}function dm(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?BT(t.position):"start"in t||"end"in t?BT(t):"line"in t||"column"in t?eS(t):""}function eS(t){return IT(t&&t.line)+":"+IT(t&&t.column)}function BT(t){return eS(t&&t.start)+"-"+eS(t&&t.end)}function IT(t){return t&&typeof t=="number"?t:1}class gs extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(a=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?i.ruleId=r:(i.source=r.slice(0,u),i.ruleId=r.slice(u+1))}if(!i.place&&i.ancestors&&i.ancestors){const u=i.ancestors[i.ancestors.length-1];u&&(i.place=u.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=dm(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gs.prototype.file="";gs.prototype.name="";gs.prototype.reason="";gs.prototype.message="";gs.prototype.stack="";gs.prototype.column=void 0;gs.prototype.line=void 0;gs.prototype.ancestors=void 0;gs.prototype.cause=void 0;gs.prototype.fatal=void 0;gs.prototype.place=void 0;gs.prototype.ruleId=void 0;gs.prototype.source=void 0;const v6={}.hasOwnProperty,Ade=new Map,Rde=/[A-Z]/g,Dde=new Set(["table","tbody","thead","tfoot","tr"]),zde=new Set(["td","th"]),iq="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Pde(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Hde(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Qde(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Nv:nq,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=aq(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function aq(t,e,n){if(e.type==="element")return Lde(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return Bde(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return qde(t,e,n);if(e.type==="mdxjsEsm")return Ide(t,e);if(e.type==="root")return Fde(t,e,n);if(e.type==="text")return $de(t,e)}function Lde(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Nv,t.schema=s),t.ancestors.push(e);const i=oq(t,e.tagName,!1),a=Vde(t,e);let o=b6(t,e);return Dde.has(e.tagName)&&(o=o.filter(function(u){return typeof u=="string"?!pde(u):!0})),lq(t,a,i,e),y6(a,o),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function Bde(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}$m(t,e.position)}function Ide(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);$m(t,e.position)}function qde(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Nv,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:oq(t,e.name,!0),a=Ude(t,e),o=b6(t,e);return lq(t,a,i,e),y6(a,o),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function Fde(t,e,n){const r={};return y6(r,b6(t,e)),t.create(e,t.Fragment,r,n)}function $de(t,e){return e.value}function lq(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function y6(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Qde(t,e,n){return r;function r(s,i,a,o){const h=Array.isArray(a.children)?n:e;return o?h(i,a,o):h(i,a)}}function Hde(t,e){return n;function n(r,s,i,a){const o=Array.isArray(i.children),u=x6(r);return e(s,i,a,o,{columnNumber:u?u.column-1:void 0,fileName:t,lineNumber:u?u.line:void 0},void 0)}}function Vde(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&v6.call(e.properties,s)){const i=Wde(t,s,e.properties[s]);if(i){const[a,o]=i;t.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&zde.has(e.tagName)?r=o:n[a]=o}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Ude(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,t.evaluater.evaluateExpression(o.argument))}else $m(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const o=r.value.data.estree.body[0];o.type,i=t.evaluater.evaluateExpression(o.expression)}else $m(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function b6(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:Ade;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);i0?(fi(t,t.length,0,e),t):e}const $T={}.hasOwnProperty;function uq(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ta(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ws=hc(/[A-Za-z]/),fs=hc(/[\dA-Za-z]/),nhe=hc(/[#-'*+\--9=?A-Z^-~]/);function S1(t){return t!==null&&(t<32||t===127)}const tS=hc(/\d/),rhe=hc(/[\dA-Fa-f]/),she=hc(/[!-/:-@[-`{-~]/);function it(t){return t!==null&&t<-2}function $n(t){return t!==null&&(t<0||t===32)}function Gt(t){return t===-2||t===-1||t===32}const Cv=hc(new RegExp("\\p{P}|\\p{S}","u")),mu=hc(/\s/);function hc(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ch(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const o=t.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function Ht(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(u){return Gt(u)?(t.enter(n),o(u)):e(u)}function o(u){return Gt(u)&&i++a))return;const A=e.events.length;let F=A,B,P;for(;F--;)if(e.events[F][0]==="exit"&&e.events[F][1].type==="chunkFlow"){if(B){P=e.events[F][1].end;break}B=!0}for(k(r),_=A;_C;){const E=n[T];e.containerState=E[1],E[0].exit.call(e,t)}n.length=C}function N(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function che(t,e,n){return Ht(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ch(t){if(t===null||$n(t)||mu(t))return 1;if(Cv(t))return 2}function Tv(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};HT(m,-u),HT(g,u),a={type:u>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},o={type:u>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},i={type:u>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:u>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},t[r][1].end={...a.start},t[n][1].start={...o.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=_i(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=_i(h,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),h=_i(h,Tv(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=_i(h,[["exit",i,e],["enter",o,e],["exit",o,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,h=_i(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,fi(t,r-1,n-r+3,h),n=r+h.length-f-2;break}}for(n=-1;++n0&&Gt(_)?Ht(t,N,"linePrefix",i+1)(_):N(_)}function N(_){return _===null||it(_)?t.check(VT,w,T)(_):(t.enter("codeFlowValue"),C(_))}function C(_){return _===null||it(_)?(t.exit("codeFlowValue"),N(_)):(t.consume(_),C)}function T(_){return t.exit("codeFenced"),e(_)}function E(_,A,F){let B=0;return P;function P(W){return _.enter("lineEnding"),_.consume(W),_.exit("lineEnding"),H}function H(W){return _.enter("codeFencedFence"),Gt(W)?Ht(_,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):U(W)}function U(W){return W===o?(_.enter("codeFencedFenceSequence"),te(W)):F(W)}function te(W){return W===o?(B++,_.consume(W),te):B>=a?(_.exit("codeFencedFenceSequence"),Gt(W)?Ht(_,z,"whitespace")(W):z(W)):F(W)}function z(W){return W===null||it(W)?(_.exit("codeFencedFence"),A(W)):F(W)}}}function whe(t,e,n){const r=this;return s;function s(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const u4={name:"codeIndented",tokenize:khe},She={partial:!0,tokenize:Ohe};function khe(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),Ht(t,i,"linePrefix",5)(h)}function i(h){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(h):n(h)}function a(h){return h===null?u(h):it(h)?t.attempt(She,a,u)(h):(t.enter("codeFlowValue"),o(h))}function o(h){return h===null||it(h)?(t.exit("codeFlowValue"),a(h)):(t.consume(h),o)}function u(h){return t.exit("codeIndented"),e(h)}}function Ohe(t,e,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):it(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):Ht(t,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(a):it(a)?s(a):n(a)}}const jhe={name:"codeText",previous:Che,resolve:Nhe,tokenize:The};function Nhe(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Bf(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Bf(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Bf(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function gq(t,e,n,r,s,i,a,o,u){const h=u||Number.POSITIVE_INFINITY;let f=0;return m;function m(k){return k===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(k),t.exit(i),g):k===null||k===32||k===41||S1(k)?n(k):(t.enter(r),t.enter(a),t.enter(o),t.enter("chunkString",{contentType:"string"}),w(k))}function g(k){return k===62?(t.enter(i),t.consume(k),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(o),t.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===62?(t.exit("chunkString"),t.exit(o),g(k)):k===null||k===60||it(k)?n(k):(t.consume(k),k===92?y:x)}function y(k){return k===60||k===62||k===92?(t.consume(k),x):x(k)}function w(k){return!f&&(k===null||k===41||$n(k))?(t.exit("chunkString"),t.exit(o),t.exit(a),t.exit(r),e(k)):f999||x===null||x===91||x===93&&!u||x===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(x):x===93?(t.exit(i),t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):it(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||x===91||x===93||it(x)||o++>999?(t.exit("chunkString"),f(x)):(t.consume(x),u||(u=!Gt(x)),x===92?g:m)}function g(x){return x===91||x===92||x===93?(t.consume(x),o++,m):m(x)}}function vq(t,e,n,r,s,i){let a;return o;function o(g){return g===34||g===39||g===40?(t.enter(r),t.enter(s),t.consume(g),t.exit(s),a=g===40?41:g,u):n(g)}function u(g){return g===a?(t.enter(s),t.consume(g),t.exit(s),t.exit(r),e):(t.enter(i),h(g))}function h(g){return g===a?(t.exit(i),u(a)):g===null?n(g):it(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Ht(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===a||g===null||it(g)?(t.exit("chunkString"),h(g)):(t.consume(g),g===92?m:f)}function m(g){return g===a||g===92?(t.consume(g),f):f(g)}}function hm(t,e){let n;return r;function r(s){return it(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):Gt(s)?Ht(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const Phe={name:"definition",tokenize:Bhe},Lhe={partial:!0,tokenize:Ihe};function Bhe(t,e,n){const r=this;let s;return i;function i(x){return t.enter("definition"),a(x)}function a(x){return xq.call(r,t,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function o(x){return s=ta(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),u):n(x)}function u(x){return $n(x)?hm(t,h)(x):h(x)}function h(x){return gq(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function f(x){return t.attempt(Lhe,m,m)(x)}function m(x){return Gt(x)?Ht(t,g,"whitespace")(x):g(x)}function g(x){return x===null||it(x)?(t.exit("definition"),r.parser.defined.push(s),e(x)):n(x)}}function Ihe(t,e,n){return r;function r(o){return $n(o)?hm(t,s)(o):n(o)}function s(o){return vq(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Gt(o)?Ht(t,a,"whitespace")(o):a(o)}function a(o){return o===null||it(o)?e(o):n(o)}}const qhe={name:"hardBreakEscape",tokenize:Fhe};function Fhe(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return it(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const $he={name:"headingAtx",resolve:Qhe,tokenize:Hhe};function Qhe(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},fi(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Hhe(t,e,n){let r=0;return s;function s(f){return t.enter("atxHeading"),i(f)}function i(f){return t.enter("atxHeadingSequence"),a(f)}function a(f){return f===35&&r++<6?(t.consume(f),a):f===null||$n(f)?(t.exit("atxHeadingSequence"),o(f)):n(f)}function o(f){return f===35?(t.enter("atxHeadingSequence"),u(f)):f===null||it(f)?(t.exit("atxHeading"),e(f)):Gt(f)?Ht(t,o,"whitespace")(f):(t.enter("atxHeadingText"),h(f))}function u(f){return f===35?(t.consume(f),u):(t.exit("atxHeadingSequence"),o(f))}function h(f){return f===null||f===35||$n(f)?(t.exit("atxHeadingText"),o(f)):(t.consume(f),h)}}const Vhe=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],WT=["pre","script","style","textarea"],Uhe={concrete:!0,name:"htmlFlow",resolveTo:Xhe,tokenize:Yhe},Whe={partial:!0,tokenize:Khe},Ghe={partial:!0,tokenize:Zhe};function Xhe(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Yhe(t,e,n){const r=this;let s,i,a,o,u;return h;function h(I){return f(I)}function f(I){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(I),m}function m(I){return I===33?(t.consume(I),g):I===47?(t.consume(I),i=!0,w):I===63?(t.consume(I),s=3,r.interrupt?e:R):ws(I)?(t.consume(I),a=String.fromCharCode(I),b):n(I)}function g(I){return I===45?(t.consume(I),s=2,x):I===91?(t.consume(I),s=5,o=0,y):ws(I)?(t.consume(I),s=4,r.interrupt?e:R):n(I)}function x(I){return I===45?(t.consume(I),r.interrupt?e:R):n(I)}function y(I){const Q="CDATA[";return I===Q.charCodeAt(o++)?(t.consume(I),o===Q.length?r.interrupt?e:U:y):n(I)}function w(I){return ws(I)?(t.consume(I),a=String.fromCharCode(I),b):n(I)}function b(I){if(I===null||I===47||I===62||$n(I)){const Q=I===47,$=a.toLowerCase();return!Q&&!i&&WT.includes($)?(s=1,r.interrupt?e(I):U(I)):Vhe.includes(a.toLowerCase())?(s=6,Q?(t.consume(I),k):r.interrupt?e(I):U(I)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):i?N(I):C(I))}return I===45||fs(I)?(t.consume(I),a+=String.fromCharCode(I),b):n(I)}function k(I){return I===62?(t.consume(I),r.interrupt?e:U):n(I)}function N(I){return Gt(I)?(t.consume(I),N):P(I)}function C(I){return I===47?(t.consume(I),P):I===58||I===95||ws(I)?(t.consume(I),T):Gt(I)?(t.consume(I),C):P(I)}function T(I){return I===45||I===46||I===58||I===95||fs(I)?(t.consume(I),T):E(I)}function E(I){return I===61?(t.consume(I),_):Gt(I)?(t.consume(I),E):C(I)}function _(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(t.consume(I),u=I,A):Gt(I)?(t.consume(I),_):F(I)}function A(I){return I===u?(t.consume(I),u=null,B):I===null||it(I)?n(I):(t.consume(I),A)}function F(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||$n(I)?E(I):(t.consume(I),F)}function B(I){return I===47||I===62||Gt(I)?C(I):n(I)}function P(I){return I===62?(t.consume(I),H):n(I)}function H(I){return I===null||it(I)?U(I):Gt(I)?(t.consume(I),H):n(I)}function U(I){return I===45&&s===2?(t.consume(I),q):I===60&&s===1?(t.consume(I),J):I===62&&s===4?(t.consume(I),re):I===63&&s===3?(t.consume(I),R):I===93&&s===5?(t.consume(I),Y):it(I)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Whe,K,te)(I)):I===null||it(I)?(t.exit("htmlFlowData"),te(I)):(t.consume(I),U)}function te(I){return t.check(Ghe,z,K)(I)}function z(I){return t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),W}function W(I){return I===null||it(I)?te(I):(t.enter("htmlFlowData"),U(I))}function q(I){return I===45?(t.consume(I),R):U(I)}function J(I){return I===47?(t.consume(I),a="",ee):U(I)}function ee(I){if(I===62){const Q=a.toLowerCase();return WT.includes(Q)?(t.consume(I),re):U(I)}return ws(I)&&a.length<8?(t.consume(I),a+=String.fromCharCode(I),ee):U(I)}function Y(I){return I===93?(t.consume(I),R):U(I)}function R(I){return I===62?(t.consume(I),re):I===45&&s===2?(t.consume(I),R):U(I)}function re(I){return I===null||it(I)?(t.exit("htmlFlowData"),K(I)):(t.consume(I),re)}function K(I){return t.exit("htmlFlow"),e(I)}}function Zhe(t,e,n){const r=this;return s;function s(a){return it(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function Khe(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(T0,e,n)}}const Jhe={name:"htmlText",tokenize:efe};function efe(t,e,n){const r=this;let s,i,a;return o;function o(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),u}function u(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),E):R===63?(t.consume(R),C):ws(R)?(t.consume(R),F):n(R)}function h(R){return R===45?(t.consume(R),f):R===91?(t.consume(R),i=0,y):ws(R)?(t.consume(R),N):n(R)}function f(R){return R===45?(t.consume(R),x):n(R)}function m(R){return R===null?n(R):R===45?(t.consume(R),g):it(R)?(a=m,J(R)):(t.consume(R),m)}function g(R){return R===45?(t.consume(R),x):m(R)}function x(R){return R===62?q(R):R===45?g(R):m(R)}function y(R){const re="CDATA[";return R===re.charCodeAt(i++)?(t.consume(R),i===re.length?w:y):n(R)}function w(R){return R===null?n(R):R===93?(t.consume(R),b):it(R)?(a=w,J(R)):(t.consume(R),w)}function b(R){return R===93?(t.consume(R),k):w(R)}function k(R){return R===62?q(R):R===93?(t.consume(R),k):w(R)}function N(R){return R===null||R===62?q(R):it(R)?(a=N,J(R)):(t.consume(R),N)}function C(R){return R===null?n(R):R===63?(t.consume(R),T):it(R)?(a=C,J(R)):(t.consume(R),C)}function T(R){return R===62?q(R):C(R)}function E(R){return ws(R)?(t.consume(R),_):n(R)}function _(R){return R===45||fs(R)?(t.consume(R),_):A(R)}function A(R){return it(R)?(a=A,J(R)):Gt(R)?(t.consume(R),A):q(R)}function F(R){return R===45||fs(R)?(t.consume(R),F):R===47||R===62||$n(R)?B(R):n(R)}function B(R){return R===47?(t.consume(R),q):R===58||R===95||ws(R)?(t.consume(R),P):it(R)?(a=B,J(R)):Gt(R)?(t.consume(R),B):q(R)}function P(R){return R===45||R===46||R===58||R===95||fs(R)?(t.consume(R),P):H(R)}function H(R){return R===61?(t.consume(R),U):it(R)?(a=H,J(R)):Gt(R)?(t.consume(R),H):B(R)}function U(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,te):it(R)?(a=U,J(R)):Gt(R)?(t.consume(R),U):(t.consume(R),z)}function te(R){return R===s?(t.consume(R),s=void 0,W):R===null?n(R):it(R)?(a=te,J(R)):(t.consume(R),te)}function z(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||$n(R)?B(R):(t.consume(R),z)}function W(R){return R===47||R===62||$n(R)?B(R):n(R)}function q(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function J(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),ee}function ee(R){return Gt(R)?Ht(t,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):Y(R)}function Y(R){return t.enter("htmlTextData"),a(R)}}const k6={name:"labelEnd",resolveAll:sfe,resolveTo:ife,tokenize:afe},tfe={tokenize:lfe},nfe={tokenize:ofe},rfe={tokenize:cfe};function sfe(t){let e=-1;const n=[];for(;++e=3&&(h===null||it(h))?(t.exit("thematicBreak"),e(h)):n(h)}function u(h){return h===s?(t.consume(h),r++,u):(t.exit("thematicBreakSequence"),Gt(h)?Ht(t,o,"whitespace")(h):o(h))}}const Ps={continuation:{tokenize:yfe},exit:wfe,name:"list",tokenize:vfe},gfe={partial:!0,tokenize:Sfe},xfe={partial:!0,tokenize:bfe};function vfe(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(x){const y=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:tS(x)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(Px,n,h)(x):h(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),u(x)}return n(x)}function u(x){return tS(x)&&++a<10?(t.consume(x),u):(!r.interrupt||a<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),h(x)):n(x)}function h(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,t.check(T0,r.interrupt?n:f,t.attempt(gfe,g,m))}function f(x){return r.containerState.initialBlankLine=!0,i++,g(x)}function m(x){return Gt(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),g):n(x)}function g(x){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(x)}}function yfe(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(T0,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ht(t,e,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Gt(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(xfe,e,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ht(t,t.attempt(Ps,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function bfe(t,e,n){const r=this;return Ht(t,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(i):n(i)}}function wfe(t){t.exit(this.containerState.type)}function Sfe(t,e,n){const r=this;return Ht(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!Gt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const GT={name:"setextUnderline",resolveTo:kfe,tokenize:Ofe};function kfe(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",a,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function Ofe(t,e,n){const r=this;let s;return i;function i(h){let f=r.events.length,m;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){m=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),s=h,a(h)):n(h)}function a(h){return t.enter("setextHeadingLineSequence"),o(h)}function o(h){return h===s?(t.consume(h),o):(t.exit("setextHeadingLineSequence"),Gt(h)?Ht(t,u,"lineSuffix")(h):u(h))}function u(h){return h===null||it(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const jfe={tokenize:Nfe};function Nfe(t){const e=this,n=t.attempt(T0,r,t.attempt(this.parser.constructs.flowInitial,s,Ht(t,t.attempt(this.parser.constructs.flow,s,t.attempt(Mhe,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const Cfe={resolveAll:bq()},Tfe=yq("string"),Efe=yq("text");function yq(t){return{resolveAll:bq(t==="text"?_fe:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,a,o);return a;function a(f){return h(f)?i(f):o(f)}function o(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),u}function u(f){return h(f)?(n.exit("data"),i(f)):(n.consume(f),u)}function h(f){if(f===null)return!0;const m=s[f];let g=-1;if(m)for(;++g-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function Qfe(t,e){let n=-1;const r=[];let s;for(;++n0){const Vt=Le.tokenStack[Le.tokenStack.length-1];(Vt[1]||YT).call(Le,void 0,Vt[0])}for(Oe.position={start:_o(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:_o(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},Ot=-1;++Ot1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,u);const h={type:"element",tagName:"sup",properties:{},children:[u]};return t.patch(e,h),t.applyData(e,h)}function ame(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function lme(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function kq(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function ome(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return kq(t,e);const s={src:Ch(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function cme(t,e){const n={src:Ch(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function ume(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function dme(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return kq(t,e);const s={href:Ch(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function hme(t,e){const n={href:Ch(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function fme(t,e,n){const r=t.all(e),s=n?mme(n):Oq(e),i={},a=[];if(typeof e.checked=="boolean"){const f=r[0];let m;f&&f.type==="element"&&f.tagName==="p"?m=f:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o1}function pme(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},o=x6(e.children[1]),u=rq(e.children[e.children.length-1]);o&&u&&(a.position={start:o,end:u}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function bme(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:e.children.length;let u=-1;const h=[];for(;++u0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(JT(e.slice(s),s>0,!1)),i.join("")}function JT(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===ZT||i===KT;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===ZT||i===KT;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function kme(t,e){const n={type:"text",value:Sme(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Ome(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const jme={blockquote:eme,break:tme,code:nme,delete:rme,emphasis:sme,footnoteReference:ime,heading:ame,html:lme,imageReference:ome,image:cme,inlineCode:ume,linkReference:dme,link:hme,listItem:fme,list:pme,paragraph:gme,root:xme,strong:vme,table:yme,tableCell:wme,tableRow:bme,text:kme,thematicBreak:Ome,toml:Ug,yaml:Ug,definition:Ug,footnoteDefinition:Ug};function Ug(){}const jq=-1,Ev=0,fm=1,k1=2,O6=3,j6=4,N6=5,C6=6,Nq=7,Cq=8,eE=typeof self=="object"?self:globalThis,Nme=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,a]=e[s];switch(i){case Ev:case jq:return n(a,s);case fm:{const o=n([],s);for(const u of a)o.push(r(u));return o}case k1:{const o=n({},s);for(const[u,h]of a)o[r(u)]=r(h);return o}case O6:return n(new Date(a),s);case j6:{const{source:o,flags:u}=a;return n(new RegExp(o,u),s)}case N6:{const o=n(new Map,s);for(const[u,h]of a)o.set(r(u),r(h));return o}case C6:{const o=n(new Set,s);for(const u of a)o.add(r(u));return o}case Nq:{const{name:o,message:u}=a;return n(new eE[o](u),s)}case Cq:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(new eE[i](a),s)};return r},tE=t=>Nme(new Map,t)(0),ud="",{toString:Cme}={},{keys:Tme}=Object,If=t=>{const e=typeof t;if(e!=="object"||!t)return[Ev,e];const n=Cme.call(t).slice(8,-1);switch(n){case"Array":return[fm,ud];case"Object":return[k1,ud];case"Date":return[O6,ud];case"RegExp":return[j6,ud];case"Map":return[N6,ud];case"Set":return[C6,ud];case"DataView":return[fm,n]}return n.includes("Array")?[fm,n]:n.includes("Error")?[Nq,n]:[k1,n]},Wg=([t,e])=>t===Ev&&(e==="function"||e==="symbol"),Eme=(t,e,n,r)=>{const s=(a,o)=>{const u=r.push(a)-1;return n.set(o,u),u},i=a=>{if(n.has(a))return n.get(a);let[o,u]=If(a);switch(o){case Ev:{let f=a;switch(u){case"bigint":o=Cq,f=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+u);f=null;break;case"undefined":return s([jq],a)}return s([o,f],a)}case fm:{if(u){let g=a;return u==="DataView"?g=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(g=new Uint8Array(a)),s([u,[...g]],a)}const f=[],m=s([o,f],a);for(const g of a)f.push(i(g));return m}case k1:{if(u)switch(u){case"BigInt":return s([u,a.toString()],a);case"Boolean":case"Number":case"String":return s([u,a.valueOf()],a)}if(e&&"toJSON"in a)return i(a.toJSON());const f=[],m=s([o,f],a);for(const g of Tme(a))(t||!Wg(If(a[g])))&&f.push([i(g),i(a[g])]);return m}case O6:return s([o,a.toISOString()],a);case j6:{const{source:f,flags:m}=a;return s([o,{source:f,flags:m}],a)}case N6:{const f=[],m=s([o,f],a);for(const[g,x]of a)(t||!(Wg(If(g))||Wg(If(x))))&&f.push([i(g),i(x)]);return m}case C6:{const f=[],m=s([o,f],a);for(const g of a)(t||!Wg(If(g)))&&f.push(i(g));return m}}const{message:h}=a;return s([o,{name:u,message:h}],a)};return i},nE=(t,{json:e,lossy:n}={})=>{const r=[];return Eme(!(e||n),!!e,new Map,r)(t),r},O1=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?tE(nE(t,e)):structuredClone(t):(t,e)=>tE(nE(t,e));function _me(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function Mme(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Ame(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||_me,r=t.options.footnoteBackLabel||Mme,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let u=-1;for(;++u0&&y.push({type:"text",value:" "});let N=typeof n=="string"?n:n(u,x);typeof N=="string"&&(N={type:"text",value:N}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,x),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const b=f[f.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const N=b.children[b.children.length-1];N&&N.type==="text"?N.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...y)}else f.push(...y);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(f,!0)};t.patch(h,k),o.push(k)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...O1(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:t.wrap(o,!0)},{type:"text",value:` `}]}}const E0=(function(t){if(t==null)return Pme;if(typeof t=="function")return _v(t);if(typeof t=="object")return Array.isArray(t)?Rme(t):Dme(t);if(typeof t=="string")return zme(t);throw new Error("Expected function, string, or object as test")});function Rme(t){const e=[];let n=-1;for(;++n":""))+")"})}return g;function g(){let x=Tq,y,w,b;if((!e||i(u,h,f[f.length-1]||void 0))&&(x=Ime(n(u,f)),x[0]===rS))return x;if("children"in u&&u.children){const k=u;if(k.children&&x[0]!==Eq)for(w=(r?k.children.length:-1)+a,b=f.concat(k);w>-1&&w0&&n.push({type:"text",value:` `}),n}function rE(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function sE(t,e){const n=Fme(t,e),r=n.one(t,void 0),s=Ame(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` `},s),i}function Ume(t,e){return t&&"run"in t?async function(n,r){const s=sE(n,{file:r,...e});await t.run(s,r)}:function(n,r){return sE(n,{file:r,...t||e})}}function iE(t){if(t)throw t}var h4,aE;function Wme(){if(aE)return h4;aE=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},i=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var f=t.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!f&&!m)return!1;var g;for(g in h);return typeof g>"u"||t.call(h,g)},a=function(h,f){n&&f.name==="__proto__"?n(h,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):h[f.name]=f.newValue},o=function(h,f){if(f==="__proto__")if(t.call(h,f)){if(r)return r(h,f).value}else return;return h[f]};return h4=function u(){var h,f,m,g,x,y,w=arguments[0],b=1,k=arguments.length,N=!1;for(typeof w=="boolean"&&(N=w,w=arguments[1]||{},b=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});ba.length;let u;o&&a.push(s);try{u=t.apply(this,a)}catch(h){const f=h;if(o&&n)throw f;return s(f)}o||(u&&u.then&&typeof u.then=="function"?u.then(i,s):u instanceof Error?s(u):i(u))}function s(a,...o){n||(n=!0,e(a,...o))}function i(a){s(null,a)}}const Sa={basename:Zme,dirname:Kme,extname:Jme,join:e0e,sep:"/"};function Zme(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');_0(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,o=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(t.codePointAt(s)===e.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function Kme(t){if(_0(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Jme(t){_0(t);let e=t.length,n=-1,r=0,s=-1,i=0,a;for(;e--;){const o=t.codePointAt(e);if(o===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),o===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function e0e(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function n0e(t,e){let n="",r=0,s=-1,i=0,a=-1,o,u;for(;++a<=t.length;){if(a2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,a):n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return n}function _0(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const r0e={cwd:s0e};function s0e(){return"/"}function aS(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function i0e(t){if(typeof t=="string")t=new URL(t);else if(!aS(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return a0e(t)}function a0e(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[x,...y]=f;const w=r[g][1];iS(w)&&iS(x)&&(x=f4(!0,w,x)),r[g]=[h,x,...y]}}}}const u0e=new _6().freeze();function x4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function v4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function y4(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function oE(t){if(!iS(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function cE(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Gg(t){return d0e(t)?t:new _q(t)}function d0e(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function h0e(t){return typeof t=="string"||f0e(t)}function f0e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const m0e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",uE=[],dE={allowDangerousHtml:!0},p0e=/^(https?|ircs?|mailto|xmpp)$/i,g0e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function x0e(t){const e=v0e(t),n=y0e(t);return b0e(e.runSync(e.parse(n),n),t)}function v0e(t){const e=t.rehypePlugins||uE,n=t.remarkPlugins||uE,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...dE}:dE;return u0e().use(Jfe).use(n).use(Ume,r).use(e)}function y0e(t){const e=t.children||"",n=new _q;return typeof e=="string"&&(n.value=e),n}function b0e(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,o=e.unwrapDisallowed,u=e.urlTransform||w0e;for(const f of g0e)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+m0e+f.id,void 0);return E6(t,h),Pde(t,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(f,m,g){if(f.type==="raw"&&g&&typeof m=="number")return a?g.children.splice(m,1):g.children[m]={type:"text",value:f.value},m;if(f.type==="element"){let x;for(x in c4)if(Object.hasOwn(c4,x)&&Object.hasOwn(f.properties,x)){const y=f.properties[x],w=c4[x];(w===null||w.includes(f.tagName))&&(f.properties[x]=u(String(y||""),x,f))}}if(f.type==="element"){let x=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!x&&r&&typeof m=="number"&&(x=!r(f,m,g)),x&&g&&typeof m=="number")return o&&f.children?g.children.splice(m,1,...f.children):g.children.splice(m,1),m}}}function w0e(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||p0e.test(t.slice(0,e))?t:""}function hE(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function S0e(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function k0e(t,e,n){const s=E0((n||{}).ignore||[]),i=O0e(e);let a=-1;for(;++a0?{type:"text",value:_}:void 0),_===!1?g.lastIndex=T+1:(y!==T&&N.push({type:"text",value:h.value.slice(y,T)}),Array.isArray(_)?N.push(..._):_&&N.push(_),y=T+C[0].length,k=!0),!g.global)break;C=g.exec(h.value)}return k?(y?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=hE(t,"(");let i=hE(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function Mq(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||mu(n)||Cv(n))&&(!e||n!==47)}Aq.peek=W0e;function I0e(){this.buffer()}function q0e(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function F0e(){this.buffer()}function $0e(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function Q0e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ta(this.sliceSerialize(t)).toLowerCase(),n.label=e}function H0e(t){this.exit(t)}function V0e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ta(this.sliceSerialize(t)).toLowerCase(),n.label=e}function U0e(t){this.exit(t)}function W0e(){return"["}function Aq(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function G0e(){return{enter:{gfmFootnoteCallString:I0e,gfmFootnoteCall:q0e,gfmFootnoteDefinitionLabelString:F0e,gfmFootnoteDefinition:$0e},exit:{gfmFootnoteCallString:Q0e,gfmFootnoteCall:H0e,gfmFootnoteDefinitionLabelString:V0e,gfmFootnoteDefinition:U0e}}}function X0e(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:Aq},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const o=i.createTracker(a);let u=o.move("[^");const h=i.enter("footnoteDefinition"),f=i.enter("label");return u+=o.move(i.safe(i.associationId(r),{before:u,after:"]"})),f(),u+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),u+=o.move((e?` `:" ")+i.indentLines(i.containerFlow(r,o.current()),e?Rq:Y0e))),h(),u}}function Y0e(t,e,n){return e===0?t:Rq(t,e,n)}function Rq(t,e,n){return(n?"":" ")+t}const Z0e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Dq.peek=npe;function K0e(){return{canContainEols:["delete"],enter:{strikethrough:epe},exit:{strikethrough:tpe}}}function J0e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Z0e}],handlers:{delete:Dq}}}function epe(t){this.enter({type:"delete",children:[]},t)}function tpe(t){this.exit(t)}function Dq(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(t,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function npe(){return"~"}function rpe(t){return t.length}function spe(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||rpe,i=[],a=[],o=[],u=[];let h=0,f=-1;for(;++fh&&(h=t[f].length);++ku[k])&&(u[k]=C)}w.push(N)}a[f]=w,o[f]=b}let m=-1;if(typeof r=="object"&&"length"in r)for(;++mu[m]&&(u[m]=N),x[m]=N),g[m]=C}a.splice(1,0,g),o.splice(1,0,x),f=-1;const y=[];for(;++f "),i.shift(2);const a=n.indentLines(n.containerFlow(t,i.current()),lpe);return s(),a}function lpe(t,e,n){return">"+(n?"":" ")+t}function ope(t,e){return mE(t,e.inConstruct,!0)&&!mE(t,e.notInConstruct,!1)}function mE(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+e.length,r=n.indexOf(e,s);return a}function cpe(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function upe(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function dpe(t,e,n,r){const s=upe(n),i=t.value||"",a=s==="`"?"GraveAccent":"Tilde";if(cpe(t,n)){const m=n.enter("codeIndented"),g=n.indentLines(i,hpe);return m(),g}const o=n.createTracker(r),u=s.repeat(Math.max(zq(i,s)+1,3)),h=n.enter("codeFenced");let f=o.move(u);if(t.lang){const m=n.enter(`codeFencedLang${a}`);f+=o.move(n.safe(t.lang,{before:f,after:" ",encode:["`"],...o.current()})),m()}if(t.lang&&t.meta){const m=n.enter(`codeFencedMeta${a}`);f+=o.move(" "),f+=o.move(n.safe(t.meta,{before:f,after:` `,encode:["`"],...o.current()})),m()}return f+=o.move(` `),i&&(f+=o.move(i+` `)),f+=o.move(u),h(),f}function hpe(t,e,n){return(n?"":" ")+t}function M6(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function fpe(t,e,n,r){const s=M6(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const u=n.createTracker(r);let h=u.move("[");return h+=u.move(n.safe(n.associationId(t),{before:h,after:"]",...u.current()})),h+=u.move("]: "),o(),!t.url||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),h+=u.move("<"),h+=u.move(n.safe(t.url,{before:h,after:">",...u.current()})),h+=u.move(">")):(o=n.enter("destinationRaw"),h+=u.move(n.safe(t.url,{before:h,after:t.title?" ":` `,...u.current()}))),o(),t.title&&(o=n.enter(`title${i}`),h+=u.move(" "+s),h+=u.move(n.safe(t.title,{before:h,after:s,...u.current()})),h+=u.move(s),o()),a(),h}function mpe(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Qm(t){return"&#x"+t.toString(16).toUpperCase()+";"}function j1(t,e,n){const r=ch(t),s=ch(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Pq.peek=ppe;function Pq(t,e,n,r){const s=mpe(n),i=n.enter("emphasis"),a=n.createTracker(r),o=a.move(s);let u=a.move(n.containerPhrasing(t,{after:s,before:o,...a.current()}));const h=u.charCodeAt(0),f=j1(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(u=Qm(h)+u.slice(1));const m=u.charCodeAt(u.length-1),g=j1(r.after.charCodeAt(0),m,s);g.inside&&(u=u.slice(0,-1)+Qm(m));const x=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},o+u+x}function ppe(t,e,n){return n.options.emphasis||"*"}function gpe(t,e){let n=!1;return E6(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,rS}),!!((!t.depth||t.depth<3)&&w6(t)&&(e.options.setext||n))}function xpe(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(gpe(t,n)){const f=n.enter("headingSetext"),m=n.enter("phrasing"),g=n.containerPhrasing(t,{...i.current(),before:` `,after:` `});return m(),f(),g+` `+(s===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(` `))+1))}const a="#".repeat(s),o=n.enter("headingAtx"),u=n.enter("phrasing");i.move(a+" ");let h=n.containerPhrasing(t,{before:"# ",after:` `,...i.current()});return/^[\t ]/.test(h)&&(h=Qm(h.charCodeAt(0))+h.slice(1)),h=h?a+" "+h:a,n.options.closeAtx&&(h+=" "+a),u(),o(),h}Lq.peek=vpe;function Lq(t){return t.value||""}function vpe(){return"<"}Bq.peek=ype;function Bq(t,e,n,r){const s=M6(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const u=n.createTracker(r);let h=u.move("![");return h+=u.move(n.safe(t.alt,{before:h,after:"]",...u.current()})),h+=u.move("]("),o(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),h+=u.move("<"),h+=u.move(n.safe(t.url,{before:h,after:">",...u.current()})),h+=u.move(">")):(o=n.enter("destinationRaw"),h+=u.move(n.safe(t.url,{before:h,after:t.title?" ":")",...u.current()}))),o(),t.title&&(o=n.enter(`title${i}`),h+=u.move(" "+s),h+=u.move(n.safe(t.title,{before:h,after:s,...u.current()})),h+=u.move(s),o()),h+=u.move(")"),a(),h}function ype(){return"!"}Iq.peek=bpe;function Iq(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let u=o.move("![");const h=n.safe(t.alt,{before:u,after:"]",...o.current()});u+=o.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:u,after:"]",...o.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?u+=o.move(m+"]"):s==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function bpe(){return"!"}qq.peek=wpe;function qq(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(t.url))}$q.peek=Spe;function $q(t,e,n,r){const s=M6(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,u;if(Fq(t,n)){const f=n.stack;n.stack=[],o=n.enter("autolink");let m=a.move("<");return m+=a.move(n.containerPhrasing(t,{before:m,after:">",...a.current()})),m+=a.move(">"),o(),n.stack=f,m}o=n.enter("link"),u=n.enter("label");let h=a.move("[");return h+=a.move(n.containerPhrasing(t,{before:h,after:"](",...a.current()})),h+=a.move("]("),u(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(u=n.enter("destinationLiteral"),h+=a.move("<"),h+=a.move(n.safe(t.url,{before:h,after:">",...a.current()})),h+=a.move(">")):(u=n.enter("destinationRaw"),h+=a.move(n.safe(t.url,{before:h,after:t.title?" ":")",...a.current()}))),u(),t.title&&(u=n.enter(`title${i}`),h+=a.move(" "+s),h+=a.move(n.safe(t.title,{before:h,after:s,...a.current()})),h+=a.move(s),u()),h+=a.move(")"),o(),h}function Spe(t,e,n){return Fq(t,n)?"<":"["}Qq.peek=kpe;function Qq(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let u=o.move("[");const h=n.containerPhrasing(t,{before:u,after:"]",...o.current()});u+=o.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:u,after:"]",...o.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?u+=o.move(m+"]"):s==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function kpe(){return"["}function A6(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function Ope(t){const e=A6(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function jpe(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function Hq(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function Npe(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=t.ordered?jpe(n):A6(n);const o=t.ordered?a==="."?")":".":Ope(n);let u=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const f=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&f&&(!f.children||!f.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),Hq(n)===a&&f){let m=-1;for(;++m-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const u=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,o.current()),f);return u(),h;function f(m,g,x){return g?(x?"":" ".repeat(a))+m:(x?i:i+" ".repeat(a-i.length))+m}}function Epe(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(t,r);return i(),s(),a}const _pe=E0(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Mpe(t,e,n,r){return(t.children.some(function(a){return _pe(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function Ape(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Vq.peek=Rpe;function Vq(t,e,n,r){const s=Ape(n),i=n.enter("strong"),a=n.createTracker(r),o=a.move(s+s);let u=a.move(n.containerPhrasing(t,{after:s,before:o,...a.current()}));const h=u.charCodeAt(0),f=j1(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(u=Qm(h)+u.slice(1));const m=u.charCodeAt(u.length-1),g=j1(r.after.charCodeAt(0),m,s);g.inside&&(u=u.slice(0,-1)+Qm(m));const x=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},o+u+x}function Rpe(t,e,n){return n.options.strong||"*"}function Dpe(t,e,n,r){return n.safe(t.value,r)}function zpe(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function Ppe(t,e,n){const r=(Hq(n)+(n.options.ruleSpaces?" ":"")).repeat(zpe(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Uq={blockquote:ape,break:pE,code:dpe,definition:fpe,emphasis:Pq,hardBreak:pE,heading:xpe,html:Lq,image:Bq,imageReference:Iq,inlineCode:qq,link:$q,linkReference:Qq,list:Npe,listItem:Tpe,paragraph:Epe,root:Mpe,strong:Vq,text:Dpe,thematicBreak:Ppe};function Lpe(){return{enter:{table:Bpe,tableData:gE,tableHeader:gE,tableRow:qpe},exit:{codeText:Fpe,table:Ipe,tableData:k4,tableHeader:k4,tableRow:k4}}}function Bpe(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function Ipe(t){this.exit(t),this.data.inTable=void 0}function qpe(t){this.enter({type:"tableRow",children:[]},t)}function k4(t){this.exit(t)}function gE(t){this.enter({type:"tableCell",children:[]},t)}function Fpe(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,$pe));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function $pe(t,e){return e==="|"?e:t}function Qpe(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:u,tableRow:o}};function a(x,y,w,b){return h(f(x,w,b),x.align)}function o(x,y,w,b){const k=m(x,w,b),N=h([k]);return N.slice(0,N.indexOf(` `))}function u(x,y,w,b){const k=w.enter("tableCell"),N=w.enter("phrasing"),C=w.containerPhrasing(x,{...b,before:i,after:i});return N(),k(),C}function h(x,y){return spe(x,{align:y,alignDelimiters:r,padding:n,stringLength:s})}function f(x,y,w){const b=x.children;let k=-1;const N=[],C=y.enter("table");for(;++k0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const lge={tokenize:pge,partial:!0};function oge(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:hge,continuation:{tokenize:fge},exit:mge}},text:{91:{name:"gfmFootnoteCall",tokenize:dge},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:cge,resolveTo:uge}}}}function cge(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const u=r.events[s][1];if(u.type==="labelImage"){a=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return o;function o(u){if(!a||!a._balanced)return n(u);const h=ta(r.sliceSerialize({start:a.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(u):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(u),t.exit("gfmFootnoteCallLabelMarker"),e(u))}}function uge(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...o),t}function dge(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(m){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),u}function u(m){return m!==94?n(m):(t.enter("gfmFootnoteCallMarker"),t.consume(m),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(m){if(i>999||m===93&&!a||m===null||m===91||$n(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return s.includes(ta(r.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return $n(m)||(a=!0),i++,t.consume(m),m===92?f:h}function f(m){return m===91||m===92||m===93?(t.consume(m),i++,h):h(m)}}function hge(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return u;function u(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(y)}function f(y){if(a>999||y===93&&!o||y===null||y===91||$n(y))return n(y);if(y===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return i=ta(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return $n(y)||(o=!0),a++,t.consume(y),y===92?m:f}function m(y){return y===91||y===92||y===93?(t.consume(y),a++,f):f(y)}function g(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),s.includes(i)||s.push(i),Ht(t,x,"gfmFootnoteDefinitionWhitespace")):n(y)}function x(y){return e(y)}}function fge(t,e,n){return t.check(T0,e,t.attempt(lge,e,n))}function mge(t){t.exit("gfmFootnoteDefinition")}function pge(t,e,n){const r=this;return Ht(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):n(i)}}function gge(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let u=-1;for(;++u1?u(y):(a.consume(y),m++,x);if(m<2&&!n)return u(y);const b=a.exit("strikethroughSequenceTemporary"),k=ch(y);return b._open=!k||k===2&&!!w,b._close=!w||w===2&&!!k,o(y)}}}class xge{constructor(){this.map=[]}add(e,n,r){vge(this,e,n,r)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function vge(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const z=r.events[H][1].type;if(z==="lineEnding"||z==="linePrefix")H--;else break}const U=H>-1?r.events[H][1].type:null,te=U==="tableHead"||U==="tableRow"?_:u;return te===_&&r.parser.lazy[r.now().line]?n(P):te(P)}function u(P){return t.enter("tableHead"),t.enter("tableRow"),h(P)}function h(P){return P===124||(a=!0,i+=1),f(P)}function f(P){return P===null?n(P):it(P)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),x):n(P):Gt(P)?Ht(t,f,"whitespace")(P):(i+=1,a&&(a=!1,s+=1),P===124?(t.enter("tableCellDivider"),t.consume(P),t.exit("tableCellDivider"),a=!0,f):(t.enter("data"),m(P)))}function m(P){return P===null||P===124||$n(P)?(t.exit("data"),f(P)):(t.consume(P),P===92?g:m)}function g(P){return P===92||P===124?(t.consume(P),m):m(P)}function x(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(P):(t.enter("tableDelimiterRow"),a=!1,Gt(P)?Ht(t,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):y(P))}function y(P){return P===45||P===58?b(P):P===124?(a=!0,t.enter("tableCellDivider"),t.consume(P),t.exit("tableCellDivider"),w):E(P)}function w(P){return Gt(P)?Ht(t,b,"whitespace")(P):b(P)}function b(P){return P===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(P),t.exit("tableDelimiterMarker"),k):P===45?(i+=1,k(P)):P===null||it(P)?T(P):E(P)}function k(P){return P===45?(t.enter("tableDelimiterFiller"),N(P)):E(P)}function N(P){return P===45?(t.consume(P),N):P===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(P),t.exit("tableDelimiterMarker"),C):(t.exit("tableDelimiterFiller"),C(P))}function C(P){return Gt(P)?Ht(t,T,"whitespace")(P):T(P)}function T(P){return P===124?y(P):P===null||it(P)?!a||s!==i?E(P):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(P)):E(P)}function E(P){return n(P)}function _(P){return t.enter("tableRow"),A(P)}function A(P){return P===124?(t.enter("tableCellDivider"),t.consume(P),t.exit("tableCellDivider"),A):P===null||it(P)?(t.exit("tableRow"),e(P)):Gt(P)?Ht(t,A,"whitespace")(P):(t.enter("data"),F(P))}function F(P){return P===null||P===124||$n(P)?(t.exit("data"),A(P)):(t.consume(P),P===92?B:F)}function B(P){return P===92||P===124?(t.consume(P),F):F(P)}}function Sge(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,u=0,h,f,m;const g=new xge;for(;++nn[2]+1){const y=n[2]+1,w=n[3]-n[2]-1;t.add(y,w,[])}}t.add(n[3]+1,0,[["exit",m,e]])}return s!==void 0&&(i.end=Object.assign({},Nd(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function vE(t,e,n,r,s){const i=[],a=Nd(e.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,e])),r.end=Object.assign({},a),i.push(["exit",r,e]),t.add(n+1,0,i)}function Nd(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const kge={name:"tasklistCheck",tokenize:jge};function Oge(){return{text:{91:kge}}}function jge(t,e,n){const r=this;return s;function s(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(u),t.exit("taskListCheckMarker"),i)}function i(u){return $n(u)?(t.enter("taskListCheckValueUnchecked"),t.consume(u),t.exit("taskListCheckValueUnchecked"),a):u===88||u===120?(t.enter("taskListCheckValueChecked"),t.consume(u),t.exit("taskListCheckValueChecked"),a):n(u)}function a(u){return u===93?(t.enter("taskListCheckMarker"),t.consume(u),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),o):n(u)}function o(u){return it(u)?e(u):Gt(u)?t.check({tokenize:Nge},e,n)(u):n(u)}}function Nge(t,e,n){return Ht(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function Cge(t){return uq([Kpe(),oge(),gge(t),bge(),Oge()])}const Tge={};function Ege(t){const e=this,n=t||Tge,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(Cge(n)),i.push(Gpe()),a.push(Xpe(n))}function _ge(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:o,mathText:a,mathTextData:o}};function t(u){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},u)}function e(){this.buffer()}function n(){const u=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=u}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(u){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),f=this.stack[this.stack.length-1];f.type,this.exit(u),f.value=h;const m=f.data.hChildren[0];m.type,m.tagName,m.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(u){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},u),this.buffer()}function a(u){const h=this.resume(),f=this.stack[this.stack.length-1];f.type,this.exit(u),f.value=h,f.data.hChildren.push({type:"text",value:h})}function o(u){this.config.enter.data.call(this,u),this.config.exit.data.call(this,u)}}function Mge(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` `,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,a,o,u){const h=i.value||"",f=o.createTracker(u),m="$".repeat(Math.max(zq(h,"$")+1,2)),g=o.enter("mathFlow");let x=f.move(m);if(i.meta){const y=o.enter("mathFlowMeta");x+=f.move(o.safe(i.meta,{after:` `,before:x,encode:["$"],...f.current()})),y()}return x+=f.move(` `),h&&(x+=f.move(h+` `)),x+=f.move(m),g(),x}function r(i,a,o){let u=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(u);)h++;const f="$".repeat(h);/[^ \r\n]/.test(u)&&(/^[ \r\n]/.test(u)&&/[ \r\n]$/.test(u)||/^\$|\$$/.test(u))&&(u=" "+u+" ");let m=-1;for(;++m15?h="…"+o.slice(s-15,s):h=o.slice(0,s);var f;i+15":">","<":"<",'"':""","'":"'"},Qge=/[&><"']/g;function Hge(t){return String(t).replace(Qge,e=>$ge[e])}var tF=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},Vge=function(e){var n=tF(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Uge=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Wge=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},bn={deflt:Ige,escape:Hge,hyphenate:Fge,getBaseElem:tF,isCharacterBox:Vge,protocolFromUrl:Wge},Lx={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Gge(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class D6{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n in Lx)if(Lx.hasOwnProperty(n)){var r=Lx[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Gge(r)}}reportNonstrict(e,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new Be("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var s=this.strict;if(typeof s=="function")try{s=s(e,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=bn.protocolFromUrl(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Mo{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return Oa[Xge[this.id]]}sub(){return Oa[Yge[this.id]]}fracNum(){return Oa[Zge[this.id]]}fracDen(){return Oa[Kge[this.id]]}cramp(){return Oa[Jge[this.id]]}text(){return Oa[exe[this.id]]}isTight(){return this.size>=2}}var z6=0,N1=1,Qd=2,Pl=3,Hm=4,zi=5,uh=6,Ss=7,Oa=[new Mo(z6,0,!1),new Mo(N1,0,!0),new Mo(Qd,1,!1),new Mo(Pl,1,!0),new Mo(Hm,2,!1),new Mo(zi,2,!0),new Mo(uh,3,!1),new Mo(Ss,3,!0)],Xge=[Hm,zi,Hm,zi,uh,Ss,uh,Ss],Yge=[zi,zi,zi,zi,Ss,Ss,Ss,Ss],Zge=[Qd,Pl,Hm,zi,uh,Ss,uh,Ss],Kge=[Pl,Pl,zi,zi,Ss,Ss,Ss,Ss],Jge=[N1,N1,Pl,Pl,zi,zi,Ss,Ss],exe=[z6,N1,Qd,Pl,Qd,Pl,Qd,Pl],xt={DISPLAY:Oa[z6],TEXT:Oa[Qd],SCRIPT:Oa[Hm],SCRIPTSCRIPT:Oa[uh]},oS=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function txe(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var Bx=[];oS.forEach(t=>t.blocks.forEach(e=>Bx.push(...e)));function nF(t){for(var e=0;e=Bx[e]&&t<=Bx[e+1])return!0;return!1}var dd=80,nxe=function(e,n){return"M95,"+(622+e+n)+` c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 c69,-144,104.5,-217.7,106.5,-221 l`+e/2.075+" -"+e+` c5.3,-9.3,12,-14,20,-14 H400000v`+(40+e)+`H845.2724 s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},rxe=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119 c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 c340,-704.7,510.7,-1060.3,512,-1067 l`+e/2.084+" -"+e+` c4.7,-7.3,11,-11,19,-11 H40000v`+(40+e)+`H1012.3 s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},sxe=function(e,n){return"M983 "+(10+e+n)+` l`+e/3.13+" -"+e+` c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+` H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 c53.7,-170.3,84.5,-266.8,92.5,-289.5z M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},ixe=function(e,n){return"M424,"+(2398+e+n)+` c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000 v`+(40+e)+`H1014.6 s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+n+` h400000v`+(40+e)+"h-400000z"},axe=function(e,n){return"M473,"+(2713+e+n)+` c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+` c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7 s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, 606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},lxe=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},oxe=function(e,n,r){var s=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+` H742v`+s+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},cxe=function(e,n,r){n=1e3*n;var s="";switch(e){case"sqrtMain":s=nxe(n,dd);break;case"sqrtSize1":s=rxe(n,dd);break;case"sqrtSize2":s=sxe(n,dd);break;case"sqrtSize3":s=ixe(n,dd);break;case"sqrtSize4":s=axe(n,dd);break;case"sqrtTall":s=oxe(n,dd,r)}return s},uxe=function(e,n){switch(e){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},bE={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`,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`,tilde1:`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`,tilde2:`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`,tilde3:`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`,tilde4:`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`},dxe=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 H403z M403 1759 V0 H319 V1759 v`+n+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, -36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, 949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, -544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, -210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, 63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+` c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class M0{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var Ra={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],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:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],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:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],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:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],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:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],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:[0,.44444,0,0,.63889],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:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],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:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],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:[0,.68611,.17208,0,.8961],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:[0,.69444,.06709,0,.59111],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:[.19444,.44444,.105,0,.53222],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:[.19444,.44444,.105,0,.53222],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:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],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:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],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:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],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:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],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:[0,.68333,.16389,0,.74333],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:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],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:[0,.68333,.16389,0,.74333],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:[0,.69444,.06646,0,.51111],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:[.19444,.43056,.08847,0,.46],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:[.19444,.43056,.08847,0,.46],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:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],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:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],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:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],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:[0,.43056,0,0,.55556],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:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],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:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],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:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],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:[0,.69444,0,0,.66759],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:[0,.44444,0,0,.58472],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:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],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:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],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:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],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:[0,.68333,.08125,.05556,.83125],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:[0,.68333,.02778,.08334,.76278],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:[0,.43056,0,.05556,.48472],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:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],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:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],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:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],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:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],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:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],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:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],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:[0,.69444,.07816,0,.27778],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:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],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:[0,.69444,0,0,.66667],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:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],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:[0,.69444,.0799,0,.5],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:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],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:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],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:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],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:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],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:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Yg={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],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:[.25,.25,.25],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],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},wE={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function hxe(t,e){Ra[t]=e}function P6(t,e,n){if(!Ra[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=Ra[e][r];if(!s&&t[0]in wE&&(r=wE[t[0]].charCodeAt(0),s=Ra[e][r]),!s&&n==="text"&&nF(r)&&(s=Ra[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var O4={};function fxe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!O4[e]){var n=O4[e]={cssEmPerMu:Yg.quad[e]/18};for(var r in Yg)Yg.hasOwnProperty(r)&&(n[r]=Yg[r][e])}return O4[e]}var mxe=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],SE=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],kE=function(e,n){return n.size<2?e:mxe[e-1][n.size-1]};class Tl{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||Tl.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=SE[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new Tl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:kE(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:SE[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=kE(Tl.BASESIZE,e);return this.size===n&&this.textSize===Tl.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Tl.BASESIZE?["sizing","reset-size"+this.size,"size"+Tl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=fxe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Tl.BASESIZE=6;var cS={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},pxe={ex:!0,em:!0,mu:!0},rF=function(e){return typeof e!="string"&&(e=e.unit),e in cS||e in pxe||e==="ex"},ar=function(e,n){var r;if(e.unit in cS)r=cS[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new Be("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},$e=function(e){return+e.toFixed(4)+"em"},tc=function(e){return e.filter(n=>n).join(" ")},sF=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},iF=function(e){var n=document.createElement(e);n.className=tc(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,aF=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+bn.escape(tc(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=bn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+bn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(gxe.test(i))throw new Be("Invalid attribute name '"+i+"'");n+=" "+i+'="'+bn.escape(this.attributes[i])+'"'}n+=">";for(var a=0;a",n};class A0{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,sF.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return iF.call(this,"span")}toMarkup(){return aF.call(this,"span")}}class L6{constructor(e,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,sF.call(this,n,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return iF.call(this,"a")}toMarkup(){return aF.call(this,"a")}}class xxe{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e=''+bn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=$e(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=tc(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=bn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+bn.escape(r)+'"');var i=bn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class Vl{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class uS{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var bxe={bin:1,close:1,inner:1,open:1,punct:1,rel:1},wxe={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Un={math:{},text:{}};function M(t,e,n,r,s,i){Un[t][s]={font:e,group:n,replace:r},i&&r&&(Un[t][r]=Un[t][s])}var D="math",De="text",V="main",ie="ams",er="accent-token",Ze="bin",Ts="close",Th="inner",pt="mathord",Rr="op-token",xi="open",Mv="punct",ae="rel",Kl="spacing",me="textord";M(D,V,ae,"≡","\\equiv",!0);M(D,V,ae,"≺","\\prec",!0);M(D,V,ae,"≻","\\succ",!0);M(D,V,ae,"∼","\\sim",!0);M(D,V,ae,"⊥","\\perp");M(D,V,ae,"⪯","\\preceq",!0);M(D,V,ae,"⪰","\\succeq",!0);M(D,V,ae,"≃","\\simeq",!0);M(D,V,ae,"∣","\\mid",!0);M(D,V,ae,"≪","\\ll",!0);M(D,V,ae,"≫","\\gg",!0);M(D,V,ae,"≍","\\asymp",!0);M(D,V,ae,"∥","\\parallel");M(D,V,ae,"⋈","\\bowtie",!0);M(D,V,ae,"⌣","\\smile",!0);M(D,V,ae,"⊑","\\sqsubseteq",!0);M(D,V,ae,"⊒","\\sqsupseteq",!0);M(D,V,ae,"≐","\\doteq",!0);M(D,V,ae,"⌢","\\frown",!0);M(D,V,ae,"∋","\\ni",!0);M(D,V,ae,"∝","\\propto",!0);M(D,V,ae,"⊢","\\vdash",!0);M(D,V,ae,"⊣","\\dashv",!0);M(D,V,ae,"∋","\\owns");M(D,V,Mv,".","\\ldotp");M(D,V,Mv,"⋅","\\cdotp");M(D,V,me,"#","\\#");M(De,V,me,"#","\\#");M(D,V,me,"&","\\&");M(De,V,me,"&","\\&");M(D,V,me,"ℵ","\\aleph",!0);M(D,V,me,"∀","\\forall",!0);M(D,V,me,"ℏ","\\hbar",!0);M(D,V,me,"∃","\\exists",!0);M(D,V,me,"∇","\\nabla",!0);M(D,V,me,"♭","\\flat",!0);M(D,V,me,"ℓ","\\ell",!0);M(D,V,me,"♮","\\natural",!0);M(D,V,me,"♣","\\clubsuit",!0);M(D,V,me,"℘","\\wp",!0);M(D,V,me,"♯","\\sharp",!0);M(D,V,me,"♢","\\diamondsuit",!0);M(D,V,me,"ℜ","\\Re",!0);M(D,V,me,"♡","\\heartsuit",!0);M(D,V,me,"ℑ","\\Im",!0);M(D,V,me,"♠","\\spadesuit",!0);M(D,V,me,"§","\\S",!0);M(De,V,me,"§","\\S");M(D,V,me,"¶","\\P",!0);M(De,V,me,"¶","\\P");M(D,V,me,"†","\\dag");M(De,V,me,"†","\\dag");M(De,V,me,"†","\\textdagger");M(D,V,me,"‡","\\ddag");M(De,V,me,"‡","\\ddag");M(De,V,me,"‡","\\textdaggerdbl");M(D,V,Ts,"⎱","\\rmoustache",!0);M(D,V,xi,"⎰","\\lmoustache",!0);M(D,V,Ts,"⟯","\\rgroup",!0);M(D,V,xi,"⟮","\\lgroup",!0);M(D,V,Ze,"∓","\\mp",!0);M(D,V,Ze,"⊖","\\ominus",!0);M(D,V,Ze,"⊎","\\uplus",!0);M(D,V,Ze,"⊓","\\sqcap",!0);M(D,V,Ze,"∗","\\ast");M(D,V,Ze,"⊔","\\sqcup",!0);M(D,V,Ze,"◯","\\bigcirc",!0);M(D,V,Ze,"∙","\\bullet",!0);M(D,V,Ze,"‡","\\ddagger");M(D,V,Ze,"≀","\\wr",!0);M(D,V,Ze,"⨿","\\amalg");M(D,V,Ze,"&","\\And");M(D,V,ae,"⟵","\\longleftarrow",!0);M(D,V,ae,"⇐","\\Leftarrow",!0);M(D,V,ae,"⟸","\\Longleftarrow",!0);M(D,V,ae,"⟶","\\longrightarrow",!0);M(D,V,ae,"⇒","\\Rightarrow",!0);M(D,V,ae,"⟹","\\Longrightarrow",!0);M(D,V,ae,"↔","\\leftrightarrow",!0);M(D,V,ae,"⟷","\\longleftrightarrow",!0);M(D,V,ae,"⇔","\\Leftrightarrow",!0);M(D,V,ae,"⟺","\\Longleftrightarrow",!0);M(D,V,ae,"↦","\\mapsto",!0);M(D,V,ae,"⟼","\\longmapsto",!0);M(D,V,ae,"↗","\\nearrow",!0);M(D,V,ae,"↩","\\hookleftarrow",!0);M(D,V,ae,"↪","\\hookrightarrow",!0);M(D,V,ae,"↘","\\searrow",!0);M(D,V,ae,"↼","\\leftharpoonup",!0);M(D,V,ae,"⇀","\\rightharpoonup",!0);M(D,V,ae,"↙","\\swarrow",!0);M(D,V,ae,"↽","\\leftharpoondown",!0);M(D,V,ae,"⇁","\\rightharpoondown",!0);M(D,V,ae,"↖","\\nwarrow",!0);M(D,V,ae,"⇌","\\rightleftharpoons",!0);M(D,ie,ae,"≮","\\nless",!0);M(D,ie,ae,"","\\@nleqslant");M(D,ie,ae,"","\\@nleqq");M(D,ie,ae,"⪇","\\lneq",!0);M(D,ie,ae,"≨","\\lneqq",!0);M(D,ie,ae,"","\\@lvertneqq");M(D,ie,ae,"⋦","\\lnsim",!0);M(D,ie,ae,"⪉","\\lnapprox",!0);M(D,ie,ae,"⊀","\\nprec",!0);M(D,ie,ae,"⋠","\\npreceq",!0);M(D,ie,ae,"⋨","\\precnsim",!0);M(D,ie,ae,"⪹","\\precnapprox",!0);M(D,ie,ae,"≁","\\nsim",!0);M(D,ie,ae,"","\\@nshortmid");M(D,ie,ae,"∤","\\nmid",!0);M(D,ie,ae,"⊬","\\nvdash",!0);M(D,ie,ae,"⊭","\\nvDash",!0);M(D,ie,ae,"⋪","\\ntriangleleft");M(D,ie,ae,"⋬","\\ntrianglelefteq",!0);M(D,ie,ae,"⊊","\\subsetneq",!0);M(D,ie,ae,"","\\@varsubsetneq");M(D,ie,ae,"⫋","\\subsetneqq",!0);M(D,ie,ae,"","\\@varsubsetneqq");M(D,ie,ae,"≯","\\ngtr",!0);M(D,ie,ae,"","\\@ngeqslant");M(D,ie,ae,"","\\@ngeqq");M(D,ie,ae,"⪈","\\gneq",!0);M(D,ie,ae,"≩","\\gneqq",!0);M(D,ie,ae,"","\\@gvertneqq");M(D,ie,ae,"⋧","\\gnsim",!0);M(D,ie,ae,"⪊","\\gnapprox",!0);M(D,ie,ae,"⊁","\\nsucc",!0);M(D,ie,ae,"⋡","\\nsucceq",!0);M(D,ie,ae,"⋩","\\succnsim",!0);M(D,ie,ae,"⪺","\\succnapprox",!0);M(D,ie,ae,"≆","\\ncong",!0);M(D,ie,ae,"","\\@nshortparallel");M(D,ie,ae,"∦","\\nparallel",!0);M(D,ie,ae,"⊯","\\nVDash",!0);M(D,ie,ae,"⋫","\\ntriangleright");M(D,ie,ae,"⋭","\\ntrianglerighteq",!0);M(D,ie,ae,"","\\@nsupseteqq");M(D,ie,ae,"⊋","\\supsetneq",!0);M(D,ie,ae,"","\\@varsupsetneq");M(D,ie,ae,"⫌","\\supsetneqq",!0);M(D,ie,ae,"","\\@varsupsetneqq");M(D,ie,ae,"⊮","\\nVdash",!0);M(D,ie,ae,"⪵","\\precneqq",!0);M(D,ie,ae,"⪶","\\succneqq",!0);M(D,ie,ae,"","\\@nsubseteqq");M(D,ie,Ze,"⊴","\\unlhd");M(D,ie,Ze,"⊵","\\unrhd");M(D,ie,ae,"↚","\\nleftarrow",!0);M(D,ie,ae,"↛","\\nrightarrow",!0);M(D,ie,ae,"⇍","\\nLeftarrow",!0);M(D,ie,ae,"⇏","\\nRightarrow",!0);M(D,ie,ae,"↮","\\nleftrightarrow",!0);M(D,ie,ae,"⇎","\\nLeftrightarrow",!0);M(D,ie,ae,"△","\\vartriangle");M(D,ie,me,"ℏ","\\hslash");M(D,ie,me,"▽","\\triangledown");M(D,ie,me,"◊","\\lozenge");M(D,ie,me,"Ⓢ","\\circledS");M(D,ie,me,"®","\\circledR");M(De,ie,me,"®","\\circledR");M(D,ie,me,"∡","\\measuredangle",!0);M(D,ie,me,"∄","\\nexists");M(D,ie,me,"℧","\\mho");M(D,ie,me,"Ⅎ","\\Finv",!0);M(D,ie,me,"⅁","\\Game",!0);M(D,ie,me,"‵","\\backprime");M(D,ie,me,"▲","\\blacktriangle");M(D,ie,me,"▼","\\blacktriangledown");M(D,ie,me,"■","\\blacksquare");M(D,ie,me,"⧫","\\blacklozenge");M(D,ie,me,"★","\\bigstar");M(D,ie,me,"∢","\\sphericalangle",!0);M(D,ie,me,"∁","\\complement",!0);M(D,ie,me,"ð","\\eth",!0);M(De,V,me,"ð","ð");M(D,ie,me,"╱","\\diagup");M(D,ie,me,"╲","\\diagdown");M(D,ie,me,"□","\\square");M(D,ie,me,"□","\\Box");M(D,ie,me,"◊","\\Diamond");M(D,ie,me,"¥","\\yen",!0);M(De,ie,me,"¥","\\yen",!0);M(D,ie,me,"✓","\\checkmark",!0);M(De,ie,me,"✓","\\checkmark");M(D,ie,me,"ℶ","\\beth",!0);M(D,ie,me,"ℸ","\\daleth",!0);M(D,ie,me,"ℷ","\\gimel",!0);M(D,ie,me,"ϝ","\\digamma",!0);M(D,ie,me,"ϰ","\\varkappa");M(D,ie,xi,"┌","\\@ulcorner",!0);M(D,ie,Ts,"┐","\\@urcorner",!0);M(D,ie,xi,"└","\\@llcorner",!0);M(D,ie,Ts,"┘","\\@lrcorner",!0);M(D,ie,ae,"≦","\\leqq",!0);M(D,ie,ae,"⩽","\\leqslant",!0);M(D,ie,ae,"⪕","\\eqslantless",!0);M(D,ie,ae,"≲","\\lesssim",!0);M(D,ie,ae,"⪅","\\lessapprox",!0);M(D,ie,ae,"≊","\\approxeq",!0);M(D,ie,Ze,"⋖","\\lessdot");M(D,ie,ae,"⋘","\\lll",!0);M(D,ie,ae,"≶","\\lessgtr",!0);M(D,ie,ae,"⋚","\\lesseqgtr",!0);M(D,ie,ae,"⪋","\\lesseqqgtr",!0);M(D,ie,ae,"≑","\\doteqdot");M(D,ie,ae,"≓","\\risingdotseq",!0);M(D,ie,ae,"≒","\\fallingdotseq",!0);M(D,ie,ae,"∽","\\backsim",!0);M(D,ie,ae,"⋍","\\backsimeq",!0);M(D,ie,ae,"⫅","\\subseteqq",!0);M(D,ie,ae,"⋐","\\Subset",!0);M(D,ie,ae,"⊏","\\sqsubset",!0);M(D,ie,ae,"≼","\\preccurlyeq",!0);M(D,ie,ae,"⋞","\\curlyeqprec",!0);M(D,ie,ae,"≾","\\precsim",!0);M(D,ie,ae,"⪷","\\precapprox",!0);M(D,ie,ae,"⊲","\\vartriangleleft");M(D,ie,ae,"⊴","\\trianglelefteq");M(D,ie,ae,"⊨","\\vDash",!0);M(D,ie,ae,"⊪","\\Vvdash",!0);M(D,ie,ae,"⌣","\\smallsmile");M(D,ie,ae,"⌢","\\smallfrown");M(D,ie,ae,"≏","\\bumpeq",!0);M(D,ie,ae,"≎","\\Bumpeq",!0);M(D,ie,ae,"≧","\\geqq",!0);M(D,ie,ae,"⩾","\\geqslant",!0);M(D,ie,ae,"⪖","\\eqslantgtr",!0);M(D,ie,ae,"≳","\\gtrsim",!0);M(D,ie,ae,"⪆","\\gtrapprox",!0);M(D,ie,Ze,"⋗","\\gtrdot");M(D,ie,ae,"⋙","\\ggg",!0);M(D,ie,ae,"≷","\\gtrless",!0);M(D,ie,ae,"⋛","\\gtreqless",!0);M(D,ie,ae,"⪌","\\gtreqqless",!0);M(D,ie,ae,"≖","\\eqcirc",!0);M(D,ie,ae,"≗","\\circeq",!0);M(D,ie,ae,"≜","\\triangleq",!0);M(D,ie,ae,"∼","\\thicksim");M(D,ie,ae,"≈","\\thickapprox");M(D,ie,ae,"⫆","\\supseteqq",!0);M(D,ie,ae,"⋑","\\Supset",!0);M(D,ie,ae,"⊐","\\sqsupset",!0);M(D,ie,ae,"≽","\\succcurlyeq",!0);M(D,ie,ae,"⋟","\\curlyeqsucc",!0);M(D,ie,ae,"≿","\\succsim",!0);M(D,ie,ae,"⪸","\\succapprox",!0);M(D,ie,ae,"⊳","\\vartriangleright");M(D,ie,ae,"⊵","\\trianglerighteq");M(D,ie,ae,"⊩","\\Vdash",!0);M(D,ie,ae,"∣","\\shortmid");M(D,ie,ae,"∥","\\shortparallel");M(D,ie,ae,"≬","\\between",!0);M(D,ie,ae,"⋔","\\pitchfork",!0);M(D,ie,ae,"∝","\\varpropto");M(D,ie,ae,"◀","\\blacktriangleleft");M(D,ie,ae,"∴","\\therefore",!0);M(D,ie,ae,"∍","\\backepsilon");M(D,ie,ae,"▶","\\blacktriangleright");M(D,ie,ae,"∵","\\because",!0);M(D,ie,ae,"⋘","\\llless");M(D,ie,ae,"⋙","\\gggtr");M(D,ie,Ze,"⊲","\\lhd");M(D,ie,Ze,"⊳","\\rhd");M(D,ie,ae,"≂","\\eqsim",!0);M(D,V,ae,"⋈","\\Join");M(D,ie,ae,"≑","\\Doteq",!0);M(D,ie,Ze,"∔","\\dotplus",!0);M(D,ie,Ze,"∖","\\smallsetminus");M(D,ie,Ze,"⋒","\\Cap",!0);M(D,ie,Ze,"⋓","\\Cup",!0);M(D,ie,Ze,"⩞","\\doublebarwedge",!0);M(D,ie,Ze,"⊟","\\boxminus",!0);M(D,ie,Ze,"⊞","\\boxplus",!0);M(D,ie,Ze,"⋇","\\divideontimes",!0);M(D,ie,Ze,"⋉","\\ltimes",!0);M(D,ie,Ze,"⋊","\\rtimes",!0);M(D,ie,Ze,"⋋","\\leftthreetimes",!0);M(D,ie,Ze,"⋌","\\rightthreetimes",!0);M(D,ie,Ze,"⋏","\\curlywedge",!0);M(D,ie,Ze,"⋎","\\curlyvee",!0);M(D,ie,Ze,"⊝","\\circleddash",!0);M(D,ie,Ze,"⊛","\\circledast",!0);M(D,ie,Ze,"⋅","\\centerdot");M(D,ie,Ze,"⊺","\\intercal",!0);M(D,ie,Ze,"⋒","\\doublecap");M(D,ie,Ze,"⋓","\\doublecup");M(D,ie,Ze,"⊠","\\boxtimes",!0);M(D,ie,ae,"⇢","\\dashrightarrow",!0);M(D,ie,ae,"⇠","\\dashleftarrow",!0);M(D,ie,ae,"⇇","\\leftleftarrows",!0);M(D,ie,ae,"⇆","\\leftrightarrows",!0);M(D,ie,ae,"⇚","\\Lleftarrow",!0);M(D,ie,ae,"↞","\\twoheadleftarrow",!0);M(D,ie,ae,"↢","\\leftarrowtail",!0);M(D,ie,ae,"↫","\\looparrowleft",!0);M(D,ie,ae,"⇋","\\leftrightharpoons",!0);M(D,ie,ae,"↶","\\curvearrowleft",!0);M(D,ie,ae,"↺","\\circlearrowleft",!0);M(D,ie,ae,"↰","\\Lsh",!0);M(D,ie,ae,"⇈","\\upuparrows",!0);M(D,ie,ae,"↿","\\upharpoonleft",!0);M(D,ie,ae,"⇃","\\downharpoonleft",!0);M(D,V,ae,"⊶","\\origof",!0);M(D,V,ae,"⊷","\\imageof",!0);M(D,ie,ae,"⊸","\\multimap",!0);M(D,ie,ae,"↭","\\leftrightsquigarrow",!0);M(D,ie,ae,"⇉","\\rightrightarrows",!0);M(D,ie,ae,"⇄","\\rightleftarrows",!0);M(D,ie,ae,"↠","\\twoheadrightarrow",!0);M(D,ie,ae,"↣","\\rightarrowtail",!0);M(D,ie,ae,"↬","\\looparrowright",!0);M(D,ie,ae,"↷","\\curvearrowright",!0);M(D,ie,ae,"↻","\\circlearrowright",!0);M(D,ie,ae,"↱","\\Rsh",!0);M(D,ie,ae,"⇊","\\downdownarrows",!0);M(D,ie,ae,"↾","\\upharpoonright",!0);M(D,ie,ae,"⇂","\\downharpoonright",!0);M(D,ie,ae,"⇝","\\rightsquigarrow",!0);M(D,ie,ae,"⇝","\\leadsto");M(D,ie,ae,"⇛","\\Rrightarrow",!0);M(D,ie,ae,"↾","\\restriction");M(D,V,me,"‘","`");M(D,V,me,"$","\\$");M(De,V,me,"$","\\$");M(De,V,me,"$","\\textdollar");M(D,V,me,"%","\\%");M(De,V,me,"%","\\%");M(D,V,me,"_","\\_");M(De,V,me,"_","\\_");M(De,V,me,"_","\\textunderscore");M(D,V,me,"∠","\\angle",!0);M(D,V,me,"∞","\\infty",!0);M(D,V,me,"′","\\prime");M(D,V,me,"△","\\triangle");M(D,V,me,"Γ","\\Gamma",!0);M(D,V,me,"Δ","\\Delta",!0);M(D,V,me,"Θ","\\Theta",!0);M(D,V,me,"Λ","\\Lambda",!0);M(D,V,me,"Ξ","\\Xi",!0);M(D,V,me,"Π","\\Pi",!0);M(D,V,me,"Σ","\\Sigma",!0);M(D,V,me,"Υ","\\Upsilon",!0);M(D,V,me,"Φ","\\Phi",!0);M(D,V,me,"Ψ","\\Psi",!0);M(D,V,me,"Ω","\\Omega",!0);M(D,V,me,"A","Α");M(D,V,me,"B","Β");M(D,V,me,"E","Ε");M(D,V,me,"Z","Ζ");M(D,V,me,"H","Η");M(D,V,me,"I","Ι");M(D,V,me,"K","Κ");M(D,V,me,"M","Μ");M(D,V,me,"N","Ν");M(D,V,me,"O","Ο");M(D,V,me,"P","Ρ");M(D,V,me,"T","Τ");M(D,V,me,"X","Χ");M(D,V,me,"¬","\\neg",!0);M(D,V,me,"¬","\\lnot");M(D,V,me,"⊤","\\top");M(D,V,me,"⊥","\\bot");M(D,V,me,"∅","\\emptyset");M(D,ie,me,"∅","\\varnothing");M(D,V,pt,"α","\\alpha",!0);M(D,V,pt,"β","\\beta",!0);M(D,V,pt,"γ","\\gamma",!0);M(D,V,pt,"δ","\\delta",!0);M(D,V,pt,"ϵ","\\epsilon",!0);M(D,V,pt,"ζ","\\zeta",!0);M(D,V,pt,"η","\\eta",!0);M(D,V,pt,"θ","\\theta",!0);M(D,V,pt,"ι","\\iota",!0);M(D,V,pt,"κ","\\kappa",!0);M(D,V,pt,"λ","\\lambda",!0);M(D,V,pt,"μ","\\mu",!0);M(D,V,pt,"ν","\\nu",!0);M(D,V,pt,"ξ","\\xi",!0);M(D,V,pt,"ο","\\omicron",!0);M(D,V,pt,"π","\\pi",!0);M(D,V,pt,"ρ","\\rho",!0);M(D,V,pt,"σ","\\sigma",!0);M(D,V,pt,"τ","\\tau",!0);M(D,V,pt,"υ","\\upsilon",!0);M(D,V,pt,"ϕ","\\phi",!0);M(D,V,pt,"χ","\\chi",!0);M(D,V,pt,"ψ","\\psi",!0);M(D,V,pt,"ω","\\omega",!0);M(D,V,pt,"ε","\\varepsilon",!0);M(D,V,pt,"ϑ","\\vartheta",!0);M(D,V,pt,"ϖ","\\varpi",!0);M(D,V,pt,"ϱ","\\varrho",!0);M(D,V,pt,"ς","\\varsigma",!0);M(D,V,pt,"φ","\\varphi",!0);M(D,V,Ze,"∗","*",!0);M(D,V,Ze,"+","+");M(D,V,Ze,"−","-",!0);M(D,V,Ze,"⋅","\\cdot",!0);M(D,V,Ze,"∘","\\circ",!0);M(D,V,Ze,"÷","\\div",!0);M(D,V,Ze,"±","\\pm",!0);M(D,V,Ze,"×","\\times",!0);M(D,V,Ze,"∩","\\cap",!0);M(D,V,Ze,"∪","\\cup",!0);M(D,V,Ze,"∖","\\setminus",!0);M(D,V,Ze,"∧","\\land");M(D,V,Ze,"∨","\\lor");M(D,V,Ze,"∧","\\wedge",!0);M(D,V,Ze,"∨","\\vee",!0);M(D,V,me,"√","\\surd");M(D,V,xi,"⟨","\\langle",!0);M(D,V,xi,"∣","\\lvert");M(D,V,xi,"∥","\\lVert");M(D,V,Ts,"?","?");M(D,V,Ts,"!","!");M(D,V,Ts,"⟩","\\rangle",!0);M(D,V,Ts,"∣","\\rvert");M(D,V,Ts,"∥","\\rVert");M(D,V,ae,"=","=");M(D,V,ae,":",":");M(D,V,ae,"≈","\\approx",!0);M(D,V,ae,"≅","\\cong",!0);M(D,V,ae,"≥","\\ge");M(D,V,ae,"≥","\\geq",!0);M(D,V,ae,"←","\\gets");M(D,V,ae,">","\\gt",!0);M(D,V,ae,"∈","\\in",!0);M(D,V,ae,"","\\@not");M(D,V,ae,"⊂","\\subset",!0);M(D,V,ae,"⊃","\\supset",!0);M(D,V,ae,"⊆","\\subseteq",!0);M(D,V,ae,"⊇","\\supseteq",!0);M(D,ie,ae,"⊈","\\nsubseteq",!0);M(D,ie,ae,"⊉","\\nsupseteq",!0);M(D,V,ae,"⊨","\\models");M(D,V,ae,"←","\\leftarrow",!0);M(D,V,ae,"≤","\\le");M(D,V,ae,"≤","\\leq",!0);M(D,V,ae,"<","\\lt",!0);M(D,V,ae,"→","\\rightarrow",!0);M(D,V,ae,"→","\\to");M(D,ie,ae,"≱","\\ngeq",!0);M(D,ie,ae,"≰","\\nleq",!0);M(D,V,Kl," ","\\ ");M(D,V,Kl," ","\\space");M(D,V,Kl," ","\\nobreakspace");M(De,V,Kl," ","\\ ");M(De,V,Kl," "," ");M(De,V,Kl," ","\\space");M(De,V,Kl," ","\\nobreakspace");M(D,V,Kl,null,"\\nobreak");M(D,V,Kl,null,"\\allowbreak");M(D,V,Mv,",",",");M(D,V,Mv,";",";");M(D,ie,Ze,"⊼","\\barwedge",!0);M(D,ie,Ze,"⊻","\\veebar",!0);M(D,V,Ze,"⊙","\\odot",!0);M(D,V,Ze,"⊕","\\oplus",!0);M(D,V,Ze,"⊗","\\otimes",!0);M(D,V,me,"∂","\\partial",!0);M(D,V,Ze,"⊘","\\oslash",!0);M(D,ie,Ze,"⊚","\\circledcirc",!0);M(D,ie,Ze,"⊡","\\boxdot",!0);M(D,V,Ze,"△","\\bigtriangleup");M(D,V,Ze,"▽","\\bigtriangledown");M(D,V,Ze,"†","\\dagger");M(D,V,Ze,"⋄","\\diamond");M(D,V,Ze,"⋆","\\star");M(D,V,Ze,"◃","\\triangleleft");M(D,V,Ze,"▹","\\triangleright");M(D,V,xi,"{","\\{");M(De,V,me,"{","\\{");M(De,V,me,"{","\\textbraceleft");M(D,V,Ts,"}","\\}");M(De,V,me,"}","\\}");M(De,V,me,"}","\\textbraceright");M(D,V,xi,"{","\\lbrace");M(D,V,Ts,"}","\\rbrace");M(D,V,xi,"[","\\lbrack",!0);M(De,V,me,"[","\\lbrack",!0);M(D,V,Ts,"]","\\rbrack",!0);M(De,V,me,"]","\\rbrack",!0);M(D,V,xi,"(","\\lparen",!0);M(D,V,Ts,")","\\rparen",!0);M(De,V,me,"<","\\textless",!0);M(De,V,me,">","\\textgreater",!0);M(D,V,xi,"⌊","\\lfloor",!0);M(D,V,Ts,"⌋","\\rfloor",!0);M(D,V,xi,"⌈","\\lceil",!0);M(D,V,Ts,"⌉","\\rceil",!0);M(D,V,me,"\\","\\backslash");M(D,V,me,"∣","|");M(D,V,me,"∣","\\vert");M(De,V,me,"|","\\textbar",!0);M(D,V,me,"∥","\\|");M(D,V,me,"∥","\\Vert");M(De,V,me,"∥","\\textbardbl");M(De,V,me,"~","\\textasciitilde");M(De,V,me,"\\","\\textbackslash");M(De,V,me,"^","\\textasciicircum");M(D,V,ae,"↑","\\uparrow",!0);M(D,V,ae,"⇑","\\Uparrow",!0);M(D,V,ae,"↓","\\downarrow",!0);M(D,V,ae,"⇓","\\Downarrow",!0);M(D,V,ae,"↕","\\updownarrow",!0);M(D,V,ae,"⇕","\\Updownarrow",!0);M(D,V,Rr,"∐","\\coprod");M(D,V,Rr,"⋁","\\bigvee");M(D,V,Rr,"⋀","\\bigwedge");M(D,V,Rr,"⨄","\\biguplus");M(D,V,Rr,"⋂","\\bigcap");M(D,V,Rr,"⋃","\\bigcup");M(D,V,Rr,"∫","\\int");M(D,V,Rr,"∫","\\intop");M(D,V,Rr,"∬","\\iint");M(D,V,Rr,"∭","\\iiint");M(D,V,Rr,"∏","\\prod");M(D,V,Rr,"∑","\\sum");M(D,V,Rr,"⨂","\\bigotimes");M(D,V,Rr,"⨁","\\bigoplus");M(D,V,Rr,"⨀","\\bigodot");M(D,V,Rr,"∮","\\oint");M(D,V,Rr,"∯","\\oiint");M(D,V,Rr,"∰","\\oiiint");M(D,V,Rr,"⨆","\\bigsqcup");M(D,V,Rr,"∫","\\smallint");M(De,V,Th,"…","\\textellipsis");M(D,V,Th,"…","\\mathellipsis");M(De,V,Th,"…","\\ldots",!0);M(D,V,Th,"…","\\ldots",!0);M(D,V,Th,"⋯","\\@cdots",!0);M(D,V,Th,"⋱","\\ddots",!0);M(D,V,me,"⋮","\\varvdots");M(De,V,me,"⋮","\\varvdots");M(D,V,er,"ˊ","\\acute");M(D,V,er,"ˋ","\\grave");M(D,V,er,"¨","\\ddot");M(D,V,er,"~","\\tilde");M(D,V,er,"ˉ","\\bar");M(D,V,er,"˘","\\breve");M(D,V,er,"ˇ","\\check");M(D,V,er,"^","\\hat");M(D,V,er,"⃗","\\vec");M(D,V,er,"˙","\\dot");M(D,V,er,"˚","\\mathring");M(D,V,pt,"","\\@imath");M(D,V,pt,"","\\@jmath");M(D,V,me,"ı","ı");M(D,V,me,"ȷ","ȷ");M(De,V,me,"ı","\\i",!0);M(De,V,me,"ȷ","\\j",!0);M(De,V,me,"ß","\\ss",!0);M(De,V,me,"æ","\\ae",!0);M(De,V,me,"œ","\\oe",!0);M(De,V,me,"ø","\\o",!0);M(De,V,me,"Æ","\\AE",!0);M(De,V,me,"Œ","\\OE",!0);M(De,V,me,"Ø","\\O",!0);M(De,V,er,"ˊ","\\'");M(De,V,er,"ˋ","\\`");M(De,V,er,"ˆ","\\^");M(De,V,er,"˜","\\~");M(De,V,er,"ˉ","\\=");M(De,V,er,"˘","\\u");M(De,V,er,"˙","\\.");M(De,V,er,"¸","\\c");M(De,V,er,"˚","\\r");M(De,V,er,"ˇ","\\v");M(De,V,er,"¨",'\\"');M(De,V,er,"˝","\\H");M(De,V,er,"◯","\\textcircled");var lF={"--":!0,"---":!0,"``":!0,"''":!0};M(De,V,me,"–","--",!0);M(De,V,me,"–","\\textendash");M(De,V,me,"—","---",!0);M(De,V,me,"—","\\textemdash");M(De,V,me,"‘","`",!0);M(De,V,me,"‘","\\textquoteleft");M(De,V,me,"’","'",!0);M(De,V,me,"’","\\textquoteright");M(De,V,me,"“","``",!0);M(De,V,me,"“","\\textquotedblleft");M(De,V,me,"”","''",!0);M(De,V,me,"”","\\textquotedblright");M(D,V,me,"°","\\degree",!0);M(De,V,me,"°","\\degree");M(De,V,me,"°","\\textdegree",!0);M(D,V,me,"£","\\pounds");M(D,V,me,"£","\\mathsterling",!0);M(De,V,me,"£","\\pounds");M(De,V,me,"£","\\textsterling",!0);M(D,ie,me,"✠","\\maltese");M(De,ie,me,"✠","\\maltese");var jE='0123456789/@."';for(var j4=0;j40)return Ki(i,h,s,n,a.concat(f));if(u){var m,g;if(u==="boldsymbol"){var x=Oxe(i,s,n,a,r);m=x.fontName,g=[x.fontClass]}else o?(m=uF[u].fontName,g=[u]):(m=ex(u,n.fontWeight,n.fontShape),g=[u,n.fontWeight,n.fontShape]);if(Av(i,m,s).metrics)return Ki(i,m,s,n,a.concat(g));if(lF.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w{if(tc(t.classes)!==tc(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var s in e.style)if(e.style.hasOwnProperty(s)&&t.style[s]!==e.style[s])return!1;return!0},Cxe=t=>{for(var e=0;en&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Ls=function(e,n,r,s){var i=new A0(e,n,r,s);return B6(i),i},oF=(t,e,n,r)=>new A0(t,e,n,r),Txe=function(e,n,r){var s=Ls([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=$e(s.height),s.maxFontSize=1,s},Exe=function(e,n,r,s){var i=new L6(e,n,r,s);return B6(i),i},cF=function(e){var n=new M0(e);return B6(n),n},_xe=function(e,n){return e instanceof M0?Ls([],[e],n):e},Mxe=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,a=1;a{var n=Ls(["mspace"],[],e),r=ar(t,e);return n.style.marginRight=$e(r),n},ex=function(e,n,r){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return n==="textbf"&&r==="textit"?i="BoldItalic":n==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",s+"-"+i},uF={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},dF={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Dxe=function(e,n){var[r,s,i]=dF[e],a=new nc(r),o=new Vl([a],{width:$e(s),height:$e(i),style:"width:"+$e(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),u=oF(["overlay"],[o],n);return u.height=i,u.style.height=$e(i),u.style.width=$e(s),u},be={fontMap:uF,makeSymbol:Ki,mathsym:kxe,makeSpan:Ls,makeSvgSpan:oF,makeLineSpan:Txe,makeAnchor:Exe,makeFragment:cF,wrapFragment:_xe,makeVList:Axe,makeOrd:jxe,makeGlue:Rxe,staticSvg:Dxe,svgData:dF,tryCombineChars:Cxe},sr={number:3,unit:"mu"},Bc={number:4,unit:"mu"},bl={number:5,unit:"mu"},zxe={mord:{mop:sr,mbin:Bc,mrel:bl,minner:sr},mop:{mord:sr,mop:sr,mrel:bl,minner:sr},mbin:{mord:Bc,mop:Bc,mopen:Bc,minner:Bc},mrel:{mord:bl,mop:bl,mopen:bl,minner:bl},mopen:{},mclose:{mop:sr,mbin:Bc,mrel:bl,minner:sr},mpunct:{mord:sr,mop:sr,mrel:bl,mopen:sr,mclose:sr,mpunct:sr,minner:sr},minner:{mord:sr,mop:sr,mbin:Bc,mrel:bl,mopen:sr,mpunct:sr,minner:sr}},Pxe={mord:{mop:sr},mop:{mord:sr,mop:sr},mbin:{},mrel:{},mopen:{},mclose:{mop:sr},mpunct:{},minner:{mop:sr}},hF={},T1={},E1={};function Ge(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},u=0;u{var b=w.classes[0],k=y.classes[0];b==="mbin"&&Bxe.includes(k)?w.classes[0]="mord":k==="mbin"&&Lxe.includes(b)&&(y.classes[0]="mord")},{node:m},g,x),_E(i,(y,w)=>{var b=hS(w),k=hS(y),N=b&&k?y.hasClass("mtight")?Pxe[b][k]:zxe[b][k]:null;if(N)return be.makeGlue(N,h)},{node:m},g,x),i},_E=function t(e,n,r,s,i){s&&e.push(s);for(var a=0;ag=>{e.splice(m+1,0,g),a++})(a)}s&&e.pop()},fF=function(e){return e instanceof M0||e instanceof L6||e instanceof A0&&e.hasClass("enclosing")?e:null},Fxe=function t(e,n){var r=fF(e);if(r){var s=r.children;if(s.length){if(n==="right")return t(s[s.length-1],"right");if(n==="left")return t(s[0],"left")}}return e},hS=function(e,n){return e?(n&&(e=Fxe(e,n)),qxe[e.classes[0]]||null):null},Vm=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return Ul(n.concat(r))},hn=function(e,n,r){if(!e)return Ul();if(T1[e.type]){var s=T1[e.type](e,n);if(r&&n.size!==r.size){s=Ul(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new Be("Got group of unknown type: '"+e.type+"'")};function tx(t,e){var n=Ul(["base"],t,e),r=Ul(["strut"]);return r.style.height=$e(n.height+n.depth),n.depth&&(r.style.verticalAlign=$e(-n.depth)),n.children.unshift(r),n}function fS(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Fr(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],o=0;o0&&(i.push(tx(a,e)),a=[]),i.push(r[o]));a.length>0&&i.push(tx(a,e));var h;n?(h=tx(Fr(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var f=Ul(["katex-html"],i);if(f.setAttribute("aria-hidden","true"),h){var m=h.children[0];m.style.height=$e(f.height+f.depth),f.depth&&(m.style.verticalAlign=$e(-f.depth))}return f}function mF(t){return new M0(t)}class ui{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=tc(this.classes));for(var r=0;r0&&(e+=' class ="'+bn.escape(tc(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Da{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return bn.escape(this.toText())}toText(){return this.text}}class $xe{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",$e(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var Pe={MathNode:ui,TextNode:Da,SpaceNode:$xe,newDocumentFragment:mF},Qi=function(e,n,r){return Un[n][e]&&Un[n][e].replace&&e.charCodeAt(0)!==55349&&!(lF.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Un[n][e].replace),new Pe.TextNode(e)},I6=function(e){return e.length===1?e[0]:new Pe.MathNode("mrow",e)},q6=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var s=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var i=e.text;if(["\\imath","\\jmath"].includes(i))return null;Un[s][i]&&Un[s][i].replace&&(i=Un[s][i].replace);var a=be.fontMap[r].fontName;return P6(i,a,s)?be.fontMap[r].variant:null};function E4(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Da&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof Da&&n.text===","}else return!1}var Ys=function(e,n,r){if(e.length===1){var s=Qn(e[0],n);return r&&s instanceof ui&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,o=0;o=1&&(a.type==="mn"||E4(a))){var h=u.children[0];h instanceof ui&&h.type==="mn"&&(h.children=[...a.children,...h.children],i.pop())}else if(a.type==="mi"&&a.children.length===1){var f=a.children[0];if(f instanceof Da&&f.text==="̸"&&(u.type==="mo"||u.type==="mi"||u.type==="mn")){var m=u.children[0];m instanceof Da&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),i.pop())}}}i.push(u),a=u}return i},rc=function(e,n,r){return I6(Ys(e,n,r))},Qn=function(e,n){if(!e)return new Pe.MathNode("mrow");if(E1[e.type]){var r=E1[e.type](e,n);return r}else throw new Be("Got group of unknown type: '"+e.type+"'")};function ME(t,e,n,r,s){var i=Ys(t,n),a;i.length===1&&i[0]instanceof ui&&["mrow","mtable"].includes(i[0].type)?a=i[0]:a=new Pe.MathNode("mrow",i);var o=new Pe.MathNode("annotation",[new Pe.TextNode(e)]);o.setAttribute("encoding","application/x-tex");var u=new Pe.MathNode("semantics",[a,o]),h=new Pe.MathNode("math",[u]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var f=s?"katex":"katex-mathml";return be.makeSpan([f],[h])}var pF=function(e){return new Tl({style:e.displayMode?xt.DISPLAY:xt.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},gF=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=be.makeSpan(r,[e])}return e},Qxe=function(e,n,r){var s=pF(r),i;if(r.output==="mathml")return ME(e,n,s,r.displayMode,!0);if(r.output==="html"){var a=fS(e,s);i=be.makeSpan(["katex"],[a])}else{var o=ME(e,n,s,r.displayMode,!1),u=fS(e,s);i=be.makeSpan(["katex"],[o,u])}return gF(i,r)},Hxe=function(e,n,r){var s=pF(r),i=fS(e,s),a=be.makeSpan(["katex"],[i]);return gF(a,r)},Vxe={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Uxe=function(e){var n=new Pe.MathNode("mo",[new Pe.TextNode(Vxe[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Wxe={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"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,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"],"\\cdlongequal":[["longequal"],3,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],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["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],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Gxe=function(e){return e.type==="ordgroup"?e.body.length:1},Xxe=function(e,n){function r(){var o=4e5,u=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(u)){var h=e,f=Gxe(h.base),m,g,x;if(f>5)u==="widehat"||u==="widecheck"?(m=420,o=2364,x=.42,g=u+"4"):(m=312,o=2340,x=.34,g="tilde4");else{var y=[1,1,2,2,3,3][f];u==="widehat"||u==="widecheck"?(o=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],x=[0,.24,.3,.3,.36,.42][y],g=u+y):(o=[0,600,1033,2339,2340][y],m=[0,260,286,306,312][y],x=[0,.26,.286,.3,.306,.34][y],g="tilde"+y)}var w=new nc(g),b=new Vl([w],{width:"100%",height:$e(x),viewBox:"0 0 "+o+" "+m,preserveAspectRatio:"none"});return{span:be.makeSvgSpan([],[b],n),minWidth:0,height:x}}else{var k=[],N=Wxe[u],[C,T,E]=N,_=E/1e3,A=C.length,F,B;if(A===1){var P=N[3];F=["hide-tail"],B=[P]}else if(A===2)F=["halfarrow-left","halfarrow-right"],B=["xMinYMin","xMaxYMin"];else if(A===3)F=["brace-left","brace-center","brace-right"],B=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support `+A+" children.");for(var H=0;H0&&(s.style.minWidth=$e(i)),s},Yxe=function(e,n,r,s,i){var a,o=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(a=be.makeSpan(["stretchy",n],[],i),n==="fbox"){var u=i.color&&i.getColor();u&&(a.style.borderColor=u)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new uS({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new uS({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var f=new Vl(h,{width:"100%",height:$e(o)});a=be.makeSvgSpan([],[f],i)}return a.height=o,a.style.height=$e(o),a},Wl={encloseSpan:Yxe,mathMLnode:Uxe,svgSpan:Xxe};function zt(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function F6(t){var e=Rv(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Rv(t){return t&&(t.type==="atom"||wxe.hasOwnProperty(t.type))?t:null}var $6=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=zt(t.base,"accent"),n=r.base,t.base=n,s=yxe(hn(t,e)),t.base=r):(r=zt(t,"accent"),n=r.base);var i=hn(n,e.havingCrampedStyle()),a=r.isShifty&&bn.isCharacterBox(n),o=0;if(a){var u=bn.getBaseElem(n),h=hn(u,e.havingCrampedStyle());o=OE(h).skew}var f=r.label==="\\c",m=f?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),g;if(r.isStretchy)g=Wl.svgSpan(r,e),g=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+$e(2*o)+")",marginLeft:$e(2*o)}:void 0}]},e);else{var x,y;r.label==="\\vec"?(x=be.staticSvg("vec",e),y=be.svgData.vec[1]):(x=be.makeOrd({mode:r.mode,text:r.label},e,"textord"),x=OE(x),x.italic=0,y=x.width,f&&(m+=x.depth)),g=be.makeSpan(["accent-body"],[x]);var w=r.label==="\\textcircled";w&&(g.classes.push("accent-full"),m=i.height);var b=o;w||(b-=y/2),g.style.left=$e(b),r.label==="\\textcircled"&&(g.style.top=".2em"),g=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:g}]},e)}var k=be.makeSpan(["mord","accent"],[g],e);return s?(s.children[0]=k,s.height=Math.max(k.height,s.height),s.classes[0]="mord",s):k},xF=(t,e)=>{var n=t.isStretchy?Wl.mathMLnode(t.label):new Pe.MathNode("mo",[Qi(t.label,t.mode)]),r=new Pe.MathNode("mover",[Qn(t.base,e),n]);return r.setAttribute("accent","true"),r},Zxe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Ge({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=_1(e[0]),r=!Zxe.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:$6,mathmlBuilder:xF});Ge({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:$6,mathmlBuilder:xF});Ge({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var n=hn(t.base,e),r=Wl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=be.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return be.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=Wl.mathMLnode(t.label),r=new Pe.MathNode("munder",[Qn(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var nx=t=>{var e=new Pe.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Ge({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=be.wrapFragment(hn(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var a;t.below&&(r=e.havingStyle(n.sub()),a=be.wrapFragment(hn(t.below,r,e),e),a.classes.push(i+"-arrow-pad"));var o=Wl.svgSpan(t,e),u=-e.fontMetrics().axisHeight+.5*o.height,h=-e.fontMetrics().axisHeight-.5*o.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var f;if(a){var m=-e.fontMetrics().axisHeight+a.height+.5*o.height+.111;f=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:o,shift:u},{type:"elem",elem:a,shift:m}]},e)}else f=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:o,shift:u}]},e);return f.children[0].children[0].children[1].classes.push("svg-align"),be.makeSpan(["mrel","x-arrow"],[f],e)},mathmlBuilder(t,e){var n=Wl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=nx(Qn(t.body,e));if(t.below){var i=nx(Qn(t.below,e));r=new Pe.MathNode("munderover",[n,i,s])}else r=new Pe.MathNode("mover",[n,s])}else if(t.below){var a=nx(Qn(t.below,e));r=new Pe.MathNode("munder",[n,a])}else r=nx(),r=new Pe.MathNode("mover",[n,r]);return r}});var Kxe=be.makeSpan;function vF(t,e){var n=Fr(t.body,e,!0);return Kxe([t.mclass],n,e)}function yF(t,e){var n,r=Ys(t.body,e);return t.mclass==="minner"?n=new Pe.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new Pe.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new Pe.MathNode("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Ge({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:xr(s),isCharacterBox:bn.isCharacterBox(s)}},htmlBuilder:vF,mathmlBuilder:yF});var Dv=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Ge({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Dv(e[0]),body:xr(e[1]),isCharacterBox:bn.isCharacterBox(e[1])}}});Ge({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],a;r!=="\\stackrel"?a=Dv(s):a="mrel";var o={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:xr(s)},u={type:"supsub",mode:i.mode,base:o,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:a,body:[u],isCharacterBox:bn.isCharacterBox(u)}},htmlBuilder:vF,mathmlBuilder:yF});Ge({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Dv(e[0]),body:xr(e[0])}},htmlBuilder(t,e){var n=Fr(t.body,e,!0),r=be.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Ys(t.body,e),r=new Pe.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Jxe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},AE=()=>({type:"styling",body:[],mode:"math",style:"display"}),RE=t=>t.type==="textord"&&t.text==="@",e1e=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function t1e(t,e,n){var r=Jxe[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},a=n.callFunction("\\Big",[i],[]),o=n.callFunction("\\\\cdright",[e[1]],[]),u={type:"ordgroup",mode:"math",body:[s,a,o]};return n.callFunction("\\\\cdparent",[u],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function n1e(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new Be("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var m=0;m<2;m++){for(var g=!0,x=u+1;xAV=|." after @',a[u]);var y=t1e(h,f,t),w={type:"styling",body:[y],mode:"math",style:"display"};r.push(w),o=AE()}i%2===0?r.push(o):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var b=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:b,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Ge({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=be.wrapFragment(hn(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=$e(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new Pe.MathNode("mrow",[Qn(t.label,e)]);return n=new Pe.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Pe.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Ge({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=be.wrapFragment(hn(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new Pe.MathNode("mrow",[Qn(t.fragment,e)])}});Ge({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=zt(e[0],"ordgroup"),s=r.body,i="",a=0;a=1114111)throw new Be("\\@char with invalid code point "+i);return u<=65535?h=String.fromCharCode(u):(u-=65536,h=String.fromCharCode((u>>10)+55296,(u&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var bF=(t,e)=>{var n=Fr(t.body,e.withColor(t.color),!1);return be.makeFragment(n)},wF=(t,e)=>{var n=Ys(t.body,e.withColor(t.color)),r=new Pe.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Ge({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=zt(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:xr(s)}},htmlBuilder:bF,mathmlBuilder:wF});Ge({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=zt(e[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:bF,mathmlBuilder:wF});Ge({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&zt(s,"size").value}},htmlBuilder(t,e){var n=be.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=$e(ar(t.size,e)))),n},mathmlBuilder(t,e){var n=new Pe.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",$e(ar(t.size,e)))),n}});var mS={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},SF=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new Be("Expected a control sequence",t);return e},r1e=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},kF=(t,e,n,r)=>{var s=t.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,s,r)};Ge({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(mS[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=mS[r.text]),zt(e.parseFunction(),"internal");throw new Be("Invalid token after macro prefix",r)}});Ge({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new Be("Expected a control sequence",r);for(var i=0,a,o=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),o[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Be('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new Be('Argument number "'+r.text+'" out of order');i++,o.push([])}else{if(r.text==="EOF")throw new Be("Expected a macro definition");o[i].push(r.text)}var{tokens:u}=e.gullet.consumeArg();return a&&u.unshift(a),(n==="\\edef"||n==="\\xdef")&&(u=e.gullet.expandTokens(u),u.reverse()),e.gullet.macros.set(s,{tokens:u,numArgs:i,delimiters:o},n===mS[n]),{type:"internal",mode:e.mode}}});Ge({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=SF(e.gullet.popToken());e.gullet.consumeSpaces();var s=r1e(e);return kF(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Ge({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=SF(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return kF(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var Xf=function(e,n,r){var s=Un.math[e]&&Un.math[e].replace,i=P6(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},Q6=function(e,n,r,s){var i=r.havingBaseStyle(n),a=be.makeSpan(s.concat(i.sizingClasses(r)),[e],r),o=i.sizeMultiplier/r.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=i.sizeMultiplier,a},OF=function(e,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=$e(i),e.height-=i,e.depth+=i},s1e=function(e,n,r,s,i,a){var o=be.makeSymbol(e,"Main-Regular",i,s),u=Q6(o,n,s,a);return r&&OF(u,s,n),u},i1e=function(e,n,r,s){return be.makeSymbol(e,"Size"+n+"-Regular",r,s)},jF=function(e,n,r,s,i,a){var o=i1e(e,n,i,s),u=Q6(be.makeSpan(["delimsizing","size"+n],[o],s),xt.TEXT,s,a);return r&&OF(u,s,xt.TEXT),u},_4=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=be.makeSpan(["delimsizinginner",s],[be.makeSpan([],[be.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},M4=function(e,n,r){var s=Ra["Size4-Regular"][e.charCodeAt(0)]?Ra["Size4-Regular"][e.charCodeAt(0)][4]:Ra["Size1-Regular"][e.charCodeAt(0)][4],i=new nc("inner",uxe(e,Math.round(1e3*n))),a=new Vl([i],{width:$e(s),height:$e(n),style:"width:"+$e(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),o=be.makeSvgSpan([],[a],r);return o.height=n,o.style.height=$e(n),o.style.width=$e(s),{type:"elem",elem:o}},pS=.008,rx={type:"kern",size:-1*pS},a1e=["|","\\lvert","\\rvert","\\vert"],l1e=["\\|","\\lVert","\\rVert","\\Vert"],NF=function(e,n,r,s,i,a){var o,u,h,f,m="",g=0;o=h=f=e,u=null;var x="Size1-Regular";e==="\\uparrow"?h=f="⏐":e==="\\Uparrow"?h=f="‖":e==="\\downarrow"?o=h="⏐":e==="\\Downarrow"?o=h="‖":e==="\\updownarrow"?(o="\\uparrow",h="⏐",f="\\downarrow"):e==="\\Updownarrow"?(o="\\Uparrow",h="‖",f="\\Downarrow"):a1e.includes(e)?(h="∣",m="vert",g=333):l1e.includes(e)?(h="∥",m="doublevert",g=556):e==="["||e==="\\lbrack"?(o="⎡",h="⎢",f="⎣",x="Size4-Regular",m="lbrack",g=667):e==="]"||e==="\\rbrack"?(o="⎤",h="⎥",f="⎦",x="Size4-Regular",m="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(h=o="⎢",f="⎣",x="Size4-Regular",m="lfloor",g=667):e==="\\lceil"||e==="⌈"?(o="⎡",h=f="⎢",x="Size4-Regular",m="lceil",g=667):e==="\\rfloor"||e==="⌋"?(h=o="⎥",f="⎦",x="Size4-Regular",m="rfloor",g=667):e==="\\rceil"||e==="⌉"?(o="⎤",h=f="⎥",x="Size4-Regular",m="rceil",g=667):e==="("||e==="\\lparen"?(o="⎛",h="⎜",f="⎝",x="Size4-Regular",m="lparen",g=875):e===")"||e==="\\rparen"?(o="⎞",h="⎟",f="⎠",x="Size4-Regular",m="rparen",g=875):e==="\\{"||e==="\\lbrace"?(o="⎧",u="⎨",f="⎩",h="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(o="⎫",u="⎬",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(o="⎧",f="⎩",h="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(o="⎫",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(o="⎧",f="⎭",h="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(o="⎫",f="⎩",h="⎪",x="Size4-Regular");var y=Xf(o,x,i),w=y.height+y.depth,b=Xf(h,x,i),k=b.height+b.depth,N=Xf(f,x,i),C=N.height+N.depth,T=0,E=1;if(u!==null){var _=Xf(u,x,i);T=_.height+_.depth,E=2}var A=w+C+T,F=Math.max(0,Math.ceil((n-A)/(E*k))),B=A+F*E*k,P=s.fontMetrics().axisHeight;r&&(P*=s.sizeMultiplier);var H=B/2-P,U=[];if(m.length>0){var te=B-w-C,z=Math.round(B*1e3),W=dxe(m,Math.round(te*1e3)),q=new nc(m,W),J=(g/1e3).toFixed(3)+"em",ee=(z/1e3).toFixed(3)+"em",Y=new Vl([q],{width:J,height:ee,viewBox:"0 0 "+g+" "+z}),R=be.makeSvgSpan([],[Y],s);R.height=z/1e3,R.style.width=J,R.style.height=ee,U.push({type:"elem",elem:R})}else{if(U.push(_4(f,x,i)),U.push(rx),u===null){var re=B-w-C+2*pS;U.push(M4(h,re,s))}else{var K=(B-w-C-T)/2+2*pS;U.push(M4(h,K,s)),U.push(rx),U.push(_4(u,x,i)),U.push(rx),U.push(M4(h,K,s))}U.push(rx),U.push(_4(o,x,i))}var I=s.havingBaseStyle(xt.TEXT),Q=be.makeVList({positionType:"bottom",positionData:H,children:U},I);return Q6(be.makeSpan(["delimsizing","mult"],[Q],I),xt.TEXT,s,a)},A4=80,R4=.08,D4=function(e,n,r,s,i){var a=cxe(e,s,r),o=new nc(e,a),u=new Vl([o],{width:"400em",height:$e(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return be.makeSvgSpan(["hide-tail"],[u],i)},o1e=function(e,n){var r=n.havingBaseSizing(),s=_F("\\surd",e*r.sizeMultiplier,EF,r),i=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),o,u=0,h=0,f=0,m;return s.type==="small"?(f=1e3+1e3*a+A4,e<1?i=1:e<1.4&&(i=.7),u=(1+a+R4)/i,h=(1+a)/i,o=D4("sqrtMain",u,f,a,n),o.style.minWidth="0.853em",m=.833/i):s.type==="large"?(f=(1e3+A4)*mm[s.size],h=(mm[s.size]+a)/i,u=(mm[s.size]+a+R4)/i,o=D4("sqrtSize"+s.size,u,f,a,n),o.style.minWidth="1.02em",m=1/i):(u=e+a+R4,h=e+a,f=Math.floor(1e3*e+a)+A4,o=D4("sqrtTall",u,f,a,n),o.style.minWidth="0.742em",m=1.056),o.height=h,o.style.height=$e(u),{span:o,advanceWidth:m,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*i}},CF=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],c1e=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],TF=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],mm=[0,1.2,1.8,2.4,3],u1e=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),CF.includes(e)||TF.includes(e))return jF(e,n,!1,r,s,i);if(c1e.includes(e))return NF(e,mm[n],!1,r,s,i);throw new Be("Illegal delimiter: '"+e+"'")},d1e=[{type:"small",style:xt.SCRIPTSCRIPT},{type:"small",style:xt.SCRIPT},{type:"small",style:xt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],h1e=[{type:"small",style:xt.SCRIPTSCRIPT},{type:"small",style:xt.SCRIPT},{type:"small",style:xt.TEXT},{type:"stack"}],EF=[{type:"small",style:xt.SCRIPTSCRIPT},{type:"small",style:xt.SCRIPT},{type:"small",style:xt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],f1e=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},_F=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),a=i;an)return r[a]}return r[r.length-1]},MF=function(e,n,r,s,i,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var o;TF.includes(e)?o=d1e:CF.includes(e)?o=EF:o=h1e;var u=_F(e,n,o,s);return u.type==="small"?s1e(e,u.style,r,s,i,a):u.type==="large"?jF(e,u.size,r,s,i,a):NF(e,n,r,s,i,a)},m1e=function(e,n,r,s,i,a){var o=s.fontMetrics().axisHeight*s.sizeMultiplier,u=901,h=5/s.fontMetrics().ptPerEm,f=Math.max(n-o,r+o),m=Math.max(f/500*u,2*f-h);return MF(e,m,!0,s,i,a)},Ll={sqrtImage:o1e,sizedDelim:u1e,sizeToMaxHeight:mm,customSizedDelim:MF,leftRightDelim:m1e},DE={"\\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}},p1e=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function zv(t,e){var n=Rv(t);if(n&&p1e.includes(n.text))return n;throw n?new Be("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new Be("Invalid delimiter type '"+t.type+"'",t)}Ge({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=zv(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:DE[t.funcName].size,mclass:DE[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?be.makeSpan([t.mclass]):Ll.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Qi(t.delim,t.mode));var n=new Pe.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=$e(Ll.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function zE(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Ge({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new Be("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:zv(e[0],t).text,color:n}}});Ge({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=zv(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=zt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{zE(t);for(var n=Fr(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a{zE(t);var n=Ys(t.body,e);if(t.left!=="."){var r=new Pe.MathNode("mo",[Qi(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new Pe.MathNode("mo",[Qi(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return I6(n)}});Ge({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=zv(e[0],t);if(!t.parser.leftrightDepth)throw new Be("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=Vm(e,[]);else{n=Ll.sizedDelim(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?Qi("|","text"):Qi(t.delim,t.mode),r=new Pe.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var H6=(t,e)=>{var n=be.wrapFragment(hn(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,a=0,o=bn.isCharacterBox(t.body);if(r==="sout")i=be.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,a=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var u=ar({number:.6,unit:"pt"},e),h=ar({number:.35,unit:"ex"},e),f=e.havingBaseSizing();s=s/f.sizeMultiplier;var m=n.height+n.depth+u+h;n.style.paddingLeft=$e(m/2+u);var g=Math.floor(1e3*m*s),x=lxe(g),y=new Vl([new nc("phase",x)],{width:"400em",height:$e(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});i=be.makeSvgSpan(["hide-tail"],[y],e),i.style.height=$e(m),a=n.depth+u+h}else{/cancel/.test(r)?o||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var w=0,b=0,k=0;/box/.test(r)?(k=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),w=e.fontMetrics().fboxsep+(r==="colorbox"?0:k),b=w):r==="angl"?(k=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),w=4*k,b=Math.max(0,.25-n.depth)):(w=o?.2:0,b=w),i=Wl.encloseSpan(n,r,w,b,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=$e(k)):r==="angl"&&k!==.049&&(i.style.borderTopWidth=$e(k),i.style.borderRightWidth=$e(k)),a=n.depth+b,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var N;if(t.backgroundColor)N=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:a},{type:"elem",elem:n,shift:0}]},e);else{var C=/cancel|phase/.test(r)?["svg-align"]:[];N=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:a,wrapperClasses:C}]},e)}return/cancel/.test(r)&&(N.height=n.height,N.depth=n.depth),/cancel/.test(r)&&!o?be.makeSpan(["mord","cancel-lap"],[N],e):be.makeSpan(["mord"],[N],e)},V6=(t,e)=>{var n=0,r=new Pe.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Qn(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+s+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Ge({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=zt(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:H6,mathmlBuilder:V6});Ge({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=zt(e[0],"color-token").color,a=zt(e[1],"color-token").color,o=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:o}},htmlBuilder:H6,mathmlBuilder:V6});Ge({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Ge({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:H6,mathmlBuilder:V6});Ge({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var AF={};function Ha(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},u=0;u{var e=t.parser.settings;if(!e.displayMode)throw new Be("{"+t.envName+"} can be used only in display mode.")};function U6(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function fc(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:o,autoTag:u,singleRow:h,emptySingleRow:f,maxNumCols:m,leqno:g}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!a){var x=t.gullet.expandMacroAsText("\\arraystretch");if(x==null)a=1;else if(a=parseFloat(x),!a||a<0)throw new Be("Invalid \\arraystretch: "+x)}t.gullet.beginGroup();var y=[],w=[y],b=[],k=[],N=u!=null?[]:void 0;function C(){u&&t.gullet.macros.set("\\@eqnsw","1",!0)}function T(){N&&(t.gullet.macros.get("\\df@tag")?(N.push(t.subparse([new mi("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):N.push(!!u&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(C(),k.push(PE(t));;){var E=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),E={type:"ordgroup",mode:t.mode,body:E},n&&(E={type:"styling",mode:t.mode,style:n,body:[E]}),y.push(E);var _=t.fetch().text;if(_==="&"){if(m&&y.length===m){if(h||o)throw new Be("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(_==="\\end"){T(),y.length===1&&E.type==="styling"&&E.body[0].body.length===0&&(w.length>1||!f)&&w.pop(),k.length0&&(C+=.25),h.push({pos:C,isDashed:He[St]})}for(T(a[0]),r=0;r0&&(H+=N,AHe))for(r=0;r=o)){var ne=void 0;(s>0||e.hskipBeforeAndAfter)&&(ne=bn.deflt(K.pregap,g),ne!==0&&(W=be.makeSpan(["arraycolsep"],[]),W.style.width=$e(ne),z.push(W)));var ge=[];for(r=0;r0){for(var ve=be.makeLineSpan("hline",n,f),Fe=be.makeLineSpan("hdashline",n,f),Qe=[{type:"elem",elem:u,shift:0}];h.length>0;){var Ke=h.pop(),Tt=Ke.pos-U;Ke.isDashed?Qe.push({type:"elem",elem:Fe,shift:Tt}):Qe.push({type:"elem",elem:ve,shift:Tt})}u=be.makeVList({positionType:"individualShift",children:Qe},n)}if(J.length===0)return be.makeSpan(["mord"],[u],n);var st=be.makeVList({positionType:"individualShift",children:J},n);return st=be.makeSpan(["tag"],[st],n),be.makeFragment([u,st])},g1e={c:"center ",l:"left ",r:"right "},Ua=function(e,n){for(var r=[],s=new Pe.MathNode("mtd",[],["mtr-glue"]),i=new Pe.MathNode("mtd",[],["mml-eqn-num"]),a=0;a0){var y=e.cols,w="",b=!1,k=0,N=y.length;y[0].type==="separator"&&(g+="top ",k=1),y[y.length-1].type==="separator"&&(g+="bottom ",N-=1);for(var C=k;C0?"left ":"",g+=F[F.length-1].length>0?"right ":"";for(var B=1;B-1?"alignat":"align",i=e.envName==="split",a=fc(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:U6(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),o,u=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var f="",m=0;m0&&x&&(b=1),r[y]={type:"align",align:w,pregap:b,postgap:0}}return a.colSeparationType=x?"align":"alignat",a};Ha({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Rv(e[0]),r=n?[e[0]]:zt(e[0],"ordgroup").body,s=r.map(function(a){var o=F6(a),u=o.text;if("lcr".indexOf(u)!==-1)return{type:"align",align:u};if(u==="|")return{type:"separator",separator:"|"};if(u===":")return{type:"separator",separator:":"};throw new Be("Unknown column alignment: "+u,a)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return fc(t.parser,i,W6(t.envName))},htmlBuilder:Va,mathmlBuilder:Ua});Ha({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,"lcr".indexOf(n)===-1)throw new Be("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=fc(t.parser,r,W6(t.envName)),a=Math.max(0,...i.body.map(o=>o.length));return i.cols=new Array(a).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Va,mathmlBuilder:Ua});Ha({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=fc(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Va,mathmlBuilder:Ua});Ha({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Rv(e[0]),r=n?[e[0]]:zt(e[0],"ordgroup").body,s=r.map(function(a){var o=F6(a),u=o.text;if("lc".indexOf(u)!==-1)return{type:"align",align:u};throw new Be("Unknown column alignment: "+u,a)});if(s.length>1)throw new Be("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=fc(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new Be("{subarray} can contain only one column");return i},htmlBuilder:Va,mathmlBuilder:Ua});Ha({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=fc(t.parser,e,W6(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Va,mathmlBuilder:Ua});Ha({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:DF,htmlBuilder:Va,mathmlBuilder:Ua});Ha({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Pv(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:U6(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return fc(t.parser,e,"display")},htmlBuilder:Va,mathmlBuilder:Ua});Ha({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:DF,htmlBuilder:Va,mathmlBuilder:Ua});Ha({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Pv(t);var e={autoTag:U6(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return fc(t.parser,e,"display")},htmlBuilder:Va,mathmlBuilder:Ua});Ha({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Pv(t),n1e(t.parser)},htmlBuilder:Va,mathmlBuilder:Ua});X("\\nonumber","\\gdef\\@eqnsw{0}");X("\\notag","\\nonumber");Ge({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new Be(t.funcName+" valid only within array environment")}});var LE=AF;Ge({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new Be("Invalid environment name",s);for(var i="",a=0;a{var n=t.font,r=e.withFont(n);return hn(t.body,r)},PF=(t,e)=>{var n=t.font,r=e.withFont(n);return Qn(t.body,r)},BE={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Ge({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=_1(e[0]),i=r;return i in BE&&(i=BE[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:zF,mathmlBuilder:PF});Ge({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=bn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Dv(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Ge({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,a=n.parseExpression(!0,s),o="math"+r.slice(1);return{type:"font",mode:i,font:o,body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:zF,mathmlBuilder:PF});var LF=(t,e)=>{var n=e;return t==="display"?n=n.id>=xt.SCRIPT.id?n.text():xt.DISPLAY:t==="text"&&n.size===xt.DISPLAY.size?n=xt.TEXT:t==="script"?n=xt.SCRIPT:t==="scriptscript"&&(n=xt.SCRIPTSCRIPT),n},G6=(t,e)=>{var n=LF(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var a=hn(t.numer,i,e);if(t.continued){var o=8.5/e.fontMetrics().ptPerEm,u=3.5/e.fontMetrics().ptPerEm;a.height=a.height0?y=3*g:y=7*g,w=e.fontMetrics().denom1):(m>0?(x=e.fontMetrics().num2,y=g):(x=e.fontMetrics().num3,y=3*g),w=e.fontMetrics().denom2);var b;if(f){var N=e.fontMetrics().axisHeight;x-a.depth-(N+.5*m){var n=new Pe.MathNode("mfrac",[Qn(t.numer,e),Qn(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=ar(t.barSize,e);n.setAttribute("linethickness",$e(r))}var s=LF(t.size,e.style);if(s.size!==e.style.size){n=new Pe.MathNode("mstyle",[n]);var i=s.size===xt.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var a=[];if(t.leftDelim!=null){var o=new Pe.MathNode("mo",[new Pe.TextNode(t.leftDelim.replace("\\",""))]);o.setAttribute("fence","true"),a.push(o)}if(a.push(n),t.rightDelim!=null){var u=new Pe.MathNode("mo",[new Pe.TextNode(t.rightDelim.replace("\\",""))]);u.setAttribute("fence","true"),a.push(u)}return I6(a)}return n};Ge({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],a,o=null,u=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,o="(",u=")";break;case"\\\\bracefrac":a=!1,o="\\{",u="\\}";break;case"\\\\brackfrac":a=!1,o="[",u="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:a,leftDelim:o,rightDelim:u,size:h,barSize:null}},htmlBuilder:G6,mathmlBuilder:X6});Ge({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Ge({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:r}}});var IE=["display","text","script","scriptscript"],qE=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Ge({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],s=e[5],i=_1(e[0]),a=i.type==="atom"&&i.family==="open"?qE(i.text):null,o=_1(e[1]),u=o.type==="atom"&&o.family==="close"?qE(o.text):null,h=zt(e[2],"size"),f,m=null;h.isBlank?f=!0:(m=h.value,f=m.number>0);var g="auto",x=e[3];if(x.type==="ordgroup"){if(x.body.length>0){var y=zt(x.body[0],"textord");g=IE[Number(y.text)]}}else x=zt(x,"textord"),g=IE[Number(x.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:f,barSize:m,leftDelim:a,rightDelim:u,size:g}},htmlBuilder:G6,mathmlBuilder:X6});Ge({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:s}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:zt(e[0],"size").value,token:s}}});Ge({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Uge(zt(e[1],"infix").size),a=e[2],o=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:a,continued:!1,hasBarLine:o,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:G6,mathmlBuilder:X6});var BF=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?hn(t.sup,e.havingStyle(n.sup()),e):hn(t.sub,e.havingStyle(n.sub()),e),s=zt(t.base,"horizBrace")):s=zt(t,"horizBrace");var i=hn(s.base,e.havingBaseStyle(xt.DISPLAY)),a=Wl.svgSpan(s,e),o;if(s.isOver?(o=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a}]},e),o.children[0].children[0].children[1].classes.push("svg-align")):(o=be.makeVList({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:i}]},e),o.children[0].children[0].children[0].classes.push("svg-align")),r){var u=be.makeSpan(["mord",s.isOver?"mover":"munder"],[o],e);s.isOver?o=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:u},{type:"kern",size:.2},{type:"elem",elem:r}]},e):o=be.makeVList({positionType:"bottom",positionData:u.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:u}]},e)}return be.makeSpan(["mord",s.isOver?"mover":"munder"],[o],e)},x1e=(t,e)=>{var n=Wl.mathMLnode(t.label);return new Pe.MathNode(t.isOver?"mover":"munder",[Qn(t.base,e),n])};Ge({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:BF,mathmlBuilder:x1e});Ge({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=zt(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:xr(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Fr(t.body,e,!1);return be.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=rc(t.body,e);return n instanceof ui||(n=new ui("mrow",[n])),n.setAttribute("href",t.href),n}});Ge({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=zt(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=zt(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,u={};switch(r){case"\\htmlClass":u.class=i,o={command:"\\htmlClass",class:i};break;case"\\htmlId":u.id=i,o={command:"\\htmlId",id:i};break;case"\\htmlStyle":u.style=i,o={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),f=0;f{var n=Fr(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=be.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>rc(t.body,e)});Ge({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:xr(e[0]),mathml:xr(e[1])}},htmlBuilder:(t,e)=>{var n=Fr(t.html,e,!1);return be.makeFragment(n)},mathmlBuilder:(t,e)=>rc(t.mathml,e)});var z4=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new Be("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!rF(r))throw new Be("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Ge({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},a={number:0,unit:"em"},o="";if(n[0])for(var u=zt(n[0],"raw").string,h=u.split(","),f=0;f{var n=ar(t.height,e),r=0;t.totalheight.number>0&&(r=ar(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=ar(t.width,e));var i={height:$e(n+r)};s>0&&(i.width=$e(s)),r>0&&(i.verticalAlign=$e(-r));var a=new xxe(t.src,t.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new Pe.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=ar(t.height,e),s=0;if(t.totalheight.number>0&&(s=ar(t.totalheight,e)-r,n.setAttribute("valign",$e(-s))),n.setAttribute("height",$e(r+s)),t.width.number>0){var i=ar(t.width,e);n.setAttribute("width",$e(i))}return n.setAttribute("src",t.src),n}});Ge({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=zt(e[0],"size");if(n.settings.strict){var i=r[1]==="m",a=s.value.unit==="mu";i?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return be.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=ar(t.dimension,e);return new Pe.SpaceNode(n)}});Ge({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=be.makeSpan([],[hn(t.body,e)]),n=be.makeSpan(["inner"],[n],e)):n=be.makeSpan(["inner"],[hn(t.body,e)]);var r=be.makeSpan(["fix"],[]),s=be.makeSpan([t.alignment],[n,r],e),i=be.makeSpan(["strut"]);return i.style.height=$e(s.height+s.depth),s.depth&&(i.style.verticalAlign=$e(-s.depth)),s.children.unshift(i),s=be.makeSpan(["thinbox"],[s],e),be.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new Pe.MathNode("mpadded",[Qn(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Ge({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:a}}});Ge({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new Be("Mismatched "+t.funcName)}});var FE=(t,e)=>{switch(e.style.size){case xt.DISPLAY.size:return t.display;case xt.TEXT.size:return t.text;case xt.SCRIPT.size:return t.script;case xt.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Ge({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:xr(e[0]),text:xr(e[1]),script:xr(e[2]),scriptscript:xr(e[3])}},htmlBuilder:(t,e)=>{var n=FE(t,e),r=Fr(n,e,!1);return be.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=FE(t,e);return rc(n,e)}});var IF=(t,e,n,r,s,i,a)=>{t=be.makeSpan([],[t]);var o=n&&bn.isCharacterBox(n),u,h;if(e){var f=hn(e,r.havingStyle(s.sup()),r);h={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-f.depth)}}if(n){var m=hn(n,r.havingStyle(s.sub()),r);u={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-m.height)}}var g;if(h&&u){var x=r.fontMetrics().bigOpSpacing5+u.elem.height+u.elem.depth+u.kern+t.depth+a;g=be.makeVList({positionType:"bottom",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:u.elem,marginLeft:$e(-i)},{type:"kern",size:u.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:$e(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(u){var y=t.height-a;g=be.makeVList({positionType:"top",positionData:y,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:u.elem,marginLeft:$e(-i)},{type:"kern",size:u.kern},{type:"elem",elem:t}]},r)}else if(h){var w=t.depth+a;g=be.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:$e(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var b=[g];if(u&&i!==0&&!o){var k=be.makeSpan(["mspace"],[],r);k.style.marginRight=$e(i),b.unshift(k)}return be.makeSpan(["mop","op-limits"],b,r)},qF=["\\smallint"],Eh=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=zt(t.base,"op"),s=!0):i=zt(t,"op");var a=e.style,o=!1;a.size===xt.DISPLAY.size&&i.symbol&&!qF.includes(i.name)&&(o=!0);var u;if(i.symbol){var h=o?"Size2-Regular":"Size1-Regular",f="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(f=i.name.slice(1),i.name=f==="oiint"?"\\iint":"\\iiint"),u=be.makeSymbol(i.name,h,"math",e,["mop","op-symbol",o?"large-op":"small-op"]),f.length>0){var m=u.italic,g=be.staticSvg(f+"Size"+(o?"2":"1"),e);u=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:u,shift:0},{type:"elem",elem:g,shift:o?.08:0}]},e),i.name="\\"+f,u.classes.unshift("mop"),u.italic=m}}else if(i.body){var x=Fr(i.body,e,!0);x.length===1&&x[0]instanceof $i?(u=x[0],u.classes[0]="mop"):u=be.makeSpan(["mop"],x,e)}else{for(var y=[],w=1;w{var n;if(t.symbol)n=new ui("mo",[Qi(t.name,t.mode)]),qF.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new ui("mo",Ys(t.body,e));else{n=new ui("mi",[new Da(t.name.slice(1))]);var r=new ui("mo",[Qi("⁡","text")]);t.parentIsSupSub?n=new ui("mrow",[n,r]):n=mF([n,r])}return n},v1e={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Ge({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=r;return s.length===1&&(s=v1e[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Eh,mathmlBuilder:R0});Ge({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:xr(r)}},htmlBuilder:Eh,mathmlBuilder:R0});var y1e={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Ge({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Eh,mathmlBuilder:R0});Ge({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Eh,mathmlBuilder:R0});Ge({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=y1e[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Eh,mathmlBuilder:R0});var FF=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=zt(t.base,"operatorname"),s=!0):i=zt(t,"operatorname");var a;if(i.body.length>0){for(var o=i.body.map(m=>{var g=m.text;return typeof g=="string"?{type:"textord",mode:m.mode,text:g}:m}),u=Fr(o,e.withFont("mathrm"),!0),h=0;h{for(var n=Ys(t.body,e.withFont("mathrm")),r=!0,s=0;sf.toText()).join("");n=[new Pe.TextNode(o)]}var u=new Pe.MathNode("mi",n);u.setAttribute("mathvariant","normal");var h=new Pe.MathNode("mo",[Qi("⁡","text")]);return t.parentIsSupSub?new Pe.MathNode("mrow",[u,h]):Pe.newDocumentFragment([u,h])};Ge({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"operatorname",mode:n.mode,body:xr(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:FF,mathmlBuilder:b1e});X("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Ou({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?be.makeFragment(Fr(t.body,e,!1)):be.makeSpan(["mord"],Fr(t.body,e,!0),e)},mathmlBuilder(t,e){return rc(t.body,e,!0)}});Ge({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=hn(t.body,e.havingCrampedStyle()),r=be.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return be.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new Pe.MathNode("mo",[new Pe.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Pe.MathNode("mover",[Qn(t.body,e),n]);return r.setAttribute("accent","true"),r}});Ge({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:xr(r)}},htmlBuilder:(t,e)=>{var n=Fr(t.body,e.withPhantom(),!1);return be.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=Ys(t.body,e);return new Pe.MathNode("mphantom",n)}});Ge({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=be.makeSpan([],[hn(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=Ys(xr(t.body),e),r=new Pe.MathNode("mphantom",n),s=new Pe.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Ge({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=be.makeSpan(["inner"],[hn(t.body,e.withPhantom())]),r=be.makeSpan(["fix"],[]);return be.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Ys(xr(t.body),e),r=new Pe.MathNode("mphantom",n),s=new Pe.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Ge({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=zt(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=hn(t.body,e),r=ar(t.dy,e);return be.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new Pe.MathNode("mpadded",[Qn(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Ge({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Ge({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,s=n[0],i=zt(e[0],"size"),a=zt(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&zt(s,"size").value,width:i.value,height:a.value}},htmlBuilder(t,e){var n=be.makeSpan(["mord","rule"],[],e),r=ar(t.width,e),s=ar(t.height,e),i=t.shift?ar(t.shift,e):0;return n.style.borderRightWidth=$e(r),n.style.borderTopWidth=$e(s),n.style.bottom=$e(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=ar(t.width,e),r=ar(t.height,e),s=t.shift?ar(t.shift,e):0,i=e.color&&e.getColor()||"black",a=new Pe.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",$e(n)),a.setAttribute("height",$e(r));var o=new Pe.MathNode("mpadded",[a]);return s>=0?o.setAttribute("height",$e(s)):(o.setAttribute("height",$e(s)),o.setAttribute("depth",$e(-s))),o.setAttribute("voffset",$e(s)),o}});function $F(t,e,n){for(var r=Fr(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return $F(t.body,n,e)};Ge({type:"sizing",names:$E,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:$E.indexOf(r)+1,body:i}},htmlBuilder:w1e,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Ys(t.body,n),s=new Pe.MathNode("mstyle",r);return s.setAttribute("mathsize",$e(n.sizeMultiplier)),s}});Ge({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,a=n[0]&&zt(n[0],"ordgroup");if(a)for(var o="",u=0;u{var n=be.makeSpan([],[hn(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new Pe.MathNode("mpadded",[Qn(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Ge({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,s=n[0],i=e[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(t,e){var n=hn(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=be.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+a&&(a=(a+m-n.height-n.depth)/2);var g=u.height-n.height-a-h;n.style.paddingLeft=$e(f);var x=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+g)},{type:"elem",elem:u},{type:"kern",size:h}]},e);if(t.index){var y=e.havingStyle(xt.SCRIPTSCRIPT),w=hn(t.index,y,e),b=.6*(x.height-x.depth),k=be.makeVList({positionType:"shift",positionData:-b,children:[{type:"elem",elem:w}]},e),N=be.makeSpan(["root"],[k]);return be.makeSpan(["mord","sqrt"],[N,x],e)}else return be.makeSpan(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new Pe.MathNode("mroot",[Qn(n,e),Qn(r,e)]):new Pe.MathNode("msqrt",[Qn(n,e)])}});var QE={display:xt.DISPLAY,text:xt.TEXT,script:xt.SCRIPT,scriptscript:xt.SCRIPTSCRIPT};Ge({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:a,body:i}},htmlBuilder(t,e){var n=QE[t.style],r=e.havingStyle(n).withFont("");return $F(t.body,r,e)},mathmlBuilder(t,e){var n=QE[t.style],r=e.havingStyle(n),s=Ys(t.body,r),i=new Pe.MathNode("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=a[t.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});var S1e=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===xt.DISPLAY.size||r.alwaysHandleSupSub);return s?Eh:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===xt.DISPLAY.size||r.limits);return i?FF:null}else{if(r.type==="accent")return bn.isCharacterBox(r.base)?$6:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?BF:null}else return null}else return null};Ou({type:"supsub",htmlBuilder(t,e){var n=S1e(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,a=hn(r,e),o,u,h=e.fontMetrics(),f=0,m=0,g=r&&bn.isCharacterBox(r);if(s){var x=e.havingStyle(e.style.sup());o=hn(s,x,e),g||(f=a.height-x.fontMetrics().supDrop*x.sizeMultiplier/e.sizeMultiplier)}if(i){var y=e.havingStyle(e.style.sub());u=hn(i,y,e),g||(m=a.depth+y.fontMetrics().subDrop*y.sizeMultiplier/e.sizeMultiplier)}var w;e.style===xt.DISPLAY?w=h.sup1:e.style.cramped?w=h.sup3:w=h.sup2;var b=e.sizeMultiplier,k=$e(.5/h.ptPerEm/b),N=null;if(u){var C=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(a instanceof $i||C)&&(N=$e(-a.italic))}var T;if(o&&u){f=Math.max(f,w,o.depth+.25*h.xHeight),m=Math.max(m,h.sub2);var E=h.defaultRuleThickness,_=4*E;if(f-o.depth-(u.height-m)<_){m=_-(f-o.depth)+u.height;var A=.8*h.xHeight-(f-o.depth);A>0&&(f+=A,m-=A)}var F=[{type:"elem",elem:u,shift:m,marginRight:k,marginLeft:N},{type:"elem",elem:o,shift:-f,marginRight:k}];T=be.makeVList({positionType:"individualShift",children:F},e)}else if(u){m=Math.max(m,h.sub1,u.height-.8*h.xHeight);var B=[{type:"elem",elem:u,marginLeft:N,marginRight:k}];T=be.makeVList({positionType:"shift",positionData:m,children:B},e)}else if(o)f=Math.max(f,w,o.depth+.25*h.xHeight),T=be.makeVList({positionType:"shift",positionData:-f,children:[{type:"elem",elem:o,marginRight:k}]},e);else throw new Error("supsub must have either sup or sub.");var P=hS(a,"right")||"mord";return be.makeSpan([P],[a,be.makeSpan(["msupsub"],[T])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[Qn(t.base,e)];t.sub&&i.push(Qn(t.sub,e)),t.sup&&i.push(Qn(t.sup,e));var a;if(n)a=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===xt.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===xt.DISPLAY||h.limits)?a="munderover":a="msubsup"}else{var u=t.base;u&&u.type==="op"&&u.limits&&(e.style===xt.DISPLAY||u.alwaysHandleSupSub)||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(u.limits||e.style===xt.DISPLAY)?a="munder":a="msub"}else{var o=t.base;o&&o.type==="op"&&o.limits&&(e.style===xt.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||e.style===xt.DISPLAY)?a="mover":a="msup"}return new Pe.MathNode(a,i)}});Ou({type:"atom",htmlBuilder(t,e){return be.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new Pe.MathNode("mo",[Qi(t.text,t.mode)]);if(t.family==="bin"){var r=q6(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var QF={mi:"italic",mn:"normal",mtext:"normal"};Ou({type:"mathord",htmlBuilder(t,e){return be.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new Pe.MathNode("mi",[Qi(t.text,t.mode,e)]),r=q6(t,e)||"italic";return r!==QF[n.type]&&n.setAttribute("mathvariant",r),n}});Ou({type:"textord",htmlBuilder(t,e){return be.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Qi(t.text,t.mode,e),r=q6(t,e)||"normal",s;return t.mode==="text"?s=new Pe.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new Pe.MathNode("mn",[n]):t.text==="\\prime"?s=new Pe.MathNode("mo",[n]):s=new Pe.MathNode("mi",[n]),r!==QF[s.type]&&s.setAttribute("mathvariant",r),s}});var P4={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},L4={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Ou({type:"spacing",htmlBuilder(t,e){if(L4.hasOwnProperty(t.text)){var n=L4[t.text].className||"";if(t.mode==="text"){var r=be.makeOrd(t,e,"textord");return r.classes.push(n),r}else return be.makeSpan(["mspace",n],[be.mathsym(t.text,t.mode,e)],e)}else{if(P4.hasOwnProperty(t.text))return be.makeSpan(["mspace",P4[t.text]],[],e);throw new Be('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(L4.hasOwnProperty(t.text))n=new Pe.MathNode("mtext",[new Pe.TextNode(" ")]);else{if(P4.hasOwnProperty(t.text))return new Pe.MathNode("mspace");throw new Be('Unknown type of space "'+t.text+'"')}return n}});var HE=()=>{var t=new Pe.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Ou({type:"tag",mathmlBuilder(t,e){var n=new Pe.MathNode("mtable",[new Pe.MathNode("mtr",[HE(),new Pe.MathNode("mtd",[rc(t.body,e)]),HE(),new Pe.MathNode("mtd",[rc(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var VE={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},UE={"\\textbf":"textbf","\\textmd":"textmd"},k1e={"\\textit":"textit","\\textup":"textup"},WE=(t,e)=>{var n=t.font;if(n){if(VE[n])return e.withTextFontFamily(VE[n]);if(UE[n])return e.withTextFontWeight(UE[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(k1e[n])};Ge({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"text",mode:n.mode,body:xr(s),font:r}},htmlBuilder(t,e){var n=WE(t,e),r=Fr(t.body,n,!0);return be.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=WE(t,e);return rc(t.body,n)}});Ge({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=hn(t.body,e),r=be.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=be.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return be.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new Pe.MathNode("mo",[new Pe.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Pe.MathNode("munder",[Qn(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Ge({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=hn(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return be.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new Pe.MathNode("mpadded",[Qn(t.body,e)],["vcenter"])}});Ge({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new Be("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=GE(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),Qo=hF,HF=`[ \r ]`,O1e="\\\\[a-zA-Z@]+",j1e="\\\\[^\uD800-\uDFFF]",N1e="("+O1e+")"+HF+"*",C1e=`\\\\( |[ \r ]+ ?)[ \r ]*`,gS="[̀-ͯ]",T1e=new RegExp(gS+"+$"),E1e="("+HF+"+)|"+(C1e+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(gS+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(gS+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+N1e)+("|"+j1e+")");class XE{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(E1e,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new mi("EOF",new Bs(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new Be("Unexpected character: '"+e[n]+"'",new mi(e[n],new Bs(this,n,n+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=e.indexOf(` `,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new mi(s,new Bs(this,n,this.tokenRegex.lastIndex))}}class _1e{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Be("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var M1e=RF;X("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});X("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});X("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});X("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});X("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});X("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");X("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var YE={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};X("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new Be("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=YE[e.text],r==null||r>=n)throw new Be("Invalid base-"+n+" digit "+e.text);for(var s;(s=YE[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new Be("\\newcommand's first argument must be a macro name");var i=s[0].text,a=t.isDefined(i);if(a&&!e)throw new Be("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!a&&!n)throw new Be("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var o=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var u="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)u+=h.text,h=t.expandNextToken();if(!u.match(/^\s*[0-9]+\s*$/))throw new Be("Invalid number of arguments: "+u);o=parseInt(u),s=t.consumeArg().tokens}return a&&r||t.macros.set(i,{tokens:s,numArgs:o}),""};X("\\newcommand",t=>Y6(t,!1,!0,!1));X("\\renewcommand",t=>Y6(t,!0,!1,!1));X("\\providecommand",t=>Y6(t,!0,!0,!0));X("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});X("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});X("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),Qo[n],Un.math[n],Un.text[n]),""});X("\\bgroup","{");X("\\egroup","}");X("~","\\nobreakspace");X("\\lq","`");X("\\rq","'");X("\\aa","\\r a");X("\\AA","\\r A");X("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");X("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");X("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");X("ℬ","\\mathscr{B}");X("ℰ","\\mathscr{E}");X("ℱ","\\mathscr{F}");X("ℋ","\\mathscr{H}");X("ℐ","\\mathscr{I}");X("ℒ","\\mathscr{L}");X("ℳ","\\mathscr{M}");X("ℛ","\\mathscr{R}");X("ℭ","\\mathfrak{C}");X("ℌ","\\mathfrak{H}");X("ℨ","\\mathfrak{Z}");X("\\Bbbk","\\Bbb{k}");X("·","\\cdotp");X("\\llap","\\mathllap{\\textrm{#1}}");X("\\rlap","\\mathrlap{\\textrm{#1}}");X("\\clap","\\mathclap{\\textrm{#1}}");X("\\mathstrut","\\vphantom{(}");X("\\underbar","\\underline{\\text{#1}}");X("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');X("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");X("\\ne","\\neq");X("≠","\\neq");X("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");X("∉","\\notin");X("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");X("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");X("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");X("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");X("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");X("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");X("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");X("⟂","\\perp");X("‼","\\mathclose{!\\mkern-0.8mu!}");X("∌","\\notni");X("⌜","\\ulcorner");X("⌝","\\urcorner");X("⌞","\\llcorner");X("⌟","\\lrcorner");X("©","\\copyright");X("®","\\textregistered");X("️","\\textregistered");X("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');X("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');X("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');X("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');X("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");X("⋮","\\vdots");X("\\varGamma","\\mathit{\\Gamma}");X("\\varDelta","\\mathit{\\Delta}");X("\\varTheta","\\mathit{\\Theta}");X("\\varLambda","\\mathit{\\Lambda}");X("\\varXi","\\mathit{\\Xi}");X("\\varPi","\\mathit{\\Pi}");X("\\varSigma","\\mathit{\\Sigma}");X("\\varUpsilon","\\mathit{\\Upsilon}");X("\\varPhi","\\mathit{\\Phi}");X("\\varPsi","\\mathit{\\Psi}");X("\\varOmega","\\mathit{\\Omega}");X("\\substack","\\begin{subarray}{c}#1\\end{subarray}");X("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");X("\\boxed","\\fbox{$\\displaystyle{#1}$}");X("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");X("\\implies","\\DOTSB\\;\\Longrightarrow\\;");X("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");X("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");X("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var ZE={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};X("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in ZE?e=ZE[n]:(n.slice(0,4)==="\\not"||n in Un.math&&["bin","rel"].includes(Un.math[n].group))&&(e="\\dotsb"),e});var Z6={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};X("\\dotso",function(t){var e=t.future().text;return e in Z6?"\\ldots\\,":"\\ldots"});X("\\dotsc",function(t){var e=t.future().text;return e in Z6&&e!==","?"\\ldots\\,":"\\ldots"});X("\\cdots",function(t){var e=t.future().text;return e in Z6?"\\@cdots\\,":"\\@cdots"});X("\\dotsb","\\cdots");X("\\dotsm","\\cdots");X("\\dotsi","\\!\\cdots");X("\\dotsx","\\ldots\\,");X("\\DOTSI","\\relax");X("\\DOTSB","\\relax");X("\\DOTSX","\\relax");X("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");X("\\,","\\tmspace+{3mu}{.1667em}");X("\\thinspace","\\,");X("\\>","\\mskip{4mu}");X("\\:","\\tmspace+{4mu}{.2222em}");X("\\medspace","\\:");X("\\;","\\tmspace+{5mu}{.2777em}");X("\\thickspace","\\;");X("\\!","\\tmspace-{3mu}{.1667em}");X("\\negthinspace","\\!");X("\\negmedspace","\\tmspace-{4mu}{.2222em}");X("\\negthickspace","\\tmspace-{5mu}{.277em}");X("\\enspace","\\kern.5em ");X("\\enskip","\\hskip.5em\\relax");X("\\quad","\\hskip1em\\relax");X("\\qquad","\\hskip2em\\relax");X("\\tag","\\@ifstar\\tag@literal\\tag@paren");X("\\tag@paren","\\tag@literal{({#1})}");X("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new Be("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});X("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");X("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");X("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");X("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");X("\\newline","\\\\\\relax");X("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var VF=$e(Ra["Main-Regular"][84][1]-.7*Ra["Main-Regular"][65][1]);X("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+VF+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");X("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+VF+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");X("\\hspace","\\@ifstar\\@hspacer\\@hspace");X("\\@hspace","\\hskip #1\\relax");X("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");X("\\ordinarycolon",":");X("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");X("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');X("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');X("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');X("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');X("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');X("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');X("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');X("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');X("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');X("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');X("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');X("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');X("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');X("∷","\\dblcolon");X("∹","\\eqcolon");X("≔","\\coloneqq");X("≕","\\eqqcolon");X("⩴","\\Coloneqq");X("\\ratio","\\vcentcolon");X("\\coloncolon","\\dblcolon");X("\\colonequals","\\coloneqq");X("\\coloncolonequals","\\Coloneqq");X("\\equalscolon","\\eqqcolon");X("\\equalscoloncolon","\\Eqqcolon");X("\\colonminus","\\coloneq");X("\\coloncolonminus","\\Coloneq");X("\\minuscolon","\\eqcolon");X("\\minuscoloncolon","\\Eqcolon");X("\\coloncolonapprox","\\Colonapprox");X("\\coloncolonsim","\\Colonsim");X("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");X("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");X("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");X("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");X("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");X("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");X("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");X("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");X("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");X("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");X("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");X("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");X("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");X("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");X("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");X("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");X("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");X("\\nleqq","\\html@mathml{\\@nleqq}{≰}");X("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");X("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");X("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");X("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");X("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");X("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");X("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");X("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");X("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");X("\\imath","\\html@mathml{\\@imath}{ı}");X("\\jmath","\\html@mathml{\\@jmath}{ȷ}");X("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");X("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");X("⟦","\\llbracket");X("⟧","\\rrbracket");X("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");X("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");X("⦃","\\lBrace");X("⦄","\\rBrace");X("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");X("⦵","\\minuso");X("\\darr","\\downarrow");X("\\dArr","\\Downarrow");X("\\Darr","\\Downarrow");X("\\lang","\\langle");X("\\rang","\\rangle");X("\\uarr","\\uparrow");X("\\uArr","\\Uparrow");X("\\Uarr","\\Uparrow");X("\\N","\\mathbb{N}");X("\\R","\\mathbb{R}");X("\\Z","\\mathbb{Z}");X("\\alef","\\aleph");X("\\alefsym","\\aleph");X("\\Alpha","\\mathrm{A}");X("\\Beta","\\mathrm{B}");X("\\bull","\\bullet");X("\\Chi","\\mathrm{X}");X("\\clubs","\\clubsuit");X("\\cnums","\\mathbb{C}");X("\\Complex","\\mathbb{C}");X("\\Dagger","\\ddagger");X("\\diamonds","\\diamondsuit");X("\\empty","\\emptyset");X("\\Epsilon","\\mathrm{E}");X("\\Eta","\\mathrm{H}");X("\\exist","\\exists");X("\\harr","\\leftrightarrow");X("\\hArr","\\Leftrightarrow");X("\\Harr","\\Leftrightarrow");X("\\hearts","\\heartsuit");X("\\image","\\Im");X("\\infin","\\infty");X("\\Iota","\\mathrm{I}");X("\\isin","\\in");X("\\Kappa","\\mathrm{K}");X("\\larr","\\leftarrow");X("\\lArr","\\Leftarrow");X("\\Larr","\\Leftarrow");X("\\lrarr","\\leftrightarrow");X("\\lrArr","\\Leftrightarrow");X("\\Lrarr","\\Leftrightarrow");X("\\Mu","\\mathrm{M}");X("\\natnums","\\mathbb{N}");X("\\Nu","\\mathrm{N}");X("\\Omicron","\\mathrm{O}");X("\\plusmn","\\pm");X("\\rarr","\\rightarrow");X("\\rArr","\\Rightarrow");X("\\Rarr","\\Rightarrow");X("\\real","\\Re");X("\\reals","\\mathbb{R}");X("\\Reals","\\mathbb{R}");X("\\Rho","\\mathrm{P}");X("\\sdot","\\cdot");X("\\sect","\\S");X("\\spades","\\spadesuit");X("\\sub","\\subset");X("\\sube","\\subseteq");X("\\supe","\\supseteq");X("\\Tau","\\mathrm{T}");X("\\thetasym","\\vartheta");X("\\weierp","\\wp");X("\\Zeta","\\mathrm{Z}");X("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");X("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");X("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");X("\\bra","\\mathinner{\\langle{#1}|}");X("\\ket","\\mathinner{|{#1}\\rangle}");X("\\braket","\\mathinner{\\langle{#1}\\rangle}");X("\\Bra","\\left\\langle#1\\right|");X("\\Ket","\\left|#1\\right\\rangle");var UF=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,a=e.macros.get("|"),o=e.macros.get("\\|");e.macros.beginGroup();var u=m=>g=>{t&&(g.macros.set("|",a),s.length&&g.macros.set("\\|",o));var x=m;if(!m&&s.length){var y=g.future();y.text==="|"&&(g.popToken(),x=!0)}return{tokens:x?s:r,numArgs:0}};e.macros.set("|",u(!1)),s.length&&e.macros.set("\\|",u(!0));var h=e.consumeArg().tokens,f=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:f.reverse(),numArgs:0}};X("\\bra@ket",UF(!1));X("\\bra@set",UF(!0));X("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");X("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");X("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");X("\\angln","{\\angl n}");X("\\blue","\\textcolor{##6495ed}{#1}");X("\\orange","\\textcolor{##ffa500}{#1}");X("\\pink","\\textcolor{##ff00af}{#1}");X("\\red","\\textcolor{##df0030}{#1}");X("\\green","\\textcolor{##28ae7b}{#1}");X("\\gray","\\textcolor{gray}{#1}");X("\\purple","\\textcolor{##9d38bd}{#1}");X("\\blueA","\\textcolor{##ccfaff}{#1}");X("\\blueB","\\textcolor{##80f6ff}{#1}");X("\\blueC","\\textcolor{##63d9ea}{#1}");X("\\blueD","\\textcolor{##11accd}{#1}");X("\\blueE","\\textcolor{##0c7f99}{#1}");X("\\tealA","\\textcolor{##94fff5}{#1}");X("\\tealB","\\textcolor{##26edd5}{#1}");X("\\tealC","\\textcolor{##01d1c1}{#1}");X("\\tealD","\\textcolor{##01a995}{#1}");X("\\tealE","\\textcolor{##208170}{#1}");X("\\greenA","\\textcolor{##b6ffb0}{#1}");X("\\greenB","\\textcolor{##8af281}{#1}");X("\\greenC","\\textcolor{##74cf70}{#1}");X("\\greenD","\\textcolor{##1fab54}{#1}");X("\\greenE","\\textcolor{##0d923f}{#1}");X("\\goldA","\\textcolor{##ffd0a9}{#1}");X("\\goldB","\\textcolor{##ffbb71}{#1}");X("\\goldC","\\textcolor{##ff9c39}{#1}");X("\\goldD","\\textcolor{##e07d10}{#1}");X("\\goldE","\\textcolor{##a75a05}{#1}");X("\\redA","\\textcolor{##fca9a9}{#1}");X("\\redB","\\textcolor{##ff8482}{#1}");X("\\redC","\\textcolor{##f9685d}{#1}");X("\\redD","\\textcolor{##e84d39}{#1}");X("\\redE","\\textcolor{##bc2612}{#1}");X("\\maroonA","\\textcolor{##ffbde0}{#1}");X("\\maroonB","\\textcolor{##ff92c6}{#1}");X("\\maroonC","\\textcolor{##ed5fa6}{#1}");X("\\maroonD","\\textcolor{##ca337c}{#1}");X("\\maroonE","\\textcolor{##9e034e}{#1}");X("\\purpleA","\\textcolor{##ddd7ff}{#1}");X("\\purpleB","\\textcolor{##c6b9fc}{#1}");X("\\purpleC","\\textcolor{##aa87ff}{#1}");X("\\purpleD","\\textcolor{##7854ab}{#1}");X("\\purpleE","\\textcolor{##543b78}{#1}");X("\\mintA","\\textcolor{##f5f9e8}{#1}");X("\\mintB","\\textcolor{##edf2df}{#1}");X("\\mintC","\\textcolor{##e0e5cc}{#1}");X("\\grayA","\\textcolor{##f6f7f7}{#1}");X("\\grayB","\\textcolor{##f0f1f2}{#1}");X("\\grayC","\\textcolor{##e3e5e6}{#1}");X("\\grayD","\\textcolor{##d6d8da}{#1}");X("\\grayE","\\textcolor{##babec2}{#1}");X("\\grayF","\\textcolor{##888d93}{#1}");X("\\grayG","\\textcolor{##626569}{#1}");X("\\grayH","\\textcolor{##3b3e40}{#1}");X("\\grayI","\\textcolor{##21242c}{#1}");X("\\kaBlue","\\textcolor{##314453}{#1}");X("\\kaGreen","\\textcolor{##71B307}{#1}");var WF={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class A1e{constructor(e,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(e),this.macros=new _1e(M1e,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new XE(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new mi("EOF",r.loc)),this.pushTokens(s),new mi("",Bs.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,a=0,o=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++a;else if(i.text==="}"){if(--a,a===-1)throw new Be("Extra }",i)}else if(i.text==="EOF")throw new Be("Unexpected end of input in a macro argument, expected '"+(e&&r?e[o]:"}")+"'",i);if(e&&r)if((a===0||a===1&&e[o]==="{")&&i.text===e[o]){if(++o,o===e.length){n.splice(-o,o);break}}else o=0}while(a!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new Be("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new Be("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||e&&s.unexpandable){if(e&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new Be("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,a=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var o=i.length-1;o>=0;--o){var u=i[o];if(u.text==="#"){if(o===0)throw new Be("Incomplete placeholder at end of macro body",u);if(u=i[--o],u.text==="#")i.splice(o+1,1);else if(/^[1-9]$/.test(u.text))i.splice(o,2,...a[+u.text-1]);else throw new Be("Not a valid argument number",u)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new mi(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var a=s.replace(/##/g,"");a.indexOf("#"+(i+1))!==-1;)++i;for(var o=new XE(s,this.settings),u=[],h=o.lex();h.text!=="EOF";)u.push(h),h=o.lex();u.reverse();var f={tokens:u,numArgs:i};return f}return s}isDefined(e){return this.macros.has(e)||Qo.hasOwnProperty(e)||Un.math.hasOwnProperty(e)||Un.text.hasOwnProperty(e)||WF.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Qo.hasOwnProperty(e)&&!Qo[e].primitive}}var KE=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,sx=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),B4={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},JE={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Lv{constructor(e,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new A1e(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new Be("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new mi("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(Lv.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&Qo[s.text]&&Qo[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,s=0;s=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var o=Un[this.mode][n].group,u=Bs.range(e),h;if(bxe.hasOwnProperty(o)){var f=o;h={type:"atom",mode:this.mode,family:f,loc:u,text:n}}else h={type:o,mode:this.mode,loc:u,text:n};a=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(nF(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),a={type:"textord",mode:"text",loc:Bs.range(e),text:n};else return null;if(this.consume(),i)for(var m=0;mh&&(h=f):f&&(h!==void 0&&h>-1&&u.push(` `.repeat(h)||" "),h=-1,u.push(f))}return u.join("")}function e$(t,e,n){return t.type==="element"?cve(t,e,n):t.type==="text"?n.whitespace==="normal"?t$(t,n):uve(t):[]}function cve(t,e,n){const r=n$(t,n),s=t.children||[];let i=-1,a=[];if(lve(t))return a;let o,u;for(vS(t)||o_(t)&&s_(e,t,o_)?u=` `:ave(t)?(o=2,u=2):JF(t)&&(o=1,u=1);++i{try{i(!0);const ve=await bve({page:a,page_size:f,search:g||void 0,is_registered:y==="all"?void 0:y==="registered",is_banned:b==="all"?void 0:b==="banned",format:N==="all"?void 0:N,sort_by:"usage_count",sort_order:"desc"});e(ve.data),h(ve.total)}catch(ve){const Fe=ve instanceof Error?ve.message:"加载表情包列表失败";ee({title:"错误",description:Fe,variant:"destructive"})}finally{i(!1)}},[a,f,g,y,b,N,ee]),R=async()=>{try{const ve=await Ove();r(ve.data)}catch(ve){console.error("加载统计数据失败:",ve)}};O.useEffect(()=>{Y()},[Y]),O.useEffect(()=>{R()},[]);const re=async ve=>{try{const Fe=await wve(ve.id);E(Fe.data),A(!0)}catch(Fe){const Qe=Fe instanceof Error?Fe.message:"加载详情失败";ee({title:"错误",description:Qe,variant:"destructive"})}},K=ve=>{E(ve),B(!0)},I=ve=>{E(ve),H(!0)},Q=async()=>{if(T)try{await kve(T.id),ee({title:"成功",description:"表情包已删除"}),H(!1),E(null),Y(),R()}catch(ve){const Fe=ve instanceof Error?ve.message:"删除失败";ee({title:"错误",description:Fe,variant:"destructive"})}},$=async ve=>{try{await jve(ve.id),ee({title:"成功",description:"表情包已注册"}),Y(),R()}catch(Fe){const Qe=Fe instanceof Error?Fe.message:"注册失败";ee({title:"错误",description:Qe,variant:"destructive"})}},Z=async ve=>{try{await Nve(ve.id),ee({title:"成功",description:"表情包已封禁"}),Y(),R()}catch(Fe){const Qe=Fe instanceof Error?Fe.message:"封禁失败";ee({title:"错误",description:Qe,variant:"destructive"})}},ne=ve=>{const Fe=new Set(U);Fe.has(ve)?Fe.delete(ve):Fe.add(ve),te(Fe)},ge=()=>{U.size===t.length&&t.length>0?te(new Set):te(new Set(t.map(ve=>ve.id)))},se=async()=>{try{const ve=await Cve(Array.from(U));ee({title:"批量删除完成",description:ve.message}),te(new Set),W(!1),Y(),R()}catch(ve){ee({title:"批量删除失败",description:ve instanceof Error?ve.message:"批量删除失败",variant:"destructive"})}},Te=()=>{const ve=parseInt(q),Fe=Math.ceil(u/f);ve>=1&&ve<=Fe?(o(ve),J("")):ee({title:"无效的页码",description:`请输入1-${Fe}之间的页码`,variant:"destructive"})},qe=n?.formats?Object.keys(n.formats):[];return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsxs("div",{className:"mb-4 sm:mb-6",children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),l.jsx(yn,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&l.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[l.jsx(Ct,{children:l.jsxs(xn,{className:"pb-2",children:[l.jsx(Lr,{children:"总数"}),l.jsx(vn,{className:"text-2xl",children:n.total})]})}),l.jsx(Ct,{children:l.jsxs(xn,{className:"pb-2",children:[l.jsx(Lr,{children:"已注册"}),l.jsx(vn,{className:"text-2xl text-green-600",children:n.registered})]})}),l.jsx(Ct,{children:l.jsxs(xn,{className:"pb-2",children:[l.jsx(Lr,{children:"已封禁"}),l.jsx(vn,{className:"text-2xl text-red-600",children:n.banned})]})}),l.jsx(Ct,{children:l.jsxs(xn,{className:"pb-2",children:[l.jsx(Lr,{children:"未注册"}),l.jsx(vn,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),l.jsxs(Ct,{children:[l.jsx(xn,{children:l.jsxs(vn,{className:"flex items-center gap-2",children:[l.jsx(q5,{className:"h-5 w-5"}),"搜索和筛选"]})}),l.jsxs(Tn,{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{children:"搜索"}),l.jsxs("div",{className:"relative",children:[l.jsx(js,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),l.jsx(Re,{placeholder:"描述或哈希值...",value:g,onChange:ve=>{x(ve.target.value),o(1)},className:"pl-8"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{children:"注册状态"}),l.jsxs(It,{value:y,onValueChange:ve=>{w(ve),o(1)},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"all",children:"全部"}),l.jsx(ze,{value:"registered",children:"已注册"}),l.jsx(ze,{value:"unregistered",children:"未注册"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{children:"封禁状态"}),l.jsxs(It,{value:b,onValueChange:ve=>{k(ve),o(1)},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"all",children:"全部"}),l.jsx(ze,{value:"banned",children:"已封禁"}),l.jsx(ze,{value:"unbanned",children:"未封禁"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{children:"格式"}),l.jsxs(It,{value:N,onValueChange:ve=>{C(ve),o(1)},children:[l.jsx(Pt,{children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"all",children:"全部"}),qe.map(ve=>l.jsxs(ze,{value:ve,children:[ve.toUpperCase()," (",n?.formats[ve],")"]},ve))]})]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[l.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:U.size>0&&l.jsxs("span",{children:["已选择 ",U.size," 个表情包"]})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ce,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(It,{value:f.toString(),onValueChange:ve=>{m(parseInt(ve)),o(1),te(new Set)},children:[l.jsx(Pt,{id:"emoji-page-size",className:"w-20",children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),U.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>te(new Set),children:"取消选择"}),l.jsxs(de,{variant:"destructive",size:"sm",onClick:()=>W(!0),children:[l.jsx(Kt,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),l.jsx("div",{className:"flex justify-end pt-4 border-t",children:l.jsxs(de,{variant:"outline",size:"sm",onClick:Y,disabled:s,children:[l.jsx(hi,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{children:[l.jsx(vn,{children:"表情包列表"}),l.jsxs(Lr,{children:["共 ",u," 个表情包,当前第 ",a," 页"]})]}),l.jsxs(Tn,{children:[l.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:l.jsxs(bu,{children:[l.jsx(wu,{children:l.jsxs(_r,{children:[l.jsx(jt,{className:"w-12",children:l.jsx(ms,{checked:t.length>0&&U.size===t.length,onCheckedChange:ge,"aria-label":"全选"})}),l.jsx(jt,{className:"w-16",children:"预览"}),l.jsx(jt,{children:"描述"}),l.jsx(jt,{children:"格式"}),l.jsx(jt,{children:"情绪"}),l.jsx(jt,{className:"text-center",children:"状态"}),l.jsx(jt,{className:"text-right",children:"使用次数"}),l.jsx(jt,{className:"text-right",children:"操作"})]})}),l.jsx(Su,{children:t.length===0?l.jsx(_r,{children:l.jsx(gt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(ve=>l.jsxs(_r,{children:[l.jsx(gt,{children:l.jsx(ms,{checked:U.has(ve.id),onCheckedChange:()=>ne(ve.id),"aria-label":`选择 ${ve.description}`})}),l.jsx(gt,{children:l.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:l.jsx("img",{src:yS(ve.id),alt:ve.description||"表情包",className:"w-full h-full object-cover",onError:Fe=>{const Qe=Fe.target;Qe.style.display="none";const Ke=Qe.parentElement;Ke&&(Ke.innerHTML='')}})})}),l.jsx(gt,{children:l.jsxs("div",{className:"space-y-1 max-w-xs",children:[l.jsx("div",{className:"font-medium truncate",title:ve.description||"无描述",children:ve.description||"无描述"}),l.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[ve.emoji_hash.slice(0,16),"..."]})]})}),l.jsx(gt,{children:l.jsx(kn,{variant:"outline",children:ve.format.toUpperCase()})}),l.jsx(gt,{children:l.jsx(c_,{emotions:ve.emotion})}),l.jsx(gt,{className:"align-middle",children:l.jsxs("div",{className:"flex gap-2 justify-center",children:[ve.is_registered&&l.jsxs(kn,{variant:"default",className:"bg-green-600",children:[l.jsx(Ea,{className:"h-3 w-3 mr-1"}),"已注册"]}),ve.is_banned&&l.jsxs(kn,{variant:"destructive",children:[l.jsx(P5,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),l.jsx(gt,{className:"text-right font-mono",children:ve.usage_count}),l.jsx(gt,{children:l.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>re(ve),children:[l.jsx(Il,{className:"h-4 w-4 mr-1"}),"详情"]}),l.jsxs(de,{variant:"default",size:"sm",onClick:()=>K(ve),children:[l.jsx(Gd,{className:"h-4 w-4 mr-1"}),"编辑"]}),!ve.is_registered&&l.jsxs(de,{size:"sm",onClick:()=>$(ve),className:"bg-green-600 hover:bg-green-700 text-white",children:[l.jsx(Ea,{className:"h-4 w-4 mr-1"}),"注册"]}),!ve.is_banned&&l.jsxs(de,{size:"sm",onClick:()=>Z(ve),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[l.jsx(N8,{className:"h-4 w-4 mr-1"}),"封禁"]}),l.jsxs(de,{size:"sm",onClick:()=>I(ve),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(Kt,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ve.id))})]})}),l.jsx("div",{className:"md:hidden space-y-3",children:t.length===0?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(ve=>l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[l.jsxs("div",{className:"flex gap-3",children:[l.jsx("div",{className:"flex-shrink-0",children:l.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:l.jsx("img",{src:yS(ve.id),alt:ve.description||"表情包",className:"w-full h-full object-cover",onError:Fe=>{const Qe=Fe.target;Qe.style.display="none";const Ke=Qe.parentElement;Ke&&(Ke.innerHTML='')}})})}),l.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[l.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[l.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:ve.description||"无描述",children:ve.description||"无描述"}),l.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[ve.emoji_hash.slice(0,16),"..."]})]}),l.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[l.jsx(kn,{variant:"outline",className:"text-xs flex-shrink-0",children:ve.format.toUpperCase()}),ve.is_registered&&l.jsxs(kn,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[l.jsx(Ea,{className:"h-3 w-3 mr-1"}),"已注册"]}),ve.is_banned&&l.jsxs(kn,{variant:"destructive",className:"text-xs flex-shrink-0",children:[l.jsx(P5,{className:"h-3 w-3 mr-1"}),"已封禁"]}),l.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",ve.usage_count]})]}),ve.emotion&&ve.emotion.trim()&&l.jsx("div",{className:"min-w-0 overflow-hidden",children:l.jsx(c_,{emotions:ve.emotion})})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>re(ve),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx(Il,{className:"h-3 w-3 mr-1"}),"详情"]}),l.jsxs(de,{variant:"default",size:"sm",onClick:()=>K(ve),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx(Gd,{className:"h-3 w-3 mr-1"}),"编辑"]}),!ve.is_registered&&l.jsxs(de,{size:"sm",onClick:()=>$(ve),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[l.jsx(Ea,{className:"h-3 w-3 mr-1"}),"注册"]}),!ve.is_banned&&l.jsxs(de,{size:"sm",onClick:()=>Z(ve),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[l.jsx(N8,{className:"h-3 w-3 mr-1"}),"封禁"]}),l.jsxs(de,{size:"sm",onClick:()=>I(ve),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(Kt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ve.id))}),u>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(a-1)*f+1," 到"," ",Math.min(a*f,u)," 条,共 ",u," 条"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(i0,{className:"h-4 w-4"})}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(ve=>Math.max(1,ve-1)),disabled:a===1,children:[l.jsx(vu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Re,{type:"number",value:q,onChange:ve=>J(ve.target.value),onKeyDown:ve=>ve.key==="Enter"&&Te(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/f)}),l.jsx(de,{variant:"outline",size:"sm",onClick:Te,disabled:!q,className:"h-8",children:"跳转"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(ve=>ve+1),disabled:a>=Math.ceil(u/f),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(yu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(u/f)),disabled:a>=Math.ceil(u/f),className:"hidden sm:flex",children:l.jsx(a0,{className:"h-4 w-4"})})]})]})]})]}),l.jsx(Eve,{emoji:T,open:_,onOpenChange:A}),l.jsx(_ve,{emoji:T,open:F,onOpenChange:B,onSuccess:()=>{Y(),R()}})]})}),l.jsx(wn,{open:z,onOpenChange:W,children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认批量删除"}),l.jsxs(cn,{children:["你确定要删除选中的 ",U.size," 个表情包吗?此操作不可撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:se,children:"确认删除"})]})]})}),l.jsx(Mr,{open:P,onOpenChange:H,children:l.jsxs(vr,{children:[l.jsxs(yr,{children:[l.jsx(br,{children:"确认删除"}),l.jsx(as,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),l.jsxs(Ns,{children:[l.jsx(de,{variant:"outline",onClick:()=>H(!1),children:"取消"}),l.jsx(de,{variant:"destructive",onClick:Q,children:"删除"})]})]})})]})}function Eve({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return l.jsx(Mr,{open:e,onOpenChange:n,children:l.jsxs(vr,{className:"max-w-2xl max-h-[90vh]",children:[l.jsx(yr,{children:l.jsx(br,{children:"表情包详情"})}),l.jsx(yn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"flex justify-center",children:l.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:l.jsx("img",{src:yS(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const a=i.parentElement;a&&(a.innerHTML='')}})})}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(ce,{className:"text-muted-foreground",children:"ID"}),l.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"text-muted-foreground",children:"格式"}),l.jsx("div",{className:"mt-1",children:l.jsx(kn,{variant:"outline",children:t.format.toUpperCase()})})]})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"text-muted-foreground",children:"文件路径"}),l.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"text-muted-foreground",children:"哈希值"}),l.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"text-muted-foreground",children:"描述"}),t.description?l.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:l.jsx(yve,{className:"prose-sm",children:t.description})}):l.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"text-muted-foreground",children:"情绪"}),l.jsx("div",{className:"mt-1",children:t.emotion?l.jsx("span",{className:"text-sm",children:t.emotion}):l.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(ce,{className:"text-muted-foreground",children:"状态"}),l.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&l.jsx(kn,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&l.jsx(kn,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&l.jsx(kn,{variant:"outline",children:"未注册"})]})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"text-muted-foreground",children:"使用次数"}),l.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(ce,{className:"text-muted-foreground",children:"记录时间"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"text-muted-foreground",children:"注册时间"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),l.jsxs("div",{children:[l.jsx(ce,{className:"text-muted-foreground",children:"最后使用"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function _ve({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=O.useState(""),[a,o]=O.useState(""),[u,h]=O.useState(!1),[f,m]=O.useState(!1),[g,x]=O.useState(!1),{toast:y}=$r();O.useEffect(()=>{t&&(i(t.description||""),o(t.emotion||""),h(t.is_registered),m(t.is_banned))},[t]);const w=async()=>{if(t)try{x(!0);const b=a.split(/[,,]/).map(k=>k.trim()).filter(Boolean).join(",");await Sve(t.id,{description:s||void 0,emotion:b||void 0,is_registered:u,is_banned:f}),y({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(b){const k=b instanceof Error?b.message:"保存失败";y({title:"错误",description:k,variant:"destructive"})}finally{x(!1)}};return t?l.jsx(Mr,{open:e,onOpenChange:n,children:l.jsxs(vr,{className:"max-w-2xl",children:[l.jsxs(yr,{children:[l.jsx(br,{children:"编辑表情包"}),l.jsx(as,{children:"修改表情包的描述和标签信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(ce,{children:"描述"}),l.jsx(Rn,{value:s,onChange:b=>i(b.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),l.jsxs("div",{children:[l.jsx(ce,{children:"情绪"}),l.jsx(Rn,{value:a,onChange:b=>o(b.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ms,{id:"is_registered",checked:u,onCheckedChange:b=>h(b===!0)}),l.jsx(ce,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ms,{id:"is_banned",checked:f,onCheckedChange:b=>m(b===!0)}),l.jsx(ce,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),l.jsxs(Ns,{children:[l.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(de,{onClick:w,disabled:g,children:g?"保存中...":"保存"})]})]})}):null}function c_({emotions:t}){if(!t||t.trim()==="")return l.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const e=20,n=t.length>e?t.slice(0,e)+"...":t;return l.jsx("div",{className:"text-sm break-words max-w-xs",title:t,children:n})}const Nu="/api/webui/expression";async function Mve(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.chat_id&&e.append("chat_id",t.chat_id);const n=await yt(`${Nu}/list?${e}`,{headers:Et()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function Ave(t){const e=await yt(`${Nu}/${t}`,{headers:Et()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function Rve(t){const e=await yt(`${Nu}/`,{method:"POST",headers:Et(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function Dve(t,e){const n=await yt(`${Nu}/${t}`,{method:"PATCH",headers:Et(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function zve(t){const e=await yt(`${Nu}/${t}`,{method:"DELETE",headers:Et()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function Pve(t){const e=await yt(`${Nu}/batch/delete`,{method:"POST",headers:Et(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function Lve(){const t=await yt(`${Nu}/stats/summary`,{headers:Et()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function Bve(){const[t,e]=O.useState([]),[n,r]=O.useState(!0),[s,i]=O.useState(0),[a,o]=O.useState(1),[u,h]=O.useState(20),[f,m]=O.useState(""),[g,x]=O.useState(null),[y,w]=O.useState(!1),[b,k]=O.useState(!1),[N,C]=O.useState(!1),[T,E]=O.useState(null),[_,A]=O.useState(new Set),[F,B]=O.useState(!1),[P,H]=O.useState(""),[U,te]=O.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:z}=$r(),W=async()=>{try{r(!0);const $=await Mve({page:a,page_size:u,search:f||void 0});e($.data),i($.total)}catch($){z({title:"加载失败",description:$ instanceof Error?$.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},q=async()=>{try{const $=await Lve();$?.data&&te($.data)}catch($){console.error("加载统计数据失败:",$)}};O.useEffect(()=>{W(),q()},[a,u,f]);const J=async $=>{try{const Z=await Ave($.id);x(Z.data),w(!0)}catch(Z){z({title:"加载详情失败",description:Z instanceof Error?Z.message:"无法加载表达方式详情",variant:"destructive"})}},ee=$=>{x($),k(!0)},Y=async $=>{try{await zve($.id),z({title:"删除成功",description:`已删除表达方式: ${$.situation}`}),E(null),W(),q()}catch(Z){z({title:"删除失败",description:Z instanceof Error?Z.message:"无法删除表达方式",variant:"destructive"})}},R=$=>{const Z=new Set(_);Z.has($)?Z.delete($):Z.add($),A(Z)},re=()=>{_.size===t.length&&t.length>0?A(new Set):A(new Set(t.map($=>$.id)))},K=async()=>{try{await Pve(Array.from(_)),z({title:"批量删除成功",description:`已删除 ${_.size} 个表达方式`}),A(new Set),B(!1),W(),q()}catch($){z({title:"批量删除失败",description:$ instanceof Error?$.message:"无法批量删除表达方式",variant:"destructive"})}},I=()=>{const $=parseInt(P),Z=Math.ceil(s/u);$>=1&&$<=Z?(o($),H("")):z({title:"无效的页码",description:`请输入1-${Z}之间的页码`,variant:"destructive"})},Q=$=>$?new Date($*1e3).toLocaleString("zh-CN"):"-";return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsx("div",{className:"mb-4 sm:mb-6",children:l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[l.jsx(r0,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),l.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),l.jsxs(de,{onClick:()=>C(!0),className:"gap-2",children:[l.jsx(is,{className:"h-4 w-4"}),"新增表达方式"]})]})}),l.jsx(yn,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),l.jsx("div",{className:"text-2xl font-bold mt-1",children:U.total})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:U.recent_7days})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:U.chat_count})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx(ce,{htmlFor:"search",children:"搜索"}),l.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(js,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),l.jsx(Re,{id:"search",placeholder:"搜索情境、风格或上下文...",value:f,onChange:$=>m($.target.value),className:"pl-9"})]})}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[l.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:_.size>0&&l.jsxs("span",{children:["已选择 ",_.size," 个表达方式"]})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ce,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(It,{value:u.toString(),onValueChange:$=>{h(parseInt($)),o(1),A(new Set)},children:[l.jsx(Pt,{id:"page-size",className:"w-20",children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),_.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>A(new Set),children:"取消选择"}),l.jsxs(de,{variant:"destructive",size:"sm",onClick:()=>B(!0),children:[l.jsx(Kt,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card",children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(bu,{children:[l.jsx(wu,{children:l.jsxs(_r,{children:[l.jsx(jt,{className:"w-12",children:l.jsx(ms,{checked:_.size===t.length&&t.length>0,onCheckedChange:re})}),l.jsx(jt,{children:"情境"}),l.jsx(jt,{children:"风格"}),l.jsx(jt,{children:"聊天ID"}),l.jsx(jt,{children:"最后活跃"}),l.jsx(jt,{className:"text-right",children:"操作"})]})}),l.jsx(Su,{children:n?l.jsx(_r,{children:l.jsx(gt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?l.jsx(_r,{children:l.jsx(gt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map($=>l.jsxs(_r,{children:[l.jsx(gt,{children:l.jsx(ms,{checked:_.has($.id),onCheckedChange:()=>R($.id)})}),l.jsx(gt,{className:"font-medium max-w-xs truncate",children:$.situation}),l.jsx(gt,{className:"max-w-xs truncate",children:$.style}),l.jsx(gt,{className:"font-mono text-sm",children:$.chat_id}),l.jsx(gt,{className:"text-sm text-muted-foreground",children:Q($.last_active_time)}),l.jsx(gt,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>J($),children:[l.jsx(na,{className:"h-4 w-4 mr-1"}),"详情"]}),l.jsxs(de,{variant:"default",size:"sm",onClick:()=>ee($),children:[l.jsx(Gd,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsxs(de,{size:"sm",onClick:()=>E($),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(Kt,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},$.id))})]})}),l.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map($=>l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(ms,{checked:_.has($.id),onCheckedChange:()=>R($.id),className:"mt-1"}),l.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),l.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:$.situation,children:$.situation})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),l.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:$.style,children:$.style})]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),l.jsx("p",{className:"font-mono text-xs truncate",children:$.chat_id})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),l.jsx("p",{className:"text-xs",children:Q($.last_active_time)})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>J($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx(na,{className:"h-3 w-3 mr-1"}),"查看"]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>ee($),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx(Gd,{className:"h-3 w-3 mr-1"}),"编辑"]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>E($),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[l.jsx(Kt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},$.id))}),s>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/u)," 页"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(i0,{className:"h-4 w-4"})}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(a-1),disabled:a===1,children:[l.jsx(vu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Re,{type:"number",value:P,onChange:$=>H($.target.value),onKeyDown:$=>$.key==="Enter"&&I(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/u)}),l.jsx(de,{variant:"outline",size:"sm",onClick:I,disabled:!P,className:"h-8",children:"跳转"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(a+1),disabled:a>=Math.ceil(s/u),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(yu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(s/u)),disabled:a>=Math.ceil(s/u),className:"hidden sm:flex",children:l.jsx(a0,{className:"h-4 w-4"})})]})]})]})]})}),l.jsx(Ive,{expression:g,open:y,onOpenChange:w}),l.jsx(qve,{open:N,onOpenChange:C,onSuccess:()=>{W(),q(),C(!1)}}),l.jsx(Fve,{expression:g,open:b,onOpenChange:k,onSuccess:()=>{W(),q(),k(!1)}}),l.jsx(wn,{open:!!T,onOpenChange:()=>E(null),children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:['确定要删除表达方式 "',T?.situation,'" 吗? 此操作不可撤销。']})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>T&&Y(T),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),l.jsx($ve,{open:F,onOpenChange:B,onConfirm:K,count:_.size})]})}function Ive({expression:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return l.jsx(Mr,{open:e,onOpenChange:n,children:l.jsxs(vr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(yr,{children:[l.jsx(br,{children:"表达方式详情"}),l.jsx(as,{children:"查看表达方式的完整信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(hd,{label:"情境",value:t.situation}),l.jsx(hd,{label:"风格",value:t.style}),l.jsx(hd,{icon:Ux,label:"聊天ID",value:t.chat_id,mono:!0}),l.jsx(hd,{icon:Ux,label:"记录ID",value:t.id.toString(),mono:!0})]}),t.context&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(ce,{className:"text-xs text-muted-foreground",children:"上下文"}),l.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.context})]}),t.up_content&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(ce,{className:"text-xs text-muted-foreground",children:"上文内容"}),l.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.up_content})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(hd,{icon:Yc,label:"最后活跃",value:r(t.last_active_time)}),l.jsx(hd,{icon:Yc,label:"创建时间",value:r(t.create_date)})]})]}),l.jsx(Ns,{children:l.jsx(de,{onClick:()=>n(!1),children:"关闭"})})]})})}function hd({icon:t,label:e,value:n,mono:r=!1}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs(ce,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&l.jsx(t,{className:"h-3 w-3"}),e]}),l.jsx("div",{className:Se("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function qve({open:t,onOpenChange:e,onSuccess:n}){const[r,s]=O.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[i,a]=O.useState(!1),{toast:o}=$r(),u=async()=>{if(!r.situation||!r.style||!r.chat_id){o({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{a(!0),await Rve(r),o({title:"创建成功",description:"表达方式已创建"}),s({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(h){o({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{a(!1)}};return l.jsx(Mr,{open:t,onOpenChange:e,children:l.jsxs(vr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(yr,{children:[l.jsx(br,{children:"新增表达方式"}),l.jsx(as,{children:"创建新的表达方式记录"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(ce,{htmlFor:"situation",children:["情境 ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Re,{id:"situation",value:r.situation,onChange:h=>s({...r,situation:h.target.value}),placeholder:"描述使用场景"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(ce,{htmlFor:"style",children:["风格 ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Re,{id:"style",value:r.style,onChange:h=>s({...r,style:h.target.value}),placeholder:"描述表达风格"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(ce,{htmlFor:"chat_id",children:["聊天ID ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Re,{id:"chat_id",value:r.chat_id,onChange:h=>s({...r,chat_id:h.target.value}),placeholder:"关联的聊天ID"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"context",children:"上下文"}),l.jsx(Rn,{id:"context",value:r.context,onChange:h=>s({...r,context:h.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"up_content",children:"上文内容"}),l.jsx(Rn,{id:"up_content",value:r.up_content,onChange:h=>s({...r,up_content:h.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),l.jsxs(Ns,{children:[l.jsx(de,{variant:"outline",onClick:()=>e(!1),children:"取消"}),l.jsx(de,{onClick:u,disabled:i,children:i?"创建中...":"创建"})]})]})})}function Fve({expression:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=O.useState({}),[a,o]=O.useState(!1),{toast:u}=$r();O.useEffect(()=>{t&&i({situation:t.situation,style:t.style,context:t.context||"",up_content:t.up_content||"",chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{o(!0),await Dve(t.id,s),u({title:"保存成功",description:"表达方式已更新"}),r()}catch(f){u({title:"保存失败",description:f instanceof Error?f.message:"无法更新表达方式",variant:"destructive"})}finally{o(!1)}};return t?l.jsx(Mr,{open:e,onOpenChange:n,children:l.jsxs(vr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(yr,{children:[l.jsx(br,{children:"编辑表达方式"}),l.jsx(as,{children:"修改表达方式的信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"edit_situation",children:"情境"}),l.jsx(Re,{id:"edit_situation",value:s.situation||"",onChange:f=>i({...s,situation:f.target.value}),placeholder:"描述使用场景"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"edit_style",children:"风格"}),l.jsx(Re,{id:"edit_style",value:s.style||"",onChange:f=>i({...s,style:f.target.value}),placeholder:"描述表达风格"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"edit_chat_id",children:"聊天ID"}),l.jsx(Re,{id:"edit_chat_id",value:s.chat_id||"",onChange:f=>i({...s,chat_id:f.target.value}),placeholder:"关联的聊天ID"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"edit_context",children:"上下文"}),l.jsx(Rn,{id:"edit_context",value:s.context||"",onChange:f=>i({...s,context:f.target.value}),placeholder:"上下文信息",rows:3})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"edit_up_content",children:"上文内容"}),l.jsx(Rn,{id:"edit_up_content",value:s.up_content||"",onChange:f=>i({...s,up_content:f.target.value}),placeholder:"上文内容",rows:3})]})]}),l.jsxs(Ns,{children:[l.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(de,{onClick:h,disabled:a,children:a?"保存中...":"保存"})]})]})}):null}function $ve({open:t,onOpenChange:e,onConfirm:n,count:r}){return l.jsx(wn,{open:t,onOpenChange:e,children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认批量删除"}),l.jsxs(cn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const _h="/api/webui/person";async function Qve(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.is_known!==void 0&&e.append("is_known",t.is_known.toString()),t.platform&&e.append("platform",t.platform);const n=await yt(`${_h}/list?${e}`,{headers:Et()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function Hve(t){const e=await yt(`${_h}/${t}`,{headers:Et()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Vve(t,e){const n=await yt(`${_h}/${t}`,{method:"PATCH",headers:Et(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Uve(t){const e=await yt(`${_h}/${t}`,{method:"DELETE",headers:Et()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Wve(){const t=await yt(`${_h}/stats/summary`,{headers:Et()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Gve(t){const e=await yt(`${_h}/batch/delete`,{method:"POST",headers:Et(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Xve(){const[t,e]=O.useState([]),[n,r]=O.useState(!0),[s,i]=O.useState(0),[a,o]=O.useState(1),[u,h]=O.useState(20),[f,m]=O.useState(""),[g,x]=O.useState(void 0),[y,w]=O.useState(void 0),[b,k]=O.useState(null),[N,C]=O.useState(!1),[T,E]=O.useState(!1),[_,A]=O.useState(null),[F,B]=O.useState({total:0,known:0,unknown:0,platforms:{}}),[P,H]=O.useState(new Set),[U,te]=O.useState(!1),[z,W]=O.useState(""),{toast:q}=$r(),J=async()=>{try{r(!0);const se=await Qve({page:a,page_size:u,search:f||void 0,is_known:g,platform:y});e(se.data),i(se.total)}catch(se){q({title:"加载失败",description:se instanceof Error?se.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},ee=async()=>{try{const se=await Wve();se?.data&&B(se.data)}catch(se){console.error("加载统计数据失败:",se)}};O.useEffect(()=>{J(),ee()},[a,u,f,g,y]);const Y=async se=>{try{const Te=await Hve(se.person_id);k(Te.data),C(!0)}catch(Te){q({title:"加载详情失败",description:Te instanceof Error?Te.message:"无法加载人物详情",variant:"destructive"})}},R=se=>{k(se),E(!0)},re=async se=>{try{await Uve(se.person_id),q({title:"删除成功",description:`已删除人物信息: ${se.person_name||se.nickname||se.user_id}`}),A(null),J(),ee()}catch(Te){q({title:"删除失败",description:Te instanceof Error?Te.message:"无法删除人物信息",variant:"destructive"})}},K=O.useMemo(()=>Object.keys(F.platforms),[F.platforms]),I=se=>{const Te=new Set(P);Te.has(se)?Te.delete(se):Te.add(se),H(Te)},Q=()=>{P.size===t.length&&t.length>0?H(new Set):H(new Set(t.map(se=>se.person_id)))},$=()=>{if(P.size===0){q({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}te(!0)},Z=async()=>{try{const se=await Gve(Array.from(P));q({title:"批量删除完成",description:se.message}),H(new Set),te(!1),J(),ee()}catch(se){q({title:"批量删除失败",description:se instanceof Error?se.message:"批量删除失败",variant:"destructive"})}},ne=()=>{const se=parseInt(z),Te=Math.ceil(s/u);se>=1&&se<=Te?(o(se),W("")):q({title:"无效的页码",description:`请输入1-${Te}之间的页码`,variant:"destructive"})},ge=se=>se?new Date(se*1e3).toLocaleString("zh-CN"):"-";return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsx("div",{className:"mb-4 sm:mb-6",children:l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[l.jsx(QX,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),l.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),l.jsx(yn,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),l.jsx("div",{className:"text-2xl font-bold mt-1",children:F.total})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:F.known})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:F.unknown})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx(ce,{htmlFor:"search",children:"搜索"}),l.jsxs("div",{className:"relative mt-1.5",children:[l.jsx(js,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),l.jsx(Re,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:f,onChange:se=>m(se.target.value),className:"pl-9"})]})]}),l.jsxs("div",{children:[l.jsx(ce,{htmlFor:"filter-known",children:"认识状态"}),l.jsxs(It,{value:g===void 0?"all":g.toString(),onValueChange:se=>{x(se==="all"?void 0:se==="true"),o(1)},children:[l.jsx(Pt,{id:"filter-known",className:"mt-1.5",children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"all",children:"全部"}),l.jsx(ze,{value:"true",children:"已认识"}),l.jsx(ze,{value:"false",children:"未认识"})]})]})]}),l.jsxs("div",{children:[l.jsx(ce,{htmlFor:"filter-platform",children:"平台"}),l.jsxs(It,{value:y||"all",onValueChange:se=>{w(se==="all"?void 0:se),o(1)},children:[l.jsx(Pt,{id:"filter-platform",className:"mt-1.5",children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"all",children:"全部平台"}),K.map(se=>l.jsxs(ze,{value:se,children:[se," (",F.platforms[se],")"]},se))]})]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[l.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:P.size>0&&l.jsxs("span",{children:["已选择 ",P.size," 个人物"]})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ce,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(It,{value:u.toString(),onValueChange:se=>{h(parseInt(se)),o(1),H(new Set)},children:[l.jsx(Pt,{id:"page-size",className:"w-20",children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),P.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>H(new Set),children:"取消选择"}),l.jsxs(de,{variant:"destructive",size:"sm",onClick:$,children:[l.jsx(Kt,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card",children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(bu,{children:[l.jsx(wu,{children:l.jsxs(_r,{children:[l.jsx(jt,{className:"w-12",children:l.jsx(ms,{checked:t.length>0&&P.size===t.length,onCheckedChange:Q,"aria-label":"全选"})}),l.jsx(jt,{children:"状态"}),l.jsx(jt,{children:"名称"}),l.jsx(jt,{children:"昵称"}),l.jsx(jt,{children:"平台"}),l.jsx(jt,{children:"用户ID"}),l.jsx(jt,{children:"最后更新"}),l.jsx(jt,{className:"text-right",children:"操作"})]})}),l.jsx(Su,{children:n?l.jsx(_r,{children:l.jsx(gt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?l.jsx(_r,{children:l.jsx(gt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(se=>l.jsxs(_r,{children:[l.jsx(gt,{children:l.jsx(ms,{checked:P.has(se.person_id),onCheckedChange:()=>I(se.person_id),"aria-label":`选择 ${se.person_name||se.nickname||se.user_id}`})}),l.jsx(gt,{children:l.jsx("div",{className:Se("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",se.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:se.is_known?"已认识":"未认识"})}),l.jsx(gt,{className:"font-medium",children:se.person_name||l.jsx("span",{className:"text-muted-foreground",children:"-"})}),l.jsx(gt,{children:se.nickname||"-"}),l.jsx(gt,{children:se.platform}),l.jsx(gt,{className:"font-mono text-sm",children:se.user_id}),l.jsx(gt,{className:"text-sm text-muted-foreground",children:ge(se.last_know)}),l.jsx(gt,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(de,{variant:"default",size:"sm",onClick:()=>Y(se),children:[l.jsx(na,{className:"h-4 w-4 mr-1"}),"详情"]}),l.jsxs(de,{variant:"default",size:"sm",onClick:()=>R(se),children:[l.jsx(Gd,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsxs(de,{size:"sm",onClick:()=>A(se),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(Kt,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},se.id))})]})}),l.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(se=>l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(ms,{checked:P.has(se.person_id),onCheckedChange:()=>I(se.person_id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:Se("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",se.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:se.is_known?"已认识":"未认识"}),l.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:se.person_name||l.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),se.nickname&&l.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",se.nickname]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),l.jsx("p",{className:"font-medium text-xs",children:se.platform})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),l.jsx("p",{className:"font-mono text-xs truncate",title:se.user_id,children:se.user_id})]}),l.jsxs("div",{className:"col-span-2",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),l.jsx("p",{className:"text-xs",children:ge(se.last_know)})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>Y(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx(na,{className:"h-3 w-3 mr-1"}),"查看"]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>R(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx(Gd,{className:"h-3 w-3 mr-1"}),"编辑"]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>A(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[l.jsx(Kt,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},se.id))}),s>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/u)," 页"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(i0,{className:"h-4 w-4"})}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(a-1),disabled:a===1,children:[l.jsx(vu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Re,{type:"number",value:z,onChange:se=>W(se.target.value),onKeyDown:se=>se.key==="Enter"&&ne(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/u)}),l.jsx(de,{variant:"outline",size:"sm",onClick:ne,disabled:!z,className:"h-8",children:"跳转"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:()=>o(a+1),disabled:a>=Math.ceil(s/u),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(yu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(s/u)),disabled:a>=Math.ceil(s/u),className:"hidden sm:flex",children:l.jsx(a0,{className:"h-4 w-4"})})]})]})]})]})}),l.jsx(Yve,{person:b,open:N,onOpenChange:C}),l.jsx(Zve,{person:b,open:T,onOpenChange:E,onSuccess:()=>{J(),ee(),E(!1)}}),l.jsx(wn,{open:!!_,onOpenChange:()=>A(null),children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认删除"}),l.jsxs(cn,{children:['确定要删除人物信息 "',_?.person_name||_?.nickname||_?.user_id,'" 吗? 此操作不可撤销。']})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:()=>_&&re(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),l.jsx(wn,{open:U,onOpenChange:te,children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"确认批量删除"}),l.jsxs(cn,{children:["确定要删除选中的 ",P.size," 个人物信息吗? 此操作不可撤销。"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{children:"取消"}),l.jsx(un,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function Yve({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return l.jsx(Mr,{open:e,onOpenChange:n,children:l.jsxs(vr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(yr,{children:[l.jsx(br,{children:"人物详情"}),l.jsxs(as,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(wl,{icon:ER,label:"人物名称",value:t.person_name}),l.jsx(wl,{icon:r0,label:"昵称",value:t.nickname}),l.jsx(wl,{icon:Ux,label:"用户ID",value:t.user_id,mono:!0}),l.jsx(wl,{icon:Ux,label:"人物ID",value:t.person_id,mono:!0}),l.jsx(wl,{label:"平台",value:t.platform}),l.jsx(wl,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(ce,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),l.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(ce,{className:"text-xs text-muted-foreground",children:"个人印象"}),l.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(ce,{className:"text-xs text-muted-foreground",children:"群昵称"}),l.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>l.jsxs("div",{className:"text-sm flex items-center gap-2",children:[l.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),l.jsx("span",{children:"→"}),l.jsx("span",{children:s.group_nick_name})]},i))})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[l.jsx(wl,{icon:Yc,label:"认识时间",value:r(t.know_times)}),l.jsx(wl,{icon:Yc,label:"首次记录",value:r(t.know_since)}),l.jsx(wl,{icon:Yc,label:"最后更新",value:r(t.last_know)})]})]}),l.jsx(Ns,{children:l.jsx(de,{onClick:()=>n(!1),children:"关闭"})})]})})}function wl({icon:t,label:e,value:n,mono:r=!1}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs(ce,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&l.jsx(t,{className:"h-3 w-3"}),e]}),l.jsx("div",{className:Se("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Zve({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=O.useState({}),[a,o]=O.useState(!1),{toast:u}=$r();O.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const h=async()=>{if(t)try{o(!0),await Vve(t.person_id,s),u({title:"保存成功",description:"人物信息已更新"}),r()}catch(f){u({title:"保存失败",description:f instanceof Error?f.message:"无法更新人物信息",variant:"destructive"})}finally{o(!1)}};return t?l.jsx(Mr,{open:e,onOpenChange:n,children:l.jsxs(vr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(yr,{children:[l.jsx(br,{children:"编辑人物信息"}),l.jsxs(as,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"person_name",children:"人物名称"}),l.jsx(Re,{id:"person_name",value:s.person_name||"",onChange:f=>i({...s,person_name:f.target.value}),placeholder:"为这个人设置一个名称"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"nickname",children:"昵称"}),l.jsx(Re,{id:"nickname",value:s.nickname||"",onChange:f=>i({...s,nickname:f.target.value}),placeholder:"昵称"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"name_reason",children:"名称设定原因"}),l.jsx(Rn,{id:"name_reason",value:s.name_reason||"",onChange:f=>i({...s,name_reason:f.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"memory_points",children:"个人印象"}),l.jsx(Rn,{id:"memory_points",value:s.memory_points||"",onChange:f=>i({...s,memory_points:f.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),l.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[l.jsxs("div",{children:[l.jsx(ce,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),l.jsx(Dt,{id:"is_known",checked:s.is_known,onCheckedChange:f=>i({...s,is_known:f})})]})]}),l.jsxs(Ns,{children:[l.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(de,{onClick:h,disabled:a,children:a?"保存中...":"保存"})]})]})}):null}function ls(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n{let e;const n=new Set,r=(f,m)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const x=e;e=m??(typeof g!="object"||g===null)?g:Object.assign({},e,g),n.forEach(y=>y(e,x))}},s=()=>e,u={setState:r,getState:s,getInitialState:()=>h,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Kve?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},h=e=t(r,s,u);return u},Jve=t=>t?u_(t):u_,{useDebugValue:eye}=fe,{useSyncExternalStoreWithSelector:tye}=aG,nye=t=>t;function r$(t,e=nye,n){const r=tye(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return eye(r),r}const d_=(t,e)=>{const n=Jve(t),r=(s,i=e)=>r$(n,s,i);return Object.assign(r,n),r},rye=(t,e)=>t?d_(t,e):d_;function Wr(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,s]of t)if(!Object.is(s,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}var sye={value:()=>{}};function Bv(){for(var t=0,e=arguments.length,n={},r;t=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ix.prototype=Bv.prototype={constructor:Ix,on:function(t,e){var n=this._,r=iye(t+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),f_.hasOwnProperty(e)?{space:f_[e],local:t}:t}function lye(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===bS&&e.documentElement.namespaceURI===bS?e.createElement(t):e.createElementNS(n,t)}}function oye(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function s$(t){var e=Iv(t);return(e.local?oye:lye)(e)}function cye(){}function tO(t){return t==null?cye:function(){return this.querySelector(t)}}function uye(t){typeof t!="function"&&(t=tO(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s=C&&(C=N+1);!(E=b[C])&&++C=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function zye(t){t||(t=Pye);function e(m,g){return m&&g?t(m.__data__,g.__data__):!m-!g}for(var n=this._groups,r=n.length,s=new Array(r),i=0;ie?1:t>=e?0:NaN}function Lye(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Bye(){return Array.from(this)}function Iye(){for(var t=this._groups,e=0,n=t.length;e1?this.each((e==null?Yye:typeof e=="function"?Kye:Zye)(t,e,n??"")):dh(this.node(),t)}function dh(t,e){return t.style.getPropertyValue(e)||c$(t).getComputedStyle(t,null).getPropertyValue(e)}function ebe(t){return function(){delete this[t]}}function tbe(t,e){return function(){this[t]=e}}function nbe(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function rbe(t,e){return arguments.length>1?this.each((e==null?ebe:typeof e=="function"?nbe:tbe)(t,e)):this.node()[t]}function u$(t){return t.trim().split(/^|\s+/)}function nO(t){return t.classList||new d$(t)}function d$(t){this._node=t,this._names=u$(t.getAttribute("class")||"")}d$.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function h$(t,e){for(var n=nO(t),r=-1,s=e.length;++r=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function Mbe(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,i;n()=>t;function wS(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:i,x:a,y:o,dx:u,dy:h,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:f}})}wS.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Fbe(t){return!t.ctrlKey&&!t.button}function $be(){return this.parentNode}function Qbe(t,e){return e??{x:t.x,y:t.y}}function Hbe(){return navigator.maxTouchPoints||"ontouchstart"in this}function Vbe(){var t=Fbe,e=$be,n=Qbe,r=Hbe,s={},i=Bv("start","drag","end"),a=0,o,u,h,f,m=0;function g(T){T.on("mousedown.drag",x).filter(r).on("touchstart.drag",b).on("touchmove.drag",k,qbe).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(T,E){if(!(f||!t.call(this,T,E))){var _=C(this,e.call(this,T,E),T,E,"mouse");_&&(Mi(T.view).on("mousemove.drag",y,Um).on("mouseup.drag",w,Um),g$(T.view),q4(T),h=!1,o=T.clientX,u=T.clientY,_("start",T))}}function y(T){if(Hd(T),!h){var E=T.clientX-o,_=T.clientY-u;h=E*E+_*_>m}s.mouse("drag",T)}function w(T){Mi(T.view).on("mousemove.drag mouseup.drag",null),x$(T.view,h),Hd(T),s.mouse("end",T)}function b(T,E){if(t.call(this,T,E)){var _=T.changedTouches,A=e.call(this,T,E),F=_.length,B,P;for(B=0;B=0&&t._call.call(void 0,e),t=t._next;--hh}function m_(){pu=(R1=Wm.now())+qv,hh=Yf=0;try{Wbe()}finally{hh=0,Xbe(),pu=0}}function Gbe(){var t=Wm.now(),e=t-R1;e>v$&&(qv-=e,R1=t)}function Xbe(){for(var t,e=A1,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:A1=n);Zf=t,SS(r)}function SS(t){if(!hh){Yf&&(Yf=clearTimeout(Yf));var e=t-pu;e>24?(t<1/0&&(Yf=setTimeout(m_,t-Wm.now()-qv)),qf&&(qf=clearInterval(qf))):(qf||(R1=Wm.now(),qf=setInterval(Gbe,v$)),hh=1,y$(m_))}}function p_(t,e,n){var r=new D1;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var Ybe=Bv("start","end","cancel","interrupt"),Zbe=[],w$=0,g_=1,kS=2,qx=3,x_=4,OS=5,Fx=6;function Fv(t,e,n,r,s,i){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;Kbe(t,n,{name:e,index:r,group:s,on:Ybe,tween:Zbe,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:w$})}function sO(t,e){var n=da(t,e);if(n.state>w$)throw new Error("too late; already scheduled");return n}function Wa(t,e){var n=da(t,e);if(n.state>qx)throw new Error("too late; already running");return n}function da(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Kbe(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=b$(i,0,n.time);function i(h){n.state=g_,n.timer.restart(a,n.delay,n.time),n.delay<=h&&a(h-n.delay)}function a(h){var f,m,g,x;if(n.state!==g_)return u();for(f in r)if(x=r[f],x.name===n.name){if(x.state===qx)return p_(a);x.state===x_?(x.state=Fx,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete r[f]):+fkS&&r.state=0&&(e=e.slice(0,n)),!e||e==="start"})}function T2e(t,e,n){var r,s,i=C2e(e)?sO:Wa;return function(){var a=i(this,t),o=a.on;o!==r&&(s=(r=o).copy()).on(e,n),a.on=s}}function E2e(t,e){var n=this._id;return arguments.length<2?da(this.node(),n).on.on(t):this.each(T2e(n,t,e))}function _2e(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function M2e(){return this.on("end.remove",_2e(this._id))}function A2e(t){var e=this._name,n=this._id;typeof t!="function"&&(t=tO(t));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>t;function r4e(t,{sourceEvent:e,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Ml(t,e,n){this.k=t,this.x=e,this.y=n}Ml.prototype={constructor:Ml,scale:function(t){return t===1?this:new Ml(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Ml(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Bl=new Ml(1,0,0);Ml.prototype;function F4(t){t.stopImmediatePropagation()}function Ff(t){t.preventDefault(),t.stopImmediatePropagation()}function s4e(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function i4e(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function v_(){return this.__zoom||Bl}function a4e(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function l4e(){return navigator.maxTouchPoints||"ontouchstart"in this}function o4e(t,e,n){var r=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function j$(){var t=s4e,e=i4e,n=o4e,r=a4e,s=l4e,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,u=EG,h=Bv("start","zoom","end"),f,m,g,x=500,y=150,w=0,b=10;function k(z){z.property("__zoom",v_).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",P).filter(s).on("touchstart.zoom",H).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",te).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(z,W,q,J){var ee=z.selection?z.selection():z;ee.property("__zoom",v_),z!==ee?E(z,W,q,J):ee.interrupt().each(function(){_(this,arguments).event(J).start().zoom(null,typeof W=="function"?W.apply(this,arguments):W).end()})},k.scaleBy=function(z,W,q,J){k.scaleTo(z,function(){var ee=this.__zoom.k,Y=typeof W=="function"?W.apply(this,arguments):W;return ee*Y},q,J)},k.scaleTo=function(z,W,q,J){k.transform(z,function(){var ee=e.apply(this,arguments),Y=this.__zoom,R=q==null?T(ee):typeof q=="function"?q.apply(this,arguments):q,re=Y.invert(R),K=typeof W=="function"?W.apply(this,arguments):W;return n(C(N(Y,K),R,re),ee,a)},q,J)},k.translateBy=function(z,W,q,J){k.transform(z,function(){return n(this.__zoom.translate(typeof W=="function"?W.apply(this,arguments):W,typeof q=="function"?q.apply(this,arguments):q),e.apply(this,arguments),a)},null,J)},k.translateTo=function(z,W,q,J,ee){k.transform(z,function(){var Y=e.apply(this,arguments),R=this.__zoom,re=J==null?T(Y):typeof J=="function"?J.apply(this,arguments):J;return n(Bl.translate(re[0],re[1]).scale(R.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof q=="function"?-q.apply(this,arguments):-q),Y,a)},J,ee)};function N(z,W){return W=Math.max(i[0],Math.min(i[1],W)),W===z.k?z:new Ml(W,z.x,z.y)}function C(z,W,q){var J=W[0]-q[0]*z.k,ee=W[1]-q[1]*z.k;return J===z.x&&ee===z.y?z:new Ml(z.k,J,ee)}function T(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function E(z,W,q,J){z.on("start.zoom",function(){_(this,arguments).event(J).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(J).end()}).tween("zoom",function(){var ee=this,Y=arguments,R=_(ee,Y).event(J),re=e.apply(ee,Y),K=q==null?T(re):typeof q=="function"?q.apply(ee,Y):q,I=Math.max(re[1][0]-re[0][0],re[1][1]-re[0][1]),Q=ee.__zoom,$=typeof W=="function"?W.apply(ee,Y):W,Z=u(Q.invert(K).concat(I/Q.k),$.invert(K).concat(I/$.k));return function(ne){if(ne===1)ne=$;else{var ge=Z(ne),se=I/ge[2];ne=new Ml(se,K[0]-ge[0]*se,K[1]-ge[1]*se)}R.zoom(null,ne)}})}function _(z,W,q){return!q&&z.__zooming||new A(z,W)}function A(z,W){this.that=z,this.args=W,this.active=0,this.sourceEvent=null,this.extent=e.apply(z,W),this.taps=0}A.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,W){return this.mouse&&z!=="mouse"&&(this.mouse[1]=W.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=W.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=W.invert(this.touch1[0])),this.that.__zoom=W,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var W=Mi(this.that).datum();h.call(z,this.that,new r4e(z,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:h}),W)}};function F(z,...W){if(!t.apply(this,arguments))return;var q=_(this,W).event(z),J=this.__zoom,ee=Math.max(i[0],Math.min(i[1],J.k*Math.pow(2,r.apply(this,arguments)))),Y=Ji(z);if(q.wheel)(q.mouse[0][0]!==Y[0]||q.mouse[0][1]!==Y[1])&&(q.mouse[1]=J.invert(q.mouse[0]=Y)),clearTimeout(q.wheel);else{if(J.k===ee)return;q.mouse=[Y,J.invert(Y)],$x(this),q.start()}Ff(z),q.wheel=setTimeout(R,y),q.zoom("mouse",n(C(N(J,ee),q.mouse[0],q.mouse[1]),q.extent,a));function R(){q.wheel=null,q.end()}}function B(z,...W){if(g||!t.apply(this,arguments))return;var q=z.currentTarget,J=_(this,W,!0).event(z),ee=Mi(z.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",I,!0),Y=Ji(z,q),R=z.clientX,re=z.clientY;g$(z.view),F4(z),J.mouse=[Y,this.__zoom.invert(Y)],$x(this),J.start();function K(Q){if(Ff(Q),!J.moved){var $=Q.clientX-R,Z=Q.clientY-re;J.moved=$*$+Z*Z>w}J.event(Q).zoom("mouse",n(C(J.that.__zoom,J.mouse[0]=Ji(Q,q),J.mouse[1]),J.extent,a))}function I(Q){ee.on("mousemove.zoom mouseup.zoom",null),x$(Q.view,J.moved),Ff(Q),J.event(Q).end()}}function P(z,...W){if(t.apply(this,arguments)){var q=this.__zoom,J=Ji(z.changedTouches?z.changedTouches[0]:z,this),ee=q.invert(J),Y=q.k*(z.shiftKey?.5:2),R=n(C(N(q,Y),J,ee),e.apply(this,W),a);Ff(z),o>0?Mi(this).transition().duration(o).call(E,R,J,z):Mi(this).call(k.transform,R,J,z)}}function H(z,...W){if(t.apply(this,arguments)){var q=z.touches,J=q.length,ee=_(this,W,z.changedTouches.length===J).event(z),Y,R,re,K;for(F4(z),R=0;R"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},N$=Xl.error001();function Wn(t,e){const n=O.useContext($v);if(n===null)throw new Error(N$);return r$(n,t,e)}const Qr=()=>{const t=O.useContext($v);if(t===null)throw new Error(N$);return O.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},u4e=t=>t.userSelectionActive?"none":"all";function Qv({position:t,children:e,className:n,style:r,...s}){const i=Wn(u4e),a=`${t}`.split("-");return fe.createElement("div",{className:ls(["react-flow__panel",n,...a]),style:{...r,pointerEvents:i},...s},e)}function d4e({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:fe.createElement(Qv,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},fe.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const h4e=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:u,className:h,...f})=>{const m=O.useRef(null),[g,x]=O.useState({x:0,y:0,width:0,height:0}),y=ls(["react-flow__edge-textwrapper",h]);return O.useEffect(()=>{if(m.current){const w=m.current.getBBox();x({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),typeof n>"u"||!n?null:fe.createElement("g",{transform:`translate(${t-g.width/2} ${e-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...f},s&&fe.createElement("rect",{width:g.width+2*a[0],x:-a[0],y:-a[1],height:g.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:o,ry:o}),fe.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:m,style:r},n),u)};var f4e=O.memo(h4e);const aO=t=>({width:t.offsetWidth,height:t.offsetHeight}),fh=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),lO=(t={x:0,y:0},e)=>({x:fh(t.x,e[0][0],e[1][0]),y:fh(t.y,e[0][1],e[1][1])}),y_=(t,e,n)=>tn?-fh(Math.abs(t-n),1,50)/50:0,C$=(t,e)=>{const n=y_(t.x,35,e.width-35)*20,r=y_(t.y,35,e.height-35)*20;return[n,r]},T$=t=>t.getRootNode?.()||window?.document,E$=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Gm=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),_$=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),b_=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),m4e=(t,e)=>_$(E$(Gm(t),Gm(e))),jS=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},p4e=t=>Pi(t.width)&&Pi(t.height)&&Pi(t.x)&&Pi(t.y),Pi=t=>!isNaN(t)&&isFinite(t),hr=Symbol.for("internals"),M$=["Enter"," ","Escape"],g4e=(t,e)=>{},x4e=t=>"nativeEvent"in t;function NS(t){const n=(x4e(t)?t.nativeEvent:t).composedPath?.()?.[0]||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n?.nodeName)||n?.hasAttribute("contenteditable")||!!n?.closest(".nokey")}const A$=t=>"clientX"in t,Vo=(t,e)=>{const n=A$(t),r=n?t.clientX:t.touches?.[0].clientX,s=n?t.clientY:t.touches?.[0].clientY;return{x:r-(e?.left??0),y:s-(e?.top??0)}},z1=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,z0=({id:t,path:e,labelX:n,labelY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x=20})=>fe.createElement(fe.Fragment,null,fe.createElement("path",{id:t,style:f,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:g}),x&&fe.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),s&&Pi(n)&&Pi(r)?fe.createElement(f4e,{x:n,y:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:u,labelBgBorderRadius:h}):null);z0.displayName="BaseEdge";function $f(t,e,n){return n===void 0?n:r=>{const s=e().edges.find(i=>i.id===t);s&&n(r,{...s})}}function R$({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,i=n{const[b,k,N]=z$({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i});return fe.createElement(z0,{path:b,labelX:k,labelY:N,label:a,labelStyle:o,labelShowBg:u,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:w})});oO.displayName="SimpleBezierEdge";const S_={[at.Left]:{x:-1,y:0},[at.Right]:{x:1,y:0},[at.Top]:{x:0,y:-1},[at.Bottom]:{x:0,y:1}},v4e=({source:t,sourcePosition:e=at.Bottom,target:n})=>e===at.Left||e===at.Right?t.xMath.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function y4e({source:t,sourcePosition:e=at.Bottom,target:n,targetPosition:r=at.Top,center:s,offset:i}){const a=S_[e],o=S_[r],u={x:t.x+a.x*i,y:t.y+a.y*i},h={x:n.x+o.x*i,y:n.y+o.y*i},f=v4e({source:u,sourcePosition:e,target:h}),m=f.x!==0?"x":"y",g=f[m];let x=[],y,w;const b={x:0,y:0},k={x:0,y:0},[N,C,T,E]=R$({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[m]*o[m]===-1){y=s.x??N,w=s.y??C;const A=[{x:y,y:u.y},{x:y,y:h.y}],F=[{x:u.x,y:w},{x:h.x,y:w}];a[m]===g?x=m==="x"?A:F:x=m==="x"?F:A}else{const A=[{x:u.x,y:h.y}],F=[{x:h.x,y:u.y}];if(m==="x"?x=a.x===g?F:A:x=a.y===g?A:F,e===r){const te=Math.abs(t[m]-n[m]);if(te<=i){const z=Math.min(i-1,i-te);a[m]===g?b[m]=(u[m]>t[m]?-1:1)*z:k[m]=(h[m]>n[m]?-1:1)*z}}if(e!==r){const te=m==="x"?"y":"x",z=a[m]===o[te],W=u[te]>h[te],q=u[te]=U?(y=(B.x+P.x)/2,w=x[0].y):(y=x[0].x,w=(B.y+P.y)/2)}return[[t,{x:u.x+b.x,y:u.y+b.y},...x,{x:h.x+k.x,y:h.y+k.y},n],y,w,T,E]}function b4e(t,e,n,r){const s=Math.min(k_(t,e)/2,k_(e,n)/2,r),{x:i,y:a}=e;if(t.x===i&&i===n.x||t.y===a&&a===n.y)return`L${i} ${a}`;if(t.y===a){const h=t.x{let C="";return N>0&&N{const[k,N,C]=CS({sourceX:t,sourceY:e,sourcePosition:m,targetX:n,targetY:r,targetPosition:g,borderRadius:w?.borderRadius,offset:w?.offset});return fe.createElement(z0,{path:k,labelX:N,labelY:C,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:x,markerStart:y,interactionWidth:b})});Hv.displayName="SmoothStepEdge";const cO=O.memo(t=>fe.createElement(Hv,{...t,pathOptions:O.useMemo(()=>({borderRadius:0,offset:t.pathOptions?.offset}),[t.pathOptions?.offset])}));cO.displayName="StepEdge";function w4e({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,i,a,o]=R$({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,i,a,o]}const uO=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})=>{const[y,w,b]=w4e({sourceX:t,sourceY:e,targetX:n,targetY:r});return fe.createElement(z0,{path:y,labelX:w,labelY:b,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:u,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})});uO.displayName="StraightEdge";function lx(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function O_({pos:t,x1:e,y1:n,x2:r,y2:s,c:i}){switch(t){case at.Left:return[e-lx(e-r,i),n];case at.Right:return[e+lx(r-e,i),n];case at.Top:return[e,n-lx(n-s,i)];case at.Bottom:return[e,n+lx(s-n,i)]}}function P$({sourceX:t,sourceY:e,sourcePosition:n=at.Bottom,targetX:r,targetY:s,targetPosition:i=at.Top,curvature:a=.25}){const[o,u]=O_({pos:n,x1:t,y1:e,x2:r,y2:s,c:a}),[h,f]=O_({pos:i,x1:r,y1:s,x2:t,y2:e,c:a}),[m,g,x,y]=D$({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:o,sourceControlY:u,targetControlX:h,targetControlY:f});return[`M${t},${e} C${o},${u} ${h},${f} ${r},${s}`,m,g,x,y]}const L1=O.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=at.Bottom,targetPosition:i=at.Top,label:a,labelStyle:o,labelShowBg:u,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,pathOptions:w,interactionWidth:b})=>{const[k,N,C]=P$({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:w?.curvature});return fe.createElement(z0,{path:k,labelX:N,labelY:C,label:a,labelStyle:o,labelShowBg:u,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:b})});L1.displayName="BezierEdge";const dO=O.createContext(null),S4e=dO.Provider;dO.Consumer;const k4e=()=>O.useContext(dO),O4e=t=>"id"in t&&"source"in t&&"target"in t,j4e=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,TS=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,N4e=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),C4e=(t,e)=>{if(!t.source||!t.target)return e;let n;return O4e(t)?n={...t}:n={...t,id:j4e(t)},N4e(n,e)?e:e.concat(n)},ES=({x:t,y:e},[n,r,s],i,[a,o])=>{const u={x:(t-n)/s,y:(e-r)/s};return i?{x:a*Math.round(u.x/a),y:o*Math.round(u.y/o)}:u},L$=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r}),ru=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],r=(t.height??0)*e[1],s={x:t.position.x-n,y:t.position.y-r};return{...s,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-r}:s}},Vv=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,s)=>{const{x:i,y:a}=ru(s,e).positionAbsolute;return E$(r,Gm({x:i,y:a,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return _$(n)},B$=(t,e,[n,r,s]=[0,0,1],i=!1,a=!1,o=[0,0])=>{const u={x:(e.x-n)/s,y:(e.y-r)/s,width:e.width/s,height:e.height/s},h=[];return t.forEach(f=>{const{width:m,height:g,selectable:x=!0,hidden:y=!1}=f;if(a&&!x||y)return!1;const{positionAbsolute:w}=ru(f,o),b={x:w.x,y:w.y,width:m||0,height:g||0},k=jS(u,b),N=typeof m>"u"||typeof g>"u"||m===null||g===null,C=i&&k>0,T=(m||0)*(g||0);(N||C||k>=T||f.dragging)&&h.push(f)}),h},I$=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},q$=(t,e,n,r,s,i=.1)=>{const a=e/(t.width*(1+i)),o=n/(t.height*(1+i)),u=Math.min(a,o),h=fh(u,r,s),f=t.x+t.width/2,m=t.y+t.height/2,g=e/2-f*h,x=n/2-m*h;return{x:g,y:x,zoom:h}},qc=(t,e=0)=>t.transition().duration(e);function j_(t,e,n,r){return(e[n]||[]).reduce((s,i)=>(`${t.id}-${i.id}-${n}`!==r&&s.push({id:i.id||null,type:n,nodeId:t.id,x:(t.positionAbsolute?.x??0)+i.x+i.width/2,y:(t.positionAbsolute?.y??0)+i.y+i.height/2}),s),[])}function T4e(t,e,n,r,s,i){const{x:a,y:o}=Vo(t),h=e.elementsFromPoint(a,o).find(y=>y.classList.contains("react-flow__handle"));if(h){const y=h.getAttribute("data-nodeid");if(y){const w=hO(void 0,h),b=h.getAttribute("data-handleid"),k=i({nodeId:y,id:b,type:w});if(k){const N=s.find(C=>C.nodeId===y&&C.type===w&&C.id===b);return{handle:{id:b,type:w,nodeId:y,x:N?.x||n.x,y:N?.y||n.y},validHandleResult:k}}}}let f=[],m=1/0;if(s.forEach(y=>{const w=Math.sqrt((y.x-n.x)**2+(y.y-n.y)**2);if(w<=r){const b=i(y);w<=m&&(wy.isValid),x=f.some(({handle:y})=>y.type==="target");return f.find(({handle:y,validHandleResult:w})=>x?y.type==="target":g?w.isValid:!0)||f[0]}const E4e={source:null,target:null,sourceHandle:null,targetHandle:null},F$=()=>({handleDomNode:null,isValid:!1,connection:E4e,endHandle:null});function $$(t,e,n,r,s,i,a){const o=s==="target",u=a.querySelector(`.react-flow__handle[data-id="${t?.nodeId}-${t?.id}-${t?.type}"]`),h={...F$(),handleDomNode:u};if(u){const f=hO(void 0,u),m=u.getAttribute("data-nodeid"),g=u.getAttribute("data-handleid"),x=u.classList.contains("connectable"),y=u.classList.contains("connectableend"),w={source:o?m:n,sourceHandle:o?g:r,target:o?n:m,targetHandle:o?r:g};h.connection=w,x&&y&&(e===gu.Strict?o&&f==="source"||!o&&f==="target":m!==n||g!==r)&&(h.endHandle={nodeId:m,handleId:g,type:f},h.isValid=i(w))}return h}function _4e({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((s,i)=>{if(i[hr]){const{handleBounds:a}=i[hr];let o=[],u=[];a&&(o=j_(i,a,"source",`${e}-${n}-${r}`),u=j_(i,a,"target",`${e}-${n}-${r}`)),s.push(...o,...u)}return s},[])}function hO(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function $4(t){t?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function M4e(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function Q$({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:s,getState:i,setState:a,isValidConnection:o,edgeUpdaterType:u,onReconnectEnd:h}){const f=T$(t.target),{connectionMode:m,domNode:g,autoPanOnConnect:x,connectionRadius:y,onConnectStart:w,panBy:b,getNodes:k,cancelConnection:N}=i();let C=0,T;const{x:E,y:_}=Vo(t),A=f?.elementFromPoint(E,_),F=hO(u,A),B=g?.getBoundingClientRect();if(!B||!F)return;let P,H=Vo(t,B),U=!1,te=null,z=!1,W=null;const q=_4e({nodes:k(),nodeId:n,handleId:e,handleType:F}),J=()=>{if(!x)return;const[R,re]=C$(H,B);b({x:R,y:re}),C=requestAnimationFrame(J)};a({connectionPosition:H,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:F,connectionStartHandle:{nodeId:n,handleId:e,type:F},connectionEndHandle:null}),w?.(t,{nodeId:n,handleId:e,handleType:F});function ee(R){const{transform:re}=i();H=Vo(R,B);const{handle:K,validHandleResult:I}=T4e(R,f,ES(H,re,!1,[1,1]),y,q,Q=>$$(Q,m,n,e,s?"target":"source",o,f));if(T=K,U||(J(),U=!0),W=I.handleDomNode,te=I.connection,z=I.isValid,a({connectionPosition:T&&z?L$({x:T.x,y:T.y},re):H,connectionStatus:M4e(!!T,z),connectionEndHandle:I.endHandle}),!T&&!z&&!W)return $4(P);te.source!==te.target&&W&&($4(P),P=W,W.classList.add("connecting","react-flow__handle-connecting"),W.classList.toggle("valid",z),W.classList.toggle("react-flow__handle-valid",z))}function Y(R){(T||W)&&te&&z&&r?.(te),i().onConnectEnd?.(R),u&&h?.(R),$4(P),N(),cancelAnimationFrame(C),U=!1,z=!1,te=null,W=null,f.removeEventListener("mousemove",ee),f.removeEventListener("mouseup",Y),f.removeEventListener("touchmove",ee),f.removeEventListener("touchend",Y)}f.addEventListener("mousemove",ee),f.addEventListener("mouseup",Y),f.addEventListener("touchmove",ee),f.addEventListener("touchend",Y)}const N_=()=>!0,A4e=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),R4e=(t,e,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:i,connectionClickStartHandle:a}=r;return{connecting:s?.nodeId===t&&s?.handleId===e&&s?.type===n||i?.nodeId===t&&i?.handleId===e&&i?.type===n,clickConnecting:a?.nodeId===t&&a?.handleId===e&&a?.type===n}},H$=O.forwardRef(({type:t="source",position:e=at.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:o,children:u,className:h,onMouseDown:f,onTouchStart:m,...g},x)=>{const y=a||null,w=t==="target",b=Qr(),k=k4e(),{connectOnClick:N,noPanClassName:C}=Wn(A4e,Wr),{connecting:T,clickConnecting:E}=Wn(R4e(k,y,t),Wr);k||b.getState().onError?.("010",Xl.error010());const _=B=>{const{defaultEdgeOptions:P,onConnect:H,hasDefaultEdges:U}=b.getState(),te={...P,...B};if(U){const{edges:z,setEdges:W}=b.getState();W(C4e(te,z))}H?.(te),o?.(te)},A=B=>{if(!k)return;const P=A$(B);s&&(P&&B.button===0||!P)&&Q$({event:B,handleId:y,nodeId:k,onConnect:_,isTarget:w,getState:b.getState,setState:b.setState,isValidConnection:n||b.getState().isValidConnection||N_}),P?f?.(B):m?.(B)},F=B=>{const{onClickConnectStart:P,onClickConnectEnd:H,connectionClickStartHandle:U,connectionMode:te,isValidConnection:z}=b.getState();if(!k||!U&&!s)return;if(!U){P?.(B,{nodeId:k,handleId:y,handleType:t}),b.setState({connectionClickStartHandle:{nodeId:k,type:t,handleId:y}});return}const W=T$(B.target),q=n||z||N_,{connection:J,isValid:ee}=$$({nodeId:k,id:y,type:t},te,U.nodeId,U.handleId||null,U.type,q,W);ee&&_(J),H?.(B),b.setState({connectionClickStartHandle:null})};return fe.createElement("div",{"data-handleid":y,"data-nodeid":k,"data-handlepos":e,"data-id":`${k}-${y}-${t}`,className:ls(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",C,h,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:i,connecting:E,connectionindicator:r&&(s&&!T||i&&T)}]),onMouseDown:A,onTouchStart:A,onClick:N?F:void 0,ref:x,...g},u)});H$.displayName="Handle";var sc=O.memo(H$);const V$=({data:t,isConnectable:e,targetPosition:n=at.Top,sourcePosition:r=at.Bottom})=>fe.createElement(fe.Fragment,null,fe.createElement(sc,{type:"target",position:n,isConnectable:e}),t?.label,fe.createElement(sc,{type:"source",position:r,isConnectable:e}));V$.displayName="DefaultNode";var _S=O.memo(V$);const U$=({data:t,isConnectable:e,sourcePosition:n=at.Bottom})=>fe.createElement(fe.Fragment,null,t?.label,fe.createElement(sc,{type:"source",position:n,isConnectable:e}));U$.displayName="InputNode";var W$=O.memo(U$);const G$=({data:t,isConnectable:e,targetPosition:n=at.Top})=>fe.createElement(fe.Fragment,null,fe.createElement(sc,{type:"target",position:n,isConnectable:e}),t?.label);G$.displayName="OutputNode";var X$=O.memo(G$);const fO=()=>null;fO.displayName="GroupNode";const D4e=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),ox=t=>t.id;function z4e(t,e){return Wr(t.selectedNodes.map(ox),e.selectedNodes.map(ox))&&Wr(t.selectedEdges.map(ox),e.selectedEdges.map(ox))}const Y$=O.memo(({onSelectionChange:t})=>{const e=Qr(),{selectedNodes:n,selectedEdges:r}=Wn(D4e,z4e);return O.useEffect(()=>{const s={nodes:n,edges:r};t?.(s),e.getState().onSelectionChange.forEach(i=>i(s))},[n,r,t]),null});Y$.displayName="SelectionListener";const P4e=t=>!!t.onSelectionChange;function L4e({onSelectionChange:t}){const e=Wn(P4e);return t||e?fe.createElement(Y$,{onSelectionChange:t}):null}const B4e=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function fd(t,e){O.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function Qt(t,e,n){O.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const I4e=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:i,onConnectEnd:a,onClickConnectStart:o,onClickConnectEnd:u,nodesDraggable:h,nodesConnectable:f,nodesFocusable:m,edgesFocusable:g,edgesUpdatable:x,elevateNodesOnSelect:y,minZoom:w,maxZoom:b,nodeExtent:k,onNodesChange:N,onEdgesChange:C,elementsSelectable:T,connectionMode:E,snapGrid:_,snapToGrid:A,translateExtent:F,connectOnClick:B,defaultEdgeOptions:P,fitView:H,fitViewOptions:U,onNodesDelete:te,onEdgesDelete:z,onNodeDrag:W,onNodeDragStart:q,onNodeDragStop:J,onSelectionDrag:ee,onSelectionDragStart:Y,onSelectionDragStop:R,noPanClassName:re,nodeOrigin:K,rfId:I,autoPanOnConnect:Q,autoPanOnNodeDrag:$,onError:Z,connectionRadius:ne,isValidConnection:ge,nodeDragThreshold:se})=>{const{setNodes:Te,setEdges:qe,setDefaultNodesAndEdges:ve,setMinZoom:Fe,setMaxZoom:Qe,setTranslateExtent:Ke,setNodeExtent:Tt,reset:st}=Wn(B4e,Wr),He=Qr();return O.useEffect(()=>{const St=r?.map(bt=>({...bt,...P}));return ve(n,St),()=>{st()}},[]),Qt("defaultEdgeOptions",P,He.setState),Qt("connectionMode",E,He.setState),Qt("onConnect",s,He.setState),Qt("onConnectStart",i,He.setState),Qt("onConnectEnd",a,He.setState),Qt("onClickConnectStart",o,He.setState),Qt("onClickConnectEnd",u,He.setState),Qt("nodesDraggable",h,He.setState),Qt("nodesConnectable",f,He.setState),Qt("nodesFocusable",m,He.setState),Qt("edgesFocusable",g,He.setState),Qt("edgesUpdatable",x,He.setState),Qt("elementsSelectable",T,He.setState),Qt("elevateNodesOnSelect",y,He.setState),Qt("snapToGrid",A,He.setState),Qt("snapGrid",_,He.setState),Qt("onNodesChange",N,He.setState),Qt("onEdgesChange",C,He.setState),Qt("connectOnClick",B,He.setState),Qt("fitViewOnInit",H,He.setState),Qt("fitViewOnInitOptions",U,He.setState),Qt("onNodesDelete",te,He.setState),Qt("onEdgesDelete",z,He.setState),Qt("onNodeDrag",W,He.setState),Qt("onNodeDragStart",q,He.setState),Qt("onNodeDragStop",J,He.setState),Qt("onSelectionDrag",ee,He.setState),Qt("onSelectionDragStart",Y,He.setState),Qt("onSelectionDragStop",R,He.setState),Qt("noPanClassName",re,He.setState),Qt("nodeOrigin",K,He.setState),Qt("rfId",I,He.setState),Qt("autoPanOnConnect",Q,He.setState),Qt("autoPanOnNodeDrag",$,He.setState),Qt("onError",Z,He.setState),Qt("connectionRadius",ne,He.setState),Qt("isValidConnection",ge,He.setState),Qt("nodeDragThreshold",se,He.setState),fd(t,Te),fd(e,qe),fd(w,Fe),fd(b,Qe),fd(F,Ke),fd(k,Tt),null},C_={display:"none"},q4e={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Z$="react-flow__node-desc",K$="react-flow__edge-desc",F4e="react-flow__aria-live",$4e=t=>t.ariaLiveMessage;function Q4e({rfId:t}){const e=Wn($4e);return fe.createElement("div",{id:`${F4e}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:q4e},e)}function H4e({rfId:t,disableKeyboardA11y:e}){return fe.createElement(fe.Fragment,null,fe.createElement("div",{id:`${Z$}-${t}`,style:C_},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),fe.createElement("div",{id:`${K$}-${t}`,style:C_},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&fe.createElement(Q4e,{rfId:t}))}var Ym=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=O.useState(!1),s=O.useRef(!1),i=O.useRef(new Set([])),[a,o]=O.useMemo(()=>{if(t!==null){const h=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.split("+")),f=h.reduce((m,g)=>m.concat(...g),[]);return[h,f]}return[[],[]]},[t]);return O.useEffect(()=>{const u=typeof document<"u"?document:null,h=e?.target||u;if(t!==null){const f=x=>{if(s.current=x.ctrlKey||x.metaKey||x.shiftKey,(!s.current||s.current&&!e.actInsideInputWithModifier)&&NS(x))return!1;const w=E_(x.code,o);i.current.add(x[w]),T_(a,i.current,!1)&&(x.preventDefault(),r(!0))},m=x=>{if((!s.current||s.current&&!e.actInsideInputWithModifier)&&NS(x))return!1;const w=E_(x.code,o);T_(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(x[w]),x.key==="Meta"&&i.current.clear(),s.current=!1},g=()=>{i.current.clear(),r(!1)};return h?.addEventListener("keydown",f),h?.addEventListener("keyup",m),window.addEventListener("blur",g),()=>{h?.removeEventListener("keydown",f),h?.removeEventListener("keyup",m),window.removeEventListener("blur",g)}}},[t,r]),n};function T_(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function E_(t,e){return e.includes(t)?"code":"key"}function J$(t,e,n,r){const s=t.parentNode||t.parentId;if(!s)return n;const i=e.get(s),a=ru(i,r);return J$(i,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(i[hr]?.z??0)>(n.z??0)?i[hr]?.z??0:n.z??0},r)}function eQ(t,e,n){t.forEach(r=>{const s=r.parentNode||r.parentId;if(s&&!t.has(s))throw new Error(`Parent node ${s} not found`);if(s||n?.[r.id]){const{x:i,y:a,z:o}=J$(r,t,{...r.position,z:r[hr]?.z??0},e);r.positionAbsolute={x:i,y:a},r[hr].z=o,n?.[r.id]&&(r[hr].isParent=!0)}})}function Q4(t,e,n,r){const s=new Map,i={},a=r?1e3:0;return t.forEach(o=>{const u=(Pi(o.zIndex)?o.zIndex:0)+(o.selected?a:0),h=e.get(o.id),f={...o,positionAbsolute:{x:o.position.x,y:o.position.y}},m=o.parentNode||o.parentId;m&&(i[m]=!0);const g=h?.type&&h?.type!==o.type;Object.defineProperty(f,hr,{enumerable:!1,value:{handleBounds:g?void 0:h?.[hr]?.handleBounds,z:u}}),s.set(o.id,f)}),eQ(s,n,i),s}function tQ(t,e={}){const{getNodes:n,width:r,height:s,minZoom:i,maxZoom:a,d3Zoom:o,d3Selection:u,fitViewOnInitDone:h,fitViewOnInit:f,nodeOrigin:m}=t(),g=e.initial&&!h&&f;if(o&&u&&(g||!e.initial)){const y=n().filter(b=>{const k=e.includeHiddenNodes?b.width&&b.height:!b.hidden;return e.nodes?.length?k&&e.nodes.some(N=>N.id===b.id):k}),w=y.every(b=>b.width&&b.height);if(y.length>0&&w){const b=Vv(y,m),{x:k,y:N,zoom:C}=q$(b,r,s,e.minZoom??i,e.maxZoom??a,e.padding??.1),T=Bl.translate(k,N).scale(C);return typeof e.duration=="number"&&e.duration>0?o.transform(qc(u,e.duration),T):o.transform(u,T),!0}}return!1}function V4e(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[hr]:r[hr],selected:n.selected})}),new Map(e)}function U4e(t,e){return e.map(n=>{const r=t.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function cx({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:s,edges:i,onNodesChange:a,onEdgesChange:o,hasDefaultNodes:u,hasDefaultEdges:h}=n();t?.length&&(u&&r({nodeInternals:V4e(t,s)}),a?.(t)),e?.length&&(h&&r({edges:U4e(e,i)}),o?.(e))}const md=()=>{},W4e={zoomIn:md,zoomOut:md,zoomTo:md,getZoom:()=>1,setViewport:md,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:md,fitBounds:md,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},G4e=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),X4e=()=>{const t=Qr(),{d3Zoom:e,d3Selection:n}=Wn(G4e,Wr);return O.useMemo(()=>n&&e?{zoomIn:s=>e.scaleBy(qc(n,s?.duration),1.2),zoomOut:s=>e.scaleBy(qc(n,s?.duration),1/1.2),zoomTo:(s,i)=>e.scaleTo(qc(n,i?.duration),s),getZoom:()=>t.getState().transform[2],setViewport:(s,i)=>{const[a,o,u]=t.getState().transform,h=Bl.translate(s.x??a,s.y??o).scale(s.zoom??u);e.transform(qc(n,i?.duration),h)},getViewport:()=>{const[s,i,a]=t.getState().transform;return{x:s,y:i,zoom:a}},fitView:s=>tQ(t.getState,s),setCenter:(s,i,a)=>{const{width:o,height:u,maxZoom:h}=t.getState(),f=typeof a?.zoom<"u"?a.zoom:h,m=o/2-s*f,g=u/2-i*f,x=Bl.translate(m,g).scale(f);e.transform(qc(n,a?.duration),x)},fitBounds:(s,i)=>{const{width:a,height:o,minZoom:u,maxZoom:h}=t.getState(),{x:f,y:m,zoom:g}=q$(s,a,o,u,h,i?.padding??.1),x=Bl.translate(f,m).scale(g);e.transform(qc(n,i?.duration),x)},project:s=>{const{transform:i,snapToGrid:a,snapGrid:o}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),ES(s,i,a,o)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:a,snapGrid:o,domNode:u}=t.getState();if(!u)return s;const{x:h,y:f}=u.getBoundingClientRect(),m={x:s.x-h,y:s.y-f};return ES(m,i,a,o)},flowToScreenPosition:s=>{const{transform:i,domNode:a}=t.getState();if(!a)return s;const{x:o,y:u}=a.getBoundingClientRect(),h=L$(s,i);return{x:h.x+o,y:h.y+u}},viewportInitialized:!0}:W4e,[e,n])};function mO(){const t=X4e(),e=Qr(),n=O.useCallback(()=>e.getState().getNodes().map(w=>({...w})),[]),r=O.useCallback(w=>e.getState().nodeInternals.get(w),[]),s=O.useCallback(()=>{const{edges:w=[]}=e.getState();return w.map(b=>({...b}))},[]),i=O.useCallback(w=>{const{edges:b=[]}=e.getState();return b.find(k=>k.id===w)},[]),a=O.useCallback(w=>{const{getNodes:b,setNodes:k,hasDefaultNodes:N,onNodesChange:C}=e.getState(),T=b(),E=typeof w=="function"?w(T):w;if(N)k(E);else if(C){const _=E.length===0?T.map(A=>({type:"remove",id:A.id})):E.map(A=>({item:A,type:"reset"}));C(_)}},[]),o=O.useCallback(w=>{const{edges:b=[],setEdges:k,hasDefaultEdges:N,onEdgesChange:C}=e.getState(),T=typeof w=="function"?w(b):w;if(N)k(T);else if(C){const E=T.length===0?b.map(_=>({type:"remove",id:_.id})):T.map(_=>({item:_,type:"reset"}));C(E)}},[]),u=O.useCallback(w=>{const b=Array.isArray(w)?w:[w],{getNodes:k,setNodes:N,hasDefaultNodes:C,onNodesChange:T}=e.getState();if(C){const _=[...k(),...b];N(_)}else if(T){const E=b.map(_=>({item:_,type:"add"}));T(E)}},[]),h=O.useCallback(w=>{const b=Array.isArray(w)?w:[w],{edges:k=[],setEdges:N,hasDefaultEdges:C,onEdgesChange:T}=e.getState();if(C)N([...k,...b]);else if(T){const E=b.map(_=>({item:_,type:"add"}));T(E)}},[]),f=O.useCallback(()=>{const{getNodes:w,edges:b=[],transform:k}=e.getState(),[N,C,T]=k;return{nodes:w().map(E=>({...E})),edges:b.map(E=>({...E})),viewport:{x:N,y:C,zoom:T}}},[]),m=O.useCallback(({nodes:w,edges:b})=>{const{nodeInternals:k,getNodes:N,edges:C,hasDefaultNodes:T,hasDefaultEdges:E,onNodesDelete:_,onEdgesDelete:A,onNodesChange:F,onEdgesChange:B}=e.getState(),P=(w||[]).map(W=>W.id),H=(b||[]).map(W=>W.id),U=N().reduce((W,q)=>{const J=q.parentNode||q.parentId,ee=!P.includes(q.id)&&J&&W.find(R=>R.id===J);return(typeof q.deletable=="boolean"?q.deletable:!0)&&(P.includes(q.id)||ee)&&W.push(q),W},[]),te=C.filter(W=>typeof W.deletable=="boolean"?W.deletable:!0),z=te.filter(W=>H.includes(W.id));if(U||z){const W=I$(U,te),q=[...z,...W],J=q.reduce((ee,Y)=>(ee.includes(Y.id)||ee.push(Y.id),ee),[]);if((E||T)&&(E&&e.setState({edges:C.filter(ee=>!J.includes(ee.id))}),T&&(U.forEach(ee=>{k.delete(ee.id)}),e.setState({nodeInternals:new Map(k)}))),J.length>0&&(A?.(q),B&&B(J.map(ee=>({id:ee,type:"remove"})))),U.length>0&&(_?.(U),F)){const ee=U.map(Y=>({id:Y.id,type:"remove"}));F(ee)}}},[]),g=O.useCallback(w=>{const b=p4e(w),k=b?null:e.getState().nodeInternals.get(w.id);return!b&&!k?[null,null,b]:[b?w:b_(k),k,b]},[]),x=O.useCallback((w,b=!0,k)=>{const[N,C,T]=g(w);return N?(k||e.getState().getNodes()).filter(E=>{if(!T&&(E.id===C.id||!E.positionAbsolute))return!1;const _=b_(E),A=jS(_,N);return b&&A>0||A>=N.width*N.height}):[]},[]),y=O.useCallback((w,b,k=!0)=>{const[N]=g(w);if(!N)return!1;const C=jS(N,b);return k&&C>0||C>=N.width*N.height},[]);return O.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:s,getEdge:i,setNodes:a,setEdges:o,addNodes:u,addEdges:h,toObject:f,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:y}),[t,n,r,s,i,a,o,u,h,f,m,x,y])}const Y4e={actInsideInputWithModifier:!1};var Z4e=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=Qr(),{deleteElements:r}=mO(),s=Ym(t,Y4e),i=Ym(e);O.useEffect(()=>{if(s){const{edges:a,getNodes:o}=n.getState(),u=o().filter(f=>f.selected),h=a.filter(f=>f.selected);r({nodes:u,edges:h}),n.setState({nodesSelectionActive:!1})}},[s]),O.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function K4e(t){const e=Qr();O.useEffect(()=>{let n;const r=()=>{if(!t.current)return;const s=aO(t.current);(s.height===0||s.width===0)&&e.getState().onError?.("004",Xl.error004()),e.setState({width:s.width||500,height:s.height||500})};return r(),window.addEventListener("resize",r),t.current&&(n=new ResizeObserver(()=>r()),n.observe(t.current)),()=>{window.removeEventListener("resize",r),n&&t.current&&n.unobserve(t.current)}},[])}const pO={position:"absolute",width:"100%",height:"100%",top:0,left:0},J4e=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,ux=t=>({x:t.x,y:t.y,zoom:t.k}),pd=(t,e)=>t.target.closest(`.${e}`),__=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),M_=t=>{const e=t.ctrlKey&&z1()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},ewe=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),twe=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:a=!1,panOnScrollSpeed:o=.5,panOnScrollMode:u=Gc.Free,zoomOnDoubleClick:h=!0,elementsSelectable:f,panOnDrag:m=!0,defaultViewport:g,translateExtent:x,minZoom:y,maxZoom:w,zoomActivationKeyCode:b,preventScrolling:k=!0,children:N,noWheelClassName:C,noPanClassName:T})=>{const E=O.useRef(),_=Qr(),A=O.useRef(!1),F=O.useRef(!1),B=O.useRef(null),P=O.useRef({x:0,y:0,zoom:0}),{d3Zoom:H,d3Selection:U,d3ZoomHandler:te,userSelectionActive:z}=Wn(ewe,Wr),W=Ym(b),q=O.useRef(0),J=O.useRef(!1),ee=O.useRef();return K4e(B),O.useEffect(()=>{if(B.current){const Y=B.current.getBoundingClientRect(),R=j$().scaleExtent([y,w]).translateExtent(x),re=Mi(B.current).call(R),K=Bl.translate(g.x,g.y).scale(fh(g.zoom,y,w)),I=[[0,0],[Y.width,Y.height]],Q=R.constrain()(K,I,x);R.transform(re,Q),R.wheelDelta(M_),_.setState({d3Zoom:R,d3Selection:re,d3ZoomHandler:re.on("wheel.zoom"),transform:[Q.x,Q.y,Q.k],domNode:B.current.closest(".react-flow")})}},[]),O.useEffect(()=>{U&&H&&(a&&!W&&!z?U.on("wheel.zoom",Y=>{if(pd(Y,C))return!1;Y.preventDefault(),Y.stopImmediatePropagation();const R=U.property("__zoom").k||1;if(Y.ctrlKey&&i){const ge=Ji(Y),se=M_(Y),Te=R*Math.pow(2,se);H.scaleTo(U,Te,ge,Y);return}const re=Y.deltaMode===1?20:1;let K=u===Gc.Vertical?0:Y.deltaX*re,I=u===Gc.Horizontal?0:Y.deltaY*re;!z1()&&Y.shiftKey&&u!==Gc.Vertical&&(K=Y.deltaY*re,I=0),H.translateBy(U,-(K/R)*o,-(I/R)*o,{internal:!0});const Q=ux(U.property("__zoom")),{onViewportChangeStart:$,onViewportChange:Z,onViewportChangeEnd:ne}=_.getState();clearTimeout(ee.current),J.current||(J.current=!0,e?.(Y,Q),$?.(Q)),J.current&&(t?.(Y,Q),Z?.(Q),ee.current=setTimeout(()=>{n?.(Y,Q),ne?.(Q),J.current=!1},150))},{passive:!1}):typeof te<"u"&&U.on("wheel.zoom",function(Y,R){if(!k&&Y.type==="wheel"&&!Y.ctrlKey||pd(Y,C))return null;Y.preventDefault(),te.call(this,Y,R)},{passive:!1}))},[z,a,u,U,H,te,W,i,k,C,e,t,n]),O.useEffect(()=>{H&&H.on("start",Y=>{if(!Y.sourceEvent||Y.sourceEvent.internal)return null;q.current=Y.sourceEvent?.button;const{onViewportChangeStart:R}=_.getState(),re=ux(Y.transform);A.current=!0,P.current=re,Y.sourceEvent?.type==="mousedown"&&_.setState({paneDragging:!0}),R?.(re),e?.(Y.sourceEvent,re)})},[H,e]),O.useEffect(()=>{H&&(z&&!A.current?H.on("zoom",null):z||H.on("zoom",Y=>{const{onViewportChange:R}=_.getState();if(_.setState({transform:[Y.transform.x,Y.transform.y,Y.transform.k]}),F.current=!!(r&&__(m,q.current??0)),(t||R)&&!Y.sourceEvent?.internal){const re=ux(Y.transform);R?.(re),t?.(Y.sourceEvent,re)}}))},[z,H,t,m,r]),O.useEffect(()=>{H&&H.on("end",Y=>{if(!Y.sourceEvent||Y.sourceEvent.internal)return null;const{onViewportChangeEnd:R}=_.getState();if(A.current=!1,_.setState({paneDragging:!1}),r&&__(m,q.current??0)&&!F.current&&r(Y.sourceEvent),F.current=!1,(n||R)&&J4e(P.current,Y.transform)){const re=ux(Y.transform);P.current=re,clearTimeout(E.current),E.current=setTimeout(()=>{R?.(re),n?.(Y.sourceEvent,re)},a?150:0)}})},[H,a,m,n,r]),O.useEffect(()=>{H&&H.filter(Y=>{const R=W||s,re=i&&Y.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&Y.button===1&&Y.type==="mousedown"&&(pd(Y,"react-flow__node")||pd(Y,"react-flow__edge")))return!0;if(!m&&!R&&!a&&!h&&!i||z||!h&&Y.type==="dblclick"||pd(Y,C)&&Y.type==="wheel"||pd(Y,T)&&(Y.type!=="wheel"||a&&Y.type==="wheel"&&!W)||!i&&Y.ctrlKey&&Y.type==="wheel"||!R&&!a&&!re&&Y.type==="wheel"||!m&&(Y.type==="mousedown"||Y.type==="touchstart")||Array.isArray(m)&&!m.includes(Y.button)&&Y.type==="mousedown")return!1;const K=Array.isArray(m)&&m.includes(Y.button)||!Y.button||Y.button<=1;return(!Y.ctrlKey||Y.type==="wheel")&&K})},[z,H,s,i,a,h,m,f,W]),fe.createElement("div",{className:"react-flow__renderer",ref:B,style:pO},N)},nwe=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function rwe(){const{userSelectionActive:t,userSelectionRect:e}=Wn(nwe,Wr);return t&&e?fe.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function A_(t,e){const n=e.parentNode||e.parentId,r=t.find(s=>s.id===n);if(r){const s=e.position.x+e.width-r.width,i=e.position.y+e.height-r.height;if(s>0||i>0||e.position.x<0||e.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,s>0&&(r.style.width+=s),i>0&&(r.style.height+=i),e.position.x<0){const a=Math.abs(e.position.x);r.position.x=r.position.x-a,r.style.width+=a,e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);r.position.y=r.position.y-a,r.style.height+=a,e.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function nQ(t,e){if(t.some(r=>r.type==="reset"))return t.filter(r=>r.type==="reset").map(r=>r.item);const n=t.filter(r=>r.type==="add").map(r=>r.item);return e.reduce((r,s)=>{const i=t.filter(o=>o.id===s.id);if(i.length===0)return r.push(s),r;const a={...s};for(const o of i)if(o)switch(o.type){case"select":{a.selected=o.selected;break}case"position":{typeof o.position<"u"&&(a.position=o.position),typeof o.positionAbsolute<"u"&&(a.positionAbsolute=o.positionAbsolute),typeof o.dragging<"u"&&(a.dragging=o.dragging),a.expandParent&&A_(r,a);break}case"dimensions":{typeof o.dimensions<"u"&&(a.width=o.dimensions.width,a.height=o.dimensions.height),typeof o.updateStyle<"u"&&(a.style={...a.style||{},...o.dimensions}),typeof o.resizing=="boolean"&&(a.resizing=o.resizing),a.expandParent&&A_(r,a);break}case"remove":return r}return r.push(a),r},n)}function rQ(t,e){return nQ(t,e)}function swe(t,e){return nQ(t,e)}const Bo=(t,e)=>({id:t,type:"select",selected:e});function Ad(t,e){return t.reduce((n,r)=>{const s=e.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(Bo(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(Bo(r.id,!1))),n},[])}const H4=(t,e)=>n=>{n.target===e.current&&t?.(n)},iwe=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),sQ=O.memo(({isSelecting:t,selectionMode:e=Xm.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:a,onPaneScroll:o,onPaneMouseEnter:u,onPaneMouseMove:h,onPaneMouseLeave:f,children:m})=>{const g=O.useRef(null),x=Qr(),y=O.useRef(0),w=O.useRef(0),b=O.useRef(),{userSelectionActive:k,elementsSelectable:N,dragging:C}=Wn(iwe,Wr),T=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,w.current=0},E=te=>{i?.(te),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},_=te=>{if(Array.isArray(n)&&n?.includes(2)){te.preventDefault();return}a?.(te)},A=o?te=>o(te):void 0,F=te=>{const{resetSelectedElements:z,domNode:W}=x.getState();if(b.current=W?.getBoundingClientRect(),!N||!t||te.button!==0||te.target!==g.current||!b.current)return;const{x:q,y:J}=Vo(te,b.current);z(),x.setState({userSelectionRect:{width:0,height:0,startX:q,startY:J,x:q,y:J}}),r?.(te)},B=te=>{const{userSelectionRect:z,nodeInternals:W,edges:q,transform:J,onNodesChange:ee,onEdgesChange:Y,nodeOrigin:R,getNodes:re}=x.getState();if(!t||!b.current||!z)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const K=Vo(te,b.current),I=z.startX??0,Q=z.startY??0,$={...z,x:K.xTe.id),se=ne.map(Te=>Te.id);if(y.current!==se.length){y.current=se.length;const Te=Ad(Z,se);Te.length&&ee?.(Te)}if(w.current!==ge.length){w.current=ge.length;const Te=Ad(q,ge);Te.length&&Y?.(Te)}x.setState({userSelectionRect:$})},P=te=>{if(te.button!==0)return;const{userSelectionRect:z}=x.getState();!k&&z&&te.target===g.current&&E?.(te),x.setState({nodesSelectionActive:y.current>0}),T(),s?.(te)},H=te=>{k&&(x.setState({nodesSelectionActive:y.current>0}),s?.(te)),T()},U=N&&(t||k);return fe.createElement("div",{className:ls(["react-flow__pane",{dragging:C,selection:t}]),onClick:U?void 0:H4(E,g),onContextMenu:H4(_,g),onWheel:H4(A,g),onMouseEnter:U?void 0:u,onMouseDown:U?F:void 0,onMouseMove:U?B:h,onMouseUp:U?P:void 0,onMouseLeave:U?H:f,ref:g,style:pO},m,fe.createElement(rwe,null))});sQ.displayName="Pane";function iQ(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const r=e.get(n);return r?r.selected?!0:iQ(r,e):!1}function R_(t,e,n){let r=t;do{if(r?.matches(e))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function awe(t,e,n,r){return Array.from(t.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!iQ(s,t))&&(s.draggable||e&&typeof s.draggable>"u")).map(s=>({id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(s.positionAbsolute?.x??0),y:n.y-(s.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}))}function lwe(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function aQ(t,e,n,r,s=[0,0],i){const a=lwe(t,t.extent||r);let o=a;const u=t.parentNode||t.parentId;if(t.extent==="parent"&&!t.expandParent)if(u&&t.width&&t.height){const m=n.get(u),{x:g,y:x}=ru(m,s).positionAbsolute;o=m&&Pi(g)&&Pi(x)&&Pi(m.width)&&Pi(m.height)?[[g+t.width*s[0],x+t.height*s[1]],[g+m.width-t.width+t.width*s[0],x+m.height-t.height+t.height*s[1]]]:o}else i?.("005",Xl.error005()),o=a;else if(t.extent&&u&&t.extent!=="parent"){const m=n.get(u),{x:g,y:x}=ru(m,s).positionAbsolute;o=[[t.extent[0][0]+g,t.extent[0][1]+x],[t.extent[1][0]+g,t.extent[1][1]+x]]}let h={x:0,y:0};if(u){const m=n.get(u);h=ru(m,s).positionAbsolute}const f=o&&o!=="parent"?lO(e,o):e;return{position:{x:f.x-h.x,y:f.y-h.y},positionAbsolute:f}}function V4({nodeId:t,dragItems:e,nodeInternals:n}){const r=e.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[t?r.find(s=>s.id===t):r[0],r]}const D_=(t,e,n,r)=>{const s=e.querySelectorAll(t);if(!s||!s.length)return null;const i=Array.from(s),a=e.getBoundingClientRect(),o={x:a.width*r[0],y:a.height*r[1]};return i.map(u=>{const h=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),position:u.getAttribute("data-handlepos"),x:(h.left-a.left-o.x)/n,y:(h.top-a.top-o.y)/n,...aO(u)}})};function Qf(t,e,n){return n===void 0?n:r=>{const s=e().nodeInternals.get(t);s&&n(r,{...s})}}function MS({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeInternals:o,onError:u}=e.getState(),h=o.get(t);if(!h){u?.("012",Xl.error012(t));return}e.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&a)&&(i({nodes:[h],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):s([t])}function owe(){const t=Qr();return O.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:i}=t.getState(),a=n.touches?n.touches[0].clientX:n.clientX,o=n.touches?n.touches[0].clientY:n.clientY,u={x:(a-r[0])/r[2],y:(o-r[1])/r[2]};return{xSnapped:i?s[0]*Math.round(u.x/s[0]):u.x,ySnapped:i?s[1]*Math.round(u.y/s[1]):u.y,...u}},[])}function U4(t){return(e,n,r)=>t?.(e,r)}function lQ({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,selectNodesOnDrag:a}){const o=Qr(),[u,h]=O.useState(!1),f=O.useRef([]),m=O.useRef({x:null,y:null}),g=O.useRef(0),x=O.useRef(null),y=O.useRef({x:0,y:0}),w=O.useRef(null),b=O.useRef(!1),k=O.useRef(!1),N=O.useRef(!1),C=owe();return O.useEffect(()=>{if(t?.current){const T=Mi(t.current),E=({x:F,y:B})=>{const{nodeInternals:P,onNodeDrag:H,onSelectionDrag:U,updateNodePositions:te,nodeExtent:z,snapGrid:W,snapToGrid:q,nodeOrigin:J,onError:ee}=o.getState();m.current={x:F,y:B};let Y=!1,R={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&z){const K=Vv(f.current,J);R=Gm(K)}if(f.current=f.current.map(K=>{const I={x:F-K.distance.x,y:B-K.distance.y};q&&(I.x=W[0]*Math.round(I.x/W[0]),I.y=W[1]*Math.round(I.y/W[1]));const Q=[[z[0][0],z[0][1]],[z[1][0],z[1][1]]];f.current.length>1&&z&&!K.extent&&(Q[0][0]=K.positionAbsolute.x-R.x+z[0][0],Q[1][0]=K.positionAbsolute.x+(K.width??0)-R.x2+z[1][0],Q[0][1]=K.positionAbsolute.y-R.y+z[0][1],Q[1][1]=K.positionAbsolute.y+(K.height??0)-R.y2+z[1][1]);const $=aQ(K,I,P,Q,J,ee);return Y=Y||K.position.x!==$.position.x||K.position.y!==$.position.y,K.position=$.position,K.positionAbsolute=$.positionAbsolute,K}),!Y)return;te(f.current,!0,!0),h(!0);const re=s?H:U4(U);if(re&&w.current){const[K,I]=V4({nodeId:s,dragItems:f.current,nodeInternals:P});re(w.current,K,I)}},_=()=>{if(!x.current)return;const[F,B]=C$(y.current,x.current);if(F!==0||B!==0){const{transform:P,panBy:H}=o.getState();m.current.x=(m.current.x??0)-F/P[2],m.current.y=(m.current.y??0)-B/P[2],H({x:F,y:B})&&E(m.current)}g.current=requestAnimationFrame(_)},A=F=>{const{nodeInternals:B,multiSelectionActive:P,nodesDraggable:H,unselectNodesAndEdges:U,onNodeDragStart:te,onSelectionDragStart:z}=o.getState();k.current=!0;const W=s?te:U4(z);(!a||!i)&&!P&&s&&(B.get(s)?.selected||U()),s&&i&&a&&MS({id:s,store:o,nodeRef:t});const q=C(F);if(m.current=q,f.current=awe(B,H,q,s),W&&f.current){const[J,ee]=V4({nodeId:s,dragItems:f.current,nodeInternals:B});W(F.sourceEvent,J,ee)}};if(e)T.on(".drag",null);else{const F=Vbe().on("start",B=>{const{domNode:P,nodeDragThreshold:H}=o.getState();H===0&&A(B),N.current=!1;const U=C(B);m.current=U,x.current=P?.getBoundingClientRect()||null,y.current=Vo(B.sourceEvent,x.current)}).on("drag",B=>{const P=C(B),{autoPanOnNodeDrag:H,nodeDragThreshold:U}=o.getState();if(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!b.current&&k.current&&H&&(b.current=!0,_()),!k.current){const te=P.xSnapped-(m?.current?.x??0),z=P.ySnapped-(m?.current?.y??0);Math.sqrt(te*te+z*z)>U&&A(B)}(m.current.x!==P.xSnapped||m.current.y!==P.ySnapped)&&f.current&&k.current&&(w.current=B.sourceEvent,y.current=Vo(B.sourceEvent,x.current),E(P))}}).on("end",B=>{if(!(!k.current||N.current)&&(h(!1),b.current=!1,k.current=!1,cancelAnimationFrame(g.current),f.current)){const{updateNodePositions:P,nodeInternals:H,onNodeDragStop:U,onSelectionDragStop:te}=o.getState(),z=s?U:U4(te);if(P(f.current,!1,!1),z){const[W,q]=V4({nodeId:s,dragItems:f.current,nodeInternals:H});z(B.sourceEvent,W,q)}}}).filter(B=>{const P=B.target;return!B.button&&(!n||!R_(P,`.${n}`,t))&&(!r||R_(P,r,t))});return T.call(F),()=>{T.on(".drag",null)}}}},[t,e,n,r,i,o,s,a,C]),u}function oQ(){const t=Qr();return O.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:i,getNodes:a,snapToGrid:o,snapGrid:u,onError:h,nodesDraggable:f}=t.getState(),m=a().filter(N=>N.selected&&(N.draggable||f&&typeof N.draggable>"u")),g=o?u[0]:5,x=o?u[1]:5,y=n.isShiftPressed?4:1,w=n.x*g*y,b=n.y*x*y,k=m.map(N=>{if(N.positionAbsolute){const C={x:N.positionAbsolute.x+w,y:N.positionAbsolute.y+b};o&&(C.x=u[0]*Math.round(C.x/u[0]),C.y=u[1]*Math.round(C.y/u[1]));const{positionAbsolute:T,position:E}=aQ(N,C,r,s,void 0,h);N.position=E,N.positionAbsolute=T}return N});i(k,!0,!1)},[])}const Vd={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Hf=t=>{const e=({id:n,type:r,data:s,xPos:i,yPos:a,xPosOrigin:o,yPosOrigin:u,selected:h,onClick:f,onMouseEnter:m,onMouseMove:g,onMouseLeave:x,onContextMenu:y,onDoubleClick:w,style:b,className:k,isDraggable:N,isSelectable:C,isConnectable:T,isFocusable:E,selectNodesOnDrag:_,sourcePosition:A,targetPosition:F,hidden:B,resizeObserver:P,dragHandle:H,zIndex:U,isParent:te,noDragClassName:z,noPanClassName:W,initialized:q,disableKeyboardA11y:J,ariaLabel:ee,rfId:Y,hasHandleBounds:R})=>{const re=Qr(),K=O.useRef(null),I=O.useRef(null),Q=O.useRef(A),$=O.useRef(F),Z=O.useRef(r),ne=C||N||f||m||g||x,ge=oQ(),se=Qf(n,re.getState,m),Te=Qf(n,re.getState,g),qe=Qf(n,re.getState,x),ve=Qf(n,re.getState,y),Fe=Qf(n,re.getState,w),Qe=st=>{const{nodeDragThreshold:He}=re.getState();if(C&&(!_||!N||He>0)&&MS({id:n,store:re,nodeRef:K}),f){const St=re.getState().nodeInternals.get(n);St&&f(st,{...St})}},Ke=st=>{if(!NS(st)&&!J)if(M$.includes(st.key)&&C){const He=st.key==="Escape";MS({id:n,store:re,unselect:He,nodeRef:K})}else N&&h&&Object.prototype.hasOwnProperty.call(Vd,st.key)&&(re.setState({ariaLiveMessage:`Moved selected node ${st.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),ge({x:Vd[st.key].x,y:Vd[st.key].y,isShiftPressed:st.shiftKey}))};O.useEffect(()=>()=>{I.current&&(P?.unobserve(I.current),I.current=null)},[]),O.useEffect(()=>{if(K.current&&!B){const st=K.current;(!q||!R||I.current!==st)&&(I.current&&P?.unobserve(I.current),P?.observe(st),I.current=st)}},[B,q,R]),O.useEffect(()=>{const st=Z.current!==r,He=Q.current!==A,St=$.current!==F;K.current&&(st||He||St)&&(st&&(Z.current=r),He&&(Q.current=A),St&&($.current=F),re.getState().updateNodeDimensions([{id:n,nodeElement:K.current,forceUpdate:!0}]))},[n,r,A,F]);const Tt=lQ({nodeRef:K,disabled:B||!N,noDragClassName:z,handleSelector:H,nodeId:n,isSelectable:C,selectNodesOnDrag:_});return B?null:fe.createElement("div",{className:ls(["react-flow__node",`react-flow__node-${r}`,{[W]:N},k,{selected:h,selectable:C,parent:te,dragging:Tt}]),ref:K,style:{zIndex:U,transform:`translate(${o}px,${u}px)`,pointerEvents:ne?"all":"none",visibility:q?"visible":"hidden",...b},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:se,onMouseMove:Te,onMouseLeave:qe,onContextMenu:ve,onClick:Qe,onDoubleClick:Fe,onKeyDown:E?Ke:void 0,tabIndex:E?0:void 0,role:E?"button":void 0,"aria-describedby":J?void 0:`${Z$}-${Y}`,"aria-label":ee},fe.createElement(S4e,{value:n},fe.createElement(t,{id:n,data:s,type:r,xPos:i,yPos:a,selected:h,isConnectable:T,sourcePosition:A,targetPosition:F,dragging:Tt,dragHandle:H,zIndex:U})))};return e.displayName="NodeWrapper",O.memo(e)};const cwe=t=>{const e=t.getNodes().filter(n=>n.selected);return{...Vv(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function uwe({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=Qr(),{width:s,height:i,x:a,y:o,transformString:u,userSelectionActive:h}=Wn(cwe,Wr),f=oQ(),m=O.useRef(null);if(O.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]),lQ({nodeRef:m}),h||!s||!i)return null;const g=t?y=>{const w=r.getState().getNodes().filter(b=>b.selected);t(y,w)}:void 0,x=y=>{Object.prototype.hasOwnProperty.call(Vd,y.key)&&f({x:Vd[y.key].x,y:Vd[y.key].y,isShiftPressed:y.shiftKey})};return fe.createElement("div",{className:ls(["react-flow__nodesselection","react-flow__container",e]),style:{transform:u}},fe.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:s,height:i,top:o,left:a}}))}var dwe=O.memo(uwe);const hwe=t=>t.nodesSelectionActive,cQ=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,deleteKeyCode:o,onMove:u,onMoveStart:h,onMoveEnd:f,selectionKeyCode:m,selectionOnDrag:g,selectionMode:x,onSelectionStart:y,onSelectionEnd:w,multiSelectionKeyCode:b,panActivationKeyCode:k,zoomActivationKeyCode:N,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:_,panOnScrollSpeed:A,panOnScrollMode:F,zoomOnDoubleClick:B,panOnDrag:P,defaultViewport:H,translateExtent:U,minZoom:te,maxZoom:z,preventScrolling:W,onSelectionContextMenu:q,noWheelClassName:J,noPanClassName:ee,disableKeyboardA11y:Y})=>{const R=Wn(hwe),re=Ym(m),K=Ym(k),I=K||P,Q=K||_,$=re||g&&I!==!0;return Z4e({deleteKeyCode:o,multiSelectionKeyCode:b}),fe.createElement(twe,{onMove:u,onMoveStart:h,onMoveEnd:f,onPaneContextMenu:i,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:Q,panOnScrollSpeed:A,panOnScrollMode:F,zoomOnDoubleClick:B,panOnDrag:!re&&I,defaultViewport:H,translateExtent:U,minZoom:te,maxZoom:z,zoomActivationKeyCode:N,preventScrolling:W,noWheelClassName:J,noPanClassName:ee},fe.createElement(sQ,{onSelectionStart:y,onSelectionEnd:w,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:I,isSelecting:!!$,selectionMode:x},t,R&&fe.createElement(dwe,{onSelectionContextMenu:q,noPanClassName:ee,disableKeyboardA11y:Y})))};cQ.displayName="FlowRenderer";var fwe=O.memo(cQ);function mwe(t){return Wn(O.useCallback(n=>t?B$(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function pwe(t){const e={input:Hf(t.input||W$),default:Hf(t.default||_S),output:Hf(t.output||X$),group:Hf(t.group||fO)},n={},r=Object.keys(t).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=Hf(t[i]||_S),s),n);return{...e,...r}}const gwe=({x:t,y:e,width:n,height:r,origin:s})=>!n||!r?{x:t,y:e}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:t,y:e}:{x:t-n*s[0],y:e-r*s[1]},xwe=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),uQ=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:i,onError:a}=Wn(xwe,Wr),o=mwe(t.onlyRenderVisibleElements),u=O.useRef(),h=O.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(m=>{const g=m.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));i(g)});return u.current=f,f},[]);return O.useEffect(()=>()=>{u?.current?.disconnect()},[]),fe.createElement("div",{className:"react-flow__nodes",style:pO},o.map(f=>{let m=f.type||"default";t.nodeTypes[m]||(a?.("003",Xl.error003(m)),m="default");const g=t.nodeTypes[m]||t.nodeTypes.default,x=!!(f.draggable||e&&typeof f.draggable>"u"),y=!!(f.selectable||s&&typeof f.selectable>"u"),w=!!(f.connectable||n&&typeof f.connectable>"u"),b=!!(f.focusable||r&&typeof f.focusable>"u"),k=t.nodeExtent?lO(f.positionAbsolute,t.nodeExtent):f.positionAbsolute,N=k?.x??0,C=k?.y??0,T=gwe({x:N,y:C,width:f.width??0,height:f.height??0,origin:t.nodeOrigin});return fe.createElement(g,{key:f.id,id:f.id,className:f.className,style:f.style,type:m,data:f.data,sourcePosition:f.sourcePosition||at.Bottom,targetPosition:f.targetPosition||at.Top,hidden:f.hidden,xPos:N,yPos:C,xPosOrigin:T.x,yPosOrigin:T.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!f.selected,isDraggable:x,isSelectable:y,isConnectable:w,isFocusable:b,resizeObserver:h,dragHandle:f.dragHandle,zIndex:f[hr]?.z??0,isParent:!!f[hr]?.isParent,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!f.width&&!!f.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!f[hr]?.handleBounds})}))};uQ.displayName="NodeRenderer";var vwe=O.memo(uQ);const ywe=(t,e,n)=>n===at.Left?t-e:n===at.Right?t+e:t,bwe=(t,e,n)=>n===at.Top?t-e:n===at.Bottom?t+e:t,z_="react-flow__edgeupdater",P_=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:o})=>fe.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:ls([z_,`${z_}-${o}`]),cx:ywe(e,r,t),cy:bwe(n,r,t),r,stroke:"transparent",fill:"transparent"}),wwe=()=>!0;var gd=t=>{const e=({id:n,className:r,type:s,data:i,onClick:a,onEdgeDoubleClick:o,selected:u,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,style:b,source:k,target:N,sourceX:C,sourceY:T,targetX:E,targetY:_,sourcePosition:A,targetPosition:F,elementsSelectable:B,hidden:P,sourceHandleId:H,targetHandleId:U,onContextMenu:te,onMouseEnter:z,onMouseMove:W,onMouseLeave:q,reconnectRadius:J,onReconnect:ee,onReconnectStart:Y,onReconnectEnd:R,markerEnd:re,markerStart:K,rfId:I,ariaLabel:Q,isFocusable:$,isReconnectable:Z,pathOptions:ne,interactionWidth:ge,disableKeyboardA11y:se})=>{const Te=O.useRef(null),[qe,ve]=O.useState(!1),[Fe,Qe]=O.useState(!1),Ke=Qr(),Tt=O.useMemo(()=>`url('#${TS(K,I)}')`,[K,I]),st=O.useMemo(()=>`url('#${TS(re,I)}')`,[re,I]);if(P)return null;const He=Vt=>{const{edges:Ln,addSelectedEdges:ue,unselectNodesAndEdges:Ce,multiSelectionActive:lt}=Ke.getState(),ut=Ln.find(or=>or.id===n);ut&&(B&&(Ke.setState({nodesSelectionActive:!1}),ut.selected&<?(Ce({nodes:[],edges:[ut]}),Te.current?.blur()):ue([n])),a&&a(Vt,ut))},St=$f(n,Ke.getState,o),bt=$f(n,Ke.getState,te),nr=$f(n,Ke.getState,z),mn=$f(n,Ke.getState,W),Hn=$f(n,Ke.getState,q),$t=(Vt,Ln)=>{if(Vt.button!==0)return;const{edges:ue,isValidConnection:Ce}=Ke.getState(),lt=Ln?N:k,ut=(Ln?U:H)||null,or=Ln?"target":"source",ft=Ce||wwe,On=Ln,mt=ue.find(kt=>kt.id===n);Qe(!0),Y?.(Vt,mt,or);const Jt=kt=>{Qe(!1),R?.(kt,mt,or)};Q$({event:Vt,handleId:ut,nodeId:lt,onConnect:kt=>ee?.(mt,kt),isTarget:On,getState:Ke.getState,setState:Ke.setState,isValidConnection:ft,edgeUpdaterType:or,onReconnectEnd:Jt})},ht=Vt=>$t(Vt,!0),le=Vt=>$t(Vt,!1),Oe=()=>ve(!0),Le=()=>ve(!1),nt=!B&&!a,Ot=Vt=>{if(!se&&M$.includes(Vt.key)&&B){const{unselectNodesAndEdges:Ln,addSelectedEdges:ue,edges:Ce}=Ke.getState();Vt.key==="Escape"?(Te.current?.blur(),Ln({edges:[Ce.find(ut=>ut.id===n)]})):ue([n])}};return fe.createElement("g",{className:ls(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:u,animated:h,inactive:nt,updating:qe}]),onClick:He,onDoubleClick:St,onContextMenu:bt,onMouseEnter:nr,onMouseMove:mn,onMouseLeave:Hn,onKeyDown:$?Ot:void 0,tabIndex:$?0:void 0,role:$?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Q===null?void 0:Q||`Edge from ${k} to ${N}`,"aria-describedby":$?`${K$}-${I}`:void 0,ref:Te},!Fe&&fe.createElement(t,{id:n,source:k,target:N,selected:u,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,data:i,style:b,sourceX:C,sourceY:T,targetX:E,targetY:_,sourcePosition:A,targetPosition:F,sourceHandleId:H,targetHandleId:U,markerStart:Tt,markerEnd:st,pathOptions:ne,interactionWidth:ge}),Z&&fe.createElement(fe.Fragment,null,(Z==="source"||Z===!0)&&fe.createElement(P_,{position:A,centerX:C,centerY:T,radius:J,onMouseDown:ht,onMouseEnter:Oe,onMouseOut:Le,type:"source"}),(Z==="target"||Z===!0)&&fe.createElement(P_,{position:F,centerX:E,centerY:_,radius:J,onMouseDown:le,onMouseEnter:Oe,onMouseOut:Le,type:"target"})))};return e.displayName="EdgeWrapper",O.memo(e)};function Swe(t){const e={default:gd(t.default||L1),straight:gd(t.bezier||uO),step:gd(t.step||cO),smoothstep:gd(t.step||Hv),simplebezier:gd(t.simplebezier||oO)},n={},r=Object.keys(t).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=gd(t[i]||L1),s),n);return{...e,...r}}function L_(t,e,n=null){const r=(n?.x||0)+e.x,s=(n?.y||0)+e.y,i=n?.width||e.width,a=n?.height||e.height;switch(t){case at.Top:return{x:r+i/2,y:s};case at.Right:return{x:r+i,y:s+a/2};case at.Bottom:return{x:r+i/2,y:s+a};case at.Left:return{x:r,y:s+a/2}}}function B_(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const kwe=(t,e,n,r,s,i)=>{const a=L_(n,t,e),o=L_(i,r,s);return{sourceX:a.x,sourceY:a.y,targetX:o.x,targetY:o.y}};function Owe({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:i,width:a,height:o,transform:u}){const h={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+s),y2:Math.max(t.y+r,e.y+i)};h.x===h.x2&&(h.x2+=1),h.y===h.y2&&(h.y2+=1);const f=Gm({x:(0-u[0])/u[2],y:(0-u[1])/u[2],width:a/u[2],height:o/u[2]}),m=Math.max(0,Math.min(f.x2,h.x2)-Math.max(f.x,h.x)),g=Math.max(0,Math.min(f.y2,h.y2)-Math.max(f.y,h.y));return Math.ceil(m*g)>0}function I_(t){const e=t?.[hr]?.handleBounds||null,n=e&&t?.width&&t?.height&&typeof t?.positionAbsolute?.x<"u"&&typeof t?.positionAbsolute?.y<"u";return[{x:t?.positionAbsolute?.x||0,y:t?.positionAbsolute?.y||0,width:t?.width||0,height:t?.height||0},e,!!n]}const jwe=[{level:0,isMaxLevel:!0,edges:[]}];function Nwe(t,e,n=!1){let r=-1;const s=t.reduce((a,o)=>{const u=Pi(o.zIndex);let h=u?o.zIndex:0;if(n){const f=e.get(o.target),m=e.get(o.source),g=o.selected||f?.selected||m?.selected,x=Math.max(m?.[hr]?.z||0,f?.[hr]?.z||0,1e3);h=(u?o.zIndex:0)+(g?x:0)}return a[h]?a[h].push(o):a[h]=[o],r=h>r?h:r,a},{}),i=Object.entries(s).map(([a,o])=>{const u=+a;return{edges:o,level:u,isMaxLevel:u===r}});return i.length===0?jwe:i}function Cwe(t,e,n){const r=Wn(O.useCallback(s=>t?s.edges.filter(i=>{const a=e.get(i.source),o=e.get(i.target);return a?.width&&a?.height&&o?.width&&o?.height&&Owe({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:o.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:o.width,targetHeight:o.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[t,e]));return Nwe(r,e,n)}const Twe=({color:t="none",strokeWidth:e=1})=>fe.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),Ewe=({color:t="none",strokeWidth:e=1})=>fe.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),q_={[P1.Arrow]:Twe,[P1.ArrowClosed]:Ewe};function _we(t){const e=Qr();return O.useMemo(()=>Object.prototype.hasOwnProperty.call(q_,t)?q_[t]:(e.getState().onError?.("009",Xl.error009(t)),null),[t])}const Mwe=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const u=_we(e);return u?fe.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:o,refX:"0",refY:"0"},fe.createElement(u,{color:n,strokeWidth:a})):null},Awe=({defaultColor:t,rfId:e})=>n=>{const r=[];return n.edges.reduce((s,i)=>([i.markerStart,i.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const o=TS(a,e);r.includes(o)||(s.push({id:o,color:a.color||t,...a}),r.push(o))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},dQ=({defaultColor:t,rfId:e})=>{const n=Wn(O.useCallback(Awe({defaultColor:t,rfId:e}),[t,e]),(r,s)=>!(r.length!==s.length||r.some((i,a)=>i.id!==s[a].id)));return fe.createElement("defs",null,n.map(r=>fe.createElement(Mwe,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};dQ.displayName="MarkerDefinitions";var Rwe=O.memo(dQ);const Dwe=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),hQ=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:u,onEdgeMouseLeave:h,onEdgeClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,children:b,disableKeyboardA11y:k})=>{const{edgesFocusable:N,edgesUpdatable:C,elementsSelectable:T,width:E,height:_,connectionMode:A,nodeInternals:F,onError:B}=Wn(Dwe,Wr),P=Cwe(e,F,n);return E?fe.createElement(fe.Fragment,null,P.map(({level:H,edges:U,isMaxLevel:te})=>fe.createElement("svg",{key:H,style:{zIndex:H},width:E,height:_,className:"react-flow__edges react-flow__container"},te&&fe.createElement(Rwe,{defaultColor:t,rfId:r}),fe.createElement("g",null,U.map(z=>{const[W,q,J]=I_(F.get(z.source)),[ee,Y,R]=I_(F.get(z.target));if(!J||!R)return null;let re=z.type||"default";s[re]||(B?.("011",Xl.error011(re)),re="default");const K=s[re]||s.default,I=A===gu.Strict?Y.target:(Y.target??[]).concat(Y.source??[]),Q=B_(q.source,z.sourceHandle),$=B_(I,z.targetHandle),Z=Q?.position||at.Bottom,ne=$?.position||at.Top,ge=!!(z.focusable||N&&typeof z.focusable>"u"),se=z.reconnectable||z.updatable,Te=typeof g<"u"&&(se||C&&typeof se>"u");if(!Q||!$)return B?.("008",Xl.error008(Q,z)),null;const{sourceX:qe,sourceY:ve,targetX:Fe,targetY:Qe}=kwe(W,Q,Z,ee,$,ne);return fe.createElement(K,{key:z.id,id:z.id,className:ls([z.className,i]),type:re,data:z.data,selected:!!z.selected,animated:!!z.animated,hidden:!!z.hidden,label:z.label,labelStyle:z.labelStyle,labelShowBg:z.labelShowBg,labelBgStyle:z.labelBgStyle,labelBgPadding:z.labelBgPadding,labelBgBorderRadius:z.labelBgBorderRadius,style:z.style,source:z.source,target:z.target,sourceHandleId:z.sourceHandle,targetHandleId:z.targetHandle,markerEnd:z.markerEnd,markerStart:z.markerStart,sourceX:qe,sourceY:ve,targetX:Fe,targetY:Qe,sourcePosition:Z,targetPosition:ne,elementsSelectable:T,onContextMenu:a,onMouseEnter:o,onMouseMove:u,onMouseLeave:h,onClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,rfId:r,ariaLabel:z.ariaLabel,isFocusable:ge,isReconnectable:Te,pathOptions:"pathOptions"in z?z.pathOptions:void 0,interactionWidth:z.interactionWidth,disableKeyboardA11y:k})})))),b):null};hQ.displayName="EdgeRenderer";var zwe=O.memo(hQ);const Pwe=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function Lwe({children:t}){const e=Wn(Pwe);return fe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function Bwe(t){const e=mO(),n=O.useRef(!1);O.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const Iwe={[at.Left]:at.Right,[at.Right]:at.Left,[at.Top]:at.Bottom,[at.Bottom]:at.Top},fQ=({nodeId:t,handleType:e,style:n,type:r=qo.Bezier,CustomComponent:s,connectionStatus:i})=>{const{fromNode:a,handleId:o,toX:u,toY:h,connectionMode:f}=Wn(O.useCallback(_=>({fromNode:_.nodeInternals.get(t),handleId:_.connectionHandleId,toX:(_.connectionPosition.x-_.transform[0])/_.transform[2],toY:(_.connectionPosition.y-_.transform[1])/_.transform[2],connectionMode:_.connectionMode}),[t]),Wr),m=a?.[hr]?.handleBounds;let g=m?.[e];if(f===gu.Loose&&(g=g||m?.[e==="source"?"target":"source"]),!a||!g)return null;const x=o?g.find(_=>_.id===o):g[0],y=x?x.x+x.width/2:(a.width??0)/2,w=x?x.y+x.height/2:a.height??0,b=(a.positionAbsolute?.x??0)+y,k=(a.positionAbsolute?.y??0)+w,N=x?.position,C=N?Iwe[N]:null;if(!N||!C)return null;if(s)return fe.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:x,fromX:b,fromY:k,toX:u,toY:h,fromPosition:N,toPosition:C,connectionStatus:i});let T="";const E={sourceX:b,sourceY:k,sourcePosition:N,targetX:u,targetY:h,targetPosition:C};return r===qo.Bezier?[T]=P$(E):r===qo.Step?[T]=CS({...E,borderRadius:0}):r===qo.SmoothStep?[T]=CS(E):r===qo.SimpleBezier?[T]=z$(E):T=`M${b},${k} ${u},${h}`,fe.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:n})};fQ.displayName="ConnectionLine";const qwe=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function Fwe({containerStyle:t,style:e,type:n,component:r}){const{nodeId:s,handleType:i,nodesConnectable:a,width:o,height:u,connectionStatus:h}=Wn(qwe,Wr);return!(s&&i&&o&&a)?null:fe.createElement("svg",{style:t,width:o,height:u,className:"react-flow__edges react-flow__connectionline react-flow__container"},fe.createElement("g",{className:ls(["react-flow__connection",h])},fe.createElement(fQ,{nodeId:s,handleType:i,style:e,type:n,CustomComponent:r,connectionStatus:h})))}function F_(t,e){return O.useRef(null),Qr(),O.useMemo(()=>e(t),[t])}const mQ=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:i,onNodeClick:a,onEdgeClick:o,onNodeDoubleClick:u,onEdgeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,onSelectionContextMenu:y,onSelectionStart:w,onSelectionEnd:b,connectionLineType:k,connectionLineStyle:N,connectionLineComponent:C,connectionLineContainerStyle:T,selectionKeyCode:E,selectionOnDrag:_,selectionMode:A,multiSelectionKeyCode:F,panActivationKeyCode:B,zoomActivationKeyCode:P,deleteKeyCode:H,onlyRenderVisibleElements:U,elementsSelectable:te,selectNodesOnDrag:z,defaultViewport:W,translateExtent:q,minZoom:J,maxZoom:ee,preventScrolling:Y,defaultMarkerColor:R,zoomOnScroll:re,zoomOnPinch:K,panOnScroll:I,panOnScrollSpeed:Q,panOnScrollMode:$,zoomOnDoubleClick:Z,panOnDrag:ne,onPaneClick:ge,onPaneMouseEnter:se,onPaneMouseMove:Te,onPaneMouseLeave:qe,onPaneScroll:ve,onPaneContextMenu:Fe,onEdgeContextMenu:Qe,onEdgeMouseEnter:Ke,onEdgeMouseMove:Tt,onEdgeMouseLeave:st,onReconnect:He,onReconnectStart:St,onReconnectEnd:bt,reconnectRadius:nr,noDragClassName:mn,noWheelClassName:Hn,noPanClassName:$t,elevateEdgesOnSelect:ht,disableKeyboardA11y:le,nodeOrigin:Oe,nodeExtent:Le,rfId:nt})=>{const Ot=F_(t,pwe),Vt=F_(e,Swe);return Bwe(i),fe.createElement(fwe,{onPaneClick:ge,onPaneMouseEnter:se,onPaneMouseMove:Te,onPaneMouseLeave:qe,onPaneContextMenu:Fe,onPaneScroll:ve,deleteKeyCode:H,selectionKeyCode:E,selectionOnDrag:_,selectionMode:A,onSelectionStart:w,onSelectionEnd:b,multiSelectionKeyCode:F,panActivationKeyCode:B,zoomActivationKeyCode:P,elementsSelectable:te,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:re,zoomOnPinch:K,zoomOnDoubleClick:Z,panOnScroll:I,panOnScrollSpeed:Q,panOnScrollMode:$,panOnDrag:ne,defaultViewport:W,translateExtent:q,minZoom:J,maxZoom:ee,onSelectionContextMenu:y,preventScrolling:Y,noDragClassName:mn,noWheelClassName:Hn,noPanClassName:$t,disableKeyboardA11y:le},fe.createElement(Lwe,null,fe.createElement(zwe,{edgeTypes:Vt,onEdgeClick:o,onEdgeDoubleClick:h,onlyRenderVisibleElements:U,onEdgeContextMenu:Qe,onEdgeMouseEnter:Ke,onEdgeMouseMove:Tt,onEdgeMouseLeave:st,onReconnect:He,onReconnectStart:St,onReconnectEnd:bt,reconnectRadius:nr,defaultMarkerColor:R,noPanClassName:$t,elevateEdgesOnSelect:!!ht,disableKeyboardA11y:le,rfId:nt},fe.createElement(Fwe,{style:N,type:k,component:C,containerStyle:T})),fe.createElement("div",{className:"react-flow__edgelabel-renderer"}),fe.createElement(vwe,{nodeTypes:Ot,onNodeClick:a,onNodeDoubleClick:u,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,selectNodesOnDrag:z,onlyRenderVisibleElements:U,noPanClassName:$t,noDragClassName:mn,disableKeyboardA11y:le,nodeOrigin:Oe,nodeExtent:Le,rfId:nt})))};mQ.displayName="GraphView";var $we=O.memo(mQ);const AS=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ro={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:AS,nodeExtent:AS,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:gu.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:g4e,isValidConnection:void 0},Qwe=()=>rye((t,e)=>({...Ro,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:i}=e();t({nodeInternals:Q4(n,r,s,i)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=e();t({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",i=typeof r<"u",a=s?Q4(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:i?r:[],hasDefaultNodes:s,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:i,fitViewOnInitDone:a,fitViewOnInitOptions:o,domNode:u,nodeOrigin:h}=e(),f=u?.querySelector(".react-flow__viewport");if(!f)return;const m=window.getComputedStyle(f),{m22:g}=new window.DOMMatrixReadOnly(m.transform),x=n.reduce((w,b)=>{const k=s.get(b.id);if(k?.hidden)s.set(k.id,{...k,[hr]:{...k[hr],handleBounds:void 0}});else if(k){const N=aO(b.nodeElement);!!(N.width&&N.height&&(k.width!==N.width||k.height!==N.height||b.forceUpdate))&&(s.set(k.id,{...k,[hr]:{...k[hr],handleBounds:{source:D_(".source",b.nodeElement,g,h),target:D_(".target",b.nodeElement,g,h)}},...N}),w.push({id:k.id,type:"dimensions",dimensions:N}))}return w},[]);eQ(s,h);const y=a||i&&!a&&tQ(e,{initial:!0,...o});t({nodeInternals:new Map(s),fitViewOnInitDone:y}),x?.length>0&&r?.(x)},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:i}=e(),a=n.map(o=>{const u={id:o.id,type:"position",dragging:s};return r&&(u.positionAbsolute=o.positionAbsolute,u.position=o.position),u});i(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:a,getNodes:o,elevateNodesOnSelect:u}=e();if(n?.length){if(i){const h=rQ(n,o()),f=Q4(h,s,a,u);t({nodeInternals:f})}r?.(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,o=null;r?a=n.map(u=>Bo(u,!0)):(a=Ad(i(),n),o=Ad(s,[])),cx({changedNodes:a,changedEdges:o,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,o=null;r?a=n.map(u=>Bo(u,!0)):(a=Ad(s,n),o=Ad(i(),[])),cx({changedNodes:o,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:i}=e(),a=n||i(),o=r||s,u=a.map(f=>(f.selected=!1,Bo(f.id,!1))),h=o.map(f=>Bo(f.id,!1));cx({changedNodes:u,changedEdges:h,get:e,set:t})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=e();r?.scaleExtent([n,s]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=e();r?.scaleExtent([s,n]),t({maxZoom:n})},setTranslateExtent:n=>{e().d3Zoom?.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=e(),i=r().filter(o=>o.selected).map(o=>Bo(o.id,!1)),a=n.filter(o=>o.selected).map(o=>Bo(o.id,!1));cx({changedNodes:i,changedEdges:a,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(s=>{s.positionAbsolute=lO(s.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:i,d3Zoom:a,d3Selection:o,translateExtent:u}=e();if(!a||!o||!n.x&&!n.y)return!1;const h=Bl.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),f=[[0,0],[s,i]],m=a?.constrain()(h,f,u);return a.transform(o,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>t({connectionNodeId:Ro.connectionNodeId,connectionHandleId:Ro.connectionHandleId,connectionHandleType:Ro.connectionHandleType,connectionStatus:Ro.connectionStatus,connectionStartHandle:Ro.connectionStartHandle,connectionEndHandle:Ro.connectionEndHandle}),reset:()=>t({...Ro})}),Object.is),pQ=({children:t})=>{const e=O.useRef(null);return e.current||(e.current=Qwe()),fe.createElement(c4e,{value:e.current},t)};pQ.displayName="ReactFlowProvider";const gQ=({children:t})=>O.useContext($v)?fe.createElement(fe.Fragment,null,t):fe.createElement(pQ,null,t);gQ.displayName="ReactFlowWrapper";const Hwe={input:W$,default:_S,output:X$,group:fO},Vwe={default:L1,straight:uO,step:cO,smoothstep:Hv,simplebezier:oO},Uwe=[0,0],Wwe=[15,15],Gwe={x:0,y:0,zoom:1},Xwe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},xQ=O.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i=Hwe,edgeTypes:a=Vwe,onNodeClick:o,onEdgeClick:u,onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:b,onClickConnectEnd:k,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:E,onNodeDoubleClick:_,onNodeDragStart:A,onNodeDrag:F,onNodeDragStop:B,onNodesDelete:P,onEdgesDelete:H,onSelectionChange:U,onSelectionDragStart:te,onSelectionDrag:z,onSelectionDragStop:W,onSelectionContextMenu:q,onSelectionStart:J,onSelectionEnd:ee,connectionMode:Y=gu.Strict,connectionLineType:R=qo.Bezier,connectionLineStyle:re,connectionLineComponent:K,connectionLineContainerStyle:I,deleteKeyCode:Q="Backspace",selectionKeyCode:$="Shift",selectionOnDrag:Z=!1,selectionMode:ne=Xm.Full,panActivationKeyCode:ge="Space",multiSelectionKeyCode:se=z1()?"Meta":"Control",zoomActivationKeyCode:Te=z1()?"Meta":"Control",snapToGrid:qe=!1,snapGrid:ve=Wwe,onlyRenderVisibleElements:Fe=!1,selectNodesOnDrag:Qe=!0,nodesDraggable:Ke,nodesConnectable:Tt,nodesFocusable:st,nodeOrigin:He=Uwe,edgesFocusable:St,edgesUpdatable:bt,elementsSelectable:nr,defaultViewport:mn=Gwe,minZoom:Hn=.5,maxZoom:$t=2,translateExtent:ht=AS,preventScrolling:le=!0,nodeExtent:Oe,defaultMarkerColor:Le="#b1b1b7",zoomOnScroll:nt=!0,zoomOnPinch:Ot=!0,panOnScroll:Vt=!1,panOnScrollSpeed:Ln=.5,panOnScrollMode:ue=Gc.Free,zoomOnDoubleClick:Ce=!0,panOnDrag:lt=!0,onPaneClick:ut,onPaneMouseEnter:or,onPaneMouseMove:ft,onPaneMouseLeave:On,onPaneScroll:mt,onPaneContextMenu:Jt,children:fr,onEdgeContextMenu:kt,onEdgeDoubleClick:eo,onEdgeMouseEnter:Xa,onEdgeMouseMove:Mh,onEdgeMouseLeave:to,onEdgeUpdate:Ya,onEdgeUpdateStart:pc,onEdgeUpdateEnd:Zv,onReconnect:U0,onReconnectStart:W0,onReconnectEnd:G0,reconnectRadius:Ah=10,edgeUpdaterRadius:Rh=10,onNodesChange:X0,onEdgesChange:Y0,noDragClassName:ha="nodrag",noWheelClassName:Dr="nowheel",noPanClassName:Yr="nopan",fitView:no=!1,fitViewOptions:Dh,connectOnClick:Kv=!0,attributionPosition:Jv,proOptions:Z0,defaultEdgeOptions:gc,elevateNodesOnSelect:zh=!0,elevateEdgesOnSelect:ro=!1,disableKeyboardA11y:Za=!1,autoPanOnConnect:xc=!0,autoPanOnNodeDrag:so=!0,connectionRadius:Sr=20,isValidConnection:K0,onError:J0,style:Ka,id:Ja,nodeDragThreshold:ey,...ep},tp)=>{const Ph=Ja||"1";return fe.createElement("div",{...ep,style:{...Ka,...Xwe},ref:tp,className:ls(["react-flow",s]),"data-testid":"rf__wrapper",id:Ja},fe.createElement(gQ,null,fe.createElement($we,{onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onNodeClick:o,onEdgeClick:u,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:E,onNodeDoubleClick:_,nodeTypes:i,edgeTypes:a,connectionLineType:R,connectionLineStyle:re,connectionLineComponent:K,connectionLineContainerStyle:I,selectionKeyCode:$,selectionOnDrag:Z,selectionMode:ne,deleteKeyCode:Q,multiSelectionKeyCode:se,panActivationKeyCode:ge,zoomActivationKeyCode:Te,onlyRenderVisibleElements:Fe,selectNodesOnDrag:Qe,defaultViewport:mn,translateExtent:ht,minZoom:Hn,maxZoom:$t,preventScrolling:le,zoomOnScroll:nt,zoomOnPinch:Ot,zoomOnDoubleClick:Ce,panOnScroll:Vt,panOnScrollSpeed:Ln,panOnScrollMode:ue,panOnDrag:lt,onPaneClick:ut,onPaneMouseEnter:or,onPaneMouseMove:ft,onPaneMouseLeave:On,onPaneScroll:mt,onPaneContextMenu:Jt,onSelectionContextMenu:q,onSelectionStart:J,onSelectionEnd:ee,onEdgeContextMenu:kt,onEdgeDoubleClick:eo,onEdgeMouseEnter:Xa,onEdgeMouseMove:Mh,onEdgeMouseLeave:to,onReconnect:U0??Ya,onReconnectStart:W0??pc,onReconnectEnd:G0??Zv,reconnectRadius:Ah??Rh,defaultMarkerColor:Le,noDragClassName:ha,noWheelClassName:Dr,noPanClassName:Yr,elevateEdgesOnSelect:ro,rfId:Ph,disableKeyboardA11y:Za,nodeOrigin:He,nodeExtent:Oe}),fe.createElement(I4e,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:b,onClickConnectEnd:k,nodesDraggable:Ke,nodesConnectable:Tt,nodesFocusable:st,edgesFocusable:St,edgesUpdatable:bt,elementsSelectable:nr,elevateNodesOnSelect:zh,minZoom:Hn,maxZoom:$t,nodeExtent:Oe,onNodesChange:X0,onEdgesChange:Y0,snapToGrid:qe,snapGrid:ve,connectionMode:Y,translateExtent:ht,connectOnClick:Kv,defaultEdgeOptions:gc,fitView:no,fitViewOptions:Dh,onNodesDelete:P,onEdgesDelete:H,onNodeDragStart:A,onNodeDrag:F,onNodeDragStop:B,onSelectionDrag:z,onSelectionDragStart:te,onSelectionDragStop:W,noPanClassName:Yr,nodeOrigin:He,rfId:Ph,autoPanOnConnect:xc,autoPanOnNodeDrag:so,onError:J0,connectionRadius:Sr,isValidConnection:K0,nodeDragThreshold:ey}),fe.createElement(L4e,{onSelectionChange:U}),fr,fe.createElement(d4e,{proOptions:Z0,position:Jv}),fe.createElement(H4e,{rfId:Ph,disableKeyboardA11y:Za})))});xQ.displayName="ReactFlow";function vQ(t){return e=>{const[n,r]=O.useState(e),s=O.useCallback(i=>r(a=>t(i,a)),[]);return[n,r,s]}}const Ywe=vQ(rQ),Zwe=vQ(swe),yQ=({id:t,x:e,y:n,width:r,height:s,style:i,color:a,strokeColor:o,strokeWidth:u,className:h,borderRadius:f,shapeRendering:m,onClick:g,selected:x})=>{const{background:y,backgroundColor:w}=i||{},b=a||y||w;return fe.createElement("rect",{className:ls(["react-flow__minimap-node",{selected:x},h]),x:e,y:n,rx:f,ry:f,width:r,height:s,fill:b,stroke:o,strokeWidth:u,shapeRendering:m,onClick:g?k=>g(k,t):void 0})};yQ.displayName="MiniMapNode";var Kwe=O.memo(yQ);const Jwe=t=>t.nodeOrigin,e5e=t=>t.getNodes().filter(e=>!e.hidden&&e.width&&e.height),W4=t=>t instanceof Function?t:()=>t;function t5e({nodeStrokeColor:t="transparent",nodeColor:e="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:i=Kwe,onClick:a}){const o=Wn(e5e,Wr),u=Wn(Jwe),h=W4(e),f=W4(t),m=W4(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return fe.createElement(fe.Fragment,null,o.map(x=>{const{x:y,y:w}=ru(x,u).positionAbsolute;return fe.createElement(i,{key:x.id,x:y,y:w,width:x.width,height:x.height,style:x.style,selected:x.selected,className:m(x),color:h(x),borderRadius:r,strokeColor:f(x),strokeWidth:s,shapeRendering:g,onClick:a,id:x.id})}))}var n5e=O.memo(t5e);const r5e=200,s5e=150,i5e=t=>{const e=t.getNodes(),n={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:n,boundingRect:e.length>0?m4e(Vv(e,t.nodeOrigin),n):n,rfId:t.rfId}},a5e="react-flow__minimap-desc";function bQ({style:t,className:e,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a=2,nodeComponent:o,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:h="none",maskStrokeWidth:f=1,position:m="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:w=!1,ariaLabel:b="React Flow mini map",inversePan:k=!1,zoomStep:N=10,offsetScale:C=5}){const T=Qr(),E=O.useRef(null),{boundingRect:_,viewBB:A,rfId:F}=Wn(i5e,Wr),B=t?.width??r5e,P=t?.height??s5e,H=_.width/B,U=_.height/P,te=Math.max(H,U),z=te*B,W=te*P,q=C*te,J=_.x-(z-_.width)/2-q,ee=_.y-(W-_.height)/2-q,Y=z+q*2,R=W+q*2,re=`${a5e}-${F}`,K=O.useRef(0);K.current=te,O.useEffect(()=>{if(E.current){const $=Mi(E.current),Z=se=>{const{transform:Te,d3Selection:qe,d3Zoom:ve}=T.getState();if(se.sourceEvent.type!=="wheel"||!qe||!ve)return;const Fe=-se.sourceEvent.deltaY*(se.sourceEvent.deltaMode===1?.05:se.sourceEvent.deltaMode?1:.002)*N,Qe=Te[2]*Math.pow(2,Fe);ve.scaleTo(qe,Qe)},ne=se=>{const{transform:Te,d3Selection:qe,d3Zoom:ve,translateExtent:Fe,width:Qe,height:Ke}=T.getState();if(se.sourceEvent.type!=="mousemove"||!qe||!ve)return;const Tt=K.current*Math.max(1,Te[2])*(k?-1:1),st={x:Te[0]-se.sourceEvent.movementX*Tt,y:Te[1]-se.sourceEvent.movementY*Tt},He=[[0,0],[Qe,Ke]],St=Bl.translate(st.x,st.y).scale(Te[2]),bt=ve.constrain()(St,He,Fe);ve.transform(qe,bt)},ge=j$().on("zoom",y?ne:null).on("zoom.wheel",w?Z:null);return $.call(ge),()=>{$.on("zoom",null)}}},[y,w,k,N]);const I=g?$=>{const Z=Ji($);g($,{x:Z[0],y:Z[1]})}:void 0,Q=x?($,Z)=>{const ne=T.getState().nodeInternals.get(Z);x($,ne)}:void 0;return fe.createElement(Qv,{position:m,style:t,className:ls(["react-flow__minimap",e]),"data-testid":"rf__minimap"},fe.createElement("svg",{width:B,height:P,viewBox:`${J} ${ee} ${Y} ${R}`,role:"img","aria-labelledby":re,ref:E,onClick:I},b&&fe.createElement("title",{id:re},b),fe.createElement(n5e,{onClick:Q,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:o}),fe.createElement("path",{className:"react-flow__minimap-mask",d:`M${J-q},${ee-q}h${Y+q*2}v${R+q*2}h${-Y-q*2}z M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:u,fillRule:"evenodd",stroke:h,strokeWidth:f,pointerEvents:"none"})))}bQ.displayName="MiniMap";var l5e=O.memo(bQ);function o5e(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},fe.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function c5e(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},fe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function u5e(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},fe.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function d5e(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function h5e(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Kf=({children:t,className:e,...n})=>fe.createElement("button",{type:"button",className:ls(["react-flow__controls-button",e]),...n},t);Kf.displayName="ControlButton";const f5e=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),wQ=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:o,onInteractiveChange:u,className:h,children:f,position:m="bottom-left"})=>{const g=Qr(),[x,y]=O.useState(!1),{isInteractive:w,minZoomReached:b,maxZoomReached:k}=Wn(f5e,Wr),{zoomIn:N,zoomOut:C,fitView:T}=mO();if(O.useEffect(()=>{y(!0)},[]),!x)return null;const E=()=>{N(),i?.()},_=()=>{C(),a?.()},A=()=>{T(s),o?.()},F=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),u?.(!w)};return fe.createElement(Qv,{className:ls(["react-flow__controls",h]),position:m,style:t,"data-testid":"rf__controls"},e&&fe.createElement(fe.Fragment,null,fe.createElement(Kf,{onClick:E,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},fe.createElement(o5e,null)),fe.createElement(Kf,{onClick:_,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:b},fe.createElement(c5e,null))),n&&fe.createElement(Kf,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},fe.createElement(u5e,null)),r&&fe.createElement(Kf,{className:"react-flow__controls-interactive",onClick:F,title:"toggle interactivity","aria-label":"toggle interactivity"},w?fe.createElement(h5e,null):fe.createElement(d5e,null)),f)};wQ.displayName="Controls";var m5e=O.memo(wQ),Ii;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Ii||(Ii={}));function p5e({color:t,dimensions:e,lineWidth:n}){return fe.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function g5e({color:t,radius:e}){return fe.createElement("circle",{cx:e,cy:e,r:e,fill:t})}const x5e={[Ii.Dots]:"#91919a",[Ii.Lines]:"#eee",[Ii.Cross]:"#e2e2e2"},v5e={[Ii.Dots]:1,[Ii.Lines]:1,[Ii.Cross]:6},y5e=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function SQ({id:t,variant:e=Ii.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=2,color:a,style:o,className:u}){const h=O.useRef(null),{transform:f,patternId:m}=Wn(y5e,Wr),g=a||x5e[e],x=r||v5e[e],y=e===Ii.Dots,w=e===Ii.Cross,b=Array.isArray(n)?n:[n,n],k=[b[0]*f[2]||1,b[1]*f[2]||1],N=x*f[2],C=w?[N,N]:k,T=y?[N/i,N/i]:[C[0]/i,C[1]/i];return fe.createElement("svg",{className:ls(["react-flow__background",u]),style:{...o,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:h,"data-testid":"rf__background"},fe.createElement("pattern",{id:m+t,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},y?fe.createElement(g5e,{color:g,radius:N/i}):fe.createElement(p5e,{dimensions:C,color:g,lineWidth:s})),fe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+t})`}))}SQ.displayName="Background";var b5e=O.memo(SQ);function gO(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var G4,$_;function w5e(){if($_)return G4;$_=1;var t=XA(),e=4;function n(r){return t(r,e)}return G4=n,G4}var X4,Q_;function kQ(){if(Q_)return X4;Q_=1;var t=_G();function e(n){return typeof n=="function"?n:t}return X4=e,X4}var Y4,H_;function OQ(){if(H_)return Y4;H_=1;var t=YA(),e=FS(),n=kQ(),r=xu();function s(i,a){var o=r(i)?t:e;return o(i,n(a))}return Y4=s,Y4}var Z4,V_;function jQ(){return V_||(V_=1,Z4=OQ()),Z4}var K4,U_;function S5e(){if(U_)return K4;U_=1;var t=FS();function e(n,r){var s=[];return t(n,function(i,a,o){r(i,a,o)&&s.push(i)}),s}return K4=e,K4}var J4,W_;function NQ(){if(W_)return J4;W_=1;var t=MG(),e=S5e(),n=$S(),r=xu();function s(i,a){var o=r(i)?t:e;return o(i,n(a,3))}return J4=s,J4}var ew,G_;function k5e(){if(G_)return ew;G_=1;var t=Object.prototype,e=t.hasOwnProperty;function n(r,s){return r!=null&&e.call(r,s)}return ew=n,ew}var tw,X_;function CQ(){if(X_)return tw;X_=1;var t=k5e(),e=AG();function n(r,s){return r!=null&&e(r,s,t)}return tw=n,tw}var nw,Y_;function O5e(){if(Y_)return nw;Y_=1;var t=ZA(),e=KA(),n=JA(),r=xu(),s=QS(),i=HS(),a=RG(),o=VS(),u="[object Map]",h="[object Set]",f=Object.prototype,m=f.hasOwnProperty;function g(x){if(x==null)return!0;if(s(x)&&(r(x)||typeof x=="string"||typeof x.splice=="function"||i(x)||o(x)||n(x)))return!x.length;var y=e(x);if(y==u||y==h)return!x.size;if(a(x))return!t(x).length;for(var w in x)if(m.call(x,w))return!1;return!0}return nw=g,nw}var rw,Z_;function TQ(){if(Z_)return rw;Z_=1;function t(e){return e===void 0}return rw=t,rw}var sw,K_;function j5e(){if(K_)return sw;K_=1;function t(e,n,r,s){var i=-1,a=e==null?0:e.length;for(s&&a&&(r=e[++i]);++i1?x.setNode(y,m):x.setNode(y)}),this},s.prototype.setNode=function(f,m){return t.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=m),this):(this._nodes[f]=arguments.length>1?m:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},s.prototype.node=function(f){return this._nodes[f]},s.prototype.hasNode=function(f){return t.has(this._nodes,f)},s.prototype.removeNode=function(f){var m=this;if(t.has(this._nodes,f)){var g=function(x){m.removeEdge(m._edgeObjs[x])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],t.each(this.children(f),function(x){m.setParent(x)}),delete this._children[f]),t.each(t.keys(this._in[f]),g),delete this._in[f],delete this._preds[f],t.each(t.keys(this._out[f]),g),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},s.prototype.setParent=function(f,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(m))m=n;else{m+="";for(var g=m;!t.isUndefined(g);g=this.parent(g))if(g===f)throw new Error("Setting "+m+" as parent of "+f+" would create a cycle");this.setNode(m)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=m,this._children[m][f]=!0,this},s.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},s.prototype.parent=function(f){if(this._isCompound){var m=this._parent[f];if(m!==n)return m}},s.prototype.children=function(f){if(t.isUndefined(f)&&(f=n),this._isCompound){var m=this._children[f];if(m)return t.keys(m)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},s.prototype.predecessors=function(f){var m=this._preds[f];if(m)return t.keys(m)},s.prototype.successors=function(f){var m=this._sucs[f];if(m)return t.keys(m)},s.prototype.neighbors=function(f){var m=this.predecessors(f);if(m)return t.union(m,this.successors(f))},s.prototype.isLeaf=function(f){var m;return this.isDirected()?m=this.successors(f):m=this.neighbors(f),m.length===0},s.prototype.filterNodes=function(f){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var g=this;t.each(this._nodes,function(w,b){f(b)&&m.setNode(b,w)}),t.each(this._edgeObjs,function(w){m.hasNode(w.v)&&m.hasNode(w.w)&&m.setEdge(w,g.edge(w))});var x={};function y(w){var b=g.parent(w);return b===void 0||m.hasNode(b)?(x[w]=b,b):b in x?x[b]:y(b)}return this._isCompound&&t.each(m.nodes(),function(w){m.setParent(w,y(w))}),m},s.prototype.setDefaultEdgeLabel=function(f){return t.isFunction(f)||(f=t.constant(f)),this._defaultEdgeLabelFn=f,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return t.values(this._edgeObjs)},s.prototype.setPath=function(f,m){var g=this,x=arguments;return t.reduce(f,function(y,w){return x.length>1?g.setEdge(y,w,m):g.setEdge(y,w),w}),this},s.prototype.setEdge=function(){var f,m,g,x,y=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(f=w.v,m=w.w,g=w.name,arguments.length===2&&(x=arguments[1],y=!0)):(f=w,m=arguments[1],g=arguments[3],arguments.length>2&&(x=arguments[2],y=!0)),f=""+f,m=""+m,t.isUndefined(g)||(g=""+g);var b=o(this._isDirected,f,m,g);if(t.has(this._edgeLabels,b))return y&&(this._edgeLabels[b]=x),this;if(!t.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(m),this._edgeLabels[b]=y?x:this._defaultEdgeLabelFn(f,m,g);var k=u(this._isDirected,f,m,g);return f=k.v,m=k.w,Object.freeze(k),this._edgeObjs[b]=k,i(this._preds[m],f),i(this._sucs[f],m),this._in[m][b]=k,this._out[f][b]=k,this._edgeCount++,this},s.prototype.edge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g);return this._edgeLabels[x]},s.prototype.hasEdge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g);return t.has(this._edgeLabels,x)},s.prototype.removeEdge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g),y=this._edgeObjs[x];return y&&(f=y.v,m=y.w,delete this._edgeLabels[x],delete this._edgeObjs[x],a(this._preds[m],f),a(this._sucs[f],m),delete this._in[m][x],delete this._out[f][x],this._edgeCount--),this},s.prototype.inEdges=function(f,m){var g=this._in[f];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.v===m}):x}},s.prototype.outEdges=function(f,m){var g=this._out[f];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.w===m}):x}},s.prototype.nodeEdges=function(f,m){var g=this.inEdges(f,m);if(g)return g.concat(this.outEdges(f,m))};function i(f,m){f[m]?f[m]++:f[m]=1}function a(f,m){--f[m]||delete f[m]}function o(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var b=y;y=w,w=b}return y+r+w+r+(t.isUndefined(x)?e:x)}function u(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var b=y;y=w,w=b}var k={v:y,w};return x&&(k.name=x),k}function h(f,m){return o(f,m.v,m.w,m.name)}return xw}var vw,hM;function D5e(){return hM||(hM=1,vw="2.1.8"),vw}var yw,fM;function z5e(){return fM||(fM=1,yw={Graph:xO(),version:D5e()}),yw}var bw,mM;function P5e(){if(mM)return bw;mM=1;var t=Ui(),e=xO();bw={write:n,read:i};function n(a){var o={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:r(a),edges:s(a)};return t.isUndefined(a.graph())||(o.value=t.clone(a.graph())),o}function r(a){return t.map(a.nodes(),function(o){var u=a.node(o),h=a.parent(o),f={v:o};return t.isUndefined(u)||(f.value=u),t.isUndefined(h)||(f.parent=h),f})}function s(a){return t.map(a.edges(),function(o){var u=a.edge(o),h={v:o.v,w:o.w};return t.isUndefined(o.name)||(h.name=o.name),t.isUndefined(u)||(h.value=u),h})}function i(a){var o=new e(a.options).setGraph(a.value);return t.each(a.nodes,function(u){o.setNode(u.v,u.value),u.parent&&o.setParent(u.v,u.parent)}),t.each(a.edges,function(u){o.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),o}return bw}var ww,pM;function L5e(){if(pM)return ww;pM=1;var t=Ui();ww=e;function e(n){var r={},s=[],i;function a(o){t.has(r,o)||(r[o]=!0,i.push(o),t.each(n.successors(o),a),t.each(n.predecessors(o),a))}return t.each(n.nodes(),function(o){i=[],a(o),i.length&&s.push(i)}),s}return ww}var Sw,gM;function AQ(){if(gM)return Sw;gM=1;var t=Ui();Sw=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(n){return n.key})},e.prototype.has=function(n){return t.has(this._keyIndices,n)},e.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(n,r){var s=this._keyIndices;if(n=String(n),!t.has(s,n)){var i=this._arr,a=i.length;return s[n]=a,i.push({key:n,priority:r}),this._decrease(a),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},e.prototype.decrease=function(n,r){var s=this._keyIndices[n];if(r>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[s].priority+" New: "+r);this._arr[s].priority=r,this._decrease(s)},e.prototype._heapify=function(n){var r=this._arr,s=2*n,i=s+1,a=n;s>1,!(r[i].priority0&&(m=f.removeMin(),g=h[m],g.distance!==Number.POSITIVE_INFINITY);)u(m).forEach(x);return h}return kw}var Ow,vM;function B5e(){if(vM)return Ow;vM=1;var t=RQ(),e=Ui();Ow=n;function n(r,s,i){return e.transform(r.nodes(),function(a,o){a[o]=t(r,o,s,i)},{})}return Ow}var jw,yM;function DQ(){if(yM)return jw;yM=1;var t=Ui();jw=e;function e(n){var r=0,s=[],i={},a=[];function o(u){var h=i[u]={onStack:!0,lowlink:r,index:r++};if(s.push(u),n.successors(u).forEach(function(g){t.has(i,g)?i[g].onStack&&(h.lowlink=Math.min(h.lowlink,i[g].index)):(o(g),h.lowlink=Math.min(h.lowlink,i[g].lowlink))}),h.lowlink===h.index){var f=[],m;do m=s.pop(),i[m].onStack=!1,f.push(m);while(u!==m);a.push(f)}}return n.nodes().forEach(function(u){t.has(i,u)||o(u)}),a}return jw}var Nw,bM;function I5e(){if(bM)return Nw;bM=1;var t=Ui(),e=DQ();Nw=n;function n(r){return t.filter(e(r),function(s){return s.length>1||s.length===1&&r.hasEdge(s[0],s[0])})}return Nw}var Cw,wM;function q5e(){if(wM)return Cw;wM=1;var t=Ui();Cw=n;var e=t.constant(1);function n(s,i,a){return r(s,i||e,a||function(o){return s.outEdges(o)})}function r(s,i,a){var o={},u=s.nodes();return u.forEach(function(h){o[h]={},o[h][h]={distance:0},u.forEach(function(f){h!==f&&(o[h][f]={distance:Number.POSITIVE_INFINITY})}),a(h).forEach(function(f){var m=f.v===h?f.w:f.v,g=i(f);o[h][m]={distance:g,predecessor:h}})}),u.forEach(function(h){var f=o[h];u.forEach(function(m){var g=o[m];u.forEach(function(x){var y=g[h],w=f[x],b=g[x],k=y.distance+w.distance;k0;){if(h=u.removeMin(),t.has(o,h))a.setEdge(h,o[h]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(h).forEach(f)}return a}return Rw}var Dw,TM;function V5e(){return TM||(TM=1,Dw={components:L5e(),dijkstra:RQ(),dijkstraAll:B5e(),findCycles:I5e(),floydWarshall:q5e(),isAcyclic:F5e(),postorder:$5e(),preorder:Q5e(),prim:H5e(),tarjan:DQ(),topsort:zQ()}),Dw}var zw,EM;function U5e(){if(EM)return zw;EM=1;var t=z5e();return zw={Graph:t.Graph,json:P5e(),alg:V5e(),version:t.version},zw}var Pw,_M;function ia(){if(_M)return Pw;_M=1;var t;if(typeof gO=="function")try{t=U5e()}catch{}return t||(t=window.graphlib),Pw=t,Pw}var Lw,MM;function W5e(){if(MM)return Lw;MM=1;var t=XA(),e=1,n=4;function r(s){return t(s,e|n)}return Lw=r,Lw}var Bw,AM;function G5e(){if(AM)return Bw;AM=1;var t=WS(),e=sR(),n=rR(),r=$1(),s=Object.prototype,i=s.hasOwnProperty,a=t(function(o,u){o=Object(o);var h=-1,f=u.length,m=f>2?u[2]:void 0;for(m&&n(u[0],u[1],m)&&(f=1);++h1?i[o-1]:void 0,h=o>2?i[2]:void 0;for(u=r.length>3&&typeof u=="function"?(o--,u):void 0,h&&e(i[0],i[1],h)&&(u=o<3?void 0:u,o=1),s=Object(s);++a0;--b)if(w=f[b].dequeue(),w){g=g.concat(a(h,f,m,w,!0));break}}}return g}function a(h,f,m,g,x){var y=x?[]:void 0;return t.forEach(h.inEdges(g.v),function(w){var b=h.edge(w),k=h.node(w.v);x&&y.push({v:w.v,w:w.w}),k.out-=b,u(f,m,k)}),t.forEach(h.outEdges(g.v),function(w){var b=h.edge(w),k=w.w,N=h.node(k);N.in-=b,u(f,m,N)}),h.removeNode(g.v),y}function o(h,f){var m=new e,g=0,x=0;t.forEach(h.nodes(),function(b){m.setNode(b,{v:b,in:0,out:0})}),t.forEach(h.edges(),function(b){var k=m.edge(b.v,b.w)||0,N=f(b),C=k+N;m.setEdge(b.v,b.w,C),x=Math.max(x,m.node(b.v).out+=N),g=Math.max(g,m.node(b.w).in+=N)});var y=t.range(x+g+3).map(function(){return new n}),w=g+1;return t.forEach(m.nodes(),function(b){u(y,w,m.node(b))}),{graph:m,buckets:y,zeroIdx:w}}function u(h,f,m){m.out?m.in?h[m.out-m.in+f].enqueue(m):h[h.length-1].enqueue(m):h[0].enqueue(m)}return n5}var r5,ZM;function u3e(){if(ZM)return r5;ZM=1;var t=tr(),e=c3e();r5={run:n,undo:s};function n(i){var a=i.graph().acyclicer==="greedy"?e(i,o(i)):r(i);t.forEach(a,function(u){var h=i.edge(u);i.removeEdge(u),h.forwardName=u.name,h.reversed=!0,i.setEdge(u.w,u.v,h,t.uniqueId("rev"))});function o(u){return function(h){return u.edge(h).weight}}}function r(i){var a=[],o={},u={};function h(f){t.has(u,f)||(u[f]=!0,o[f]=!0,t.forEach(i.outEdges(f),function(m){t.has(o,m.w)?a.push(m):h(m.w)}),delete o[f])}return t.forEach(i.nodes(),h),a}function s(i){t.forEach(i.edges(),function(a){var o=i.edge(a);if(o.reversed){i.removeEdge(a);var u=o.forwardName;delete o.reversed,delete o.forwardName,i.setEdge(a.w,a.v,o,u)}})}return r5}var s5,KM;function Us(){if(KM)return s5;KM=1;var t=tr(),e=ia().Graph;s5={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:i,predecessorWeights:a,intersectRect:o,buildLayerMatrix:u,normalizeRanks:h,removeEmptyRanks:f,addBorderNode:m,maxRank:g,partition:x,time:y,notime:w};function n(b,k,N,C){var T;do T=t.uniqueId(C);while(b.hasNode(T));return N.dummy=k,b.setNode(T,N),T}function r(b){var k=new e().setGraph(b.graph());return t.forEach(b.nodes(),function(N){k.setNode(N,b.node(N))}),t.forEach(b.edges(),function(N){var C=k.edge(N.v,N.w)||{weight:0,minlen:1},T=b.edge(N);k.setEdge(N.v,N.w,{weight:C.weight+T.weight,minlen:Math.max(C.minlen,T.minlen)})}),k}function s(b){var k=new e({multigraph:b.isMultigraph()}).setGraph(b.graph());return t.forEach(b.nodes(),function(N){b.children(N).length||k.setNode(N,b.node(N))}),t.forEach(b.edges(),function(N){k.setEdge(N,b.edge(N))}),k}function i(b){var k=t.map(b.nodes(),function(N){var C={};return t.forEach(b.outEdges(N),function(T){C[T.w]=(C[T.w]||0)+b.edge(T).weight}),C});return t.zipObject(b.nodes(),k)}function a(b){var k=t.map(b.nodes(),function(N){var C={};return t.forEach(b.inEdges(N),function(T){C[T.v]=(C[T.v]||0)+b.edge(T).weight}),C});return t.zipObject(b.nodes(),k)}function o(b,k){var N=b.x,C=b.y,T=k.x-N,E=k.y-C,_=b.width/2,A=b.height/2;if(!T&&!E)throw new Error("Not possible to find intersection inside of the rectangle");var F,B;return Math.abs(E)*_>Math.abs(T)*A?(E<0&&(A=-A),F=A*T/E,B=A):(T<0&&(_=-_),F=_,B=_*E/T),{x:N+F,y:C+B}}function u(b){var k=t.map(t.range(g(b)+1),function(){return[]});return t.forEach(b.nodes(),function(N){var C=b.node(N),T=C.rank;t.isUndefined(T)||(k[T][C.order]=N)}),k}function h(b){var k=t.min(t.map(b.nodes(),function(N){return b.node(N).rank}));t.forEach(b.nodes(),function(N){var C=b.node(N);t.has(C,"rank")&&(C.rank-=k)})}function f(b){var k=t.min(t.map(b.nodes(),function(E){return b.node(E).rank})),N=[];t.forEach(b.nodes(),function(E){var _=b.node(E).rank-k;N[_]||(N[_]=[]),N[_].push(E)});var C=0,T=b.graph().nodeRankFactor;t.forEach(N,function(E,_){t.isUndefined(E)&&_%T!==0?--C:C&&t.forEach(E,function(A){b.node(A).rank+=C})})}function m(b,k,N,C){var T={width:0,height:0};return arguments.length>=4&&(T.rank=N,T.order=C),n(b,"border",T,k)}function g(b){return t.max(t.map(b.nodes(),function(k){var N=b.node(k).rank;if(!t.isUndefined(N))return N}))}function x(b,k){var N={lhs:[],rhs:[]};return t.forEach(b,function(C){k(C)?N.lhs.push(C):N.rhs.push(C)}),N}function y(b,k){var N=t.now();try{return k()}finally{console.log(b+" time: "+(t.now()-N)+"ms")}}function w(b,k){return k()}return s5}var i5,JM;function d3e(){if(JM)return i5;JM=1;var t=tr(),e=Us();i5={run:n,undo:s};function n(i){i.graph().dummyChains=[],t.forEach(i.edges(),function(a){r(i,a)})}function r(i,a){var o=a.v,u=i.node(o).rank,h=a.w,f=i.node(h).rank,m=a.name,g=i.edge(a),x=g.labelRank;if(f!==u+1){i.removeEdge(a);var y,w,b;for(b=0,++u;uB.lim&&(P=B,H=!0);var U=t.filter(T.edges(),function(te){return H===N(C,C.node(te.v),P)&&H!==N(C,C.node(te.w),P)});return t.minBy(U,function(te){return n(T,te)})}function w(C,T,E,_){var A=E.v,F=E.w;C.removeEdge(A,F),C.setEdge(_.v,_.w,{}),m(C),u(C,T),b(C,T)}function b(C,T){var E=t.find(C.nodes(),function(A){return!T.node(A).parent}),_=s(C,E);_=_.slice(1),t.forEach(_,function(A){var F=C.node(A).parent,B=T.edge(A,F),P=!1;B||(B=T.edge(F,A),P=!0),T.node(A).rank=T.node(F).rank+(P?B.minlen:-B.minlen)})}function k(C,T,E){return C.hasEdge(T,E)}function N(C,T,E){return E.low<=T.lim&&T.lim<=E.lim}return o5}var c5,rA;function f3e(){if(rA)return c5;rA=1;var t=B1(),e=t.longestPath,n=IQ(),r=h3e();c5=s;function s(u){switch(u.graph().ranker){case"network-simplex":o(u);break;case"tight-tree":a(u);break;case"longest-path":i(u);break;default:o(u)}}var i=e;function a(u){e(u),n(u)}function o(u){r(u)}return c5}var u5,sA;function m3e(){if(sA)return u5;sA=1;var t=tr();u5=e;function e(s){var i=r(s);t.forEach(s.graph().dummyChains,function(a){for(var o=s.node(a),u=o.edgeObj,h=n(s,i,u.v,u.w),f=h.path,m=h.lca,g=0,x=f[g],y=!0;a!==u.w;){if(o=s.node(a),y){for(;(x=f[g])!==m&&s.node(x).maxRankf||m>i[g].lim));for(x=g,g=o;(g=s.parent(g))!==x;)h.push(g);return{path:u.concat(h.reverse()),lca:x}}function r(s){var i={},a=0;function o(u){var h=a;t.forEach(s.children(u),o),i[u]={low:h,lim:a++}}return t.forEach(s.children(),o),i}return u5}var d5,iA;function p3e(){if(iA)return d5;iA=1;var t=tr(),e=Us();d5={run:n,cleanup:a};function n(o){var u=e.addDummyNode(o,"root",{},"_root"),h=s(o),f=t.max(t.values(h))-1,m=2*f+1;o.graph().nestingRoot=u,t.forEach(o.edges(),function(x){o.edge(x).minlen*=m});var g=i(o)+1;t.forEach(o.children(),function(x){r(o,u,m,g,f,h,x)}),o.graph().nodeRankFactor=m}function r(o,u,h,f,m,g,x){var y=o.children(x);if(!y.length){x!==u&&o.setEdge(u,x,{weight:0,minlen:h});return}var w=e.addBorderNode(o,"_bt"),b=e.addBorderNode(o,"_bb"),k=o.node(x);o.setParent(w,x),k.borderTop=w,o.setParent(b,x),k.borderBottom=b,t.forEach(y,function(N){r(o,u,h,f,m,g,N);var C=o.node(N),T=C.borderTop?C.borderTop:N,E=C.borderBottom?C.borderBottom:N,_=C.borderTop?f:2*f,A=T!==E?1:m-g[x]+1;o.setEdge(w,T,{weight:_,minlen:A,nestingEdge:!0}),o.setEdge(E,b,{weight:_,minlen:A,nestingEdge:!0})}),o.parent(x)||o.setEdge(u,w,{weight:0,minlen:m+g[x]})}function s(o){var u={};function h(f,m){var g=o.children(f);g&&g.length&&t.forEach(g,function(x){h(x,m+1)}),u[f]=m}return t.forEach(o.children(),function(f){h(f,1)}),u}function i(o){return t.reduce(o.edges(),function(u,h){return u+o.edge(h).weight},0)}function a(o){var u=o.graph();o.removeNode(u.nestingRoot),delete u.nestingRoot,t.forEach(o.edges(),function(h){var f=o.edge(h);f.nestingEdge&&o.removeEdge(h)})}return d5}var h5,aA;function g3e(){if(aA)return h5;aA=1;var t=tr(),e=Us();h5=n;function n(s){function i(a){var o=s.children(a),u=s.node(a);if(o.length&&t.forEach(o,i),t.has(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(var h=u.minRank,f=u.maxRank+1;h0;)x%2&&(y+=f[x+1]),x=x-1>>1,f[x]+=g.weight;m+=g.weight*y})),m}return p5}var g5,uA;function b3e(){if(uA)return g5;uA=1;var t=tr();g5=e;function e(n,r){return t.map(r,function(s){var i=n.inEdges(s);if(i.length){var a=t.reduce(i,function(o,u){var h=n.edge(u),f=n.node(u.v);return{sum:o.sum+h.weight*f.order,weight:o.weight+h.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:s}})}return g5}var x5,dA;function w3e(){if(dA)return x5;dA=1;var t=tr();x5=e;function e(s,i){var a={};t.forEach(s,function(u,h){var f=a[u.v]={indegree:0,in:[],out:[],vs:[u.v],i:h};t.isUndefined(u.barycenter)||(f.barycenter=u.barycenter,f.weight=u.weight)}),t.forEach(i.edges(),function(u){var h=a[u.v],f=a[u.w];!t.isUndefined(h)&&!t.isUndefined(f)&&(f.indegree++,h.out.push(a[u.w]))});var o=t.filter(a,function(u){return!u.indegree});return n(o)}function n(s){var i=[];function a(h){return function(f){f.merged||(t.isUndefined(f.barycenter)||t.isUndefined(h.barycenter)||f.barycenter>=h.barycenter)&&r(h,f)}}function o(h){return function(f){f.in.push(h),--f.indegree===0&&s.push(f)}}for(;s.length;){var u=s.pop();i.push(u),t.forEach(u.in.reverse(),a(u)),t.forEach(u.out,o(u))}return t.map(t.filter(i,function(h){return!h.merged}),function(h){return t.pick(h,["vs","i","barycenter","weight"])})}function r(s,i){var a=0,o=0;s.weight&&(a+=s.barycenter*s.weight,o+=s.weight),i.weight&&(a+=i.barycenter*i.weight,o+=i.weight),s.vs=i.vs.concat(s.vs),s.barycenter=a/o,s.weight=o,s.i=Math.min(i.i,s.i),i.merged=!0}return x5}var v5,hA;function S3e(){if(hA)return v5;hA=1;var t=tr(),e=Us();v5=n;function n(i,a){var o=e.partition(i,function(w){return t.has(w,"barycenter")}),u=o.lhs,h=t.sortBy(o.rhs,function(w){return-w.i}),f=[],m=0,g=0,x=0;u.sort(s(!!a)),x=r(f,h,x),t.forEach(u,function(w){x+=w.vs.length,f.push(w.vs),m+=w.barycenter*w.weight,g+=w.weight,x=r(f,h,x)});var y={vs:t.flatten(f,!0)};return g&&(y.barycenter=m/g,y.weight=g),y}function r(i,a,o){for(var u;a.length&&(u=t.last(a)).i<=o;)a.pop(),i.push(u.vs),o++;return o}function s(i){return function(a,o){return a.barycentero.barycenter?1:i?o.i-a.i:a.i-o.i}}return v5}var y5,fA;function k3e(){if(fA)return y5;fA=1;var t=tr(),e=b3e(),n=w3e(),r=S3e();y5=s;function s(o,u,h,f){var m=o.children(u),g=o.node(u),x=g?g.borderLeft:void 0,y=g?g.borderRight:void 0,w={};x&&(m=t.filter(m,function(E){return E!==x&&E!==y}));var b=e(o,m);t.forEach(b,function(E){if(o.children(E.v).length){var _=s(o,E.v,h,f);w[E.v]=_,t.has(_,"barycenter")&&a(E,_)}});var k=n(b,h);i(k,w);var N=r(k,f);if(x&&(N.vs=t.flatten([x,N.vs,y],!0),o.predecessors(x).length)){var C=o.node(o.predecessors(x)[0]),T=o.node(o.predecessors(y)[0]);t.has(N,"barycenter")||(N.barycenter=0,N.weight=0),N.barycenter=(N.barycenter*N.weight+C.order+T.order)/(N.weight+2),N.weight+=2}return N}function i(o,u){t.forEach(o,function(h){h.vs=t.flatten(h.vs.map(function(f){return u[f]?u[f].vs:f}),!0)})}function a(o,u){t.isUndefined(o.barycenter)?(o.barycenter=u.barycenter,o.weight=u.weight):(o.barycenter=(o.barycenter*o.weight+u.barycenter*u.weight)/(o.weight+u.weight),o.weight+=u.weight)}return y5}var b5,mA;function O3e(){if(mA)return b5;mA=1;var t=tr(),e=ia().Graph;b5=n;function n(s,i,a){var o=r(s),u=new e({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(h){return s.node(h)});return t.forEach(s.nodes(),function(h){var f=s.node(h),m=s.parent(h);(f.rank===i||f.minRank<=i&&i<=f.maxRank)&&(u.setNode(h),u.setParent(h,m||o),t.forEach(s[a](h),function(g){var x=g.v===h?g.w:g.v,y=u.edge(x,h),w=t.isUndefined(y)?0:y.weight;u.setEdge(x,h,{weight:s.edge(g).weight+w})}),t.has(f,"minRank")&&u.setNode(h,{borderLeft:f.borderLeft[i],borderRight:f.borderRight[i]}))}),u}function r(s){for(var i;s.hasNode(i=t.uniqueId("_root")););return i}return b5}var w5,pA;function j3e(){if(pA)return w5;pA=1;var t=tr();w5=e;function e(n,r,s){var i={},a;t.forEach(s,function(o){for(var u=n.parent(o),h,f;u;){if(h=n.parent(u),h?(f=i[h],i[h]=u):(f=a,a=u),f&&f!==u){r.setEdge(f,u);return}u=h}})}return w5}var S5,gA;function N3e(){if(gA)return S5;gA=1;var t=tr(),e=v3e(),n=y3e(),r=k3e(),s=O3e(),i=j3e(),a=ia().Graph,o=Us();S5=u;function u(g){var x=o.maxRank(g),y=h(g,t.range(1,x+1),"inEdges"),w=h(g,t.range(x-1,-1,-1),"outEdges"),b=e(g);m(g,b);for(var k=Number.POSITIVE_INFINITY,N,C=0,T=0;T<4;++C,++T){f(C%2?y:w,C%4>=2),b=o.buildLayerMatrix(g);var E=n(g,b);EP)&&a(C,te,H)})})}function E(_,A){var F=-1,B,P=0;return t.forEach(A,function(H,U){if(k.node(H).dummy==="border"){var te=k.predecessors(H);te.length&&(B=k.node(te[0]).order,T(A,P,U,F,B),P=U,F=B)}T(A,P,A.length,B,_.length)}),A}return t.reduce(N,E),C}function i(k,N){if(k.node(N).dummy)return t.find(k.predecessors(N),function(C){return k.node(C).dummy})}function a(k,N,C){if(N>C){var T=N;N=C,C=T}var E=k[N];E||(k[N]=E={}),E[C]=!0}function o(k,N,C){if(N>C){var T=N;N=C,C=T}return t.has(k[N],C)}function u(k,N,C,T){var E={},_={},A={};return t.forEach(N,function(F){t.forEach(F,function(B,P){E[B]=B,_[B]=B,A[B]=P})}),t.forEach(N,function(F){var B=-1;t.forEach(F,function(P){var H=T(P);if(H.length){H=t.sortBy(H,function(q){return A[q]});for(var U=(H.length-1)/2,te=Math.floor(U),z=Math.ceil(U);te<=z;++te){var W=H[te];_[P]===P&&Bl.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[l.jsx(sc,{type:"target",position:at.Top}),l.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:t.content,children:t.label}),l.jsx(sc,{type:"source",position:at.Bottom})]}));qQ.displayName="EntityNode";const FQ=O.memo(({data:t})=>l.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[l.jsx(sc,{type:"target",position:at.Top}),l.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:t.content,children:t.label}),l.jsx(sc,{type:"source",position:at.Bottom})]}));FQ.displayName="ParagraphNode";const L3e={entity:qQ,paragraph:FQ};function B3e(t,e){const n=new kA.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const r=[],s=[];return t.forEach(i=>{n.setNode(i.id,{width:150,height:50})}),e.forEach(i=>{n.setEdge(i.source,i.target)}),kA.layout(n),t.forEach(i=>{const a=n.node(i.id);r.push({id:i.id,type:i.type,position:{x:a.x-75,y:a.y-25},data:{label:i.content.slice(0,20)+(i.content.length>20?"...":""),content:i.content}})}),e.forEach((i,a)=>{const o={id:`edge-${a}`,source:i.source,target:i.target,animated:t.length<=200&&i.weight>5,style:{strokeWidth:Math.min(i.weight/2,5),opacity:.6}};i.weight>10&&t.length<100&&(o.label=`${i.weight.toFixed(0)}`),s.push(o)}),{nodes:r,edges:s}}function I3e(){const t=aa(),[e,n]=O.useState(!1),[r,s]=O.useState(null),[i,a]=O.useState(""),[o,u]=O.useState("all"),[h,f]=O.useState(50),[m,g]=O.useState("50"),[x,y]=O.useState(!1),[w,b]=O.useState(!0),[k,N]=O.useState(!1),[C,T]=O.useState(!1),[E,_,A]=Ywe([]),[F,B,P]=Zwe([]),[H,U]=O.useState(0),[te,z]=O.useState(null),[W,q]=O.useState(null),{toast:J}=$r(),ee=O.useCallback(Z=>Z.type==="entity"?"#6366f1":Z.type==="paragraph"?"#10b981":"#6b7280",[]),Y=O.useCallback(async(Z=!1)=>{try{if(!Z&&h>200){T(!0);return}n(!0);const[ne,ge]=await Promise.all([D3e(h,o),z3e()]);if(s(ge),ne.nodes.length===0){J({title:"提示",description:"知识库为空,请先导入知识数据"}),_([]),B([]);return}const{nodes:se,edges:Te}=B3e(ne.nodes,ne.edges);_(se),B(Te),U(se.length),ge&&ge.total_nodes>h&&J({title:"提示",description:`知识图谱包含 ${ge.total_nodes} 个节点,当前显示 ${se.length} 个`}),J({title:"加载成功",description:`已加载 ${se.length} 个节点,${Te.length} 条边`})}catch(ne){console.error("加载知识图谱失败:",ne),J({title:"加载失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}finally{n(!1)}},[h,o,J]),R=O.useCallback(async()=>{if(!i.trim()){J({title:"提示",description:"请输入搜索关键词"});return}try{const Z=await P3e(i);if(Z.length===0){J({title:"未找到",description:"没有找到匹配的节点"});return}const ne=new Set(Z.map(ge=>ge.id));_(ge=>ge.map(se=>({...se,style:{...se.style,opacity:ne.has(se.id)?1:.3,filter:ne.has(se.id)?"brightness(1.2)":"brightness(0.8)"}}))),J({title:"搜索完成",description:`找到 ${Z.length} 个匹配节点`})}catch(Z){console.error("搜索失败:",Z),J({title:"搜索失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}},[i,J]),re=O.useCallback(()=>{_(Z=>Z.map(ne=>({...ne,style:{...ne.style,opacity:1,filter:"brightness(1)"}})))},[]),K=O.useCallback(()=>{b(!1),N(!0),Y()},[Y]),I=O.useCallback(()=>{T(!1),setTimeout(()=>{Y(!0)},0)},[Y]),Q=O.useCallback((Z,ne)=>{E.find(se=>se.id===ne.id)&&z({id:ne.id,type:ne.type,content:ne.data.content})},[E]);O.useEffect(()=>{w||k&&Y()},[h,o,w,k]);const $=O.useCallback((Z,ne)=>{const ge=E.find(qe=>qe.id===ne.source),se=E.find(qe=>qe.id===ne.target),Te=F.find(qe=>qe.id===ne.id);ge&&se&&Te&&q({source:{id:ge.id,type:ge.type,content:ge.data.content},target:{id:se.id,type:se.type,content:se.data.content},edge:{source:ne.source,target:ne.target,weight:parseFloat(ne.label||"0")}})},[E,F]);return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),l.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),r&&l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsxs(kn,{variant:"outline",className:"gap-1",children:[l.jsx(R5,{className:"h-3 w-3"}),"节点: ",r.total_nodes]}),l.jsxs(kn,{variant:"outline",className:"gap-1",children:[l.jsx(MR,{className:"h-3 w-3"}),"边: ",r.total_edges]}),l.jsxs(kn,{variant:"outline",className:"gap-1",children:[l.jsx(Il,{className:"h-3 w-3"}),"实体: ",r.entity_nodes]}),l.jsxs(kn,{variant:"outline",className:"gap-1",children:[l.jsx(Dl,{className:"h-3 w-3"}),"段落: ",r.paragraph_nodes]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[l.jsxs("div",{className:"flex-1 flex gap-2",children:[l.jsx(Re,{placeholder:"搜索节点内容...",value:i,onChange:Z=>a(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&R(),className:"flex-1"}),l.jsx(de,{onClick:R,size:"sm",children:l.jsx(js,{className:"h-4 w-4"})}),l.jsx(de,{onClick:re,variant:"outline",size:"sm",children:"重置"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(It,{value:o,onValueChange:Z=>u(Z),children:[l.jsx(Pt,{className:"w-[120px]",children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"all",children:"全部节点"}),l.jsx(ze,{value:"entity",children:"仅实体"}),l.jsx(ze,{value:"paragraph",children:"仅段落"})]})]}),l.jsxs(It,{value:h===1e4?"all":x?"custom":h.toString(),onValueChange:Z=>{Z==="custom"?(y(!0),g(h.toString())):Z==="all"?(y(!1),f(1e4)):(y(!1),f(Number(Z)))},children:[l.jsx(Pt,{className:"w-[120px]",children:l.jsx(qt,{})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"50",children:"50 节点"}),l.jsx(ze,{value:"100",children:"100 节点"}),l.jsx(ze,{value:"200",children:"200 节点"}),l.jsx(ze,{value:"500",children:"500 节点"}),l.jsx(ze,{value:"1000",children:"1000 节点"}),l.jsx(ze,{value:"all",children:"全部 (最多10000)"}),l.jsx(ze,{value:"custom",children:"自定义..."})]})]}),x&&l.jsx(Re,{type:"number",min:"50",value:m,onChange:Z=>g(Z.target.value),onBlur:()=>{const Z=parseInt(m);!isNaN(Z)&&Z>=50?f(Z):(g("50"),f(50))},onKeyDown:Z=>{if(Z.key==="Enter"){const ne=parseInt(m);!isNaN(ne)&&ne>=50?f(ne):(g("50"),f(50))}},placeholder:"最少50个",className:"w-[120px]"}),l.jsx(de,{onClick:()=>Y(),variant:"outline",size:"sm",disabled:e,children:l.jsx(hi,{className:Se("h-4 w-4",e&&"animate-spin")})})]})]})]}),l.jsx("div",{className:"flex-1 relative",children:e?l.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l.jsxs("div",{className:"text-center",children:[l.jsx(hi,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),l.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):E.length===0?l.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l.jsxs("div",{className:"text-center",children:[l.jsx(R5,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),l.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):l.jsxs(xQ,{nodes:E,edges:F,onNodesChange:A,onEdgesChange:P,onNodeClick:Q,onEdgeClick:$,nodeTypes:L3e,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:H<=500,nodesDraggable:H<=1e3,attributionPosition:"bottom-left",children:[l.jsx(b5e,{variant:Ii.Dots,gap:12,size:1}),l.jsx(m5e,{}),H<=500&&l.jsx(l5e,{nodeColor:ee,nodeBorderRadius:8,pannable:!0,zoomable:!0}),l.jsxs(Qv,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[l.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),l.jsxs("div",{className:"space-y-2 text-xs",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),l.jsx("span",{children:"实体节点"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),l.jsx("span",{children:"段落节点"})]}),H>200&&l.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[l.jsx("div",{className:"font-semibold",children:"性能模式"}),l.jsx("div",{children:"已禁用动画"}),H>500&&l.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),l.jsx(Mr,{open:!!te,onOpenChange:Z=>!Z&&z(null),children:l.jsxs(vr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsx(yr,{children:l.jsx(br,{children:"节点详情"})}),te&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"grid grid-cols-2 gap-4",children:l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),l.jsx("div",{className:"mt-1",children:l.jsx(kn,{variant:te.type==="entity"?"default":"secondary",children:te.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),l.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:te.id})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),l.jsx(yn,{className:"mt-1 h-40 p-3 bg-muted rounded",children:l.jsx("p",{className:"text-sm whitespace-pre-wrap",children:te.content})})]})]})]})}),l.jsx(Mr,{open:!!W,onOpenChange:Z=>!Z&&q(null),children:l.jsxs(vr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsx(yr,{children:l.jsx(br,{children:"边详情"})}),W&&l.jsx(yn,{className:"flex-1 pr-4",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),l.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:W.source.content}),l.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[W.source.id.slice(0,40),"..."]})]}),l.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),l.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),l.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:W.target.content}),l.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[W.target.id.slice(0,40),"..."]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),l.jsx("div",{className:"mt-1",children:l.jsx(kn,{variant:"outline",className:"text-base font-mono",children:W.edge.weight.toFixed(4)})})]})]})})]})}),l.jsx(wn,{open:w,onOpenChange:b,children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"加载知识图谱"}),l.jsxs(cn,{children:["知识图谱的动态展示会消耗较多系统资源。",l.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),l.jsxs(ln,{children:[l.jsx(dn,{onClick:()=>t({to:"/"}),children:"取消 (返回首页)"}),l.jsx(un,{onClick:K,children:"确认加载"})]})]})}),l.jsx(wn,{open:C,onOpenChange:T,children:l.jsxs(sn,{children:[l.jsxs(an,{children:[l.jsx(on,{children:"⚠️ 节点数量较多"}),l.jsx(cn,{asChild:!0,children:l.jsxs("div",{children:[l.jsxs("p",{children:["您正在尝试加载 ",l.jsx("strong",{className:"text-orange-600",children:h>=1e4?"全部 (最多10000个)":h})," 个节点。"]}),l.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),l.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[l.jsx("li",{children:"页面加载时间较长"}),l.jsx("li",{children:"浏览器卡顿或崩溃"}),l.jsx("li",{children:"系统资源占用过高"})]}),l.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),l.jsxs(ln,{children:[l.jsx(dn,{onClick:()=>{T(!1),h>200&&(f(50),y(!1))},children:"取消"}),l.jsx(un,{onClick:I,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function xd(t,e,n){let r=n.initialDeps??[],s;function i(){var a,o,u,h;let f;n.key&&((a=n.debug)!=null&&a.call(n))&&(f=Date.now());const m=t();if(!(m.length!==r.length||m.some((y,w)=>r[w]!==y)))return s;r=m;let x;if(n.key&&((o=n.debug)!=null&&o.call(n))&&(x=Date.now()),s=e(...m),n.key&&((u=n.debug)!=null&&u.call(n))){const y=Math.round((Date.now()-f)*100)/100,w=Math.round((Date.now()-x)*100)/100,b=w/16,k=(N,C)=>{for(N=String(N);N.length{r=a},i}function OA(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const q3e=(t,e)=>Math.abs(t-e)<1.01,F3e=(t,e,n)=>{let r;return function(...s){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,s),n)}},jA=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},$3e=t=>t,Q3e=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let s=e;s<=n;s++)r.push(s);return r},H3e=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const s=a=>{const{width:o,height:u}=a;e({width:Math.round(o),height:Math.round(u)})};if(s(jA(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const o=()=>{const u=a[0];if(u?.borderBoxSize){const h=u.borderBoxSize[0];if(h){s({width:h.inlineSize,height:h.blockSize});return}}s(jA(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},NA={passive:!0},CA=typeof window>"u"?!0:"onscrollend"in window,V3e=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let s=0;const i=t.options.useScrollendEvent&&CA?()=>{}:F3e(r,()=>{e(s,!1)},t.options.isScrollingResetDelay),a=f=>()=>{const{horizontal:m,isRtl:g}=t.options;s=m?n.scrollLeft*(g&&-1||1):n.scrollTop,i(),e(s,f)},o=a(!0),u=a(!1);u(),n.addEventListener("scroll",o,NA);const h=t.options.useScrollendEvent&&CA;return h&&n.addEventListener("scrollend",u,NA),()=>{n.removeEventListener("scroll",o),h&&n.removeEventListener("scrollend",u)}},U3e=(t,e,n)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},W3e=(t,{adjustments:e=0,behavior:n},r)=>{var s,i;const a=t+e;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class G3e{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const a=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:$3e,rangeExtractor:Q3e,onChange:()=>{},measureElement:U3e,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=xd(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,i=new Map;for(let a=r-1;a>=0;a--){const o=n[a];if(s.has(o.lane))continue;const u=i.get(o.lane);if(u==null||o.end>u.end?i.set(o.lane,o):o.enda.end===o.end?a.index-o.index:a.end-o.end)[0]:void 0},this.getMeasurementOptions=xd(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,s,i,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a}),{key:!1}),this.getMeasurements=xd(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a},o)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const u=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const h=this.measurementsCache.slice(0,u);for(let f=u;fthis.options.debug}),this.calculateRange=xd(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?X3e({measurements:n,outerSize:r,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=xd(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,i,a)=>i===null||a===null?[]:n({startIndex:i,endIndex:a,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const s=this.indexFromElement(n),i=this.measurementsCache[s];if(!i)return;const a=i.key,o=this.elementsCache.get(a);o!==n&&(o&&this.observer.unobserve(o),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(s,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const s=this.measurementsCache[n];if(!s)return;const i=this.itemSizeCache.get(s.key)??s.size,a=r-i;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start{if(!n){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(n,void 0)},this.getVirtualItems=xd(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,a=n.length;ithis.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return OA(r[$Q(0,r.length-1,s=>OA(r[s]).start,n)])},this.getOffsetForAlignment=(n,r,s=0)=>{const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const o=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.measurementsCache[n];if(!s)return;const i=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(s.end>=a+i-this.options.scrollPaddingEnd)r="end";else if(s.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const o=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(n,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1));let i=0;const a=10,o=h=>{if(!this.targetWindow)return;const f=this.getOffsetForIndex(n,h);if(!f){console.warn("Failed to get offset for index:",n);return}const[m,g]=f;this._scrollToOffset(m,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const x=this.getScrollOffset(),y=this.getOffsetForIndex(n,g);if(!y){console.warn("Failed to get offset for index:",n);return}q3e(y[0],x)||u(g)})},u=h=>{this.targetWindow&&(i++,io(h)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};o(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((n=r[r.length-1])==null?void 0:n.end)??0;else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(o=>o===null);){const o=r[a];i[o.lane]===null&&(i[o.lane]=o.end),a--}s=Math.max(...i.filter(o=>o!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const $Q=(t,e,n,r)=>{for(;t<=e;){const s=(t+e)/2|0,i=n(s);if(ir)e=s-1;else return s}return t>0?t-1:0};function X3e({measurements:t,outerSize:e,scrollOffset:n,lanes:r}){const s=t.length-1,i=u=>t[u].start;if(t.length<=r)return{startIndex:0,endIndex:s};let a=$Q(0,s,i,n),o=a;if(r===1)for(;o1){const u=Array(r).fill(0);for(;of=0&&h.some(f=>f>=n);){const f=t[a];h[f.lane]=f.start,a--}a=Math.max(0,a-a%r),o=Math.min(s,o+(r-1-o%r))}return{startIndex:a,endIndex:o}}const TA=typeof document<"u"?O.useLayoutEffect:O.useEffect;function Y3e(t){const e=O.useReducer(()=>({}),{})[1],n={...t,onChange:(s,i)=>{var a;i?UA.flushSync(e):e(),(a=t.onChange)==null||a.call(t,s,i)}},[r]=O.useState(()=>new G3e(n));return r.setOptions(n),TA(()=>r._didMount(),[]),TA(()=>r._willUpdate()),r}function Z3e(t){return Y3e({observeElementRect:H3e,observeElementOffset:V3e,scrollToFn:W3e,...t})}function K3e(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const J3e={},Jf={};function Xc(t,e){try{const r=(J3e[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Jf?Jf[r]:EA(r,r.split(":"))}catch{if(t in Jf)return Jf[t];const n=t?.match(eSe);return n?EA(t,n.slice(1)):NaN}}const eSe=/([+-]\d\d):?(\d\d)?/;function EA(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return Jf[t]=n*60+r>0?n*60+r+s:n*60-r-s}class za extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Xc(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),QQ(this),RS(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new za(...n,e):new za(Date.now(),e)}withTimeZone(e){return new za(+this,e)}getTimezoneOffset(){const e=-Xc(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),RS(this),+this}[Symbol.for("constructDateFrom")](e){return new za(+new Date(e),this.timeZone)}}const _A=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!_A.test(t))return;const e=t.replace(_A,"$1UTC");za.prototype[e]&&(t.startsWith("get")?za.prototype[t]=function(){return this.internal[e]()}:(za.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),tSe(this),+this},za.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),RS(this),+this}))});function RS(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Xc(t.timeZone,t)*60))}function tSe(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),QQ(t)}function QQ(t){const e=Xc(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),a=s-i,o=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();a&&o&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+a);const u=s-n;u&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+u);const h=new Date(+t);h.setUTCSeconds(0);const f=s>0?h.getSeconds():(h.getSeconds()-60)%60,m=Math.round(-(Xc(t.timeZone,t)*60))%60;(m||f)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+m+f));const g=Xc(t.timeZone,t),x=g>0?Math.floor(g):Math.ceil(g),w=-new Date(+t).getTimezoneOffset()-x,b=x!==n,k=w-u;if(b&&k){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+k);const N=Xc(t.timeZone,t),C=N>0?Math.floor(N):Math.ceil(N),T=x-C;T&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+T),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+T))}}class os extends za{static tz(e,...n){return n.length?new os(...n,e):new os(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${K3e(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new os(+this,e)}[Symbol.for("constructDateFrom")](e){return new os(+new Date(e),this.timeZone)}}const HQ=6048e5,nSe=864e5,MA=Symbol.for("constructDateFrom");function Ar(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&MA in t?t[MA](e):t instanceof Date?new t.constructor(e):new Date(e)}function zn(t,e){return Ar(e||t,t)}function VQ(t,e,n){const r=zn(t,n?.in);return isNaN(e)?Ar(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function UQ(t,e,n){const r=zn(t,n?.in);if(isNaN(e))return Ar(t,NaN);if(!e)return r;const s=r.getDate(),i=Ar(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const a=i.getDate();return s>=a?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let rSe={};function P0(){return rSe}function ic(t,e){const n=P0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=zn(t,e?.in),i=s.getDay(),a=(i=i.getTime()?r+1:n.getTime()>=o.getTime()?r:r-1}function AA(t){const e=zn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Cu(t,...e){const n=Ar.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function Km(t,e){const n=zn(t,e?.in);return n.setHours(0,0,0,0),n}function GQ(t,e,n){const[r,s]=Cu(n?.in,t,e),i=Km(r),a=Km(s),o=+i-AA(i),u=+a-AA(a);return Math.round((o-u)/nSe)}function sSe(t,e){const n=WQ(t,e),r=Ar(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Zm(r)}function iSe(t,e,n){return VQ(t,e*7,n)}function aSe(t,e,n){return UQ(t,e*12,n)}function lSe(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=Ar.bind(null,s));const i=zn(s,r);(!n||n{!r&&typeof s=="object"&&(r=Ar.bind(null,s));const i=zn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),Ar(r,n||NaN)}function cSe(t,e,n){const[r,s]=Cu(n?.in,t,e);return+Km(r)==+Km(s)}function XQ(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function uSe(t){return!(!XQ(t)&&typeof t!="number"||isNaN(+zn(t)))}function dSe(t,e,n){const[r,s]=Cu(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),a=r.getMonth()-s.getMonth();return i*12+a}function hSe(t,e){const n=zn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function YQ(t,e){const[n,r]=Cu(t,e.start,e.end);return{start:n,end:r}}function fSe(t,e){const{start:n,end:r}=YQ(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setDate(1);let o=1;const u=[];for(;+a<=i;)u.push(Ar(n,a)),a.setMonth(a.getMonth()+o);return s?u.reverse():u}function mSe(t,e){const n=zn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function pSe(t,e){const n=zn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function ZQ(t,e){const n=zn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function gSe(t,e){const{start:n,end:r}=YQ(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setMonth(0,1);let o=1;const u=[];for(;+a<=i;)u.push(Ar(n,a)),a.setFullYear(a.getFullYear()+o);return s?u.reverse():u}function KQ(t,e){const n=P0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=zn(t,e?.in),i=s.getDay(),a=(i{let r;const s=vSe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Ud(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const bSe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},wSe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},SSe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},kSe={date:Ud({formats:bSe,defaultWidth:"full"}),time:Ud({formats:wSe,defaultWidth:"full"}),dateTime:Ud({formats:SSe,defaultWidth:"full"})},OSe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},jSe=(t,e,n,r)=>OSe[t];function Ca(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,o=n?.width?String(n.width):a;s=t.formattingValues[o]||t.formattingValues[a]}else{const a=t.defaultWidth,o=n?.width?String(n.width):t.defaultWidth;s=t.values[o]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const NSe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},CSe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},TSe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ESe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},_Se={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},MSe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ASe=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},RSe={ordinalNumber:ASe,era:Ca({values:NSe,defaultWidth:"wide"}),quarter:Ca({values:CSe,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ca({values:TSe,defaultWidth:"wide"}),day:Ca({values:ESe,defaultWidth:"wide"}),dayPeriod:Ca({values:_Se,defaultWidth:"wide",formattingValues:MSe,defaultFormattingWidth:"wide"})};function Ta(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const a=i[0],o=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],u=Array.isArray(o)?zSe(o,m=>m.test(a)):DSe(o,m=>m.test(a));let h;h=t.valueCallback?t.valueCallback(u):u,h=n.valueCallback?n.valueCallback(h):h;const f=e.slice(a.length);return{value:h,rest:f}}}function DSe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function zSe(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let a=t.valueCallback?t.valueCallback(i[0]):i[0];a=n.valueCallback?n.valueCallback(a):a;const o=e.slice(s.length);return{value:a,rest:o}}}const PSe=/^(\d+)(th|st|nd|rd)?/i,LSe=/\d+/i,BSe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},ISe={any:[/^b/i,/^(a|c)/i]},qSe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},FSe={any:[/1/i,/2/i,/3/i,/4/i]},$Se={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},QSe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},HSe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},VSe={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},USe={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},WSe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},GSe={ordinalNumber:JQ({matchPattern:PSe,parsePattern:LSe,valueCallback:t=>parseInt(t,10)}),era:Ta({matchPatterns:BSe,defaultMatchWidth:"wide",parsePatterns:ISe,defaultParseWidth:"any"}),quarter:Ta({matchPatterns:qSe,defaultMatchWidth:"wide",parsePatterns:FSe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Ta({matchPatterns:$Se,defaultMatchWidth:"wide",parsePatterns:QSe,defaultParseWidth:"any"}),day:Ta({matchPatterns:HSe,defaultMatchWidth:"wide",parsePatterns:VSe,defaultParseWidth:"any"}),dayPeriod:Ta({matchPatterns:USe,defaultMatchWidth:"any",parsePatterns:WSe,defaultParseWidth:"any"})},yO={code:"en-US",formatDistance:ySe,formatLong:kSe,formatRelative:jSe,localize:RSe,match:GSe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function XSe(t,e){const n=zn(t,e?.in);return GQ(n,ZQ(n))+1}function eH(t,e){const n=zn(t,e?.in),r=+Zm(n)-+sSe(n);return Math.round(r/HQ)+1}function tH(t,e){const n=zn(t,e?.in),r=n.getFullYear(),s=P0(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=Ar(e?.in||t,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const o=ic(a,e),u=Ar(e?.in||t,0);u.setFullYear(r,0,i),u.setHours(0,0,0,0);const h=ic(u,e);return+n>=+o?r+1:+n>=+h?r:r-1}function YSe(t,e){const n=P0(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=tH(t,e),i=Ar(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),ic(i,e)}function nH(t,e){const n=zn(t,e?.in),r=+ic(n,e)-+YSe(n,e);return Math.round(r/HQ)+1}function Cn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Do={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Cn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Cn(n+1,2)},d(t,e){return Cn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Cn(t.getHours()%12||12,e.length)},H(t,e){return Cn(t.getHours(),e.length)},m(t,e){return Cn(t.getMinutes(),e.length)},s(t,e){return Cn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Cn(s,e.length)}},vd={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},RA={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Do.y(t,e)},Y:function(t,e,n,r){const s=tH(t,r),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return Cn(a,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Cn(i,e.length)},R:function(t,e){const n=WQ(t);return Cn(n,e.length)},u:function(t,e){const n=t.getFullYear();return Cn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Cn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Cn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Do.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Cn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=nH(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):Cn(s,e.length)},I:function(t,e,n){const r=eH(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Cn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Do.d(t,e)},D:function(t,e,n){const r=XSe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Cn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Cn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Cn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return Cn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=vd.noon:r===0?s=vd.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=vd.evening:r>=12?s=vd.afternoon:r>=4?s=vd.morning:s=vd.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Do.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Do.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Cn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Cn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Do.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Do.s(t,e)},S:function(t,e){return Do.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return zA(r);case"XXXX":case"XX":return Fc(r);case"XXXXX":case"XXX":default:return Fc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return zA(r);case"xxxx":case"xx":return Fc(r);case"xxxxx":case"xxx":default:return Fc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+DA(r,":");case"OOOO":default:return"GMT"+Fc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+DA(r,":");case"zzzz":default:return"GMT"+Fc(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Cn(r,e.length)},T:function(t,e,n){return Cn(+t,e.length)}};function DA(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+Cn(i,2)}function zA(t,e){return t%60===0?(t>0?"-":"+")+Cn(Math.abs(t)/60,2):Fc(t,e)}function Fc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Cn(Math.trunc(r/60),2),i=Cn(r%60,2);return n+s+e+i}const PA=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},rH=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},ZSe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return PA(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",PA(r,e)).replace("{{time}}",rH(s,e))},KSe={p:rH,P:ZSe},JSe=/^D+$/,eke=/^Y+$/,tke=["D","DD","YY","YYYY"];function nke(t){return JSe.test(t)}function rke(t){return eke.test(t)}function ske(t,e,n){const r=ike(t,e,n);if(console.warn(r),tke.includes(t))throw new RangeError(r)}function ike(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ake=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,lke=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,oke=/^'([^]*?)'?$/,cke=/''/g,uke=/[a-zA-Z]/;function Qx(t,e,n){const r=P0(),s=n?.locale??r.locale??yO,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=zn(t,n?.in);if(!uSe(o))throw new RangeError("Invalid time value");let u=e.match(lke).map(f=>{const m=f[0];if(m==="p"||m==="P"){const g=KSe[m];return g(f,s.formatLong)}return f}).join("").match(ake).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const m=f[0];if(m==="'")return{isToken:!1,value:dke(f)};if(RA[m])return{isToken:!0,value:f};if(m.match(uke))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:f}});s.localize.preprocessor&&(u=s.localize.preprocessor(o,u));const h={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return u.map(f=>{if(!f.isToken)return f.value;const m=f.value;(!n?.useAdditionalWeekYearTokens&&rke(m)||!n?.useAdditionalDayOfYearTokens&&nke(m))&&ske(m,e,String(t));const g=RA[m[0]];return g(o,m,s.localize,h)}).join("")}function dke(t){const e=t.match(oke);return e?e[1].replace(cke,"'"):t}function hke(t,e){const n=zn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=Ar(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function fke(t,e){return zn(t,e?.in).getMonth()}function mke(t,e){return zn(t,e?.in).getFullYear()}function pke(t,e){return+zn(t)>+zn(e)}function gke(t,e){return+zn(t)<+zn(e)}function xke(t,e,n){const[r,s]=Cu(n?.in,t,e);return+ic(r,n)==+ic(s,n)}function vke(t,e,n){const[r,s]=Cu(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function yke(t,e,n){const[r,s]=Cu(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function bke(t,e,n){const r=zn(t,n?.in),s=r.getFullYear(),i=r.getDate(),a=Ar(t,0);a.setFullYear(s,e,15),a.setHours(0,0,0,0);const o=hke(a);return r.setMonth(e,Math.min(i,o)),r}function wke(t,e,n){const r=zn(t,n?.in);return isNaN(+r)?Ar(t,NaN):(r.setFullYear(e),r)}const LA=5,Ske=4;function kke(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,LA*7-1);return e.getMonth(t)===e.getMonth(i)?LA:Ske}function sH(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function Oke(t,e){const n=sH(t,e),r=kke(t,e);return e.addDays(n,r*7-1)}class gi{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?os.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new os(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):VQ(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):UQ(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):iSe(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):aSe(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):GQ(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):dSe(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):fSe(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):gSe(r),i=new Set(s.map(o=>this.getYear(o)));if(i.size===s.length)return s;const a=[];return i.forEach(o=>{a.push(new Date(o,0,1))}),a},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):Oke(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):xSe(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):hSe(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):KQ(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):pSe(r),this.format=(r,s,i)=>{const a=this.overrides?.format?this.overrides.format(r,s,this.options):Qx(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(a):a},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):eH(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):fke(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):mke(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):nH(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):pke(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):gke(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):XQ(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):cSe(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):vke(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):yke(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):lSe(r),this.min=r=>this.overrides?.min?this.overrides.min(r):oSe(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):bke(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):wke(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):sH(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Km(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Zm(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):mSe(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):ic(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):ZQ(r),this.options={locale:yO,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&gi.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&gi.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const a=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,a)}}gi.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Ga=new gi;class iH{constructor(e,n,r=Ga){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class jke{constructor(e,n){this.date=e,this.weeks=n}}class Nke{constructor(e,n){this.days=n,this.weekNumber=e}}function Cke(t){return fe.createElement("button",{...t})}function Tke(t){return fe.createElement("span",{...t})}function Eke(t){const{size:e=24,orientation:n="left",className:r}=t;return fe.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&fe.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&fe.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&fe.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&fe.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function _ke(t){const{day:e,modifiers:n,...r}=t;return fe.createElement("td",{...r})}function Mke(t){const{day:e,modifiers:n,...r}=t,s=fe.useRef(null);return fe.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),fe.createElement("button",{ref:s,...r})}var ct;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(ct||(ct={}));var ir;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(ir||(ir={}));var ea;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(ea||(ea={}));var ci;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(ci||(ci={}));function Ake(t){const{options:e,className:n,components:r,classNames:s,...i}=t,a=[s[ct.Dropdown],n].join(" "),o=e?.find(({value:u})=>u===i.value);return fe.createElement("span",{"data-disabled":i.disabled,className:s[ct.DropdownRoot]},fe.createElement(r.Select,{className:a,...i},e?.map(({value:u,label:h,disabled:f})=>fe.createElement(r.Option,{key:u,value:u,disabled:f},h))),fe.createElement("span",{className:s[ct.CaptionLabel],"aria-hidden":!0},o?.label,fe.createElement(r.Chevron,{orientation:"down",size:18,className:s[ct.Chevron]})))}function Rke(t){return fe.createElement("div",{...t})}function Dke(t){return fe.createElement("div",{...t})}function zke(t){const{calendarMonth:e,displayIndex:n,...r}=t;return fe.createElement("div",{...r},t.children)}function Pke(t){const{calendarMonth:e,displayIndex:n,...r}=t;return fe.createElement("div",{...r})}function Lke(t){return fe.createElement("table",{...t})}function Bke(t){return fe.createElement("div",{...t})}const aH=O.createContext(void 0);function L0(){const t=O.useContext(aH);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function Ike(t){const{components:e}=L0();return fe.createElement(e.Dropdown,{...t})}function qke(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:a,classNames:o,labels:{labelPrevious:u,labelNext:h}}=L0(),f=O.useCallback(g=>{s&&n?.(g)},[s,n]),m=O.useCallback(g=>{r&&e?.(g)},[r,e]);return fe.createElement("nav",{...i},fe.createElement(a.PreviousMonthButton,{type:"button",className:o[ct.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":u(r),onClick:m},fe.createElement(a.Chevron,{disabled:r?void 0:!0,className:o[ct.Chevron],orientation:"left"})),fe.createElement(a.NextMonthButton,{type:"button",className:o[ct.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:f},fe.createElement(a.Chevron,{disabled:s?void 0:!0,orientation:"right",className:o[ct.Chevron]})))}function Fke(t){const{components:e}=L0();return fe.createElement(e.Button,{...t})}function $ke(t){return fe.createElement("option",{...t})}function Qke(t){const{components:e}=L0();return fe.createElement(e.Button,{...t})}function Hke(t){const{rootRef:e,...n}=t;return fe.createElement("div",{...n,ref:e})}function Vke(t){return fe.createElement("select",{...t})}function Uke(t){const{week:e,...n}=t;return fe.createElement("tr",{...n})}function Wke(t){return fe.createElement("th",{...t})}function Gke(t){return fe.createElement("thead",{"aria-hidden":!0},fe.createElement("tr",{...t}))}function Xke(t){const{week:e,...n}=t;return fe.createElement("th",{...n})}function Yke(t){return fe.createElement("th",{...t})}function Zke(t){return fe.createElement("tbody",{...t})}function Kke(t){const{components:e}=L0();return fe.createElement(e.Dropdown,{...t})}const Jke=Object.freeze(Object.defineProperty({__proto__:null,Button:Cke,CaptionLabel:Tke,Chevron:Eke,Day:_ke,DayButton:Mke,Dropdown:Ake,DropdownNav:Rke,Footer:Dke,Month:zke,MonthCaption:Pke,MonthGrid:Lke,Months:Bke,MonthsDropdown:Ike,Nav:qke,NextMonthButton:Fke,Option:$ke,PreviousMonthButton:Qke,Root:Hke,Select:Vke,Week:Uke,WeekNumber:Xke,WeekNumberHeader:Yke,Weekday:Wke,Weekdays:Gke,Weeks:Zke,YearsDropdown:Kke},Symbol.toStringTag,{value:"Module"}));function Al(t,e,n=!1,r=Ga){let{from:s,to:i}=t;const{differenceInCalendarDays:a,isSameDay:o}=r;return s&&i?(a(i,s)<0&&([s,i]=[i,s]),a(e,s)>=(n?1:0)&&a(i,e)>=(n?1:0)):!n&&i?o(i,e):!n&&s?o(s,e):!1}function lH(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function bO(t){return!!(t&&typeof t=="object"&&"from"in t)}function oH(t){return!!(t&&typeof t=="object"&&"after"in t)}function cH(t){return!!(t&&typeof t=="object"&&"before"in t)}function uH(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function dH(t,e){return Array.isArray(t)&&t.every(e.isDate)}function Rl(t,e,n=Ga){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:a}=n;return r.some(o=>{if(typeof o=="boolean")return o;if(n.isDate(o))return s(t,o);if(dH(o,n))return o.includes(t);if(bO(o))return Al(o,t,!1,n);if(uH(o))return Array.isArray(o.dayOfWeek)?o.dayOfWeek.includes(t.getDay()):o.dayOfWeek===t.getDay();if(lH(o)){const u=i(o.before,t),h=i(o.after,t),f=u>0,m=h<0;return a(o.before,o.after)?m&&f:f||m}return oH(o)?i(t,o.after)>0:cH(o)?i(o.before,t)>0:typeof o=="function"?o(t):!1})}function e6e(t,e,n,r,s){const{disabled:i,hidden:a,modifiers:o,showOutsideDays:u,broadcastCalendar:h,today:f}=e,{isSameDay:m,isSameMonth:g,startOfMonth:x,isBefore:y,endOfMonth:w,isAfter:b}=s,k=n&&x(n),N=r&&w(r),C={[ir.focused]:[],[ir.outside]:[],[ir.disabled]:[],[ir.hidden]:[],[ir.today]:[]},T={};for(const E of t){const{date:_,displayMonth:A}=E,F=!!(A&&!g(_,A)),B=!!(k&&y(_,k)),P=!!(N&&b(_,N)),H=!!(i&&Rl(_,i,s)),U=!!(a&&Rl(_,a,s))||B||P||!h&&!u&&F||h&&u===!1&&F,te=m(_,f??s.today());F&&C.outside.push(E),H&&C.disabled.push(E),U&&C.hidden.push(E),te&&C.today.push(E),o&&Object.keys(o).forEach(z=>{const W=o?.[z];W&&Rl(_,W,s)&&(T[z]?T[z].push(E):T[z]=[E])})}return E=>{const _={[ir.focused]:!1,[ir.disabled]:!1,[ir.hidden]:!1,[ir.outside]:!1,[ir.today]:!1},A={};for(const F in C){const B=C[F];_[F]=B.some(P=>P===E)}for(const F in T)A[F]=T[F].some(B=>B===E);return{..._,...A}}}function t6e(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[ir[i]]?s.push(e[ir[i]]):e[ea[i]]&&s.push(e[ea[i]]),s),[e[ct.Day]])}function n6e(t){return{...Jke,...t}}function r6e(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function wO(){const t={};for(const e in ct)t[ct[e]]=`rdp-${ct[e]}`;for(const e in ir)t[ir[e]]=`rdp-${ir[e]}`;for(const e in ea)t[ea[e]]=`rdp-${ea[e]}`;for(const e in ci)t[ci[e]]=`rdp-${ci[e]}`;return t}function hH(t,e,n){return(n??new gi(e)).formatMonthYear(t)}const s6e=hH;function i6e(t,e,n){return(n??new gi(e)).format(t,"d")}function a6e(t,e=Ga){return e.format(t,"LLLL")}function l6e(t,e,n){return(n??new gi(e)).format(t,"cccccc")}function o6e(t,e=Ga){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function c6e(){return""}function fH(t,e=Ga){return e.format(t,"yyyy")}const u6e=fH,d6e=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:hH,formatDay:i6e,formatMonthCaption:s6e,formatMonthDropdown:a6e,formatWeekNumber:o6e,formatWeekNumberHeader:c6e,formatWeekdayName:l6e,formatYearCaption:u6e,formatYearDropdown:fH},Symbol.toStringTag,{value:"Module"}));function h6e(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...d6e,...t}}function f6e(t,e,n,r,s){const{startOfMonth:i,startOfYear:a,endOfYear:o,eachMonthOfInterval:u,getMonth:h}=s;return u({start:a(t),end:o(t)}).map(g=>{const x=r.formatMonthDropdown(g,s),y=h(g),w=e&&gi(n)||!1;return{value:y,label:x,disabled:w}})}function m6e(t,e={},n={}){let r={...e?.[ct.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function p6e(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let a=0;a<7;a++){const o=t.addDays(s,a);i.push(o)}return i}function g6e(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:a,eachYearOfInterval:o,getYear:u}=r,h=i(t),f=a(e),m=o({start:h,end:f});return s&&m.reverse(),m.map(g=>{const x=n.formatYearDropdown(g,r);return{value:u(g),label:x,disabled:!1}})}function mH(t,e,n,r){let s=(r??new gi(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const x6e=mH;function pH(t,e,n){return(n??new gi(e)).formatMonthYear(t)}const v6e=pH;function y6e(t,e,n,r){let s=(r??new gi(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function b6e(t){return"Choose the Month"}function w6e(){return""}function S6e(t){return"Go to the Next Month"}function k6e(t){return"Go to the Previous Month"}function O6e(t,e,n){return(n??new gi(e)).format(t,"cccc")}function j6e(t,e){return`Week ${t}`}function N6e(t){return"Week Number"}function C6e(t){return"Choose the Year"}const T6e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:v6e,labelDay:x6e,labelDayButton:mH,labelGrid:pH,labelGridcell:y6e,labelMonthDropdown:b6e,labelNav:w6e,labelNext:S6e,labelPrevious:k6e,labelWeekNumber:j6e,labelWeekNumberHeader:N6e,labelWeekday:O6e,labelYearDropdown:C6e},Symbol.toStringTag,{value:"Module"})),B0=t=>t instanceof HTMLElement?t:null,E5=t=>[...t.querySelectorAll("[data-animated-month]")??[]],E6e=t=>B0(t.querySelector("[data-animated-month]")),_5=t=>B0(t.querySelector("[data-animated-caption]")),M5=t=>B0(t.querySelector("[data-animated-weeks]")),_6e=t=>B0(t.querySelector("[data-animated-nav]")),M6e=t=>B0(t.querySelector("[data-animated-weekdays]"));function A6e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const a=O.useRef(null),o=O.useRef(r),u=O.useRef(!1);O.useLayoutEffect(()=>{const h=o.current;if(o.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const f=i.isSameMonth(r[0].date,h[0].date),m=i.isAfter(r[0].date,h[0].date),g=m?n[ci.caption_after_enter]:n[ci.caption_before_enter],x=m?n[ci.weeks_after_enter]:n[ci.weeks_before_enter],y=a.current,w=t.current.cloneNode(!0);if(w instanceof HTMLElement?(E5(w).forEach(C=>{if(!(C instanceof HTMLElement))return;const T=E6e(C);T&&C.contains(T)&&C.removeChild(T);const E=_5(C);E&&E.classList.remove(g);const _=M5(C);_&&_.classList.remove(x)}),a.current=w):a.current=null,u.current||f||s)return;const b=y instanceof HTMLElement?E5(y):[],k=E5(t.current);if(k?.every(N=>N instanceof HTMLElement)&&b&&b.every(N=>N instanceof HTMLElement)){u.current=!0,t.current.style.isolation="isolate";const N=_6e(t.current);N&&(N.style.zIndex="1"),k.forEach((C,T)=>{const E=b[T];if(!E)return;C.style.position="relative",C.style.overflow="hidden";const _=_5(C);_&&_.classList.add(g);const A=M5(C);A&&A.classList.add(x);const F=()=>{u.current=!1,t.current&&(t.current.style.isolation=""),N&&(N.style.zIndex=""),_&&_.classList.remove(g),A&&A.classList.remove(x),C.style.position="",C.style.overflow="",C.contains(E)&&C.removeChild(E)};E.style.pointerEvents="none",E.style.position="absolute",E.style.overflow="hidden",E.setAttribute("aria-hidden","true");const B=M6e(E);B&&(B.style.opacity="0");const P=_5(E);P&&(P.classList.add(m?n[ci.caption_before_exit]:n[ci.caption_after_exit]),P.addEventListener("animationend",F));const H=M5(E);H&&H.classList.add(m?n[ci.weeks_before_exit]:n[ci.weeks_after_exit]),C.insertBefore(E,C.firstChild)})}})}function R6e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:a,fixedWeeks:o,broadcastCalendar:u}=n??{},{addDays:h,differenceInCalendarDays:f,differenceInCalendarMonths:m,endOfBroadcastWeek:g,endOfISOWeek:x,endOfMonth:y,endOfWeek:w,isAfter:b,startOfBroadcastWeek:k,startOfISOWeek:N,startOfWeek:C}=r,T=u?k(s,r):a?N(s):C(s),E=u?g(i):a?x(y(i)):w(y(i)),_=f(E,T),A=m(i,s)+1,F=[];for(let H=0;H<=_;H++){const U=h(T,H);if(e&&b(U,e))break;F.push(U)}const P=(u?35:42)*A;if(o&&F.length{const s=r.weeks.reduce((i,a)=>i.concat(a.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function z6e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let a=0;ae)break;i.push(o)}return i}function BA(t,e,n,r){const{month:s,defaultMonth:i,today:a=r.today(),numberOfMonths:o=1}=t;let u=s||i||a;const{differenceInCalendarMonths:h,addMonths:f,startOfMonth:m}=r;if(n&&h(n,u){const k=n.broadcastCalendar?m(b,r):n.ISOWeek?g(b):x(b),N=n.broadcastCalendar?i(b):n.ISOWeek?a(o(b)):u(o(b)),C=e.filter(A=>A>=k&&A<=N),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&C.length{const B=T-C.length;return F>N&&F<=s(N,B)});C.push(...A)}const E=C.reduce((A,F)=>{const B=n.ISOWeek?h(F):f(F),P=A.find(U=>U.weekNumber===B),H=new iH(F,b,r);return P?P.days.push(H):A.push(new Nke(B,[H])),A},[]),_=new jke(b,E);return w.push(_),w},[]);return n.reverseMonths?y.reverse():y}function L6e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:a,endOfMonth:o,addYears:u,endOfYear:h,newDate:f,today:m}=e,{fromYear:g,toYear:x,fromMonth:y,toMonth:w}=t;!n&&y&&(n=y),!n&&g&&(n=e.newDate(g,0,1)),!r&&w&&(r=w),!r&&x&&(r=f(x,11,31));const b=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=a(n):g?n=f(g,0,1):!n&&b&&(n=s(u(t.today??m(),-100))),r?r=o(r):x?r=f(x,11,31):!r&&b&&(r=h(t.today??m())),[n&&i(n),r&&i(r)]}function B6e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:a,addMonths:o,differenceInCalendarMonths:u}=r,h=s?i:1,f=a(t);if(!e)return o(f,h);if(!(u(e,t)n.concat(r.weeks.slice()),e.slice())}function Uv(t,e){const[n,r]=O.useState(t);return[e===void 0?n:e,r]}function F6e(t,e){const[n,r]=L6e(t,e),{startOfMonth:s,endOfMonth:i}=e,a=BA(t,n,r,e),[o,u]=Uv(a,t.month?a:void 0);O.useEffect(()=>{const _=BA(t,n,r,e);u(_)},[t.timeZone]);const h=z6e(o,r,t,e),f=R6e(h,t.endMonth?i(t.endMonth):void 0,t,e),m=P6e(h,f,t,e),g=q6e(m),x=D6e(m),y=I6e(o,n,t,e),w=B6e(o,r,t,e),{disableNavigation:b,onMonthChange:k}=t,N=_=>g.some(A=>A.days.some(F=>F.isEqualTo(_))),C=_=>{if(b)return;let A=s(_);n&&As(r)&&(A=s(r)),u(A),k?.(A)};return{months:m,weeks:g,days:x,navStart:n,navEnd:r,previousMonth:y,nextMonth:w,goToMonth:C,goToDay:_=>{N(_)||C(_.date)}}}var ka;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(ka||(ka={}));function IA(t){return!t[ir.disabled]&&!t[ir.hidden]&&!t[ir.outside]}function $6e(t,e,n,r){let s,i=-1;for(const a of t){const o=e(a);IA(o)&&(o[ir.focused]&&iIA(e(a)))),s}function Q6e(t,e,n,r,s,i,a){const{ISOWeek:o,broadcastCalendar:u}=i,{addDays:h,addMonths:f,addWeeks:m,addYears:g,endOfBroadcastWeek:x,endOfISOWeek:y,endOfWeek:w,max:b,min:k,startOfBroadcastWeek:N,startOfISOWeek:C,startOfWeek:T}=a;let _={day:h,week:m,month:f,year:g,startOfWeek:A=>u?N(A,a):o?C(A):T(A),endOfWeek:A=>u?x(A):o?y(A):w(A)}[t](n,e==="after"?1:-1);return e==="before"&&r?_=b([r,_]):e==="after"&&s&&(_=k([s,_])),_}function gH(t,e,n,r,s,i,a,o=0){if(o>365)return;const u=Q6e(t,e,n.date,r,s,i,a),h=!!(i.disabled&&Rl(u,i.disabled,a)),f=!!(i.hidden&&Rl(u,i.hidden,a)),m=u,g=new iH(u,m,a);return!h&&!f?g:gH(t,e,g,r,s,i,a,o+1)}function H6e(t,e,n,r,s){const{autoFocus:i}=t,[a,o]=O.useState(),u=$6e(e.days,n,r||(()=>!1),a),[h,f]=O.useState(i?u:void 0);return{isFocusTarget:w=>!!u?.isEqualTo(w),setFocused:f,focused:h,blur:()=>{o(h),f(void 0)},moveFocus:(w,b)=>{if(!h)return;const k=gH(w,b,h,e.navStart,e.navEnd,t,s);k&&(t.disableNavigation&&!e.days.some(C=>C.isEqualTo(k))||(e.goToDay(k),f(k)))}}}function V6e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=Uv(n,s?n:void 0),o=s?n:i,{isSameDay:u}=e,h=x=>o?.some(y=>u(y,x))??!1,{min:f,max:m}=t;return{selected:o,select:(x,y,w)=>{let b=[...o??[]];if(h(x)){if(o?.length===f||r&&o?.length===1)return;b=o?.filter(k=>!u(k,x))}else o?.length===m?b=[x]:b=[...b,x];return s||a(b),s?.(b,x,y,w),b},isSelected:h}}function U6e(t,e,n=0,r=0,s=!1,i=Ga){const{from:a,to:o}=e||{},{isSameDay:u,isAfter:h,isBefore:f}=i;let m;if(!a&&!o)m={from:t,to:n>0?void 0:t};else if(a&&!o)u(a,t)?n===0?m={from:a,to:t}:s?m={from:a,to:void 0}:m=void 0:f(t,a)?m={from:t,to:a}:m={from:a,to:t};else if(a&&o)if(u(a,t)&&u(o,t))s?m={from:a,to:o}:m=void 0;else if(u(a,t))m={from:a,to:n>0?void 0:t};else if(u(o,t))m={from:t,to:n>0?void 0:t};else if(f(t,a))m={from:t,to:o};else if(h(t,a))m={from:a,to:t};else if(h(t,o))m={from:a,to:t};else throw new Error("Invalid range");if(m?.from&&m?.to){const g=i.differenceInCalendarDays(m.to,m.from);r>0&&g>r?m={from:t,to:void 0}:n>1&&gtypeof o!="function").some(o=>typeof o=="boolean"?o:n.isDate(o)?Al(t,o,!1,n):dH(o,n)?o.some(u=>Al(t,u,!1,n)):bO(o)?o.from&&o.to?qA(t,{from:o.from,to:o.to},n):!1:uH(o)?W6e(t,o.dayOfWeek,n):lH(o)?n.isAfter(o.before,o.after)?qA(t,{from:n.addDays(o.after,1),to:n.addDays(o.before,-1)},n):Rl(t.from,o,n)||Rl(t.to,o,n):oH(o)||cH(o)?Rl(t.from,o,n)||Rl(t.to,o,n):!1))return!0;const a=r.filter(o=>typeof o=="function");if(a.length){let o=t.from;const u=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=u;h++){if(a.some(f=>f(o)))return!0;o=n.addDays(o,1)}}return!1}function X6e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:a}=t,[o,u]=Uv(s,a?s:void 0),h=a?s:o;return{selected:h,select:(g,x,y)=>{const{min:w,max:b}=t,k=g?U6e(g,h,w,b,i,e):void 0;return r&&n&&k?.from&&k.to&&G6e({from:k.from,to:k.to},n,e)&&(k.from=g,k.to=void 0),a||u(k),a?.(k,g,x,y),k},isSelected:g=>h&&Al(h,g,!1,e)}}function Y6e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=Uv(n,s?n:void 0),o=s?n:i,{isSameDay:u}=e;return{selected:o,select:(m,g,x)=>{let y=m;return!r&&o&&o&&u(m,o)&&(y=void 0),s||a(y),s?.(y,m,g,x),y},isSelected:m=>o?u(o,m):!1}}function Z6e(t,e){const n=Y6e(t,e),r=V6e(t,e),s=X6e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function K6e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new os(e.today,e.timeZone)),e.month&&(e.month=new os(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new os(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new os(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new os(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new os(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(ft=>new os(ft,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new os(e.selected.from,e.timeZone):void 0,to:e.selected.to?new os(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:a,classNames:o}=O.useMemo(()=>{const ft={...yO,...e.locale};return{dateLib:new gi({locale:ft,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:n6e(e.components),formatters:h6e(e.formatters),labels:{...T6e,...e.labels},locale:ft,classNames:{...wO(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:u,mode:h,navLayout:f,numberOfMonths:m=1,onDayBlur:g,onDayClick:x,onDayFocus:y,onDayKeyDown:w,onDayMouseEnter:b,onDayMouseLeave:k,onNextClick:N,onPrevClick:C,showWeekNumber:T,styles:E}=e,{formatCaption:_,formatDay:A,formatMonthDropdown:F,formatWeekNumber:B,formatWeekNumberHeader:P,formatWeekdayName:H,formatYearDropdown:U}=r,te=F6e(e,i),{days:z,months:W,navStart:q,navEnd:J,previousMonth:ee,nextMonth:Y,goToMonth:R}=te,re=e6e(z,e,q,J,i),{isSelected:K,select:I,selected:Q}=Z6e(e,i)??{},{blur:$,focused:Z,isFocusTarget:ne,moveFocus:ge,setFocused:se}=H6e(e,te,re,K??(()=>!1),i),{labelDayButton:Te,labelGridcell:qe,labelGrid:ve,labelMonthDropdown:Fe,labelNav:Qe,labelPrevious:Ke,labelNext:Tt,labelWeekday:st,labelWeekNumber:He,labelWeekNumberHeader:St,labelYearDropdown:bt}=s,nr=O.useMemo(()=>p6e(i,e.ISOWeek),[i,e.ISOWeek]),mn=h!==void 0||x!==void 0,Hn=O.useCallback(()=>{ee&&(R(ee),C?.(ee))},[ee,R,C]),$t=O.useCallback(()=>{Y&&(R(Y),N?.(Y))},[R,Y,N]),ht=O.useCallback((ft,On)=>mt=>{mt.preventDefault(),mt.stopPropagation(),se(ft),I?.(ft.date,On,mt),x?.(ft.date,On,mt)},[I,x,se]),le=O.useCallback((ft,On)=>mt=>{se(ft),y?.(ft.date,On,mt)},[y,se]),Oe=O.useCallback((ft,On)=>mt=>{$(),g?.(ft.date,On,mt)},[$,g]),Le=O.useCallback((ft,On)=>mt=>{const Jt={ArrowLeft:[mt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[mt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[mt.shiftKey?"year":"week","after"],ArrowUp:[mt.shiftKey?"year":"week","before"],PageUp:[mt.shiftKey?"year":"month","before"],PageDown:[mt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Jt[mt.key]){mt.preventDefault(),mt.stopPropagation();const[fr,kt]=Jt[mt.key];ge(fr,kt)}w?.(ft.date,On,mt)},[ge,w,e.dir]),nt=O.useCallback((ft,On)=>mt=>{b?.(ft.date,On,mt)},[b]),Ot=O.useCallback((ft,On)=>mt=>{k?.(ft.date,On,mt)},[k]),Vt=O.useCallback(ft=>On=>{const mt=Number(On.target.value),Jt=i.setMonth(i.startOfMonth(ft),mt);R(Jt)},[i,R]),Ln=O.useCallback(ft=>On=>{const mt=Number(On.target.value),Jt=i.setYear(i.startOfMonth(ft),mt);R(Jt)},[i,R]),{className:ue,style:Ce}=O.useMemo(()=>({className:[o[ct.Root],e.className].filter(Boolean).join(" "),style:{...E?.[ct.Root],...e.style}}),[o,e.className,e.style,E]),lt=r6e(e),ut=O.useRef(null);A6e(ut,!!e.animate,{classNames:o,months:W,focused:Z,dateLib:i});const or={dayPickerProps:e,selected:Q,select:I,isSelected:K,months:W,nextMonth:Y,previousMonth:ee,goToMonth:R,getModifiers:re,components:n,classNames:o,styles:E,labels:s,formatters:r};return fe.createElement(aH.Provider,{value:or},fe.createElement(n.Root,{rootRef:e.animate?ut:void 0,className:ue,style:Ce,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...lt},fe.createElement(n.Months,{className:o[ct.Months],style:E?.[ct.Months]},!e.hideNavigation&&!f&&fe.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:o[ct.Nav],style:E?.[ct.Nav],"aria-label":Qe(),onPreviousClick:Hn,onNextClick:$t,previousMonth:ee,nextMonth:Y}),W.map((ft,On)=>fe.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:o[ct.Month],style:E?.[ct.Month],key:On,displayIndex:On,calendarMonth:ft},f==="around"&&!e.hideNavigation&&On===0&&fe.createElement(n.PreviousMonthButton,{type:"button",className:o[ct.PreviousMonthButton],tabIndex:ee?void 0:-1,"aria-disabled":ee?void 0:!0,"aria-label":Ke(ee),onClick:Hn,"data-animated-button":e.animate?"true":void 0},fe.createElement(n.Chevron,{disabled:ee?void 0:!0,className:o[ct.Chevron],orientation:e.dir==="rtl"?"right":"left"})),fe.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:o[ct.MonthCaption],style:E?.[ct.MonthCaption],calendarMonth:ft,displayIndex:On},u?.startsWith("dropdown")?fe.createElement(n.DropdownNav,{className:o[ct.Dropdowns],style:E?.[ct.Dropdowns]},(()=>{const mt=u==="dropdown"||u==="dropdown-months"?fe.createElement(n.MonthsDropdown,{key:"month",className:o[ct.MonthsDropdown],"aria-label":Fe(),classNames:o,components:n,disabled:!!e.disableNavigation,onChange:Vt(ft.date),options:f6e(ft.date,q,J,r,i),style:E?.[ct.Dropdown],value:i.getMonth(ft.date)}):fe.createElement("span",{key:"month"},F(ft.date,i)),Jt=u==="dropdown"||u==="dropdown-years"?fe.createElement(n.YearsDropdown,{key:"year",className:o[ct.YearsDropdown],"aria-label":bt(i.options),classNames:o,components:n,disabled:!!e.disableNavigation,onChange:Ln(ft.date),options:g6e(q,J,r,i,!!e.reverseYears),style:E?.[ct.Dropdown],value:i.getYear(ft.date)}):fe.createElement("span",{key:"year"},U(ft.date,i));return i.getMonthYearOrder()==="year-first"?[Jt,mt]:[mt,Jt]})(),fe.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},_(ft.date,i.options,i))):fe.createElement(n.CaptionLabel,{className:o[ct.CaptionLabel],role:"status","aria-live":"polite"},_(ft.date,i.options,i))),f==="around"&&!e.hideNavigation&&On===m-1&&fe.createElement(n.NextMonthButton,{type:"button",className:o[ct.NextMonthButton],tabIndex:Y?void 0:-1,"aria-disabled":Y?void 0:!0,"aria-label":Tt(Y),onClick:$t,"data-animated-button":e.animate?"true":void 0},fe.createElement(n.Chevron,{disabled:Y?void 0:!0,className:o[ct.Chevron],orientation:e.dir==="rtl"?"left":"right"})),On===m-1&&f==="after"&&!e.hideNavigation&&fe.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:o[ct.Nav],style:E?.[ct.Nav],"aria-label":Qe(),onPreviousClick:Hn,onNextClick:$t,previousMonth:ee,nextMonth:Y}),fe.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":ve(ft.date,i.options,i)||void 0,className:o[ct.MonthGrid],style:E?.[ct.MonthGrid]},!e.hideWeekdays&&fe.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:o[ct.Weekdays],style:E?.[ct.Weekdays]},T&&fe.createElement(n.WeekNumberHeader,{"aria-label":St(i.options),className:o[ct.WeekNumberHeader],style:E?.[ct.WeekNumberHeader],scope:"col"},P()),nr.map(mt=>fe.createElement(n.Weekday,{"aria-label":st(mt,i.options,i),className:o[ct.Weekday],key:String(mt),style:E?.[ct.Weekday],scope:"col"},H(mt,i.options,i)))),fe.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:o[ct.Weeks],style:E?.[ct.Weeks]},ft.weeks.map(mt=>fe.createElement(n.Week,{className:o[ct.Week],key:mt.weekNumber,style:E?.[ct.Week],week:mt},T&&fe.createElement(n.WeekNumber,{week:mt,style:E?.[ct.WeekNumber],"aria-label":He(mt.weekNumber,{locale:a}),className:o[ct.WeekNumber],scope:"row",role:"rowheader"},B(mt.weekNumber,i)),mt.days.map(Jt=>{const{date:fr}=Jt,kt=re(Jt);if(kt[ir.focused]=!kt.hidden&&!!Z?.isEqualTo(Jt),kt[ea.selected]=K?.(fr)||kt.selected,bO(Q)){const{from:to,to:Ya}=Q;kt[ea.range_start]=!!(to&&Ya&&i.isSameDay(fr,to)),kt[ea.range_end]=!!(to&&Ya&&i.isSameDay(fr,Ya)),kt[ea.range_middle]=Al(Q,fr,!0,i)}const eo=m6e(kt,E,e.modifiersStyles),Xa=t6e(kt,o,e.modifiersClassNames),Mh=!mn&&!kt.hidden?qe(fr,kt,i.options,i):void 0;return fe.createElement(n.Day,{key:`${i.format(fr,"yyyy-MM-dd")}_${i.format(Jt.displayMonth,"yyyy-MM")}`,day:Jt,modifiers:kt,className:Xa.join(" "),style:eo,role:"gridcell","aria-selected":kt.selected||void 0,"aria-label":Mh,"data-day":i.format(fr,"yyyy-MM-dd"),"data-month":Jt.outside?i.format(fr,"yyyy-MM"):void 0,"data-selected":kt.selected||void 0,"data-disabled":kt.disabled||void 0,"data-hidden":kt.hidden||void 0,"data-outside":Jt.outside||void 0,"data-focused":kt.focused||void 0,"data-today":kt.today||void 0},!kt.hidden&&mn?fe.createElement(n.DayButton,{className:o[ct.DayButton],style:E?.[ct.DayButton],type:"button",day:Jt,modifiers:kt,disabled:kt.disabled||void 0,tabIndex:ne(Jt)?0:-1,"aria-label":Te(fr,kt,i.options,i),onClick:ht(Jt,kt),onBlur:Oe(Jt,kt),onFocus:le(Jt,kt),onKeyDown:Le(Jt,kt),onMouseEnter:nt(Jt,kt),onMouseLeave:Ot(Jt,kt)},A(fr,i.options,i)):!kt.hidden&&A(Jt.date,i.options,i))})))))))),e.footer&&fe.createElement(n.Footer,{className:o[ct.Footer],style:E?.[ct.Footer],role:"status","aria-live":"polite"},e.footer)))}function FA({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:a,...o}){const u=wO();return l.jsx(K6e,{showOutsideDays:n,className:Se("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:h=>h.toLocaleString("default",{month:"short"}),...i},classNames:{root:Se("w-fit",u.root),months:Se("relative flex flex-col gap-4 md:flex-row",u.months),month:Se("flex w-full flex-col gap-4",u.month),nav:Se("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",u.nav),button_previous:Se(vm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",u.button_previous),button_next:Se(vm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",u.button_next),month_caption:Se("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",u.month_caption),dropdowns:Se("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",u.dropdowns),dropdown_root:Se("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",u.dropdown_root),dropdown:Se("bg-popover absolute inset-0 opacity-0",u.dropdown),caption_label:Se("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",u.caption_label),table:"w-full border-collapse",weekdays:Se("flex",u.weekdays),weekday:Se("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",u.weekday),week:Se("mt-2 flex w-full",u.week),week_number_header:Se("w-[--cell-size] select-none",u.week_number_header),week_number:Se("text-muted-foreground select-none text-[0.8rem]",u.week_number),day:Se("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",u.day),range_start:Se("bg-accent rounded-l-md",u.range_start),range_middle:Se("rounded-none",u.range_middle),range_end:Se("bg-accent rounded-r-md",u.range_end),today:Se("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",u.today),outside:Se("text-muted-foreground aria-selected:text-muted-foreground",u.outside),disabled:Se("text-muted-foreground opacity-50",u.disabled),hidden:Se("invisible",u.hidden),...e},components:{Root:({className:h,rootRef:f,...m})=>l.jsx("div",{"data-slot":"calendar",ref:f,className:Se(h),...m}),Chevron:({className:h,orientation:f,...m})=>f==="left"?l.jsx(vu,{className:Se("size-4",h),...m}):f==="right"?l.jsx(yu,{className:Se("size-4",h),...m}):l.jsx(gm,{className:Se("size-4",h),...m}),DayButton:J6e,WeekNumber:({children:h,...f})=>l.jsx("td",{...f,children:l.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...a},...o})}function J6e({className:t,day:e,modifiers:n,...r}){const s=wO(),i=O.useRef(null);return O.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),l.jsx(de,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:Se("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,t),...r})}class eOe{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const e=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${e}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const e=this.getWebSocketUrl();try{this.ws=new WebSocket(e),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const e=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},e)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(e){return this.logCallbacks.add(e),()=>this.logCallbacks.delete(e)}onConnectionChange(e){return this.connectionCallbacks.add(e),e(this.isConnected),()=>this.connectionCallbacks.delete(e)}notifyLog(e){this.logCache.some(r=>r.id===e.id)||(this.logCache.push(e),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(e)}catch(s){console.error("日志回调执行失败:",s)}}))}notifyConnection(e){this.connectionCallbacks.forEach(n=>{try{n(e)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Cd=new eOe;typeof window<"u"&&Cd.connect();const tOe={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},nOe=(t,e,n)=>{let r;const s=tOe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},rOe={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},sOe={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},iOe={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},aOe={date:Ud({formats:rOe,defaultWidth:"full"}),time:Ud({formats:sOe,defaultWidth:"full"}),dateTime:Ud({formats:iOe,defaultWidth:"full"})};function $A(t,e,n){const r="eeee p";return xke(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const lOe={lastWeek:$A,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:$A,other:"PP p"},oOe=(t,e,n,r)=>{const s=lOe[t];return typeof s=="function"?s(e,n,r):s},cOe={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},uOe={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},dOe={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},hOe={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},fOe={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},mOe={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},pOe=(t,e)=>{const n=Number(t);switch(e?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},gOe={ordinalNumber:pOe,era:Ca({values:cOe,defaultWidth:"wide"}),quarter:Ca({values:uOe,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ca({values:dOe,defaultWidth:"wide"}),day:Ca({values:hOe,defaultWidth:"wide"}),dayPeriod:Ca({values:fOe,defaultWidth:"wide",formattingValues:mOe,defaultFormattingWidth:"wide"})},xOe=/^(第\s*)?\d+(日|时|分|秒)?/i,vOe=/\d+/i,yOe={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},bOe={any:[/^(前)/i,/^(公元)/i]},wOe={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},SOe={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},kOe={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},OOe={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},jOe={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},NOe={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},COe={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},TOe={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},EOe={ordinalNumber:JQ({matchPattern:xOe,parsePattern:vOe,valueCallback:t=>parseInt(t,10)}),era:Ta({matchPatterns:yOe,defaultMatchWidth:"wide",parsePatterns:bOe,defaultParseWidth:"any"}),quarter:Ta({matchPatterns:wOe,defaultMatchWidth:"wide",parsePatterns:SOe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Ta({matchPatterns:kOe,defaultMatchWidth:"wide",parsePatterns:OOe,defaultParseWidth:"any"}),day:Ta({matchPatterns:jOe,defaultMatchWidth:"wide",parsePatterns:NOe,defaultParseWidth:"any"}),dayPeriod:Ta({matchPatterns:COe,defaultMatchWidth:"any",parsePatterns:TOe,defaultParseWidth:"any"})},dx={code:"zh-CN",formatDistance:nOe,formatLong:aOe,formatRelative:oOe,localize:gOe,match:EOe,options:{weekStartsOn:1,firstWeekContainsDate:4}};function _Oe(){const[t,e]=O.useState([]),[n,r]=O.useState(""),[s,i]=O.useState("all"),[a,o]=O.useState("all"),[u,h]=O.useState(void 0),[f,m]=O.useState(void 0),[g,x]=O.useState(!0),[y,w]=O.useState(!1),b=O.useRef(null);O.useEffect(()=>{const H=Cd.getAllLogs();e(H);const U=Cd.onLog(()=>{e(Cd.getAllLogs())}),te=Cd.onConnectionChange(z=>{w(z)});return()=>{U(),te()}},[]);const k=O.useMemo(()=>{const H=new Set(t.map(U=>U.module));return Array.from(H).sort()},[t]),N=H=>{switch(H){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},C=H=>{switch(H){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},T=()=>{window.location.reload()},E=()=>{Cd.clearLogs(),e([])},_=()=>{const H=B.map(W=>`${W.timestamp} [${W.level.padEnd(8)}] [${W.module}] ${W.message}`).join(` `),U=new Blob([H],{type:"text/plain;charset=utf-8"}),te=URL.createObjectURL(U),z=document.createElement("a");z.href=te,z.download=`logs-${Qx(new Date,"yyyy-MM-dd-HHmmss")}.txt`,z.click(),URL.revokeObjectURL(te)},A=()=>{x(!g)},F=()=>{h(void 0),m(void 0)},B=O.useMemo(()=>t.filter(H=>{const U=n===""||H.message.toLowerCase().includes(n.toLowerCase())||H.module.toLowerCase().includes(n.toLowerCase()),te=s==="all"||H.level===s,z=a==="all"||H.module===a;let W=!0;if(u||f){const q=new Date(H.timestamp);if(u){const J=new Date(u);J.setHours(0,0,0,0),W=W&&q>=J}if(f){const J=new Date(f);J.setHours(23,59,59,999),W=W&&q<=J}}return U&&te&&z&&W}),[t,n,s,a,u,f]),P=Z3e({count:B.length,getScrollElement:()=>b.current,estimateSize:()=>80,overscan:10});return O.useEffect(()=>{g&&B.length>0&&P.scrollToIndex(B.length-1,{align:"end",behavior:"auto"})},[B.length,g,P]),l.jsx(yn,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:Se("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",y?"bg-green-500 animate-pulse":"bg-red-500")}),l.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:y?"已连接":"未连接"})]})]}),l.jsx(Ct,{className:"p-3 sm:p-4",children:l.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[l.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(js,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Re,{placeholder:"搜索日志...",value:n,onChange:H=>r(H.target.value),className:"pl-9 h-9 text-sm"})]}),l.jsxs(It,{value:s,onValueChange:i,children:[l.jsxs(Pt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[l.jsx(q5,{className:"h-4 w-4 mr-2"}),l.jsx(qt,{placeholder:"级别"})]}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"all",children:"全部级别"}),l.jsx(ze,{value:"DEBUG",children:"DEBUG"}),l.jsx(ze,{value:"INFO",children:"INFO"}),l.jsx(ze,{value:"WARNING",children:"WARNING"}),l.jsx(ze,{value:"ERROR",children:"ERROR"}),l.jsx(ze,{value:"CRITICAL",children:"CRITICAL"})]})]}),l.jsxs(It,{value:a,onValueChange:o,children:[l.jsxs(Pt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[l.jsx(q5,{className:"h-4 w-4 mr-2"}),l.jsx(qt,{placeholder:"模块"})]}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"all",children:"全部模块"}),k.map(H=>l.jsx(ze,{value:H,children:H},H))]})]})]}),l.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[l.jsxs(Wo,{children:[l.jsx(Go,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",className:Se("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!u&&"text-muted-foreground"),children:[l.jsx(C8,{className:"mr-2 h-4 w-4"}),l.jsx("span",{className:"text-xs sm:text-sm",children:u?Qx(u,"PPP",{locale:dx}):"开始日期"})]})}),l.jsx(Fl,{className:"w-auto p-0",align:"start",children:l.jsx(FA,{mode:"single",selected:u,onSelect:h,initialFocus:!0,locale:dx})})]}),l.jsxs(Wo,{children:[l.jsx(Go,{asChild:!0,children:l.jsxs(de,{variant:"outline",size:"sm",className:Se("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!f&&"text-muted-foreground"),children:[l.jsx(C8,{className:"mr-2 h-4 w-4"}),l.jsx("span",{className:"text-xs sm:text-sm",children:f?Qx(f,"PPP",{locale:dx}):"结束日期"})]})}),l.jsx(Fl,{className:"w-auto p-0",align:"start",children:l.jsx(FA,{mode:"single",selected:f,onSelect:m,initialFocus:!0,locale:dx})})]}),(u||f)&&l.jsxs(de,{variant:"outline",size:"sm",onClick:F,className:"w-full sm:w-auto h-9",children:[l.jsx(s0,{className:"h-4 w-4 sm:mr-2"}),l.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),l.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),l.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsxs(de,{variant:g?"default":"outline",size:"sm",onClick:A,className:"flex-1 sm:flex-none h-9",children:[g?l.jsx(HX,{className:"h-4 w-4"}):l.jsx(VX,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:g?"自动滚动":"已暂停"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:T,className:"flex-1 sm:flex-none h-9",children:[l.jsx(hi,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:E,className:"flex-1 sm:flex-none h-9",children:[l.jsx(Kt,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:_,className:"flex-1 sm:flex-none h-9",children:[l.jsx(Jc,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),l.jsx("div",{className:"flex-1 hidden sm:block"}),l.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[l.jsxs("span",{className:"font-mono",children:[B.length," / ",t.length]}),l.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),l.jsx(Ct,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:l.jsx(yn,{viewportRef:b,className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:l.jsx("div",{className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm relative",style:{height:`${P.getTotalSize()}px`},children:B.length===0?l.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):P.getVirtualItems().map(H=>{const U=B[H.index];return l.jsxs("div",{"data-index":H.index,ref:P.measureElement,className:Se("absolute top-0 left-0 w-full py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",C(U.level)),style:{transform:`translateY(${H.start}px)`},children:[l.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:U.timestamp}),l.jsxs("span",{className:Se("text-xs font-semibold",N(U.level)),children:["[",U.level,"]"]})]}),l.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:U.module}),l.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs whitespace-pre-wrap break-words",children:U.message})]}),l.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:U.timestamp}),l.jsxs("span",{className:Se("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",N(U.level)),children:["[",U.level,"]"]}),l.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:U.module}),l.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words text-xs lg:text-sm",children:U.message})]})]},H.key)})})})})]})})}const MOe="Mai-with-u",AOe="plugin-repo",ROe="main",DOe="plugin_details.json";async function zOe(){try{const t=await yt("/api/webui/plugins/fetch-raw",{method:"POST",headers:Et(),body:JSON.stringify({owner:MOe,repo:AOe,branch:ROe,file_path:DOe})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success||!e.data)throw new Error(e.error||"获取插件列表失败");return JSON.parse(e.data).filter(s=>!s?.id||!s?.manifest?(console.warn("跳过无效插件数据:",s),!1):!s.manifest.name||!s.manifest.version?(console.warn("跳过缺少必需字段的插件:",s.id),!1):!0).map(s=>({id:s.id,manifest:{manifest_version:s.manifest.manifest_version||1,name:s.manifest.name,version:s.manifest.version,description:s.manifest.description||"",author:s.manifest.author||{name:"Unknown"},license:s.manifest.license||"Unknown",host_application:s.manifest.host_application||{min_version:"0.0.0"},homepage_url:s.manifest.homepage_url,repository_url:s.manifest.repository_url,keywords:s.manifest.keywords||[],categories:s.manifest.categories||[],default_locale:s.manifest.default_locale||"zh-CN",locales_path:s.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(t){throw console.error("Failed to fetch plugin list:",t),t}}async function POe(){try{const t=await yt("/api/webui/plugins/git-status");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to check Git status:",t),{installed:!1,error:"无法检测 Git 安装状态"}}}async function LOe(){try{const t=await yt("/api/webui/plugins/version");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to get Maimai version:",t),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function BOe(t,e,n){const r=t.split(".").map(o=>parseInt(o)||0),s=r[0]||0,i=r[1]||0,a=r[2]||0;if(n.version_majorparseInt(m)||0),u=o[0]||0,h=o[1]||0,f=o[2]||0;if(n.version_major>u||n.version_major===u&&n.version_minor>h||n.version_major===u&&n.version_minor===h&&n.version_patch>f)return!1}return!0}function IOe(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const a=JSON.parse(i.data);t(a)}catch(a){console.error("Failed to parse progress data:",a)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function hx(){try{const t=await yt("/api/webui/plugins/installed",{headers:Et()});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success)throw new Error(e.message||"获取已安装插件列表失败");return e.plugins||[]}catch(t){return console.error("Failed to get installed plugins:",t),[]}}function fx(t,e){return e.some(n=>n.id===t)}function mx(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function qOe(t,e,n="main"){const r=await yt("/api/webui/plugins/install",{method:"POST",headers:Et(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"安装失败")}return await r.json()}async function FOe(t){const e=await yt("/api/webui/plugins/uninstall",{method:"POST",headers:Et(),body:JSON.stringify({plugin_id:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"卸载失败")}return await e.json()}async function $Oe(t,e,n="main"){const r=await yt("/api/webui/plugins/update",{method:"POST",headers:Et(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"更新失败")}return await r.json()}const I0="https://maibot-plugin-stats.maibot-webui.workers.dev";async function xH(t){try{const e=await fetch(`${I0}/stats/${t}`);return e.ok?await e.json():(console.error("Failed to fetch plugin stats:",e.statusText),null)}catch(e){return console.error("Error fetching plugin stats:",e),null}}async function QOe(t,e){try{const n=e||SO(),r=await fetch(`${I0}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function HOe(t,e){try{const n=e||SO(),r=await fetch(`${I0}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function VOe(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||SO(),i=await fetch(`${I0}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),a=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...a}:{success:!1,error:a.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function UOe(t){try{const e=await fetch(`${I0}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t})}),n=await e.json();return e.status===429?(console.warn("Download recording rate limited"),{success:!0}):e.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(e){return console.error("Error recording download:",e),{success:!1,error:"网络错误"}}}function WOe(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const k=await xH(t);k&&r(k),i(!1)};O.useEffect(()=>{x()},[t]);const y=async()=>{const k=await QOe(t);k.success?(g({title:"已点赞",description:"感谢你的支持!"}),x()):g({title:"点赞失败",description:k.error||"未知错误",variant:"destructive"})},w=async()=>{const k=await HOe(t);k.success?(g({title:"已反馈",description:"感谢你的反馈!"}),x()):g({title:"操作失败",description:k.error||"未知错误",variant:"destructive"})},b=async()=>{if(a===0){g({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const k=await VOe(t,a,u||void 0);k.success?(g({title:"评分成功",description:"感谢你的评价!"}),m(!1),o(0),h(""),x()):g({title:"评分失败",description:k.error||"未知错误",variant:"destructive"})};return s?l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Jc,{className:"h-4 w-4"}),l.jsx("span",{children:"-"})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(zo,{className:"h-4 w-4"}),l.jsx("span",{children:"-"})]})]}):n?e?l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[l.jsx(Jc,{className:"h-4 w-4"}),l.jsx("span",{children:n.downloads.toLocaleString()})]}),l.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[l.jsx(zo,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsx("span",{children:n.rating.toFixed(1)})]}),l.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[l.jsx(c2,{className:"h-4 w-4"}),l.jsx("span",{children:n.likes})]})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(Jc,{className:"h-5 w-5 text-muted-foreground mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(zo,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),l.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),l.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(c2,{className:"h-5 w-5 text-green-500 mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.likes}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(T8,{className:"h-5 w-5 text-red-500 mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(de,{variant:"outline",size:"sm",onClick:y,children:[l.jsx(c2,{className:"h-4 w-4 mr-1"}),"点赞"]}),l.jsxs(de,{variant:"outline",size:"sm",onClick:w,children:[l.jsx(T8,{className:"h-4 w-4 mr-1"}),"点踩"]}),l.jsxs(Mr,{open:f,onOpenChange:m,children:[l.jsx(wk,{asChild:!0,children:l.jsxs(de,{variant:"default",size:"sm",children:[l.jsx(zo,{className:"h-4 w-4 mr-1"}),"评分"]})}),l.jsxs(vr,{children:[l.jsxs(yr,{children:[l.jsx(br,{children:"为插件评分"}),l.jsx(as,{children:"分享你的使用体验,帮助其他用户"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"flex flex-col items-center gap-2",children:[l.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(k=>l.jsx("button",{onClick:()=>o(k),className:"focus:outline-none",children:l.jsx(zo,{className:`h-8 w-8 transition-colors ${k<=a?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},k))}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[a===0&&"点击星星进行评分",a===1&&"很差",a===2&&"一般",a===3&&"还行",a===4&&"不错",a===5&&"非常好"]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),l.jsx(Rn,{value:u,onChange:k=>h(k.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),l.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[u.length," / 500"]})]})]}),l.jsxs(Ns,{children:[l.jsx(de,{variant:"outline",onClick:()=>m(!1),children:"取消"}),l.jsx(de,{onClick:b,disabled:a===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),l.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((k,N)=>l.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(C=>l.jsx(zo,{className:`h-3 w-3 ${C<=k.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},C))}),l.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(k.created_at).toLocaleDateString()})]}),k.comment&&l.jsx("p",{className:"text-sm text-muted-foreground",children:k.comment})]},N))})]})]}):null}const QA={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function XOe(){const t=aa(),[e,n]=O.useState(null),[r,s]=O.useState(""),[i,a]=O.useState("all"),[o,u]=O.useState("all"),[h,f]=O.useState(!0),[m,g]=O.useState([]),[x,y]=O.useState(!0),[w,b]=O.useState(null),[k,N]=O.useState(null),[C,T]=O.useState(null),[E,_]=O.useState(null),[,A]=O.useState([]),[F,B]=O.useState({}),{toast:P}=$r(),H=async R=>{const re=R.map(async Q=>{try{const $=await xH(Q.id);return{id:Q.id,stats:$}}catch($){return console.warn(`Failed to load stats for ${Q.id}:`,$),{id:Q.id,stats:null}}}),K=await Promise.all(re),I={};K.forEach(({id:Q,stats:$})=>{$&&(I[Q]=$)}),B(I)};O.useEffect(()=>{let R=null,re=!1;return(async()=>{if(R=IOe(I=>{re||(T(I),I.stage==="success"?setTimeout(()=>{re||T(null)},2e3):I.stage==="error"&&(y(!1),b(I.error||"加载失败")))},I=>{console.error("WebSocket error:",I),re||P({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(I=>{if(!R){I();return}const Q=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),I()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),I()):setTimeout(Q,100)};Q()}),!re){const I=await POe();N(I),I.installed||P({title:"Git 未安装",description:I.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!re){const I=await LOe();_(I)}if(!re)try{y(!0),b(null);const I=await zOe();if(!re){const Q=await hx();A(Q);const $=I.map(Z=>{const ne=fx(Z.id,Q),ge=mx(Z.id,Q);return{...Z,installed:ne,installed_version:ge}});for(const Z of Q)!$.some(ge=>ge.id===Z.id)&&Z.manifest&&$.push({id:Z.id,manifest:{manifest_version:Z.manifest.manifest_version||1,name:Z.manifest.name,version:Z.manifest.version,description:Z.manifest.description||"",author:Z.manifest.author,license:Z.manifest.license||"Unknown",host_application:Z.manifest.host_application,homepage_url:Z.manifest.homepage_url,repository_url:Z.manifest.repository_url,keywords:Z.manifest.keywords||[],categories:Z.manifest.categories||[],default_locale:Z.manifest.default_locale||"zh-CN",locales_path:Z.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Z.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});g($),H($)}}catch(I){if(!re){const Q=I instanceof Error?I.message:"加载插件列表失败";b(Q),P({title:"加载失败",description:Q,variant:"destructive"})}}finally{re||y(!1)}})(),()=>{re=!0,R&&R.close()}},[P]);const U=R=>{if(!R.installed&&E&&!te(R))return l.jsxs(kn,{variant:"destructive",className:"gap-1",children:[l.jsx(su,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const re=R.installed_version?.trim(),K=R.manifest.version?.trim();if(re!==K){const I=re?.split(".").map(Number)||[0,0,0],Q=K?.split(".").map(Number)||[0,0,0];for(let $=0;$<3;$++){if((Q[$]||0)>(I[$]||0))return l.jsxs(kn,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[l.jsx(su,{className:"h-3 w-3"}),"可更新"]});if((Q[$]||0)<(I[$]||0))break}}return l.jsxs(kn,{variant:"default",className:"gap-1",children:[l.jsx(Ea,{className:"h-3 w-3"}),"已安装"]})}return null},te=R=>!E||!R.manifest?.host_application?!0:BOe(R.manifest.host_application.min_version,R.manifest.host_application.max_version,E),z=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const re=R.installed_version.trim(),K=R.manifest.version.trim();if(re===K)return!1;const I=re.split(".").map(Number),Q=K.split(".").map(Number);for(let $=0;$<3;$++){if((Q[$]||0)>(I[$]||0))return!0;if((Q[$]||0)<(I[$]||0))return!1}return!1},W=m.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const re=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some($=>$.toLowerCase().includes(r.toLowerCase())),K=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let I=!0;o==="installed"?I=R.installed===!0:o==="updates"&&(I=R.installed===!0&&z(R));const Q=!h||!E||te(R);return re&&K&&I&&Q}),q=()=>{n(null)},J=async R=>{if(!k?.installed){P({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(E&&!te(R)){P({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await qOe(R.id,R.manifest.repository_url||"","main"),UOe(R.id).catch(K=>{console.warn("Failed to record download:",K)}),P({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const re=await hx();A(re),g(K=>K.map(I=>{if(I.id===R.id){const Q=fx(I.id,re),$=mx(I.id,re);return{...I,installed:Q,installed_version:$}}return I}))}catch(re){P({title:"安装失败",description:re instanceof Error?re.message:"未知错误",variant:"destructive"})}},ee=async R=>{try{await FOe(R.id),P({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const re=await hx();A(re),g(K=>K.map(I=>{if(I.id===R.id){const Q=fx(I.id,re),$=mx(I.id,re);return{...I,installed:Q,installed_version:$}}return I}))}catch(re){P({title:"卸载失败",description:re instanceof Error?re.message:"未知错误",variant:"destructive"})}},Y=async R=>{if(!k?.installed){P({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const re=await $Oe(R.id,R.manifest.repository_url||"","main");P({title:"更新成功",description:`${R.manifest.name} 已从 ${re.old_version} 更新到 ${re.new_version}`});const K=await hx();A(K),g(I=>I.map(Q=>{if(Q.id===R.id){const $=fx(Q.id,K),Z=mx(Q.id,K);return{...Q,installed:$,installed_version:Z}}return Q}))}catch(re){P({title:"更新失败",description:re instanceof Error?re.message:"未知错误",variant:"destructive"})}};return l.jsx(yn,{className:"h-full",children:l.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),l.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),l.jsxs(de,{onClick:()=>t({to:"/plugin-mirrors"}),children:[l.jsx(UX,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),k&&!k.installed&&l.jsxs(Ct,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[l.jsx(xn,{children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Rd,{className:"h-5 w-5 text-orange-600"}),l.jsxs("div",{children:[l.jsx(vn,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),l.jsx(Lr,{className:"text-orange-800 dark:text-orange-200",children:k.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),l.jsx(Tn,{children:l.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",l.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),l.jsx(Ct,{className:"p-4",children:l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(js,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Re,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),l.jsxs(It,{value:i,onValueChange:a,children:[l.jsx(Pt,{className:"w-full sm:w-[200px]",children:l.jsx(qt,{placeholder:"选择分类"})}),l.jsxs(Lt,{children:[l.jsx(ze,{value:"all",children:"全部分类"}),l.jsx(ze,{value:"Group Management",children:"群组管理"}),l.jsx(ze,{value:"Entertainment & Interaction",children:"娱乐互动"}),l.jsx(ze,{value:"Utility Tools",children:"实用工具"}),l.jsx(ze,{value:"Content Generation",children:"内容生成"}),l.jsx(ze,{value:"Multimedia",children:"多媒体"}),l.jsx(ze,{value:"External Integration",children:"外部集成"}),l.jsx(ze,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),l.jsx(ze,{value:"Other",children:"其他"})]})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ms,{id:"compatible-only",checked:h,onCheckedChange:R=>f(R===!0)}),l.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),l.jsx(ql,{value:o,onValueChange:u,className:"w-full",children:l.jsxs(La,{className:"grid w-full grid-cols-3",children:[l.jsxs(Zt,{value:"all",children:["全部插件 (",m.filter(R=>{if(!R.manifest)return!1;const re=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(Q=>Q.toLowerCase().includes(r.toLowerCase())),K=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),I=!h||!E||te(R);return re&&K&&I}).length,")"]}),l.jsxs(Zt,{value:"installed",children:["已安装 (",m.filter(R=>{if(!R.manifest)return!1;const re=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(Q=>Q.toLowerCase().includes(r.toLowerCase())),K=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),I=!h||!E||te(R);return R.installed&&re&&K&&I}).length,")"]}),l.jsxs(Zt,{value:"updates",children:["可更新 (",m.filter(R=>{if(!R.manifest)return!1;const re=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(Q=>Q.toLowerCase().includes(r.toLowerCase())),K=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),I=!h||!E||te(R);return R.installed&&z(R)&&re&&K&&I}).length,")"]})]})}),C&&C.stage==="loading"&&l.jsx(Ct,{className:"p-4",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(xm,{className:"h-4 w-4 animate-spin"}),l.jsxs("span",{className:"text-sm font-medium",children:[C.operation==="fetch"&&"加载插件列表",C.operation==="install"&&`安装插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="uninstall"&&`卸载插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="update"&&`更新插件${C.plugin_id?`: ${C.plugin_id}`:""}`]})]}),l.jsxs("span",{className:"text-sm font-medium",children:[C.progress,"%"]})]}),l.jsx(h0,{value:C.progress,className:"h-2"}),l.jsx("div",{className:"text-xs text-muted-foreground",children:C.message}),C.operation==="fetch"&&C.total_plugins>0&&l.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",C.loaded_plugins," / ",C.total_plugins," 个插件"]})]})}),C&&C.stage==="error"&&C.error&&l.jsx(Ct,{className:"border-destructive bg-destructive/10",children:l.jsx(xn,{children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Rd,{className:"h-5 w-5 text-destructive"}),l.jsxs("div",{children:[l.jsx(vn,{className:"text-lg text-destructive",children:"加载失败"}),l.jsx(Lr,{className:"text-destructive/80",children:C.error})]})]})})}),x?l.jsxs("div",{className:"flex items-center justify-center py-12",children:[l.jsx(xm,{className:"h-8 w-8 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):w?l.jsx(Ct,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(Rd,{className:"h-12 w-12 text-destructive mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:w}),l.jsx(de,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):W.length===0?l.jsx(Ct,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(js,{className:"h-12 w-12 text-muted-foreground mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:W.map(R=>l.jsxs(Ct,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[l.jsxs(xn,{children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsx(vn,{className:"text-xl",children:R.manifest?.name||R.id}),l.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&l.jsx(kn,{variant:"secondary",className:"text-xs whitespace-nowrap",children:QA[R.manifest.categories[0]]||R.manifest.categories[0]}),U(R)]})]}),l.jsx(Lr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),l.jsx(Tn,{className:"flex-1",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Jc,{className:"h-4 w-4"}),l.jsx("span",{children:(F[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(zo,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsx("span",{children:(F[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(re=>l.jsx(kn,{variant:"outline",className:"text-xs",children:re},re)),R.manifest?.keywords&&R.manifest.keywords.length>3&&l.jsxs(kn,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),l.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[l.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{children:"支持:"}),l.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),l.jsx(xD,{className:"pt-4",children:l.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[l.jsx(de,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?z(R)?l.jsxs(de,{size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>Y(R),children:[l.jsx(hi,{className:"h-4 w-4 mr-1"}),"更新"]}):l.jsxs(de,{variant:"destructive",size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>ee(R),children:[l.jsx(Kt,{className:"h-4 w-4 mr-1"}),"卸载"]}):l.jsxs(de,{size:"sm",disabled:!k?.installed||C?.operation==="install"||E!==null&&!te(R),title:k?.installed?E!==null&&!te(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${E?.version})`:void 0:"Git 未安装",onClick:()=>J(R),children:[l.jsx(Jc,{className:"h-4 w-4 mr-1"}),C?.operation==="install"&&C?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),l.jsx(Mr,{open:e!==null,onOpenChange:q,children:e&&e.manifest&&l.jsxs(vr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsx(yr,{children:l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"space-y-2 flex-1",children:[l.jsx(br,{className:"text-2xl",children:e.manifest.name}),l.jsxs(as,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&l.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:l.jsx(nm,{className:"h-3 w-3 inline"})})]})]}),l.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&l.jsx(kn,{variant:"secondary",children:QA[e.manifest.categories[0]]||e.manifest.categories[0]}),U(e)]})]})}),l.jsxs("div",{className:"space-y-6",children:[l.jsx(GOe,{pluginId:e.id}),l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"版本"}),l.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"下载量"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:(F[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"评分"}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(zo,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[(F[e.id]?.rating??e.rating??0).toFixed(1)," (",F[e.id]?.rating_count??e.review_count??0,")"]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"许可证"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),l.jsxs("div",{className:"col-span-2",children:[l.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),l.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>l.jsx(kn,{variant:"outline",children:R},R))})]}),e.detailed_description&&l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),l.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),l.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"font-medium",children:"主页: "}),l.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"font-medium",children:"仓库: "}),l.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),l.jsxs(Ns,{children:[e.manifest.homepage_url&&l.jsxs(de,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[l.jsx(nm,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&l.jsxs(de,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[l.jsx(nm,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function YOe(){return l.jsx(yn,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(de,{variant:"outline",size:"sm",children:[l.jsx(hi,{className:"h-4 w-4 mr-2"}),"刷新"]}),l.jsxs(de,{size:"sm",children:[l.jsx(Zc,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[l.jsxs(Ct,{children:[l.jsxs(xn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(vn,{className:"text-sm font-medium",children:"已安装插件"}),l.jsx(Wx,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(Tn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(vn,{className:"text-sm font-medium",children:"已启用"}),l.jsx(Ea,{className:"h-4 w-4 text-green-600"})]}),l.jsxs(Tn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(vn,{className:"text-sm font-medium",children:"已禁用"}),l.jsx(su,{className:"h-4 w-4 text-orange-600"})]}),l.jsxs(Tn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(vn,{className:"text-sm font-medium",children:"可更新"}),l.jsx(hi,{className:"h-4 w-4 text-blue-600"})]}),l.jsxs(Tn,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),l.jsxs(Ct,{children:[l.jsxs(xn,{children:[l.jsx(vn,{children:"已安装的插件"}),l.jsx(Lr,{children:"查看和管理已安装插件的配置"})]}),l.jsx(Tn,{children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[l.jsx(Wx,{className:"h-16 w-16 text-muted-foreground/50"}),l.jsxs("div",{className:"text-center space-y-2",children:[l.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),l.jsx("div",{className:"flex gap-2",children:l.jsx(de,{variant:"outline",asChild:!0,children:l.jsxs("a",{href:"/plugins",children:[l.jsx(nm,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),l.jsx(Ct,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:l.jsx(Tn,{className:"pt-6",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(su,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),l.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",l.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function ZOe(){const t=aa(),{toast:e}=$r(),[n,r]=O.useState([]),[s,i]=O.useState(!0),[a,o]=O.useState(null),[u,h]=O.useState(null),[f,m]=O.useState(!1),[g,x]=O.useState(!1),[y,w]=O.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),b=O.useCallback(async()=>{try{i(!0),o(null);const A=localStorage.getItem("access-token"),F=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${A}`}});if(!F.ok)throw new Error("获取镜像源列表失败");const B=await F.json();r(B.mirrors||[])}catch(A){const F=A instanceof Error?A.message:"加载镜像源失败";o(F),e({title:"加载失败",description:F,variant:"destructive"})}finally{i(!1)}},[e]);O.useEffect(()=>{b()},[b]);const k=async()=>{try{const A=localStorage.getItem("access-token"),F=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"},body:JSON.stringify(y)});if(!F.ok){const B=await F.json();throw new Error(B.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),m(!1),w({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),b()}catch(A){e({title:"添加失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},N=async()=>{if(u)try{const A=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${u.id}`,{method:"PUT",headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"},body:JSON.stringify({name:y.name,raw_prefix:y.raw_prefix,clone_prefix:y.clone_prefix,enabled:y.enabled,priority:y.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),x(!1),h(null),b()}catch(A){e({title:"更新失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},C=async A=>{if(confirm("确定要删除这个镜像源吗?"))try{const F=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A}`,{method:"DELETE",headers:{Authorization:`Bearer ${F}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),b()}catch(F){e({title:"删除失败",description:F instanceof Error?F.message:"未知错误",variant:"destructive"})}},T=async A=>{try{const F=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",headers:{Authorization:`Bearer ${F}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!A.enabled})})).ok)throw new Error("更新状态失败");b()}catch(F){e({title:"更新失败",description:F instanceof Error?F.message:"未知错误",variant:"destructive"})}},E=A=>{h(A),w({id:A.id,name:A.name,raw_prefix:A.raw_prefix,clone_prefix:A.clone_prefix,enabled:A.enabled,priority:A.priority}),x(!0)},_=async(A,F)=>{const B=F==="up"?A.priority-1:A.priority+1;if(!(B<1))try{const P=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",headers:{Authorization:`Bearer ${P}`,"Content-Type":"application/json"},body:JSON.stringify({priority:B})})).ok)throw new Error("更新优先级失败");b()}catch(P){e({title:"更新失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}};return l.jsx(yn,{className:"h-full",children:l.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx(de,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:l.jsx(_R,{className:"h-5 w-5"})}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),l.jsxs(de,{onClick:()=>m(!0),children:[l.jsx(is,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?l.jsx(Ct,{className:"p-6",children:l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx(xm,{className:"h-8 w-8 animate-spin text-primary"})})}):a?l.jsx(Ct,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(Rd,{className:"h-12 w-12 text-destructive mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:a}),l.jsx(de,{onClick:b,children:"重新加载"})]})}):l.jsxs(Ct,{children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(bu,{children:[l.jsx(wu,{children:l.jsxs(_r,{children:[l.jsx(jt,{children:"状态"}),l.jsx(jt,{children:"名称"}),l.jsx(jt,{children:"ID"}),l.jsx(jt,{children:"优先级"}),l.jsx(jt,{className:"text-right",children:"操作"})]})}),l.jsx(Su,{children:n.map(A=>l.jsxs(_r,{children:[l.jsx(gt,{children:l.jsx(Dt,{checked:A.enabled,onCheckedChange:()=>T(A)})}),l.jsx(gt,{children:l.jsxs("div",{children:[l.jsx("div",{className:"font-medium",children:A.name}),l.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",A.raw_prefix]})]})}),l.jsx(gt,{children:l.jsx(kn,{variant:"outline",children:A.id})}),l.jsx(gt,{children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-mono",children:A.priority}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx(de,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>_(A,"up"),disabled:A.priority===1,children:l.jsx(I5,{className:"h-3 w-3"})}),l.jsx(de,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>_(A,"down"),children:l.jsx(gm,{className:"h-3 w-3"})})]})]})}),l.jsx(gt,{className:"text-right",children:l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.jsx(de,{variant:"ghost",size:"icon",onClick:()=>E(A),children:l.jsx(Wd,{className:"h-4 w-4"})}),l.jsx(de,{variant:"ghost",size:"icon",onClick:()=>C(A.id),children:l.jsx(Kt,{className:"h-4 w-4 text-destructive"})})]})})]},A.id))})]})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(A=>l.jsx(Ct,{className:"p-4",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h3",{className:"font-semibold",children:A.name}),A.enabled&&l.jsx(kn,{variant:"default",className:"text-xs",children:"启用"})]}),l.jsx(kn,{variant:"outline",className:"mt-1 text-xs",children:A.id})]}),l.jsx(Dt,{checked:A.enabled,onCheckedChange:()=>T(A)})]}),l.jsxs("div",{className:"text-sm space-y-1",children:[l.jsxs("div",{className:"text-muted-foreground",children:[l.jsx("span",{className:"font-medium",children:"Raw: "}),l.jsx("span",{className:"break-all",children:A.raw_prefix})]}),l.jsxs("div",{className:"text-muted-foreground",children:[l.jsx("span",{className:"font-medium",children:"优先级: "}),l.jsx("span",{className:"font-mono",children:A.priority})]})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[l.jsxs(de,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>E(A),children:[l.jsx(Wd,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>_(A,"up"),disabled:A.priority===1,children:l.jsx(I5,{className:"h-4 w-4"})}),l.jsx(de,{variant:"outline",size:"sm",onClick:()=>_(A,"down"),children:l.jsx(gm,{className:"h-4 w-4"})}),l.jsx(de,{variant:"destructive",size:"sm",onClick:()=>C(A.id),children:l.jsx(Kt,{className:"h-4 w-4"})})]})]})},A.id))})]}),l.jsx(Mr,{open:f,onOpenChange:m,children:l.jsxs(vr,{className:"max-w-lg",children:[l.jsxs(yr,{children:[l.jsx(br,{children:"添加镜像源"}),l.jsx(as,{children:"添加新的 Git 镜像源配置"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"add-id",children:"镜像源 ID *"}),l.jsx(Re,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:A=>w({...y,id:A.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"add-name",children:"名称 *"}),l.jsx(Re,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:A=>w({...y,name:A.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),l.jsx(Re,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:A=>w({...y,raw_prefix:A.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"add-clone",children:"克隆前缀 *"}),l.jsx(Re,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:A=>w({...y,clone_prefix:A.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"add-priority",children:"优先级"}),l.jsx(Re,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:A=>w({...y,priority:parseInt(A.target.value)||1})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"add-enabled",checked:y.enabled,onCheckedChange:A=>w({...y,enabled:A})}),l.jsx(ce,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),l.jsxs(Ns,{children:[l.jsx(de,{variant:"outline",onClick:()=>m(!1),children:"取消"}),l.jsx(de,{onClick:k,children:"添加"})]})]})}),l.jsx(Mr,{open:g,onOpenChange:x,children:l.jsxs(vr,{className:"max-w-lg",children:[l.jsxs(yr,{children:[l.jsx(br,{children:"编辑镜像源"}),l.jsx(as,{children:"修改镜像源配置"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{children:"镜像源 ID"}),l.jsx(Re,{value:y.id,disabled:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"edit-name",children:"名称 *"}),l.jsx(Re,{id:"edit-name",value:y.name,onChange:A=>w({...y,name:A.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),l.jsx(Re,{id:"edit-raw",value:y.raw_prefix,onChange:A=>w({...y,raw_prefix:A.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"edit-clone",children:"克隆前缀 *"}),l.jsx(Re,{id:"edit-clone",value:y.clone_prefix,onChange:A=>w({...y,clone_prefix:A.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ce,{htmlFor:"edit-priority",children:"优先级"}),l.jsx(Re,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:A=>w({...y,priority:parseInt(A.target.value)||1})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Dt,{id:"edit-enabled",checked:y.enabled,onCheckedChange:A=>w({...y,enabled:A})}),l.jsx(ce,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),l.jsxs(Ns,{children:[l.jsx(de,{variant:"outline",onClick:()=>x(!1),children:"取消"}),l.jsx(de,{onClick:N,children:"保存"})]})]})})]})})}const KOe=bh("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),vH=O.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>l.jsx("kbd",{className:Se(KOe({size:e,className:t})),ref:i,...s,children:n?l.jsx("abbr",{title:n,children:r}):r}));vH.displayName="Kbd";const JOe=[{icon:Hx,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Dl,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:AR,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:RR,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:sk,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:r0,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:DR,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:WX,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:Wx,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Vx,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Zc,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function eje({open:t,onOpenChange:e}){const[n,r]=O.useState(""),[s,i]=O.useState(0),a=aa(),o=JOe.filter(f=>f.title.toLowerCase().includes(n.toLowerCase())||f.description.toLowerCase().includes(n.toLowerCase())||f.category.toLowerCase().includes(n.toLowerCase()));O.useEffect(()=>{t&&(r(""),i(0))},[t]);const u=O.useCallback(f=>{a({to:f}),e(!1)},[a,e]),h=O.useCallback(f=>{f.key==="ArrowDown"?(f.preventDefault(),i(m=>(m+1)%o.length)):f.key==="ArrowUp"?(f.preventDefault(),i(m=>(m-1+o.length)%o.length)):f.key==="Enter"&&o[s]&&(f.preventDefault(),u(o[s].path))},[o,s,u]);return l.jsx(Mr,{open:t,onOpenChange:e,children:l.jsxs(vr,{className:"max-w-2xl p-0 gap-0",children:[l.jsxs(yr,{className:"px-4 pt-4 pb-0",children:[l.jsx(br,{className:"sr-only",children:"搜索"}),l.jsxs("div",{className:"relative",children:[l.jsx(js,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),l.jsx(Re,{value:n,onChange:f=>{r(f.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),l.jsx("div",{className:"border-t",children:l.jsx(yn,{className:"h-[400px]",children:o.length>0?l.jsx("div",{className:"p-2",children:o.map((f,m)=>{const g=f.icon;return l.jsxs("button",{onClick:()=>u(f.path),onMouseEnter:()=>i(m),className:Se("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",m===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[l.jsx(g,{className:"h-5 w-5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-sm",children:f.title}),l.jsx("div",{className:"text-xs text-muted-foreground truncate",children:f.description})]}),l.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:f.category})]},f.path)})}):l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[l.jsx(js,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),l.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function tje(t){const e=nje(t),n=O.forwardRef((r,s)=>{const{children:i,...a}=r,o=O.Children.toArray(i),u=o.find(sje);if(u){const h=u.props.children,f=o.map(m=>m===u?O.Children.count(h)>1?O.Children.only(null):O.isValidElement(h)?h.props.children:null:m);return l.jsx(e,{...a,ref:s,children:O.isValidElement(h)?O.cloneElement(h,void 0,f):null})}return l.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function nje(t){const e=O.forwardRef((n,r)=>{const{children:s,...i}=n;if(O.isValidElement(s)){const a=aje(s),o=ije(i,s.props);return s.type!==O.Fragment&&(o.ref=r?Uo(r,a):a),O.cloneElement(s,o)}return O.Children.count(s)>1?O.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var rje=Symbol("radix.slottable");function sje(t){return O.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===rje}function ije(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...o)=>{const u=i(...o);return s(...o),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function aje(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var DS=["Enter"," "],lje=["ArrowDown","PageUp","Home"],yH=["ArrowUp","PageDown","End"],oje=[...lje,...yH],cje={ltr:[...DS,"ArrowRight"],rtl:[...DS,"ArrowLeft"]},uje={ltr:["ArrowLeft"],rtl:["ArrowRight"]},q0="Menu",[Jm,dje,hje]=Q1(q0),[Tu,bH]=la(q0,[hje,ph,tv]),F0=ph(),wH=tv(),[SH,mc]=Tu(q0),[fje,$0]=Tu(q0),kH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:a=!0}=t,o=F0(e),[u,h]=O.useState(null),f=O.useRef(!1),m=us(i),g=n0(s);return O.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),l.jsx(W1,{...o,children:l.jsx(SH,{scope:e,open:n,onOpenChange:m,content:u,onContentChange:h,children:l.jsx(fje,{scope:e,onClose:O.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:g,modal:a,children:r})})})};kH.displayName=q0;var mje="MenuAnchor",kO=O.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=F0(n);return l.jsx(G1,{...s,...r,ref:e})});kO.displayName=mje;var OO="MenuPortal",[pje,OH]=Tu(OO,{forceMount:void 0}),jH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=mc(OO,e);return l.jsx(pje,{scope:e,forceMount:n,children:l.jsx(Ws,{present:n||i.open,children:l.jsx(U1,{asChild:!0,container:s,children:r})})})};jH.displayName=OO;var qi="MenuContent",[gje,jO]=Tu(qi),NH=O.forwardRef((t,e)=>{const n=OH(qi,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=mc(qi,t.__scopeMenu),a=$0(qi,t.__scopeMenu);return l.jsx(Jm.Provider,{scope:t.__scopeMenu,children:l.jsx(Ws,{present:r||i.open,children:l.jsx(Jm.Slot,{scope:t.__scopeMenu,children:a.modal?l.jsx(xje,{...s,ref:e}):l.jsx(vje,{...s,ref:e})})})})}),xje=O.forwardRef((t,e)=>{const n=mc(qi,t.__scopeMenu),r=O.useRef(null),s=Pn(e,r);return O.useEffect(()=>{const i=r.current;if(i)return wR(i)},[]),l.jsx(NO,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Xe(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),vje=O.forwardRef((t,e)=>{const n=mc(qi,t.__scopeMenu);return l.jsx(NO,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),yje=tje("MenuContent.ScrollLock"),NO=O.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEntryFocus:u,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,disableOutsideScroll:y,...w}=t,b=mc(qi,n),k=$0(qi,n),N=F0(n),C=wH(n),T=dje(n),[E,_]=O.useState(null),A=O.useRef(null),F=Pn(e,A,b.onContentChange),B=O.useRef(0),P=O.useRef(""),H=O.useRef(0),U=O.useRef(null),te=O.useRef("right"),z=O.useRef(0),W=y?SR:O.Fragment,q=y?{as:yje,allowPinchZoom:!0}:void 0,J=Y=>{const R=P.current+Y,re=T().filter(ne=>!ne.disabled),K=document.activeElement,I=re.find(ne=>ne.ref.current===K)?.textValue,Q=re.map(ne=>ne.textValue),$=Mje(Q,R,I),Z=re.find(ne=>ne.textValue===$)?.ref.current;(function ne(ge){P.current=ge,window.clearTimeout(B.current),ge!==""&&(B.current=window.setTimeout(()=>ne(""),1e3))})(R),Z&&setTimeout(()=>Z.focus())};O.useEffect(()=>()=>window.clearTimeout(B.current),[]),kR();const ee=O.useCallback(Y=>te.current===U.current?.side&&Rje(Y,U.current?.area),[]);return l.jsx(gje,{scope:n,searchRef:P,onItemEnter:O.useCallback(Y=>{ee(Y)&&Y.preventDefault()},[ee]),onItemLeave:O.useCallback(Y=>{ee(Y)||(A.current?.focus(),_(null))},[ee]),onTriggerLeave:O.useCallback(Y=>{ee(Y)&&Y.preventDefault()},[ee]),pointerGraceTimerRef:H,onPointerGraceIntentChange:O.useCallback(Y=>{U.current=Y},[]),children:l.jsx(W,{...q,children:l.jsx(OR,{asChild:!0,trapped:s,onMountAutoFocus:Xe(i,Y=>{Y.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:l.jsx(tk,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,children:l.jsx(kD,{asChild:!0,...C,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:_,onEntryFocus:Xe(u,Y=>{k.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(nk,{role:"menu","aria-orientation":"vertical","data-state":QH(b.open),"data-radix-menu-content":"",dir:k.dir,...N,...w,ref:F,style:{outline:"none",...w.style},onKeyDown:Xe(w.onKeyDown,Y=>{const re=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,K=Y.ctrlKey||Y.altKey||Y.metaKey,I=Y.key.length===1;re&&(Y.key==="Tab"&&Y.preventDefault(),!K&&I&&J(Y.key));const Q=A.current;if(Y.target!==Q||!oje.includes(Y.key))return;Y.preventDefault();const Z=T().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);yH.includes(Y.key)&&Z.reverse(),Eje(Z)}),onBlur:Xe(t.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(B.current),P.current="")}),onPointerMove:Xe(t.onPointerMove,e0(Y=>{const R=Y.target,re=z.current!==Y.clientX;if(Y.currentTarget.contains(R)&&re){const K=Y.clientX>z.current?"right":"left";te.current=K,z.current=Y.clientX}}))})})})})})})});NH.displayName=qi;var bje="MenuGroup",CO=O.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(fn.div,{role:"group",...r,ref:e})});CO.displayName=bje;var wje="MenuLabel",CH=O.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(fn.div,{...r,ref:e})});CH.displayName=wje;var I1="MenuItem",HA="menu.itemSelect",Wv=O.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=O.useRef(null),a=$0(I1,t.__scopeMenu),o=jO(I1,t.__scopeMenu),u=Pn(e,i),h=O.useRef(!1),f=()=>{const m=i.current;if(!n&&m){const g=new CustomEvent(HA,{bubbles:!0,cancelable:!0});m.addEventListener(HA,x=>r?.(x),{once:!0}),NR(m,g),g.defaultPrevented?h.current=!1:a.onClose()}};return l.jsx(TH,{...s,ref:u,disabled:n,onClick:Xe(t.onClick,f),onPointerDown:m=>{t.onPointerDown?.(m),h.current=!0},onPointerUp:Xe(t.onPointerUp,m=>{h.current||m.currentTarget?.click()}),onKeyDown:Xe(t.onKeyDown,m=>{const g=o.searchRef.current!=="";n||g&&m.key===" "||DS.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});Wv.displayName=I1;var TH=O.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,a=jO(I1,n),o=wH(n),u=O.useRef(null),h=Pn(e,u),[f,m]=O.useState(!1),[g,x]=O.useState("");return O.useEffect(()=>{const y=u.current;y&&x((y.textContent??"").trim())},[i.children]),l.jsx(Jm.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:l.jsx(OD,{asChild:!0,...o,focusable:!r,children:l.jsx(fn.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:Xe(t.onPointerMove,e0(y=>{r?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Xe(t.onPointerLeave,e0(y=>a.onItemLeave(y))),onFocus:Xe(t.onFocus,()=>m(!0)),onBlur:Xe(t.onBlur,()=>m(!1))})})})}),Sje="MenuCheckboxItem",EH=O.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return l.jsx(DH,{scope:t.__scopeMenu,checked:n,children:l.jsx(Wv,{role:"menuitemcheckbox","aria-checked":q1(n)?"mixed":n,...s,ref:e,"data-state":_O(n),onSelect:Xe(s.onSelect,()=>r?.(q1(n)?!0:!n),{checkForDefaultPrevented:!1})})})});EH.displayName=Sje;var _H="MenuRadioGroup",[kje,Oje]=Tu(_H,{value:void 0,onValueChange:()=>{}}),MH=O.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=us(r);return l.jsx(kje,{scope:t.__scopeMenu,value:n,onValueChange:i,children:l.jsx(CO,{...s,ref:e})})});MH.displayName=_H;var AH="MenuRadioItem",RH=O.forwardRef((t,e)=>{const{value:n,...r}=t,s=Oje(AH,t.__scopeMenu),i=n===s.value;return l.jsx(DH,{scope:t.__scopeMenu,checked:i,children:l.jsx(Wv,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":_O(i),onSelect:Xe(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});RH.displayName=AH;var TO="MenuItemIndicator",[DH,jje]=Tu(TO,{checked:!1}),zH=O.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=jje(TO,n);return l.jsx(Ws,{present:r||q1(i.checked)||i.checked===!0,children:l.jsx(fn.span,{...s,ref:e,"data-state":_O(i.checked)})})});zH.displayName=TO;var Nje="MenuSeparator",PH=O.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(fn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});PH.displayName=Nje;var Cje="MenuArrow",LH=O.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=F0(n);return l.jsx(rk,{...s,...r,ref:e})});LH.displayName=Cje;var EO="MenuSub",[Tje,BH]=Tu(EO),IH=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=mc(EO,e),a=F0(e),[o,u]=O.useState(null),[h,f]=O.useState(null),m=us(s);return O.useEffect(()=>(i.open===!1&&m(!1),()=>m(!1)),[i.open,m]),l.jsx(W1,{...a,children:l.jsx(SH,{scope:e,open:r,onOpenChange:m,content:h,onContentChange:f,children:l.jsx(Tje,{scope:e,contentId:Li(),triggerId:Li(),trigger:o,onTriggerChange:u,children:n})})})};IH.displayName=EO;var em="MenuSubTrigger",qH=O.forwardRef((t,e)=>{const n=mc(em,t.__scopeMenu),r=$0(em,t.__scopeMenu),s=BH(em,t.__scopeMenu),i=jO(em,t.__scopeMenu),a=O.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:u}=i,h={__scopeMenu:t.__scopeMenu},f=O.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return O.useEffect(()=>f,[f]),O.useEffect(()=>{const m=o.current;return()=>{window.clearTimeout(m),u(null)}},[o,u]),l.jsx(kO,{asChild:!0,...h,children:l.jsx(TH,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":QH(n.open),...t,ref:Uo(e,s.onTriggerChange),onClick:m=>{t.onClick?.(m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Xe(t.onPointerMove,e0(m=>{i.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Xe(t.onPointerLeave,e0(m=>{f();const g=n.content?.getBoundingClientRect();if(g){const x=n.content?.dataset.side,y=x==="right",w=y?-5:5,b=g[y?"left":"right"],k=g[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+w,y:m.clientY},{x:b,y:g.top},{x:k,y:g.top},{x:k,y:g.bottom},{x:b,y:g.bottom}],side:x}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Xe(t.onKeyDown,m=>{const g=i.searchRef.current!=="";t.disabled||g&&m.key===" "||cje[r.dir].includes(m.key)&&(n.onOpenChange(!0),n.content?.focus(),m.preventDefault())})})})});qH.displayName=em;var FH="MenuSubContent",$H=O.forwardRef((t,e)=>{const n=OH(qi,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=mc(qi,t.__scopeMenu),a=$0(qi,t.__scopeMenu),o=BH(FH,t.__scopeMenu),u=O.useRef(null),h=Pn(e,u);return l.jsx(Jm.Provider,{scope:t.__scopeMenu,children:l.jsx(Ws,{present:r||i.open,children:l.jsx(Jm.Slot,{scope:t.__scopeMenu,children:l.jsx(NO,{id:o.contentId,"aria-labelledby":o.triggerId,...s,ref:h,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{a.isUsingKeyboardRef.current&&u.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Xe(t.onFocusOutside,f=>{f.target!==o.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Xe(t.onEscapeKeyDown,f=>{a.onClose(),f.preventDefault()}),onKeyDown:Xe(t.onKeyDown,f=>{const m=f.currentTarget.contains(f.target),g=uje[a.dir].includes(f.key);m&&g&&(i.onOpenChange(!1),o.trigger?.focus(),f.preventDefault())})})})})})});$H.displayName=FH;function QH(t){return t?"open":"closed"}function q1(t){return t==="indeterminate"}function _O(t){return q1(t)?"indeterminate":t?"checked":"unchecked"}function Eje(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function _je(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Mje(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=_je(t,Math.max(i,0));s.length===1&&(a=a.filter(h=>h!==n));const u=a.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return u!==n?u:void 0}function Aje(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function Rje(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Aje(n,e)}function e0(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Dje=kH,zje=kO,Pje=jH,Lje=NH,Bje=CO,Ije=CH,qje=Wv,Fje=EH,$je=MH,Qje=RH,Hje=zH,Vje=PH,Uje=LH,Wje=IH,Gje=qH,Xje=$H,MO="ContextMenu",[Yje]=la(MO,[bH]),xs=bH(),[Zje,HH]=Yje(MO),VH=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[a,o]=O.useState(!1),u=xs(e),h=us(r),f=O.useCallback(m=>{o(m),h(m)},[h]);return l.jsx(Zje,{scope:e,open:a,onOpenChange:f,modal:i,children:l.jsx(Dje,{...u,dir:s,open:a,onOpenChange:f,modal:i,children:n})})};VH.displayName=MO;var UH="ContextMenuTrigger",WH=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=HH(UH,n),a=xs(n),o=O.useRef({x:0,y:0}),u=O.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...o.current})}),h=O.useRef(0),f=O.useCallback(()=>window.clearTimeout(h.current),[]),m=g=>{o.current={x:g.clientX,y:g.clientY},i.onOpenChange(!0)};return O.useEffect(()=>f,[f]),O.useEffect(()=>void(r&&f()),[r,f]),l.jsxs(l.Fragment,{children:[l.jsx(zje,{...a,virtualRef:u}),l.jsx(fn.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:Xe(t.onContextMenu,g=>{f(),m(g),g.preventDefault()}),onPointerDown:r?t.onPointerDown:Xe(t.onPointerDown,px(g=>{f(),h.current=window.setTimeout(()=>m(g),700)})),onPointerMove:r?t.onPointerMove:Xe(t.onPointerMove,px(f)),onPointerCancel:r?t.onPointerCancel:Xe(t.onPointerCancel,px(f)),onPointerUp:r?t.onPointerUp:Xe(t.onPointerUp,px(f))})]})});WH.displayName=UH;var Kje="ContextMenuPortal",GH=t=>{const{__scopeContextMenu:e,...n}=t,r=xs(e);return l.jsx(Pje,{...r,...n})};GH.displayName=Kje;var XH="ContextMenuContent",YH=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=HH(XH,n),i=xs(n),a=O.useRef(!1);return l.jsx(Lje,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:o=>{t.onCloseAutoFocus?.(o),!o.defaultPrevented&&a.current&&o.preventDefault(),a.current=!1},onInteractOutside:o=>{t.onInteractOutside?.(o),!o.defaultPrevented&&!s.modal&&(a.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});YH.displayName=XH;var Jje="ContextMenuGroup",e7e=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=xs(n);return l.jsx(Bje,{...s,...r,ref:e})});e7e.displayName=Jje;var t7e="ContextMenuLabel",ZH=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=xs(n);return l.jsx(Ije,{...s,...r,ref:e})});ZH.displayName=t7e;var n7e="ContextMenuItem",KH=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=xs(n);return l.jsx(qje,{...s,...r,ref:e})});KH.displayName=n7e;var r7e="ContextMenuCheckboxItem",JH=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=xs(n);return l.jsx(Fje,{...s,...r,ref:e})});JH.displayName=r7e;var s7e="ContextMenuRadioGroup",i7e=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=xs(n);return l.jsx($je,{...s,...r,ref:e})});i7e.displayName=s7e;var a7e="ContextMenuRadioItem",eV=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=xs(n);return l.jsx(Qje,{...s,...r,ref:e})});eV.displayName=a7e;var l7e="ContextMenuItemIndicator",tV=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=xs(n);return l.jsx(Hje,{...s,...r,ref:e})});tV.displayName=l7e;var o7e="ContextMenuSeparator",nV=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=xs(n);return l.jsx(Vje,{...s,...r,ref:e})});nV.displayName=o7e;var c7e="ContextMenuArrow",u7e=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=xs(n);return l.jsx(Uje,{...s,...r,ref:e})});u7e.displayName=c7e;var rV="ContextMenuSub",sV=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,a=xs(e),[o,u]=ac({prop:s,defaultProp:i??!1,onChange:r,caller:rV});return l.jsx(Wje,{...a,open:o,onOpenChange:u,children:n})};sV.displayName=rV;var d7e="ContextMenuSubTrigger",iV=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=xs(n);return l.jsx(Gje,{...s,...r,ref:e})});iV.displayName=d7e;var h7e="ContextMenuSubContent",aV=O.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=xs(n);return l.jsx(Xje,{...s,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});aV.displayName=h7e;function px(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var f7e=VH,m7e=WH,p7e=GH,lV=YH,oV=ZH,cV=KH,uV=JH,dV=eV,hV=tV,fV=nV,g7e=sV,mV=iV,pV=aV;const x7e=f7e,v7e=m7e,y7e=g7e,gV=O.forwardRef(({className:t,inset:e,children:n,...r},s)=>l.jsxs(mV,{ref:s,className:Se("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,l.jsx(yu,{className:"ml-auto h-4 w-4"})]}));gV.displayName=mV.displayName;const xV=O.forwardRef(({className:t,...e},n)=>l.jsx(pV,{ref:n,className:Se("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e}));xV.displayName=pV.displayName;const vV=O.forwardRef(({className:t,...e},n)=>l.jsx(p7e,{children:l.jsx(lV,{ref:n,className:Se("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e})}));vV.displayName=lV.displayName;const Zi=O.forwardRef(({className:t,inset:e,...n},r)=>l.jsx(cV,{ref:r,className:Se("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));Zi.displayName=cV.displayName;const b7e=O.forwardRef(({className:t,children:e,checked:n,...r},s)=>l.jsxs(uV,{ref:s,className:Se("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(hV,{children:l.jsx(Kc,{className:"h-4 w-4"})})}),e]}));b7e.displayName=uV.displayName;const w7e=O.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(dV,{ref:r,className:Se("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(hV,{children:l.jsx(GX,{className:"h-2 w-2 fill-current"})})}),e]}));w7e.displayName=dV.displayName;const S7e=O.forwardRef(({className:t,inset:e,...n},r)=>l.jsx(oV,{ref:r,className:Se("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));S7e.displayName=oV.displayName;const tm=O.forwardRef(({className:t,...e},n)=>l.jsx(fV,{ref:n,className:Se("-mx-1 my-1 h-px bg-border",t),...e}));tm.displayName=fV.displayName;const Td=({className:t,...e})=>l.jsx("span",{className:Se("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});Td.displayName="ContextMenuShortcut";var k7e=Symbol("radix.slottable");function O7e(t){const e=({children:n})=>l.jsx(l.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=k7e,e}var[Gv]=la("Tooltip",[ph]),Xv=ph(),yV="TooltipProvider",j7e=700,zS="tooltip.open",[N7e,AO]=Gv(yV),bV=t=>{const{__scopeTooltip:e,delayDuration:n=j7e,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,a=O.useRef(!0),o=O.useRef(!1),u=O.useRef(0);return O.useEffect(()=>{const h=u.current;return()=>window.clearTimeout(h)},[]),l.jsx(N7e,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:O.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:O.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:o,onPointerInTransitChange:O.useCallback(h=>{o.current=h},[]),disableHoverableContent:s,children:i})};bV.displayName=yV;var t0="Tooltip",[C7e,Q0]=Gv(t0),wV=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:o}=t,u=AO(t0,t.__scopeTooltip),h=Xv(e),[f,m]=O.useState(null),g=Li(),x=O.useRef(0),y=a??u.disableHoverableContent,w=o??u.delayDuration,b=O.useRef(!1),[k,N]=ac({prop:r,defaultProp:s??!1,onChange:A=>{A?(u.onOpen(),document.dispatchEvent(new CustomEvent(zS))):u.onClose(),i?.(A)},caller:t0}),C=O.useMemo(()=>k?b.current?"delayed-open":"instant-open":"closed",[k]),T=O.useCallback(()=>{window.clearTimeout(x.current),x.current=0,b.current=!1,N(!0)},[N]),E=O.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),_=O.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{b.current=!0,N(!0),x.current=0},w)},[w,N]);return O.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),l.jsx(W1,{...h,children:l.jsx(C7e,{scope:e,contentId:g,open:k,stateAttribute:C,trigger:f,onTriggerChange:m,onTriggerEnter:O.useCallback(()=>{u.isOpenDelayedRef.current?_():T()},[u.isOpenDelayedRef,_,T]),onTriggerLeave:O.useCallback(()=>{y?E():(window.clearTimeout(x.current),x.current=0)},[E,y]),onOpen:T,onClose:E,disableHoverableContent:y,children:n})})};wV.displayName=t0;var PS="TooltipTrigger",SV=O.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Q0(PS,n),i=AO(PS,n),a=Xv(n),o=O.useRef(null),u=Pn(e,o,s.onTriggerChange),h=O.useRef(!1),f=O.useRef(!1),m=O.useCallback(()=>h.current=!1,[]);return O.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),l.jsx(G1,{asChild:!0,...a,children:l.jsx(fn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:u,onPointerMove:Xe(t.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:Xe(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:Xe(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Xe(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:Xe(t.onBlur,s.onClose),onClick:Xe(t.onClick,s.onClose)})})});SV.displayName=PS;var RO="TooltipPortal",[T7e,E7e]=Gv(RO,{forceMount:void 0}),kV=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=Q0(RO,e);return l.jsx(T7e,{scope:e,forceMount:n,children:l.jsx(Ws,{present:n||i.open,children:l.jsx(U1,{asChild:!0,container:s,children:r})})})};kV.displayName=RO;var mh="TooltipContent",OV=O.forwardRef((t,e)=>{const n=E7e(mh,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=Q0(mh,t.__scopeTooltip);return l.jsx(Ws,{present:r||a.open,children:a.disableHoverableContent?l.jsx(jV,{side:s,...i,ref:e}):l.jsx(_7e,{side:s,...i,ref:e})})}),_7e=O.forwardRef((t,e)=>{const n=Q0(mh,t.__scopeTooltip),r=AO(mh,t.__scopeTooltip),s=O.useRef(null),i=Pn(e,s),[a,o]=O.useState(null),{trigger:u,onClose:h}=n,f=s.current,{onPointerInTransitChange:m}=r,g=O.useCallback(()=>{o(null),m(!1)},[m]),x=O.useCallback((y,w)=>{const b=y.currentTarget,k={x:y.clientX,y:y.clientY},N=z7e(k,b.getBoundingClientRect()),C=P7e(k,N),T=L7e(w.getBoundingClientRect()),E=I7e([...C,...T]);o(E),m(!0)},[m]);return O.useEffect(()=>()=>g(),[g]),O.useEffect(()=>{if(u&&f){const y=b=>x(b,f),w=b=>x(b,u);return u.addEventListener("pointerleave",y),f.addEventListener("pointerleave",w),()=>{u.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",w)}}},[u,f,x,g]),O.useEffect(()=>{if(a){const y=w=>{const b=w.target,k={x:w.clientX,y:w.clientY},N=u?.contains(b)||f?.contains(b),C=!B7e(k,a);N?g():C&&(g(),h())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[u,f,a,h,g]),l.jsx(jV,{...t,ref:i})}),[M7e,A7e]=Gv(t0,{isInside:!1}),R7e=O7e("TooltipContent"),jV=O.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...o}=t,u=Q0(mh,n),h=Xv(n),{onClose:f}=u;return O.useEffect(()=>(document.addEventListener(zS,f),()=>document.removeEventListener(zS,f)),[f]),O.useEffect(()=>{if(u.trigger){const m=g=>{g.target?.contains(u.trigger)&&f()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[u.trigger,f]),l.jsx(tk,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:f,children:l.jsxs(nk,{"data-state":u.stateAttribute,...h,...o,ref:e,style:{...o.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(R7e,{children:r}),l.jsx(M7e,{scope:n,isInside:!0,children:l.jsx(OX,{id:u.contentId,role:"tooltip",children:s||r})})]})})});OV.displayName=mh;var NV="TooltipArrow",D7e=O.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Xv(n);return A7e(NV,n).isInside?null:l.jsx(rk,{...s,...r,ref:e})});D7e.displayName=NV;function z7e(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function P7e(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function L7e(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function B7e(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function I7e(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),q7e(e)}function q7e(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var F7e=bV,$7e=wV,Q7e=SV,H7e=kV,CV=OV;const V7e=F7e,U7e=$7e,W7e=Q7e,TV=O.forwardRef(({className:t,sideOffset:e=4,...n},r)=>l.jsx(H7e,{children:l.jsx(CV,{ref:r,sideOffset:e,className:Se("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...n})}));TV.displayName=CV.displayName;function G7e({children:t}){UJ();const[e,n]=O.useState(!0),[r,s]=O.useState(!1),[i,a]=O.useState(!1),{theme:o,setTheme:u}=vk(),h=lG(),f=aa();O.useEffect(()=>{const w=b=>{(b.metaKey||b.ctrlKey)&&b.key==="k"&&(b.preventDefault(),a(!0))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[]);const m=[{title:"概览",items:[{icon:Hx,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Dl,label:"麦麦主程序配置",path:"/config/bot"},{icon:AR,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:RR,label:"麦麦模型配置",path:"/config/model"},{icon:E8,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:sk,label:"表情包管理",path:"/resource/emoji"},{icon:r0,label:"表达方式管理",path:"/resource/expression"},{icon:DR,label:"人物信息管理",path:"/resource/person"},{icon:MR,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:Wx,label:"插件市场",path:"/plugins"},{icon:E8,label:"插件配置",path:"/plugin-config"},{icon:Vx,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Zc,label:"系统设置",path:"/settings"}]}],x=o==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":o,y=()=>{localStorage.removeItem("access-token"),f({to:"/auth"})};return l.jsx(V7e,{delayDuration:300,children:l.jsxs("div",{className:"flex h-screen overflow-hidden",children:[l.jsxs("aside",{className:Se("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[l.jsx("div",{className:"flex h-16 items-center border-b px-4",children:l.jsxs("div",{className:Se("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[l.jsxs("div",{className:Se("flex items-baseline gap-2",!e&&"lg:hidden"),children:[l.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),l.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:SJ()})]}),!e&&l.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),l.jsx(yn,{className:Se("flex-1 overflow-x-hidden",!e&&"lg:w-16"),children:l.jsx("nav",{className:Se("p-4",!e&&"lg:p-2 lg:w-16"),children:l.jsx("ul",{className:Se("space-y-6",!e&&"lg:space-y-3 lg:w-full"),children:m.map((w,b)=>l.jsxs("li",{children:[l.jsx("div",{className:Se("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:l.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:w.title})}),!e&&b>0&&l.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),l.jsx("ul",{className:"space-y-1",children:w.items.map(k=>{const N=h({to:k.path}),C=k.icon,T=l.jsxs(l.Fragment,{children:[N&&l.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),l.jsxs("div",{className:Se("flex items-center transition-all duration-300",e?"gap-3":"gap-3 lg:gap-0"),children:[l.jsx(C,{className:Se("h-5 w-5 flex-shrink-0",N&&"text-primary"),strokeWidth:2,fill:"none"}),l.jsx("span",{className:Se("text-sm font-medium whitespace-nowrap transition-all duration-300",N&&"font-semibold",e?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:k.label})]})]});return l.jsx("li",{className:"relative",children:l.jsxs(U7e,{children:[l.jsx(W7e,{asChild:!0,children:l.jsx(oG,{to:k.path,className:Se("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",N?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>s(!1),children:T})}),!e&&l.jsx(TV,{side:"right",className:"hidden lg:block",children:l.jsx("p",{children:k.label})})]})},k.path)})})]},w.title))})})})]}),r&&l.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),l.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[l.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:l.jsx(XX,{className:"h-5 w-5"})}),l.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:l.jsx(vu,{className:Se("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>a(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[l.jsx(js,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),l.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),l.jsxs(vH,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[l.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),l.jsx(eje,{open:i,onOpenChange:a}),l.jsxs(de,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[l.jsx(YX,{className:"h-4 w-4"}),l.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),l.jsx("button",{onClick:w=>{lJ(x==="dark"?"light":"dark",u,w)},className:"rounded-lg p-2 hover:bg-accent",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?l.jsx(L5,{className:"h-5 w-5"}):l.jsx(B5,{className:"h-5 w-5"})}),l.jsx("div",{className:"h-6 w-px bg-border"}),l.jsxs(de,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[l.jsx(_8,{className:"h-4 w-4"}),l.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),l.jsxs(x7e,{children:[l.jsx(v7e,{asChild:!0,children:l.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),l.jsxs(vV,{className:"w-64",children:[l.jsxs(Zi,{onClick:()=>f({to:"/"}),children:[l.jsx(Hx,{className:"mr-2 h-4 w-4"}),"首页"]}),l.jsxs(Zi,{onClick:()=>f({to:"/settings"}),children:[l.jsx(Zc,{className:"mr-2 h-4 w-4"}),"系统设置"]}),l.jsxs(Zi,{onClick:()=>f({to:"/logs"}),children:[l.jsx(Vx,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),l.jsx(tm,{}),l.jsxs(y7e,{children:[l.jsxs(gV,{children:[l.jsx(TR,{className:"mr-2 h-4 w-4"}),"切换主题"]}),l.jsxs(xV,{className:"w-48",children:[l.jsxs(Zi,{onClick:()=>u("light"),disabled:o==="light",children:[l.jsx(L5,{className:"mr-2 h-4 w-4"}),"浅色",o==="light"&&l.jsx(Td,{children:"✓"})]}),l.jsxs(Zi,{onClick:()=>u("dark"),disabled:o==="dark",children:[l.jsx(B5,{className:"mr-2 h-4 w-4"}),"深色",o==="dark"&&l.jsx(Td,{children:"✓"})]}),l.jsxs(Zi,{onClick:()=>u("system"),disabled:o==="system",children:[l.jsx(Zc,{className:"mr-2 h-4 w-4"}),"跟随系统",o==="system"&&l.jsx(Td,{children:"✓"})]})]})]}),l.jsx(tm,{}),l.jsxs(Zi,{onClick:()=>window.location.reload(),children:[l.jsx(ZX,{className:"mr-2 h-4 w-4"}),"刷新页面",l.jsx(Td,{children:"⌘R"})]}),l.jsxs(Zi,{onClick:()=>a(!0),children:[l.jsx(js,{className:"mr-2 h-4 w-4"}),"搜索",l.jsx(Td,{children:"⌘K"})]}),l.jsx(tm,{}),l.jsxs(Zi,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[l.jsx(nm,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),l.jsx(tm,{}),l.jsxs(Zi,{onClick:y,className:"text-destructive focus:text-destructive",children:[l.jsx(_8,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const H0=cG({component:()=>l.jsxs(l.Fragment,{children:[l.jsx(WA,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!Pz())throw dG({to:"/auth"})}}),X7e=Gr({getParentRoute:()=>H0,path:"/auth",component:WJ}),Y7e=Gr({getParentRoute:()=>H0,path:"/setup",component:hee}),Es=Gr({getParentRoute:()=>H0,id:"protected",component:()=>l.jsx(G7e,{children:l.jsx(WA,{})})}),Z7e=Gr({getParentRoute:()=>Es,path:"/",component:iJ}),K7e=Gr({getParentRoute:()=>Es,path:"/config/bot",component:uue}),J7e=Gr({getParentRoute:()=>Es,path:"/config/modelProvider",component:Nue}),eNe=Gr({getParentRoute:()=>Es,path:"/config/model",component:ede}),tNe=Gr({getParentRoute:()=>Es,path:"/config/adapter",component:sde}),nNe=Gr({getParentRoute:()=>Es,path:"/resource/emoji",component:Tve}),rNe=Gr({getParentRoute:()=>Es,path:"/resource/expression",component:Bve}),sNe=Gr({getParentRoute:()=>Es,path:"/resource/person",component:Xve}),iNe=Gr({getParentRoute:()=>Es,path:"/resource/knowledge-graph",component:I3e}),aNe=Gr({getParentRoute:()=>Es,path:"/logs",component:_Oe}),lNe=Gr({getParentRoute:()=>Es,path:"/plugins",component:XOe}),oNe=Gr({getParentRoute:()=>Es,path:"/plugin-config",component:YOe}),cNe=Gr({getParentRoute:()=>Es,path:"/plugin-mirrors",component:ZOe}),uNe=Gr({getParentRoute:()=>Es,path:"/settings",component:IJ}),dNe=Gr({getParentRoute:()=>H0,path:"*",component:Iz}),hNe=H0.addChildren([X7e,Y7e,Es.addChildren([Z7e,K7e,J7e,eNe,tNe,nNe,rNe,sNe,iNe,lNe,oNe,cNe,aNe,uNe]),dNe]),fNe=uG({routeTree:hNe,defaultNotFoundComponent:Iz});function mNe({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=O.useState(()=>localStorage.getItem(n)||e);O.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark"),s==="system"){const u=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";o.classList.add(u);return}o.classList.add(s)},[s]),O.useEffect(()=>{const o=localStorage.getItem("accent-color");if(o){const u=document.documentElement,f={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[o];f&&(u.style.setProperty("--primary",f.hsl),f.gradient?(u.style.setProperty("--primary-gradient",f.gradient),u.classList.add("has-gradient")):(u.style.removeProperty("--primary-gradient"),u.classList.remove("has-gradient")))}},[]);const a={theme:s,setTheme:o=>{localStorage.setItem(n,o),i(o)}};return l.jsx(az.Provider,{...r,value:a,children:t})}function pNe({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,a]=O.useState(()=>{const f=localStorage.getItem(r);return f!==null?f==="true":e}),[o,u]=O.useState(()=>{const f=localStorage.getItem(s);return f!==null?f==="true":n});O.useEffect(()=>{const f=document.documentElement;i?f.classList.remove("no-animations"):f.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),O.useEffect(()=>{localStorage.setItem(s,String(o))},[o,s]);const h={enableAnimations:i,setEnableAnimations:a,enableWavesBackground:o,setEnableWavesBackground:u};return l.jsx(lz.Provider,{value:h,children:t})}var DO="ToastProvider",[zO,gNe,xNe]=Q1("Toast"),[EV]=la("Toast",[xNe]),[vNe,Yv]=EV(DO),_V=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=t,[o,u]=O.useState(null),[h,f]=O.useState(0),m=O.useRef(!1),g=O.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${DO}\`. Expected non-empty \`string\`.`),l.jsx(zO.Provider,{scope:e,children:l.jsx(vNe,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:o,onViewportChange:u,onToastAdd:O.useCallback(()=>f(x=>x+1),[]),onToastRemove:O.useCallback(()=>f(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:a})})};_V.displayName=DO;var MV="ToastViewport",yNe=["F8"],LS="toast.viewportPause",BS="toast.viewportResume",AV=O.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=yNe,label:s="Notifications ({hotkey})",...i}=t,a=Yv(MV,n),o=gNe(n),u=O.useRef(null),h=O.useRef(null),f=O.useRef(null),m=O.useRef(null),g=Pn(e,m,a.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;O.useEffect(()=>{const b=k=>{r.length!==0&&r.every(C=>k[C]||k.code===C)&&m.current?.focus()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]),O.useEffect(()=>{const b=u.current,k=m.current;if(y&&b&&k){const N=()=>{if(!a.isClosePausedRef.current){const _=new CustomEvent(LS);k.dispatchEvent(_),a.isClosePausedRef.current=!0}},C=()=>{if(a.isClosePausedRef.current){const _=new CustomEvent(BS);k.dispatchEvent(_),a.isClosePausedRef.current=!1}},T=_=>{!b.contains(_.relatedTarget)&&C()},E=()=>{b.contains(document.activeElement)||C()};return b.addEventListener("focusin",N),b.addEventListener("focusout",T),b.addEventListener("pointermove",N),b.addEventListener("pointerleave",E),window.addEventListener("blur",N),window.addEventListener("focus",C),()=>{b.removeEventListener("focusin",N),b.removeEventListener("focusout",T),b.removeEventListener("pointermove",N),b.removeEventListener("pointerleave",E),window.removeEventListener("blur",N),window.removeEventListener("focus",C)}}},[y,a.isClosePausedRef]);const w=O.useCallback(({tabbingDirection:b})=>{const N=o().map(C=>{const T=C.ref.current,E=[T,...ANe(T)];return b==="forwards"?E:E.reverse()});return(b==="forwards"?N.reverse():N).flat()},[o]);return O.useEffect(()=>{const b=m.current;if(b){const k=N=>{const C=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!C){const E=document.activeElement,_=N.shiftKey;if(N.target===b&&_){h.current?.focus();return}const B=w({tabbingDirection:_?"backwards":"forwards"}),P=B.findIndex(H=>H===E);A5(B.slice(P+1))?N.preventDefault():_?h.current?.focus():f.current?.focus()}};return b.addEventListener("keydown",k),()=>b.removeEventListener("keydown",k)}},[o,w]),l.jsxs(jX,{ref:u,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&l.jsx(IS,{ref:h,onFocusFromOutsideViewport:()=>{const b=w({tabbingDirection:"forwards"});A5(b)}}),l.jsx(zO.Slot,{scope:n,children:l.jsx(fn.ol,{tabIndex:-1,...i,ref:g})}),y&&l.jsx(IS,{ref:f,onFocusFromOutsideViewport:()=>{const b=w({tabbingDirection:"backwards"});A5(b)}})]})});AV.displayName=MV;var RV="ToastFocusProxy",IS=O.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=Yv(RV,n);return l.jsx(CR,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{const o=a.relatedTarget;!i.viewport?.contains(o)&&r()}})});IS.displayName=RV;var V0="Toast",bNe="toast.swipeStart",wNe="toast.swipeMove",SNe="toast.swipeCancel",kNe="toast.swipeEnd",DV=O.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=t,[o,u]=ac({prop:r,defaultProp:s??!0,onChange:i,caller:V0});return l.jsx(Ws,{present:n||o,children:l.jsx(NNe,{open:o,...a,ref:e,onClose:()=>u(!1),onPause:us(t.onPause),onResume:us(t.onResume),onSwipeStart:Xe(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Xe(t.onSwipeMove,h=>{const{x:f,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:Xe(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Xe(t.onSwipeEnd,h=>{const{x:f,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),u(!1)})})})});DV.displayName=V0;var[ONe,jNe]=EV(V0,{onClose(){}}),NNe=O.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:o,onPause:u,onResume:h,onSwipeStart:f,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:x,...y}=t,w=Yv(V0,n),[b,k]=O.useState(null),N=Pn(e,z=>k(z)),C=O.useRef(null),T=O.useRef(null),E=s||w.duration,_=O.useRef(0),A=O.useRef(E),F=O.useRef(0),{onToastAdd:B,onToastRemove:P}=w,H=us(()=>{b?.contains(document.activeElement)&&w.viewport?.focus(),a()}),U=O.useCallback(z=>{!z||z===1/0||(window.clearTimeout(F.current),_.current=new Date().getTime(),F.current=window.setTimeout(H,z))},[H]);O.useEffect(()=>{const z=w.viewport;if(z){const W=()=>{U(A.current),h?.()},q=()=>{const J=new Date().getTime()-_.current;A.current=A.current-J,window.clearTimeout(F.current),u?.()};return z.addEventListener(LS,q),z.addEventListener(BS,W),()=>{z.removeEventListener(LS,q),z.removeEventListener(BS,W)}}},[w.viewport,E,u,h,U]),O.useEffect(()=>{i&&!w.isClosePausedRef.current&&U(E)},[i,E,w.isClosePausedRef,U]),O.useEffect(()=>(B(),()=>P()),[B,P]);const te=O.useMemo(()=>b?FV(b):null,[b]);return w.viewport?l.jsxs(l.Fragment,{children:[te&&l.jsx(CNe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:te}),l.jsx(ONe,{scope:n,onClose:H,children:UA.createPortal(l.jsx(zO.ItemSlot,{scope:n,children:l.jsx(NX,{asChild:!0,onEscapeKeyDown:Xe(o,()=>{w.isFocusedToastEscapeKeyDownRef.current||H(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(fn.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":w.swipeDirection,...y,ref:N,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Xe(t.onKeyDown,z=>{z.key==="Escape"&&(o?.(z.nativeEvent),z.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,H()))}),onPointerDown:Xe(t.onPointerDown,z=>{z.button===0&&(C.current={x:z.clientX,y:z.clientY})}),onPointerMove:Xe(t.onPointerMove,z=>{if(!C.current)return;const W=z.clientX-C.current.x,q=z.clientY-C.current.y,J=!!T.current,ee=["left","right"].includes(w.swipeDirection),Y=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,R=ee?Y(0,W):0,re=ee?0:Y(0,q),K=z.pointerType==="touch"?10:2,I={x:R,y:re},Q={originalEvent:z,delta:I};J?(T.current=I,gx(wNe,m,Q,{discrete:!1})):VA(I,w.swipeDirection,K)?(T.current=I,gx(bNe,f,Q,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(W)>K||Math.abs(q)>K)&&(C.current=null)}),onPointerUp:Xe(t.onPointerUp,z=>{const W=T.current,q=z.target;if(q.hasPointerCapture(z.pointerId)&&q.releasePointerCapture(z.pointerId),T.current=null,C.current=null,W){const J=z.currentTarget,ee={originalEvent:z,delta:W};VA(W,w.swipeDirection,w.swipeThreshold)?gx(kNe,x,ee,{discrete:!0}):gx(SNe,g,ee,{discrete:!0}),J.addEventListener("click",Y=>Y.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),CNe=t=>{const{__scopeToast:e,children:n,...r}=t,s=Yv(V0,e),[i,a]=O.useState(!1),[o,u]=O.useState(!1);return _Ne(()=>a(!0)),O.useEffect(()=>{const h=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(h)},[]),o?null:l.jsx(U1,{asChild:!0,children:l.jsx(CR,{...r,children:i&&l.jsxs(l.Fragment,{children:[s.label," ",n]})})})},TNe="ToastTitle",zV=O.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return l.jsx(fn.div,{...r,ref:e})});zV.displayName=TNe;var ENe="ToastDescription",PV=O.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return l.jsx(fn.div,{...r,ref:e})});PV.displayName=ENe;var LV="ToastAction",BV=O.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?l.jsx(qV,{altText:n,asChild:!0,children:l.jsx(PO,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${LV}\`. Expected non-empty \`string\`.`),null)});BV.displayName=LV;var IV="ToastClose",PO=O.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=jNe(IV,n);return l.jsx(qV,{asChild:!0,children:l.jsx(fn.button,{type:"button",...r,ref:e,onClick:Xe(t.onClick,s.onClose)})})});PO.displayName=IV;var qV=O.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return l.jsx(fn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function FV(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),MNe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=r.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...FV(r))}}),e}function gx(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?NR(s,i):s.dispatchEvent(i)}var VA=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function _Ne(t=()=>{}){const e=us(t);oR(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function MNe(t){return t.nodeType===t.ELEMENT_NODE}function ANe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function A5(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var RNe=_V,$V=AV,QV=DV,HV=zV,VV=PV,UV=BV,WV=PO;const DNe=RNe,GV=O.forwardRef(({className:t,...e},n)=>l.jsx($V,{ref:n,className:Se("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",t),...e}));GV.displayName=$V.displayName;const zNe=bh("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),XV=O.forwardRef(({className:t,variant:e,...n},r)=>l.jsx(QV,{ref:r,className:Se(zNe({variant:e}),t),...n}));XV.displayName=QV.displayName;const PNe=O.forwardRef(({className:t,...e},n)=>l.jsx(UV,{ref:n,className:Se("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));PNe.displayName=UV.displayName;const YV=O.forwardRef(({className:t,...e},n)=>l.jsx(WV,{ref:n,className:Se("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:l.jsx(s0,{className:"h-4 w-4"})}));YV.displayName=WV.displayName;const ZV=O.forwardRef(({className:t,...e},n)=>l.jsx(HV,{ref:n,className:Se("text-sm font-semibold [&+div]:text-xs",t),...e}));ZV.displayName=HV.displayName;const KV=O.forwardRef(({className:t,...e},n)=>l.jsx(VV,{ref:n,className:Se("text-sm opacity-90",t),...e}));KV.displayName=VV.displayName;function LNe(){const{toasts:t}=$r();return l.jsxs(DNe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return l.jsxs(XV,{...i,children:[l.jsxs("div",{className:"grid gap-1",children:[n&&l.jsx(ZV,{children:n}),r&&l.jsx(KV,{children:r})]}),s,l.jsx(YV,{})]},e)}),l.jsx(GV,{})]})}nY.createRoot(document.getElementById("root")).render(l.jsx(O.StrictMode,{children:l.jsx(mNe,{defaultTheme:"system",children:l.jsxs(pNe,{children:[l.jsx(hG,{router:fNe}),l.jsx(LNe,{})]})})}));