MaiBot/webui/dist/assets/index-ZouZGJSS.js

368 lines
1.9 MiB
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import{r as b,j as o,u as Ca,R as he,b as du,d as HX,e as VX,L as UX,f as WX,g as ns,h as GX,k as XX,O as dD,l as YX}from"./router-SinpzM5S.js";import{a as KX,b as ZX,g as Mk}from"./react-vendor-Dtc2IqVY.js";import{c as hD,R as JX,T as eY,L as tY,a as nY,C as Bg,X as qg,Y as Vf,b as rY,B as H2,d as Fg,P as sY,e as iY,f as aY,_ as oY,g as lY,i as cY,h as CC,j as uY,k as TC,l as dY,m as hY,n as fY,r as fD,o as mY,p as Ak,q as mD,s as Lu,t as Rk,u as pY,v as gY,w as pD,x as gD,y as xD,z as Dk,A as zk,D as Pk,E as xY,F as vY,G as yY,H as bY,I as wY,J as SY,K as kY,M as Lk,N as bv,O as OY,Q as jY,S as Ik,U as NY,V as CY,W as vD,Z as yD,$ as bD,a0 as wD,a1 as wv,a2 as SD,a3 as kD,a4 as TY,a5 as EY,a6 as _Y,a7 as MY,a8 as AY,a9 as RY,aa as DY,ab as zY,ac as OD,ad as jD,ae as PY,af as LY,ag as IY,ah as BY,ai as qY,aj as FY,ak as $Y,al as QY,am as HY,an as VY,ao as UY,ap as WY,aq as GY,ar as XY,as as YY,at as KY}from"./charts-BH1Uno6i.js";import{c as Ta,a as Sv,u as ea,P as xn,b as Ze,d as qn,e as T0,f as Cc,g as ys,h as ai,i as ND,j as Bk,k as qk,S as ZY,l as CD,m as TD,R as ED,O as kv,n as Fk,C as Ov,o as $k,T as Qk,D as Hk,p as Vk,q as _D,r as MD,W as JY,s as AD,I as eK,t as RD,v as DD,w as tK,x as zD,V as nK,L as PD,y as LD,z as rK,A as sK,B as ID,E as iK,F as aK,G as mc,H as jv,J as Ah,K as BD,M as qD,N as FD,Q as $D,U as Uk,X as Wk,Y as Nv,Z as Cv,_ as Gk,$ as QD,a0 as oK,a1 as HD,a2 as lK,a3 as cK,a4 as VD,a5 as uK}from"./ui-vendor-BLBhIcJ8.js";import{R as Ti,A as dK,D as hK,a as b3,Z as w3,C as Gd,M as E0,T as fK,X as _0,P as UD,S as mK,b as vu,I as wa,c as Xd,d as dc,e as S3,E as b1,f as sa,g as pc,h as pK,i as gK,j as k3,k as O3,L as EC,K as WD,l as Ou,m as xK,n as vK,F as tl,o as Yd,p as dh,q as yK,B as bK,U as GD,r as Xk,s as wK,t as SK,u as ii,H as w1,v as XD,w as Im,x as j3,y as kK,z as OK,G as Tv,J as Yk,N as ms,O as sn,Q as S1,V as hh,W as M0,Y as Iu,_ as Bu,$ as A0,a0 as YD,a1 as jK,a2 as NK,a3 as fh,a4 as _C,a5 as CK,a6 as yu,a7 as N3,a8 as Bm,a9 as TK,aa as C3,ab as EK,ac as KD,ad as MC,ae as _K,af as MK,ag as AK,ah as tc,ai as V2,aj as AC,ak as RK,al as ZD,am as JD,an as ez,ao as DK,ap as zK,aq as RC,ar as PK,as as LK,at as DC,au as IK}from"./icons-NigUckDX.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:{}},Uf={},W2={exports:{}},G2={};var zC;function BK(){return zC||(zC=1,(function(t){function e(P,W){var J=P.length;P.push(W);e:for(;0<J;){var X=J-1>>>1,R=P[X];if(0<s(R,W))P[X]=W,P[J]=R,J=X;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var W=P[0],J=P.pop();if(J!==W){P[0]=J;e:for(var X=0,R=P.length,se=R>>>1;X<se;){var G=2*(X+1)-1,F=P[G],U=G+1,te=P[U];if(0>s(F,J))U<R&&0>s(te,F)?(P[X]=te,P[U]=J,X=U):(P[X]=F,P[G]=J,X=G);else if(U<R&&0>s(te,J))P[X]=te,P[U]=J,X=U;else break e}}return W}function s(P,W){var J=P.sortIndex-W.sortIndex;return J!==0?J:P.id-W.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,l=a.now();t.unstable_now=function(){return a.now()-l}}var c=[],h=[],f=1,m=null,g=3,x=!1,y=!1,w=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function T(P){for(var W=n(h);W!==null;){if(W.callback===null)r(h);else if(W.startTime<=P)r(h),W.sortIndex=W.expirationTime,e(c,W);else break;W=n(h)}}function _(P){if(w=!1,T(P),!y)if(n(c)!==null)y=!0,E||(E=!0,V());else{var W=n(h);W!==null&&H(_,W.startTime-P)}}var E=!1,M=-1,q=5,L=-1;function I(){return S?!0:!(t.unstable_now()-L<q)}function $(){if(S=!1,E){var P=t.unstable_now();L=P;var W=!0;try{e:{y=!1,w&&(w=!1,N(M),M=-1),x=!0;var J=g;try{t:{for(T(P),m=n(c);m!==null&&!(m.expirationTime>P&&I());){var X=m.callback;if(typeof X=="function"){m.callback=null,g=m.priorityLevel;var R=X(m.expirationTime<=P);if(P=t.unstable_now(),typeof R=="function"){m.callback=R,T(P),W=!0;break t}m===n(c)&&r(c),T(P)}else r(c);m=n(c)}if(m!==null)W=!0;else{var se=n(h);se!==null&&H(_,se.startTime-P),W=!1}}break e}finally{m=null,g=J,x=!1}W=void 0}}finally{W?V():E=!1}}}var V;if(typeof C=="function")V=function(){C($)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,z=ee.port2;ee.port1.onmessage=$,V=function(){z.postMessage(null)}}else V=function(){k($,0)};function H(P,W){M=k(function(){P(t.unstable_now())},W)}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(P){P.callback=null},t.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<P?Math.floor(1e3/P):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(P){switch(g){case 1:case 2:case 3:var W=3;break;default:W=g}var J=g;g=W;try{return P()}finally{g=J}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function(P,W){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var J=g;g=P;try{return W()}finally{g=J}},t.unstable_scheduleCallback=function(P,W,J){var X=t.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?X+J:X):J=X,P){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=J+R,P={id:f++,callback:W,priorityLevel:P,startTime:J,expirationTime:R,sortIndex:-1},J>X?(P.sortIndex=J,e(h,P),n(c)===null&&P===n(h)&&(w?(N(M),M=-1):w=!0,H(_,J-X))):(P.sortIndex=R,e(c,P),y||x||(y=!0,E||(E=!0,V()))),P},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(P){var W=g;return function(){var J=g;g=W;try{return P.apply(this,arguments)}finally{g=J}}}})(G2)),G2}var PC;function qK(){return PC||(PC=1,W2.exports=BK()),W2.exports}var LC;function FK(){if(LC)return Uf;LC=1;var t=qK(),e=KX(),n=ZX();function r(u){var d="https://react.dev/errors/"+u;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+u+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function i(u){var d=u,p=u;if(u.alternate)for(;d.return;)d=d.return;else{u=d;do d=u,(d.flags&4098)!==0&&(p=d.return),u=d.return;while(u)}return d.tag===3?p:null}function a(u){if(u.tag===13){var d=u.memoizedState;if(d===null&&(u=u.alternate,u!==null&&(d=u.memoizedState)),d!==null)return d.dehydrated}return null}function l(u){if(u.tag===31){var d=u.memoizedState;if(d===null&&(u=u.alternate,u!==null&&(d=u.memoizedState)),d!==null)return d.dehydrated}return null}function c(u){if(i(u)!==u)throw Error(r(188))}function h(u){var d=u.alternate;if(!d){if(d=i(u),d===null)throw Error(r(188));return d!==u?null:u}for(var p=u,v=d;;){var O=p.return;if(O===null)break;var j=O.alternate;if(j===null){if(v=O.return,v!==null){p=v;continue}break}if(O.child===j.child){for(j=O.child;j;){if(j===p)return c(O),u;if(j===v)return c(O),d;j=j.sibling}throw Error(r(188))}if(p.return!==v.return)p=O,v=j;else{for(var B=!1,K=O.child;K;){if(K===p){B=!0,p=O,v=j;break}if(K===v){B=!0,v=O,p=j;break}K=K.sibling}if(!B){for(K=j.child;K;){if(K===p){B=!0,p=j,v=O;break}if(K===v){B=!0,v=j,p=O;break}K=K.sibling}if(!B)throw Error(r(189))}}if(p.alternate!==v)throw Error(r(190))}if(p.tag!==3)throw Error(r(188));return p.stateNode.current===p?u:d}function f(u){var d=u.tag;if(d===5||d===26||d===27||d===6)return u;for(u=u.child;u!==null;){if(d=f(u),d!==null)return d;u=u.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),C=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function V(u){return u===null||typeof u!="object"?null:(u=$&&u[$]||u["@@iterator"],typeof u=="function"?u:null)}var ee=Symbol.for("react.client.reference");function z(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===ee?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case w:return"Fragment";case k:return"Profiler";case S:return"StrictMode";case _:return"Suspense";case E:return"SuspenseList";case L:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case y:return"Portal";case C:return u.displayName||"Context";case N:return(u._context.displayName||"Context")+".Consumer";case T:var d=u.render;return u=u.displayName,u||(u=d.displayName||d.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case M:return d=u.displayName||null,d!==null?d:z(u.type)||"Memo";case q:d=u._payload,u=u._init;try{return z(u(d))}catch{}}return null}var H=Array.isArray,P=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},X=[],R=-1;function se(u){return{current:u}}function G(u){0>R||(u.current=X[R],X[R]=null,R--)}function F(u,d){R++,X[R]=u.current,u.current=d}var U=se(null),te=se(null),ne=se(null),Y=se(null);function ae(u,d){switch(F(ne,d),F(te,u),F(U,null),d.nodeType){case 9:case 11:u=(u=d.documentElement)&&(u=u.namespaceURI)?Y8(u):0;break;default:if(u=d.tagName,d=d.namespaceURI)d=Y8(d),u=K8(d,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}G(U),F(U,u)}function re(){G(U),G(te),G(ne)}function oe(u){u.memoizedState!==null&&F(Y,u);var d=U.current,p=K8(d,u.type);d!==p&&(F(te,u),F(U,p))}function _e(u){te.current===u&&(G(U),G(te)),Y.current===u&&(G(Y),Ff._currentValue=J)}var Ge,tt;function Xe(u){if(Ge===void 0)try{throw Error()}catch(p){var d=p.stack.trim().match(/\n( *(at )?)/);Ge=d&&d[1]||"",tt=-1<p.stack.indexOf(`
at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Ge+u+tt}var je=!1;function Qe(u,d){if(!u||je)return"";je=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(d){var De=function(){throw Error()};if(Object.defineProperty(De.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(De,[])}catch(Ce){var ke=Ce}Reflect.construct(u,[],De)}else{try{De.call()}catch(Ce){ke=Ce}u.call(De.prototype)}}else{try{throw Error()}catch(Ce){ke=Ce}(De=u())&&typeof De.catch=="function"&&De.catch(function(){})}}catch(Ce){if(Ce&&ke&&typeof Ce.stack=="string")return[Ce.stack,ke.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var O=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");O&&O.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=v.DetermineComponentFrameRoot(),B=j[0],K=j[1];if(B&&K){var ue=B.split(`
`),Se=K.split(`
`);for(O=v=0;v<ue.length&&!ue[v].includes("DetermineComponentFrameRoot");)v++;for(;O<Se.length&&!Se[O].includes("DetermineComponentFrameRoot");)O++;if(v===ue.length||O===Se.length)for(v=ue.length-1,O=Se.length-1;1<=v&&0<=O&&ue[v]!==Se[O];)O--;for(;1<=v&&0<=O;v--,O--)if(ue[v]!==Se[O]){if(v!==1||O!==1)do if(v--,O--,0>O||ue[v]!==Se[O]){var Ee=`
`+ue[v].replace(" at new "," at ");return u.displayName&&Ee.includes("<anonymous>")&&(Ee=Ee.replace("<anonymous>",u.displayName)),Ee}while(1<=v&&0<=O);break}}}finally{je=!1,Error.prepareStackTrace=p}return(p=u?u.displayName||u.name:"")?Xe(p):""}function He(u,d){switch(u.tag){case 26:case 27:case 5:return Xe(u.type);case 16:return Xe("Lazy");case 13:return u.child!==d&&d!==null?Xe("Suspense Fallback"):Xe("Suspense");case 19:return Xe("SuspenseList");case 0:case 15:return Qe(u.type,!1);case 11:return Qe(u.type.render,!1);case 1:return Qe(u.type,!0);case 31:return Xe("Activity");default:return""}}function $e(u){try{var d="",p=null;do d+=He(u,p),p=u,u=u.return;while(u);return d}catch(v){return`
Error generating stack: `+v.message+`
`+v.stack}}var bt=Object.prototype.hasOwnProperty,ot=t.unstable_scheduleCallback,on=t.unstable_cancelCallback,Tn=t.unstable_shouldYield,Nn=t.unstable_requestPaint,Rt=t.unstable_now,xt=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Re=t.unstable_UserBlockingPriority,qe=t.unstable_NormalPriority,rt=t.unstable_LowPriority,wt=t.unstable_IdlePriority,jt=t.log,Ne=t.unstable_setDisableYieldValue,ie=null,xe=null;function Je(u){if(typeof jt=="function"&&Ne(u),xe&&typeof xe.setStrictMode=="function")try{xe.setStrictMode(ie,u)}catch{}}var dt=Math.clz32?Math.clz32:vn,er=Math.log,pt=Math.LN2;function vn(u){return u>>>=0,u===0?32:31-(er(u)/pt|0)|0}var vt=256,Wt=262144,Ht=4194304;function lt(u){var d=u&42;if(d!==0)return d;switch(u&-u){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 u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function ur(u,d,p){var v=u.pendingLanes;if(v===0)return 0;var O=0,j=u.suspendedLanes,B=u.pingedLanes;u=u.warmLanes;var K=v&134217727;return K!==0?(v=K&~j,v!==0?O=lt(v):(B&=K,B!==0?O=lt(B):p||(p=K&~u,p!==0&&(O=lt(p))))):(K=v&~j,K!==0?O=lt(K):B!==0?O=lt(B):p||(p=v&~u,p!==0&&(O=lt(p)))),O===0?0:d!==0&&d!==O&&(d&j)===0&&(j=O&-O,p=d&-d,j>=p||j===32&&(p&4194048)!==0)?d:O}function Xr(u,d){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&d)===0}function Yr(u,d){switch(u){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 dr(){var u=Ht;return Ht<<=1,(Ht&62914560)===0&&(Ht=4194304),u}function Nr(u){for(var d=[],p=0;31>p;p++)d.push(u);return d}function Is(u,d){u.pendingLanes|=d,d!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function xr(u,d,p,v,O,j){var B=u.pendingLanes;u.pendingLanes=p,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=p,u.entangledLanes&=p,u.errorRecoveryDisabledLanes&=p,u.shellSuspendCounter=0;var K=u.entanglements,ue=u.expirationTimes,Se=u.hiddenUpdates;for(p=B&~p;0<p;){var Ee=31-dt(p),De=1<<Ee;K[Ee]=0,ue[Ee]=-1;var ke=Se[Ee];if(ke!==null)for(Se[Ee]=null,Ee=0;Ee<ke.length;Ee++){var Ce=ke[Ee];Ce!==null&&(Ce.lane&=-536870913)}p&=~De}v!==0&&di(u,v,0),j!==0&&O===0&&u.tag!==0&&(u.suspendedLanes|=j&~(B&~d))}function di(u,d,p){u.pendingLanes|=d,u.suspendedLanes&=~d;var v=31-dt(d);u.entangledLanes|=d,u.entanglements[v]=u.entanglements[v]|1073741824|p&261930}function Ns(u,d){var p=u.entangledLanes|=d;for(u=u.entanglements;p;){var v=31-dt(p),O=1<<v;O&d|u[v]&d&&(u[v]|=d),p&=~O}}function Bs(u,d){var p=d&-d;return p=(p&42)!==0?1:da(p),(p&(u.suspendedLanes|d))!==0?0:p}function da(u){switch(u){case 2:u=1;break;case 8:u=4;break;case 32:u=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:u=128;break;case 268435456:u=134217728;break;default:u=0}return u}function ha(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function hi(){var u=W.p;return u!==0?u:(u=window.event,u===void 0?32:bC(u.type))}function Ra(u,d){var p=W.p;try{return W.p=u,d()}finally{W.p=p}}var qs=Math.random().toString(36).slice(2),Ir="__reactFiber$"+qs,ss="__reactProps$"+qs,kl="__reactContainer$"+qs,ef="__reactEvents$"+qs,Dy="__reactListeners$"+qs,zy="__reactHandles$"+qs,Sp="__reactResources$"+qs,Lc="__reactMarker$"+qs;function tf(u){delete u[Ir],delete u[ss],delete u[ef],delete u[Dy],delete u[zy]}function Ol(u){var d=u[Ir];if(d)return d;for(var p=u.parentNode;p;){if(d=p[kl]||p[Ir]){if(p=d.alternate,d.child!==null||p!==null&&p.child!==null)for(u=sC(u);u!==null;){if(p=u[Ir])return p;u=sC(u)}return d}u=p,p=u.parentNode}return null}function vo(u){if(u=u[Ir]||u[kl]){var d=u.tag;if(d===5||d===6||d===13||d===31||d===26||d===27||d===3)return u}return null}function Ic(u){var d=u.tag;if(d===5||d===26||d===27||d===6)return u.stateNode;throw Error(r(33))}function jl(u){var d=u[Sp];return d||(d=u[Sp]={hoistableStyles:new Map,hoistableScripts:new Map}),d}function Cr(u){u[Lc]=!0}var kp=new Set,Op={};function yo(u,d){bo(u,d),bo(u+"Capture",d)}function bo(u,d){for(Op[u]=d,u=0;u<d.length;u++)kp.add(d[u])}var Py=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),jp={},Np={};function nf(u){return bt.call(Np,u)?!0:bt.call(jp,u)?!1:Py.test(u)?Np[u]=!0:(jp[u]=!0,!1)}function Cp(u,d,p){if(nf(d))if(p===null)u.removeAttribute(d);else{switch(typeof p){case"undefined":case"function":case"symbol":u.removeAttribute(d);return;case"boolean":var v=d.toLowerCase().slice(0,5);if(v!=="data-"&&v!=="aria-"){u.removeAttribute(d);return}}u.setAttribute(d,""+p)}}function Tp(u,d,p){if(p===null)u.removeAttribute(d);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(d);return}u.setAttribute(d,""+p)}}function wo(u,d,p,v){if(v===null)u.removeAttribute(p);else{switch(typeof v){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(p);return}u.setAttributeNS(d,p,""+v)}}function Di(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function $j(u){var d=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function LW(u,d,p){var v=Object.getOwnPropertyDescriptor(u.constructor.prototype,d);if(!u.hasOwnProperty(d)&&typeof v<"u"&&typeof v.get=="function"&&typeof v.set=="function"){var O=v.get,j=v.set;return Object.defineProperty(u,d,{configurable:!0,get:function(){return O.call(this)},set:function(B){p=""+B,j.call(this,B)}}),Object.defineProperty(u,d,{enumerable:v.enumerable}),{getValue:function(){return p},setValue:function(B){p=""+B},stopTracking:function(){u._valueTracker=null,delete u[d]}}}}function Ly(u){if(!u._valueTracker){var d=$j(u)?"checked":"value";u._valueTracker=LW(u,d,""+u[d])}}function Qj(u){if(!u)return!1;var d=u._valueTracker;if(!d)return!0;var p=d.getValue(),v="";return u&&(v=$j(u)?u.checked?"true":"false":u.value),u=v,u!==p?(d.setValue(u),!0):!1}function Ep(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var IW=/[\n"\\]/g;function zi(u){return u.replace(IW,function(d){return"\\"+d.charCodeAt(0).toString(16)+" "})}function Iy(u,d,p,v,O,j,B,K){u.name="",B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?u.type=B:u.removeAttribute("type"),d!=null?B==="number"?(d===0&&u.value===""||u.value!=d)&&(u.value=""+Di(d)):u.value!==""+Di(d)&&(u.value=""+Di(d)):B!=="submit"&&B!=="reset"||u.removeAttribute("value"),d!=null?By(u,B,Di(d)):p!=null?By(u,B,Di(p)):v!=null&&u.removeAttribute("value"),O==null&&j!=null&&(u.defaultChecked=!!j),O!=null&&(u.checked=O&&typeof O!="function"&&typeof O!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?u.name=""+Di(K):u.removeAttribute("name")}function Hj(u,d,p,v,O,j,B,K){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(u.type=j),d!=null||p!=null){if(!(j!=="submit"&&j!=="reset"||d!=null)){Ly(u);return}p=p!=null?""+Di(p):"",d=d!=null?""+Di(d):p,K||d===u.value||(u.value=d),u.defaultValue=d}v=v??O,v=typeof v!="function"&&typeof v!="symbol"&&!!v,u.checked=K?u.checked:!!v,u.defaultChecked=!!v,B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"&&(u.name=B),Ly(u)}function By(u,d,p){d==="number"&&Ep(u.ownerDocument)===u||u.defaultValue===""+p||(u.defaultValue=""+p)}function Vu(u,d,p,v){if(u=u.options,d){d={};for(var O=0;O<p.length;O++)d["$"+p[O]]=!0;for(p=0;p<u.length;p++)O=d.hasOwnProperty("$"+u[p].value),u[p].selected!==O&&(u[p].selected=O),O&&v&&(u[p].defaultSelected=!0)}else{for(p=""+Di(p),d=null,O=0;O<u.length;O++){if(u[O].value===p){u[O].selected=!0,v&&(u[O].defaultSelected=!0);return}d!==null||u[O].disabled||(d=u[O])}d!==null&&(d.selected=!0)}}function Vj(u,d,p){if(d!=null&&(d=""+Di(d),d!==u.value&&(u.value=d),p==null)){u.defaultValue!==d&&(u.defaultValue=d);return}u.defaultValue=p!=null?""+Di(p):""}function Uj(u,d,p,v){if(d==null){if(v!=null){if(p!=null)throw Error(r(92));if(H(v)){if(1<v.length)throw Error(r(93));v=v[0]}p=v}p==null&&(p=""),d=p}p=Di(d),u.defaultValue=p,v=u.textContent,v===p&&v!==""&&v!==null&&(u.value=v),Ly(u)}function Uu(u,d){if(d){var p=u.firstChild;if(p&&p===u.lastChild&&p.nodeType===3){p.nodeValue=d;return}}u.textContent=d}var BW=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Wj(u,d,p){var v=d.indexOf("--")===0;p==null||typeof p=="boolean"||p===""?v?u.setProperty(d,""):d==="float"?u.cssFloat="":u[d]="":v?u.setProperty(d,p):typeof p!="number"||p===0||BW.has(d)?d==="float"?u.cssFloat=p:u[d]=(""+p).trim():u[d]=p+"px"}function Gj(u,d,p){if(d!=null&&typeof d!="object")throw Error(r(62));if(u=u.style,p!=null){for(var v in p)!p.hasOwnProperty(v)||d!=null&&d.hasOwnProperty(v)||(v.indexOf("--")===0?u.setProperty(v,""):v==="float"?u.cssFloat="":u[v]="");for(var O in d)v=d[O],d.hasOwnProperty(O)&&p[O]!==v&&Wj(u,O,v)}else for(var j in d)d.hasOwnProperty(j)&&Wj(u,j,d[j])}function qy(u){if(u.indexOf("-")===-1)return!1;switch(u){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var qW=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),FW=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function _p(u){return FW.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function So(){}var Fy=null;function $y(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Wu=null,Gu=null;function Xj(u){var d=vo(u);if(d&&(u=d.stateNode)){var p=u[ss]||null;e:switch(u=d.stateNode,d.type){case"input":if(Iy(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name),d=p.name,p.type==="radio"&&d!=null){for(p=u;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll('input[name="'+zi(""+d)+'"][type="radio"]'),d=0;d<p.length;d++){var v=p[d];if(v!==u&&v.form===u.form){var O=v[ss]||null;if(!O)throw Error(r(90));Iy(v,O.value,O.defaultValue,O.defaultValue,O.checked,O.defaultChecked,O.type,O.name)}}for(d=0;d<p.length;d++)v=p[d],v.form===u.form&&Qj(v)}break e;case"textarea":Vj(u,p.value,p.defaultValue);break e;case"select":d=p.value,d!=null&&Vu(u,!!p.multiple,d,!1)}}}var Qy=!1;function Yj(u,d,p){if(Qy)return u(d,p);Qy=!0;try{var v=u(d);return v}finally{if(Qy=!1,(Wu!==null||Gu!==null)&&(xg(),Wu&&(d=Wu,u=Gu,Gu=Wu=null,Xj(d),u)))for(d=0;d<u.length;d++)Xj(u[d])}}function rf(u,d){var p=u.stateNode;if(p===null)return null;var v=p[ss]||null;if(v===null)return null;p=v[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(v=!v.disabled)||(u=u.type,v=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!v;break e;default:u=!1}if(u)return null;if(p&&typeof p!="function")throw Error(r(231,d,typeof p));return p}var ko=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hy=!1;if(ko)try{var sf={};Object.defineProperty(sf,"passive",{get:function(){Hy=!0}}),window.addEventListener("test",sf,sf),window.removeEventListener("test",sf,sf)}catch{Hy=!1}var Nl=null,Vy=null,Mp=null;function Kj(){if(Mp)return Mp;var u,d=Vy,p=d.length,v,O="value"in Nl?Nl.value:Nl.textContent,j=O.length;for(u=0;u<p&&d[u]===O[u];u++);var B=p-u;for(v=1;v<=B&&d[p-v]===O[j-v];v++);return Mp=O.slice(u,1<v?1-v:void 0)}function Ap(u){var d=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&d===13&&(u=13)):u=d,u===10&&(u=13),32<=u||u===13?u:0}function Rp(){return!0}function Zj(){return!1}function Fs(u){function d(p,v,O,j,B){this._reactName=p,this._targetInst=O,this.type=v,this.nativeEvent=j,this.target=B,this.currentTarget=null;for(var K in u)u.hasOwnProperty(K)&&(p=u[K],this[K]=p?p(j):j[K]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?Rp:Zj,this.isPropagationStopped=Zj,this}return m(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=Rp)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=Rp)},persist:function(){},isPersistent:Rp}),d}var Bc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dp=Fs(Bc),af=m({},Bc,{view:0,detail:0}),$W=Fs(af),Uy,Wy,of,zp=m({},af,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xy,button:0,buttons:0,relatedTarget:function(u){return u.relatedTarget===void 0?u.fromElement===u.srcElement?u.toElement:u.fromElement:u.relatedTarget},movementX:function(u){return"movementX"in u?u.movementX:(u!==of&&(of&&u.type==="mousemove"?(Uy=u.screenX-of.screenX,Wy=u.screenY-of.screenY):Wy=Uy=0,of=u),Uy)},movementY:function(u){return"movementY"in u?u.movementY:Wy}}),Jj=Fs(zp),QW=m({},zp,{dataTransfer:0}),HW=Fs(QW),VW=m({},af,{relatedTarget:0}),Gy=Fs(VW),UW=m({},Bc,{animationName:0,elapsedTime:0,pseudoElement:0}),WW=Fs(UW),GW=m({},Bc,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),XW=Fs(GW),YW=m({},Bc,{data:0}),e7=Fs(YW),KW={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ZW={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},JW={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function eG(u){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(u):(u=JW[u])?!!d[u]:!1}function Xy(){return eG}var tG=m({},af,{key:function(u){if(u.key){var d=KW[u.key]||u.key;if(d!=="Unidentified")return d}return u.type==="keypress"?(u=Ap(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?ZW[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xy,charCode:function(u){return u.type==="keypress"?Ap(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?Ap(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),nG=Fs(tG),rG=m({},zp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),t7=Fs(rG),sG=m({},af,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xy}),iG=Fs(sG),aG=m({},Bc,{propertyName:0,elapsedTime:0,pseudoElement:0}),oG=Fs(aG),lG=m({},zp,{deltaX:function(u){return"deltaX"in u?u.deltaX:"wheelDeltaX"in u?-u.wheelDeltaX:0},deltaY:function(u){return"deltaY"in u?u.deltaY:"wheelDeltaY"in u?-u.wheelDeltaY:"wheelDelta"in u?-u.wheelDelta:0},deltaZ:0,deltaMode:0}),cG=Fs(lG),uG=m({},Bc,{newState:0,oldState:0}),dG=Fs(uG),hG=[9,13,27,32],Yy=ko&&"CompositionEvent"in window,lf=null;ko&&"documentMode"in document&&(lf=document.documentMode);var fG=ko&&"TextEvent"in window&&!lf,n7=ko&&(!Yy||lf&&8<lf&&11>=lf),r7=" ",s7=!1;function i7(u,d){switch(u){case"keyup":return hG.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function a7(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Xu=!1;function mG(u,d){switch(u){case"compositionend":return a7(d);case"keypress":return d.which!==32?null:(s7=!0,r7);case"textInput":return u=d.data,u===r7&&s7?null:u;default:return null}}function pG(u,d){if(Xu)return u==="compositionend"||!Yy&&i7(u,d)?(u=Kj(),Mp=Vy=Nl=null,Xu=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1<d.char.length)return d.char;if(d.which)return String.fromCharCode(d.which)}return null;case"compositionend":return n7&&d.locale!=="ko"?null:d.data;default:return null}}var gG={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function o7(u){var d=u&&u.nodeName&&u.nodeName.toLowerCase();return d==="input"?!!gG[u.type]:d==="textarea"}function l7(u,d,p,v){Wu?Gu?Gu.push(v):Gu=[v]:Wu=v,d=Og(d,"onChange"),0<d.length&&(p=new Dp("onChange","change",null,p,v),u.push({event:p,listeners:d}))}var cf=null,uf=null;function xG(u){H8(u,0)}function Pp(u){var d=Ic(u);if(Qj(d))return u}function c7(u,d){if(u==="change")return d}var u7=!1;if(ko){var Ky;if(ko){var Zy="oninput"in document;if(!Zy){var d7=document.createElement("div");d7.setAttribute("oninput","return;"),Zy=typeof d7.oninput=="function"}Ky=Zy}else Ky=!1;u7=Ky&&(!document.documentMode||9<document.documentMode)}function h7(){cf&&(cf.detachEvent("onpropertychange",f7),uf=cf=null)}function f7(u){if(u.propertyName==="value"&&Pp(uf)){var d=[];l7(d,uf,u,$y(u)),Yj(xG,d)}}function vG(u,d,p){u==="focusin"?(h7(),cf=d,uf=p,cf.attachEvent("onpropertychange",f7)):u==="focusout"&&h7()}function yG(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Pp(uf)}function bG(u,d){if(u==="click")return Pp(d)}function wG(u,d){if(u==="input"||u==="change")return Pp(d)}function SG(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var fi=typeof Object.is=="function"?Object.is:SG;function df(u,d){if(fi(u,d))return!0;if(typeof u!="object"||u===null||typeof d!="object"||d===null)return!1;var p=Object.keys(u),v=Object.keys(d);if(p.length!==v.length)return!1;for(v=0;v<p.length;v++){var O=p[v];if(!bt.call(d,O)||!fi(u[O],d[O]))return!1}return!0}function m7(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function p7(u,d){var p=m7(u);u=0;for(var v;p;){if(p.nodeType===3){if(v=u+p.textContent.length,u<=d&&v>=d)return{node:p,offset:d-u};u=v}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=m7(p)}}function g7(u,d){return u&&d?u===d?!0:u&&u.nodeType===3?!1:d&&d.nodeType===3?g7(u,d.parentNode):"contains"in u?u.contains(d):u.compareDocumentPosition?!!(u.compareDocumentPosition(d)&16):!1:!1}function x7(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var d=Ep(u.document);d instanceof u.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)u=d.contentWindow;else break;d=Ep(u.document)}return d}function Jy(u){var d=u&&u.nodeName&&u.nodeName.toLowerCase();return d&&(d==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||d==="textarea"||u.contentEditable==="true")}var kG=ko&&"documentMode"in document&&11>=document.documentMode,Yu=null,eb=null,hf=null,tb=!1;function v7(u,d,p){var v=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;tb||Yu==null||Yu!==Ep(v)||(v=Yu,"selectionStart"in v&&Jy(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}),hf&&df(hf,v)||(hf=v,v=Og(eb,"onSelect"),0<v.length&&(d=new Dp("onSelect","select",null,d,p),u.push({event:d,listeners:v}),d.target=Yu)))}function qc(u,d){var p={};return p[u.toLowerCase()]=d.toLowerCase(),p["Webkit"+u]="webkit"+d,p["Moz"+u]="moz"+d,p}var Ku={animationend:qc("Animation","AnimationEnd"),animationiteration:qc("Animation","AnimationIteration"),animationstart:qc("Animation","AnimationStart"),transitionrun:qc("Transition","TransitionRun"),transitionstart:qc("Transition","TransitionStart"),transitioncancel:qc("Transition","TransitionCancel"),transitionend:qc("Transition","TransitionEnd")},nb={},y7={};ko&&(y7=document.createElement("div").style,"AnimationEvent"in window||(delete Ku.animationend.animation,delete Ku.animationiteration.animation,delete Ku.animationstart.animation),"TransitionEvent"in window||delete Ku.transitionend.transition);function Fc(u){if(nb[u])return nb[u];if(!Ku[u])return u;var d=Ku[u],p;for(p in d)if(d.hasOwnProperty(p)&&p in y7)return nb[u]=d[p];return u}var b7=Fc("animationend"),w7=Fc("animationiteration"),S7=Fc("animationstart"),OG=Fc("transitionrun"),jG=Fc("transitionstart"),NG=Fc("transitioncancel"),k7=Fc("transitionend"),O7=new Map,rb="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");rb.push("scrollEnd");function fa(u,d){O7.set(u,d),yo(d,[u])}var Lp=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var d=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof u=="object"&&u!==null&&typeof u.message=="string"?String(u.message):String(u),error:u});if(!window.dispatchEvent(d))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}console.error(u)},Pi=[],Zu=0,sb=0;function Ip(){for(var u=Zu,d=sb=Zu=0;d<u;){var p=Pi[d];Pi[d++]=null;var v=Pi[d];Pi[d++]=null;var O=Pi[d];Pi[d++]=null;var j=Pi[d];if(Pi[d++]=null,v!==null&&O!==null){var B=v.pending;B===null?O.next=O:(O.next=B.next,B.next=O),v.pending=O}j!==0&&j7(p,O,j)}}function Bp(u,d,p,v){Pi[Zu++]=u,Pi[Zu++]=d,Pi[Zu++]=p,Pi[Zu++]=v,sb|=v,u.lanes|=v,u=u.alternate,u!==null&&(u.lanes|=v)}function ib(u,d,p,v){return Bp(u,d,p,v),qp(u)}function $c(u,d){return Bp(u,null,null,d),qp(u)}function j7(u,d,p){u.lanes|=p;var v=u.alternate;v!==null&&(v.lanes|=p);for(var O=!1,j=u.return;j!==null;)j.childLanes|=p,v=j.alternate,v!==null&&(v.childLanes|=p),j.tag===22&&(u=j.stateNode,u===null||u._visibility&1||(O=!0)),u=j,j=j.return;return u.tag===3?(j=u.stateNode,O&&d!==null&&(O=31-dt(p),u=j.hiddenUpdates,v=u[O],v===null?u[O]=[d]:v.push(d),d.lane=p|536870912),j):null}function qp(u){if(50<Df)throw Df=0,m2=null,Error(r(185));for(var d=u.return;d!==null;)u=d,d=u.return;return u.tag===3?u.stateNode:null}var Ju={};function CG(u,d,p,v){this.tag=u,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mi(u,d,p,v){return new CG(u,d,p,v)}function ab(u){return u=u.prototype,!(!u||!u.isReactComponent)}function Oo(u,d){var p=u.alternate;return p===null?(p=mi(u.tag,d,u.key,u.mode),p.elementType=u.elementType,p.type=u.type,p.stateNode=u.stateNode,p.alternate=u,u.alternate=p):(p.pendingProps=d,p.type=u.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=u.flags&65011712,p.childLanes=u.childLanes,p.lanes=u.lanes,p.child=u.child,p.memoizedProps=u.memoizedProps,p.memoizedState=u.memoizedState,p.updateQueue=u.updateQueue,d=u.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=u.sibling,p.index=u.index,p.ref=u.ref,p.refCleanup=u.refCleanup,p}function N7(u,d){u.flags&=65011714;var p=u.alternate;return p===null?(u.childLanes=0,u.lanes=d,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=p.childLanes,u.lanes=p.lanes,u.child=p.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=p.memoizedProps,u.memoizedState=p.memoizedState,u.updateQueue=p.updateQueue,u.type=p.type,d=p.dependencies,u.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext}),u}function Fp(u,d,p,v,O,j){var B=0;if(v=u,typeof u=="function")ab(u)&&(B=1);else if(typeof u=="string")B=AX(u,p,U.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case L:return u=mi(31,p,d,O),u.elementType=L,u.lanes=j,u;case w:return Qc(p.children,O,j,d);case S:B=8,O|=24;break;case k:return u=mi(12,p,d,O|2),u.elementType=k,u.lanes=j,u;case _:return u=mi(13,p,d,O),u.elementType=_,u.lanes=j,u;case E:return u=mi(19,p,d,O),u.elementType=E,u.lanes=j,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case C:B=10;break e;case N:B=9;break e;case T:B=11;break e;case M:B=14;break e;case q:B=16,v=null;break e}B=29,p=Error(r(130,u===null?"null":typeof u,"")),v=null}return d=mi(B,p,d,O),d.elementType=u,d.type=v,d.lanes=j,d}function Qc(u,d,p,v){return u=mi(7,u,v,d),u.lanes=p,u}function ob(u,d,p){return u=mi(6,u,null,d),u.lanes=p,u}function C7(u){var d=mi(18,null,null,0);return d.stateNode=u,d}function lb(u,d,p){return d=mi(4,u.children!==null?u.children:[],u.key,d),d.lanes=p,d.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},d}var T7=new WeakMap;function Li(u,d){if(typeof u=="object"&&u!==null){var p=T7.get(u);return p!==void 0?p:(d={value:u,source:d,stack:$e(d)},T7.set(u,d),d)}return{value:u,source:d,stack:$e(d)}}var ed=[],td=0,$p=null,ff=0,Ii=[],Bi=0,Cl=null,Da=1,za="";function jo(u,d){ed[td++]=ff,ed[td++]=$p,$p=u,ff=d}function E7(u,d,p){Ii[Bi++]=Da,Ii[Bi++]=za,Ii[Bi++]=Cl,Cl=u;var v=Da;u=za;var O=32-dt(v)-1;v&=~(1<<O),p+=1;var j=32-dt(d)+O;if(30<j){var B=O-O%5;j=(v&(1<<B)-1).toString(32),v>>=B,O-=B,Da=1<<32-dt(d)+O|p<<O|v,za=j+u}else Da=1<<j|p<<O|v,za=u}function cb(u){u.return!==null&&(jo(u,1),E7(u,1,0))}function ub(u){for(;u===$p;)$p=ed[--td],ed[td]=null,ff=ed[--td],ed[td]=null;for(;u===Cl;)Cl=Ii[--Bi],Ii[Bi]=null,za=Ii[--Bi],Ii[Bi]=null,Da=Ii[--Bi],Ii[Bi]=null}function _7(u,d){Ii[Bi++]=Da,Ii[Bi++]=za,Ii[Bi++]=Cl,Da=d.id,za=d.overflow,Cl=u}var is=null,Yn=null,tn=!1,Tl=null,qi=!1,db=Error(r(519));function El(u){var d=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw mf(Li(d,u)),db}function M7(u){var d=u.stateNode,p=u.type,v=u.memoizedProps;switch(d[Ir]=u,d[ss]=v,p){case"dialog":Xt("cancel",d),Xt("close",d);break;case"iframe":case"object":case"embed":Xt("load",d);break;case"video":case"audio":for(p=0;p<Pf.length;p++)Xt(Pf[p],d);break;case"source":Xt("error",d);break;case"img":case"image":case"link":Xt("error",d),Xt("load",d);break;case"details":Xt("toggle",d);break;case"input":Xt("invalid",d),Hj(d,v.value,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name,!0);break;case"select":Xt("invalid",d);break;case"textarea":Xt("invalid",d),Uj(d,v.value,v.defaultValue,v.children)}p=v.children,typeof p!="string"&&typeof p!="number"&&typeof p!="bigint"||d.textContent===""+p||v.suppressHydrationWarning===!0||G8(d.textContent,p)?(v.popover!=null&&(Xt("beforetoggle",d),Xt("toggle",d)),v.onScroll!=null&&Xt("scroll",d),v.onScrollEnd!=null&&Xt("scrollend",d),v.onClick!=null&&(d.onclick=So),d=!0):d=!1,d||El(u,!0)}function A7(u){for(is=u.return;is;)switch(is.tag){case 5:case 31:case 13:qi=!1;return;case 27:case 3:qi=!0;return;default:is=is.return}}function nd(u){if(u!==is)return!1;if(!tn)return A7(u),tn=!0,!1;var d=u.tag,p;if((p=d!==3&&d!==27)&&((p=d===5)&&(p=u.type,p=!(p!=="form"&&p!=="button")||E2(u.type,u.memoizedProps)),p=!p),p&&Yn&&El(u),A7(u),d===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Yn=rC(u)}else if(d===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Yn=rC(u)}else d===27?(d=Yn,Ql(u.type)?(u=D2,D2=null,Yn=u):Yn=d):Yn=is?$i(u.stateNode.nextSibling):null;return!0}function Hc(){Yn=is=null,tn=!1}function hb(){var u=Tl;return u!==null&&(Vs===null?Vs=u:Vs.push.apply(Vs,u),Tl=null),u}function mf(u){Tl===null?Tl=[u]:Tl.push(u)}var fb=se(null),Vc=null,No=null;function _l(u,d,p){F(fb,d._currentValue),d._currentValue=p}function Co(u){u._currentValue=fb.current,G(fb)}function mb(u,d,p){for(;u!==null;){var v=u.alternate;if((u.childLanes&d)!==d?(u.childLanes|=d,v!==null&&(v.childLanes|=d)):v!==null&&(v.childLanes&d)!==d&&(v.childLanes|=d),u===p)break;u=u.return}}function pb(u,d,p,v){var O=u.child;for(O!==null&&(O.return=u);O!==null;){var j=O.dependencies;if(j!==null){var B=O.child;j=j.firstContext;e:for(;j!==null;){var K=j;j=O;for(var ue=0;ue<d.length;ue++)if(K.context===d[ue]){j.lanes|=p,K=j.alternate,K!==null&&(K.lanes|=p),mb(j.return,p,u),v||(B=null);break e}j=K.next}}else if(O.tag===18){if(B=O.return,B===null)throw Error(r(341));B.lanes|=p,j=B.alternate,j!==null&&(j.lanes|=p),mb(B,p,u),B=null}else B=O.child;if(B!==null)B.return=O;else for(B=O;B!==null;){if(B===u){B=null;break}if(O=B.sibling,O!==null){O.return=B.return,B=O;break}B=B.return}O=B}}function rd(u,d,p,v){u=null;for(var O=d,j=!1;O!==null;){if(!j){if((O.flags&524288)!==0)j=!0;else if((O.flags&262144)!==0)break}if(O.tag===10){var B=O.alternate;if(B===null)throw Error(r(387));if(B=B.memoizedProps,B!==null){var K=O.type;fi(O.pendingProps.value,B.value)||(u!==null?u.push(K):u=[K])}}else if(O===Y.current){if(B=O.alternate,B===null)throw Error(r(387));B.memoizedState.memoizedState!==O.memoizedState.memoizedState&&(u!==null?u.push(Ff):u=[Ff])}O=O.return}u!==null&&pb(d,u,p,v),d.flags|=262144}function Qp(u){for(u=u.firstContext;u!==null;){if(!fi(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function Uc(u){Vc=u,No=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function as(u){return R7(Vc,u)}function Hp(u,d){return Vc===null&&Uc(u),R7(u,d)}function R7(u,d){var p=d._currentValue;if(d={context:d,memoizedValue:p,next:null},No===null){if(u===null)throw Error(r(308));No=d,u.dependencies={lanes:0,firstContext:d},u.flags|=524288}else No=No.next=d;return p}var TG=typeof AbortController<"u"?AbortController:function(){var u=[],d=this.signal={aborted:!1,addEventListener:function(p,v){u.push(v)}};this.abort=function(){d.aborted=!0,u.forEach(function(p){return p()})}},EG=t.unstable_scheduleCallback,_G=t.unstable_NormalPriority,Tr={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gb(){return{controller:new TG,data:new Map,refCount:0}}function pf(u){u.refCount--,u.refCount===0&&EG(_G,function(){u.controller.abort()})}var gf=null,xb=0,sd=0,id=null;function MG(u,d){if(gf===null){var p=gf=[];xb=0,sd=b2(),id={status:"pending",value:void 0,then:function(v){p.push(v)}}}return xb++,d.then(D7,D7),d}function D7(){if(--xb===0&&gf!==null){id!==null&&(id.status="fulfilled");var u=gf;gf=null,sd=0,id=null;for(var d=0;d<u.length;d++)(0,u[d])()}}function AG(u,d){var p=[],v={status:"pending",value:null,reason:null,then:function(O){p.push(O)}};return u.then(function(){v.status="fulfilled",v.value=d;for(var O=0;O<p.length;O++)(0,p[O])(d)},function(O){for(v.status="rejected",v.reason=O,O=0;O<p.length;O++)(0,p[O])(void 0)}),v}var z7=P.S;P.S=function(u,d){v8=Rt(),typeof d=="object"&&d!==null&&typeof d.then=="function"&&MG(u,d),z7!==null&&z7(u,d)};var Wc=se(null);function vb(){var u=Wc.current;return u!==null?u:Fn.pooledCache}function Vp(u,d){d===null?F(Wc,Wc.current):F(Wc,d.pool)}function P7(){var u=vb();return u===null?null:{parent:Tr._currentValue,pool:u}}var ad=Error(r(460)),yb=Error(r(474)),Up=Error(r(542)),Wp={then:function(){}};function L7(u){return u=u.status,u==="fulfilled"||u==="rejected"}function I7(u,d,p){switch(p=u[p],p===void 0?u.push(d):p!==d&&(d.then(So,So),d=p),d.status){case"fulfilled":return d.value;case"rejected":throw u=d.reason,q7(u),u;default:if(typeof d.status=="string")d.then(So,So);else{if(u=Fn,u!==null&&100<u.shellSuspendCounter)throw Error(r(482));u=d,u.status="pending",u.then(function(v){if(d.status==="pending"){var O=d;O.status="fulfilled",O.value=v}},function(v){if(d.status==="pending"){var O=d;O.status="rejected",O.reason=v}})}switch(d.status){case"fulfilled":return d.value;case"rejected":throw u=d.reason,q7(u),u}throw Xc=d,ad}}function Gc(u){try{var d=u._init;return d(u._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(Xc=p,ad):p}}var Xc=null;function B7(){if(Xc===null)throw Error(r(459));var u=Xc;return Xc=null,u}function q7(u){if(u===ad||u===Up)throw Error(r(483))}var od=null,xf=0;function Gp(u){var d=xf;return xf+=1,od===null&&(od=[]),I7(od,u,d)}function vf(u,d){d=d.props.ref,u.ref=d!==void 0?d:null}function Xp(u,d){throw d.$$typeof===g?Error(r(525)):(u=Object.prototype.toString.call(d),Error(r(31,u==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":u)))}function F7(u){function d(ge,fe){if(u){var be=ge.deletions;be===null?(ge.deletions=[fe],ge.flags|=16):be.push(fe)}}function p(ge,fe){if(!u)return null;for(;fe!==null;)d(ge,fe),fe=fe.sibling;return null}function v(ge){for(var fe=new Map;ge!==null;)ge.key!==null?fe.set(ge.key,ge):fe.set(ge.index,ge),ge=ge.sibling;return fe}function O(ge,fe){return ge=Oo(ge,fe),ge.index=0,ge.sibling=null,ge}function j(ge,fe,be){return ge.index=be,u?(be=ge.alternate,be!==null?(be=be.index,be<fe?(ge.flags|=67108866,fe):be):(ge.flags|=67108866,fe)):(ge.flags|=1048576,fe)}function B(ge){return u&&ge.alternate===null&&(ge.flags|=67108866),ge}function K(ge,fe,be,Me){return fe===null||fe.tag!==6?(fe=ob(be,ge.mode,Me),fe.return=ge,fe):(fe=O(fe,be),fe.return=ge,fe)}function ue(ge,fe,be,Me){var yt=be.type;return yt===w?Ee(ge,fe,be.props.children,Me,be.key):fe!==null&&(fe.elementType===yt||typeof yt=="object"&&yt!==null&&yt.$$typeof===q&&Gc(yt)===fe.type)?(fe=O(fe,be.props),vf(fe,be),fe.return=ge,fe):(fe=Fp(be.type,be.key,be.props,null,ge.mode,Me),vf(fe,be),fe.return=ge,fe)}function Se(ge,fe,be,Me){return fe===null||fe.tag!==4||fe.stateNode.containerInfo!==be.containerInfo||fe.stateNode.implementation!==be.implementation?(fe=lb(be,ge.mode,Me),fe.return=ge,fe):(fe=O(fe,be.children||[]),fe.return=ge,fe)}function Ee(ge,fe,be,Me,yt){return fe===null||fe.tag!==7?(fe=Qc(be,ge.mode,Me,yt),fe.return=ge,fe):(fe=O(fe,be),fe.return=ge,fe)}function De(ge,fe,be){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return fe=ob(""+fe,ge.mode,be),fe.return=ge,fe;if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case x:return be=Fp(fe.type,fe.key,fe.props,null,ge.mode,be),vf(be,fe),be.return=ge,be;case y:return fe=lb(fe,ge.mode,be),fe.return=ge,fe;case q:return fe=Gc(fe),De(ge,fe,be)}if(H(fe)||V(fe))return fe=Qc(fe,ge.mode,be,null),fe.return=ge,fe;if(typeof fe.then=="function")return De(ge,Gp(fe),be);if(fe.$$typeof===C)return De(ge,Hp(ge,fe),be);Xp(ge,fe)}return null}function ke(ge,fe,be,Me){var yt=fe!==null?fe.key:null;if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return yt!==null?null:K(ge,fe,""+be,Me);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case x:return be.key===yt?ue(ge,fe,be,Me):null;case y:return be.key===yt?Se(ge,fe,be,Me):null;case q:return be=Gc(be),ke(ge,fe,be,Me)}if(H(be)||V(be))return yt!==null?null:Ee(ge,fe,be,Me,null);if(typeof be.then=="function")return ke(ge,fe,Gp(be),Me);if(be.$$typeof===C)return ke(ge,fe,Hp(ge,be),Me);Xp(ge,be)}return null}function Ce(ge,fe,be,Me,yt){if(typeof Me=="string"&&Me!==""||typeof Me=="number"||typeof Me=="bigint")return ge=ge.get(be)||null,K(fe,ge,""+Me,yt);if(typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case x:return ge=ge.get(Me.key===null?be:Me.key)||null,ue(fe,ge,Me,yt);case y:return ge=ge.get(Me.key===null?be:Me.key)||null,Se(fe,ge,Me,yt);case q:return Me=Gc(Me),Ce(ge,fe,be,Me,yt)}if(H(Me)||V(Me))return ge=ge.get(be)||null,Ee(fe,ge,Me,yt,null);if(typeof Me.then=="function")return Ce(ge,fe,be,Gp(Me),yt);if(Me.$$typeof===C)return Ce(ge,fe,be,Hp(fe,Me),yt);Xp(fe,Me)}return null}function st(ge,fe,be,Me){for(var yt=null,yn=null,ct=fe,Bt=fe=0,Zt=null;ct!==null&&Bt<be.length;Bt++){ct.index>Bt?(Zt=ct,ct=null):Zt=ct.sibling;var bn=ke(ge,ct,be[Bt],Me);if(bn===null){ct===null&&(ct=Zt);break}u&&ct&&bn.alternate===null&&d(ge,ct),fe=j(bn,fe,Bt),yn===null?yt=bn:yn.sibling=bn,yn=bn,ct=Zt}if(Bt===be.length)return p(ge,ct),tn&&jo(ge,Bt),yt;if(ct===null){for(;Bt<be.length;Bt++)ct=De(ge,be[Bt],Me),ct!==null&&(fe=j(ct,fe,Bt),yn===null?yt=ct:yn.sibling=ct,yn=ct);return tn&&jo(ge,Bt),yt}for(ct=v(ct);Bt<be.length;Bt++)Zt=Ce(ct,ge,Bt,be[Bt],Me),Zt!==null&&(u&&Zt.alternate!==null&&ct.delete(Zt.key===null?Bt:Zt.key),fe=j(Zt,fe,Bt),yn===null?yt=Zt:yn.sibling=Zt,yn=Zt);return u&&ct.forEach(function(Gl){return d(ge,Gl)}),tn&&jo(ge,Bt),yt}function Ot(ge,fe,be,Me){if(be==null)throw Error(r(151));for(var yt=null,yn=null,ct=fe,Bt=fe=0,Zt=null,bn=be.next();ct!==null&&!bn.done;Bt++,bn=be.next()){ct.index>Bt?(Zt=ct,ct=null):Zt=ct.sibling;var Gl=ke(ge,ct,bn.value,Me);if(Gl===null){ct===null&&(ct=Zt);break}u&&ct&&Gl.alternate===null&&d(ge,ct),fe=j(Gl,fe,Bt),yn===null?yt=Gl:yn.sibling=Gl,yn=Gl,ct=Zt}if(bn.done)return p(ge,ct),tn&&jo(ge,Bt),yt;if(ct===null){for(;!bn.done;Bt++,bn=be.next())bn=De(ge,bn.value,Me),bn!==null&&(fe=j(bn,fe,Bt),yn===null?yt=bn:yn.sibling=bn,yn=bn);return tn&&jo(ge,Bt),yt}for(ct=v(ct);!bn.done;Bt++,bn=be.next())bn=Ce(ct,ge,Bt,bn.value,Me),bn!==null&&(u&&bn.alternate!==null&&ct.delete(bn.key===null?Bt:bn.key),fe=j(bn,fe,Bt),yn===null?yt=bn:yn.sibling=bn,yn=bn);return u&&ct.forEach(function(QX){return d(ge,QX)}),tn&&jo(ge,Bt),yt}function zn(ge,fe,be,Me){if(typeof be=="object"&&be!==null&&be.type===w&&be.key===null&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case x:e:{for(var yt=be.key;fe!==null;){if(fe.key===yt){if(yt=be.type,yt===w){if(fe.tag===7){p(ge,fe.sibling),Me=O(fe,be.props.children),Me.return=ge,ge=Me;break e}}else if(fe.elementType===yt||typeof yt=="object"&&yt!==null&&yt.$$typeof===q&&Gc(yt)===fe.type){p(ge,fe.sibling),Me=O(fe,be.props),vf(Me,be),Me.return=ge,ge=Me;break e}p(ge,fe);break}else d(ge,fe);fe=fe.sibling}be.type===w?(Me=Qc(be.props.children,ge.mode,Me,be.key),Me.return=ge,ge=Me):(Me=Fp(be.type,be.key,be.props,null,ge.mode,Me),vf(Me,be),Me.return=ge,ge=Me)}return B(ge);case y:e:{for(yt=be.key;fe!==null;){if(fe.key===yt)if(fe.tag===4&&fe.stateNode.containerInfo===be.containerInfo&&fe.stateNode.implementation===be.implementation){p(ge,fe.sibling),Me=O(fe,be.children||[]),Me.return=ge,ge=Me;break e}else{p(ge,fe);break}else d(ge,fe);fe=fe.sibling}Me=lb(be,ge.mode,Me),Me.return=ge,ge=Me}return B(ge);case q:return be=Gc(be),zn(ge,fe,be,Me)}if(H(be))return st(ge,fe,be,Me);if(V(be)){if(yt=V(be),typeof yt!="function")throw Error(r(150));return be=yt.call(be),Ot(ge,fe,be,Me)}if(typeof be.then=="function")return zn(ge,fe,Gp(be),Me);if(be.$$typeof===C)return zn(ge,fe,Hp(ge,be),Me);Xp(ge,be)}return typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint"?(be=""+be,fe!==null&&fe.tag===6?(p(ge,fe.sibling),Me=O(fe,be),Me.return=ge,ge=Me):(p(ge,fe),Me=ob(be,ge.mode,Me),Me.return=ge,ge=Me),B(ge)):p(ge,fe)}return function(ge,fe,be,Me){try{xf=0;var yt=zn(ge,fe,be,Me);return od=null,yt}catch(ct){if(ct===ad||ct===Up)throw ct;var yn=mi(29,ct,null,ge.mode);return yn.lanes=Me,yn.return=ge,yn}finally{}}}var Yc=F7(!0),$7=F7(!1),Ml=!1;function bb(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wb(u,d){u=u.updateQueue,d.updateQueue===u&&(d.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function Al(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function Rl(u,d,p){var v=u.updateQueue;if(v===null)return null;if(v=v.shared,(Cn&2)!==0){var O=v.pending;return O===null?d.next=d:(d.next=O.next,O.next=d),v.pending=d,d=qp(u),j7(u,null,p),d}return Bp(u,v,d,p),qp(u)}function yf(u,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194048)!==0)){var v=d.lanes;v&=u.pendingLanes,p|=v,d.lanes=p,Ns(u,p)}}function Sb(u,d){var p=u.updateQueue,v=u.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var O=null,j=null;if(p=p.firstBaseUpdate,p!==null){do{var B={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};j===null?O=j=B:j=j.next=B,p=p.next}while(p!==null);j===null?O=j=d:j=j.next=d}else O=j=d;p={baseState:v.baseState,firstBaseUpdate:O,lastBaseUpdate:j,shared:v.shared,callbacks:v.callbacks},u.updateQueue=p;return}u=p.lastBaseUpdate,u===null?p.firstBaseUpdate=d:u.next=d,p.lastBaseUpdate=d}var kb=!1;function bf(){if(kb){var u=id;if(u!==null)throw u}}function wf(u,d,p,v){kb=!1;var O=u.updateQueue;Ml=!1;var j=O.firstBaseUpdate,B=O.lastBaseUpdate,K=O.shared.pending;if(K!==null){O.shared.pending=null;var ue=K,Se=ue.next;ue.next=null,B===null?j=Se:B.next=Se,B=ue;var Ee=u.alternate;Ee!==null&&(Ee=Ee.updateQueue,K=Ee.lastBaseUpdate,K!==B&&(K===null?Ee.firstBaseUpdate=Se:K.next=Se,Ee.lastBaseUpdate=ue))}if(j!==null){var De=O.baseState;B=0,Ee=Se=ue=null,K=j;do{var ke=K.lane&-536870913,Ce=ke!==K.lane;if(Ce?(Kt&ke)===ke:(v&ke)===ke){ke!==0&&ke===sd&&(kb=!0),Ee!==null&&(Ee=Ee.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var st=u,Ot=K;ke=d;var zn=p;switch(Ot.tag){case 1:if(st=Ot.payload,typeof st=="function"){De=st.call(zn,De,ke);break e}De=st;break e;case 3:st.flags=st.flags&-65537|128;case 0:if(st=Ot.payload,ke=typeof st=="function"?st.call(zn,De,ke):st,ke==null)break e;De=m({},De,ke);break e;case 2:Ml=!0}}ke=K.callback,ke!==null&&(u.flags|=64,Ce&&(u.flags|=8192),Ce=O.callbacks,Ce===null?O.callbacks=[ke]:Ce.push(ke))}else Ce={lane:ke,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ee===null?(Se=Ee=Ce,ue=De):Ee=Ee.next=Ce,B|=ke;if(K=K.next,K===null){if(K=O.shared.pending,K===null)break;Ce=K,K=Ce.next,Ce.next=null,O.lastBaseUpdate=Ce,O.shared.pending=null}}while(!0);Ee===null&&(ue=De),O.baseState=ue,O.firstBaseUpdate=Se,O.lastBaseUpdate=Ee,j===null&&(O.shared.lanes=0),Il|=B,u.lanes=B,u.memoizedState=De}}function Q7(u,d){if(typeof u!="function")throw Error(r(191,u));u.call(d)}function H7(u,d){var p=u.callbacks;if(p!==null)for(u.callbacks=null,u=0;u<p.length;u++)Q7(p[u],d)}var ld=se(null),Yp=se(0);function V7(u,d){u=Po,F(Yp,u),F(ld,d),Po=u|d.baseLanes}function Ob(){F(Yp,Po),F(ld,ld.current)}function jb(){Po=Yp.current,G(ld),G(Yp)}var pi=se(null),Fi=null;function Dl(u){var d=u.alternate;F(vr,vr.current&1),F(pi,u),Fi===null&&(d===null||ld.current!==null||d.memoizedState!==null)&&(Fi=u)}function Nb(u){F(vr,vr.current),F(pi,u),Fi===null&&(Fi=u)}function U7(u){u.tag===22?(F(vr,vr.current),F(pi,u),Fi===null&&(Fi=u)):zl()}function zl(){F(vr,vr.current),F(pi,pi.current)}function gi(u){G(pi),Fi===u&&(Fi=null),G(vr)}var vr=se(0);function Kp(u){for(var d=u;d!==null;){if(d.tag===13){var p=d.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||A2(p)||R2(p)))return d}else if(d.tag===19&&(d.memoizedProps.revealOrder==="forwards"||d.memoizedProps.revealOrder==="backwards"||d.memoizedProps.revealOrder==="unstable_legacy-backwards"||d.memoizedProps.revealOrder==="together")){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===u)break;for(;d.sibling===null;){if(d.return===null||d.return===u)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var To=0,Pt=null,Rn=null,Er=null,Zp=!1,cd=!1,Kc=!1,Jp=0,Sf=0,ud=null,RG=0;function hr(){throw Error(r(321))}function Cb(u,d){if(d===null)return!1;for(var p=0;p<d.length&&p<u.length;p++)if(!fi(u[p],d[p]))return!1;return!0}function Tb(u,d,p,v,O,j){return To=j,Pt=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,P.H=u===null||u.memoizedState===null?EN:Qb,Kc=!1,j=p(v,O),Kc=!1,cd&&(j=G7(d,p,v,O)),W7(u),j}function W7(u){P.H=jf;var d=Rn!==null&&Rn.next!==null;if(To=0,Er=Rn=Pt=null,Zp=!1,Sf=0,ud=null,d)throw Error(r(300));u===null||_r||(u=u.dependencies,u!==null&&Qp(u)&&(_r=!0))}function G7(u,d,p,v){Pt=u;var O=0;do{if(cd&&(ud=null),Sf=0,cd=!1,25<=O)throw Error(r(301));if(O+=1,Er=Rn=null,u.updateQueue!=null){var j=u.updateQueue;j.lastEffect=null,j.events=null,j.stores=null,j.memoCache!=null&&(j.memoCache.index=0)}P.H=_N,j=d(p,v)}while(cd);return j}function DG(){var u=P.H,d=u.useState()[0];return d=typeof d.then=="function"?kf(d):d,u=u.useState()[0],(Rn!==null?Rn.memoizedState:null)!==u&&(Pt.flags|=1024),d}function Eb(){var u=Jp!==0;return Jp=0,u}function _b(u,d,p){d.updateQueue=u.updateQueue,d.flags&=-2053,u.lanes&=~p}function Mb(u){if(Zp){for(u=u.memoizedState;u!==null;){var d=u.queue;d!==null&&(d.pending=null),u=u.next}Zp=!1}To=0,Er=Rn=Pt=null,cd=!1,Sf=Jp=0,ud=null}function Cs(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Er===null?Pt.memoizedState=Er=u:Er=Er.next=u,Er}function yr(){if(Rn===null){var u=Pt.alternate;u=u!==null?u.memoizedState:null}else u=Rn.next;var d=Er===null?Pt.memoizedState:Er.next;if(d!==null)Er=d,Rn=u;else{if(u===null)throw Pt.alternate===null?Error(r(467)):Error(r(310));Rn=u,u={memoizedState:Rn.memoizedState,baseState:Rn.baseState,baseQueue:Rn.baseQueue,queue:Rn.queue,next:null},Er===null?Pt.memoizedState=Er=u:Er=Er.next=u}return Er}function eg(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function kf(u){var d=Sf;return Sf+=1,ud===null&&(ud=[]),u=I7(ud,u,d),d=Pt,(Er===null?d.memoizedState:Er.next)===null&&(d=d.alternate,P.H=d===null||d.memoizedState===null?EN:Qb),u}function tg(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return kf(u);if(u.$$typeof===C)return as(u)}throw Error(r(438,String(u)))}function Ab(u){var d=null,p=Pt.updateQueue;if(p!==null&&(d=p.memoCache),d==null){var v=Pt.alternate;v!==null&&(v=v.updateQueue,v!==null&&(v=v.memoCache,v!=null&&(d={data:v.data.map(function(O){return O.slice()}),index:0})))}if(d==null&&(d={data:[],index:0}),p===null&&(p=eg(),Pt.updateQueue=p),p.memoCache=d,p=d.data[d.index],p===void 0)for(p=d.data[d.index]=Array(u),v=0;v<u;v++)p[v]=I;return d.index++,p}function Eo(u,d){return typeof d=="function"?d(u):d}function ng(u){var d=yr();return Rb(d,Rn,u)}function Rb(u,d,p){var v=u.queue;if(v===null)throw Error(r(311));v.lastRenderedReducer=p;var O=u.baseQueue,j=v.pending;if(j!==null){if(O!==null){var B=O.next;O.next=j.next,j.next=B}d.baseQueue=O=j,v.pending=null}if(j=u.baseState,O===null)u.memoizedState=j;else{d=O.next;var K=B=null,ue=null,Se=d,Ee=!1;do{var De=Se.lane&-536870913;if(De!==Se.lane?(Kt&De)===De:(To&De)===De){var ke=Se.revertLane;if(ke===0)ue!==null&&(ue=ue.next={lane:0,revertLane:0,gesture:null,action:Se.action,hasEagerState:Se.hasEagerState,eagerState:Se.eagerState,next:null}),De===sd&&(Ee=!0);else if((To&ke)===ke){Se=Se.next,ke===sd&&(Ee=!0);continue}else De={lane:0,revertLane:Se.revertLane,gesture:null,action:Se.action,hasEagerState:Se.hasEagerState,eagerState:Se.eagerState,next:null},ue===null?(K=ue=De,B=j):ue=ue.next=De,Pt.lanes|=ke,Il|=ke;De=Se.action,Kc&&p(j,De),j=Se.hasEagerState?Se.eagerState:p(j,De)}else ke={lane:De,revertLane:Se.revertLane,gesture:Se.gesture,action:Se.action,hasEagerState:Se.hasEagerState,eagerState:Se.eagerState,next:null},ue===null?(K=ue=ke,B=j):ue=ue.next=ke,Pt.lanes|=De,Il|=De;Se=Se.next}while(Se!==null&&Se!==d);if(ue===null?B=j:ue.next=K,!fi(j,u.memoizedState)&&(_r=!0,Ee&&(p=id,p!==null)))throw p;u.memoizedState=j,u.baseState=B,u.baseQueue=ue,v.lastRenderedState=j}return O===null&&(v.lanes=0),[u.memoizedState,v.dispatch]}function Db(u){var d=yr(),p=d.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=u;var v=p.dispatch,O=p.pending,j=d.memoizedState;if(O!==null){p.pending=null;var B=O=O.next;do j=u(j,B.action),B=B.next;while(B!==O);fi(j,d.memoizedState)||(_r=!0),d.memoizedState=j,d.baseQueue===null&&(d.baseState=j),p.lastRenderedState=j}return[j,v]}function X7(u,d,p){var v=Pt,O=yr(),j=tn;if(j){if(p===void 0)throw Error(r(407));p=p()}else p=d();var B=!fi((Rn||O).memoizedState,p);if(B&&(O.memoizedState=p,_r=!0),O=O.queue,Lb(Z7.bind(null,v,O,u),[u]),O.getSnapshot!==d||B||Er!==null&&Er.memoizedState.tag&1){if(v.flags|=2048,dd(9,{destroy:void 0},K7.bind(null,v,O,p,d),null),Fn===null)throw Error(r(349));j||(To&127)!==0||Y7(v,d,p)}return p}function Y7(u,d,p){u.flags|=16384,u={getSnapshot:d,value:p},d=Pt.updateQueue,d===null?(d=eg(),Pt.updateQueue=d,d.stores=[u]):(p=d.stores,p===null?d.stores=[u]:p.push(u))}function K7(u,d,p,v){d.value=p,d.getSnapshot=v,J7(d)&&eN(u)}function Z7(u,d,p){return p(function(){J7(d)&&eN(u)})}function J7(u){var d=u.getSnapshot;u=u.value;try{var p=d();return!fi(u,p)}catch{return!0}}function eN(u){var d=$c(u,2);d!==null&&Us(d,u,2)}function zb(u){var d=Cs();if(typeof u=="function"){var p=u;if(u=p(),Kc){Je(!0);try{p()}finally{Je(!1)}}}return d.memoizedState=d.baseState=u,d.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:u},d}function tN(u,d,p,v){return u.baseState=p,Rb(u,Rn,typeof v=="function"?v:Eo)}function zG(u,d,p,v,O){if(ig(u))throw Error(r(485));if(u=d.action,u!==null){var j={payload:O,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(B){j.listeners.push(B)}};P.T!==null?p(!0):j.isTransition=!1,v(j),p=d.pending,p===null?(j.next=d.pending=j,nN(d,j)):(j.next=p.next,d.pending=p.next=j)}}function nN(u,d){var p=d.action,v=d.payload,O=u.state;if(d.isTransition){var j=P.T,B={};P.T=B;try{var K=p(O,v),ue=P.S;ue!==null&&ue(B,K),rN(u,d,K)}catch(Se){Pb(u,d,Se)}finally{j!==null&&B.types!==null&&(j.types=B.types),P.T=j}}else try{j=p(O,v),rN(u,d,j)}catch(Se){Pb(u,d,Se)}}function rN(u,d,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(v){sN(u,d,v)},function(v){return Pb(u,d,v)}):sN(u,d,p)}function sN(u,d,p){d.status="fulfilled",d.value=p,iN(d),u.state=p,d=u.pending,d!==null&&(p=d.next,p===d?u.pending=null:(p=p.next,d.next=p,nN(u,p)))}function Pb(u,d,p){var v=u.pending;if(u.pending=null,v!==null){v=v.next;do d.status="rejected",d.reason=p,iN(d),d=d.next;while(d!==v)}u.action=null}function iN(u){u=u.listeners;for(var d=0;d<u.length;d++)(0,u[d])()}function aN(u,d){return d}function oN(u,d){if(tn){var p=Fn.formState;if(p!==null){e:{var v=Pt;if(tn){if(Yn){t:{for(var O=Yn,j=qi;O.nodeType!==8;){if(!j){O=null;break t}if(O=$i(O.nextSibling),O===null){O=null;break t}}j=O.data,O=j==="F!"||j==="F"?O:null}if(O){Yn=$i(O.nextSibling),v=O.data==="F!";break e}}El(v)}v=!1}v&&(d=p[0])}}return p=Cs(),p.memoizedState=p.baseState=d,v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:aN,lastRenderedState:d},p.queue=v,p=NN.bind(null,Pt,v),v.dispatch=p,v=zb(!1),j=$b.bind(null,Pt,!1,v.queue),v=Cs(),O={state:d,dispatch:null,action:u,pending:null},v.queue=O,p=zG.bind(null,Pt,O,j,p),O.dispatch=p,v.memoizedState=u,[d,p,!1]}function lN(u){var d=yr();return cN(d,Rn,u)}function cN(u,d,p){if(d=Rb(u,d,aN)[0],u=ng(Eo)[0],typeof d=="object"&&d!==null&&typeof d.then=="function")try{var v=kf(d)}catch(B){throw B===ad?Up:B}else v=d;d=yr();var O=d.queue,j=O.dispatch;return p!==d.memoizedState&&(Pt.flags|=2048,dd(9,{destroy:void 0},PG.bind(null,O,p),null)),[v,j,u]}function PG(u,d){u.action=d}function uN(u){var d=yr(),p=Rn;if(p!==null)return cN(d,p,u);yr(),d=d.memoizedState,p=yr();var v=p.queue.dispatch;return p.memoizedState=u,[d,v,!1]}function dd(u,d,p,v){return u={tag:u,create:p,deps:v,inst:d,next:null},d=Pt.updateQueue,d===null&&(d=eg(),Pt.updateQueue=d),p=d.lastEffect,p===null?d.lastEffect=u.next=u:(v=p.next,p.next=u,u.next=v,d.lastEffect=u),u}function dN(){return yr().memoizedState}function rg(u,d,p,v){var O=Cs();Pt.flags|=u,O.memoizedState=dd(1|d,{destroy:void 0},p,v===void 0?null:v)}function sg(u,d,p,v){var O=yr();v=v===void 0?null:v;var j=O.memoizedState.inst;Rn!==null&&v!==null&&Cb(v,Rn.memoizedState.deps)?O.memoizedState=dd(d,j,p,v):(Pt.flags|=u,O.memoizedState=dd(1|d,j,p,v))}function hN(u,d){rg(8390656,8,u,d)}function Lb(u,d){sg(2048,8,u,d)}function LG(u){Pt.flags|=4;var d=Pt.updateQueue;if(d===null)d=eg(),Pt.updateQueue=d,d.events=[u];else{var p=d.events;p===null?d.events=[u]:p.push(u)}}function fN(u){var d=yr().memoizedState;return LG({ref:d,nextImpl:u}),function(){if((Cn&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}function mN(u,d){return sg(4,2,u,d)}function pN(u,d){return sg(4,4,u,d)}function gN(u,d){if(typeof d=="function"){u=u();var p=d(u);return function(){typeof p=="function"?p():d(null)}}if(d!=null)return u=u(),d.current=u,function(){d.current=null}}function xN(u,d,p){p=p!=null?p.concat([u]):null,sg(4,4,gN.bind(null,d,u),p)}function Ib(){}function vN(u,d){var p=yr();d=d===void 0?null:d;var v=p.memoizedState;return d!==null&&Cb(d,v[1])?v[0]:(p.memoizedState=[u,d],u)}function yN(u,d){var p=yr();d=d===void 0?null:d;var v=p.memoizedState;if(d!==null&&Cb(d,v[1]))return v[0];if(v=u(),Kc){Je(!0);try{u()}finally{Je(!1)}}return p.memoizedState=[v,d],v}function Bb(u,d,p){return p===void 0||(To&1073741824)!==0&&(Kt&261930)===0?u.memoizedState=d:(u.memoizedState=p,u=b8(),Pt.lanes|=u,Il|=u,p)}function bN(u,d,p,v){return fi(p,d)?p:ld.current!==null?(u=Bb(u,p,v),fi(u,d)||(_r=!0),u):(To&42)===0||(To&1073741824)!==0&&(Kt&261930)===0?(_r=!0,u.memoizedState=p):(u=b8(),Pt.lanes|=u,Il|=u,d)}function wN(u,d,p,v,O){var j=W.p;W.p=j!==0&&8>j?j:8;var B=P.T,K={};P.T=K,$b(u,!1,d,p);try{var ue=O(),Se=P.S;if(Se!==null&&Se(K,ue),ue!==null&&typeof ue=="object"&&typeof ue.then=="function"){var Ee=AG(ue,v);Of(u,d,Ee,yi(u))}else Of(u,d,v,yi(u))}catch(De){Of(u,d,{then:function(){},status:"rejected",reason:De},yi())}finally{W.p=j,B!==null&&K.types!==null&&(B.types=K.types),P.T=B}}function IG(){}function qb(u,d,p,v){if(u.tag!==5)throw Error(r(476));var O=SN(u).queue;wN(u,O,d,J,p===null?IG:function(){return kN(u),p(v)})}function SN(u){var d=u.memoizedState;if(d!==null)return d;d={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:J},next:null};var p={};return d.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:p},next:null},u.memoizedState=d,u=u.alternate,u!==null&&(u.memoizedState=d),d}function kN(u){var d=SN(u);d.next===null&&(d=u.alternate.memoizedState),Of(u,d.next.queue,{},yi())}function Fb(){return as(Ff)}function ON(){return yr().memoizedState}function jN(){return yr().memoizedState}function BG(u){for(var d=u.return;d!==null;){switch(d.tag){case 24:case 3:var p=yi();u=Al(p);var v=Rl(d,u,p);v!==null&&(Us(v,d,p),yf(v,d,p)),d={cache:gb()},u.payload=d;return}d=d.return}}function qG(u,d,p){var v=yi();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},ig(u)?CN(d,p):(p=ib(u,d,p,v),p!==null&&(Us(p,u,v),TN(p,d,v)))}function NN(u,d,p){var v=yi();Of(u,d,p,v)}function Of(u,d,p,v){var O={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(ig(u))CN(d,O);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=d.lastRenderedReducer,j!==null))try{var B=d.lastRenderedState,K=j(B,p);if(O.hasEagerState=!0,O.eagerState=K,fi(K,B))return Bp(u,d,O,0),Fn===null&&Ip(),!1}catch{}finally{}if(p=ib(u,d,O,v),p!==null)return Us(p,u,v),TN(p,d,v),!0}return!1}function $b(u,d,p,v){if(v={lane:2,revertLane:b2(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},ig(u)){if(d)throw Error(r(479))}else d=ib(u,p,v,2),d!==null&&Us(d,u,2)}function ig(u){var d=u.alternate;return u===Pt||d!==null&&d===Pt}function CN(u,d){cd=Zp=!0;var p=u.pending;p===null?d.next=d:(d.next=p.next,p.next=d),u.pending=d}function TN(u,d,p){if((p&4194048)!==0){var v=d.lanes;v&=u.pendingLanes,p|=v,d.lanes=p,Ns(u,p)}}var jf={readContext:as,use:tg,useCallback:hr,useContext:hr,useEffect:hr,useImperativeHandle:hr,useLayoutEffect:hr,useInsertionEffect:hr,useMemo:hr,useReducer:hr,useRef:hr,useState:hr,useDebugValue:hr,useDeferredValue:hr,useTransition:hr,useSyncExternalStore:hr,useId:hr,useHostTransitionStatus:hr,useFormState:hr,useActionState:hr,useOptimistic:hr,useMemoCache:hr,useCacheRefresh:hr};jf.useEffectEvent=hr;var EN={readContext:as,use:tg,useCallback:function(u,d){return Cs().memoizedState=[u,d===void 0?null:d],u},useContext:as,useEffect:hN,useImperativeHandle:function(u,d,p){p=p!=null?p.concat([u]):null,rg(4194308,4,gN.bind(null,d,u),p)},useLayoutEffect:function(u,d){return rg(4194308,4,u,d)},useInsertionEffect:function(u,d){rg(4,2,u,d)},useMemo:function(u,d){var p=Cs();d=d===void 0?null:d;var v=u();if(Kc){Je(!0);try{u()}finally{Je(!1)}}return p.memoizedState=[v,d],v},useReducer:function(u,d,p){var v=Cs();if(p!==void 0){var O=p(d);if(Kc){Je(!0);try{p(d)}finally{Je(!1)}}}else O=d;return v.memoizedState=v.baseState=O,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:O},v.queue=u,u=u.dispatch=qG.bind(null,Pt,u),[v.memoizedState,u]},useRef:function(u){var d=Cs();return u={current:u},d.memoizedState=u},useState:function(u){u=zb(u);var d=u.queue,p=NN.bind(null,Pt,d);return d.dispatch=p,[u.memoizedState,p]},useDebugValue:Ib,useDeferredValue:function(u,d){var p=Cs();return Bb(p,u,d)},useTransition:function(){var u=zb(!1);return u=wN.bind(null,Pt,u.queue,!0,!1),Cs().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,d,p){var v=Pt,O=Cs();if(tn){if(p===void 0)throw Error(r(407));p=p()}else{if(p=d(),Fn===null)throw Error(r(349));(Kt&127)!==0||Y7(v,d,p)}O.memoizedState=p;var j={value:p,getSnapshot:d};return O.queue=j,hN(Z7.bind(null,v,j,u),[u]),v.flags|=2048,dd(9,{destroy:void 0},K7.bind(null,v,j,p,d),null),p},useId:function(){var u=Cs(),d=Fn.identifierPrefix;if(tn){var p=za,v=Da;p=(v&~(1<<32-dt(v)-1)).toString(32)+p,d="_"+d+"R_"+p,p=Jp++,0<p&&(d+="H"+p.toString(32)),d+="_"}else p=RG++,d="_"+d+"r_"+p.toString(32)+"_";return u.memoizedState=d},useHostTransitionStatus:Fb,useFormState:oN,useActionState:oN,useOptimistic:function(u){var d=Cs();d.memoizedState=d.baseState=u;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return d.queue=p,d=$b.bind(null,Pt,!0,p),p.dispatch=d,[u,d]},useMemoCache:Ab,useCacheRefresh:function(){return Cs().memoizedState=BG.bind(null,Pt)},useEffectEvent:function(u){var d=Cs(),p={impl:u};return d.memoizedState=p,function(){if((Cn&2)!==0)throw Error(r(440));return p.impl.apply(void 0,arguments)}}},Qb={readContext:as,use:tg,useCallback:vN,useContext:as,useEffect:Lb,useImperativeHandle:xN,useInsertionEffect:mN,useLayoutEffect:pN,useMemo:yN,useReducer:ng,useRef:dN,useState:function(){return ng(Eo)},useDebugValue:Ib,useDeferredValue:function(u,d){var p=yr();return bN(p,Rn.memoizedState,u,d)},useTransition:function(){var u=ng(Eo)[0],d=yr().memoizedState;return[typeof u=="boolean"?u:kf(u),d]},useSyncExternalStore:X7,useId:ON,useHostTransitionStatus:Fb,useFormState:lN,useActionState:lN,useOptimistic:function(u,d){var p=yr();return tN(p,Rn,u,d)},useMemoCache:Ab,useCacheRefresh:jN};Qb.useEffectEvent=fN;var _N={readContext:as,use:tg,useCallback:vN,useContext:as,useEffect:Lb,useImperativeHandle:xN,useInsertionEffect:mN,useLayoutEffect:pN,useMemo:yN,useReducer:Db,useRef:dN,useState:function(){return Db(Eo)},useDebugValue:Ib,useDeferredValue:function(u,d){var p=yr();return Rn===null?Bb(p,u,d):bN(p,Rn.memoizedState,u,d)},useTransition:function(){var u=Db(Eo)[0],d=yr().memoizedState;return[typeof u=="boolean"?u:kf(u),d]},useSyncExternalStore:X7,useId:ON,useHostTransitionStatus:Fb,useFormState:uN,useActionState:uN,useOptimistic:function(u,d){var p=yr();return Rn!==null?tN(p,Rn,u,d):(p.baseState=u,[u,p.queue.dispatch])},useMemoCache:Ab,useCacheRefresh:jN};_N.useEffectEvent=fN;function Hb(u,d,p,v){d=u.memoizedState,p=p(v,d),p=p==null?d:m({},d,p),u.memoizedState=p,u.lanes===0&&(u.updateQueue.baseState=p)}var Vb={enqueueSetState:function(u,d,p){u=u._reactInternals;var v=yi(),O=Al(v);O.payload=d,p!=null&&(O.callback=p),d=Rl(u,O,v),d!==null&&(Us(d,u,v),yf(d,u,v))},enqueueReplaceState:function(u,d,p){u=u._reactInternals;var v=yi(),O=Al(v);O.tag=1,O.payload=d,p!=null&&(O.callback=p),d=Rl(u,O,v),d!==null&&(Us(d,u,v),yf(d,u,v))},enqueueForceUpdate:function(u,d){u=u._reactInternals;var p=yi(),v=Al(p);v.tag=2,d!=null&&(v.callback=d),d=Rl(u,v,p),d!==null&&(Us(d,u,p),yf(d,u,p))}};function MN(u,d,p,v,O,j,B){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(v,j,B):d.prototype&&d.prototype.isPureReactComponent?!df(p,v)||!df(O,j):!0}function AN(u,d,p,v){u=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(p,v),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(p,v),d.state!==u&&Vb.enqueueReplaceState(d,d.state,null)}function Zc(u,d){var p=d;if("ref"in d){p={};for(var v in d)v!=="ref"&&(p[v]=d[v])}if(u=u.defaultProps){p===d&&(p=m({},p));for(var O in u)p[O]===void 0&&(p[O]=u[O])}return p}function RN(u){Lp(u)}function DN(u){console.error(u)}function zN(u){Lp(u)}function ag(u,d){try{var p=u.onUncaughtError;p(d.value,{componentStack:d.stack})}catch(v){setTimeout(function(){throw v})}}function PN(u,d,p){try{var v=u.onCaughtError;v(p.value,{componentStack:p.stack,errorBoundary:d.tag===1?d.stateNode:null})}catch(O){setTimeout(function(){throw O})}}function Ub(u,d,p){return p=Al(p),p.tag=3,p.payload={element:null},p.callback=function(){ag(u,d)},p}function LN(u){return u=Al(u),u.tag=3,u}function IN(u,d,p,v){var O=p.type.getDerivedStateFromError;if(typeof O=="function"){var j=v.value;u.payload=function(){return O(j)},u.callback=function(){PN(d,p,v)}}var B=p.stateNode;B!==null&&typeof B.componentDidCatch=="function"&&(u.callback=function(){PN(d,p,v),typeof O!="function"&&(Bl===null?Bl=new Set([this]):Bl.add(this));var K=v.stack;this.componentDidCatch(v.value,{componentStack:K!==null?K:""})})}function FG(u,d,p,v,O){if(p.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){if(d=p.alternate,d!==null&&rd(d,p,O,!0),p=pi.current,p!==null){switch(p.tag){case 31:case 13:return Fi===null?vg():p.alternate===null&&fr===0&&(fr=3),p.flags&=-257,p.flags|=65536,p.lanes=O,v===Wp?p.flags|=16384:(d=p.updateQueue,d===null?p.updateQueue=new Set([v]):d.add(v),x2(u,v,O)),!1;case 22:return p.flags|=65536,v===Wp?p.flags|=16384:(d=p.updateQueue,d===null?(d={transitions:null,markerInstances:null,retryQueue:new Set([v])},p.updateQueue=d):(p=d.retryQueue,p===null?d.retryQueue=new Set([v]):p.add(v)),x2(u,v,O)),!1}throw Error(r(435,p.tag))}return x2(u,v,O),vg(),!1}if(tn)return d=pi.current,d!==null?((d.flags&65536)===0&&(d.flags|=256),d.flags|=65536,d.lanes=O,v!==db&&(u=Error(r(422),{cause:v}),mf(Li(u,p)))):(v!==db&&(d=Error(r(423),{cause:v}),mf(Li(d,p))),u=u.current.alternate,u.flags|=65536,O&=-O,u.lanes|=O,v=Li(v,p),O=Ub(u.stateNode,v,O),Sb(u,O),fr!==4&&(fr=2)),!1;var j=Error(r(520),{cause:v});if(j=Li(j,p),Rf===null?Rf=[j]:Rf.push(j),fr!==4&&(fr=2),d===null)return!0;v=Li(v,p),p=d;do{switch(p.tag){case 3:return p.flags|=65536,u=O&-O,p.lanes|=u,u=Ub(p.stateNode,v,u),Sb(p,u),!1;case 1:if(d=p.type,j=p.stateNode,(p.flags&128)===0&&(typeof d.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(Bl===null||!Bl.has(j))))return p.flags|=65536,O&=-O,p.lanes|=O,O=LN(O),IN(O,u,p,v),Sb(p,O),!1}p=p.return}while(p!==null);return!1}var Wb=Error(r(461)),_r=!1;function os(u,d,p,v){d.child=u===null?$7(d,null,p,v):Yc(d,u.child,p,v)}function BN(u,d,p,v,O){p=p.render;var j=d.ref;if("ref"in v){var B={};for(var K in v)K!=="ref"&&(B[K]=v[K])}else B=v;return Uc(d),v=Tb(u,d,p,B,j,O),K=Eb(),u!==null&&!_r?(_b(u,d,O),_o(u,d,O)):(tn&&K&&cb(d),d.flags|=1,os(u,d,v,O),d.child)}function qN(u,d,p,v,O){if(u===null){var j=p.type;return typeof j=="function"&&!ab(j)&&j.defaultProps===void 0&&p.compare===null?(d.tag=15,d.type=j,FN(u,d,j,v,O)):(u=Fp(p.type,null,v,d,d.mode,O),u.ref=d.ref,u.return=d,d.child=u)}if(j=u.child,!t2(u,O)){var B=j.memoizedProps;if(p=p.compare,p=p!==null?p:df,p(B,v)&&u.ref===d.ref)return _o(u,d,O)}return d.flags|=1,u=Oo(j,v),u.ref=d.ref,u.return=d,d.child=u}function FN(u,d,p,v,O){if(u!==null){var j=u.memoizedProps;if(df(j,v)&&u.ref===d.ref)if(_r=!1,d.pendingProps=v=j,t2(u,O))(u.flags&131072)!==0&&(_r=!0);else return d.lanes=u.lanes,_o(u,d,O)}return Gb(u,d,p,v,O)}function $N(u,d,p,v){var O=v.children,j=u!==null?u.memoizedState:null;if(u===null&&d.stateNode===null&&(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.mode==="hidden"){if((d.flags&128)!==0){if(j=j!==null?j.baseLanes|p:p,u!==null){for(v=d.child=u.child,O=0;v!==null;)O=O|v.lanes|v.childLanes,v=v.sibling;v=O&~j}else v=0,d.child=null;return QN(u,d,j,p,v)}if((p&536870912)!==0)d.memoizedState={baseLanes:0,cachePool:null},u!==null&&Vp(d,j!==null?j.cachePool:null),j!==null?V7(d,j):Ob(),U7(d);else return v=d.lanes=536870912,QN(u,d,j!==null?j.baseLanes|p:p,p,v)}else j!==null?(Vp(d,j.cachePool),V7(d,j),zl(),d.memoizedState=null):(u!==null&&Vp(d,null),Ob(),zl());return os(u,d,O,p),d.child}function Nf(u,d){return u!==null&&u.tag===22||d.stateNode!==null||(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.sibling}function QN(u,d,p,v,O){var j=vb();return j=j===null?null:{parent:Tr._currentValue,pool:j},d.memoizedState={baseLanes:p,cachePool:j},u!==null&&Vp(d,null),Ob(),U7(d),u!==null&&rd(u,d,v,!0),d.childLanes=O,null}function og(u,d){return d=cg({mode:d.mode,children:d.children},u.mode),d.ref=u.ref,u.child=d,d.return=u,d}function HN(u,d,p){return Yc(d,u.child,null,p),u=og(d,d.pendingProps),u.flags|=2,gi(d),d.memoizedState=null,u}function $G(u,d,p){var v=d.pendingProps,O=(d.flags&128)!==0;if(d.flags&=-129,u===null){if(tn){if(v.mode==="hidden")return u=og(d,v),d.lanes=536870912,Nf(null,u);if(Nb(d),(u=Yn)?(u=nC(u,qi),u=u!==null&&u.data==="&"?u:null,u!==null&&(d.memoizedState={dehydrated:u,treeContext:Cl!==null?{id:Da,overflow:za}:null,retryLane:536870912,hydrationErrors:null},p=C7(u),p.return=d,d.child=p,is=d,Yn=null)):u=null,u===null)throw El(d);return d.lanes=536870912,null}return og(d,v)}var j=u.memoizedState;if(j!==null){var B=j.dehydrated;if(Nb(d),O)if(d.flags&256)d.flags&=-257,d=HN(u,d,p);else if(d.memoizedState!==null)d.child=u.child,d.flags|=128,d=null;else throw Error(r(558));else if(_r||rd(u,d,p,!1),O=(p&u.childLanes)!==0,_r||O){if(v=Fn,v!==null&&(B=Bs(v,p),B!==0&&B!==j.retryLane))throw j.retryLane=B,$c(u,B),Us(v,u,B),Wb;vg(),d=HN(u,d,p)}else u=j.treeContext,Yn=$i(B.nextSibling),is=d,tn=!0,Tl=null,qi=!1,u!==null&&_7(d,u),d=og(d,v),d.flags|=4096;return d}return u=Oo(u.child,{mode:v.mode,children:v.children}),u.ref=d.ref,d.child=u,u.return=d,u}function lg(u,d){var p=d.ref;if(p===null)u!==null&&u.ref!==null&&(d.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(r(284));(u===null||u.ref!==p)&&(d.flags|=4194816)}}function Gb(u,d,p,v,O){return Uc(d),p=Tb(u,d,p,v,void 0,O),v=Eb(),u!==null&&!_r?(_b(u,d,O),_o(u,d,O)):(tn&&v&&cb(d),d.flags|=1,os(u,d,p,O),d.child)}function VN(u,d,p,v,O,j){return Uc(d),d.updateQueue=null,p=G7(d,v,p,O),W7(u),v=Eb(),u!==null&&!_r?(_b(u,d,j),_o(u,d,j)):(tn&&v&&cb(d),d.flags|=1,os(u,d,p,j),d.child)}function UN(u,d,p,v,O){if(Uc(d),d.stateNode===null){var j=Ju,B=p.contextType;typeof B=="object"&&B!==null&&(j=as(B)),j=new p(v,j),d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,j.updater=Vb,d.stateNode=j,j._reactInternals=d,j=d.stateNode,j.props=v,j.state=d.memoizedState,j.refs={},bb(d),B=p.contextType,j.context=typeof B=="object"&&B!==null?as(B):Ju,j.state=d.memoizedState,B=p.getDerivedStateFromProps,typeof B=="function"&&(Hb(d,p,B,v),j.state=d.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(B=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),B!==j.state&&Vb.enqueueReplaceState(j,j.state,null),wf(d,v,j,O),bf(),j.state=d.memoizedState),typeof j.componentDidMount=="function"&&(d.flags|=4194308),v=!0}else if(u===null){j=d.stateNode;var K=d.memoizedProps,ue=Zc(p,K);j.props=ue;var Se=j.context,Ee=p.contextType;B=Ju,typeof Ee=="object"&&Ee!==null&&(B=as(Ee));var De=p.getDerivedStateFromProps;Ee=typeof De=="function"||typeof j.getSnapshotBeforeUpdate=="function",K=d.pendingProps!==K,Ee||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(K||Se!==B)&&AN(d,j,v,B),Ml=!1;var ke=d.memoizedState;j.state=ke,wf(d,v,j,O),bf(),Se=d.memoizedState,K||ke!==Se||Ml?(typeof De=="function"&&(Hb(d,p,De,v),Se=d.memoizedState),(ue=Ml||MN(d,p,ue,v,ke,Se,B))?(Ee||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(d.flags|=4194308)):(typeof j.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=v,d.memoizedState=Se),j.props=v,j.state=Se,j.context=B,v=ue):(typeof j.componentDidMount=="function"&&(d.flags|=4194308),v=!1)}else{j=d.stateNode,wb(u,d),B=d.memoizedProps,Ee=Zc(p,B),j.props=Ee,De=d.pendingProps,ke=j.context,Se=p.contextType,ue=Ju,typeof Se=="object"&&Se!==null&&(ue=as(Se)),K=p.getDerivedStateFromProps,(Se=typeof K=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(B!==De||ke!==ue)&&AN(d,j,v,ue),Ml=!1,ke=d.memoizedState,j.state=ke,wf(d,v,j,O),bf();var Ce=d.memoizedState;B!==De||ke!==Ce||Ml||u!==null&&u.dependencies!==null&&Qp(u.dependencies)?(typeof K=="function"&&(Hb(d,p,K,v),Ce=d.memoizedState),(Ee=Ml||MN(d,p,Ee,v,ke,Ce,ue)||u!==null&&u.dependencies!==null&&Qp(u.dependencies))?(Se||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(v,Ce,ue),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(v,Ce,ue)),typeof j.componentDidUpdate=="function"&&(d.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof j.componentDidUpdate!="function"||B===u.memoizedProps&&ke===u.memoizedState||(d.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||B===u.memoizedProps&&ke===u.memoizedState||(d.flags|=1024),d.memoizedProps=v,d.memoizedState=Ce),j.props=v,j.state=Ce,j.context=ue,v=Ee):(typeof j.componentDidUpdate!="function"||B===u.memoizedProps&&ke===u.memoizedState||(d.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||B===u.memoizedProps&&ke===u.memoizedState||(d.flags|=1024),v=!1)}return j=v,lg(u,d),v=(d.flags&128)!==0,j||v?(j=d.stateNode,p=v&&typeof p.getDerivedStateFromError!="function"?null:j.render(),d.flags|=1,u!==null&&v?(d.child=Yc(d,u.child,null,O),d.child=Yc(d,null,p,O)):os(u,d,p,O),d.memoizedState=j.state,u=d.child):u=_o(u,d,O),u}function WN(u,d,p,v){return Hc(),d.flags|=256,os(u,d,p,v),d.child}var Xb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Yb(u){return{baseLanes:u,cachePool:P7()}}function Kb(u,d,p){return u=u!==null?u.childLanes&~p:0,d&&(u|=vi),u}function GN(u,d,p){var v=d.pendingProps,O=!1,j=(d.flags&128)!==0,B;if((B=j)||(B=u!==null&&u.memoizedState===null?!1:(vr.current&2)!==0),B&&(O=!0,d.flags&=-129),B=(d.flags&32)!==0,d.flags&=-33,u===null){if(tn){if(O?Dl(d):zl(),(u=Yn)?(u=nC(u,qi),u=u!==null&&u.data!=="&"?u:null,u!==null&&(d.memoizedState={dehydrated:u,treeContext:Cl!==null?{id:Da,overflow:za}:null,retryLane:536870912,hydrationErrors:null},p=C7(u),p.return=d,d.child=p,is=d,Yn=null)):u=null,u===null)throw El(d);return R2(u)?d.lanes=32:d.lanes=536870912,null}var K=v.children;return v=v.fallback,O?(zl(),O=d.mode,K=cg({mode:"hidden",children:K},O),v=Qc(v,O,p,null),K.return=d,v.return=d,K.sibling=v,d.child=K,v=d.child,v.memoizedState=Yb(p),v.childLanes=Kb(u,B,p),d.memoizedState=Xb,Nf(null,v)):(Dl(d),Zb(d,K))}var ue=u.memoizedState;if(ue!==null&&(K=ue.dehydrated,K!==null)){if(j)d.flags&256?(Dl(d),d.flags&=-257,d=Jb(u,d,p)):d.memoizedState!==null?(zl(),d.child=u.child,d.flags|=128,d=null):(zl(),K=v.fallback,O=d.mode,v=cg({mode:"visible",children:v.children},O),K=Qc(K,O,p,null),K.flags|=2,v.return=d,K.return=d,v.sibling=K,d.child=v,Yc(d,u.child,null,p),v=d.child,v.memoizedState=Yb(p),v.childLanes=Kb(u,B,p),d.memoizedState=Xb,d=Nf(null,v));else if(Dl(d),R2(K)){if(B=K.nextSibling&&K.nextSibling.dataset,B)var Se=B.dgst;B=Se,v=Error(r(419)),v.stack="",v.digest=B,mf({value:v,source:null,stack:null}),d=Jb(u,d,p)}else if(_r||rd(u,d,p,!1),B=(p&u.childLanes)!==0,_r||B){if(B=Fn,B!==null&&(v=Bs(B,p),v!==0&&v!==ue.retryLane))throw ue.retryLane=v,$c(u,v),Us(B,u,v),Wb;A2(K)||vg(),d=Jb(u,d,p)}else A2(K)?(d.flags|=192,d.child=u.child,d=null):(u=ue.treeContext,Yn=$i(K.nextSibling),is=d,tn=!0,Tl=null,qi=!1,u!==null&&_7(d,u),d=Zb(d,v.children),d.flags|=4096);return d}return O?(zl(),K=v.fallback,O=d.mode,ue=u.child,Se=ue.sibling,v=Oo(ue,{mode:"hidden",children:v.children}),v.subtreeFlags=ue.subtreeFlags&65011712,Se!==null?K=Oo(Se,K):(K=Qc(K,O,p,null),K.flags|=2),K.return=d,v.return=d,v.sibling=K,d.child=v,Nf(null,v),v=d.child,K=u.child.memoizedState,K===null?K=Yb(p):(O=K.cachePool,O!==null?(ue=Tr._currentValue,O=O.parent!==ue?{parent:ue,pool:ue}:O):O=P7(),K={baseLanes:K.baseLanes|p,cachePool:O}),v.memoizedState=K,v.childLanes=Kb(u,B,p),d.memoizedState=Xb,Nf(u.child,v)):(Dl(d),p=u.child,u=p.sibling,p=Oo(p,{mode:"visible",children:v.children}),p.return=d,p.sibling=null,u!==null&&(B=d.deletions,B===null?(d.deletions=[u],d.flags|=16):B.push(u)),d.child=p,d.memoizedState=null,p)}function Zb(u,d){return d=cg({mode:"visible",children:d},u.mode),d.return=u,u.child=d}function cg(u,d){return u=mi(22,u,null,d),u.lanes=0,u}function Jb(u,d,p){return Yc(d,u.child,null,p),u=Zb(d,d.pendingProps.children),u.flags|=2,d.memoizedState=null,u}function XN(u,d,p){u.lanes|=d;var v=u.alternate;v!==null&&(v.lanes|=d),mb(u.return,d,p)}function e2(u,d,p,v,O,j){var B=u.memoizedState;B===null?u.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:v,tail:p,tailMode:O,treeForkCount:j}:(B.isBackwards=d,B.rendering=null,B.renderingStartTime=0,B.last=v,B.tail=p,B.tailMode=O,B.treeForkCount=j)}function YN(u,d,p){var v=d.pendingProps,O=v.revealOrder,j=v.tail;v=v.children;var B=vr.current,K=(B&2)!==0;if(K?(B=B&1|2,d.flags|=128):B&=1,F(vr,B),os(u,d,v,p),v=tn?ff:0,!K&&u!==null&&(u.flags&128)!==0)e:for(u=d.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&XN(u,p,d);else if(u.tag===19)XN(u,p,d);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===d)break e;for(;u.sibling===null;){if(u.return===null||u.return===d)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}switch(O){case"forwards":for(p=d.child,O=null;p!==null;)u=p.alternate,u!==null&&Kp(u)===null&&(O=p),p=p.sibling;p=O,p===null?(O=d.child,d.child=null):(O=p.sibling,p.sibling=null),e2(d,!1,O,p,j,v);break;case"backwards":case"unstable_legacy-backwards":for(p=null,O=d.child,d.child=null;O!==null;){if(u=O.alternate,u!==null&&Kp(u)===null){d.child=O;break}u=O.sibling,O.sibling=p,p=O,O=u}e2(d,!0,p,null,j,v);break;case"together":e2(d,!1,null,null,void 0,v);break;default:d.memoizedState=null}return d.child}function _o(u,d,p){if(u!==null&&(d.dependencies=u.dependencies),Il|=d.lanes,(p&d.childLanes)===0)if(u!==null){if(rd(u,d,p,!1),(p&d.childLanes)===0)return null}else return null;if(u!==null&&d.child!==u.child)throw Error(r(153));if(d.child!==null){for(u=d.child,p=Oo(u,u.pendingProps),d.child=p,p.return=d;u.sibling!==null;)u=u.sibling,p=p.sibling=Oo(u,u.pendingProps),p.return=d;p.sibling=null}return d.child}function t2(u,d){return(u.lanes&d)!==0?!0:(u=u.dependencies,!!(u!==null&&Qp(u)))}function QG(u,d,p){switch(d.tag){case 3:ae(d,d.stateNode.containerInfo),_l(d,Tr,u.memoizedState.cache),Hc();break;case 27:case 5:oe(d);break;case 4:ae(d,d.stateNode.containerInfo);break;case 10:_l(d,d.type,d.memoizedProps.value);break;case 31:if(d.memoizedState!==null)return d.flags|=128,Nb(d),null;break;case 13:var v=d.memoizedState;if(v!==null)return v.dehydrated!==null?(Dl(d),d.flags|=128,null):(p&d.child.childLanes)!==0?GN(u,d,p):(Dl(d),u=_o(u,d,p),u!==null?u.sibling:null);Dl(d);break;case 19:var O=(u.flags&128)!==0;if(v=(p&d.childLanes)!==0,v||(rd(u,d,p,!1),v=(p&d.childLanes)!==0),O){if(v)return YN(u,d,p);d.flags|=128}if(O=d.memoizedState,O!==null&&(O.rendering=null,O.tail=null,O.lastEffect=null),F(vr,vr.current),v)break;return null;case 22:return d.lanes=0,$N(u,d,p,d.pendingProps);case 24:_l(d,Tr,u.memoizedState.cache)}return _o(u,d,p)}function KN(u,d,p){if(u!==null)if(u.memoizedProps!==d.pendingProps)_r=!0;else{if(!t2(u,p)&&(d.flags&128)===0)return _r=!1,QG(u,d,p);_r=(u.flags&131072)!==0}else _r=!1,tn&&(d.flags&1048576)!==0&&E7(d,ff,d.index);switch(d.lanes=0,d.tag){case 16:e:{var v=d.pendingProps;if(u=Gc(d.elementType),d.type=u,typeof u=="function")ab(u)?(v=Zc(u,v),d.tag=1,d=UN(null,d,u,v,p)):(d.tag=0,d=Gb(null,d,u,v,p));else{if(u!=null){var O=u.$$typeof;if(O===T){d.tag=11,d=BN(null,d,u,v,p);break e}else if(O===M){d.tag=14,d=qN(null,d,u,v,p);break e}}throw d=z(u)||u,Error(r(306,d,""))}}return d;case 0:return Gb(u,d,d.type,d.pendingProps,p);case 1:return v=d.type,O=Zc(v,d.pendingProps),UN(u,d,v,O,p);case 3:e:{if(ae(d,d.stateNode.containerInfo),u===null)throw Error(r(387));v=d.pendingProps;var j=d.memoizedState;O=j.element,wb(u,d),wf(d,v,null,p);var B=d.memoizedState;if(v=B.cache,_l(d,Tr,v),v!==j.cache&&pb(d,[Tr],p,!0),bf(),v=B.element,j.isDehydrated)if(j={element:v,isDehydrated:!1,cache:B.cache},d.updateQueue.baseState=j,d.memoizedState=j,d.flags&256){d=WN(u,d,v,p);break e}else if(v!==O){O=Li(Error(r(424)),d),mf(O),d=WN(u,d,v,p);break e}else{switch(u=d.stateNode.containerInfo,u.nodeType){case 9:u=u.body;break;default:u=u.nodeName==="HTML"?u.ownerDocument.body:u}for(Yn=$i(u.firstChild),is=d,tn=!0,Tl=null,qi=!0,p=$7(d,null,v,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(Hc(),v===O){d=_o(u,d,p);break e}os(u,d,v,p)}d=d.child}return d;case 26:return lg(u,d),u===null?(p=lC(d.type,null,d.pendingProps,null))?d.memoizedState=p:tn||(p=d.type,u=d.pendingProps,v=jg(ne.current).createElement(p),v[Ir]=d,v[ss]=u,ls(v,p,u),Cr(v),d.stateNode=v):d.memoizedState=lC(d.type,u.memoizedProps,d.pendingProps,u.memoizedState),null;case 27:return oe(d),u===null&&tn&&(v=d.stateNode=iC(d.type,d.pendingProps,ne.current),is=d,qi=!0,O=Yn,Ql(d.type)?(D2=O,Yn=$i(v.firstChild)):Yn=O),os(u,d,d.pendingProps.children,p),lg(u,d),u===null&&(d.flags|=4194304),d.child;case 5:return u===null&&tn&&((O=v=Yn)&&(v=yX(v,d.type,d.pendingProps,qi),v!==null?(d.stateNode=v,is=d,Yn=$i(v.firstChild),qi=!1,O=!0):O=!1),O||El(d)),oe(d),O=d.type,j=d.pendingProps,B=u!==null?u.memoizedProps:null,v=j.children,E2(O,j)?v=null:B!==null&&E2(O,B)&&(d.flags|=32),d.memoizedState!==null&&(O=Tb(u,d,DG,null,null,p),Ff._currentValue=O),lg(u,d),os(u,d,v,p),d.child;case 6:return u===null&&tn&&((u=p=Yn)&&(p=bX(p,d.pendingProps,qi),p!==null?(d.stateNode=p,is=d,Yn=null,u=!0):u=!1),u||El(d)),null;case 13:return GN(u,d,p);case 4:return ae(d,d.stateNode.containerInfo),v=d.pendingProps,u===null?d.child=Yc(d,null,v,p):os(u,d,v,p),d.child;case 11:return BN(u,d,d.type,d.pendingProps,p);case 7:return os(u,d,d.pendingProps,p),d.child;case 8:return os(u,d,d.pendingProps.children,p),d.child;case 12:return os(u,d,d.pendingProps.children,p),d.child;case 10:return v=d.pendingProps,_l(d,d.type,v.value),os(u,d,v.children,p),d.child;case 9:return O=d.type._context,v=d.pendingProps.children,Uc(d),O=as(O),v=v(O),d.flags|=1,os(u,d,v,p),d.child;case 14:return qN(u,d,d.type,d.pendingProps,p);case 15:return FN(u,d,d.type,d.pendingProps,p);case 19:return YN(u,d,p);case 31:return $G(u,d,p);case 22:return $N(u,d,p,d.pendingProps);case 24:return Uc(d),v=as(Tr),u===null?(O=vb(),O===null&&(O=Fn,j=gb(),O.pooledCache=j,j.refCount++,j!==null&&(O.pooledCacheLanes|=p),O=j),d.memoizedState={parent:v,cache:O},bb(d),_l(d,Tr,O)):((u.lanes&p)!==0&&(wb(u,d),wf(d,null,null,p),bf()),O=u.memoizedState,j=d.memoizedState,O.parent!==v?(O={parent:v,cache:v},d.memoizedState=O,d.lanes===0&&(d.memoizedState=d.updateQueue.baseState=O),_l(d,Tr,v)):(v=j.cache,_l(d,Tr,v),v!==O.cache&&pb(d,[Tr],p,!0))),os(u,d,d.pendingProps.children,p),d.child;case 29:throw d.pendingProps}throw Error(r(156,d.tag))}function Mo(u){u.flags|=4}function n2(u,d,p,v,O){if((d=(u.mode&32)!==0)&&(d=!1),d){if(u.flags|=16777216,(O&335544128)===O)if(u.stateNode.complete)u.flags|=8192;else if(O8())u.flags|=8192;else throw Xc=Wp,yb}else u.flags&=-16777217}function ZN(u,d){if(d.type!=="stylesheet"||(d.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!fC(d))if(O8())u.flags|=8192;else throw Xc=Wp,yb}function ug(u,d){d!==null&&(u.flags|=4),u.flags&16384&&(d=u.tag!==22?dr():536870912,u.lanes|=d,pd|=d)}function Cf(u,d){if(!tn)switch(u.tailMode){case"hidden":d=u.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?u.tail=null:p.sibling=null;break;case"collapsed":p=u.tail;for(var v=null;p!==null;)p.alternate!==null&&(v=p),p=p.sibling;v===null?d||u.tail===null?u.tail=null:u.tail.sibling=null:v.sibling=null}}function Kn(u){var d=u.alternate!==null&&u.alternate.child===u.child,p=0,v=0;if(d)for(var O=u.child;O!==null;)p|=O.lanes|O.childLanes,v|=O.subtreeFlags&65011712,v|=O.flags&65011712,O.return=u,O=O.sibling;else for(O=u.child;O!==null;)p|=O.lanes|O.childLanes,v|=O.subtreeFlags,v|=O.flags,O.return=u,O=O.sibling;return u.subtreeFlags|=v,u.childLanes=p,d}function HG(u,d,p){var v=d.pendingProps;switch(ub(d),d.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kn(d),null;case 1:return Kn(d),null;case 3:return p=d.stateNode,v=null,u!==null&&(v=u.memoizedState.cache),d.memoizedState.cache!==v&&(d.flags|=2048),Co(Tr),re(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(u===null||u.child===null)&&(nd(d)?Mo(d):u===null||u.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,hb())),Kn(d),null;case 26:var O=d.type,j=d.memoizedState;return u===null?(Mo(d),j!==null?(Kn(d),ZN(d,j)):(Kn(d),n2(d,O,null,v,p))):j?j!==u.memoizedState?(Mo(d),Kn(d),ZN(d,j)):(Kn(d),d.flags&=-16777217):(u=u.memoizedProps,u!==v&&Mo(d),Kn(d),n2(d,O,u,v,p)),null;case 27:if(_e(d),p=ne.current,O=d.type,u!==null&&d.stateNode!=null)u.memoizedProps!==v&&Mo(d);else{if(!v){if(d.stateNode===null)throw Error(r(166));return Kn(d),null}u=U.current,nd(d)?M7(d):(u=iC(O,v,p),d.stateNode=u,Mo(d))}return Kn(d),null;case 5:if(_e(d),O=d.type,u!==null&&d.stateNode!=null)u.memoizedProps!==v&&Mo(d);else{if(!v){if(d.stateNode===null)throw Error(r(166));return Kn(d),null}if(j=U.current,nd(d))M7(d);else{var B=jg(ne.current);switch(j){case 1:j=B.createElementNS("http://www.w3.org/2000/svg",O);break;case 2:j=B.createElementNS("http://www.w3.org/1998/Math/MathML",O);break;default:switch(O){case"svg":j=B.createElementNS("http://www.w3.org/2000/svg",O);break;case"math":j=B.createElementNS("http://www.w3.org/1998/Math/MathML",O);break;case"script":j=B.createElement("div"),j.innerHTML="<script><\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof v.is=="string"?B.createElement("select",{is:v.is}):B.createElement("select"),v.multiple?j.multiple=!0:v.size&&(j.size=v.size);break;default:j=typeof v.is=="string"?B.createElement(O,{is:v.is}):B.createElement(O)}}j[Ir]=d,j[ss]=v;e:for(B=d.child;B!==null;){if(B.tag===5||B.tag===6)j.appendChild(B.stateNode);else if(B.tag!==4&&B.tag!==27&&B.child!==null){B.child.return=B,B=B.child;continue}if(B===d)break e;for(;B.sibling===null;){if(B.return===null||B.return===d)break e;B=B.return}B.sibling.return=B.return,B=B.sibling}d.stateNode=j;e:switch(ls(j,O,v),O){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&Mo(d)}}return Kn(d),n2(d,d.type,u===null?null:u.memoizedProps,d.pendingProps,p),null;case 6:if(u&&d.stateNode!=null)u.memoizedProps!==v&&Mo(d);else{if(typeof v!="string"&&d.stateNode===null)throw Error(r(166));if(u=ne.current,nd(d)){if(u=d.stateNode,p=d.memoizedProps,v=null,O=is,O!==null)switch(O.tag){case 27:case 5:v=O.memoizedProps}u[Ir]=d,u=!!(u.nodeValue===p||v!==null&&v.suppressHydrationWarning===!0||G8(u.nodeValue,p)),u||El(d,!0)}else u=jg(u).createTextNode(v),u[Ir]=d,d.stateNode=u}return Kn(d),null;case 31:if(p=d.memoizedState,u===null||u.memoizedState!==null){if(v=nd(d),p!==null){if(u===null){if(!v)throw Error(r(318));if(u=d.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[Ir]=d}else Hc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Kn(d),u=!1}else p=hb(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=p),u=!0;if(!u)return d.flags&256?(gi(d),d):(gi(d),null);if((d.flags&128)!==0)throw Error(r(558))}return Kn(d),null;case 13:if(v=d.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(O=nd(d),v!==null&&v.dehydrated!==null){if(u===null){if(!O)throw Error(r(318));if(O=d.memoizedState,O=O!==null?O.dehydrated:null,!O)throw Error(r(317));O[Ir]=d}else Hc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Kn(d),O=!1}else O=hb(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=O),O=!0;if(!O)return d.flags&256?(gi(d),d):(gi(d),null)}return gi(d),(d.flags&128)!==0?(d.lanes=p,d):(p=v!==null,u=u!==null&&u.memoizedState!==null,p&&(v=d.child,O=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(O=v.alternate.memoizedState.cachePool.pool),j=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(j=v.memoizedState.cachePool.pool),j!==O&&(v.flags|=2048)),p!==u&&p&&(d.child.flags|=8192),ug(d,d.updateQueue),Kn(d),null);case 4:return re(),u===null&&O2(d.stateNode.containerInfo),Kn(d),null;case 10:return Co(d.type),Kn(d),null;case 19:if(G(vr),v=d.memoizedState,v===null)return Kn(d),null;if(O=(d.flags&128)!==0,j=v.rendering,j===null)if(O)Cf(v,!1);else{if(fr!==0||u!==null&&(u.flags&128)!==0)for(u=d.child;u!==null;){if(j=Kp(u),j!==null){for(d.flags|=128,Cf(v,!1),u=j.updateQueue,d.updateQueue=u,ug(d,u),d.subtreeFlags=0,u=p,p=d.child;p!==null;)N7(p,u),p=p.sibling;return F(vr,vr.current&1|2),tn&&jo(d,v.treeForkCount),d.child}u=u.sibling}v.tail!==null&&Rt()>pg&&(d.flags|=128,O=!0,Cf(v,!1),d.lanes=4194304)}else{if(!O)if(u=Kp(j),u!==null){if(d.flags|=128,O=!0,u=u.updateQueue,d.updateQueue=u,ug(d,u),Cf(v,!0),v.tail===null&&v.tailMode==="hidden"&&!j.alternate&&!tn)return Kn(d),null}else 2*Rt()-v.renderingStartTime>pg&&p!==536870912&&(d.flags|=128,O=!0,Cf(v,!1),d.lanes=4194304);v.isBackwards?(j.sibling=d.child,d.child=j):(u=v.last,u!==null?u.sibling=j:d.child=j,v.last=j)}return v.tail!==null?(u=v.tail,v.rendering=u,v.tail=u.sibling,v.renderingStartTime=Rt(),u.sibling=null,p=vr.current,F(vr,O?p&1|2:p&1),tn&&jo(d,v.treeForkCount),u):(Kn(d),null);case 22:case 23:return gi(d),jb(),v=d.memoizedState!==null,u!==null?u.memoizedState!==null!==v&&(d.flags|=8192):v&&(d.flags|=8192),v?(p&536870912)!==0&&(d.flags&128)===0&&(Kn(d),d.subtreeFlags&6&&(d.flags|=8192)):Kn(d),p=d.updateQueue,p!==null&&ug(d,p.retryQueue),p=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==p&&(d.flags|=2048),u!==null&&G(Wc),null;case 24:return p=null,u!==null&&(p=u.memoizedState.cache),d.memoizedState.cache!==p&&(d.flags|=2048),Co(Tr),Kn(d),null;case 25:return null;case 30:return null}throw Error(r(156,d.tag))}function VG(u,d){switch(ub(d),d.tag){case 1:return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 3:return Co(Tr),re(),u=d.flags,(u&65536)!==0&&(u&128)===0?(d.flags=u&-65537|128,d):null;case 26:case 27:case 5:return _e(d),null;case 31:if(d.memoizedState!==null){if(gi(d),d.alternate===null)throw Error(r(340));Hc()}return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 13:if(gi(d),u=d.memoizedState,u!==null&&u.dehydrated!==null){if(d.alternate===null)throw Error(r(340));Hc()}return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 19:return G(vr),null;case 4:return re(),null;case 10:return Co(d.type),null;case 22:case 23:return gi(d),jb(),u!==null&&G(Wc),u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 24:return Co(Tr),null;case 25:return null;default:return null}}function JN(u,d){switch(ub(d),d.tag){case 3:Co(Tr),re();break;case 26:case 27:case 5:_e(d);break;case 4:re();break;case 31:d.memoizedState!==null&&gi(d);break;case 13:gi(d);break;case 19:G(vr);break;case 10:Co(d.type);break;case 22:case 23:gi(d),jb(),u!==null&&G(Wc);break;case 24:Co(Tr)}}function Tf(u,d){try{var p=d.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var O=v.next;p=O;do{if((p.tag&u)===u){v=void 0;var j=p.create,B=p.inst;v=j(),B.destroy=v}p=p.next}while(p!==O)}}catch(K){_n(d,d.return,K)}}function Pl(u,d,p){try{var v=d.updateQueue,O=v!==null?v.lastEffect:null;if(O!==null){var j=O.next;v=j;do{if((v.tag&u)===u){var B=v.inst,K=B.destroy;if(K!==void 0){B.destroy=void 0,O=d;var ue=p,Se=K;try{Se()}catch(Ee){_n(O,ue,Ee)}}}v=v.next}while(v!==j)}}catch(Ee){_n(d,d.return,Ee)}}function e8(u){var d=u.updateQueue;if(d!==null){var p=u.stateNode;try{H7(d,p)}catch(v){_n(u,u.return,v)}}}function t8(u,d,p){p.props=Zc(u.type,u.memoizedProps),p.state=u.memoizedState;try{p.componentWillUnmount()}catch(v){_n(u,d,v)}}function Ef(u,d){try{var p=u.ref;if(p!==null){switch(u.tag){case 26:case 27:case 5:var v=u.stateNode;break;case 30:v=u.stateNode;break;default:v=u.stateNode}typeof p=="function"?u.refCleanup=p(v):p.current=v}}catch(O){_n(u,d,O)}}function Pa(u,d){var p=u.ref,v=u.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(O){_n(u,d,O)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(O){_n(u,d,O)}else p.current=null}function n8(u){var d=u.type,p=u.memoizedProps,v=u.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(O){_n(u,u.return,O)}}function r2(u,d,p){try{var v=u.stateNode;fX(v,u.type,p,d),v[ss]=d}catch(O){_n(u,u.return,O)}}function r8(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&Ql(u.type)||u.tag===4}function s2(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||r8(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&Ql(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function i2(u,d,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,d?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(u,d):(d=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,d.appendChild(u),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=So));else if(v!==4&&(v===27&&Ql(u.type)&&(p=u.stateNode,d=null),u=u.child,u!==null))for(i2(u,d,p),u=u.sibling;u!==null;)i2(u,d,p),u=u.sibling}function dg(u,d,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,d?p.insertBefore(u,d):p.appendChild(u);else if(v!==4&&(v===27&&Ql(u.type)&&(p=u.stateNode),u=u.child,u!==null))for(dg(u,d,p),u=u.sibling;u!==null;)dg(u,d,p),u=u.sibling}function s8(u){var d=u.stateNode,p=u.memoizedProps;try{for(var v=u.type,O=d.attributes;O.length;)d.removeAttributeNode(O[0]);ls(d,v,p),d[Ir]=u,d[ss]=p}catch(j){_n(u,u.return,j)}}var Ao=!1,Mr=!1,a2=!1,i8=typeof WeakSet=="function"?WeakSet:Set,Kr=null;function UG(u,d){if(u=u.containerInfo,C2=Ag,u=x7(u),Jy(u)){if("selectionStart"in u)var p={start:u.selectionStart,end:u.selectionEnd};else e:{p=(p=u.ownerDocument)&&p.defaultView||window;var v=p.getSelection&&p.getSelection();if(v&&v.rangeCount!==0){p=v.anchorNode;var O=v.anchorOffset,j=v.focusNode;v=v.focusOffset;try{p.nodeType,j.nodeType}catch{p=null;break e}var B=0,K=-1,ue=-1,Se=0,Ee=0,De=u,ke=null;t:for(;;){for(var Ce;De!==p||O!==0&&De.nodeType!==3||(K=B+O),De!==j||v!==0&&De.nodeType!==3||(ue=B+v),De.nodeType===3&&(B+=De.nodeValue.length),(Ce=De.firstChild)!==null;)ke=De,De=Ce;for(;;){if(De===u)break t;if(ke===p&&++Se===O&&(K=B),ke===j&&++Ee===v&&(ue=B),(Ce=De.nextSibling)!==null)break;De=ke,ke=De.parentNode}De=Ce}p=K===-1||ue===-1?null:{start:K,end:ue}}else p=null}p=p||{start:0,end:0}}else p=null;for(T2={focusedElem:u,selectionRange:p},Ag=!1,Kr=d;Kr!==null;)if(d=Kr,u=d.child,(d.subtreeFlags&1028)!==0&&u!==null)u.return=d,Kr=u;else for(;Kr!==null;){switch(d=Kr,j=d.alternate,u=d.flags,d.tag){case 0:if((u&4)!==0&&(u=d.updateQueue,u=u!==null?u.events:null,u!==null))for(p=0;p<u.length;p++)O=u[p],O.ref.impl=O.nextImpl;break;case 11:case 15:break;case 1:if((u&1024)!==0&&j!==null){u=void 0,p=d,O=j.memoizedProps,j=j.memoizedState,v=p.stateNode;try{var st=Zc(p.type,O);u=v.getSnapshotBeforeUpdate(st,j),v.__reactInternalSnapshotBeforeUpdate=u}catch(Ot){_n(p,p.return,Ot)}}break;case 3:if((u&1024)!==0){if(u=d.stateNode.containerInfo,p=u.nodeType,p===9)M2(u);else if(p===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":M2(u);break;default:u.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((u&1024)!==0)throw Error(r(163))}if(u=d.sibling,u!==null){u.return=d.return,Kr=u;break}Kr=d.return}}function a8(u,d,p){var v=p.flags;switch(p.tag){case 0:case 11:case 15:Do(u,p),v&4&&Tf(5,p);break;case 1:if(Do(u,p),v&4)if(u=p.stateNode,d===null)try{u.componentDidMount()}catch(B){_n(p,p.return,B)}else{var O=Zc(p.type,d.memoizedProps);d=d.memoizedState;try{u.componentDidUpdate(O,d,u.__reactInternalSnapshotBeforeUpdate)}catch(B){_n(p,p.return,B)}}v&64&&e8(p),v&512&&Ef(p,p.return);break;case 3:if(Do(u,p),v&64&&(u=p.updateQueue,u!==null)){if(d=null,p.child!==null)switch(p.child.tag){case 27:case 5:d=p.child.stateNode;break;case 1:d=p.child.stateNode}try{H7(u,d)}catch(B){_n(p,p.return,B)}}break;case 27:d===null&&v&4&&s8(p);case 26:case 5:Do(u,p),d===null&&v&4&&n8(p),v&512&&Ef(p,p.return);break;case 12:Do(u,p);break;case 31:Do(u,p),v&4&&c8(u,p);break;case 13:Do(u,p),v&4&&u8(u,p),v&64&&(u=p.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(p=tX.bind(null,p),wX(u,p))));break;case 22:if(v=p.memoizedState!==null||Ao,!v){d=d!==null&&d.memoizedState!==null||Mr,O=Ao;var j=Mr;Ao=v,(Mr=d)&&!j?zo(u,p,(p.subtreeFlags&8772)!==0):Do(u,p),Ao=O,Mr=j}break;case 30:break;default:Do(u,p)}}function o8(u){var d=u.alternate;d!==null&&(u.alternate=null,o8(d)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(d=u.stateNode,d!==null&&tf(d)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}var tr=null,$s=!1;function Ro(u,d,p){for(p=p.child;p!==null;)l8(u,d,p),p=p.sibling}function l8(u,d,p){if(xe&&typeof xe.onCommitFiberUnmount=="function")try{xe.onCommitFiberUnmount(ie,p)}catch{}switch(p.tag){case 26:Mr||Pa(p,d),Ro(u,d,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:Mr||Pa(p,d);var v=tr,O=$s;Ql(p.type)&&(tr=p.stateNode,$s=!1),Ro(u,d,p),If(p.stateNode),tr=v,$s=O;break;case 5:Mr||Pa(p,d);case 6:if(v=tr,O=$s,tr=null,Ro(u,d,p),tr=v,$s=O,tr!==null)if($s)try{(tr.nodeType===9?tr.body:tr.nodeName==="HTML"?tr.ownerDocument.body:tr).removeChild(p.stateNode)}catch(j){_n(p,d,j)}else try{tr.removeChild(p.stateNode)}catch(j){_n(p,d,j)}break;case 18:tr!==null&&($s?(u=tr,eC(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,p.stateNode),kd(u)):eC(tr,p.stateNode));break;case 4:v=tr,O=$s,tr=p.stateNode.containerInfo,$s=!0,Ro(u,d,p),tr=v,$s=O;break;case 0:case 11:case 14:case 15:Pl(2,p,d),Mr||Pl(4,p,d),Ro(u,d,p);break;case 1:Mr||(Pa(p,d),v=p.stateNode,typeof v.componentWillUnmount=="function"&&t8(p,d,v)),Ro(u,d,p);break;case 21:Ro(u,d,p);break;case 22:Mr=(v=Mr)||p.memoizedState!==null,Ro(u,d,p),Mr=v;break;default:Ro(u,d,p)}}function c8(u,d){if(d.memoizedState===null&&(u=d.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{kd(u)}catch(p){_n(d,d.return,p)}}}function u8(u,d){if(d.memoizedState===null&&(u=d.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{kd(u)}catch(p){_n(d,d.return,p)}}function WG(u){switch(u.tag){case 31:case 13:case 19:var d=u.stateNode;return d===null&&(d=u.stateNode=new i8),d;case 22:return u=u.stateNode,d=u._retryCache,d===null&&(d=u._retryCache=new i8),d;default:throw Error(r(435,u.tag))}}function hg(u,d){var p=WG(u);d.forEach(function(v){if(!p.has(v)){p.add(v);var O=nX.bind(null,u,v);v.then(O,O)}})}function Qs(u,d){var p=d.deletions;if(p!==null)for(var v=0;v<p.length;v++){var O=p[v],j=u,B=d,K=B;e:for(;K!==null;){switch(K.tag){case 27:if(Ql(K.type)){tr=K.stateNode,$s=!1;break e}break;case 5:tr=K.stateNode,$s=!1;break e;case 3:case 4:tr=K.stateNode.containerInfo,$s=!0;break e}K=K.return}if(tr===null)throw Error(r(160));l8(j,B,O),tr=null,$s=!1,j=O.alternate,j!==null&&(j.return=null),O.return=null}if(d.subtreeFlags&13886)for(d=d.child;d!==null;)d8(d,u),d=d.sibling}var ma=null;function d8(u,d){var p=u.alternate,v=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:Qs(d,u),Hs(u),v&4&&(Pl(3,u,u.return),Tf(3,u),Pl(5,u,u.return));break;case 1:Qs(d,u),Hs(u),v&512&&(Mr||p===null||Pa(p,p.return)),v&64&&Ao&&(u=u.updateQueue,u!==null&&(v=u.callbacks,v!==null&&(p=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=p===null?v:p.concat(v))));break;case 26:var O=ma;if(Qs(d,u),Hs(u),v&512&&(Mr||p===null||Pa(p,p.return)),v&4){var j=p!==null?p.memoizedState:null;if(v=u.memoizedState,p===null)if(v===null)if(u.stateNode===null){e:{v=u.type,p=u.memoizedProps,O=O.ownerDocument||O;t:switch(v){case"title":j=O.getElementsByTagName("title")[0],(!j||j[Lc]||j[Ir]||j.namespaceURI==="http://www.w3.org/2000/svg"||j.hasAttribute("itemprop"))&&(j=O.createElement(v),O.head.insertBefore(j,O.querySelector("head > title"))),ls(j,v,p),j[Ir]=u,Cr(j),v=j;break e;case"link":var B=dC("link","href",O).get(v+(p.href||""));if(B){for(var K=0;K<B.length;K++)if(j=B[K],j.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&j.getAttribute("rel")===(p.rel==null?null:p.rel)&&j.getAttribute("title")===(p.title==null?null:p.title)&&j.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){B.splice(K,1);break t}}j=O.createElement(v),ls(j,v,p),O.head.appendChild(j);break;case"meta":if(B=dC("meta","content",O).get(v+(p.content||""))){for(K=0;K<B.length;K++)if(j=B[K],j.getAttribute("content")===(p.content==null?null:""+p.content)&&j.getAttribute("name")===(p.name==null?null:p.name)&&j.getAttribute("property")===(p.property==null?null:p.property)&&j.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&j.getAttribute("charset")===(p.charSet==null?null:p.charSet)){B.splice(K,1);break t}}j=O.createElement(v),ls(j,v,p),O.head.appendChild(j);break;default:throw Error(r(468,v))}j[Ir]=u,Cr(j),v=j}u.stateNode=v}else hC(O,u.type,u.stateNode);else u.stateNode=uC(O,v,u.memoizedProps);else j!==v?(j===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):j.count--,v===null?hC(O,u.type,u.stateNode):uC(O,v,u.memoizedProps)):v===null&&u.stateNode!==null&&r2(u,u.memoizedProps,p.memoizedProps)}break;case 27:Qs(d,u),Hs(u),v&512&&(Mr||p===null||Pa(p,p.return)),p!==null&&v&4&&r2(u,u.memoizedProps,p.memoizedProps);break;case 5:if(Qs(d,u),Hs(u),v&512&&(Mr||p===null||Pa(p,p.return)),u.flags&32){O=u.stateNode;try{Uu(O,"")}catch(st){_n(u,u.return,st)}}v&4&&u.stateNode!=null&&(O=u.memoizedProps,r2(u,O,p!==null?p.memoizedProps:O)),v&1024&&(a2=!0);break;case 6:if(Qs(d,u),Hs(u),v&4){if(u.stateNode===null)throw Error(r(162));v=u.memoizedProps,p=u.stateNode;try{p.nodeValue=v}catch(st){_n(u,u.return,st)}}break;case 3:if(Tg=null,O=ma,ma=Ng(d.containerInfo),Qs(d,u),ma=O,Hs(u),v&4&&p!==null&&p.memoizedState.isDehydrated)try{kd(d.containerInfo)}catch(st){_n(u,u.return,st)}a2&&(a2=!1,h8(u));break;case 4:v=ma,ma=Ng(u.stateNode.containerInfo),Qs(d,u),Hs(u),ma=v;break;case 12:Qs(d,u),Hs(u);break;case 31:Qs(d,u),Hs(u),v&4&&(v=u.updateQueue,v!==null&&(u.updateQueue=null,hg(u,v)));break;case 13:Qs(d,u),Hs(u),u.child.flags&8192&&u.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(mg=Rt()),v&4&&(v=u.updateQueue,v!==null&&(u.updateQueue=null,hg(u,v)));break;case 22:O=u.memoizedState!==null;var ue=p!==null&&p.memoizedState!==null,Se=Ao,Ee=Mr;if(Ao=Se||O,Mr=Ee||ue,Qs(d,u),Mr=Ee,Ao=Se,Hs(u),v&8192)e:for(d=u.stateNode,d._visibility=O?d._visibility&-2:d._visibility|1,O&&(p===null||ue||Ao||Mr||Jc(u)),p=null,d=u;;){if(d.tag===5||d.tag===26){if(p===null){ue=p=d;try{if(j=ue.stateNode,O)B=j.style,typeof B.setProperty=="function"?B.setProperty("display","none","important"):B.display="none";else{K=ue.stateNode;var De=ue.memoizedProps.style,ke=De!=null&&De.hasOwnProperty("display")?De.display:null;K.style.display=ke==null||typeof ke=="boolean"?"":(""+ke).trim()}}catch(st){_n(ue,ue.return,st)}}}else if(d.tag===6){if(p===null){ue=d;try{ue.stateNode.nodeValue=O?"":ue.memoizedProps}catch(st){_n(ue,ue.return,st)}}}else if(d.tag===18){if(p===null){ue=d;try{var Ce=ue.stateNode;O?tC(Ce,!0):tC(ue.stateNode,!1)}catch(st){_n(ue,ue.return,st)}}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===u)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===u)break e;for(;d.sibling===null;){if(d.return===null||d.return===u)break e;p===d&&(p=null),d=d.return}p===d&&(p=null),d.sibling.return=d.return,d=d.sibling}v&4&&(v=u.updateQueue,v!==null&&(p=v.retryQueue,p!==null&&(v.retryQueue=null,hg(u,p))));break;case 19:Qs(d,u),Hs(u),v&4&&(v=u.updateQueue,v!==null&&(u.updateQueue=null,hg(u,v)));break;case 30:break;case 21:break;default:Qs(d,u),Hs(u)}}function Hs(u){var d=u.flags;if(d&2){try{for(var p,v=u.return;v!==null;){if(r8(v)){p=v;break}v=v.return}if(p==null)throw Error(r(160));switch(p.tag){case 27:var O=p.stateNode,j=s2(u);dg(u,j,O);break;case 5:var B=p.stateNode;p.flags&32&&(Uu(B,""),p.flags&=-33);var K=s2(u);dg(u,K,B);break;case 3:case 4:var ue=p.stateNode.containerInfo,Se=s2(u);i2(u,Se,ue);break;default:throw Error(r(161))}}catch(Ee){_n(u,u.return,Ee)}u.flags&=-3}d&4096&&(u.flags&=-4097)}function h8(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var d=u;h8(d),d.tag===5&&d.flags&1024&&d.stateNode.reset(),u=u.sibling}}function Do(u,d){if(d.subtreeFlags&8772)for(d=d.child;d!==null;)a8(u,d.alternate,d),d=d.sibling}function Jc(u){for(u=u.child;u!==null;){var d=u;switch(d.tag){case 0:case 11:case 14:case 15:Pl(4,d,d.return),Jc(d);break;case 1:Pa(d,d.return);var p=d.stateNode;typeof p.componentWillUnmount=="function"&&t8(d,d.return,p),Jc(d);break;case 27:If(d.stateNode);case 26:case 5:Pa(d,d.return),Jc(d);break;case 22:d.memoizedState===null&&Jc(d);break;case 30:Jc(d);break;default:Jc(d)}u=u.sibling}}function zo(u,d,p){for(p=p&&(d.subtreeFlags&8772)!==0,d=d.child;d!==null;){var v=d.alternate,O=u,j=d,B=j.flags;switch(j.tag){case 0:case 11:case 15:zo(O,j,p),Tf(4,j);break;case 1:if(zo(O,j,p),v=j,O=v.stateNode,typeof O.componentDidMount=="function")try{O.componentDidMount()}catch(Se){_n(v,v.return,Se)}if(v=j,O=v.updateQueue,O!==null){var K=v.stateNode;try{var ue=O.shared.hiddenCallbacks;if(ue!==null)for(O.shared.hiddenCallbacks=null,O=0;O<ue.length;O++)Q7(ue[O],K)}catch(Se){_n(v,v.return,Se)}}p&&B&64&&e8(j),Ef(j,j.return);break;case 27:s8(j);case 26:case 5:zo(O,j,p),p&&v===null&&B&4&&n8(j),Ef(j,j.return);break;case 12:zo(O,j,p);break;case 31:zo(O,j,p),p&&B&4&&c8(O,j);break;case 13:zo(O,j,p),p&&B&4&&u8(O,j);break;case 22:j.memoizedState===null&&zo(O,j,p),Ef(j,j.return);break;case 30:break;default:zo(O,j,p)}d=d.sibling}}function o2(u,d){var p=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),u=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(u=d.memoizedState.cachePool.pool),u!==p&&(u!=null&&u.refCount++,p!=null&&pf(p))}function l2(u,d){u=null,d.alternate!==null&&(u=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==u&&(d.refCount++,u!=null&&pf(u))}function pa(u,d,p,v){if(d.subtreeFlags&10256)for(d=d.child;d!==null;)f8(u,d,p,v),d=d.sibling}function f8(u,d,p,v){var O=d.flags;switch(d.tag){case 0:case 11:case 15:pa(u,d,p,v),O&2048&&Tf(9,d);break;case 1:pa(u,d,p,v);break;case 3:pa(u,d,p,v),O&2048&&(u=null,d.alternate!==null&&(u=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==u&&(d.refCount++,u!=null&&pf(u)));break;case 12:if(O&2048){pa(u,d,p,v),u=d.stateNode;try{var j=d.memoizedProps,B=j.id,K=j.onPostCommit;typeof K=="function"&&K(B,d.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(ue){_n(d,d.return,ue)}}else pa(u,d,p,v);break;case 31:pa(u,d,p,v);break;case 13:pa(u,d,p,v);break;case 23:break;case 22:j=d.stateNode,B=d.alternate,d.memoizedState!==null?j._visibility&2?pa(u,d,p,v):_f(u,d):j._visibility&2?pa(u,d,p,v):(j._visibility|=2,hd(u,d,p,v,(d.subtreeFlags&10256)!==0||!1)),O&2048&&o2(B,d);break;case 24:pa(u,d,p,v),O&2048&&l2(d.alternate,d);break;default:pa(u,d,p,v)}}function hd(u,d,p,v,O){for(O=O&&((d.subtreeFlags&10256)!==0||!1),d=d.child;d!==null;){var j=u,B=d,K=p,ue=v,Se=B.flags;switch(B.tag){case 0:case 11:case 15:hd(j,B,K,ue,O),Tf(8,B);break;case 23:break;case 22:var Ee=B.stateNode;B.memoizedState!==null?Ee._visibility&2?hd(j,B,K,ue,O):_f(j,B):(Ee._visibility|=2,hd(j,B,K,ue,O)),O&&Se&2048&&o2(B.alternate,B);break;case 24:hd(j,B,K,ue,O),O&&Se&2048&&l2(B.alternate,B);break;default:hd(j,B,K,ue,O)}d=d.sibling}}function _f(u,d){if(d.subtreeFlags&10256)for(d=d.child;d!==null;){var p=u,v=d,O=v.flags;switch(v.tag){case 22:_f(p,v),O&2048&&o2(v.alternate,v);break;case 24:_f(p,v),O&2048&&l2(v.alternate,v);break;default:_f(p,v)}d=d.sibling}}var Mf=8192;function fd(u,d,p){if(u.subtreeFlags&Mf)for(u=u.child;u!==null;)m8(u,d,p),u=u.sibling}function m8(u,d,p){switch(u.tag){case 26:fd(u,d,p),u.flags&Mf&&u.memoizedState!==null&&RX(p,ma,u.memoizedState,u.memoizedProps);break;case 5:fd(u,d,p);break;case 3:case 4:var v=ma;ma=Ng(u.stateNode.containerInfo),fd(u,d,p),ma=v;break;case 22:u.memoizedState===null&&(v=u.alternate,v!==null&&v.memoizedState!==null?(v=Mf,Mf=16777216,fd(u,d,p),Mf=v):fd(u,d,p));break;default:fd(u,d,p)}}function p8(u){var d=u.alternate;if(d!==null&&(u=d.child,u!==null)){d.child=null;do d=u.sibling,u.sibling=null,u=d;while(u!==null)}}function Af(u){var d=u.deletions;if((u.flags&16)!==0){if(d!==null)for(var p=0;p<d.length;p++){var v=d[p];Kr=v,x8(v,u)}p8(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)g8(u),u=u.sibling}function g8(u){switch(u.tag){case 0:case 11:case 15:Af(u),u.flags&2048&&Pl(9,u,u.return);break;case 3:Af(u);break;case 12:Af(u);break;case 22:var d=u.stateNode;u.memoizedState!==null&&d._visibility&2&&(u.return===null||u.return.tag!==13)?(d._visibility&=-3,fg(u)):Af(u);break;default:Af(u)}}function fg(u){var d=u.deletions;if((u.flags&16)!==0){if(d!==null)for(var p=0;p<d.length;p++){var v=d[p];Kr=v,x8(v,u)}p8(u)}for(u=u.child;u!==null;){switch(d=u,d.tag){case 0:case 11:case 15:Pl(8,d,d.return),fg(d);break;case 22:p=d.stateNode,p._visibility&2&&(p._visibility&=-3,fg(d));break;default:fg(d)}u=u.sibling}}function x8(u,d){for(;Kr!==null;){var p=Kr;switch(p.tag){case 0:case 11:case 15:Pl(8,p,d);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var v=p.memoizedState.cachePool.pool;v!=null&&v.refCount++}break;case 24:pf(p.memoizedState.cache)}if(v=p.child,v!==null)v.return=p,Kr=v;else e:for(p=u;Kr!==null;){v=Kr;var O=v.sibling,j=v.return;if(o8(v),v===p){Kr=null;break e}if(O!==null){O.return=j,Kr=O;break e}Kr=j}}}var GG={getCacheForType:function(u){var d=as(Tr),p=d.data.get(u);return p===void 0&&(p=u(),d.data.set(u,p)),p},cacheSignal:function(){return as(Tr).controller.signal}},XG=typeof WeakMap=="function"?WeakMap:Map,Cn=0,Fn=null,Gt=null,Kt=0,En=0,xi=null,Ll=!1,md=!1,c2=!1,Po=0,fr=0,Il=0,eu=0,u2=0,vi=0,pd=0,Rf=null,Vs=null,d2=!1,mg=0,v8=0,pg=1/0,gg=null,Bl=null,Br=0,ql=null,gd=null,Lo=0,h2=0,f2=null,y8=null,Df=0,m2=null;function yi(){return(Cn&2)!==0&&Kt!==0?Kt&-Kt:P.T!==null?b2():hi()}function b8(){if(vi===0)if((Kt&536870912)===0||tn){var u=Wt;Wt<<=1,(Wt&3932160)===0&&(Wt=262144),vi=u}else vi=536870912;return u=pi.current,u!==null&&(u.flags|=32),vi}function Us(u,d,p){(u===Fn&&(En===2||En===9)||u.cancelPendingCommit!==null)&&(xd(u,0),Fl(u,Kt,vi,!1)),Is(u,p),((Cn&2)===0||u!==Fn)&&(u===Fn&&((Cn&2)===0&&(eu|=p),fr===4&&Fl(u,Kt,vi,!1)),La(u))}function w8(u,d,p){if((Cn&6)!==0)throw Error(r(327));var v=!p&&(d&127)===0&&(d&u.expiredLanes)===0||Xr(u,d),O=v?ZG(u,d):g2(u,d,!0),j=v;do{if(O===0){md&&!v&&Fl(u,d,0,!1);break}else{if(p=u.current.alternate,j&&!YG(p)){O=g2(u,d,!1),j=!1;continue}if(O===2){if(j=d,u.errorRecoveryDisabledLanes&j)var B=0;else B=u.pendingLanes&-536870913,B=B!==0?B:B&536870912?536870912:0;if(B!==0){d=B;e:{var K=u;O=Rf;var ue=K.current.memoizedState.isDehydrated;if(ue&&(xd(K,B).flags|=256),B=g2(K,B,!1),B!==2){if(c2&&!ue){K.errorRecoveryDisabledLanes|=j,eu|=j,O=4;break e}j=Vs,Vs=O,j!==null&&(Vs===null?Vs=j:Vs.push.apply(Vs,j))}O=B}if(j=!1,O!==2)continue}}if(O===1){xd(u,0),Fl(u,d,0,!0);break}e:{switch(v=u,j=O,j){case 0:case 1:throw Error(r(345));case 4:if((d&4194048)!==d)break;case 6:Fl(v,d,vi,!Ll);break e;case 2:Vs=null;break;case 3:case 5:break;default:throw Error(r(329))}if((d&62914560)===d&&(O=mg+300-Rt(),10<O)){if(Fl(v,d,vi,!Ll),ur(v,0,!0)!==0)break e;Lo=d,v.timeoutHandle=Z8(S8.bind(null,v,p,Vs,gg,d2,d,vi,eu,pd,Ll,j,"Throttled",-0,0),O);break e}S8(v,p,Vs,gg,d2,d,vi,eu,pd,Ll,j,null,-0,0)}}break}while(!0);La(u)}function S8(u,d,p,v,O,j,B,K,ue,Se,Ee,De,ke,Ce){if(u.timeoutHandle=-1,De=d.subtreeFlags,De&8192||(De&16785408)===16785408){De={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:So},m8(d,j,De);var st=(j&62914560)===j?mg-Rt():(j&4194048)===j?v8-Rt():0;if(st=DX(De,st),st!==null){Lo=j,u.cancelPendingCommit=st(_8.bind(null,u,d,j,p,v,O,B,K,ue,Ee,De,null,ke,Ce)),Fl(u,j,B,!Se);return}}_8(u,d,j,p,v,O,B,K,ue)}function YG(u){for(var d=u;;){var p=d.tag;if((p===0||p===11||p===15)&&d.flags&16384&&(p=d.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var v=0;v<p.length;v++){var O=p[v],j=O.getSnapshot;O=O.value;try{if(!fi(j(),O))return!1}catch{return!1}}if(p=d.child,d.subtreeFlags&16384&&p!==null)p.return=d,d=p;else{if(d===u)break;for(;d.sibling===null;){if(d.return===null||d.return===u)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function Fl(u,d,p,v){d&=~u2,d&=~eu,u.suspendedLanes|=d,u.pingedLanes&=~d,v&&(u.warmLanes|=d),v=u.expirationTimes;for(var O=d;0<O;){var j=31-dt(O),B=1<<j;v[j]=-1,O&=~B}p!==0&&di(u,p,d)}function xg(){return(Cn&6)===0?(zf(0),!1):!0}function p2(){if(Gt!==null){if(En===0)var u=Gt.return;else u=Gt,No=Vc=null,Mb(u),od=null,xf=0,u=Gt;for(;u!==null;)JN(u.alternate,u),u=u.return;Gt=null}}function xd(u,d){var p=u.timeoutHandle;p!==-1&&(u.timeoutHandle=-1,gX(p)),p=u.cancelPendingCommit,p!==null&&(u.cancelPendingCommit=null,p()),Lo=0,p2(),Fn=u,Gt=p=Oo(u.current,null),Kt=d,En=0,xi=null,Ll=!1,md=Xr(u,d),c2=!1,pd=vi=u2=eu=Il=fr=0,Vs=Rf=null,d2=!1,(d&8)!==0&&(d|=d&32);var v=u.entangledLanes;if(v!==0)for(u=u.entanglements,v&=d;0<v;){var O=31-dt(v),j=1<<O;d|=u[O],v&=~j}return Po=d,Ip(),p}function k8(u,d){Pt=null,P.H=jf,d===ad||d===Up?(d=B7(),En=3):d===yb?(d=B7(),En=4):En=d===Wb?8:d!==null&&typeof d=="object"&&typeof d.then=="function"?6:1,xi=d,Gt===null&&(fr=1,ag(u,Li(d,u.current)))}function O8(){var u=pi.current;return u===null?!0:(Kt&4194048)===Kt?Fi===null:(Kt&62914560)===Kt||(Kt&536870912)!==0?u===Fi:!1}function j8(){var u=P.H;return P.H=jf,u===null?jf:u}function N8(){var u=P.A;return P.A=GG,u}function vg(){fr=4,Ll||(Kt&4194048)!==Kt&&pi.current!==null||(md=!0),(Il&134217727)===0&&(eu&134217727)===0||Fn===null||Fl(Fn,Kt,vi,!1)}function g2(u,d,p){var v=Cn;Cn|=2;var O=j8(),j=N8();(Fn!==u||Kt!==d)&&(gg=null,xd(u,d)),d=!1;var B=fr;e:do try{if(En!==0&&Gt!==null){var K=Gt,ue=xi;switch(En){case 8:p2(),B=6;break e;case 3:case 2:case 9:case 6:pi.current===null&&(d=!0);var Se=En;if(En=0,xi=null,vd(u,K,ue,Se),p&&md){B=0;break e}break;default:Se=En,En=0,xi=null,vd(u,K,ue,Se)}}KG(),B=fr;break}catch(Ee){k8(u,Ee)}while(!0);return d&&u.shellSuspendCounter++,No=Vc=null,Cn=v,P.H=O,P.A=j,Gt===null&&(Fn=null,Kt=0,Ip()),B}function KG(){for(;Gt!==null;)C8(Gt)}function ZG(u,d){var p=Cn;Cn|=2;var v=j8(),O=N8();Fn!==u||Kt!==d?(gg=null,pg=Rt()+500,xd(u,d)):md=Xr(u,d);e:do try{if(En!==0&&Gt!==null){d=Gt;var j=xi;t:switch(En){case 1:En=0,xi=null,vd(u,d,j,1);break;case 2:case 9:if(L7(j)){En=0,xi=null,T8(d);break}d=function(){En!==2&&En!==9||Fn!==u||(En=7),La(u)},j.then(d,d);break e;case 3:En=7;break e;case 4:En=5;break e;case 7:L7(j)?(En=0,xi=null,T8(d)):(En=0,xi=null,vd(u,d,j,7));break;case 5:var B=null;switch(Gt.tag){case 26:B=Gt.memoizedState;case 5:case 27:var K=Gt;if(B?fC(B):K.stateNode.complete){En=0,xi=null;var ue=K.sibling;if(ue!==null)Gt=ue;else{var Se=K.return;Se!==null?(Gt=Se,yg(Se)):Gt=null}break t}}En=0,xi=null,vd(u,d,j,5);break;case 6:En=0,xi=null,vd(u,d,j,6);break;case 8:p2(),fr=6;break e;default:throw Error(r(462))}}JG();break}catch(Ee){k8(u,Ee)}while(!0);return No=Vc=null,P.H=v,P.A=O,Cn=p,Gt!==null?0:(Fn=null,Kt=0,Ip(),fr)}function JG(){for(;Gt!==null&&!Tn();)C8(Gt)}function C8(u){var d=KN(u.alternate,u,Po);u.memoizedProps=u.pendingProps,d===null?yg(u):Gt=d}function T8(u){var d=u,p=d.alternate;switch(d.tag){case 15:case 0:d=VN(p,d,d.pendingProps,d.type,void 0,Kt);break;case 11:d=VN(p,d,d.pendingProps,d.type.render,d.ref,Kt);break;case 5:Mb(d);default:JN(p,d),d=Gt=N7(d,Po),d=KN(p,d,Po)}u.memoizedProps=u.pendingProps,d===null?yg(u):Gt=d}function vd(u,d,p,v){No=Vc=null,Mb(d),od=null,xf=0;var O=d.return;try{if(FG(u,O,d,p,Kt)){fr=1,ag(u,Li(p,u.current)),Gt=null;return}}catch(j){if(O!==null)throw Gt=O,j;fr=1,ag(u,Li(p,u.current)),Gt=null;return}d.flags&32768?(tn||v===1?u=!0:md||(Kt&536870912)!==0?u=!1:(Ll=u=!0,(v===2||v===9||v===3||v===6)&&(v=pi.current,v!==null&&v.tag===13&&(v.flags|=16384))),E8(d,u)):yg(d)}function yg(u){var d=u;do{if((d.flags&32768)!==0){E8(d,Ll);return}u=d.return;var p=HG(d.alternate,d,Po);if(p!==null){Gt=p;return}if(d=d.sibling,d!==null){Gt=d;return}Gt=d=u}while(d!==null);fr===0&&(fr=5)}function E8(u,d){do{var p=VG(u.alternate,u);if(p!==null){p.flags&=32767,Gt=p;return}if(p=u.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!d&&(u=u.sibling,u!==null)){Gt=u;return}Gt=u=p}while(u!==null);fr=6,Gt=null}function _8(u,d,p,v,O,j,B,K,ue){u.cancelPendingCommit=null;do bg();while(Br!==0);if((Cn&6)!==0)throw Error(r(327));if(d!==null){if(d===u.current)throw Error(r(177));if(j=d.lanes|d.childLanes,j|=sb,xr(u,p,j,B,K,ue),u===Fn&&(Gt=Fn=null,Kt=0),gd=d,ql=u,Lo=p,h2=j,f2=O,y8=v,(d.subtreeFlags&10256)!==0||(d.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,rX(qe,function(){return z8(),null})):(u.callbackNode=null,u.callbackPriority=0),v=(d.flags&13878)!==0,(d.subtreeFlags&13878)!==0||v){v=P.T,P.T=null,O=W.p,W.p=2,B=Cn,Cn|=4;try{UG(u,d,p)}finally{Cn=B,W.p=O,P.T=v}}Br=1,M8(),A8(),R8()}}function M8(){if(Br===1){Br=0;var u=ql,d=gd,p=(d.flags&13878)!==0;if((d.subtreeFlags&13878)!==0||p){p=P.T,P.T=null;var v=W.p;W.p=2;var O=Cn;Cn|=4;try{d8(d,u);var j=T2,B=x7(u.containerInfo),K=j.focusedElem,ue=j.selectionRange;if(B!==K&&K&&K.ownerDocument&&g7(K.ownerDocument.documentElement,K)){if(ue!==null&&Jy(K)){var Se=ue.start,Ee=ue.end;if(Ee===void 0&&(Ee=Se),"selectionStart"in K)K.selectionStart=Se,K.selectionEnd=Math.min(Ee,K.value.length);else{var De=K.ownerDocument||document,ke=De&&De.defaultView||window;if(ke.getSelection){var Ce=ke.getSelection(),st=K.textContent.length,Ot=Math.min(ue.start,st),zn=ue.end===void 0?Ot:Math.min(ue.end,st);!Ce.extend&&Ot>zn&&(B=zn,zn=Ot,Ot=B);var ge=p7(K,Ot),fe=p7(K,zn);if(ge&&fe&&(Ce.rangeCount!==1||Ce.anchorNode!==ge.node||Ce.anchorOffset!==ge.offset||Ce.focusNode!==fe.node||Ce.focusOffset!==fe.offset)){var be=De.createRange();be.setStart(ge.node,ge.offset),Ce.removeAllRanges(),Ot>zn?(Ce.addRange(be),Ce.extend(fe.node,fe.offset)):(be.setEnd(fe.node,fe.offset),Ce.addRange(be))}}}}for(De=[],Ce=K;Ce=Ce.parentNode;)Ce.nodeType===1&&De.push({element:Ce,left:Ce.scrollLeft,top:Ce.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;K<De.length;K++){var Me=De[K];Me.element.scrollLeft=Me.left,Me.element.scrollTop=Me.top}}Ag=!!C2,T2=C2=null}finally{Cn=O,W.p=v,P.T=p}}u.current=d,Br=2}}function A8(){if(Br===2){Br=0;var u=ql,d=gd,p=(d.flags&8772)!==0;if((d.subtreeFlags&8772)!==0||p){p=P.T,P.T=null;var v=W.p;W.p=2;var O=Cn;Cn|=4;try{a8(u,d.alternate,d)}finally{Cn=O,W.p=v,P.T=p}}Br=3}}function R8(){if(Br===4||Br===3){Br=0,Nn();var u=ql,d=gd,p=Lo,v=y8;(d.subtreeFlags&10256)!==0||(d.flags&10256)!==0?Br=5:(Br=0,gd=ql=null,D8(u,u.pendingLanes));var O=u.pendingLanes;if(O===0&&(Bl=null),ha(p),d=d.stateNode,xe&&typeof xe.onCommitFiberRoot=="function")try{xe.onCommitFiberRoot(ie,d,void 0,(d.current.flags&128)===128)}catch{}if(v!==null){d=P.T,O=W.p,W.p=2,P.T=null;try{for(var j=u.onRecoverableError,B=0;B<v.length;B++){var K=v[B];j(K.value,{componentStack:K.stack})}}finally{P.T=d,W.p=O}}(Lo&3)!==0&&bg(),La(u),O=u.pendingLanes,(p&261930)!==0&&(O&42)!==0?u===m2?Df++:(Df=0,m2=u):Df=0,zf(0)}}function D8(u,d){(u.pooledCacheLanes&=d)===0&&(d=u.pooledCache,d!=null&&(u.pooledCache=null,pf(d)))}function bg(){return M8(),A8(),R8(),z8()}function z8(){if(Br!==5)return!1;var u=ql,d=h2;h2=0;var p=ha(Lo),v=P.T,O=W.p;try{W.p=32>p?32:p,P.T=null,p=f2,f2=null;var j=ql,B=Lo;if(Br=0,gd=ql=null,Lo=0,(Cn&6)!==0)throw Error(r(331));var K=Cn;if(Cn|=4,g8(j.current),f8(j,j.current,B,p),Cn=K,zf(0,!1),xe&&typeof xe.onPostCommitFiberRoot=="function")try{xe.onPostCommitFiberRoot(ie,j)}catch{}return!0}finally{W.p=O,P.T=v,D8(u,d)}}function P8(u,d,p){d=Li(p,d),d=Ub(u.stateNode,d,2),u=Rl(u,d,2),u!==null&&(Is(u,2),La(u))}function _n(u,d,p){if(u.tag===3)P8(u,u,p);else for(;d!==null;){if(d.tag===3){P8(d,u,p);break}else if(d.tag===1){var v=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(Bl===null||!Bl.has(v))){u=Li(p,u),p=LN(2),v=Rl(d,p,2),v!==null&&(IN(p,v,d,u),Is(v,2),La(v));break}}d=d.return}}function x2(u,d,p){var v=u.pingCache;if(v===null){v=u.pingCache=new XG;var O=new Set;v.set(d,O)}else O=v.get(d),O===void 0&&(O=new Set,v.set(d,O));O.has(p)||(c2=!0,O.add(p),u=eX.bind(null,u,d,p),d.then(u,u))}function eX(u,d,p){var v=u.pingCache;v!==null&&v.delete(d),u.pingedLanes|=u.suspendedLanes&p,u.warmLanes&=~p,Fn===u&&(Kt&p)===p&&(fr===4||fr===3&&(Kt&62914560)===Kt&&300>Rt()-mg?(Cn&2)===0&&xd(u,0):u2|=p,pd===Kt&&(pd=0)),La(u)}function L8(u,d){d===0&&(d=dr()),u=$c(u,d),u!==null&&(Is(u,d),La(u))}function tX(u){var d=u.memoizedState,p=0;d!==null&&(p=d.retryLane),L8(u,p)}function nX(u,d){var p=0;switch(u.tag){case 31:case 13:var v=u.stateNode,O=u.memoizedState;O!==null&&(p=O.retryLane);break;case 19:v=u.stateNode;break;case 22:v=u.stateNode._retryCache;break;default:throw Error(r(314))}v!==null&&v.delete(d),L8(u,p)}function rX(u,d){return ot(u,d)}var wg=null,yd=null,v2=!1,Sg=!1,y2=!1,$l=0;function La(u){u!==yd&&u.next===null&&(yd===null?wg=yd=u:yd=yd.next=u),Sg=!0,v2||(v2=!0,iX())}function zf(u,d){if(!y2&&Sg){y2=!0;do for(var p=!1,v=wg;v!==null;){if(u!==0){var O=v.pendingLanes;if(O===0)var j=0;else{var B=v.suspendedLanes,K=v.pingedLanes;j=(1<<31-dt(42|u)+1)-1,j&=O&~(B&~K),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(p=!0,F8(v,j))}else j=Kt,j=ur(v,v===Fn?j:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(j&3)===0||Xr(v,j)||(p=!0,F8(v,j));v=v.next}while(p);y2=!1}}function sX(){I8()}function I8(){Sg=v2=!1;var u=0;$l!==0&&pX()&&(u=$l);for(var d=Rt(),p=null,v=wg;v!==null;){var O=v.next,j=B8(v,d);j===0?(v.next=null,p===null?wg=O:p.next=O,O===null&&(yd=p)):(p=v,(u!==0||(j&3)!==0)&&(Sg=!0)),v=O}Br!==0&&Br!==5||zf(u),$l!==0&&($l=0)}function B8(u,d){for(var p=u.suspendedLanes,v=u.pingedLanes,O=u.expirationTimes,j=u.pendingLanes&-62914561;0<j;){var B=31-dt(j),K=1<<B,ue=O[B];ue===-1?((K&p)===0||(K&v)!==0)&&(O[B]=Yr(K,d)):ue<=d&&(u.expiredLanes|=K),j&=~K}if(d=Fn,p=Kt,p=ur(u,u===d?p:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),v=u.callbackNode,p===0||u===d&&(En===2||En===9)||u.cancelPendingCommit!==null)return v!==null&&v!==null&&on(v),u.callbackNode=null,u.callbackPriority=0;if((p&3)===0||Xr(u,p)){if(d=p&-p,d===u.callbackPriority)return d;switch(v!==null&&on(v),ha(p)){case 2:case 8:p=Re;break;case 32:p=qe;break;case 268435456:p=wt;break;default:p=qe}return v=q8.bind(null,u),p=ot(p,v),u.callbackPriority=d,u.callbackNode=p,d}return v!==null&&v!==null&&on(v),u.callbackPriority=2,u.callbackNode=null,2}function q8(u,d){if(Br!==0&&Br!==5)return u.callbackNode=null,u.callbackPriority=0,null;var p=u.callbackNode;if(bg()&&u.callbackNode!==p)return null;var v=Kt;return v=ur(u,u===Fn?v:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),v===0?null:(w8(u,v,d),B8(u,Rt()),u.callbackNode!=null&&u.callbackNode===p?q8.bind(null,u):null)}function F8(u,d){if(bg())return null;w8(u,d,!0)}function iX(){xX(function(){(Cn&6)!==0?ot(Te,sX):I8()})}function b2(){if($l===0){var u=sd;u===0&&(u=vt,vt<<=1,(vt&261888)===0&&(vt=256)),$l=u}return $l}function $8(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:_p(""+u)}function Q8(u,d){var p=d.ownerDocument.createElement("input");return p.name=d.name,p.value=d.value,u.id&&p.setAttribute("form",u.id),d.parentNode.insertBefore(p,d),u=new FormData(u),p.parentNode.removeChild(p),u}function aX(u,d,p,v,O){if(d==="submit"&&p&&p.stateNode===O){var j=$8((O[ss]||null).action),B=v.submitter;B&&(d=(d=B[ss]||null)?$8(d.formAction):B.getAttribute("formAction"),d!==null&&(j=d,B=null));var K=new Dp("action","action",null,v,O);u.push({event:K,listeners:[{instance:null,listener:function(){if(v.defaultPrevented){if($l!==0){var ue=B?Q8(O,B):new FormData(O);qb(p,{pending:!0,data:ue,method:O.method,action:j},null,ue)}}else typeof j=="function"&&(K.preventDefault(),ue=B?Q8(O,B):new FormData(O),qb(p,{pending:!0,data:ue,method:O.method,action:j},j,ue))},currentTarget:O}]})}}for(var w2=0;w2<rb.length;w2++){var S2=rb[w2],oX=S2.toLowerCase(),lX=S2[0].toUpperCase()+S2.slice(1);fa(oX,"on"+lX)}fa(b7,"onAnimationEnd"),fa(w7,"onAnimationIteration"),fa(S7,"onAnimationStart"),fa("dblclick","onDoubleClick"),fa("focusin","onFocus"),fa("focusout","onBlur"),fa(OG,"onTransitionRun"),fa(jG,"onTransitionStart"),fa(NG,"onTransitionCancel"),fa(k7,"onTransitionEnd"),bo("onMouseEnter",["mouseout","mouseover"]),bo("onMouseLeave",["mouseout","mouseover"]),bo("onPointerEnter",["pointerout","pointerover"]),bo("onPointerLeave",["pointerout","pointerover"]),yo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),yo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),yo("onBeforeInput",["compositionend","keypress","textInput","paste"]),yo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),yo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),yo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),cX=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Pf));function H8(u,d){d=(d&4)!==0;for(var p=0;p<u.length;p++){var v=u[p],O=v.event;v=v.listeners;e:{var j=void 0;if(d)for(var B=v.length-1;0<=B;B--){var K=v[B],ue=K.instance,Se=K.currentTarget;if(K=K.listener,ue!==j&&O.isPropagationStopped())break e;j=K,O.currentTarget=Se;try{j(O)}catch(Ee){Lp(Ee)}O.currentTarget=null,j=ue}else for(B=0;B<v.length;B++){if(K=v[B],ue=K.instance,Se=K.currentTarget,K=K.listener,ue!==j&&O.isPropagationStopped())break e;j=K,O.currentTarget=Se;try{j(O)}catch(Ee){Lp(Ee)}O.currentTarget=null,j=ue}}}}function Xt(u,d){var p=d[ef];p===void 0&&(p=d[ef]=new Set);var v=u+"__bubble";p.has(v)||(V8(d,u,2,!1),p.add(v))}function k2(u,d,p){var v=0;d&&(v|=4),V8(p,u,v,d)}var kg="_reactListening"+Math.random().toString(36).slice(2);function O2(u){if(!u[kg]){u[kg]=!0,kp.forEach(function(p){p!=="selectionchange"&&(cX.has(p)||k2(p,!1,u),k2(p,!0,u))});var d=u.nodeType===9?u:u.ownerDocument;d===null||d[kg]||(d[kg]=!0,k2("selectionchange",!1,d))}}function V8(u,d,p,v){switch(bC(d)){case 2:var O=LX;break;case 8:O=IX;break;default:O=B2}p=O.bind(null,d,p,u),O=void 0,!Hy||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(O=!0),v?O!==void 0?u.addEventListener(d,p,{capture:!0,passive:O}):u.addEventListener(d,p,!0):O!==void 0?u.addEventListener(d,p,{passive:O}):u.addEventListener(d,p,!1)}function j2(u,d,p,v,O){var j=v;if((d&1)===0&&(d&2)===0&&v!==null)e:for(;;){if(v===null)return;var B=v.tag;if(B===3||B===4){var K=v.stateNode.containerInfo;if(K===O)break;if(B===4)for(B=v.return;B!==null;){var ue=B.tag;if((ue===3||ue===4)&&B.stateNode.containerInfo===O)return;B=B.return}for(;K!==null;){if(B=Ol(K),B===null)return;if(ue=B.tag,ue===5||ue===6||ue===26||ue===27){v=j=B;continue e}K=K.parentNode}}v=v.return}Yj(function(){var Se=j,Ee=$y(p),De=[];e:{var ke=O7.get(u);if(ke!==void 0){var Ce=Dp,st=u;switch(u){case"keypress":if(Ap(p)===0)break e;case"keydown":case"keyup":Ce=nG;break;case"focusin":st="focus",Ce=Gy;break;case"focusout":st="blur",Ce=Gy;break;case"beforeblur":case"afterblur":Ce=Gy;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ce=Jj;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ce=HW;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ce=iG;break;case b7:case w7:case S7:Ce=WW;break;case k7:Ce=oG;break;case"scroll":case"scrollend":Ce=$W;break;case"wheel":Ce=cG;break;case"copy":case"cut":case"paste":Ce=XW;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ce=t7;break;case"toggle":case"beforetoggle":Ce=dG}var Ot=(d&4)!==0,zn=!Ot&&(u==="scroll"||u==="scrollend"),ge=Ot?ke!==null?ke+"Capture":null:ke;Ot=[];for(var fe=Se,be;fe!==null;){var Me=fe;if(be=Me.stateNode,Me=Me.tag,Me!==5&&Me!==26&&Me!==27||be===null||ge===null||(Me=rf(fe,ge),Me!=null&&Ot.push(Lf(fe,Me,be))),zn)break;fe=fe.return}0<Ot.length&&(ke=new Ce(ke,st,null,p,Ee),De.push({event:ke,listeners:Ot}))}}if((d&7)===0){e:{if(ke=u==="mouseover"||u==="pointerover",Ce=u==="mouseout"||u==="pointerout",ke&&p!==Fy&&(st=p.relatedTarget||p.fromElement)&&(Ol(st)||st[kl]))break e;if((Ce||ke)&&(ke=Ee.window===Ee?Ee:(ke=Ee.ownerDocument)?ke.defaultView||ke.parentWindow:window,Ce?(st=p.relatedTarget||p.toElement,Ce=Se,st=st?Ol(st):null,st!==null&&(zn=i(st),Ot=st.tag,st!==zn||Ot!==5&&Ot!==27&&Ot!==6)&&(st=null)):(Ce=null,st=Se),Ce!==st)){if(Ot=Jj,Me="onMouseLeave",ge="onMouseEnter",fe="mouse",(u==="pointerout"||u==="pointerover")&&(Ot=t7,Me="onPointerLeave",ge="onPointerEnter",fe="pointer"),zn=Ce==null?ke:Ic(Ce),be=st==null?ke:Ic(st),ke=new Ot(Me,fe+"leave",Ce,p,Ee),ke.target=zn,ke.relatedTarget=be,Me=null,Ol(Ee)===Se&&(Ot=new Ot(ge,fe+"enter",st,p,Ee),Ot.target=be,Ot.relatedTarget=zn,Me=Ot),zn=Me,Ce&&st)t:{for(Ot=uX,ge=Ce,fe=st,be=0,Me=ge;Me;Me=Ot(Me))be++;Me=0;for(var yt=fe;yt;yt=Ot(yt))Me++;for(;0<be-Me;)ge=Ot(ge),be--;for(;0<Me-be;)fe=Ot(fe),Me--;for(;be--;){if(ge===fe||fe!==null&&ge===fe.alternate){Ot=ge;break t}ge=Ot(ge),fe=Ot(fe)}Ot=null}else Ot=null;Ce!==null&&U8(De,ke,Ce,Ot,!1),st!==null&&zn!==null&&U8(De,zn,st,Ot,!0)}}e:{if(ke=Se?Ic(Se):window,Ce=ke.nodeName&&ke.nodeName.toLowerCase(),Ce==="select"||Ce==="input"&&ke.type==="file")var yn=c7;else if(o7(ke))if(u7)yn=wG;else{yn=yG;var ct=vG}else Ce=ke.nodeName,!Ce||Ce.toLowerCase()!=="input"||ke.type!=="checkbox"&&ke.type!=="radio"?Se&&qy(Se.elementType)&&(yn=c7):yn=bG;if(yn&&(yn=yn(u,Se))){l7(De,yn,p,Ee);break e}ct&&ct(u,ke,Se),u==="focusout"&&Se&&ke.type==="number"&&Se.memoizedProps.value!=null&&By(ke,"number",ke.value)}switch(ct=Se?Ic(Se):window,u){case"focusin":(o7(ct)||ct.contentEditable==="true")&&(Yu=ct,eb=Se,hf=null);break;case"focusout":hf=eb=Yu=null;break;case"mousedown":tb=!0;break;case"contextmenu":case"mouseup":case"dragend":tb=!1,v7(De,p,Ee);break;case"selectionchange":if(kG)break;case"keydown":case"keyup":v7(De,p,Ee)}var Bt;if(Yy)e:{switch(u){case"compositionstart":var Zt="onCompositionStart";break e;case"compositionend":Zt="onCompositionEnd";break e;case"compositionupdate":Zt="onCompositionUpdate";break e}Zt=void 0}else Xu?i7(u,p)&&(Zt="onCompositionEnd"):u==="keydown"&&p.keyCode===229&&(Zt="onCompositionStart");Zt&&(n7&&p.locale!=="ko"&&(Xu||Zt!=="onCompositionStart"?Zt==="onCompositionEnd"&&Xu&&(Bt=Kj()):(Nl=Ee,Vy="value"in Nl?Nl.value:Nl.textContent,Xu=!0)),ct=Og(Se,Zt),0<ct.length&&(Zt=new e7(Zt,u,null,p,Ee),De.push({event:Zt,listeners:ct}),Bt?Zt.data=Bt:(Bt=a7(p),Bt!==null&&(Zt.data=Bt)))),(Bt=fG?mG(u,p):pG(u,p))&&(Zt=Og(Se,"onBeforeInput"),0<Zt.length&&(ct=new e7("onBeforeInput","beforeinput",null,p,Ee),De.push({event:ct,listeners:Zt}),ct.data=Bt)),aX(De,u,Se,p,Ee)}H8(De,d)})}function Lf(u,d,p){return{instance:u,listener:d,currentTarget:p}}function Og(u,d){for(var p=d+"Capture",v=[];u!==null;){var O=u,j=O.stateNode;if(O=O.tag,O!==5&&O!==26&&O!==27||j===null||(O=rf(u,p),O!=null&&v.unshift(Lf(u,O,j)),O=rf(u,d),O!=null&&v.push(Lf(u,O,j))),u.tag===3)return v;u=u.return}return[]}function uX(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function U8(u,d,p,v,O){for(var j=d._reactName,B=[];p!==null&&p!==v;){var K=p,ue=K.alternate,Se=K.stateNode;if(K=K.tag,ue!==null&&ue===v)break;K!==5&&K!==26&&K!==27||Se===null||(ue=Se,O?(Se=rf(p,j),Se!=null&&B.unshift(Lf(p,Se,ue))):O||(Se=rf(p,j),Se!=null&&B.push(Lf(p,Se,ue)))),p=p.return}B.length!==0&&u.push({event:d,listeners:B})}var dX=/\r\n?/g,hX=/\u0000|\uFFFD/g;function W8(u){return(typeof u=="string"?u:""+u).replace(dX,`
`).replace(hX,"")}function G8(u,d){return d=W8(d),W8(u)===d}function Dn(u,d,p,v,O,j){switch(p){case"children":typeof v=="string"?d==="body"||d==="textarea"&&v===""||Uu(u,v):(typeof v=="number"||typeof v=="bigint")&&d!=="body"&&Uu(u,""+v);break;case"className":Tp(u,"class",v);break;case"tabIndex":Tp(u,"tabindex",v);break;case"dir":case"role":case"viewBox":case"width":case"height":Tp(u,p,v);break;case"style":Gj(u,v,j);break;case"data":if(d!=="object"){Tp(u,"data",v);break}case"src":case"href":if(v===""&&(d!=="a"||p!=="href")){u.removeAttribute(p);break}if(v==null||typeof v=="function"||typeof v=="symbol"||typeof v=="boolean"){u.removeAttribute(p);break}v=_p(""+v),u.setAttribute(p,v);break;case"action":case"formAction":if(typeof v=="function"){u.setAttribute(p,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof j=="function"&&(p==="formAction"?(d!=="input"&&Dn(u,d,"name",O.name,O,null),Dn(u,d,"formEncType",O.formEncType,O,null),Dn(u,d,"formMethod",O.formMethod,O,null),Dn(u,d,"formTarget",O.formTarget,O,null)):(Dn(u,d,"encType",O.encType,O,null),Dn(u,d,"method",O.method,O,null),Dn(u,d,"target",O.target,O,null)));if(v==null||typeof v=="symbol"||typeof v=="boolean"){u.removeAttribute(p);break}v=_p(""+v),u.setAttribute(p,v);break;case"onClick":v!=null&&(u.onclick=So);break;case"onScroll":v!=null&&Xt("scroll",u);break;case"onScrollEnd":v!=null&&Xt("scrollend",u);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(r(61));if(p=v.__html,p!=null){if(O.children!=null)throw Error(r(60));u.innerHTML=p}}break;case"multiple":u.multiple=v&&typeof v!="function"&&typeof v!="symbol";break;case"muted":u.muted=v&&typeof v!="function"&&typeof v!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(v==null||typeof v=="function"||typeof v=="boolean"||typeof v=="symbol"){u.removeAttribute("xlink:href");break}p=_p(""+v),u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",p);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":v!=null&&typeof v!="function"&&typeof v!="symbol"?u.setAttribute(p,""+v):u.removeAttribute(p);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":v&&typeof v!="function"&&typeof v!="symbol"?u.setAttribute(p,""):u.removeAttribute(p);break;case"capture":case"download":v===!0?u.setAttribute(p,""):v!==!1&&v!=null&&typeof v!="function"&&typeof v!="symbol"?u.setAttribute(p,v):u.removeAttribute(p);break;case"cols":case"rows":case"size":case"span":v!=null&&typeof v!="function"&&typeof v!="symbol"&&!isNaN(v)&&1<=v?u.setAttribute(p,v):u.removeAttribute(p);break;case"rowSpan":case"start":v==null||typeof v=="function"||typeof v=="symbol"||isNaN(v)?u.removeAttribute(p):u.setAttribute(p,v);break;case"popover":Xt("beforetoggle",u),Xt("toggle",u),Cp(u,"popover",v);break;case"xlinkActuate":wo(u,"http://www.w3.org/1999/xlink","xlink:actuate",v);break;case"xlinkArcrole":wo(u,"http://www.w3.org/1999/xlink","xlink:arcrole",v);break;case"xlinkRole":wo(u,"http://www.w3.org/1999/xlink","xlink:role",v);break;case"xlinkShow":wo(u,"http://www.w3.org/1999/xlink","xlink:show",v);break;case"xlinkTitle":wo(u,"http://www.w3.org/1999/xlink","xlink:title",v);break;case"xlinkType":wo(u,"http://www.w3.org/1999/xlink","xlink:type",v);break;case"xmlBase":wo(u,"http://www.w3.org/XML/1998/namespace","xml:base",v);break;case"xmlLang":wo(u,"http://www.w3.org/XML/1998/namespace","xml:lang",v);break;case"xmlSpace":wo(u,"http://www.w3.org/XML/1998/namespace","xml:space",v);break;case"is":Cp(u,"is",v);break;case"innerText":case"textContent":break;default:(!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(p=qW.get(p)||p,Cp(u,p,v))}}function N2(u,d,p,v,O,j){switch(p){case"style":Gj(u,v,j);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(r(61));if(p=v.__html,p!=null){if(O.children!=null)throw Error(r(60));u.innerHTML=p}}break;case"children":typeof v=="string"?Uu(u,v):(typeof v=="number"||typeof v=="bigint")&&Uu(u,""+v);break;case"onScroll":v!=null&&Xt("scroll",u);break;case"onScrollEnd":v!=null&&Xt("scrollend",u);break;case"onClick":v!=null&&(u.onclick=So);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Op.hasOwnProperty(p))e:{if(p[0]==="o"&&p[1]==="n"&&(O=p.endsWith("Capture"),d=p.slice(2,O?p.length-7:void 0),j=u[ss]||null,j=j!=null?j[p]:null,typeof j=="function"&&u.removeEventListener(d,j,O),typeof v=="function")){typeof j!="function"&&j!==null&&(p in u?u[p]=null:u.hasAttribute(p)&&u.removeAttribute(p)),u.addEventListener(d,v,O);break e}p in u?u[p]=v:v===!0?u.setAttribute(p,""):Cp(u,p,v)}}}function ls(u,d,p){switch(d){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Xt("error",u),Xt("load",u);var v=!1,O=!1,j;for(j in p)if(p.hasOwnProperty(j)){var B=p[j];if(B!=null)switch(j){case"src":v=!0;break;case"srcSet":O=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,d));default:Dn(u,d,j,B,p,null)}}O&&Dn(u,d,"srcSet",p.srcSet,p,null),v&&Dn(u,d,"src",p.src,p,null);return;case"input":Xt("invalid",u);var K=j=B=O=null,ue=null,Se=null;for(v in p)if(p.hasOwnProperty(v)){var Ee=p[v];if(Ee!=null)switch(v){case"name":O=Ee;break;case"type":B=Ee;break;case"checked":ue=Ee;break;case"defaultChecked":Se=Ee;break;case"value":j=Ee;break;case"defaultValue":K=Ee;break;case"children":case"dangerouslySetInnerHTML":if(Ee!=null)throw Error(r(137,d));break;default:Dn(u,d,v,Ee,p,null)}}Hj(u,j,K,ue,Se,B,O,!1);return;case"select":Xt("invalid",u),v=B=j=null;for(O in p)if(p.hasOwnProperty(O)&&(K=p[O],K!=null))switch(O){case"value":j=K;break;case"defaultValue":B=K;break;case"multiple":v=K;default:Dn(u,d,O,K,p,null)}d=j,p=B,u.multiple=!!v,d!=null?Vu(u,!!v,d,!1):p!=null&&Vu(u,!!v,p,!0);return;case"textarea":Xt("invalid",u),j=O=v=null;for(B in p)if(p.hasOwnProperty(B)&&(K=p[B],K!=null))switch(B){case"value":v=K;break;case"defaultValue":O=K;break;case"children":j=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(91));break;default:Dn(u,d,B,K,p,null)}Uj(u,v,O,j);return;case"option":for(ue in p)if(p.hasOwnProperty(ue)&&(v=p[ue],v!=null))switch(ue){case"selected":u.selected=v&&typeof v!="function"&&typeof v!="symbol";break;default:Dn(u,d,ue,v,p,null)}return;case"dialog":Xt("beforetoggle",u),Xt("toggle",u),Xt("cancel",u),Xt("close",u);break;case"iframe":case"object":Xt("load",u);break;case"video":case"audio":for(v=0;v<Pf.length;v++)Xt(Pf[v],u);break;case"image":Xt("error",u),Xt("load",u);break;case"details":Xt("toggle",u);break;case"embed":case"source":case"link":Xt("error",u),Xt("load",u);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Se in p)if(p.hasOwnProperty(Se)&&(v=p[Se],v!=null))switch(Se){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,d));default:Dn(u,d,Se,v,p,null)}return;default:if(qy(d)){for(Ee in p)p.hasOwnProperty(Ee)&&(v=p[Ee],v!==void 0&&N2(u,d,Ee,v,p,void 0));return}}for(K in p)p.hasOwnProperty(K)&&(v=p[K],v!=null&&Dn(u,d,K,v,p,null))}function fX(u,d,p,v){switch(d){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var O=null,j=null,B=null,K=null,ue=null,Se=null,Ee=null;for(Ce in p){var De=p[Ce];if(p.hasOwnProperty(Ce)&&De!=null)switch(Ce){case"checked":break;case"value":break;case"defaultValue":ue=De;default:v.hasOwnProperty(Ce)||Dn(u,d,Ce,null,v,De)}}for(var ke in v){var Ce=v[ke];if(De=p[ke],v.hasOwnProperty(ke)&&(Ce!=null||De!=null))switch(ke){case"type":j=Ce;break;case"name":O=Ce;break;case"checked":Se=Ce;break;case"defaultChecked":Ee=Ce;break;case"value":B=Ce;break;case"defaultValue":K=Ce;break;case"children":case"dangerouslySetInnerHTML":if(Ce!=null)throw Error(r(137,d));break;default:Ce!==De&&Dn(u,d,ke,Ce,v,De)}}Iy(u,B,K,ue,Se,Ee,j,O);return;case"select":Ce=B=K=ke=null;for(j in p)if(ue=p[j],p.hasOwnProperty(j)&&ue!=null)switch(j){case"value":break;case"multiple":Ce=ue;default:v.hasOwnProperty(j)||Dn(u,d,j,null,v,ue)}for(O in v)if(j=v[O],ue=p[O],v.hasOwnProperty(O)&&(j!=null||ue!=null))switch(O){case"value":ke=j;break;case"defaultValue":K=j;break;case"multiple":B=j;default:j!==ue&&Dn(u,d,O,j,v,ue)}d=K,p=B,v=Ce,ke!=null?Vu(u,!!p,ke,!1):!!v!=!!p&&(d!=null?Vu(u,!!p,d,!0):Vu(u,!!p,p?[]:"",!1));return;case"textarea":Ce=ke=null;for(K in p)if(O=p[K],p.hasOwnProperty(K)&&O!=null&&!v.hasOwnProperty(K))switch(K){case"value":break;case"children":break;default:Dn(u,d,K,null,v,O)}for(B in v)if(O=v[B],j=p[B],v.hasOwnProperty(B)&&(O!=null||j!=null))switch(B){case"value":ke=O;break;case"defaultValue":Ce=O;break;case"children":break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(r(91));break;default:O!==j&&Dn(u,d,B,O,v,j)}Vj(u,ke,Ce);return;case"option":for(var st in p)if(ke=p[st],p.hasOwnProperty(st)&&ke!=null&&!v.hasOwnProperty(st))switch(st){case"selected":u.selected=!1;break;default:Dn(u,d,st,null,v,ke)}for(ue in v)if(ke=v[ue],Ce=p[ue],v.hasOwnProperty(ue)&&ke!==Ce&&(ke!=null||Ce!=null))switch(ue){case"selected":u.selected=ke&&typeof ke!="function"&&typeof ke!="symbol";break;default:Dn(u,d,ue,ke,v,Ce)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ot in p)ke=p[Ot],p.hasOwnProperty(Ot)&&ke!=null&&!v.hasOwnProperty(Ot)&&Dn(u,d,Ot,null,v,ke);for(Se in v)if(ke=v[Se],Ce=p[Se],v.hasOwnProperty(Se)&&ke!==Ce&&(ke!=null||Ce!=null))switch(Se){case"children":case"dangerouslySetInnerHTML":if(ke!=null)throw Error(r(137,d));break;default:Dn(u,d,Se,ke,v,Ce)}return;default:if(qy(d)){for(var zn in p)ke=p[zn],p.hasOwnProperty(zn)&&ke!==void 0&&!v.hasOwnProperty(zn)&&N2(u,d,zn,void 0,v,ke);for(Ee in v)ke=v[Ee],Ce=p[Ee],!v.hasOwnProperty(Ee)||ke===Ce||ke===void 0&&Ce===void 0||N2(u,d,Ee,ke,v,Ce);return}}for(var ge in p)ke=p[ge],p.hasOwnProperty(ge)&&ke!=null&&!v.hasOwnProperty(ge)&&Dn(u,d,ge,null,v,ke);for(De in v)ke=v[De],Ce=p[De],!v.hasOwnProperty(De)||ke===Ce||ke==null&&Ce==null||Dn(u,d,De,ke,v,Ce)}function X8(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function mX(){if(typeof performance.getEntriesByType=="function"){for(var u=0,d=0,p=performance.getEntriesByType("resource"),v=0;v<p.length;v++){var O=p[v],j=O.transferSize,B=O.initiatorType,K=O.duration;if(j&&K&&X8(B)){for(B=0,K=O.responseEnd,v+=1;v<p.length;v++){var ue=p[v],Se=ue.startTime;if(Se>K)break;var Ee=ue.transferSize,De=ue.initiatorType;Ee&&X8(De)&&(ue=ue.responseEnd,B+=Ee*(ue<K?1:(K-Se)/(ue-Se)))}if(--v,d+=8*(j+B)/(O.duration/1e3),u++,10<u)break}}if(0<u)return d/u/1e6}return navigator.connection&&(u=navigator.connection.downlink,typeof u=="number")?u:5}var C2=null,T2=null;function jg(u){return u.nodeType===9?u:u.ownerDocument}function Y8(u){switch(u){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function K8(u,d){if(u===0)switch(d){case"svg":return 1;case"math":return 2;default:return 0}return u===1&&d==="foreignObject"?0:u}function E2(u,d){return u==="textarea"||u==="noscript"||typeof d.children=="string"||typeof d.children=="number"||typeof d.children=="bigint"||typeof d.dangerouslySetInnerHTML=="object"&&d.dangerouslySetInnerHTML!==null&&d.dangerouslySetInnerHTML.__html!=null}var _2=null;function pX(){var u=window.event;return u&&u.type==="popstate"?u===_2?!1:(_2=u,!0):(_2=null,!1)}var Z8=typeof setTimeout=="function"?setTimeout:void 0,gX=typeof clearTimeout=="function"?clearTimeout:void 0,J8=typeof Promise=="function"?Promise:void 0,xX=typeof queueMicrotask=="function"?queueMicrotask:typeof J8<"u"?function(u){return J8.resolve(null).then(u).catch(vX)}:Z8;function vX(u){setTimeout(function(){throw u})}function Ql(u){return u==="head"}function eC(u,d){var p=d,v=0;do{var O=p.nextSibling;if(u.removeChild(p),O&&O.nodeType===8)if(p=O.data,p==="/$"||p==="/&"){if(v===0){u.removeChild(O),kd(d);return}v--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")v++;else if(p==="html")If(u.ownerDocument.documentElement);else if(p==="head"){p=u.ownerDocument.head,If(p);for(var j=p.firstChild;j;){var B=j.nextSibling,K=j.nodeName;j[Lc]||K==="SCRIPT"||K==="STYLE"||K==="LINK"&&j.rel.toLowerCase()==="stylesheet"||p.removeChild(j),j=B}}else p==="body"&&If(u.ownerDocument.body);p=O}while(p);kd(d)}function tC(u,d){var p=u;u=0;do{var v=p.nextSibling;if(p.nodeType===1?d?(p._stashedDisplay=p.style.display,p.style.display="none"):(p.style.display=p._stashedDisplay||"",p.getAttribute("style")===""&&p.removeAttribute("style")):p.nodeType===3&&(d?(p._stashedText=p.nodeValue,p.nodeValue=""):p.nodeValue=p._stashedText||""),v&&v.nodeType===8)if(p=v.data,p==="/$"){if(u===0)break;u--}else p!=="$"&&p!=="$?"&&p!=="$~"&&p!=="$!"||u++;p=v}while(p)}function M2(u){var d=u.firstChild;for(d&&d.nodeType===10&&(d=d.nextSibling);d;){var p=d;switch(d=d.nextSibling,p.nodeName){case"HTML":case"HEAD":case"BODY":M2(p),tf(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}u.removeChild(p)}}function yX(u,d,p,v){for(;u.nodeType===1;){var O=p;if(u.nodeName.toLowerCase()!==d.toLowerCase()){if(!v&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(v){if(!u[Lc])switch(d){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(j=u.getAttribute("rel"),j==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(j!==O.rel||u.getAttribute("href")!==(O.href==null||O.href===""?null:O.href)||u.getAttribute("crossorigin")!==(O.crossOrigin==null?null:O.crossOrigin)||u.getAttribute("title")!==(O.title==null?null:O.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(j=u.getAttribute("src"),(j!==(O.src==null?null:O.src)||u.getAttribute("type")!==(O.type==null?null:O.type)||u.getAttribute("crossorigin")!==(O.crossOrigin==null?null:O.crossOrigin))&&j&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(d==="input"&&u.type==="hidden"){var j=O.name==null?null:""+O.name;if(O.type==="hidden"&&u.getAttribute("name")===j)return u}else return u;if(u=$i(u.nextSibling),u===null)break}return null}function bX(u,d,p){if(d==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!p||(u=$i(u.nextSibling),u===null))return null;return u}function nC(u,d){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!d||(u=$i(u.nextSibling),u===null))return null;return u}function A2(u){return u.data==="$?"||u.data==="$~"}function R2(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function wX(u,d){var p=u.ownerDocument;if(u.data==="$~")u._reactRetry=d;else if(u.data!=="$?"||p.readyState!=="loading")d();else{var v=function(){d(),p.removeEventListener("DOMContentLoaded",v)};p.addEventListener("DOMContentLoaded",v),u._reactRetry=v}}function $i(u){for(;u!=null;u=u.nextSibling){var d=u.nodeType;if(d===1||d===3)break;if(d===8){if(d=u.data,d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"||d==="F!"||d==="F")break;if(d==="/$"||d==="/&")return null}}return u}var D2=null;function rC(u){u=u.nextSibling;for(var d=0;u;){if(u.nodeType===8){var p=u.data;if(p==="/$"||p==="/&"){if(d===0)return $i(u.nextSibling);d--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||d++}u=u.nextSibling}return null}function sC(u){u=u.previousSibling;for(var d=0;u;){if(u.nodeType===8){var p=u.data;if(p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"){if(d===0)return u;d--}else p!=="/$"&&p!=="/&"||d++}u=u.previousSibling}return null}function iC(u,d,p){switch(d=jg(p),u){case"html":if(u=d.documentElement,!u)throw Error(r(452));return u;case"head":if(u=d.head,!u)throw Error(r(453));return u;case"body":if(u=d.body,!u)throw Error(r(454));return u;default:throw Error(r(451))}}function If(u){for(var d=u.attributes;d.length;)u.removeAttributeNode(d[0]);tf(u)}var Qi=new Map,aC=new Set;function Ng(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var Io=W.d;W.d={f:SX,r:kX,D:OX,C:jX,L:NX,m:CX,X:EX,S:TX,M:_X};function SX(){var u=Io.f(),d=xg();return u||d}function kX(u){var d=vo(u);d!==null&&d.tag===5&&d.type==="form"?kN(d):Io.r(u)}var bd=typeof document>"u"?null:document;function oC(u,d,p){var v=bd;if(v&&typeof d=="string"&&d){var O=zi(d);O='link[rel="'+u+'"][href="'+O+'"]',typeof p=="string"&&(O+='[crossorigin="'+p+'"]'),aC.has(O)||(aC.add(O),u={rel:u,crossOrigin:p,href:d},v.querySelector(O)===null&&(d=v.createElement("link"),ls(d,"link",u),Cr(d),v.head.appendChild(d)))}}function OX(u){Io.D(u),oC("dns-prefetch",u,null)}function jX(u,d){Io.C(u,d),oC("preconnect",u,d)}function NX(u,d,p){Io.L(u,d,p);var v=bd;if(v&&u&&d){var O='link[rel="preload"][as="'+zi(d)+'"]';d==="image"&&p&&p.imageSrcSet?(O+='[imagesrcset="'+zi(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(O+='[imagesizes="'+zi(p.imageSizes)+'"]')):O+='[href="'+zi(u)+'"]';var j=O;switch(d){case"style":j=wd(u);break;case"script":j=Sd(u)}Qi.has(j)||(u=m({rel:"preload",href:d==="image"&&p&&p.imageSrcSet?void 0:u,as:d},p),Qi.set(j,u),v.querySelector(O)!==null||d==="style"&&v.querySelector(Bf(j))||d==="script"&&v.querySelector(qf(j))||(d=v.createElement("link"),ls(d,"link",u),Cr(d),v.head.appendChild(d)))}}function CX(u,d){Io.m(u,d);var p=bd;if(p&&u){var v=d&&typeof d.as=="string"?d.as:"script",O='link[rel="modulepreload"][as="'+zi(v)+'"][href="'+zi(u)+'"]',j=O;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=Sd(u)}if(!Qi.has(j)&&(u=m({rel:"modulepreload",href:u},d),Qi.set(j,u),p.querySelector(O)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(qf(j)))return}v=p.createElement("link"),ls(v,"link",u),Cr(v),p.head.appendChild(v)}}}function TX(u,d,p){Io.S(u,d,p);var v=bd;if(v&&u){var O=jl(v).hoistableStyles,j=wd(u);d=d||"default";var B=O.get(j);if(!B){var K={loading:0,preload:null};if(B=v.querySelector(Bf(j)))K.loading=5;else{u=m({rel:"stylesheet",href:u,"data-precedence":d},p),(p=Qi.get(j))&&z2(u,p);var ue=B=v.createElement("link");Cr(ue),ls(ue,"link",u),ue._p=new Promise(function(Se,Ee){ue.onload=Se,ue.onerror=Ee}),ue.addEventListener("load",function(){K.loading|=1}),ue.addEventListener("error",function(){K.loading|=2}),K.loading|=4,Cg(B,d,v)}B={type:"stylesheet",instance:B,count:1,state:K},O.set(j,B)}}}function EX(u,d){Io.X(u,d);var p=bd;if(p&&u){var v=jl(p).hoistableScripts,O=Sd(u),j=v.get(O);j||(j=p.querySelector(qf(O)),j||(u=m({src:u,async:!0},d),(d=Qi.get(O))&&P2(u,d),j=p.createElement("script"),Cr(j),ls(j,"link",u),p.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},v.set(O,j))}}function _X(u,d){Io.M(u,d);var p=bd;if(p&&u){var v=jl(p).hoistableScripts,O=Sd(u),j=v.get(O);j||(j=p.querySelector(qf(O)),j||(u=m({src:u,async:!0,type:"module"},d),(d=Qi.get(O))&&P2(u,d),j=p.createElement("script"),Cr(j),ls(j,"link",u),p.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},v.set(O,j))}}function lC(u,d,p,v){var O=(O=ne.current)?Ng(O):null;if(!O)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(d=wd(p.href),p=jl(O).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"){u=wd(p.href);var j=jl(O).hoistableStyles,B=j.get(u);if(B||(O=O.ownerDocument||O,B={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(u,B),(j=O.querySelector(Bf(u)))&&!j._p&&(B.instance=j,B.state.loading=5),Qi.has(u)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},Qi.set(u,p),j||MX(O,u,p,B.state))),d&&v===null)throw Error(r(528,""));return B}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=Sd(p),p=jl(O).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,u))}}function wd(u){return'href="'+zi(u)+'"'}function Bf(u){return'link[rel="stylesheet"]['+u+"]"}function cC(u){return m({},u,{"data-precedence":u.precedence,precedence:null})}function MX(u,d,p,v){u.querySelector('link[rel="preload"][as="style"]['+d+"]")?v.loading=1:(d=u.createElement("link"),v.preload=d,d.addEventListener("load",function(){return v.loading|=1}),d.addEventListener("error",function(){return v.loading|=2}),ls(d,"link",p),Cr(d),u.head.appendChild(d))}function Sd(u){return'[src="'+zi(u)+'"]'}function qf(u){return"script[async]"+u}function uC(u,d,p){if(d.count++,d.instance===null)switch(d.type){case"style":var v=u.querySelector('style[data-href~="'+zi(p.href)+'"]');if(v)return d.instance=v,Cr(v),v;var O=m({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return v=(u.ownerDocument||u).createElement("style"),Cr(v),ls(v,"style",O),Cg(v,p.precedence,u),d.instance=v;case"stylesheet":O=wd(p.href);var j=u.querySelector(Bf(O));if(j)return d.state.loading|=4,d.instance=j,Cr(j),j;v=cC(p),(O=Qi.get(O))&&z2(v,O),j=(u.ownerDocument||u).createElement("link"),Cr(j);var B=j;return B._p=new Promise(function(K,ue){B.onload=K,B.onerror=ue}),ls(j,"link",v),d.state.loading|=4,Cg(j,p.precedence,u),d.instance=j;case"script":return j=Sd(p.src),(O=u.querySelector(qf(j)))?(d.instance=O,Cr(O),O):(v=p,(O=Qi.get(j))&&(v=m({},p),P2(v,O)),u=u.ownerDocument||u,O=u.createElement("script"),Cr(O),ls(O,"link",v),u.head.appendChild(O),d.instance=O);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,Cg(v,p.precedence,u));return d.instance}function Cg(u,d,p){for(var v=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),O=v.length?v[v.length-1]:null,j=O,B=0;B<v.length;B++){var K=v[B];if(K.dataset.precedence===d)j=K;else if(j!==O)break}j?j.parentNode.insertBefore(u,j.nextSibling):(d=p.nodeType===9?p.head:p,d.insertBefore(u,d.firstChild))}function z2(u,d){u.crossOrigin==null&&(u.crossOrigin=d.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=d.referrerPolicy),u.title==null&&(u.title=d.title)}function P2(u,d){u.crossOrigin==null&&(u.crossOrigin=d.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=d.referrerPolicy),u.integrity==null&&(u.integrity=d.integrity)}var Tg=null;function dC(u,d,p){if(Tg===null){var v=new Map,O=Tg=new Map;O.set(p,v)}else O=Tg,v=O.get(p),v||(v=new Map,O.set(p,v));if(v.has(u))return v;for(v.set(u,null),p=p.getElementsByTagName(u),O=0;O<p.length;O++){var j=p[O];if(!(j[Lc]||j[Ir]||u==="link"&&j.getAttribute("rel")==="stylesheet")&&j.namespaceURI!=="http://www.w3.org/2000/svg"){var B=j.getAttribute(d)||"";B=u+B;var K=v.get(B);K?K.push(j):v.set(B,[j])}}return v}function hC(u,d,p){u=u.ownerDocument||u,u.head.insertBefore(p,d==="title"?u.querySelector("head > title"):null)}function AX(u,d,p){if(p===1||d.itemProp!=null)return!1;switch(u){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 u=d.disabled,typeof d.precedence=="string"&&u==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 fC(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function RX(u,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 O=wd(v.href),j=d.querySelector(Bf(O));if(j){d=j._p,d!==null&&typeof d=="object"&&typeof d.then=="function"&&(u.count++,u=Eg.bind(u),d.then(u,u)),p.state.loading|=4,p.instance=j,Cr(j);return}j=d.ownerDocument||d,v=cC(v),(O=Qi.get(O))&&z2(v,O),j=j.createElement("link"),Cr(j);var B=j;B._p=new Promise(function(K,ue){B.onload=K,B.onerror=ue}),ls(j,"link",v),p.instance=j}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(p,d),(d=p.state.preload)&&(p.state.loading&3)===0&&(u.count++,p=Eg.bind(u),d.addEventListener("load",p),d.addEventListener("error",p))}}var L2=0;function DX(u,d){return u.stylesheets&&u.count===0&&Mg(u,u.stylesheets),0<u.count||0<u.imgCount?function(p){var v=setTimeout(function(){if(u.stylesheets&&Mg(u,u.stylesheets),u.unsuspend){var j=u.unsuspend;u.unsuspend=null,j()}},6e4+d);0<u.imgBytes&&L2===0&&(L2=62500*mX());var O=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&Mg(u,u.stylesheets),u.unsuspend)){var j=u.unsuspend;u.unsuspend=null,j()}},(u.imgBytes>L2?50:800)+d);return u.unsuspend=p,function(){u.unsuspend=null,clearTimeout(v),clearTimeout(O)}}:null}function Eg(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Mg(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var _g=null;function Mg(u,d){u.stylesheets=null,u.unsuspend!==null&&(u.count++,_g=new Map,d.forEach(zX,u),_g=null,Eg.call(u))}function zX(u,d){if(!(d.state.loading&4)){var p=_g.get(u);if(p)var v=p.get(null);else{p=new Map,_g.set(u,p);for(var O=u.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<O.length;j++){var B=O[j];(B.nodeName==="LINK"||B.getAttribute("media")!=="not all")&&(p.set(B.dataset.precedence,B),v=B)}v&&p.set(null,v)}O=d.instance,B=O.getAttribute("data-precedence"),j=p.get(B)||v,j===v&&p.set(null,O),p.set(B,O),this.count++,v=Eg.bind(this),O.addEventListener("load",v),O.addEventListener("error",v),j?j.parentNode.insertBefore(O,j.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(O,u.firstChild)),d.state.loading|=4}}var Ff={$$typeof:C,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function PX(u,d,p,v,O,j,B,K,ue){this.tag=1,this.containerInfo=u,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Nr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nr(0),this.hiddenUpdates=Nr(null),this.identifierPrefix=v,this.onUncaughtError=O,this.onCaughtError=j,this.onRecoverableError=B,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ue,this.incompleteTransitions=new Map}function mC(u,d,p,v,O,j,B,K,ue,Se,Ee,De){return u=new PX(u,d,p,B,ue,Se,Ee,De,K),d=1,j===!0&&(d|=24),j=mi(3,null,null,d),u.current=j,j.stateNode=u,d=gb(),d.refCount++,u.pooledCache=d,d.refCount++,j.memoizedState={element:v,isDehydrated:p,cache:d},bb(j),u}function pC(u){return u?(u=Ju,u):Ju}function gC(u,d,p,v,O,j){O=pC(O),v.context===null?v.context=O:v.pendingContext=O,v=Al(d),v.payload={element:p},j=j===void 0?null:j,j!==null&&(v.callback=j),p=Rl(u,v,d),p!==null&&(Us(p,u,d),yf(p,u,d))}function xC(u,d){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var p=u.retryLane;u.retryLane=p!==0&&p<d?p:d}}function I2(u,d){xC(u,d),(u=u.alternate)&&xC(u,d)}function vC(u){if(u.tag===13||u.tag===31){var d=$c(u,67108864);d!==null&&Us(d,u,67108864),I2(u,67108864)}}function yC(u){if(u.tag===13||u.tag===31){var d=yi();d=da(d);var p=$c(u,d);p!==null&&Us(p,u,d),I2(u,d)}}var Ag=!0;function LX(u,d,p,v){var O=P.T;P.T=null;var j=W.p;try{W.p=2,B2(u,d,p,v)}finally{W.p=j,P.T=O}}function IX(u,d,p,v){var O=P.T;P.T=null;var j=W.p;try{W.p=8,B2(u,d,p,v)}finally{W.p=j,P.T=O}}function B2(u,d,p,v){if(Ag){var O=q2(v);if(O===null)j2(u,d,v,Rg,p),wC(u,v);else if(qX(O,u,d,p,v))v.stopPropagation();else if(wC(u,v),d&4&&-1<BX.indexOf(u)){for(;O!==null;){var j=vo(O);if(j!==null)switch(j.tag){case 3:if(j=j.stateNode,j.current.memoizedState.isDehydrated){var B=lt(j.pendingLanes);if(B!==0){var K=j;for(K.pendingLanes|=2,K.entangledLanes|=2;B;){var ue=1<<31-dt(B);K.entanglements[1]|=ue,B&=~ue}La(j),(Cn&6)===0&&(pg=Rt()+500,zf(0))}}break;case 31:case 13:K=$c(j,2),K!==null&&Us(K,j,2),xg(),I2(j,2)}if(j=q2(v),j===null&&j2(u,d,v,Rg,p),j===O)break;O=j}O!==null&&v.stopPropagation()}else j2(u,d,v,null,p)}}function q2(u){return u=$y(u),F2(u)}var Rg=null;function F2(u){if(Rg=null,u=Ol(u),u!==null){var d=i(u);if(d===null)u=null;else{var p=d.tag;if(p===13){if(u=a(d),u!==null)return u;u=null}else if(p===31){if(u=l(d),u!==null)return u;u=null}else if(p===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;u=null}else d!==u&&(u=null)}}return Rg=u,null}function bC(u){switch(u){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(xt()){case Te:return 2;case Re:return 8;case qe:case rt:return 32;case wt:return 268435456;default:return 32}default:return 32}}var $2=!1,Hl=null,Vl=null,Ul=null,$f=new Map,Qf=new Map,Wl=[],BX="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function wC(u,d){switch(u){case"focusin":case"focusout":Hl=null;break;case"dragenter":case"dragleave":Vl=null;break;case"mouseover":case"mouseout":Ul=null;break;case"pointerover":case"pointerout":$f.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qf.delete(d.pointerId)}}function Hf(u,d,p,v,O,j){return u===null||u.nativeEvent!==j?(u={blockedOn:d,domEventName:p,eventSystemFlags:v,nativeEvent:j,targetContainers:[O]},d!==null&&(d=vo(d),d!==null&&vC(d)),u):(u.eventSystemFlags|=v,d=u.targetContainers,O!==null&&d.indexOf(O)===-1&&d.push(O),u)}function qX(u,d,p,v,O){switch(d){case"focusin":return Hl=Hf(Hl,u,d,p,v,O),!0;case"dragenter":return Vl=Hf(Vl,u,d,p,v,O),!0;case"mouseover":return Ul=Hf(Ul,u,d,p,v,O),!0;case"pointerover":var j=O.pointerId;return $f.set(j,Hf($f.get(j)||null,u,d,p,v,O)),!0;case"gotpointercapture":return j=O.pointerId,Qf.set(j,Hf(Qf.get(j)||null,u,d,p,v,O)),!0}return!1}function SC(u){var d=Ol(u.target);if(d!==null){var p=i(d);if(p!==null){if(d=p.tag,d===13){if(d=a(p),d!==null){u.blockedOn=d,Ra(u.priority,function(){yC(p)});return}}else if(d===31){if(d=l(p),d!==null){u.blockedOn=d,Ra(u.priority,function(){yC(p)});return}}else if(d===3&&p.stateNode.current.memoizedState.isDehydrated){u.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}u.blockedOn=null}function Dg(u){if(u.blockedOn!==null)return!1;for(var d=u.targetContainers;0<d.length;){var p=q2(u.nativeEvent);if(p===null){p=u.nativeEvent;var v=new p.constructor(p.type,p);Fy=v,p.target.dispatchEvent(v),Fy=null}else return d=vo(p),d!==null&&vC(d),u.blockedOn=p,!1;d.shift()}return!0}function kC(u,d,p){Dg(u)&&p.delete(d)}function FX(){$2=!1,Hl!==null&&Dg(Hl)&&(Hl=null),Vl!==null&&Dg(Vl)&&(Vl=null),Ul!==null&&Dg(Ul)&&(Ul=null),$f.forEach(kC),Qf.forEach(kC)}function zg(u,d){u.blockedOn===d&&(u.blockedOn=null,$2||($2=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,FX)))}var Pg=null;function OC(u){Pg!==u&&(Pg=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Pg===u&&(Pg=null);for(var d=0;d<u.length;d+=3){var p=u[d],v=u[d+1],O=u[d+2];if(typeof v!="function"){if(F2(v||p)===null)continue;break}var j=vo(p);j!==null&&(u.splice(d,3),d-=3,qb(j,{pending:!0,data:O,method:p.method,action:v},v,O))}}))}function kd(u){function d(ue){return zg(ue,u)}Hl!==null&&zg(Hl,u),Vl!==null&&zg(Vl,u),Ul!==null&&zg(Ul,u),$f.forEach(d),Qf.forEach(d);for(var p=0;p<Wl.length;p++){var v=Wl[p];v.blockedOn===u&&(v.blockedOn=null)}for(;0<Wl.length&&(p=Wl[0],p.blockedOn===null);)SC(p),p.blockedOn===null&&Wl.shift();if(p=(u.ownerDocument||u).$$reactFormReplay,p!=null)for(v=0;v<p.length;v+=3){var O=p[v],j=p[v+1],B=O[ss]||null;if(typeof j=="function")B||OC(p);else if(B){var K=null;if(j&&j.hasAttribute("formAction")){if(O=j,B=j[ss]||null)K=B.formAction;else if(F2(O)!==null)continue}else K=B.action;typeof K=="function"?p[v+1]=K:(p.splice(v,3),v-=3),OC(p)}}}function jC(){function u(j){j.canIntercept&&j.info==="react-transition"&&j.intercept({handler:function(){return new Promise(function(B){return O=B})},focusReset:"manual",scroll:"manual"})}function d(){O!==null&&(O(),O=null),v||setTimeout(p,20)}function p(){if(!v&&!navigation.transition){var j=navigation.currentEntry;j&&j.url!=null&&navigation.navigate(j.url,{state:j.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var v=!1,O=null;return navigation.addEventListener("navigate",u),navigation.addEventListener("navigatesuccess",d),navigation.addEventListener("navigateerror",d),setTimeout(p,100),function(){v=!0,navigation.removeEventListener("navigate",u),navigation.removeEventListener("navigatesuccess",d),navigation.removeEventListener("navigateerror",d),O!==null&&(O(),O=null)}}}function Q2(u){this._internalRoot=u}Lg.prototype.render=Q2.prototype.render=function(u){var d=this._internalRoot;if(d===null)throw Error(r(409));var p=d.current,v=yi();gC(p,v,u,d,null,null)},Lg.prototype.unmount=Q2.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var d=u.containerInfo;gC(u.current,2,null,u,null,null),xg(),d[kl]=null}};function Lg(u){this._internalRoot=u}Lg.prototype.unstable_scheduleHydration=function(u){if(u){var d=hi();u={blockedOn:null,target:u,priority:d};for(var p=0;p<Wl.length&&d!==0&&d<Wl[p].priority;p++);Wl.splice(p,0,u),p===0&&SC(u)}};var NC=e.version;if(NC!=="19.2.0")throw Error(r(527,NC,"19.2.0"));W.findDOMNode=function(u){var d=u._reactInternals;if(d===void 0)throw typeof u.render=="function"?Error(r(188)):(u=Object.keys(u).join(","),Error(r(268,u)));return u=h(d),u=u!==null?f(u):null,u=u===null?null:u.stateNode,u};var $X={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ig=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ig.isDisabled&&Ig.supportsFiber)try{ie=Ig.inject($X),xe=Ig}catch{}}return Uf.createRoot=function(u,d){if(!s(u))throw Error(r(299));var p=!1,v="",O=RN,j=DN,B=zN;return d!=null&&(d.unstable_strictMode===!0&&(p=!0),d.identifierPrefix!==void 0&&(v=d.identifierPrefix),d.onUncaughtError!==void 0&&(O=d.onUncaughtError),d.onCaughtError!==void 0&&(j=d.onCaughtError),d.onRecoverableError!==void 0&&(B=d.onRecoverableError)),d=mC(u,1,!1,null,null,p,v,null,O,j,B,jC),u[kl]=d.current,O2(u),new Q2(d)},Uf.hydrateRoot=function(u,d,p){if(!s(u))throw Error(r(299));var v=!1,O="",j=RN,B=DN,K=zN,ue=null;return p!=null&&(p.unstable_strictMode===!0&&(v=!0),p.identifierPrefix!==void 0&&(O=p.identifierPrefix),p.onUncaughtError!==void 0&&(j=p.onUncaughtError),p.onCaughtError!==void 0&&(B=p.onCaughtError),p.onRecoverableError!==void 0&&(K=p.onRecoverableError),p.formState!==void 0&&(ue=p.formState)),d=mC(u,1,!0,d,p??null,v,O,ue,j,B,K,jC),d.context=pC(null),p=d.current,v=yi(),v=da(v),O=Al(v),O.callback=null,Rl(p,O,v),p=v,d.current.lanes=p,Is(d,p),La(d),u[kl]=d.current,O2(u),new Lg(d)},Uf.version="19.2.0",Uf}var IC;function $K(){if(IC)return U2.exports;IC=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),U2.exports=FK(),U2.exports}var QK=$K();function tz(t,e){return function(){return t.apply(e,arguments)}}const{toString:HK}=Object.prototype,{getPrototypeOf:Kk}=Object,{iterator:Ev,toStringTag:nz}=Symbol,_v=(t=>e=>{const n=HK.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ea=t=>(t=t.toLowerCase(),e=>_v(e)===t),Mv=t=>e=>typeof e===t,{isArray:Rh}=Array,mh=Mv("undefined");function R0(t){return t!==null&&!mh(t)&&t.constructor!==null&&!mh(t.constructor)&&ei(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const rz=Ea("ArrayBuffer");function VK(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&rz(t.buffer),e}const UK=Mv("string"),ei=Mv("function"),sz=Mv("number"),D0=t=>t!==null&&typeof t=="object",WK=t=>t===!0||t===!1,Ux=t=>{if(_v(t)!=="object")return!1;const e=Kk(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(nz in t)&&!(Ev in t)},GK=t=>{if(!D0(t)||R0(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},XK=Ea("Date"),YK=Ea("File"),KK=Ea("Blob"),ZK=Ea("FileList"),JK=t=>D0(t)&&ei(t.pipe),eZ=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||ei(t.append)&&((e=_v(t))==="formdata"||e==="object"&&ei(t.toString)&&t.toString()==="[object FormData]"))},tZ=Ea("URLSearchParams"),[nZ,rZ,sZ,iZ]=["ReadableStream","Request","Response","Headers"].map(Ea),aZ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function z0(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Rh(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{if(R0(t))return;const i=n?Object.getOwnPropertyNames(t):Object.keys(t),a=i.length;let l;for(r=0;r<a;r++)l=i[r],e.call(null,t[l],l,t)}}function iz(t,e){if(R0(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const hu=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,az=t=>!mh(t)&&t!==hu;function T3(){const{caseless:t,skipUndefined:e}=az(this)&&this||{},n={},r=(s,i)=>{const a=t&&iz(n,i)||i;Ux(n[a])&&Ux(s)?n[a]=T3(n[a],s):Ux(s)?n[a]=T3({},s):Rh(s)?n[a]=s.slice():(!e||!mh(s))&&(n[a]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&z0(arguments[s],r);return n}const oZ=(t,e,n,{allOwnKeys:r}={})=>(z0(e,(s,i)=>{n&&ei(s)?t[i]=tz(s,n):t[i]=s},{allOwnKeys:r}),t),lZ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),cZ=(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)},uZ=(t,e,n,r)=>{let s,i,a;const l={};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))&&!l[a]&&(e[a]=t[a],l[a]=!0);t=n!==!1&&Kk(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},dZ=(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},hZ=t=>{if(!t)return null;if(Rh(t))return t;let e=t.length;if(!sz(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},fZ=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Kk(Uint8Array)),mZ=(t,e)=>{const r=(t&&t[Ev]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},pZ=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},gZ=Ea("HTMLFormElement"),xZ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),BC=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),vZ=Ea("RegExp"),oz=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};z0(n,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(r[i]=a||s)}),Object.defineProperties(t,r)},yZ=t=>{oz(t,(e,n)=>{if(ei(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(ei(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+"'")})}})},bZ=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Rh(t)?r(t):r(String(t).split(e)),n},wZ=()=>{},SZ=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function kZ(t){return!!(t&&ei(t.append)&&t[nz]==="FormData"&&t[Ev])}const OZ=t=>{const e=new Array(10),n=(r,s)=>{if(D0(r)){if(e.indexOf(r)>=0)return;if(R0(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Rh(r)?[]:{};return z0(r,(a,l)=>{const c=n(a,s+1);!mh(c)&&(i[l]=c)}),e[s]=void 0,i}}return r};return n(t,0)},jZ=Ea("AsyncFunction"),NZ=t=>t&&(D0(t)||ei(t))&&ei(t.then)&&ei(t.catch),lz=((t,e)=>t?setImmediate:e?((n,r)=>(hu.addEventListener("message",({source:s,data:i})=>{s===hu&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),hu.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ei(hu.postMessage)),CZ=typeof queueMicrotask<"u"?queueMicrotask.bind(hu):typeof process<"u"&&process.nextTick||lz,TZ=t=>t!=null&&ei(t[Ev]),Oe={isArray:Rh,isArrayBuffer:rz,isBuffer:R0,isFormData:eZ,isArrayBufferView:VK,isString:UK,isNumber:sz,isBoolean:WK,isObject:D0,isPlainObject:Ux,isEmptyObject:GK,isReadableStream:nZ,isRequest:rZ,isResponse:sZ,isHeaders:iZ,isUndefined:mh,isDate:XK,isFile:YK,isBlob:KK,isRegExp:vZ,isFunction:ei,isStream:JK,isURLSearchParams:tZ,isTypedArray:fZ,isFileList:ZK,forEach:z0,merge:T3,extend:oZ,trim:aZ,stripBOM:lZ,inherits:cZ,toFlatObject:uZ,kindOf:_v,kindOfTest:Ea,endsWith:dZ,toArray:hZ,forEachEntry:mZ,matchAll:pZ,isHTMLForm:gZ,hasOwnProperty:BC,hasOwnProp:BC,reduceDescriptors:oz,freezeMethods:yZ,toObjectSet:bZ,toCamelCase:xZ,noop:wZ,toFiniteNumber:SZ,findKey:iz,global:hu,isContextDefined:az,isSpecCompliantForm:kZ,toJSONObject:OZ,isAsyncFn:jZ,isThenable:NZ,setImmediate:lz,asap:CZ,isIterable:TZ};function It(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)}Oe.inherits(It,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:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const cz=It.prototype,uz={};["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=>{uz[t]={value:t}});Object.defineProperties(It,uz);Object.defineProperty(cz,"isAxiosError",{value:!0});It.from=(t,e,n,r,s,i)=>{const a=Object.create(cz);Oe.toFlatObject(t,a,function(f){return f!==Error.prototype},h=>h!=="isAxiosError");const l=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return It.call(a,l,c,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 EZ=null;function E3(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function dz(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function qC(t,e,n){return t?t.concat(e).map(function(s,i){return s=dz(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function _Z(t){return Oe.isArray(t)&&!t.some(E3)}const MZ=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function Av(t,e,n){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=Oe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,S){return!Oe.isUndefined(S[w])});const r=n.metaTokens,s=n.visitor||f,i=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(s))throw new TypeError("visitor must be a function");function h(y){if(y===null)return"";if(Oe.isDate(y))return y.toISOString();if(Oe.isBoolean(y))return y.toString();if(!c&&Oe.isBlob(y))throw new It("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(y)||Oe.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function f(y,w,S){let k=y;if(y&&!S&&typeof y=="object"){if(Oe.endsWith(w,"{}"))w=r?w:w.slice(0,-2),y=JSON.stringify(y);else if(Oe.isArray(y)&&_Z(y)||(Oe.isFileList(y)||Oe.endsWith(w,"[]"))&&(k=Oe.toArray(y)))return w=dz(w),k.forEach(function(C,T){!(Oe.isUndefined(C)||C===null)&&e.append(a===!0?qC([w],T,i):a===null?w:w+"[]",h(C))}),!1}return E3(y)?!0:(e.append(qC(S,w,i),h(y)),!1)}const m=[],g=Object.assign(MZ,{defaultVisitor:f,convertValue:h,isVisitable:E3});function x(y,w){if(!Oe.isUndefined(y)){if(m.indexOf(y)!==-1)throw Error("Circular reference detected in "+w.join("."));m.push(y),Oe.forEach(y,function(k,N){(!(Oe.isUndefined(k)||k===null)&&s.call(e,k,Oe.isString(N)?N.trim():N,w,g))===!0&&x(k,w?w.concat(N):[N])}),m.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return x(t),e}function FC(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Zk(t,e){this._pairs=[],t&&Av(t,this,e)}const hz=Zk.prototype;hz.append=function(e,n){this._pairs.push([e,n])};hz.toString=function(e){const n=e?function(r){return e.call(this,r,FC)}:FC;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function AZ(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function fz(t,e,n){if(!e)return t;const r=n&&n.encode||AZ;Oe.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=Oe.isURLSearchParams(e)?e.toString():new Zk(e,n).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class $C{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){Oe.forEach(this.handlers,function(r){r!==null&&e(r)})}}const mz={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},RZ=typeof URLSearchParams<"u"?URLSearchParams:Zk,DZ=typeof FormData<"u"?FormData:null,zZ=typeof Blob<"u"?Blob:null,PZ={isBrowser:!0,classes:{URLSearchParams:RZ,FormData:DZ,Blob:zZ},protocols:["http","https","file","blob","url","data"]},Jk=typeof window<"u"&&typeof document<"u",_3=typeof navigator=="object"&&navigator||void 0,LZ=Jk&&(!_3||["ReactNative","NativeScript","NS"].indexOf(_3.product)<0),IZ=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",BZ=Jk&&window.location.href||"http://localhost",qZ=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Jk,hasStandardBrowserEnv:LZ,hasStandardBrowserWebWorkerEnv:IZ,navigator:_3,origin:BZ},Symbol.toStringTag,{value:"Module"})),bs={...qZ,...PZ};function FZ(t,e){return Av(t,new bs.classes.URLSearchParams,{visitor:function(n,r,s,i){return bs.isNode&&Oe.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function $Z(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function QZ(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],e[i]=t[i];return e}function pz(t){function e(n,r,s,i){let a=n[i++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),c=i>=n.length;return a=!a&&Oe.isArray(s)?s.length:a,c?(Oe.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!l):((!s[a]||!Oe.isObject(s[a]))&&(s[a]=[]),e(n,r,s[a],i)&&Oe.isArray(s[a])&&(s[a]=QZ(s[a])),!l)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const n={};return Oe.forEachEntry(t,(r,s)=>{e($Z(r),s,n,0)}),n}return null}function HZ(t,e,n){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const P0={transitional:mz,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=Oe.isObject(e);if(i&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return s?JSON.stringify(pz(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return FZ(e,this.formSerializer).toString();if((l=Oe.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Av(l?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),HZ(e)):e}],transformResponse:[function(e){const n=this.transitional||P0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?It.from(l,It.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:bs.classes.FormData,Blob:bs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{P0.headers[t]={}});const VZ=Oe.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"]),UZ=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]&&VZ[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},QC=Symbol("internals");function Wf(t){return t&&String(t).trim().toLowerCase()}function Wx(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(Wx):String(t)}function WZ(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 GZ=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function X2(t,e,n,r,s){if(Oe.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!Oe.isString(e)){if(Oe.isString(r))return e.indexOf(r)!==-1;if(Oe.isRegExp(r))return r.test(e)}}function XZ(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function YZ(t,e){const n=Oe.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 ti=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(l,c,h){const f=Wf(c);if(!f)throw new Error("header name must be a non-empty string");const m=Oe.findKey(s,f);(!m||s[m]===void 0||h===!0||h===void 0&&s[m]!==!1)&&(s[m||c]=Wx(l))}const a=(l,c)=>Oe.forEach(l,(h,f)=>i(h,f,c));if(Oe.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(Oe.isString(e)&&(e=e.trim())&&!GZ(e))a(UZ(e),n);else if(Oe.isObject(e)&&Oe.isIterable(e)){let l={},c,h;for(const f of e){if(!Oe.isArray(f))throw TypeError("Object iterator must return a key-value pair");l[h=f[0]]=(c=l[h])?Oe.isArray(c)?[...c,f[1]]:[c,f[1]]:f[1]}a(l,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Wf(e),e){const r=Oe.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return WZ(s);if(Oe.isFunction(n))return n.call(this,s,r);if(Oe.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Wf(e),e){const r=Oe.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||X2(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(a){if(a=Wf(a),a){const l=Oe.findKey(r,a);l&&(!n||X2(r,r[l],l,n))&&(delete r[l],s=!0)}}return Oe.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||X2(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return Oe.forEach(this,(s,i)=>{const a=Oe.findKey(r,i);if(a){n[a]=Wx(s),delete n[i];return}const l=e?XZ(i):String(i).trim();l!==i&&delete n[i],n[l]=Wx(s),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return Oe.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&Oe.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[QC]=this[QC]={accessors:{}}).accessors,s=this.prototype;function i(a){const l=Wf(a);r[l]||(YZ(s,a),r[l]=!0)}return Oe.isArray(e)?e.forEach(i):i(e),this}};ti.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Oe.reduceDescriptors(ti.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});Oe.freezeMethods(ti);function Y2(t,e){const n=this||P0,r=e||n,s=ti.from(r.headers);let i=r.data;return Oe.forEach(t,function(l){i=l.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function gz(t){return!!(t&&t.__CANCEL__)}function Dh(t,e,n){It.call(this,t??"canceled",It.ERR_CANCELED,e,n),this.name="CanceledError"}Oe.inherits(Dh,It,{__CANCEL__:!0});function xz(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new It("Request failed with status code "+n.status,[It.ERR_BAD_REQUEST,It.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function KZ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function ZZ(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(c){const h=Date.now(),f=r[i];a||(a=h),n[s]=c,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<e)return;const x=f&&h-f;return x?Math.round(g*1e3/x):void 0}}function JZ(t,e){let n=0,r=1e3/e,s,i;const a=(h,f=Date.now())=>{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 k1=(t,e,n=3)=>{let r=0;const s=ZZ(50,250);return JZ(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,c=a-r,h=s(c),f=a<=l;r=a;const m={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:h||void 0,estimated:h&&l&&f?(l-a)/h:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(m)},n)},HC=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},VC=t=>(...e)=>Oe.asap(()=>t(...e)),eJ=bs.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,bs.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(bs.origin),bs.navigator&&/(msie|trident)/i.test(bs.navigator.userAgent)):()=>!0,tJ=bs.hasStandardBrowserEnv?{write(t,e,n,r,s,i,a){if(typeof document>"u")return;const l=[`${t}=${encodeURIComponent(e)}`];Oe.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),Oe.isString(r)&&l.push(`path=${r}`),Oe.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),Oe.isString(a)&&l.push(`SameSite=${a}`),document.cookie=l.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 nJ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function rJ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function vz(t,e,n){let r=!nJ(e);return t&&(r||n==!1)?rJ(t,e):e}const UC=t=>t instanceof ti?{...t}:t;function ju(t,e){e=e||{};const n={};function r(h,f,m,g){return Oe.isPlainObject(h)&&Oe.isPlainObject(f)?Oe.merge.call({caseless:g},h,f):Oe.isPlainObject(f)?Oe.merge({},f):Oe.isArray(f)?f.slice():f}function s(h,f,m,g){if(Oe.isUndefined(f)){if(!Oe.isUndefined(h))return r(void 0,h,m,g)}else return r(h,f,m,g)}function i(h,f){if(!Oe.isUndefined(f))return r(void 0,f)}function a(h,f){if(Oe.isUndefined(f)){if(!Oe.isUndefined(h))return r(void 0,h)}else return r(void 0,f)}function l(h,f,m){if(m in e)return r(h,f);if(m in t)return r(void 0,h)}const c={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:l,headers:(h,f,m)=>s(UC(h),UC(f),m,!0)};return Oe.forEach(Object.keys({...t,...e}),function(f){const m=c[f]||s,g=m(t[f],e[f],f);Oe.isUndefined(g)&&m!==l||(n[f]=g)}),n}const yz=t=>{const e=ju({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:l}=e;if(e.headers=a=ti.from(a),e.url=fz(vz(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),Oe.isFormData(n)){if(bs.hasStandardBrowserEnv||bs.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(Oe.isFunction(n.getHeaders)){const c=n.getHeaders(),h=["content-type","content-length"];Object.entries(c).forEach(([f,m])=>{h.includes(f.toLowerCase())&&a.set(f,m)})}}if(bs.hasStandardBrowserEnv&&(r&&Oe.isFunction(r)&&(r=r(e)),r||r!==!1&&eJ(e.url))){const c=s&&i&&tJ.read(i);c&&a.set(s,c)}return e},sJ=typeof XMLHttpRequest<"u",iJ=sJ&&function(t){return new Promise(function(n,r){const s=yz(t);let i=s.data;const a=ti.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,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 S=new XMLHttpRequest;S.open(s.method.toUpperCase(),s.url,!0),S.timeout=s.timeout;function k(){if(!S)return;const C=ti.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),_={data:!l||l==="text"||l==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:C,config:t,request:S};xz(function(M){n(M),w()},function(M){r(M),w()},_),S=null}"onloadend"in S?S.onloadend=k:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(k)},S.onabort=function(){S&&(r(new It("Request aborted",It.ECONNABORTED,t,S)),S=null)},S.onerror=function(T){const _=T&&T.message?T.message:"Network Error",E=new It(_,It.ERR_NETWORK,t,S);E.event=T||null,r(E),S=null},S.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const _=s.transitional||mz;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new It(T,_.clarifyTimeoutError?It.ETIMEDOUT:It.ECONNABORTED,t,S)),S=null},i===void 0&&a.setContentType(null),"setRequestHeader"in S&&Oe.forEach(a.toJSON(),function(T,_){S.setRequestHeader(_,T)}),Oe.isUndefined(s.withCredentials)||(S.withCredentials=!!s.withCredentials),l&&l!=="json"&&(S.responseType=s.responseType),h&&([g,y]=k1(h,!0),S.addEventListener("progress",g)),c&&S.upload&&([m,x]=k1(c),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",x)),(s.cancelToken||s.signal)&&(f=C=>{S&&(r(!C||C.type?new Dh(null,t,S):C),S.abort(),S=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const N=KZ(s.url);if(N&&bs.protocols.indexOf(N)===-1){r(new It("Unsupported protocol "+N+":",It.ERR_BAD_REQUEST,t));return}S.send(i||null)})},aJ=(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,l();const f=h instanceof Error?h:this.reason;r.abort(f instanceof It?f:new Dh(f instanceof Error?f.message:f))}};let a=e&&setTimeout(()=>{a=null,i(new It(`timeout ${e} of ms exceeded`,It.ETIMEDOUT))},e);const l=()=>{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:c}=r;return c.unsubscribe=()=>Oe.asap(l),c}},oJ=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},lJ=async function*(t,e){for await(const n of cJ(t))yield*oJ(n,e)},cJ=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},WC=(t,e,n,r)=>{const s=lJ(t,e);let i=0,a,l=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:h,value:f}=await s.next();if(h){l(),c.close();return}let m=f.byteLength;if(n){let g=i+=m;n(g)}c.enqueue(new Uint8Array(f))}catch(h){throw l(h),h}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},GC=64*1024,{isFunction:$g}=Oe,uJ=(({Request:t,Response:e})=>({Request:t,Response:e}))(Oe.global),{ReadableStream:XC,TextEncoder:YC}=Oe.global,KC=(t,...e)=>{try{return!!t(...e)}catch{return!1}},dJ=t=>{t=Oe.merge.call({skipUndefined:!0},uJ,t);const{fetch:e,Request:n,Response:r}=t,s=e?$g(e):typeof fetch=="function",i=$g(n),a=$g(r);if(!s)return!1;const l=s&&$g(XC),c=s&&(typeof YC=="function"?(y=>w=>y.encode(w))(new YC):async y=>new Uint8Array(await new n(y).arrayBuffer())),h=i&&l&&KC(()=>{let y=!1;const w=new n(bs.origin,{body:new XC,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!w}),f=a&&l&&KC(()=>Oe.isReadableStream(new r("").body)),m={stream:f&&(y=>y.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!m[y]&&(m[y]=(w,S)=>{let k=w&&w[y];if(k)return k.call(w);throw new It(`Response type '${y}' is not supported`,It.ERR_NOT_SUPPORT,S)})});const g=async y=>{if(y==null)return 0;if(Oe.isBlob(y))return y.size;if(Oe.isSpecCompliantForm(y))return(await new n(bs.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(y)||Oe.isArrayBuffer(y))return y.byteLength;if(Oe.isURLSearchParams(y)&&(y=y+""),Oe.isString(y))return(await c(y)).byteLength},x=async(y,w)=>{const S=Oe.toFiniteNumber(y.getContentLength());return S??g(w)};return async y=>{let{url:w,method:S,data:k,signal:N,cancelToken:C,timeout:T,onDownloadProgress:_,onUploadProgress:E,responseType:M,headers:q,withCredentials:L="same-origin",fetchOptions:I}=yz(y),$=e||fetch;M=M?(M+"").toLowerCase():"text";let V=aJ([N,C&&C.toAbortSignal()],T),ee=null;const z=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let H;try{if(E&&h&&S!=="get"&&S!=="head"&&(H=await x(q,k))!==0){let se=new n(w,{method:"POST",body:k,duplex:"half"}),G;if(Oe.isFormData(k)&&(G=se.headers.get("content-type"))&&q.setContentType(G),se.body){const[F,U]=HC(H,k1(VC(E)));k=WC(se.body,GC,F,U)}}Oe.isString(L)||(L=L?"include":"omit");const P=i&&"credentials"in n.prototype,W={...I,signal:V,method:S.toUpperCase(),headers:q.normalize().toJSON(),body:k,duplex:"half",credentials:P?L:void 0};ee=i&&new n(w,W);let J=await(i?$(ee,I):$(w,W));const X=f&&(M==="stream"||M==="response");if(f&&(_||X&&z)){const se={};["status","statusText","headers"].forEach(te=>{se[te]=J[te]});const G=Oe.toFiniteNumber(J.headers.get("content-length")),[F,U]=_&&HC(G,k1(VC(_),!0))||[];J=new r(WC(J.body,GC,F,()=>{U&&U(),z&&z()}),se)}M=M||"text";let R=await m[Oe.findKey(m,M)||"text"](J,y);return!X&&z&&z(),await new Promise((se,G)=>{xz(se,G,{data:R,headers:ti.from(J.headers),status:J.status,statusText:J.statusText,config:y,request:ee})})}catch(P){throw z&&z(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new It("Network Error",It.ERR_NETWORK,y,ee),{cause:P.cause||P}):It.from(P,P&&P.code,y,ee)}}},hJ=new Map,bz=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let a=i.length,l=a,c,h,f=hJ;for(;l--;)c=i[l],h=f.get(c),h===void 0&&f.set(c,h=l?new Map:dJ(e)),f=h;return h};bz();const e6={http:EZ,xhr:iJ,fetch:{get:bz}};Oe.forEach(e6,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const ZC=t=>`- ${t}`,fJ=t=>Oe.isFunction(t)||t===null||t===!1;function mJ(t,e){t=Oe.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let a=0;a<n;a++){r=t[a];let l;if(s=r,!fJ(r)&&(s=e6[(l=String(r)).toLowerCase()],s===void 0))throw new It(`Unknown adapter '${l}'`);if(s&&(Oe.isFunction(s)||(s=s.get(e))))break;i[l||"#"+a]=s}if(!s){const a=Object.entries(i).map(([c,h])=>`adapter ${c} `+(h===!1?"is not supported by the environment":"is not available in the build"));let l=n?a.length>1?`since :
`+a.map(ZC).join(`
`):" "+ZC(a[0]):"as no adapter specified";throw new It("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const wz={getAdapter:mJ,adapters:e6};function K2(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Dh(null,t)}function JC(t){return K2(t),t.headers=ti.from(t.headers),t.data=Y2.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),wz.getAdapter(t.adapter||P0.adapter,t)(t).then(function(r){return K2(t),r.data=Y2.call(t,t.transformResponse,r),r.headers=ti.from(r.headers),r},function(r){return gz(r)||(K2(t),r&&r.response&&(r.response.data=Y2.call(t,t.transformResponse,r.response),r.response.headers=ti.from(r.response.headers))),Promise.reject(r)})}const Sz="1.13.2",Rv={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Rv[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const e9={};Rv.transitional=function(e,n,r){function s(i,a){return"[Axios v"+Sz+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(e===!1)throw new It(s(a," has been removed"+(n?" in "+n:"")),It.ERR_DEPRECATED);return n&&!e9[a]&&(e9[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,a,l):!0}};Rv.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function pJ(t,e,n){if(typeof t!="object")throw new It("options must be an object",It.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 l=t[i],c=l===void 0||a(l,i,t);if(c!==!0)throw new It("option "+i+" must be "+c,It.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new It("Unknown option "+i,It.ERR_BAD_OPTION)}}const Gx={assertOptions:pJ,validators:Rv},Ia=Gx.validators;let bu=class{constructor(e){this.defaults=e||{},this.interceptors={request:new $C,response:new $C}}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=ju(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Gx.assertOptions(r,{silentJSONParsing:Ia.transitional(Ia.boolean),forcedJSONParsing:Ia.transitional(Ia.boolean),clarifyTimeoutError:Ia.transitional(Ia.boolean)},!1),s!=null&&(Oe.isFunction(s)?n.paramsSerializer={serialize:s}:Gx.assertOptions(s,{encode:Ia.function,serialize:Ia.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Gx.assertOptions(n,{baseUrl:Ia.spelling("baseURL"),withXsrfToken:Ia.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&Oe.merge(i.common,i[n.method]);i&&Oe.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=ti.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(c=c&&w.synchronous,l.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(!c){const y=[JC.bind(this),void 0];for(y.unshift(...l),y.push(...h),g=y.length,f=Promise.resolve(n);m<g;)f=f.then(y[m++],y[m++]);return f}g=l.length;let x=n;for(;m<g;){const y=l[m++],w=l[m++];try{x=y(x)}catch(S){w.call(this,S);break}}try{f=JC.call(this,x)}catch(y){return Promise.reject(y)}for(m=0,g=h.length;m<g;)f=f.then(h[m++],h[m++]);return f}getUri(e){e=ju(this.defaults,e);const n=vz(e.baseURL,e.url,e.allowAbsoluteUrls);return fz(n,e.params,e.paramsSerializer)}};Oe.forEach(["delete","get","head","options"],function(e){bu.prototype[e]=function(n,r){return this.request(ju(r||{},{method:e,url:n,data:(r||{}).data}))}});Oe.forEach(["post","put","patch"],function(e){function n(r){return function(i,a,l){return this.request(ju(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}bu.prototype[e]=n(),bu.prototype[e+"Form"]=n(!0)});let gJ=class kz{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{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(l=>{r.subscribe(l),i=l}).then(s);return a.cancel=function(){r.unsubscribe(i)},a},e(function(i,a,l){r.reason||(r.reason=new Dh(i,a,l),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 kz(function(s){e=s}),cancel:e}}};function xJ(t){return function(n){return t.apply(null,n)}}function vJ(t){return Oe.isObject(t)&&t.isAxiosError===!0}const M3={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(M3).forEach(([t,e])=>{M3[e]=t});function Oz(t){const e=new bu(t),n=tz(bu.prototype.request,e);return Oe.extend(n,bu.prototype,e,{allOwnKeys:!0}),Oe.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return Oz(ju(t,s))},n}const gr=Oz(P0);gr.Axios=bu;gr.CanceledError=Dh;gr.CancelToken=gJ;gr.isCancel=gz;gr.VERSION=Sz;gr.toFormData=Av;gr.AxiosError=It;gr.Cancel=gr.CanceledError;gr.all=function(e){return Promise.all(e)};gr.spread=xJ;gr.isAxiosError=vJ;gr.mergeConfig=ju;gr.AxiosHeaders=ti;gr.formToJSON=t=>pz(Oe.isHTMLForm(t)?new FormData(t):t);gr.getAdapter=wz.getAdapter;gr.HttpStatusCode=M3;gr.default=gr;const{Axios:STe,AxiosError:kTe,CanceledError:OTe,isCancel:jTe,CancelToken:NTe,VERSION:CTe,all:TTe,Cancel:ETe,isAxiosError:_Te,spread:MTe,toFormData:ATe,AxiosHeaders:RTe,HttpStatusCode:DTe,formToJSON:zTe,getAdapter:PTe,mergeConfig:LTe}=gr,yJ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},bJ=(t,e)=>({classGroupId:t,validator:e}),jz=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),O1="-",t9=[],wJ="arbitrary..",SJ=t=>{const e=OJ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return kJ(a);const l=a.split(O1),c=l[0]===""&&l.length>1?1:0;return Nz(l,c,e)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=r[a],h=n[a];return c?h?yJ(h,c):c:h||t9}return n[a]||t9}}},Nz=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=Nz(t,e+1,i);if(h)return h}const a=n.validators;if(a===null)return;const l=e===0?t.join(O1):t.slice(e).join(O1),c=a.length;for(let h=0;h<c;h++){const f=a[h];if(f.validator(l))return f.classGroupId}},kJ=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?wJ+r:void 0})(),OJ=t=>{const{theme:e,classGroups:n}=t;return jJ(n,e)},jJ=(t,e)=>{const n=jz();for(const r in t){const s=t[r];t6(s,n,r,e)}return n},t6=(t,e,n,r)=>{const s=t.length;for(let i=0;i<s;i++){const a=t[i];NJ(a,e,n,r)}},NJ=(t,e,n,r)=>{if(typeof t=="string"){CJ(t,e,n);return}if(typeof t=="function"){TJ(t,e,n,r);return}EJ(t,e,n,r)},CJ=(t,e,n)=>{const r=t===""?e:Cz(e,t);r.classGroupId=n},TJ=(t,e,n,r)=>{if(_J(t)){t6(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(bJ(n,t))},EJ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let a=0;a<i;a++){const[l,c]=s[a];t6(c,Cz(e,l),n,r)}},Cz=(t,e)=>{let n=t;const r=e.split(O1),s=r.length;for(let i=0;i<s;i++){const a=r[i];let l=n.nextPart.get(a);l||(l=jz(),n.nextPart.set(a,l)),n=l}return n},_J=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,MJ=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)}}},A3="!",n9=":",AJ=[],r9=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),RJ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let a=0,l=0,c=0,h;const f=s.length;for(let w=0;w<f;w++){const S=s[w];if(a===0&&l===0){if(S===n9){i.push(s.slice(c,w)),c=w+1;continue}if(S==="/"){h=w;continue}}S==="["?a++:S==="]"?a--:S==="("?l++:S===")"&&l--}const m=i.length===0?s:s.slice(c);let g=m,x=!1;m.endsWith(A3)?(g=m.slice(0,-1),x=!0):m.startsWith(A3)&&(g=m.slice(1),x=!0);const y=h&&h>c?h-c:void 0;return r9(i,x,g,y)};if(e){const s=e+n9,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):r9(AJ,!1,a,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},DJ=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;i<n.length;i++){const a=n[i],l=a[0]==="[",c=e.has(a);l||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},zJ=t=>({cache:MJ(t.cacheSize),parseClassName:RJ(t),sortModifiers:DJ(t),...SJ(t)}),PJ=/\s+/,LJ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,a=[],l=t.trim().split(PJ);let c="";for(let h=l.length-1;h>=0;h-=1){const f=l[h],{isExternal:m,modifiers:g,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:w}=n(f);if(m){c=f+(c.length>0?" "+c:c);continue}let S=!!w,k=r(S?y.substring(0,w):y);if(!k){if(!S){c=f+(c.length>0?" "+c:c);continue}if(k=r(y),!k){c=f+(c.length>0?" "+c:c);continue}S=!1}const N=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=x?N+A3:N,T=C+k;if(a.indexOf(T)>-1)continue;a.push(T);const _=s(k,S);for(let E=0;E<_.length;++E){const M=_[E];a.push(C+M)}c=f+(c.length>0?" "+c:c)}return c},IJ=(...t)=>{let e=0,n,r,s="";for(;e<t.length;)(n=t[e++])&&(r=Tz(n))&&(s&&(s+=" "),s+=r);return s},Tz=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=Tz(t[r]))&&(n&&(n+=" "),n+=e);return n},BJ=(t,...e)=>{let n,r,s,i;const a=c=>{const h=e.reduce((f,m)=>m(f),t());return n=zJ(h),r=n.cache.get,s=n.cache.set,i=l,l(c)},l=c=>{const h=r(c);if(h)return h;const f=LJ(c,n);return s(c,f),f};return i=a,(...c)=>i(IJ(...c))},qJ=[],qr=t=>{const e=n=>n[t]||qJ;return e.isThemeGetter=!0,e},Ez=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,_z=/^\((?:(\w[\w-]*):)?(.+)\)$/i,FJ=/^\d+\/\d+$/,$J=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,QJ=/\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$/,HJ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,VJ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,UJ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Od=t=>FJ.test(t),$t=t=>!!t&&!Number.isNaN(Number(t)),Xl=t=>!!t&&Number.isInteger(Number(t)),Z2=t=>t.endsWith("%")&&$t(t.slice(0,-1)),Bo=t=>$J.test(t),WJ=()=>!0,GJ=t=>QJ.test(t)&&!HJ.test(t),Mz=()=>!1,XJ=t=>VJ.test(t),YJ=t=>UJ.test(t),KJ=t=>!it(t)&&!at(t),ZJ=t=>zh(t,Dz,Mz),it=t=>Ez.test(t),tu=t=>zh(t,zz,GJ),J2=t=>zh(t,ree,$t),s9=t=>zh(t,Az,Mz),JJ=t=>zh(t,Rz,YJ),Qg=t=>zh(t,Pz,XJ),at=t=>_z.test(t),Gf=t=>Ph(t,zz),eee=t=>Ph(t,see),i9=t=>Ph(t,Az),tee=t=>Ph(t,Dz),nee=t=>Ph(t,Rz),Hg=t=>Ph(t,Pz,!0),zh=(t,e,n)=>{const r=Ez.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Ph=(t,e,n=!1)=>{const r=_z.exec(t);return r?r[1]?e(r[1]):n:!1},Az=t=>t==="position"||t==="percentage",Rz=t=>t==="image"||t==="url",Dz=t=>t==="length"||t==="size"||t==="bg-size",zz=t=>t==="length",ree=t=>t==="number",see=t=>t==="family-name",Pz=t=>t==="shadow",iee=()=>{const t=qr("color"),e=qr("font"),n=qr("text"),r=qr("font-weight"),s=qr("tracking"),i=qr("leading"),a=qr("breakpoint"),l=qr("container"),c=qr("spacing"),h=qr("radius"),f=qr("shadow"),m=qr("inset-shadow"),g=qr("text-shadow"),x=qr("drop-shadow"),y=qr("blur"),w=qr("perspective"),S=qr("aspect"),k=qr("ease"),N=qr("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"],_=()=>[...T(),at,it],E=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],q=()=>[at,it,c],L=()=>[Od,"full","auto",...q()],I=()=>[Xl,"none","subgrid",at,it],$=()=>["auto",{span:["full",Xl,at,it]},Xl,at,it],V=()=>[Xl,"auto",at,it],ee=()=>["auto","min","max","fr",at,it],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...q()],W=()=>[Od,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],J=()=>[t,at,it],X=()=>[...T(),i9,s9,{position:[at,it]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",tee,ZJ,{size:[at,it]}],G=()=>[Z2,Gf,tu],F=()=>["","none","full",h,at,it],U=()=>["",$t,Gf,tu],te=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[$t,Z2,i9,s9],ae=()=>["","none",y,at,it],re=()=>["none",$t,at,it],oe=()=>["none",$t,at,it],_e=()=>[$t,at,it],Ge=()=>[Od,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Bo],breakpoint:[Bo],color:[WJ],container:[Bo],"drop-shadow":[Bo],ease:["in","out","in-out"],font:[KJ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Bo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Bo],shadow:[Bo],spacing:["px",$t],text:[Bo],"text-shadow":[Bo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Od,it,at,S]}],container:["container"],columns:[{columns:[$t,it,at,l]}],"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:_()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Xl,"auto",at,it]}],basis:[{basis:[Od,"full","auto",l,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[$t,Od,"auto","initial","none",it]}],grow:[{grow:["",$t,at,it]}],shrink:[{shrink:["",$t,at,it]}],order:[{order:[Xl,"first","last","none",at,it]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Gf,tu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,at,J2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Z2,it]}],"font-family":[{font:[eee,it,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,at,it]}],"line-clamp":[{"line-clamp":[$t,"none",at,J2]}],leading:[{leading:[i,...q()]}],"list-image":[{"list-image":["none",at,it]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",at,it]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[$t,"from-font","auto",at,tu]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[$t,"auto",at,it]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",at,it]}],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",at,it]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Xl,at,it],radial:["",at,it],conic:[Xl,at,it]},nee,JJ]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[$t,at,it]}],"outline-w":[{outline:["",$t,Gf,tu]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",f,Hg,Qg]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",m,Hg,Qg]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[$t,tu]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",g,Hg,Qg]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[$t,at,it]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[$t]}],"mask-image-linear-from-pos":[{"mask-linear-from":Y()}],"mask-image-linear-to-pos":[{"mask-linear-to":Y()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":Y()}],"mask-image-t-to-pos":[{"mask-t-to":Y()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":Y()}],"mask-image-r-to-pos":[{"mask-r-to":Y()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":Y()}],"mask-image-b-to-pos":[{"mask-b-to":Y()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":Y()}],"mask-image-l-to-pos":[{"mask-l-to":Y()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":Y()}],"mask-image-x-to-pos":[{"mask-x-to":Y()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":Y()}],"mask-image-y-to-pos":[{"mask-y-to":Y()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[at,it]}],"mask-image-radial-from-pos":[{"mask-radial-from":Y()}],"mask-image-radial-to-pos":[{"mask-radial-to":Y()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"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":[$t]}],"mask-image-conic-from-pos":[{"mask-conic-from":Y()}],"mask-image-conic-to-pos":[{"mask-conic-to":Y()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",at,it]}],filter:[{filter:["","none",at,it]}],blur:[{blur:ae()}],brightness:[{brightness:[$t,at,it]}],contrast:[{contrast:[$t,at,it]}],"drop-shadow":[{"drop-shadow":["","none",x,Hg,Qg]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",$t,at,it]}],"hue-rotate":[{"hue-rotate":[$t,at,it]}],invert:[{invert:["",$t,at,it]}],saturate:[{saturate:[$t,at,it]}],sepia:[{sepia:["",$t,at,it]}],"backdrop-filter":[{"backdrop-filter":["","none",at,it]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[$t,at,it]}],"backdrop-contrast":[{"backdrop-contrast":[$t,at,it]}],"backdrop-grayscale":[{"backdrop-grayscale":["",$t,at,it]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$t,at,it]}],"backdrop-invert":[{"backdrop-invert":["",$t,at,it]}],"backdrop-opacity":[{"backdrop-opacity":[$t,at,it]}],"backdrop-saturate":[{"backdrop-saturate":[$t,at,it]}],"backdrop-sepia":[{"backdrop-sepia":["",$t,at,it]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":q()}],"border-spacing-x":[{"border-spacing-x":q()}],"border-spacing-y":[{"border-spacing-y":q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",at,it]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[$t,"initial",at,it]}],ease:[{ease:["linear","initial",k,at,it]}],delay:[{delay:[$t,at,it]}],animate:[{animate:["none",N,at,it]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,at,it]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[at,it,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ge()}],"translate-x":[{"translate-x":Ge()}],"translate-y":[{"translate-y":Ge()}],"translate-z":[{"translate-z":Ge()}],"translate-none":["translate-none"],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"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",at,it]}],"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":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"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",at,it]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[$t,Gf,tu,J2]}],stroke:[{stroke:["none",...J()]}],"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"]}},aee=BJ(iee);function ye(...t){return aee(hD(t))}const _t=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));_t.displayName="Card";const wn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));wn.displayName="CardHeader";const Sn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));Sn.displayName="CardTitle";const Fr=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Fr.displayName="CardDescription";const An=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));An.displayName="CardContent";const Lz=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));Lz.displayName="CardFooter";var ew="rovingFocusGroup.onEntryFocus",oee={bubbles:!1,cancelable:!0},L0="RovingFocusGroup",[R3,Iz,lee]=Sv(L0),[cee,Dv]=Ta(L0,[lee]),[uee,dee]=cee(L0),Bz=b.forwardRef((t,e)=>o.jsx(R3.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(R3.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(hee,{...t,ref:e})})}));Bz.displayName=L0;var hee=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),x=qn(e,g),y=T0(i),[w,S]=Cc({prop:a,defaultProp:l??null,onChange:c,caller:L0}),[k,N]=b.useState(!1),C=ys(h),T=Iz(n),_=b.useRef(!1),[E,M]=b.useState(0);return b.useEffect(()=>{const q=g.current;if(q)return q.addEventListener(ew,C),()=>q.removeEventListener(ew,C)},[C]),o.jsx(uee,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:w,onItemFocus:b.useCallback(q=>S(q),[S]),onItemShiftTab:b.useCallback(()=>N(!0),[]),onFocusableItemAdd:b.useCallback(()=>M(q=>q+1),[]),onFocusableItemRemove:b.useCallback(()=>M(q=>q-1),[]),children:o.jsx(xn.div,{tabIndex:k||E===0?-1:0,"data-orientation":r,...m,ref:x,style:{outline:"none",...t.style},onMouseDown:Ze(t.onMouseDown,()=>{_.current=!0}),onFocus:Ze(t.onFocus,q=>{const L=!_.current;if(q.target===q.currentTarget&&L&&!k){const I=new CustomEvent(ew,oee);if(q.currentTarget.dispatchEvent(I),!I.defaultPrevented){const $=T().filter(P=>P.focusable),V=$.find(P=>P.active),ee=$.find(P=>P.id===w),H=[V,ee,...$].filter(Boolean).map(P=>P.ref.current);$z(H,f)}}_.current=!1}),onBlur:Ze(t.onBlur,()=>N(!1))})})}),qz="RovingFocusGroupItem",Fz=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...l}=t,c=ea(),h=i||c,f=dee(qz,n),m=f.currentTabStopId===h,g=Iz(n),{onFocusableItemAdd:x,onFocusableItemRemove:y,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return x(),()=>y()},[r,x,y]),o.jsx(R3.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:o.jsx(xn.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...l,ref:e,onMouseDown:Ze(t.onMouseDown,S=>{r?f.onItemFocus(h):S.preventDefault()}),onFocus:Ze(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:Ze(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const k=pee(S,f.orientation,f.dir);if(k!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.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(S.currentTarget);C=f.loop?gee(C,T+1):C.slice(T+1)}setTimeout(()=>$z(C))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:w!=null}):a})})});Fz.displayName=qz;var fee={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function mee(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function pee(t,e,n){const r=mee(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return fee[r]}function $z(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function gee(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Qz=Bz,Hz=Fz,zv="Tabs",[xee]=Ta(zv,[Dv]),Vz=Dv(),[vee,n6]=xee(zv),Uz=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:c="automatic",...h}=t,f=T0(l),[m,g]=Cc({prop:r,onChange:s,defaultProp:i??"",caller:zv});return o.jsx(vee,{scope:n,baseId:ea(),value:m,onValueChange:g,orientation:a,dir:f,activationMode:c,children:o.jsx(xn.div,{dir:f,"data-orientation":a,...h,ref:e})})});Uz.displayName=zv;var Wz="TabsList",Gz=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=n6(Wz,n),a=Vz(n);return o.jsx(Qz,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:o.jsx(xn.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});Gz.displayName=Wz;var Xz="TabsTrigger",Yz=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,a=n6(Xz,n),l=Vz(n),c=Jz(a.baseId,r),h=eP(a.baseId,r),f=r===a.value;return o.jsx(Hz,{asChild:!0,...l,focusable:!s,active:f,children:o.jsx(xn.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:Ze(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?a.onValueChange(r):m.preventDefault()}),onKeyDown:Ze(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&a.onValueChange(r)}),onFocus:Ze(t.onFocus,()=>{const m=a.activationMode!=="manual";!f&&!s&&m&&a.onValueChange(r)})})})});Yz.displayName=Xz;var Kz="TabsContent",Zz=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...a}=t,l=n6(Kz,n),c=Jz(l.baseId,r),h=eP(l.baseId,r),f=r===l.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),o.jsx(ai,{present:s||f,children:({present:g})=>o.jsx(xn.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:h,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});Zz.displayName=Kz;function Jz(t,e){return`${t}-trigger-${e}`}function eP(t,e){return`${t}-content-${e}`}var yee=Uz,tP=Gz,nP=Yz,rP=Zz;const ll=yee,ro=b.forwardRef(({className:t,...e},n)=>o.jsx(tP,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ro.displayName=tP.displayName;const Jt=b.forwardRef(({className:t,...e},n)=>o.jsx(nP,{ref:n,className:ye("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}));Jt.displayName=nP.displayName;const Pn=b.forwardRef(({className:t,...e},n)=>o.jsx(rP,{ref:n,className:ye("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}));Pn.displayName=rP.displayName;function bee(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var r6="ScrollArea",[sP]=Ta(r6),[wee,la]=sP(r6),iP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...a}=t,[l,c]=b.useState(null),[h,f]=b.useState(null),[m,g]=b.useState(null),[x,y]=b.useState(null),[w,S]=b.useState(null),[k,N]=b.useState(0),[C,T]=b.useState(0),[_,E]=b.useState(!1),[M,q]=b.useState(!1),L=qn(e,$=>c($)),I=T0(s);return o.jsx(wee,{scope:n,type:r,dir:I,scrollHideDelay:i,scrollArea:l,viewport:h,onViewportChange:f,content:m,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:_,onScrollbarXEnabledChange:E,scrollbarY:w,onScrollbarYChange:S,scrollbarYEnabled:M,onScrollbarYEnabledChange:q,onCornerWidthChange:N,onCornerHeightChange:T,children:o.jsx(xn.div,{dir:I,...a,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":C+"px",...t.style}})})});iP.displayName=r6;var aP="ScrollAreaViewport",oP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,a=la(aP,n),l=b.useRef(null),c=qn(e,l,a.onViewportChange);return o.jsxs(o.Fragment,{children:[o.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}),o.jsx(xn.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:o.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});oP.displayName=aP;var oo="ScrollAreaScrollbar",s6=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=la(oo,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=s,l=t.orientation==="horizontal";return b.useEffect(()=>(l?i(!0):a(!0),()=>{l?i(!1):a(!1)}),[l,i,a]),s.type==="hover"?o.jsx(See,{...r,ref:e,forceMount:n}):s.type==="scroll"?o.jsx(kee,{...r,ref:e,forceMount:n}):s.type==="auto"?o.jsx(lP,{...r,ref:e,forceMount:n}):s.type==="always"?o.jsx(i6,{...r,ref:e}):null});s6.displayName=oo;var See=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=la(oo,t.__scopeScrollArea),[i,a]=b.useState(!1);return b.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const h=()=>{window.clearTimeout(c),a(!0)},f=()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",h),l.addEventListener("pointerleave",f),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",h),l.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),o.jsx(ai,{present:n||i,children:o.jsx(lP,{"data-state":i?"visible":"hidden",...r,ref:e})})}),kee=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=la(oo,t.__scopeScrollArea),i=t.orientation==="horizontal",a=Lv(()=>c("SCROLL_END"),100),[l,c]=bee("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 b.useEffect(()=>{if(l==="idle"){const h=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[l,s.scrollHideDelay,c]),b.useEffect(()=>{const h=s.viewport,f=i?"scrollLeft":"scrollTop";if(h){let m=h[f];const g=()=>{const x=h[f];m!==x&&(c("SCROLL"),a()),m=x};return h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,i,c,a]),o.jsx(ai,{present:n||l!=="hidden",children:o.jsx(i6,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Ze(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ze(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),lP=b.forwardRef((t,e)=>{const n=la(oo,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,a]=b.useState(!1),l=t.orientation==="horizontal",c=Lv(()=>{if(n.viewport){const h=n.viewport.offsetWidth<n.viewport.scrollWidth,f=n.viewport.offsetHeight<n.viewport.scrollHeight;a(l?h:f)}},10);return ph(n.viewport,c),ph(n.content,c),o.jsx(ai,{present:r||i,children:o.jsx(i6,{"data-state":i?"visible":"hidden",...s,ref:e})})}),i6=b.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,s=la(oo,t.__scopeScrollArea),i=b.useRef(null),a=b.useRef(0),[l,c]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=fP(l.viewport,l.content),f={...r,sizes:l,onSizesChange:c,hasThumb:h>0&&h<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:g=>a.current=g};function m(g,x){return Eee(g,a.current,l,x)}return n==="horizontal"?o.jsx(Oee,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollLeft,x=a9(g,l,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"?o.jsx(jee,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollTop,x=a9(g,l);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}),Oee=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=la(oo,t.__scopeScrollArea),[a,l]=b.useState(),c=b.useRef(null),h=qn(e,c,i.onScrollbarXChange);return b.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(uP,{"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":Pv(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),pP(g,m)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:N1(a.paddingLeft),paddingEnd:N1(a.paddingRight)}})}})}),jee=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=la(oo,t.__scopeScrollArea),[a,l]=b.useState(),c=b.useRef(null),h=qn(e,c,i.onScrollbarYChange);return b.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(uP,{"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":Pv(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),pP(g,m)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:N1(a.paddingTop),paddingEnd:N1(a.paddingBottom)}})}})}),[Nee,cP]=sP(oo),uP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:h,onWheelScroll:f,onResize:m,...g}=t,x=la(oo,n),[y,w]=b.useState(null),S=qn(e,L=>w(L)),k=b.useRef(null),N=b.useRef(""),C=x.viewport,T=r.content-r.viewport,_=ys(f),E=ys(c),M=Lv(m,10);function q(L){if(k.current){const I=L.clientX-k.current.left,$=L.clientY-k.current.top;h({x:I,y:$})}}return b.useEffect(()=>{const L=I=>{const $=I.target;y?.contains($)&&_(I,T)};return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[C,y,T,_]),b.useEffect(E,[r,E]),ph(y,M),ph(x.content,M),o.jsx(Nee,{scope:n,scrollbar:y,hasThumb:s,onThumbChange:ys(i),onThumbPointerUp:ys(a),onThumbPositionChange:E,onThumbPointerDown:ys(l),children:o.jsx(xn.div,{...g,ref:S,style:{position:"absolute",...g.style},onPointerDown:Ze(t.onPointerDown,L=>{L.button===0&&(L.target.setPointerCapture(L.pointerId),k.current=y.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),q(L))}),onPointerMove:Ze(t.onPointerMove,q),onPointerUp:Ze(t.onPointerUp,L=>{const I=L.target;I.hasPointerCapture(L.pointerId)&&I.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),k.current=null})})})}),j1="ScrollAreaThumb",dP=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=cP(j1,t.__scopeScrollArea);return o.jsx(ai,{present:n||s.hasThumb,children:o.jsx(Cee,{ref:e,...r})})}),Cee=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=la(j1,n),a=cP(j1,n),{onThumbPositionChange:l}=a,c=qn(e,m=>a.onThumbChange(m)),h=b.useRef(void 0),f=Lv(()=>{h.current&&(h.current(),h.current=void 0)},100);return b.useEffect(()=>{const m=i.viewport;if(m){const g=()=>{if(f(),!h.current){const x=_ee(m,l);h.current=x,l()}};return l(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[i.viewport,f,l]),o.jsx(xn.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ze(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:Ze(t.onPointerUp,a.onThumbPointerUp)})});dP.displayName=j1;var a6="ScrollAreaCorner",hP=b.forwardRef((t,e)=>{const n=la(a6,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?o.jsx(Tee,{...t,ref:e}):null});hP.displayName=a6;var Tee=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=la(a6,n),[i,a]=b.useState(0),[l,c]=b.useState(0),h=!!(i&&l);return ph(s.scrollbarX,()=>{const f=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(f),c(f)}),ph(s.scrollbarY,()=>{const f=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(f),a(f)}),h?o.jsx(xn.div,{...r,ref:e,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function N1(t){return t?parseInt(t,10):0}function fP(t,e){const n=t/e;return isNaN(n)?0:n}function Pv(t){const e=fP(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Eee(t,e,n,r="ltr"){const s=Pv(n),i=s/2,a=e||i,l=s-a,c=n.scrollbar.paddingStart+a,h=n.scrollbar.size-n.scrollbar.paddingEnd-l,f=n.content-n.viewport,m=r==="ltr"?[0,f]:[f*-1,0];return mP([c,h],m)(t)}function a9(t,e,n="ltr"){const r=Pv(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,a=e.content-e.viewport,l=i-r,c=n==="ltr"?[0,a]:[a*-1,0],h=Bk(t,c);return mP([0,a],[0,l])(h)}function mP(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 pP(t,e){return t>0&&t<e}var _ee=(t,e=()=>{})=>{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,l=n.top!==i.top;(a||l)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function Lv(t,e){const n=ys(t),r=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),b.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function ph(t,e){const n=ys(e);ND(()=>{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 gP=iP,Mee=oP,Aee=hP;const kn=b.forwardRef(({className:t,children:e,viewportRef:n,...r},s)=>o.jsxs(gP,{ref:s,className:ye("relative overflow-hidden",t),...r,children:[o.jsx(Mee,{ref:n,className:"h-full w-full rounded-[inherit]",children:e}),o.jsx(D3,{}),o.jsx(D3,{orientation:"horizontal"}),o.jsx(Aee,{})]}));kn.displayName=gP.displayName;const D3=b.forwardRef(({className:t,orientation:e="vertical",...n},r)=>o.jsx(s6,{ref:r,orientation:e,className:ye("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:o.jsx(dP,{className:"relative flex-1 rounded-full bg-border"})}));D3.displayName=s6.displayName;function o9({className:t,...e}){return o.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function Ree(t,e=[]){let n=[];function r(i,a){const l=b.createContext(a);l.displayName=i+"Context";const c=n.length;n=[...n,a];const h=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[c]||l,S=b.useMemo(()=>y,Object.values(y));return o.jsx(w.Provider,{value:S,children:x})};h.displayName=i+"Provider";function f(m,g){const x=g?.[t]?.[c]||l,y=b.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=>b.createContext(a));return function(l){const c=l?.[t]||i;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,Dee(s,...e)]}function Dee(...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((l,{useScope:c,scopeName:h})=>{const m=c(i)[`__scope${h}`];return{...l,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var zee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xP=zee.reduce((t,e)=>{const n=qk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),o6="Progress",l6=100,[Pee]=Ree(o6),[Lee,Iee]=Pee(o6),vP=b.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=Bee,...a}=t;(s||s===0)&&!l9(s)&&console.error(qee(`${s}`,"Progress"));const l=l9(s)?s:l6;r!==null&&!c9(r,l)&&console.error(Fee(`${r}`,"Progress"));const c=c9(r,l)?r:null,h=C1(c)?i(c,l):void 0;return o.jsx(Lee,{scope:n,value:c,max:l,children:o.jsx(xP.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":C1(c)?c:void 0,"aria-valuetext":h,role:"progressbar","data-state":wP(c,l),"data-value":c??void 0,"data-max":l,...a,ref:e})})});vP.displayName=o6;var yP="ProgressIndicator",bP=b.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=Iee(yP,n);return o.jsx(xP.div,{"data-state":wP(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});bP.displayName=yP;function Bee(t,e){return`${Math.round(t/e*100)}%`}function wP(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function C1(t){return typeof t=="number"}function l9(t){return C1(t)&&!isNaN(t)&&t>0}function c9(t,e){return C1(t)&&!isNaN(t)&&t<=e&&t>=0}function qee(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${l6}\`.`}function Fee(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 ${l6} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`}var SP=vP,$ee=bP;const I0=b.forwardRef(({className:t,value:e,...n},r)=>o.jsx(SP,{ref:r,className:ye("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:o.jsx($ee,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));I0.displayName=SP.displayName;const Qee={light:"",dark:".dark"},kP=b.createContext(null);function OP(){const t=b.useContext(kP);if(!t)throw new Error("useChart must be used within a <ChartContainer />");return t}const Dd=b.forwardRef(({id:t,className:e,children:n,config:r,...s},i)=>{const a=b.useId(),l=`chart-${t||a.replace(/:/g,"")}`;return o.jsx(kP.Provider,{value:{config:r},children:o.jsxs("div",{"data-chart":l,ref:i,className:ye("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:[o.jsx(Hee,{id:l,config:r}),o.jsx(JX,{children:n})]})})});Dd.displayName="Chart";const Hee=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?o.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(Qee).map(([r,s])=>`
${s} [data-chart=${t}] {
${n.map(([i,a])=>{const l=a.theme?.[r]||a.color;return l?` --color-${i}: ${l};`:null}).join(`
`)}
}
`).join(`
`)}}):null},Xf=eY,zd=b.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:a,labelFormatter:l,labelClassName:c,formatter:h,color:f,nameKey:m,labelKey:g},x)=>{const{config:y}=OP(),w=b.useMemo(()=>{if(s||!e?.length)return null;const[k]=e,N=`${g||k?.dataKey||k?.name||"value"}`,C=z3(y,k,N),T=!g&&typeof a=="string"?y[a]?.label||a:C?.label;return l?o.jsx("div",{className:ye("font-medium",c),children:l(T,e)}):T?o.jsx("div",{className:ye("font-medium",c),children:T}):null},[a,l,e,s,c,y,g]);if(!t||!e?.length)return null;const S=e.length===1&&r!=="dot";return o.jsxs("div",{ref:x,className:ye("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:[S?null:w,o.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=z3(y,k,C),_=f||k.payload.fill||k.color;return o.jsx("div",{className:ye("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):o.jsxs(o.Fragment,{children:[T?.icon?o.jsx(T.icon,{}):!i&&o.jsx("div",{className:ye("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":S&&r==="dashed"}),style:{"--color-bg":_,"--color-border":_}}),o.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[o.jsxs("div",{className:"grid gap-1.5",children:[S?w:null,o.jsx("span",{className:"text-muted-foreground",children:T?.label||k.name})]}),k.value&&o.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:k.value.toLocaleString()})]})]})},k.dataKey)})})]})});zd.displayName="ChartTooltip";const Vee=tY,jP=b.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:a}=OP();return n?.length?o.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(l=>l.type!=="none").map(l=>{const c=`${s||l.dataKey||"value"}`,h=z3(a,l,c);return o.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?o.jsx(h.icon,{}):o.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:l.color}}),h?.label]},l.value)})}):null});jP.displayName="ChartLegend";function z3(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 u9=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,d9=hD,Lh=(t,e)=>n=>{var r;if(e?.variants==null)return d9(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=u9(f)||u9(m);return s[h][g]}),l=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),c=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,S]=y;return Array.isArray(S)?S.includes({...i,...l}[w]):{...i,...l}[w]===S})?[...h,m,g]:h},[]);return d9(t,a,c,n?.class,n?.className)},qm=Lh("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"}}),me=b.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const a=r?ZY:"button";return o.jsx(a,{className:ye(qm({variant:e,size:n,className:t})),ref:i,...s})});me.displayName="Button";function Uee(){const[t,e]=b.useState(null),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(24),[c,h]=b.useState(!0),[f,m]=b.useState(null),[g,x]=b.useState(!0),y=b.useCallback(async()=>{try{x(!0);const L=await gr.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");m({hitokoto:L.data.hitokoto,from:L.data.from||L.data.from_who||"未知"})}catch(L){console.error("获取一言失败:",L),m({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{x(!1)}},[]),w=b.useCallback(async()=>{try{const L=localStorage.getItem("access-token"),I=await gr.get(`/api/webui/statistics/dashboard?hours=${a}`,{headers:{Authorization:`Bearer ${L}`}});e(I.data),r(!1),i(100)}catch(L){console.error("Failed to fetch dashboard data:",L),r(!1),i(100)}},[a]);if(b.useEffect(()=>{if(!n)return;i(0);const L=setTimeout(()=>i(15),200),I=setTimeout(()=>i(30),800),$=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),ee=setTimeout(()=>i(75),6500),z=setTimeout(()=>i(85),9e3),H=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(L),clearTimeout(I),clearTimeout($),clearTimeout(V),clearTimeout(ee),clearTimeout(z),clearTimeout(H)}},[n]),b.useEffect(()=>{w(),y()},[w,y]),b.useEffect(()=>{if(!c)return;const L=setInterval(()=>{w()},3e4);return()=>clearInterval(L)},[c,w]),n||!t)return o.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:o.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[o.jsx(Ti,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(I0,{value:s,className:"h-2"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:S,model_stats:k,hourly_data:N,daily_data:C,recent_activity:T}=t,_=L=>{const I=Math.floor(L/3600),$=Math.floor(L%3600/60);return`${I}小时${$}分钟`},E=L=>new Date(L).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),M=k.slice(0,6).map(L=>({name:L.model_name,value:L.request_count,fill:`hsl(var(--chart-${k.indexOf(L)%5+1}))`})),q={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(ll,{value:a.toString(),onValueChange:L=>l(Number(L)),children:o.jsxs(ro,{className:"grid grid-cols-3 w-full sm:w-auto",children:[o.jsx(Jt,{value:"24",children:"24小时"}),o.jsx(Jt,{value:"168",children:"7天"}),o.jsx(Jt,{value:"720",children:"30天"})]})}),o.jsxs(me,{variant:c?"default":"outline",size:"sm",onClick:()=>h(!c),className:"gap-2",children:[o.jsx(Ti,{className:`h-4 w-4 ${c?"animate-spin":""}`}),o.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:w,children:o.jsx(Ti,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"总请求数"}),o.jsx(dK,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-2xl font-bold",children:S.total_requests.toLocaleString()}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",a<48?a+"小时":Math.floor(a/24)+"天"]})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"总花费"}),o.jsx(hK,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:["¥",S.total_cost.toFixed(2)]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.cost_per_hour>0?`¥${S.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"Token消耗"}),o.jsx(b3,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[(S.total_tokens/1e3).toFixed(1),"K"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.tokens_per_hour>0?`${(S.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"平均响应"}),o.jsx(w3,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[S.avg_response_time.toFixed(2),"s"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"在线时长"}),o.jsx(Gd,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsx(An,{children:o.jsx("div",{className:"text-xl font-bold",children:_(S.online_time)})})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"消息处理"}),o.jsx(E0,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-xl font-bold",children:S.total_messages.toLocaleString()}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",S.total_replies.toLocaleString()," 条"]})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"成本效率"}),o.jsx(fK,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-xl font-bold",children:S.total_messages>0?`¥${(S.total_cost/S.total_messages*100).toFixed(2)}`:"¥0.00"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),o.jsxs(ll,{defaultValue:"trends",className:"space-y-4",children:[o.jsxs(ro,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[o.jsx(Jt,{value:"trends",children:"趋势"}),o.jsx(Jt,{value:"models",children:"模型"}),o.jsx(Jt,{value:"activity",children:"活动"}),o.jsx(Jt,{value:"daily",children:"日统计"})]}),o.jsxs(Pn,{value:"trends",className:"space-y-4",children:[o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"请求趋势"}),o.jsxs(Fr,{children:["最近",a,"小时的请求量变化"]})]}),o.jsx(An,{children:o.jsx(Dd,{config:q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:o.jsxs(nY,{data:N,children:[o.jsx(Bg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Vf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Xf,{content:o.jsx(zd,{labelFormatter:L=>E(L)})}),o.jsx(rY,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"花费趋势"}),o.jsx(Fr,{children:"API调用成本变化"})]}),o.jsx(An,{children:o.jsx(Dd,{config:q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:o.jsxs(H2,{data:N,children:[o.jsx(Bg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Vf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Xf,{content:o.jsx(zd,{labelFormatter:L=>E(L)})}),o.jsx(Fg,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"Token消耗"}),o.jsx(Fr,{children:"Token使用量变化"})]}),o.jsx(An,{children:o.jsx(Dd,{config:q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:o.jsxs(H2,{data:N,children:[o.jsx(Bg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Vf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Xf,{content:o.jsx(zd,{labelFormatter:L=>E(L)})}),o.jsx(Fg,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),o.jsx(Pn,{value:"models",className:"space-y-4",children:o.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"模型请求分布"}),o.jsx(Fr,{children:"各模型使用占比"})]}),o.jsx(An,{children:o.jsx(Dd,{config:Object.fromEntries(k.slice(0,6).map((L,I)=>[L.model_name,{label:L.model_name,color:`hsl(var(--chart-${I%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:o.jsxs(sY,{children:[o.jsx(Xf,{content:o.jsx(zd,{})}),o.jsx(iY,{data:M,cx:"50%",cy:"50%",labelLine:!1,label:({name:L,percent:I})=>`${L} ${I?(I*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:M.map((L,I)=>o.jsx(aY,{fill:L.fill},`cell-${I}`))})]})})})]}),o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"模型详细统计"}),o.jsx(Fr,{children:"请求数、花费和性能"})]}),o.jsx(An,{children:o.jsx(kn,{className:"h-[300px] sm:h-[400px]",children:o.jsx("div",{className:"space-y-3",children:k.map((L,I)=>o.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:L.model_name}),o.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${I%5+1}))`}})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),o.jsx("span",{className:"ml-1 font-medium",children:L.request_count.toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"花费:"}),o.jsxs("span",{className:"ml-1 font-medium",children:["¥",L.total_cost.toFixed(2)]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),o.jsxs("span",{className:"ml-1 font-medium",children:[(L.total_tokens/1e3).toFixed(1),"K"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),o.jsxs("span",{className:"ml-1 font-medium",children:[L.avg_response_time.toFixed(2),"s"]})]})]})]},I))})})})]})]})}),o.jsx(Pn,{value:"activity",children:o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"最近活动"}),o.jsx(Fr,{children:"最新的API调用记录"})]}),o.jsx(An,{children:o.jsx(kn,{className:"h-[400px] sm:h-[500px]",children:o.jsx("div",{className:"space-y-2",children:T.map((L,I)=>o.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium text-sm truncate",children:L.model}),o.jsx("div",{className:"text-xs text-muted-foreground",children:L.request_type})]}),o.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(L.timestamp)})]}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),o.jsx("span",{className:"ml-1",children:L.tokens})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"花费:"}),o.jsxs("span",{className:"ml-1",children:["¥",L.cost.toFixed(4)]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),o.jsxs("span",{className:"ml-1",children:[L.time_cost.toFixed(2),"s"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"状态:"}),o.jsx("span",{className:`ml-1 ${L.status==="success"?"text-green-600":"text-red-600"}`,children:L.status})]})]})]},I))})})})]})}),o.jsx(Pn,{value:"daily",children:o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"每日统计"}),o.jsx(Fr,{children:"最近7天的数据汇总"})]}),o.jsx(An,{children:o.jsx(Dd,{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:o.jsxs(H2,{data:C,children:[o.jsx(Bg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(qg,{dataKey:"timestamp",tickFormatter:L=>{const I=new Date(L);return`${I.getMonth()+1}/${I.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Vf,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Vf,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Xf,{content:o.jsx(zd,{labelFormatter:L=>new Date(L).toLocaleDateString("zh-CN")})}),o.jsx(Vee,{content:o.jsx(jP,{})}),o.jsx(Fg,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),o.jsx(Fg,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),o.jsxs(_t,{className:"border-2 border-primary/20",children:[o.jsx(wn,{className:"pb-3",children:o.jsx(Sn,{className:"text-lg",children:"每日一言"})}),o.jsx(An,{children:g?o.jsxs("div",{className:"space-y-2",children:[o.jsx(o9,{className:"h-6 w-3/4"}),o.jsx(o9,{className:"h-4 w-1/4"})]}):f?o.jsxs("div",{className:"space-y-2",children:[o.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',f.hitokoto,'"']}),o.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",f.from]})]}):null})]})]})})}const Wee={theme:"system",setTheme:()=>null},NP=b.createContext(Wee),c6=()=>{const t=b.useContext(NP);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},Gee=(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)"})})},CP=b.createContext(void 0),TP=()=>{const t=b.useContext(CP);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var Iv="Switch",[Xee]=Ta(Iv),[Yee,Kee]=Xee(Iv),EP=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:a,disabled:l,value:c="on",onCheckedChange:h,form:f,...m}=t,[g,x]=b.useState(null),y=qn(e,C=>x(C)),w=b.useRef(!1),S=g?f||!!g.closest("form"):!0,[k,N]=Cc({prop:s,defaultProp:i??!1,onChange:h,caller:Iv});return o.jsxs(Yee,{scope:n,checked:k,disabled:l,children:[o.jsx(xn.button,{type:"button",role:"switch","aria-checked":k,"aria-required":a,"data-state":RP(k),"data-disabled":l?"":void 0,disabled:l,value:c,...m,ref:y,onClick:Ze(t.onClick,C=>{N(T=>!T),S&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})}),S&&o.jsx(AP,{control:g,bubbles:!w.current,name:r,value:c,checked:k,required:a,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});EP.displayName=Iv;var _P="SwitchThumb",MP=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=Kee(_P,n);return o.jsx(xn.span,{"data-state":RP(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});MP.displayName=_P;var Zee="SwitchBubbleInput",AP=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const a=b.useRef(null),l=qn(a,i),c=CD(n),h=TD(e);return b.useEffect(()=>{const f=a.current;if(!f)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==n&&x){const y=new Event("click",{bubbles:r});x.call(f,n),f.dispatchEvent(y)}},[c,n,r]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});AP.displayName=Zee;function RP(t){return t?"checked":"unchecked"}var DP=EP,Jee=MP;const Tt=b.forwardRef(({className:t,...e},n)=>o.jsx(DP,{className:ye("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:o.jsx(Jee,{className:ye("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")})}));Tt.displayName=DP.displayName;const ete=Lh("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),de=b.forwardRef(({className:t,...e},n)=>o.jsx(ED,{ref:n,className:ye(ete(),t),...e}));de.displayName=ED.displayName;const Pe=b.forwardRef(({className:t,type:e,...n},r)=>o.jsx("input",{type:e,className:ye("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}));Pe.displayName="Input";const tte=5,nte=5e3;let tw=0;function rte(){return tw=(tw+1)%Number.MAX_SAFE_INTEGER,tw.toString()}const nw=new Map,h9=t=>{if(nw.has(t))return;const e=setTimeout(()=>{nw.delete(t),km({type:"REMOVE_TOAST",toastId:t})},nte);nw.set(t,e)},ste=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,tte)};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?h9(n):t.toasts.forEach(r=>{h9(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)}}},Xx=[];let Yx={toasts:[]};function km(t){Yx=ste(Yx,t),Xx.forEach(e=>{e(Yx)})}function ite({...t}){const e=rte(),n=s=>km({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>km({type:"DISMISS_TOAST",toastId:e});return km({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Wr(){const[t,e]=b.useState(Yx);return b.useEffect(()=>(Xx.push(e),()=>{const n=Xx.indexOf(e);n>-1&&Xx.splice(n,1)}),[t]),{...t,toast:ite,dismiss:n=>km({type:"DISMISS_TOAST",toastId:n})}}const ate=[{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 ote(t){const e=ate.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 u6="0.11.5",d6="MaiBot Dashboard",lte=`${d6} v${u6}`,cte=(t="v")=>`${t}${u6}`,zr=Vk,h6=_D,ute=Fk,zP=b.forwardRef(({className:t,...e},n)=>o.jsx(kv,{ref:n,className:ye("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}));zP.displayName=kv.displayName;const Sr=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(ute,{children:[o.jsx(zP,{}),o.jsxs(Ov,{ref:r,className:ye("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,o.jsxs($k,{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:[o.jsx(_0,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Sr.displayName=Ov.displayName;const kr=({className:t,...e})=>o.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});kr.displayName="DialogHeader";const Ds=({className:t,...e})=>o.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Ds.displayName="DialogFooter";const Or=b.forwardRef(({className:t,...e},n)=>o.jsx(Qk,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));Or.displayName=Qk.displayName;const ps=b.forwardRef(({className:t,...e},n)=>o.jsx(Hk,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));ps.displayName=Hk.displayName;var dte=Symbol("radix.slottable");function hte(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=dte,e}var PP="AlertDialog",[fte]=Ta(PP,[MD]),yl=MD(),LP=t=>{const{__scopeAlertDialog:e,...n}=t,r=yl(e);return o.jsx(Vk,{...r,...n,modal:!0})};LP.displayName=PP;var mte="AlertDialogTrigger",IP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return o.jsx(_D,{...s,...r,ref:e})});IP.displayName=mte;var pte="AlertDialogPortal",BP=t=>{const{__scopeAlertDialog:e,...n}=t,r=yl(e);return o.jsx(Fk,{...r,...n})};BP.displayName=pte;var gte="AlertDialogOverlay",qP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return o.jsx(kv,{...s,...r,ref:e})});qP.displayName=gte;var Kd="AlertDialogContent",[xte,vte]=fte(Kd),yte=hte("AlertDialogContent"),FP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=yl(n),a=b.useRef(null),l=qn(e,a),c=b.useRef(null);return o.jsx(JY,{contentName:Kd,titleName:$P,docsSlug:"alert-dialog",children:o.jsx(xte,{scope:n,cancelRef:c,children:o.jsxs(Ov,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:Ze(s.onOpenAutoFocus,h=>{h.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[o.jsx(yte,{children:r}),o.jsx(wte,{contentRef:a})]})})})});FP.displayName=Kd;var $P="AlertDialogTitle",QP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return o.jsx(Qk,{...s,...r,ref:e})});QP.displayName=$P;var HP="AlertDialogDescription",VP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return o.jsx(Hk,{...s,...r,ref:e})});VP.displayName=HP;var bte="AlertDialogAction",UP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return o.jsx($k,{...s,...r,ref:e})});UP.displayName=bte;var WP="AlertDialogCancel",GP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=vte(WP,n),i=yl(n),a=qn(e,s);return o.jsx($k,{...i,...r,ref:a})});GP.displayName=WP;var wte=({contentRef:t})=>{const e=`\`${Kd}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${Kd}\` by passing a \`${HP}\` 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 \`${Kd}\`. 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 b.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Ste=LP,kte=IP,Ote=BP,XP=qP,YP=FP,KP=UP,ZP=GP,JP=QP,eL=VP;const jn=Ste,Vr=kte,jte=Ote,tL=b.forwardRef(({className:t,...e},n)=>o.jsx(XP,{className:ye("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}));tL.displayName=XP.displayName;const cn=b.forwardRef(({className:t,...e},n)=>o.jsxs(jte,{children:[o.jsx(tL,{}),o.jsx(YP,{ref:n,className:ye("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})]}));cn.displayName=YP.displayName;const un=({className:t,...e})=>o.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});un.displayName="AlertDialogHeader";const dn=({className:t,...e})=>o.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});dn.displayName="AlertDialogFooter";const hn=b.forwardRef(({className:t,...e},n)=>o.jsx(JP,{ref:n,className:ye("text-lg font-semibold",t),...e}));hn.displayName=JP.displayName;const fn=b.forwardRef(({className:t,...e},n)=>o.jsx(eL,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));fn.displayName=eL.displayName;const mn=b.forwardRef(({className:t,...e},n)=>o.jsx(KP,{ref:n,className:ye(qm(),t),...e}));mn.displayName=KP.displayName;const pn=b.forwardRef(({className:t,...e},n)=>o.jsx(ZP,{ref:n,className:ye(qm({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));pn.displayName=ZP.displayName;function Nte(){return o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),o.jsxs(ll,{defaultValue:"appearance",className:"w-full",children:[o.jsxs(ro,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[o.jsxs(Jt,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(UD,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"外观"})]}),o.jsxs(Jt,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(mK,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"安全"})]}),o.jsxs(Jt,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(vu,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"其他"})]}),o.jsxs(Jt,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(wa,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"关于"})]})]}),o.jsxs(kn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[o.jsx(Pn,{value:"appearance",className:"mt-0",children:o.jsx(Cte,{})}),o.jsx(Pn,{value:"security",className:"mt-0",children:o.jsx(Tte,{})}),o.jsx(Pn,{value:"other",className:"mt-0",children:o.jsx(Ete,{})}),o.jsx(Pn,{value:"about",className:"mt-0",children:o.jsx(_te,{})})]})]})]})}function f9(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,l=parseInt(i.substring(2,4),16)/255,c=parseInt(i.substring(4,6),16)/255,h=Math.max(a,l,c),f=Math.min(a,l,c);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=((l-c)/y+(l<c?6:0))/6;break;case l:m=((c-a)/y+2)/6;break;case c:m=((a-l)/y+4)/6;break}}return`${Math.round(m*360)} ${Math.round(g*100)}% ${Math.round(x*100)}%`};e.style.setProperty("--primary",s(t)),e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient")}}function Cte(){const{theme:t,setTheme:e}=c6(),{enableAnimations:n,setEnableAnimations:r,enableWavesBackground:s,setEnableWavesBackground:i}=TP(),[a,l]=b.useState(()=>localStorage.getItem("accent-color")||"blue");b.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";f9(h)},[]);const c=h=>{l(h),localStorage.setItem("accent-color",h),f9(h)};return o.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[o.jsx(rw,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),o.jsx(rw,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),o.jsx(rw,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[o.jsx(Hi,{value:"blue",current:a,onChange:c,label:"蓝色",colorClass:"bg-blue-500"}),o.jsx(Hi,{value:"purple",current:a,onChange:c,label:"紫色",colorClass:"bg-purple-500"}),o.jsx(Hi,{value:"green",current:a,onChange:c,label:"绿色",colorClass:"bg-green-500"}),o.jsx(Hi,{value:"orange",current:a,onChange:c,label:"橙色",colorClass:"bg-orange-500"}),o.jsx(Hi,{value:"pink",current:a,onChange:c,label:"粉色",colorClass:"bg-pink-500"}),o.jsx(Hi,{value:"red",current:a,onChange:c,label:"红色",colorClass:"bg-red-500"})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[o.jsx(Hi,{value:"gradient-sunset",current:a,onChange:c,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),o.jsx(Hi,{value:"gradient-ocean",current:a,onChange:c,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),o.jsx(Hi,{value:"gradient-forest",current:a,onChange:c,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),o.jsx(Hi,{value:"gradient-aurora",current:a,onChange:c,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),o.jsx(Hi,{value:"gradient-fire",current:a,onChange:c,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),o.jsx(Hi,{value:"gradient-twilight",current:a,onChange:c,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[o.jsx("div",{className:"flex-1",children:o.jsx("input",{type:"color",value:a.startsWith("#")?a:"#3b82f6",onChange:h=>c(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),o.jsx("div",{className:"flex-1",children:o.jsx(Pe,{type:"text",value:a,onChange:h=>c(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),o.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),o.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[o.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5 flex-1",children:[o.jsx(de,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),o.jsx(Tt,{id:"animations",checked:n,onCheckedChange:r})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5 flex-1",children:[o.jsx(de,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),o.jsx(Tt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function Tte(){const t=Ca(),[e,n]=b.useState(""),[r,s]=b.useState(""),[i,a]=b.useState(!1),[l,c]=b.useState(!1),[h,f]=b.useState(!1),[m,g]=b.useState(!1),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[k,N]=b.useState(""),[C,T]=b.useState(!1),{toast:_}=Wr(),E=b.useMemo(()=>ote(r),[r]),M=()=>localStorage.getItem("access-token")||"",q=async z=>{try{await navigator.clipboard.writeText(z),y(!0),_({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{_({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},L=async()=>{if(!r.trim()){_({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const z=E.rules.filter(H=>!H.passed).map(H=>H.label).join(", ");_({title:"格式错误",description:`Token 不符合要求: ${z}`,variant:"destructive"});return}f(!0);try{const z=M(),H=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({new_token:r.trim()})}),P=await H.json();H.ok&&P.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),_({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):_({title:"更新失败",description:P.message||"无法更新 Token",variant:"destructive"})}catch(z){console.error("更新 Token 错误:",z),_({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{f(!1)}},I=async()=>{g(!0);try{const z=M(),H=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}}),P=await H.json();H.ok&&P.success?(localStorage.setItem("access-token",P.token),n(P.token),N(P.token),S(!0),T(!1),_({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):_({title:"生成失败",description:P.message||"无法生成新 Token",variant:"destructive"})}catch(z){console.error("生成 Token 错误:",z),_({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{g(!1)}},$=async()=>{try{await navigator.clipboard.writeText(k),T(!0),_({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{_({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{S(!1),setTimeout(()=>{N(""),T(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},ee=z=>{z||V()};return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsx(zr,{open:w,onOpenChange:ee,children:o.jsxs(Sr,{className:"sm:max-w-md",children:[o.jsxs(kr,{children:[o.jsxs(Or,{className:"flex items-center gap-2",children:[o.jsx(Xd,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),o.jsx(ps,{children:"这是您的新 Token请立即保存。关闭此窗口后将跳转到登录页面。"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[o.jsx(de,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),o.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:k})]}),o.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Xd,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),o.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[o.jsx("p",{className:"font-semibold",children:"重要提示"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[o.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),o.jsx("li",{children:"请立即复制并保存到安全的位置"}),o.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),o.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),o.jsxs(Ds,{className:"gap-2 sm:gap-0",children:[o.jsx(me,{variant:"outline",onClick:$,className:"gap-2",children:C?o.jsxs(o.Fragment,{children:[o.jsx(dc,{className:"h-4 w-4 text-green-500"}),"已复制"]}):o.jsxs(o.Fragment,{children:[o.jsx(S3,{className:"h-4 w-4"}),"复制 Token"]})}),o.jsx(me,{onClick:V,children:"我已保存,关闭"})]})]})}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),o.jsx("div",{className:"space-y-3 sm:space-y-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(Pe,{id:"current-token",type:i?"text":"password",value:e||M(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),o.jsx("button",{onClick:()=>{e||n(M()),a(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?o.jsx(b1,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(sa,{className:"h-4 w-4 text-muted-foreground"})})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsx(me,{variant:"outline",size:"icon",onClick:()=>q(M()),title:"复制到剪贴板",className:"flex-shrink-0",children:x?o.jsx(dc,{className:"h-4 w-4 text-green-500"}):o.jsx(S3,{className:"h-4 w-4"})}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs(me,{variant:"outline",disabled:m,className:"gap-2 flex-1 sm:flex-none",children:[o.jsx(Ti,{className:ye("h-4 w-4",m&&"animate-spin")}),o.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),o.jsx("span",{className:"sm:hidden",children:"生成"})]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认重新生成 Token"}),o.jsx(fn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:I,children:"确认生成"})]})]})]})]})]}),o.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token不要泄露给他人"})]})})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),o.jsxs("div",{className:"relative",children:[o.jsx(Pe,{id:"new-token",type:l?"text":"password",value:r,onChange:z=>s(z.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),o.jsx("button",{onClick:()=>c(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:l?"隐藏":"显示",children:l?o.jsx(b1,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(sa,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&o.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),o.jsx("div",{className:"space-y-1.5",children:E.rules.map(z=>o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[z.passed?o.jsx(pc,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):o.jsx(pK,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:ye(z.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:z.label})]},z.id))}),E.isValid&&o.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[o.jsx(dc,{className:"h-4 w-4"}),o.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),o.jsx(me,{onClick:L,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),o.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:[o.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),o.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),o.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),o.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),o.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),o.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),o.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function Ete(){const t=Ca(),{toast:e}=Wr(),[n,r]=b.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}`}}),l=await a.json();a.ok&&l.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:l.message||"无法重置配置状态",variant:"destructive"})}catch(i){console.error("重置配置状态错误:",i),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return o.jsx("div",{className:"space-y-4 sm:space-y-6",children:o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsx("div",{className:"space-y-2",children:o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs(me,{variant:"outline",disabled:n,className:"gap-2",children:[o.jsx(gK,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认重新配置"}),o.jsx(fn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:s,children:"确认重置"})]})]})]})]})]})})}function _te(){return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.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:o.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[o.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:o.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:o.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"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),o.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),o.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:ye("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:[o.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o.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",o.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.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"})})]})]})]})}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",d6]}),o.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[o.jsxs("p",{children:["版本: ",u6]}),o.jsx("p",{children:"麦麦MaiBot的现代化 Web 管理界面"})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),o.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",o.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"React 19.2.0"}),o.jsx("li",{children:"TypeScript 5.7.2"}),o.jsx("li",{children:"Vite 6.0.7"}),o.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"shadcn/ui"}),o.jsx("li",{children:"Radix UI"}),o.jsx("li",{children:"Tailwind CSS 3.4.17"}),o.jsx("li",{children:"Lucide Icons"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"后端"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"Python 3.12+"}),o.jsx("li",{children:"FastAPI"}),o.jsx("li",{children:"Uvicorn"}),o.jsx("li",{children:"WebSocket"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"Bun / npm"}),o.jsx("li",{children:"ESLint 9.17.0"}),o.jsx("li",{children:"PostCSS"})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),o.jsx(kn,{className:"h-[300px] sm:h-[400px]",children:o.jsxs("div",{className:"space-y-4 pr-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"React",description:"用户界面构建库",license:"MIT"}),o.jsx(ar,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),o.jsx(ar,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),o.jsx(ar,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),o.jsx(ar,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),o.jsx(ar,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),o.jsx(ar,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),o.jsx(ar,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),o.jsx(ar,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),o.jsx(ar,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),o.jsx(ar,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),o.jsx(ar,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),o.jsx(ar,{name:"Pydantic",description:"数据验证库",license:"MIT"}),o.jsx(ar,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),o.jsx(ar,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),o.jsx(ar,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),o.jsx(ar,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:o.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[o.jsx("div",{className:"flex-shrink-0 mt-0.5",children:o.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:o.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function ar({name:t,description:e,license:n}){return o.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium text-foreground truncate",children:t}),o.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),o.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 rw({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return o.jsxs("button",{onClick:()=>n(t),className:ye("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&&o.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),o.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),o.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Hi({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return o.jsxs("button",{onClick:()=>n(t),className:ye("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&&o.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"}),o.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[o.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),o.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class Mte{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),l=this.perm[r]+s,c=this.perm[l],h=this.perm[l+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[c%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 Ate(){const t=b.useRef(null),e=b.useRef(null),n=b.useRef(void 0),r=b.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 Mte(Math.random()),bounding:null});return b.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const a=r.current,l=()=>{const w=s.getBoundingClientRect();a.bounding=w,i.style.width=`${w.width}px`,i.style.height=`${w.height}px`},c=()=>{if(!a.bounding)return;const{width:w,height:S}=a.bounding;a.lines=[],a.paths.forEach(L=>L.remove()),a.paths=[];const k=10,N=32,C=w+200,T=S+30,_=Math.ceil(C/k),E=Math.ceil(T/N),M=(w-k*_)/2,q=(S-N*E)/2;for(let L=0;L<=_;L++){const I=[];for(let V=0;V<=E;V++){const ee={x:M+k*L,y:q+N*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};I.push(ee)}const $=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild($),a.paths.push($),a.lines.push(I)}},h=w=>{const{lines:S,mouse:k,noise:N}=a;S.forEach(C=>{C.forEach(T=>{const _=N.perlin2((T.x+w*.0125)*.002,(T.y+w*.005)*.0015)*12;T.wave.x=Math.cos(_)*32,T.wave.y=Math.sin(_)*16;const E=T.x-k.sx,M=T.y-k.sy,q=Math.hypot(E,M),L=Math.max(175,k.vs);if(q<L){const I=1-q/L,$=Math.cos(q*.001)*I;T.cursor.vx+=Math.cos(k.a)*$*L*k.vs*65e-5,T.cursor.vy+=Math.sin(k.a)*$*L*k.vs*65e-5}T.cursor.vx+=(0-T.cursor.x)*.005,T.cursor.vy+=(0-T.cursor.y)*.005,T.cursor.vx*=.925,T.cursor.vy*=.925,T.cursor.x+=T.cursor.vx*2,T.cursor.y+=T.cursor.vy*2,T.cursor.x=Math.min(100,Math.max(-100,T.cursor.x)),T.cursor.y=Math.min(100,Math.max(-100,T.cursor.y))})})},f=(w,S=!0)=>{const k={x:w.x+w.wave.x+(S?w.cursor.x:0),y:w.y+w.wave.y+(S?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:S}=a;w.forEach((k,N)=>{let C=f(k[0],!1),T=`M ${C.x} ${C.y}`;k.forEach((_,E)=>{const M=E===k.length-1;C=f(_,!M),T+=`L ${C.x} ${C.y}`}),S[N].setAttribute("d",T)})},g=w=>{const{mouse:S}=a;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const k=S.x-S.lx,N=S.y-S.ly,C=Math.hypot(k,N);S.v=C,S.vs+=(C-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(N,k),s&&(s.style.setProperty("--x",`${S.sx}px`),s.style.setProperty("--y",`${S.sy}px`)),h(w),m(),n.current=requestAnimationFrame(g)},x=w=>{if(!a.bounding)return;const{mouse:S}=a;S.x=w.pageX-a.bounding.left,S.y=w.pageY-a.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},y=()=>{l(),c()};return l(),c(),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)}},[]),o.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[o.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"}}),o.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:o.jsx("style",{children:`
path {
fill: none;
stroke: hsl(var(--primary) / 0.20);
stroke-width: 1px;
}
`})})]})}function Rte(){const t=Ca();b.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function nL(){return!!localStorage.getItem("access-token")}function Dte(){const[t,e]=b.useState(""),[n,r]=b.useState(!1),[s,i]=b.useState(""),a=Ca(),{enableWavesBackground:l,setEnableWavesBackground:c}=TP(),{theme:h,setTheme:f}=c6();b.useEffect(()=>{nL()&&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 S=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),k=await S.json();if(S.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(S){console.error("Token 验证错误:",S),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return o.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[l&&o.jsx(Ate,{}),o.jsxs(_t,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[o.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"?o.jsx(k3,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):o.jsx(O3,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),o.jsxs(wn,{className:"space-y-4 text-center",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:o.jsx(EC,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Sn,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),o.jsx(Fr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),o.jsx(An,{children:o.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),o.jsxs("div",{className:"relative",children:[o.jsx(WD,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),o.jsx(Pe,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:w=>e(w.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&o.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:[o.jsx(Ou,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),o.jsx("span",{children:s})]}),o.jsx(me,{type:"submit",className:"w-full",disabled:n,children:n?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),o.jsxs(zr,{children:[o.jsx(h6,{asChild:!0,children:o.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:[o.jsx(xK,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token我该去哪里获得 Token"]})}),o.jsxs(Sr,{className:"sm:max-w-md",children:[o.jsxs(kr,{children:[o.jsxs(Or,{className:"flex items-center gap-2",children:[o.jsx(EC,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),o.jsx(ps,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(vK,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),o.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[o.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),o.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(tl,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),o.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:o.jsx("code",{className:"text-primary",children:"data/webui.json"})}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",o.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),o.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Ou,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[o.jsx("p",{className:"font-semibold",children:"安全提示"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[o.jsx("li",{children:"请妥善保管您的 Token不要泄露给他人"}),o.jsx("li",{children:"如需重置 Token请在登录后前往系统设置"})]})]})]})})]})]})]}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.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:[o.jsx(w3,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsxs(hn,{className:"flex items-center gap-2",children:[o.jsx(w3,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),o.jsx(fn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>c(!1),children:"关闭动画"})]})]})]})]})})]}),o.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:o.jsx("p",{children:lte})})]})}const nr=b.forwardRef(({className:t,...e},n)=>o.jsx("textarea",{className:ye("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}));nr.displayName="Textarea";var zte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pte=zte.reduce((t,e)=>{const n=qk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Lte="Separator",m9="horizontal",Ite=["horizontal","vertical"],rL=b.forwardRef((t,e)=>{const{decorative:n,orientation:r=m9,...s}=t,i=Bte(r)?r:m9,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return o.jsx(Pte.div,{"data-orientation":i,...l,...s,ref:e})});rL.displayName=Lte;function Bte(t){return Ite.includes(t)}var sL=rL;const Fm=b.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>o.jsx(sL,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));Fm.displayName=sL.displayName;const qte=Lh("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 Ln({className:t,variant:e,...n}){return o.jsx("div",{className:ye(qte({variant:e}),t),...n})}function Fte({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 o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"qq_account",children:"QQ账号 *"}),o.jsx(Pe,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"nickname",children:"昵称 *"}),o.jsx(Pe,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{children:"别名"}),o.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>o.jsxs(Ln,{variant:"secondary",className:"gap-1",children:[s,o.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:o.jsx(_0,{className:"h-3 w-3"})})]},i))}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),o.jsx(me,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function $te({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"personality",children:"人格特征 *"}),o.jsx(nr,{id:"personality",placeholder:"描述机器人的人格特质和身份特征建议120字以内",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"reply_style",children:"表达风格 *"}),o.jsx(nr,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"interest",children:"兴趣 *"}),o.jsx(nr,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),o.jsx(Fm,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"plan_style",children:"群聊说话规则 *"}),o.jsx(nr,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),o.jsx(nr,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function Qte({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{htmlFor:"emoji_chance",children:"表情包激活概率"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),o.jsx(Pe,{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)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"max_reg_num",children:"最大表情包数量"}),o.jsx(Pe,{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)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"do_replace",children:"达到最大数量时替换"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),o.jsx(Tt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),o.jsx(Pe,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),o.jsx(Fm,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"steal_emoji",children:"偷取表情包"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),o.jsx(Tt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"content_filtration",children:"启用表情包过滤"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),o.jsx(Tt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"filtration_prompt",children:"过滤要求"}),o.jsx(Pe,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function Hte({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"enable_tool",children:"启用工具系统"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),o.jsx(Tt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),o.jsx(Fm,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"enable_mood",children:"启用情绪系统"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),o.jsx(Tt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&o.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),o.jsx(Pe,{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)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"emotion_style",children:"情感特征"}),o.jsx(nr,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),o.jsx(Fm,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"all_global",children:"启用全局黑话模式"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),o.jsx(Tt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}function Vte({config:t,onChange:e}){const[n,r]=b.useState(!1);return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"mt-0.5",children:o.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),o.jsxs("div",{className:"flex-1 text-sm",children:[o.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),o.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),o.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",o.jsx(Yd,{className:"h-3 w-3"})]})]})]})}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),o.jsxs("div",{className:"relative",children:[o.jsx(Pe,{id:"siliconflow_api_key",type:n?"text":"password",placeholder:"sk-...",value:t.api_key,onChange:s=>e({api_key:s.target.value}),className:"font-mono pr-10"}),o.jsx(me,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>r(!n),children:n?o.jsx(b1,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(sa,{className:"h-4 w-4 text-muted-foreground"})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),o.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[o.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[o.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),o.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),o.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),o.jsx("li",{children:"SenseVoice - 语音识别"}),o.jsx("li",{children:"BGE-M3 - 文本嵌入"}),o.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),o.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:o.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[o.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function mt(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 Nt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function Ute(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});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 Wte(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});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 Gte(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});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 Xte(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});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 Yte(){const t=await mt("/api/webui/config/model",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取模型配置失败");return{api_key:((await t.json()).config.api_providers||[]).find(i=>i.name==="SiliconFlow")?.api_key||""}}async function Kte(t){const e=await mt("/api/webui/config/bot/section/bot",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function Zte(t){const e=await mt("/api/webui/config/bot/section/personality",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function Jte(t){const e=await mt("/api/webui/config/bot/section/emoji",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function ene(t){const e=[];e.push(mt("/api/webui/config/bot/section/tool",{method:"POST",headers:Nt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(mt("/api/webui/config/bot/section/jargon",{method:"POST",headers:Nt(),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(mt("/api/webui/config/bot/section/mood",{method:"POST",headers:Nt(),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 tne(t){const e=await mt("/api/webui/config/model",{method:"GET",headers:Nt()});if(!e.ok)throw new Error("读取模型配置失败");const r=(await e.json()).config,s=r.api_providers||[],i=s.findIndex(c=>c.name==="SiliconFlow");i>=0?s[i]={...s[i],api_key:t.api_key}:s.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:t.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const a={...r,api_providers:s},l=await mt("/api/webui/config/model",{method:"POST",headers:Nt(),body:JSON.stringify(a)});if(!l.ok){const c=await l.json();throw new Error(c.detail||"保存模型配置失败")}return await l.json()}async function p9(){const t=localStorage.getItem("access-token"),e=await mt("/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()}async function Bv(){const t=await mt("/api/webui/system/restart",{method:"POST",headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"重启失败")}return await t.json()}async function nne(){const t=await mt("/api/webui/system/status",{method:"GET",headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取状态失败")}return await t.json()}function rne(){const t=Ca(),{toast:e}=Wr(),[n,r]=b.useState(0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,h]=b.useState(!0),[f,m]=b.useState({qq_account:0,nickname:"",alias_names:[]}),[g,x]=b.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用
2.如果相同的内容已经被执行,请不要重复执行
3.请控制你的发言频率,不要太过频繁的发言
4.如果有人对你感到厌烦,请减少回复
5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用
2.如果相同的内容已经被执行,请不要重复执行
3.某句话如果已经被回复过,不要重复回复`}),[y,w]=b.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,k]=b.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遇遇特定事件的时候起伏较大",all_global:!0}),[N,C]=b.useState({api_key:""}),[T,_]=b.useState(!1),[E,M]=b.useState(""),q=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:bK},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:GD},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Xk},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:vu},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:WD}],L=(n+1)/q.length*100;b.useEffect(()=>{(async()=>{try{h(!0);const[W,J,X,R,se]=await Promise.all([Ute(),Wte(),Gte(),Xte(),Yte()]);m(W),x(J),w(X),k(R),C(se)}catch(W){e({title:"加载配置失败",description:W instanceof Error?W.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const I=async()=>{l(!0);try{switch(n){case 0:await Kte(f);break;case 1:await Zte(g);break;case 2:await Jte(y);break;case 3:await ene(S);break;case 4:await tne(N);break}return e({title:"保存成功",description:`${q[n].title}配置已保存`}),!0}catch(P){return e({title:"保存失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"}),!1}finally{l(!1)}},$=async()=>{await I()&&n<q.length-1&&r(n+1)},V=()=>{n>0&&r(n-1)},ee=async()=>{i(!0),_(!0);try{if(M("正在保存API配置..."),!await I()){i(!1),_(!1);return}M("正在完成初始化..."),await p9(),M("正在重启麦麦..."),await Bv(),e({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),M("等待麦麦重启完成...");const W=60;let J=0,X=!1;for(;J<W&&!X;){await new Promise(R=>setTimeout(R,1e3));try{(await nne()).running&&(X=!0,M("重启成功!正在跳转..."))}catch{J++}}if(!X)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{t({to:"/"})},1e3)}catch(P){_(!1),e({title:"配置失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}finally{i(!1)}},z=async()=>{try{await p9(),t({to:"/"})}catch(P){e({title:"跳过失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}},H=()=>{switch(n){case 0:return o.jsx(Fte,{config:f,onChange:m});case 1:return o.jsx($te,{config:g,onChange:x});case 2:return o.jsx(Qte,{config:y,onChange:w});case 3:return o.jsx(Hte,{config:S,onChange:k});case 4:return o.jsx(Vte,{config:N,onChange:C});default:return null}};return o.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:[T&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:o.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[o.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:o.jsx(dh,{className:"h-10 w-10 animate-spin text-primary"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),o.jsx("p",{className:"text-muted-foreground",children:E})]}),o.jsx("div",{className:"w-full",children:o.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:o.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),o.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[o.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"}),o.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"})]}),c?o.jsxs("div",{className:"relative z-10 text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:o.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),o.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),o.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[o.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[o.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:o.jsx(yK,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),o.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),o.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",d6," 的初始配置"]})]}),o.jsxs("div",{className:"mb-6 md:mb-8",children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[o.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",q.length]}),o.jsxs("span",{className:"font-medium text-primary",children:[Math.round(L),"%"]})]}),o.jsx(I0,{value:L,className:"h-2"})]}),o.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:q.map((P,W)=>{const J=P.icon;return o.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",W<q.length-1&&"relative"),children:[W<q.length-1&&o.jsx("div",{className:ye("absolute left-1/2 top-3 md:top-4 h-0.5 w-full",W<n?"bg-primary":"bg-border")}),o.jsx("div",{className:ye("relative z-10 flex h-6 w-6 md:h-8 md:w-8 items-center justify-center rounded-full border-2 transition-all",W===n||W<n?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-muted-foreground"),children:W<n?o.jsx(pc,{className:"h-3 w-3 md:h-4 md:w-4",strokeWidth:2.5,fill:"none"}):o.jsx(J,{className:"h-3 w-3 md:h-4 md:w-4"})}),o.jsx("span",{className:ye("text-[10px] md:text-xs text-center max-w-[60px] md:max-w-none truncate md:whitespace-normal",W===n?"font-medium text-foreground":"text-muted-foreground"),title:P.title,children:P.title})]},P.id)})}),o.jsx(_t,{className:"mb-6 md:mb-8 shadow-lg",children:o.jsx(An,{className:"p-4 md:p-8",children:o.jsxs("div",{className:"min-h-[300px] md:min-h-[400px]",children:[o.jsxs("div",{className:"mb-4 md:mb-6",children:[o.jsx("h2",{className:"mb-2 text-xl md:text-2xl font-semibold",children:q[n].title}),o.jsx("p",{className:"text-sm md:text-base text-muted-foreground",children:q[n].description})]}),o.jsx(kn,{className:"h-[400px] md:h-[500px]",children:o.jsx("div",{className:"pr-2",children:H()})})]})})}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 sm:gap-0",children:[o.jsx(me,{variant:"outline",onClick:V,disabled:n===0||a,className:"w-full sm:w-auto order-2 sm:order-1",children:"上一步"}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto order-1 sm:order-2",children:[o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs(me,{variant:"ghost",className:"flex-1 sm:flex-none gap-2",disabled:a||s,children:[o.jsx(wK,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"跳过向导"]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认跳过配置向导"}),o.jsx(fn,{children:"您可以随时在系统设置中重新进入配置向导。确定要跳过吗?"})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:z,children:"确认跳过"})]})]})]}),n===q.length-1?o.jsx(me,{onClick:ee,disabled:s||a,className:"flex-1 sm:flex-none",children:s||a?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),a?"保存中...":"完成中..."]}):o.jsxs(o.Fragment,{children:["完成配置",o.jsx(pc,{className:"ml-2 h-4 w-4",strokeWidth:2,fill:"none"})]})}):o.jsx(me,{onClick:$,disabled:a,className:"flex-1 sm:flex-none",children:a?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"保存中..."]}):o.jsxs(o.Fragment,{children:["下一步",o.jsx(SK,{className:"ml-2 h-4 w-4",strokeWidth:2,fill:"none"})]})})]})]})]}),o.jsx("div",{className:"relative z-10 mt-6 md:mt-8 text-center text-xs text-muted-foreground",children:o.jsx("p",{children:"您可以随时在设置中修改这些配置"})})]})]})}function iL(){const t=Ca();return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:o.jsxs("div",{className:"w-full max-w-2xl text-center",children:[o.jsxs("div",{className:"relative mb-8",children:[o.jsx("h1",{className:"text-[150px] font-black leading-none text-primary/10 select-none sm:text-[200px]",children:"404"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx(ii,{className:"h-20 w-20 text-primary/30 sm:h-24 sm:w-24"})})]}),o.jsxs("div",{className:"space-y-4 mb-8",children:[o.jsx("h2",{className:"text-2xl font-bold text-foreground sm:text-3xl",children:"页面未找到"}),o.jsx("p",{className:"text-base text-muted-foreground sm:text-lg max-w-md mx-auto",children:"抱歉,您访问的页面不存在或已被移除。请检查 URL 是否正确,或返回首页继续浏览。"})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[o.jsxs(me,{size:"lg",onClick:()=>t({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[o.jsx(w1,{className:"h-4 w-4"}),"返回首页"]}),o.jsxs(me,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[o.jsx(XD,{className:"h-4 w-4"}),"返回上一页"]})]}),o.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var aL=["PageUp","PageDown"],oL=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],lL={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ih="Slider",[P3,sne,ine]=Sv(Ih),[cL]=Ta(Ih,[ine]),[ane,qv]=cL(Ih),uL=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:a="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:y,...w}=t,S=b.useRef(new Set),k=b.useRef(0),C=a==="horizontal"?one:lne,[T=[],_]=Cc({prop:f,defaultProp:h,onChange:$=>{[...S.current][k.current]?.focus(),m($)}}),E=b.useRef(T);function M($){const V=fne(T,$);I($,V)}function q($){I($,k.current)}function L(){const $=E.current[k.current];T[k.current]!==$&&g(T)}function I($,V,{commit:ee}={commit:!1}){const z=xne(i),H=vne(Math.round(($-r)/i)*i+r,z),P=Bk(H,[r,s]);_((W=[])=>{const J=dne(W,P,V);if(gne(J,c*i)){k.current=J.indexOf(P);const X=String(J)!==String(W);return X&&ee&&g(J),X?J:W}else return W})}return o.jsx(ane,{scope:t.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:k,thumbs:S.current,values:T,orientation:a,form:y,children:o.jsx(P3.Provider,{scope:t.__scopeSlider,children:o.jsx(P3.Slot,{scope:t.__scopeSlider,children:o.jsx(C,{"aria-disabled":l,"data-disabled":l?"":void 0,...w,ref:e,onPointerDown:Ze(w.onPointerDown,()=>{l||(E.current=T)}),min:r,max:s,inverted:x,onSlideStart:l?void 0:M,onSlideMove:l?void 0:q,onSlideEnd:l?void 0:L,onHomeKeyDown:()=>!l&&I(r,0,{commit:!0}),onEndKeyDown:()=>!l&&I(s,T.length-1,{commit:!0}),onStepKeyDown:({event:$,direction:V})=>{if(!l){const H=aL.includes($.key)||$.shiftKey&&oL.includes($.key)?10:1,P=k.current,W=T[P],J=i*H*V;I(W+J,P,{commit:!0})}}})})})})});uL.displayName=Ih;var[dL,hL]=cL(Ih,{startEdge:"left",endEdge:"right",size:"width",direction:1}),one=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:a,onSlideMove:l,onSlideEnd:c,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),x=qn(e,C=>g(C)),y=b.useRef(void 0),w=T0(s),S=w==="ltr",k=S&&!i||!S&&i;function N(C){const T=y.current||m.getBoundingClientRect(),_=[0,T.width],M=f6(_,k?[n,r]:[r,n]);return y.current=T,M(C-T.left)}return o.jsx(dL,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:o.jsx(fL,{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);l?.(T)},onSlideEnd:()=>{y.current=void 0,c?.()},onStepKeyDown:C=>{const _=lL[k?"from-left":"from-right"].includes(C.key);h?.({event:C,direction:_?-1:1})}})})}),lne=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:l,onStepKeyDown:c,...h}=t,f=b.useRef(null),m=qn(e,f),g=b.useRef(void 0),x=!s;function y(w){const S=g.current||f.current.getBoundingClientRect(),k=[0,S.height],C=f6(k,x?[r,n]:[n,r]);return g.current=S,C(w-S.top)}return o.jsx(dL,{scope:t.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:o.jsx(fL,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const S=y(w.clientY);i?.(S)},onSlideMove:w=>{const S=y(w.clientY);a?.(S)},onSlideEnd:()=>{g.current=void 0,l?.()},onStepKeyDown:w=>{const k=lL[x?"from-bottom":"from-top"].includes(w.key);c?.({event:w,direction:k?-1:1})}})})}),fL=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:l,onStepKeyDown:c,...h}=t,f=qv(Ih,n);return o.jsx(xn.span,{...h,ref:e,onKeyDown:Ze(t.onKeyDown,m=>{m.key==="Home"?(a(m),m.preventDefault()):m.key==="End"?(l(m),m.preventDefault()):aL.concat(oL).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:Ze(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:Ze(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:Ze(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),mL="SliderTrack",pL=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=qv(mL,n);return o.jsx(xn.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});pL.displayName=mL;var L3="SliderRange",gL=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=qv(L3,n),i=hL(L3,n),a=b.useRef(null),l=qn(e,a),c=s.values.length,h=s.values.map(g=>yL(g,s.min,s.max)),f=c>1?Math.min(...h):0,m=100-Math.max(...h);return o.jsx(xn.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});gL.displayName=L3;var I3="SliderThumb",xL=b.forwardRef((t,e)=>{const n=sne(t.__scopeSlider),[r,s]=b.useState(null),i=qn(e,l=>s(l)),a=b.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return o.jsx(cne,{...t,ref:i,index:a})}),cne=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,a=qv(I3,n),l=hL(I3,n),[c,h]=b.useState(null),f=qn(e,N=>h(N)),m=c?a.form||!!c.closest("form"):!0,g=TD(c),x=a.values[r],y=x===void 0?0:yL(x,a.min,a.max),w=hne(r,a.values.length),S=g?.[l.size],k=S?mne(S,y,l.direction):0;return b.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${y}% + ${k}px)`},children:[o.jsx(P3.ItemSlot,{scope:t.__scopeSlider,children:o.jsx(xn.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:Ze(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),m&&o.jsx(vL,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:x},r)]})});xL.displayName=I3;var une="RadioBubbleInput",vL=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),i=qn(s,r),a=CD(e);return b.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==e&&f){const m=new Event("input",{bubbles:!0});f.call(l,e),l.dispatchEvent(m)}},[a,e]),o.jsx(xn.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});vL.displayName=une;function dne(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function yL(t,e,n){const i=100/(n-e)*(t-e);return Bk(i,[0,100])}function hne(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function fne(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 mne(t,e,n){const r=t/2,i=f6([0,50],[0,r]);return(r-i(e)*n)*n}function pne(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function gne(t,e){if(e>0){const n=pne(t);return Math.min(...n)>=e}return!0}function f6(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 xne(t){return(String(t).split(".")[1]||"").length}function vne(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var bL=uL,yne=pL,bne=gL,wne=xL;const B0=b.forwardRef(({className:t,...e},n)=>o.jsxs(bL,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[o.jsx(yne,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:o.jsx(bne,{className:"absolute h-full bg-primary"})}),o.jsx(wne,{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"})]}));B0.displayName=bL.displayName;const Dt=iK,zt=aK,Mt=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(AD,{ref:r,className:ye("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,o.jsx(eK,{asChild:!0,children:o.jsx(Im,{className:"h-4 w-4 opacity-50"})})]}));Mt.displayName=AD.displayName;const wL=b.forwardRef(({className:t,...e},n)=>o.jsx(RD,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(j3,{className:"h-4 w-4"})}));wL.displayName=RD.displayName;const SL=b.forwardRef(({className:t,...e},n)=>o.jsx(DD,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(Im,{className:"h-4 w-4"})}));SL.displayName=DD.displayName;const At=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>o.jsx(tK,{children:o.jsxs(zD,{ref:s,className:ye("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:[o.jsx(wL,{}),o.jsx(nK,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),o.jsx(SL,{})]})}));At.displayName=zD.displayName;const Sne=b.forwardRef(({className:t,...e},n)=>o.jsx(PD,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));Sne.displayName=PD.displayName;const ze=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(LD,{ref:r,className:ye("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:[o.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(rK,{children:o.jsx(dc,{className:"h-4 w-4"})})}),o.jsx(sK,{children:e})]}));ze.displayName=LD.displayName;const kne=b.forwardRef(({className:t,...e},n)=>o.jsx(ID,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));kne.displayName=ID.displayName;function One(t){const e=jne(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,l=b.Children.toArray(i),c=l.find(Cne);if(c){const h=c.props.children,f=l.map(m=>m===c?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return o.jsx(e,{...a,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return o.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function jne(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=Ene(s),l=Tne(i,s.props);return s.type!==b.Fragment&&(l.ref=r?mc(r,a):a),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Nne=Symbol("radix.slottable");function Cne(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Nne}function Tne(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]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Ene(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 Fv="Popover",[kL]=Ta(Fv,[Ah]),q0=Ah(),[_ne,Tc]=kL(Fv),OL=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=t,l=q0(e),c=b.useRef(null),[h,f]=b.useState(!1),[m,g]=Cc({prop:r,defaultProp:s??!1,onChange:i,caller:Fv});return o.jsx(Nv,{...l,children:o.jsx(_ne,{scope:e,contentId:ea(),triggerRef:c,open:m,onOpenChange:g,onOpenToggle:b.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:h,onCustomAnchorAdd:b.useCallback(()=>f(!0),[]),onCustomAnchorRemove:b.useCallback(()=>f(!1),[]),modal:a,children:n})})};OL.displayName=Fv;var jL="PopoverAnchor",Mne=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Tc(jL,n),i=q0(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:l}=s;return b.useEffect(()=>(a(),()=>l()),[a,l]),o.jsx(Cv,{...i,...r,ref:e})});Mne.displayName=jL;var NL="PopoverTrigger",CL=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Tc(NL,n),i=q0(n),a=qn(e,s.triggerRef),l=o.jsx(xn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":AL(s.open),...r,ref:a,onClick:Ze(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:o.jsx(Cv,{asChild:!0,...i,children:l})});CL.displayName=NL;var m6="PopoverPortal",[Ane,Rne]=kL(m6,{forceMount:void 0}),TL=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Tc(m6,e);return o.jsx(Ane,{scope:e,forceMount:n,children:o.jsx(ai,{present:n||i.open,children:o.jsx(jv,{asChild:!0,container:s,children:r})})})};TL.displayName=m6;var gh="PopoverContent",EL=b.forwardRef((t,e)=>{const n=Rne(gh,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Tc(gh,t.__scopePopover);return o.jsx(ai,{present:r||i.open,children:i.modal?o.jsx(zne,{...s,ref:e}):o.jsx(Pne,{...s,ref:e})})});EL.displayName=gh;var Dne=One("PopoverContent.RemoveScroll"),zne=b.forwardRef((t,e)=>{const n=Tc(gh,t.__scopePopover),r=b.useRef(null),s=qn(e,r),i=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return BD(a)},[]),o.jsx(qD,{as:Dne,allowPinchZoom:!0,children:o.jsx(_L,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ze(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ze(t.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,h=l.button===2||c;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:Ze(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Pne=b.forwardRef((t,e)=>{const n=Tc(gh,t.__scopePopover),r=b.useRef(!1),s=b.useRef(!1);return o.jsx(_L,{...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()}})}),_L=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:h,onInteractOutside:f,...m}=t,g=Tc(gh,n),x=q0(n);return FD(),o.jsx($D,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:o.jsx(Uk,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:h,onDismiss:()=>g.onOpenChange(!1),children:o.jsx(Wk,{"data-state":AL(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)"}})})})}),ML="PopoverClose",Lne=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Tc(ML,n);return o.jsx(xn.button,{type:"button",...r,ref:e,onClick:Ze(t.onClick,()=>s.onOpenChange(!1))})});Lne.displayName=ML;var Ine="PopoverArrow",Bne=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=q0(n);return o.jsx(Gk,{...s,...r,ref:e})});Bne.displayName=Ine;function AL(t){return t?"open":"closed"}var qne=OL,Fne=CL,$ne=TL,RL=EL;const cl=qne,ul=Fne,so=b.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>o.jsx($ne,{children:o.jsx(RL,{ref:s,align:e,sideOffset:n,className:ye("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})}));so.displayName=RL.displayName;const Ec="/api/webui/config";async function g9(){const e=await(await mt(`${Ec}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Zd(){const e=await(await mt(`${Ec}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function x9(t){const n=await(await mt(`${Ec}/bot`,{method:"POST",headers:Nt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function Qne(){const e=await(await mt(`${Ec}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function Hne(t){const n=await(await mt(`${Ec}/bot/raw`,{method:"POST",headers:Nt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function T1(t){const n=await(await mt(`${Ec}/model`,{method:"POST",headers:Nt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function Vne(t,e){const r=await(await mt(`${Ec}/bot/section/${t}`,{method:"POST",headers:Nt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function B3(t,e){const r=await(await mt(`${Ec}/model/section/${t}`,{method:"POST",headers:Nt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const Une=Lh("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"}}),nl=b.forwardRef(({className:t,variant:e,...n},r)=>o.jsx("div",{ref:r,role:"alert",className:ye(Une({variant:e}),t),...n}));nl.displayName="Alert";const Wne=b.forwardRef(({className:t,...e},n)=>o.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));Wne.displayName="AlertTitle";const rl=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));rl.displayName="AlertDescription";function p6({onRestartComplete:t,onRestartFailed:e}){const[n,r]=b.useState(0),[s,i]=b.useState("restarting"),[a,l]=b.useState(0),[c,h]=b.useState(0);b.useEffect(()=>{const g=setInterval(()=>{r(w=>w>=90?w:w+1)},200),x=setInterval(()=>{l(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{c<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 o.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:o.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[o.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&o.jsxs(o.Fragment,{children:[o.jsx(dh,{className:"h-16 w-16 text-primary animate-spin"}),o.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&o.jsxs(o.Fragment,{children:[o.jsx(dh,{className:"h-16 w-16 text-primary animate-spin"}),o.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),o.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",c,"/60)"]})]}),s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(pc,{className:"h-16 w-16 text-green-500"}),o.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&o.jsxs(o.Fragment,{children:[o.jsx(Ou,{className:"h-16 w-16 text-destructive"}),o.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(I0,{value:n,className:"h-2"}),o.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[o.jsxs("span",{children:[n,"%"]}),o.jsxs("span",{children:["已用时: ",m(a)]})]})]}),o.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),o.jsx("div",{className:"bg-yellow-500/10 border border-yellow-500/50 rounded-lg p-4",children:o.jsxs("p",{className:"text-sm text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"⚠️ 重要提示:"})," 由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})}),s==="failed"&&o.jsxs("div",{className:"flex gap-2",children:[o.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:"刷新页面"}),o.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 q3=[],DL=[];(()=>{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<t.length;e++)(e%2?DL:q3).push(n=n+t[e])})();function Gne(t){if(t<768)return!1;for(let e=0,n=q3.length;;){let r=e+n>>1;if(t<q3[r])n=r;else if(t>=DL[r])e=r+1;else return!0;if(e==n)return!1}}function v9(t){return t>=127462&&t<=127487}const y9=8205;function Xne(t,e,n=!0,r=!0){return(n?zL:Yne)(t,e,r)}function zL(t,e,n){if(e==t.length)return e;e&&PL(t.charCodeAt(e))&&LL(t.charCodeAt(e-1))&&e--;let r=sw(t,e);for(e+=b9(r);e<t.length;){let s=sw(t,e);if(r==y9||s==y9||n&&Gne(s))e+=b9(s),r=s;else if(v9(s)){let i=0,a=e-2;for(;a>=0&&v9(sw(t,a));)i++,a-=2;if(i%2==0)break;e+=2}else break}return e}function Yne(t,e,n){for(;e>0;){let r=zL(t,e-2,n);if(r<e)return r;e--}return 0}function sw(t,e){let n=t.charCodeAt(e);if(!LL(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return PL(r)?(n-55296<<10)+(r-56320)+65536:n}function PL(t){return t>=56320&&t<57344}function LL(t){return t>=55296&&t<56320}function b9(t){return t<65536?1:2}class an{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]=xh(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),Kx.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]=xh(this,e,n);let r=[];return this.decompose(e,n,r,0),Kx.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 Om(this),i=new Om(e);for(let a=n,l=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(l+=s.value.length,s.done||l>=r)return!0}}iter(e=1){return new Om(this,e)}iterRange(e,n=this.length){return new IL(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 BL(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]?an.empty:e.length<=32?new br(e):Kx.from(br.split(e,[]))}}class br extends an{constructor(e,n=Kne(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],l=s+a.length;if((n?r:l)>=e)return new Zne(s,l,r,a);s=l+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new br(w9(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let a=r.pop(),l=Zx(i.text,a.text.slice(),0,i.length);if(l.length<=32)r.push(new br(l,a.length+i.length));else{let c=l.length>>1;r.push(new br(l.slice(0,c)),new br(l.slice(c)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof br))return super.replace(e,n,r);[e,n]=xh(this,e,n);let s=Zx(this.text,Zx(r.text,w9(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new br(s,i):Kx.from(br.split(s,[]),i)}sliceString(e,n=this.length,r=`
`){[e,n]=xh(this,e,n);let s="";for(let i=0,a=0;i<=n&&a<this.text.length;a++){let l=this.text[a],c=i+l.length;i>e&&a&&(s+=r),e<c&&n>i&&(s+=l.slice(Math.max(0,e-i),n-i)),i=c+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 br(r,s)),r=[],s=-1);return s>-1&&n.push(new br(r,s)),n}}let Kx=class Pd extends an{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],l=s+a.length,c=r+a.lines-1;if((n?c:l)>=e)return a.lineInner(e,n,r,s);s=l+1,r=c+1}}decompose(e,n,r,s){for(let i=0,a=0;a<=n&&i<this.children.length;i++){let l=this.children[i],c=a+l.length;if(e<=c&&n>=a){let h=s&((a<=e?1:0)|(c>=n?2:0));a>=e&&c<=n&&!h?r.push(l):l.decompose(e-a,n-a,r,h)}a=c+1}}replace(e,n,r){if([e,n]=xh(this,e,n),r.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let a=this.children[s],l=i+a.length;if(e>=i&&n<=l){let c=a.replace(e-i,n-i,r),h=this.lines-a.lines+c.lines;if(c.lines<h>>4&&c.lines>h>>6){let f=this.children.slice();return f[s]=c,new Pd(f,this.length-(n-e)+r.length)}return super.replace(i,l,c)}i=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
`){[e,n]=xh(this,e,n);let s="";for(let i=0,a=0;i<this.children.length&&a<=n;i++){let l=this.children[i],c=a+l.length;a>e&&i&&(s+=r),e<c&&n>a&&(s+=l.sliceString(e-a,n-a,r)),a=c+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Pd))return 0;let r=0,[s,i,a,l]=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==l)return r;let c=this.children[s],h=e.children[i];if(c!=h)return r+c.scanIdentical(h,n);r+=c.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 br(x,n)}let s=Math.max(32,r>>5),i=s<<1,a=s>>1,l=[],c=0,h=-1,f=[];function m(x){let y;if(x.lines>i&&x instanceof Pd)for(let w of x.children)m(w);else x.lines>a&&(c>a||!c)?(g(),l.push(x)):x instanceof br&&c&&(y=f[f.length-1])instanceof br&&x.lines+y.lines<=32?(c+=x.lines,h+=x.length+1,f[f.length-1]=new br(y.text.concat(x.text),y.length+1+x.length)):(c+x.lines>s&&g(),c+=x.lines,h+=x.length+1,f.push(x))}function g(){c!=0&&(l.push(f.length==1?f[0]:Pd.from(f,h)),h=-1,c=f.length=0)}for(let x of e)m(x);return g(),l.length==1?l[0]:new Pd(l,n)}};an.empty=new br([""],0);function Kne(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Zx(t,e,n=0,r=1e9){for(let s=0,i=0,a=!0;i<t.length&&s<=r;i++){let l=t[i],c=s+l.length;c>=n&&(c>r&&(l=l.slice(0,r-s)),s<n&&(l=l.slice(n-s)),a?(e[e.length-1]+=l,a=!1):e.push(l)),s=c+1}return e}function w9(t,e,n){return Zx(t,[""],e,n)}class Om{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof br?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,l=s instanceof br?s.text.length:s.children.length;if(a==(n>0?l: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 br){let c=s.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,c.length>Math.max(0,e))return this.value=e==0?c:n>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=s.children[a+(n<0?-1:0)];e>c.length?(e-=c.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof br?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class IL{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Om(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 BL{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"&&(an.prototype[Symbol.iterator]=function(){return this.iter()},Om.prototype[Symbol.iterator]=IL.prototype[Symbol.iterator]=BL.prototype[Symbol.iterator]=function(){return this});class Zne{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 xh(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function hs(t,e,n=!0,r=!0){return Xne(t,e,n,r)}function Jne(t){return t>=56320&&t<57344}function ere(t){return t>=55296&&t<56320}function Ys(t,e){let n=t.charCodeAt(e);if(!ere(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Jne(r)?(n-55296<<10)+(r-56320)+65536:n}function g6(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Ua(t){return t<65536?1:2}const F3=/\r\n?|\n/;var ds=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(ds||(ds={}));class no{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,s=0;n<this.sections.length;){let i=this.sections[n++],a=this.sections[n++];a<0?(e(r,s,i),s+=i):s+=a,r+=i}}iterChangedRanges(e,n=!1){$3(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];s<0?e.push(r,s):e.push(s,r)}return new no(e)}composeDesc(e){return this.empty?e:e.empty?this:qL(this,e)}mapDesc(e,n=!1){return e.empty?this:Q3(this,e,n)}mapPos(e,n=-1,r=ds.Simple){let s=0,i=0;for(let a=0;a<this.sections.length;){let l=this.sections[a++],c=this.sections[a++],h=s+l;if(c<0){if(h>e)return i+(e-s);i+=l}else{if(r!=ds.Simple&&h>=e&&(r==ds.TrackDel&&s<e&&h>e||r==ds.TrackBefore&&s<e||r==ds.TrackAfter&&h>e))return null;if(h>e||h==e&&n<0&&!l)return e==s||n<0?i:i+c;i+=c}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<this.sections.length&&s<=n;){let i=this.sections[r++],a=this.sections[r++],l=s+i;if(a>=0&&s<=n&&l>=e)return s<e&&l>n?"cover":!0;s=l}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];e+=(e?" ":"")+r+(s>=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 no(e)}static create(e){return new no(e)}}class $r extends no{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 $3(this,(n,r,s,i,a)=>e=e.replace(s,s+(r-n),a),!1),e}mapDesc(e,n=!1){return Q3(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s<n.length;s+=2){let a=n[s],l=n[s+1];if(l>=0){n[s]=l,n[s+1]=a;let c=s>>1;for(;r.length<c;)r.push(an.empty);r.push(a?e.slice(i,i+a):an.empty)}i+=a}return new $r(n,r)}compose(e){return this.empty?e:e.empty?this:qL(this,e,!0)}map(e,n=!1){return e.empty?this:Q3(this,e,n,!0)}iterChanges(e,n=!1){$3(this,e,n)}get desc(){return no.create(this.sections)}filter(e){let n=[],r=[],s=[],i=new $m(this);e:for(let a=0,l=0;;){let c=a==e.length?1e9:e[a++];for(;l<c||l==c&&i.len==0;){if(i.done)break e;let f=Math.min(i.len,c-l);vs(s,f,-1);let m=i.ins==-1?-1:i.off==0?i.ins:0;vs(n,f,m),m>0&&lc(r,n,i.text),i.forward(f),l+=f}let h=e[a++];for(;l<h;){if(i.done)break e;let f=Math.min(i.len,h-l);vs(n,f,-1),vs(s,f,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(f),l+=f}}return{changes:new $r(n,r),filtered:no.create(s)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],s=this.sections[n+1];s<0?e.push(r):s==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],a=0,l=null;function c(f=!1){if(!f&&!s.length)return;a<n&&vs(s,n-a,-1);let m=new $r(s,i);l=l?l.compose(m.map(l)):m,s=[],i=[],a=0}function h(f){if(Array.isArray(f))for(let m of f)h(m);else if(f instanceof $r){if(f.length!=n)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${n})`);c(),l=l?l.compose(f.map(l)):f}else{let{from:m,to:g=m,insert:x}=f;if(m>g||m<0||g>n)throw new RangeError(`Invalid change range ${m} to ${g} (in doc of length ${n})`);let y=x?typeof x=="string"?an.of(x.split(r||F3)):x:an.empty,w=y.length;if(m==g&&w==0)return;m<a&&c(),m>a&&vs(s,m-a,-1),vs(s,g-m,w),lc(i,s,y),a=g}}return h(e),c(!l),l}static empty(e){return new $r(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;s<e.length;s++){let i=e[s];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((a,l)=>l&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length<s;)r.push(an.empty);r[s]=an.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new $r(n,r)}static createSet(e,n){return new $r(e,n)}}function vs(t,e,n,r=!1){if(e==0&&n<=0)return;let s=t.length-2;s>=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 lc(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(an.empty);t.push(n)}}function $3(t,e,n){let r=t.inserted;for(let s=0,i=0,a=0;a<t.sections.length;){let l=t.sections[a++],c=t.sections[a++];if(c<0)s+=l,i+=l;else{let h=s,f=i,m=an.empty;for(;h+=l,f+=c,c&&r&&(m=m.append(r[a-2>>1])),!(n||a==t.sections.length||t.sections[a+1]<0);)l=t.sections[a++],c=t.sections[a++];e(s,h,i,f,m),s=h,i=f}}}function Q3(t,e,n,r=!1){let s=[],i=r?[]:null,a=new $m(t),l=new $m(e);for(let c=-1;;){if(a.done&&l.len||l.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&l.ins==-1){let h=Math.min(a.len,l.len);vs(s,h,-1),a.forward(h),l.forward(h)}else if(l.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(l.len<a.len||l.len==a.len&&!n))){let h=l.len;for(vs(s,l.ins,-1);h;){let f=Math.min(a.len,h);a.ins>=0&&c<a.i&&a.len<=f&&(vs(s,0,a.ins),i&&lc(i,s,a.text),c=a.i),a.forward(f),h-=f}l.next()}else if(a.ins>=0){let h=0,f=a.len;for(;f;)if(l.ins==-1){let m=Math.min(f,l.len);h+=m,f-=m,l.forward(m)}else if(l.ins==0&&l.len<f)f-=l.len,l.next();else break;vs(s,h,c<a.i?a.ins:0),i&&c<a.i&&lc(i,s,a.text),c=a.i,a.forward(a.len-f)}else{if(a.done&&l.done)return i?$r.createSet(s,i):no.create(s);throw new Error("Mismatched change set lengths")}}}function qL(t,e,n=!1){let r=[],s=n?[]:null,i=new $m(t),a=new $m(e);for(let l=!1;;){if(i.done&&a.done)return s?$r.createSet(r,s):no.create(r);if(i.ins==0)vs(r,i.len,0,l),i.next();else if(a.len==0&&!a.done)vs(r,0,a.ins,l),s&&lc(s,r,a.text),a.next();else{if(i.done||a.done)throw new Error("Mismatched change set lengths");{let c=Math.min(i.len2,a.len),h=r.length;if(i.ins==-1){let f=a.ins==-1?-1:a.off?0:a.ins;vs(r,c,f,l),s&&f&&lc(s,r,a.text)}else a.ins==-1?(vs(r,i.off?0:i.len,c,l),s&&lc(s,r,i.textBit(c))):(vs(r,i.off?0:i.len,a.off?0:a.ins,l),s&&!a.off&&lc(s,r,a.text));l=(i.ins>c||a.ins>=0&&a.len>c)&&(l||r.length>h),i.forward2(c),a.forward(c)}}}}class $m{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?an.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?an.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 fu{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 fu(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Ae.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ae.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 Ae.range(e.anchor,e.head)}static create(e,n,r){return new fu(e,n,r)}}class Ae{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ae.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;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Ae([this.main],0)}addRange(e,n=!0){return Ae.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,Ae.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.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 Ae(e.ranges.map(n=>fu.fromJSON(n)),e.main)}static single(e,n=e){return new Ae([Ae.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;s<e.length;s++){let i=e[s];if(i.empty?i.from<=r:i.from<r)return Ae.normalized(e.slice(),n);r=i.to}return new Ae(e,n)}static cursor(e,n=0,r,s){return fu.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(s??16777215)<<6)}static range(e,n,r,s){let i=(r??16777215)<<6|(s==null?7:Math.min(6,s));return n<e?fu.create(n,e,48|i):fu.create(e,n,(n>e?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;s<e.length;s++){let i=e[s],a=e[s-1];if(i.empty?i.from<=a.to:i.from<a.to){let l=a.from,c=Math.max(i.to,a.to);s<=n&&n--,e.splice(--s,2,i.anchor>i.head?Ae.range(c,l):Ae.range(l,c))}}return new Ae(e,n)}}function FL(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let x6=0;class et{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=x6++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new et(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:v6),!!e.static,e.enables)}of(e){return new Jx([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Jx(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Jx(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function v6(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Jx{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=x6++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,a=e[i]>>1,l=this.type==2,c=!1,h=!1,f=[];for(let m of this.dependencies)m=="doc"?c=!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(c&&g.docChanged||h&&(g.docChanged||g.selection)||H3(m,f)){let x=r(m);if(l?!S9(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=_1(g,y);if(this.dependencies.every(S=>S instanceof et?g.facet(S)===m.facet(S):S instanceof rs?g.field(S,!1)==m.field(S,!1):!0)||(l?S9(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 S9(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function H3(t,e){let n=!1;for(let r of e)jm(t,r)&1&&(n=!0);return n}function tre(t,e,n){let r=n.map(c=>t[c.id]),s=n.map(c=>c.type),i=r.filter(c=>!(c&1)),a=t[e.id]>>1;function l(c){let h=[];for(let f=0;f<r.length;f++){let m=_1(c,r[f]);if(s[f]==2)for(let g of m)h.push(g);else h.push(m)}return e.combine(h)}return{create(c){for(let h of r)jm(c,h);return c.values[a]=l(c),1},update(c,h){if(!H3(c,i))return 0;let f=l(c);return e.compare(f,c.values[a])?0:(c.values[a]=f,1)},reconfigure(c,h){let f=H3(c,r),m=h.config.facets[e.id],g=h.facet(e);if(m&&!f&&v6(n,m))return c.values[a]=g,0;let x=l(c);return e.compare(x,g)?(c.values[a]=g,0):(c.values[a]=x,1)}}}const Vg=et.define({static:!0});class rs{constructor(e,n,r,s,i){this.id=e,this.createF=n,this.updateF=r,this.compareF=s,this.spec=i,this.provides=void 0}static define(e){let n=new rs(x6++,e.create,e.update,e.compare||((r,s)=>r===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Vg).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(Vg),a=s.facet(Vg),l;return(l=i.find(c=>c.field==this))&&l!=a.find(c=>c.field==this)?(r.values[n]=l.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,Vg.of({field:this,create:e})]}get extension(){return this}}const cu={lowest:4,low:3,default:2,high:1,highest:0};function Yf(t){return e=>new $L(e,t)}const _c={highest:Yf(cu.highest),high:Yf(cu.high),default:Yf(cu.default),low:Yf(cu.low),lowest:Yf(cu.lowest)};class $L{constructor(e,n){this.inner=e,this.prec=n}}class $v{of(e){return new V3(this,e)}reconfigure(e){return $v.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class V3{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<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let s=[],i=Object.create(null),a=new Map;for(let g of nre(e,n,a))g instanceof rs?s.push(g):(i[g.facet.id]||(i[g.facet.id]=[])).push(g);let l=Object.create(null),c=[],h=[];for(let g of s)l[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(S=>S.type==0))if(l[y.id]=c.length<<1|1,v6(w,x))c.push(r.facet(y));else{let S=y.combine(x.map(k=>k.value));c.push(r&&y.compare(S,r.facet(y))?r.facet(y):S)}else{for(let S of x)S.type==0?(l[S.id]=c.length<<1|1,c.push(S.value)):(l[S.id]=h.length<<1,h.push(k=>S.dynamicSlot(k)));l[y.id]=h.length<<1,h.push(S=>tre(S,y,x))}}let m=h.map(g=>g(l));return new E1(e,a,m,l,c,i)}}function nre(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(a,l){let c=s.get(a);if(c!=null){if(c<=l)return;let h=r[c].indexOf(a);h>-1&&r[c].splice(h,1),a instanceof V3&&n.delete(a.compartment)}if(s.set(a,l),Array.isArray(a))for(let h of a)i(h,l);else if(a instanceof V3){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,l)}else if(a instanceof $L)i(a.inner,a.prec);else if(a instanceof rs)r[l].push(a),a.provides&&i(a.provides,l);else if(a instanceof Jx)r[l].push(a),a.facet.extensions&&i(a.facet.extensions,cu.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,l)}}return i(t,cu.default),r.reduce((a,l)=>a.concat(l))}function jm(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 _1(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const QL=et.define(),U3=et.define({combine:t=>t.some(e=>e),static:!0}),HL=et.define({combine:t=>t.length?t[0]:void 0,static:!0}),VL=et.define(),UL=et.define(),WL=et.define(),GL=et.define({combine:t=>t.length?t[0]:!1});class lo{constructor(e,n){this.type=e,this.value=n}static define(){return new rre}}class rre{of(e){return new lo(this,e)}}class sre{constructor(e){this.map=e}of(e){return new Et(this,e)}}class Et{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 Et(this.type,n)}is(e){return this.type==e}static define(e={}){return new sre(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}}Et.reconfigure=Et.define();Et.appendConfig=Et.define();class Dr{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&&FL(r,n.newLength),i.some(l=>l.type==Dr.time)||(this.annotations=i.concat(Dr.time.of(Date.now())))}static create(e,n,r,s,i,a){return new Dr(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(Dr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Dr.time=lo.define();Dr.userEvent=lo.define();Dr.addToHistory=lo.define();Dr.remote=lo.define();function ire(t,e){let n=[];for(let r=0,s=0;;){let i,a;if(r<t.length&&(s==e.length||e[s]>=t[r]))i=t[r++],a=t[r++];else if(s<e.length)i=e[s++],a=e[s++];else return n;!n.length||n[n.length-1]<i?n.push(i,a):n[n.length-1]<a&&(n[n.length-1]=a)}}function XL(t,e,n){var r;let s,i,a;return n?(s=e.changes,i=$r.empty(e.changes.length),a=t.changes.compose(e.changes)):(s=e.changes.map(t.changes),i=t.changes.mapDesc(e.changes,!0),a=t.changes.compose(s)),{changes:a,selection:e.selection?e.selection.map(i):(r=t.selection)===null||r===void 0?void 0:r.map(s),effects:Et.mapEffects(t.effects,s).concat(Et.mapEffects(e.effects,i)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function W3(t,e,n){let r=e.selection,s=Jd(e.annotations);return e.userEvent&&(s=s.concat(Dr.userEvent.of(e.userEvent))),{changes:e.changes instanceof $r?e.changes:$r.of(e.changes||[],n,t.facet(HL)),selection:r&&(r instanceof Ae?r:Ae.single(r.anchor,r.head)),effects:Jd(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function YL(t,e,n){let r=W3(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let i=1;i<e.length;i++){e[i].filter===!1&&(n=!1);let a=!!e[i].sequential;r=XL(r,W3(t,e[i],a?r.changes.newLength:t.doc.length),a)}let s=Dr.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return ore(n?are(s):s)}function are(t){let e=t.startState,n=!0;for(let s of e.facet(VL)){let i=s(t);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:ire(n,i))}if(n!==!0){let s,i;if(n===!1)i=t.changes.invertedDesc,s=$r.empty(e.doc.length);else{let a=t.changes.filter(n);s=a.changes,i=a.filtered.mapDesc(a.changes).invertedDesc}t=Dr.create(e,s,t.selection&&t.selection.map(i),Et.mapEffects(t.effects,i),t.annotations,t.scrollIntoView)}let r=e.facet(UL);for(let s=r.length-1;s>=0;s--){let i=r[s](t);i instanceof Dr?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Dr?t=i[0]:t=YL(e,Jd(i),!1)}return t}function ore(t){let e=t.startState,n=e.facet(WL),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=XL(r,W3(e,i,t.changes.newLength),!0))}return r==t?t:Dr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const lre=[];function Jd(t){return t==null?lre:Array.isArray(t)?t:[t]}var rr=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(rr||(rr={}));const cre=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let G3;try{G3=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ure(t){if(G3)return G3.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||cre.test(n)))return!0}return!1}function dre(t){return e=>{if(!/\S/.test(e))return rr.Space;if(ure(e))return rr.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return rr.Word;return rr.Other}}class rn{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 l=0;l<this.config.dynamicSlots.length;l++)jm(this,l<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return jm(this,r),_1(this,r)}update(...e){return YL(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:s}=n;for(let l of e.effects)l.is($v.reconfigure)?(n&&(s=new Map,n.compartments.forEach((c,h)=>s.set(h,c)),n=null),s.set(l.value.compartment,l.value.extension)):l.is(Et.reconfigure)?(n=null,r=l.value):l.is(Et.appendConfig)&&(n=null,r=Jd(r).concat(l.value));let i;n?i=e.startState.values.slice():(n=E1.resolve(r,s,this),i=new rn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,h)=>h.reconfigure(c,this),null).values);let a=e.startState.facet(U3)?e.newSelection:e.newSelection.asSingle();new rn(n,e.newDoc,a,i,(l,c)=>c.update(l,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:Ae.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=Jd(r.effects);for(let l=1;l<n.ranges.length;l++){let c=e(n.ranges[l]),h=this.changes(c.changes),f=h.map(s);for(let g=0;g<l;g++)i[g]=i[g].map(f);let m=s.mapDesc(h,!0);i.push(c.range.map(m)),s=s.compose(f),a=Et.mapEffects(a,f).concat(Et.mapEffects(Jd(c.effects),m))}return{changes:s,selection:Ae.create(i,n.mainIndex),effects:a}}changes(e=[]){return e instanceof $r?e:$r.of(e,this.doc.length,this.facet(rn.lineSeparator))}toText(e){return an.of(e.split(this.facet(rn.lineSeparator)||F3))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(jm(this,n),_1(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let s=e[r];s instanceof rs&&this.config.address[s.id]!=null&&(n[r]=s.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let i in r)if(Object.prototype.hasOwnProperty.call(e,i)){let a=r[i],l=e[i];s.push(a.init(c=>a.spec.fromJSON(l,c)))}}return rn.create({doc:e.doc,selection:Ae.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 an?e.doc:an.of((e.doc||"").split(n.staticFacet(rn.lineSeparator)||F3)),s=e.selection?e.selection instanceof Ae?e.selection:Ae.single(e.selection.anchor,e.selection.head):Ae.single(0);return FL(s,r.length),n.staticFacet(U3)||(s=s.asSingle()),new rn(n,r,s,n.dynamicSlots.map(()=>null),(i,a)=>a.create(i),null)}get tabSize(){return this.facet(rn.tabSize)}get lineBreak(){return this.facet(rn.lineSeparator)||`
`}get readOnly(){return this.facet(GL)}phrase(e,...n){for(let r of this.facet(rn.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(QL))for(let a of i(this,n,r))Object.prototype.hasOwnProperty.call(a,e)&&s.push(a[e]);return s}charCategorizer(e){return dre(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,l=e-r;for(;a>0;){let c=hs(n,a,!1);if(i(n.slice(c,a))!=rr.Word)break;a=c}for(;l<s;){let c=hs(n,l);if(i(n.slice(l,c))!=rr.Word)break;l=c}return a==l?null:Ae.range(a+r,l+r)}}rn.allowMultipleSelections=U3;rn.tabSize=et.define({combine:t=>t.length?t[0]:4});rn.lineSeparator=HL;rn.readOnly=GL;rn.phrases=et.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])}});rn.languageData=QL;rn.changeFilter=VL;rn.transactionFilter=UL;rn.transactionExtender=WL;$v.reconfigure=Et.define();function co(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let a=s[i],l=r[i];if(l===void 0)r[i]=a;else if(!(l===a||a===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](l,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 Nu{eq(e){return this==e}range(e,n=e){return X3.create(e,n,this)}}Nu.prototype.startSide=Nu.prototype.endSide=0;Nu.prototype.point=!1;Nu.prototype.mapMode=ds.TrackDel;let X3=class KL{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new KL(e,n,r)}};function Y3(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class y6{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,l=i.length;;){if(a==l)return a;let c=a+l>>1,h=i[c]-e||(r?this.value[c].endSide:this.value[c].startSide)-n;if(c==a)return h>=0?a:l;h>=0?l=c:a=c+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,i);i<a;i++)if(s(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(e,n){let r=[],s=[],i=[],a=-1,l=-1;for(let c=0;c<this.value.length;c++){let h=this.value[c],f=this.from[c]+e,m=this.to[c]+e,g,x;if(f==m){let y=n.mapPos(f,h.startSide,h.mapMode);if(y==null||(g=x=y,h.startSide!=h.endSide&&(x=n.mapPos(f,h.endSide),x<g)))continue}else if(g=n.mapPos(f,h.startSide),x=n.mapPos(m,h.endSide),g>x||g==x&&h.startSide>0&&h.endSide<=0)continue;(x-g||h.endSide-h.startSide)<0||(a<0&&(a=g),h.point&&(l=Math.max(l,x-g)),r.push(h),s.push(g-a),i.push(x-a))}return{mapped:r.length?new y6(s,i,r,l):null,pos:a}}}class ln{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 ln(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(Y3)),this.isEmpty)return n.length?ln.of(n):this;let l=new ZL(this,null,-1).goto(0),c=0,h=[],f=new dl;for(;l.value||c<n.length;)if(c<n.length&&(l.from-n[c].from||l.startSide-n[c].value.startSide)>=0){let m=n[c++];f.addInner(m.from,m.to,m.value)||h.push(m)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(l.chunkIndex)<n[c].from)&&(!a||s>this.chunkEnd(l.chunkIndex)||i<this.chunkPos[l.chunkIndex])&&f.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!a||s>l.to||i<l.from||a(l.from,l.to,l.value))&&(f.addInner(l.from,l.to,l.value)||h.push(X3.create(l.from,l.to,l.value))),l.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?ln.empty:this.nextLayer.update({add:h,filter:a,filterFrom:s,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],s=-1;for(let a=0;a<this.chunk.length;a++){let l=this.chunkPos[a],c=this.chunk[a],h=e.touchesRange(l,l+c.length);if(h===!1)s=Math.max(s,c.maxPoint),n.push(c),r.push(e.mapPos(l));else if(h===!0){let{mapped:f,pos:m}=c.map(l,e);f&&(s=Math.max(s,f.maxPoint),n.push(f),r.push(m))}}let i=this.nextLayer.map(e);return n.length==0?i:new ln(r,n,i||ln.empty,s)}between(e,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let i=this.chunkPos[s],a=this.chunk[s];if(n>=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 Qm.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Qm.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),l=n.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),c=k9(a,l,r),h=new Kf(a,c,i),f=new Kf(l,c,i);r.iterGaps((m,g,x)=>O9(h,m,f,g,x,s)),r.empty&&r.length==0&&O9(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 l=k9(i,a),c=new Kf(i,l,0).goto(r),h=new Kf(a,l,0).goto(r);for(;;){if(c.to!=h.to||!K3(c.active,h.active)||c.point&&(!h.point||!c.point.eq(h.point)))return!1;if(c.to>s)return!0;c.next(),h.next()}}static spans(e,n,r,s,i=-1){let a=new Kf(e,null,i).goto(n),l=n,c=a.openStart;for(;;){let h=Math.min(a.to,r);if(a.point){let f=a.activeForPoint(a.to),m=a.pointFrom<n?f.length+1:a.point.startSide<0?f.length:Math.min(f.length,c);s.point(l,h,a.point,f,m,a.pointRank),c=Math.min(a.openEnd(h),f.length)}else h>l&&(s.span(l,h,a.active,c),c=a.openEnd(h));if(a.to>r)return c+(a.point&&a.to>r?1:0);l=a.to,a.next()}}static of(e,n=!1){let r=new dl;for(let s of e instanceof X3?[e]:n?hre(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return ln.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=ln.empty;s=s.nextLayer)n=new ln(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}ln.empty=new ln([],[],null,-1);function hre(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Y3(e,r)>0)return t.slice().sort(Y3);e=r}return t}ln.empty.nextLayer=ln.empty;class dl{finishChunk(e){this.chunks.push(new y6(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 dl)).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(ln.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=ln.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function k9(t,e,n){let r=new Map;for(let i of t)for(let a=0;a<i.chunk.length;a++)i.chunk[a].maxPoint<=0&&r.set(i.chunk[a],i.chunkPos[a]);let s=new Set;for(let i of e)for(let a=0;a<i.chunk.length;a++){let l=r.get(i.chunk[a]);l!=null&&(n?n.mapPos(l):l)==i.chunkPos[a]&&!n?.touchesRange(l,l+i.chunk[a].length)&&s.add(i.chunk[a])}return s}class ZL{constructor(e,n,r,s=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Qm{constructor(e){this.heap=e}static from(e,n=null,r=-1){let s=[];for(let i=0;i<e.length;i++)for(let a=e[i];!a.isEmpty;a=a.nextLayer)a.maxPoint>=r&&s.push(new ZL(a,n,r,i));return s.length==1?s[0]:new Qm(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--)iw(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--)iw(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(),iw(this.heap,0)}}}function iw(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1<t.length&&s.compare(t[r+1])>=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Kf{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=Qm.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){Ug(this.active,e),Ug(this.activeTo,e),Ug(this.activeRank,e),this.minActive=j9(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n<this.activeRank.length&&(i-this.activeRank[n]||s-this.activeTo[n])>0;)n++;Wg(this.active,n,r),Wg(this.activeTo,n,s),Wg(this.activeRank,n,i),e&&Wg(e,n,this.cursor.from),this.minActive=j9(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&&Ug(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<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[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 O9(t,e,n,r,s,i){t.goto(e),n.goto(r);let a=r+s,l=r,c=r-e;for(;;){let h=t.to+c-n.to,f=h||t.endSide-n.endSide,m=f<0?t.to+c: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))&&K3(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(l,g,t.point,n.point):g>l&&!K3(t.active,n.active)&&i.compareRange(l,g,t.active,n.active),m>a)break;(h||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(m),l=m,f<=0&&t.next(),f>=0&&n.next()}}function K3(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function Ug(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function Wg(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function j9(t,e){let n=-1,r=1e9;for(let s=0;s<e.length;s++)(e[s]-r||t[s].endSide-t[n].endSide)<0&&(n=s,r=e[s]);return n}function Bh(t,e,n=t.length){let r=0;for(let s=0;s<n&&s<t.length;)t.charCodeAt(s)==9?(r+=e-r%e,s++):(r++,s=hs(t,s));return r}function Z3(t,e,n,r){for(let s=0,i=0;;){if(i>=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=hs(t,s)}return r===!0?-1:t.length}const J3="ͼ",N9=typeof Symbol>"u"?"__"+J3:Symbol.for(J3),eS=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),C9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class gc{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function i(a,l,c,h){let f=[],m=/^@(\w+)\b/.exec(a[0]),g=m&&m[1]=="keyframes";if(m&&l==null)return c.push(a[0]+";");for(let x in l){let y=l[x];if(/&/.test(x))i(x.split(/,\s*/).map(w=>a.map(S=>w.replace(/&/,S))).reduce((w,S)=>w.concat(S)),y,c);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)&&c.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=C9[N9]||1;return C9[N9]=e+1,J3+e.toString(36)}static mount(e,n,r){let s=e[eS],i=r&&r.nonce;s?i&&s.setNonce(i):s=new fre(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let T9=new Map;class fre{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=T9.get(r);if(i)return e[eS]=i;this.sheet=new s.CSSStyleSheet,T9.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[eS]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let a=0;a<e.length;a++){let l=e[a],c=this.modules.indexOf(l);if(c<i&&c>-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,l),r)for(let h=0;h<l.rules.length;h++)r.insertRule(l.rules[h],s++)}else{for(;i<c;)s+=this.modules[i++].rules.length;s+=l.rules.length,i++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let a="";for(let c=0;c<this.modules.length;c++)a+=this.modules[c].getRules()+`
`;this.styleTag.textContent=a;let l=n.head||n;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var xc={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Hm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mre=typeof navigator<"u"&&/Mac/.test(navigator.platform),pre=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var us=0;us<10;us++)xc[48+us]=xc[96+us]=String(us);for(var us=1;us<=24;us++)xc[us+111]="F"+us;for(var us=65;us<=90;us++)xc[us]=String.fromCharCode(us+32),Hm[us]=String.fromCharCode(us);for(var aw in xc)Hm.hasOwnProperty(aw)||(Hm[aw]=xc[aw]);function gre(t){var e=mre&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||pre&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Hm:xc)[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 $n(){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(;e<arguments.length;e++)JL(t,arguments[e]);return t}function JL(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)JL(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}let Es=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},tS=typeof document<"u"?document:{documentElement:{style:{}}};const nS=/Edge\/(\d+)/.exec(Es.userAgent),eI=/MSIE \d/.test(Es.userAgent),rS=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Es.userAgent),Qv=!!(eI||rS||nS),E9=!Qv&&/gecko\/(\d+)/i.test(Es.userAgent),ow=!Qv&&/Chrome\/(\d+)/.exec(Es.userAgent),xre="webkitFontSmoothing"in tS.documentElement.style,sS=!Qv&&/Apple Computer/.test(Es.vendor),_9=sS&&(/Mobile\/\w+/.test(Es.userAgent)||Es.maxTouchPoints>2);var Ye={mac:_9||/Mac/.test(Es.platform),windows:/Win/.test(Es.platform),linux:/Linux|X11/.test(Es.platform),ie:Qv,ie_version:eI?tS.documentMode||6:rS?+rS[1]:nS?+nS[1]:0,gecko:E9,gecko_version:E9?+(/Firefox\/(\d+)/.exec(Es.userAgent)||[0,0])[1]:0,chrome:!!ow,chrome_version:ow?+ow[1]:0,ios:_9,android:/Android\b/.test(Es.userAgent),webkit_version:xre?+(/\bAppleWebKit\/(\d+)/.exec(Es.userAgent)||[0,0])[1]:0,safari:sS,safari_version:sS?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Es.userAgent)||[0,0])[1]:0,tabSize:tS.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Vm(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function iS(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function e1(t,e){if(!e.anchorNode)return!1;try{return iS(t,e.anchorNode)}catch{return!1}}function vh(t){return t.nodeType==3?Tu(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Nm(t,e,n,r){return n?M9(t,e,n,r,-1)||M9(t,e,n,r,1):!1}function Cu(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function M1(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function M9(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:io(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=Cu(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?io(t):0}else return!1}}function io(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function F0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function vre(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 tI(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 yre(t,e,n,r,s,i,a,l){let c=t.ownerDocument,h=c.defaultView||window;for(let f=t,m=!1;f&&!m;)if(f.nodeType==1){let g,x=f==c.body,y=1,w=1;if(x)g=vre(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}=tI(f,N)),g={left:N.left,right:N.left+f.clientWidth*y,top:N.top,bottom:N.top+f.clientHeight*w}}let S=0,k=0;if(s=="nearest")e.top<g.top?(k=e.top-(g.top+a),n>0&&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-k<g.top&&(k=e.top-(g.top+a)));else{let N=e.bottom-e.top,C=g.bottom-g.top;k=(s=="center"&&N<=C?e.top+N/2-C/2:s=="start"||s=="center"&&n<0?e.top-a:e.bottom-C+a)-g.top}if(r=="nearest"?e.left<g.left?(S=e.left-(g.left+i),n>0&&e.right>g.right+S&&(S=e.right-g.right+i)):e.right>g.right&&(S=e.right-g.right+i,n<0&&e.left<g.left+S&&(S=e.left-(g.left+i))):S=(r=="center"?e.left+(e.right-e.left)/2-(g.right-g.left)/2:r=="start"==l?e.left-i:e.right-(g.right-g.left)+i)-g.left,S||k)if(x)h.scrollBy(S,k);else{let N=0,C=0;if(k){let T=f.scrollTop;f.scrollTop+=k/w,C=(f.scrollTop-T)*w}if(S){let T=f.scrollLeft;f.scrollLeft+=S/y,N=(f.scrollLeft-T)*y}e={left:e.left-N,top:e.top-C,right:e.right-N,bottom:e.bottom-C},N&&Math.abs(N-S)<1&&(r="nearest"),C&&Math.abs(C-k)<1&&(s="nearest")}if(x)break;(e.top<g.top||e.bottom>g.bottom||e.left<g.left||e.right>g.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 bre(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 wre{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?io(n):0),r,Math.min(e.focusOffset,r?io(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let au=null;Ye.safari&&Ye.safari_version>=26&&(au=!1);function nI(t){if(t.setActive)return t.setActive();if(au)return t.focus(au);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(au==null?{get preventScroll(){return au={preventScroll:!0},!0}}:void 0),!au){au=!1;for(let n=0;n<e.length;){let r=e[n++],s=e[n++],i=e[n++];r.scrollTop!=s&&(r.scrollTop=s),r.scrollLeft!=i&&(r.scrollLeft=i)}}}let A9;function Tu(t,e,n=e){let r=A9||(A9=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function eh(t,e,n,r){let s={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let i=new KeyboardEvent("keydown",s);i.synthetic=!0,t.dispatchEvent(i);let a=new KeyboardEvent("keyup",s);return a.synthetic=!0,t.dispatchEvent(a),i.defaultPrevented||a.defaultPrevented}function Sre(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function rI(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function kre(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,io(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=io(n))}else{if(n==t)return!0;r=Cu(n),n=n.parentNode}}function sI(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function iI(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=io(n)}else if(n.parentNode&&!M1(n))r=Cu(n),n=n.parentNode;else return null}}function aI(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!M1(n))r=Cu(n)+1,n=n.parentNode;else return null}}class ws{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new ws(e.parentNode,Cu(e),n)}static after(e,n){return new ws(e.parentNode,Cu(e)+1,n)}}const b6=[];class In{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let n=this.posAtStart;for(let r of this.children){if(r==e)return n;n+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,n){if(this.flags&2){let r=this.dom,s=null,i;for(let a of this.children){if(a.flags&7){if(!a.dom&&(i=s?s.nextSibling:r.firstChild)){let l=In.get(i);(!l||!l.parent&&l.canReuseDOM(a))&&a.reuseDOM(i)}a.sync(e,n),a.flags&=-8}if(i=s?s.nextSibling:r.firstChild,n&&!n.written&&n.node==r&&i!=a.dom&&(n.written=!0),a.dom.parentNode==r)for(;i&&i!=a.dom;)i=R9(i);else r.insertBefore(a.dom,i);s=a.dom}for(i=s?s.nextSibling:r.firstChild,i&&n&&n.node==r&&(n.written=!0);i;)i=R9(i)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(e,n),r.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,n){let r;if(e==this.dom)r=this.dom.childNodes[n];else{let s=io(e)==0?0:n==0?-1:1;for(;;){let i=e.parentNode;if(i==this.dom)break;s==0&&i.firstChild!=i.lastChild&&(e==i.firstChild?s=-1:s=1),e=i}s<0?r=e:r=e.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!In.get(r);)r=r.nextSibling;if(!r)return this.length;for(let s=0,i=0;;s++){let a=this.children[s];if(a.dom==r)return i;i+=a.length+a.breakAfter}}domBoundsAround(e,n,r=0){let s=-1,i=-1,a=-1,l=-1;for(let c=0,h=r,f=r;c<this.children.length;c++){let m=this.children[c],g=h+m.length;if(h<e&&g>n)return m.domBoundsAround(e,n,h);if(g>=e&&s==-1&&(s=c,i=h),h>n&&m.dom.parentNode==this.dom){a=c,l=f;break}f=g,h=g+m.breakAfter}return{from:i,to:l<0?r+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a<this.children.length&&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=b6){this.markDirty();for(let s=e;s<n;s++){let i=this.children[s];i.parent==this&&r.indexOf(i)<0&&i.destroy()}r.length<250?this.children.splice(e,n-e,...r):this.children=[].concat(this.children.slice(0,e),r,this.children.slice(n));for(let s=0;s<r.length;s++)r[s].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new oI(this.children,e,this.children.length)}childPos(e,n=1){return this.childCursor().findPos(e,n)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,n,r,s,i,a){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}In.prototype.breakAfter=0;function R9(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class oI{constructor(e,n,r){this.children=e,this.pos=n,this.i=r,this.off=0}findPos(e,n=1){for(;;){if(e>this.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 lI(t,e,n,r,s,i,a,l,c){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,l,c))){if(r<h.length){let x=h[r];x&&(s<x.length||x.breakAfter&&m?.breakAfter)?(e==r&&(x=x.split(s),s=0),!g&&m&&x.merge(0,s,m,!0,0,c)?i[i.length-1]=x:((s||x.children.length&&!x.children[0].length)&&x.merge(0,s,null,!1,0,c),i.push(x))):x?.breakAfter&&(m?m.breakAfter=1:a=1),r++}for(f&&(f.breakAfter=a,n>0&&(!a&&i.length&&f.merge(n,f.length,i[0],!1,l,0)?f.breakAfter=i.shift().breakAfter:(n<f.length||f.children.length&&f.children[f.children.length-1].length==0)&&f.merge(n,f.length,null,!1,l,0),e++));e<r&&i.length;)if(h[r-1].become(i[i.length-1]))r--,i.pop(),c=i.length?0:l;else if(h[e].become(i[0]))e++,i.shift(),l=i.length?0:c;else break;!i.length&&e&&r<h.length&&!h[e-1].breakAfter&&h[r].merge(0,0,h[e-1],!1,l,c)&&e--,(e<r||i.length)&&t.replaceChildren(e,r,i)}}function cI(t,e,n,r,s,i){let a=t.childCursor(),{i:l,off:c}=a.findPos(n,1),{i:h,off:f}=a.findPos(e,-1),m=e-n;for(let g of r)m+=g.length;t.length+=m,lI(t,h,f,l,c,r,0,s,i)}const Ore=256;class ka extends In{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,n){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,n,r){return this.flags&8||r&&(!(r instanceof ka)||this.length-(n-e)+r.length>Ore||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 ka(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 ws(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 jre(this.dom,e,n)}}class hl extends In{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(rI(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 hl&&r.mark.eq(this.mark))||e&&i<=0||n<this.length&&a<=0)?!1:(cI(this,e,n,r?r.children.slice():[],i-1,a-1),this.markDirty(),!0)}split(e){let n=[],r=0,s=-1,i=0;for(let l of this.children){let c=r+l.length;c>e&&n.push(r<e?l.split(e-r):l),s<0&&r>=e&&(s=i),r=c,i++}let a=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new hl(this.mark,n,a)}domAtPos(e){return uI(this,e)}coordsAt(e,n){return hI(this,e,n)}}function jre(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?Ye.chrome||Ye.gecko||(e?(s--,a=1):i<r&&(i++,a=-1)):n<0?s--:i<r&&i++;let l=Tu(t,s,i).getClientRects();if(!l.length)return null;let c=l[(a?a<0:n>=0)?0:l.length-1];return Ye.safari&&!a&&c.width==0&&(c=Array.prototype.find.call(l,h=>h.width)||c),a?F0(c,a<0):c||null}class Ko extends In{static create(e,n,r){return new Ko(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=Ko.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 Ko)||!this.widget.compare(r.widget)||e>0&&i<=0||n<this.length&&a<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-n),!0)}become(e){return e instanceof Ko&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return an.empty;let e=this;for(;e.parent;)e=e.parent;let{view:n}=e,r=n&&n.state.doc,s=this.posAtStart;return r?r.slice(s,s+this.length):an.empty}domAtPos(e){return(this.length?e==0:this.side>0)?ws.before(this.dom):ws.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 l=a?s.length-1:0;i=s[l],!(e>0?l==0:l==s.length-1||i.top<i.bottom);l+=a?-1:1);return F0(i,!a)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class yh extends In{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof yh&&e.side==this.side}split(){return new yh(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?ws.before(this.dom):ws.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return an.empty}get isHidden(){return!0}}ka.prototype.children=Ko.prototype.children=yh.prototype.children=b6;function uI(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;s<r.length;s++){let a=r[s],l=i+a.length;if(!(l==i&&a.getSide()<=0)){if(e>i&&e<l&&a.dom.parentNode==n)return a.domAtPos(e-i);if(e<=i)break;i=l}}for(let i=s;i>0;i--){let a=r[i-1];if(a.dom.parentNode==n)return a.domAtPos(a.length)}for(let i=s;i<r.length;i++){let a=r[i];if(a.dom.parentNode==n)return a.domAtPos(0)}return new ws(n,0)}function dI(t,e,n){let r,{children:s}=t;n>0&&e instanceof hl&&s.length&&(r=s[s.length-1])instanceof hl&&r.mark.eq(e.mark)?dI(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function hI(t,e,n){let r=null,s=-1,i=null,a=-1;function l(h,f){for(let m=0,g=0;m<h.children.length&&g<=f;m++){let x=h.children[m],y=g+x.length;y>=f&&(x.children.length?l(x,f-g):(!i||i.isHidden&&(n>0||Cre(i,x)))&&(y>f||g==y&&x.getSide()>0)?(i=x,a=f-g):(g<f||g==y&&x.getSide()<0&&!x.isHidden)&&(r=x,s=f-g)),g=y}}l(t,e);let c=(n<0?r:i)||r||i;return c?c.coordsAt(Math.max(0,c==r?s:a),n):Nre(t)}function Nre(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=vh(e);return n[n.length-1]||null}function Cre(t,e){let n=t.coordsAt(0,1),r=e.coordsAt(0,1);return n&&r&&r.top<n.bottom}function aS(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const D9=Object.create(null);function A1(t,e,n){if(t==e)return!0;t||(t=D9),e||(e=D9);let r=Object.keys(t),s=Object.keys(e);if(r.length-(n&&r.indexOf(n)>-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 oS(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 Tre(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}class uo{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var As=(function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t})(As||(As={}));class ft extends Nu{constructor(e,n,r,s){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(e){return new $0(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new vc(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}=fI(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(a?n?2e8:1:-6e8)+1}return new vc(e,r,s,n,e.widget||null,!0)}static line(e){return new Q0(e)}static set(e,n=!1){return ln.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ft.none=ln.empty;class $0 extends ft{constructor(e){let{start:n,end:r}=fI(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 $0&&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))&&A1(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)}}$0.prototype.point=!1;class Q0 extends ft{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Q0&&this.spec.class==e.spec.class&&A1(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)}}Q0.prototype.mapMode=ds.TrackBefore;Q0.prototype.point=!0;class vc extends ft{constructor(e,n,r,s,i,a){super(n,r,i,e),this.block=s,this.isReplace=a,this.mapMode=s?n<=0?ds.TrackBefore:ds.TrackAfter:ds.TrackDel}get type(){return this.startSide!=this.endSide?As.WidgetRange:this.startSide<=0?As.WidgetBefore:As.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof vc&&Ere(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)}}vc.prototype.point=!0;function fI(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 Ere(t,e){return t==e||!!(t&&e&&t.compare(e))}function t1(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 Rr extends In{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 Rr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),cI(this,e,n,r?r.children.slice():[],i,a),!0}split(e){let n=new Rr;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;i<this.children.length;i++)n.append(this.children[i],0);for(;r>0&&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){A1(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){dI(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=aS(n,this.attrs||{})),r&&(this.attrs=aS({class:r},this.attrs||{}))}domAtPos(e){return uI(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(rI(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&&(oS(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&&In.get(s)instanceof hl;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=In.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!Ye.ios||!this.children.some(i=>i instanceof ka))){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 ka)||/[^ -~]/.test(r.text))return null;let s=vh(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=hI(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<i){let a=(i-s.textHeight)/2;return{top:r.top+a,bottom:r.bottom-a,left:r.left,right:r.left}}}return r}become(e){return e instanceof Rr&&this.children.length==0&&e.children.length==0&&A1(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,n){for(let r=0,s=0;r<e.children.length;r++){let i=e.children[r],a=s+i.length;if(a>=n){if(i instanceof Rr)return i;if(a>n)break}s=a+i.breakAfter}return null}}class sl extends In{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 sl)||!this.widget.compare(r.widget)||e>0&&i<=0||n<this.length&&a<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-n),!0)}domAtPos(e){return e==0?ws.before(this.dom):ws.after(this.dom,e==this.length)}split(e){let n=this.length-e;this.length=e;let r=new sl(this.widget,n,this.deco);return r.breakAfter=this.breakAfter,r}get children(){return b6}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"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):an.empty}domBoundsAround(){return null}become(e){return e instanceof sl&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);return r||(this.widget instanceof lS?null:F0(this.dom.getBoundingClientRect(),this.length?e==0:n<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:n,endSide:r}=this.deco;return n==r?!1:e<0?n<0:r>0}}class lS extends uo{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 Cm{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 sl&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Rr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Gg(new yh(-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 sl)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:a,lineBreak:l,done:c}=this.cursor.next(this.skip);if(this.skip=0,c)throw new Error("Ran out of text content when drawing inline views");if(l){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(Gg(new ka(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 vc){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 l=n-e;if(r instanceof vc)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new sl(r.widget||bh.block,l,r));else{let c=Ko.create(r.widget||bh.inline,l,l?0:r.startSide),h=this.atCursorPos&&!c.isEditable&&i<=s.length&&(e<n||r.startSide>0),f=!c.isEditable&&(e<n||i>s.length||r.startSide<=0),m=this.getLine();this.pendingBuffer==2&&!h&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(m.append(Gg(new yh(1),s),i),i=s.length+Math.max(0,i-s.length)),m.append(Gg(c,s),i),this.atCursorPos=f,this.pendingBuffer=f?e<n||i>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(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 Cm(e,n,r,i);return a.openEnd=ln.spans(s,n,r,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function Gg(t,e){for(let n of e)t=new hl(n,[t],t.length);return t}class bh extends uo{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}}bh.inline=new bh("span");bh.block=new bh("div");var Jn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Jn||(Jn={}));const Eu=Jn.LTR,w6=Jn.RTL;function mI(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const _re=mI("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Mre=mI("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),cS=Object.create(null),Ba=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);cS[e]=n,cS[n]=-e}function pI(t){return t<=247?_re[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Mre[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const Are=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class cc{get dir(){return this.level%2?w6:Eu}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,s){let i=-1;for(let a=0;a<e.length;a++){let l=e[a];if(l.from<=n&&l.to>=n){if(l.level==r)return a;(i<0||(s!=0?s<0?l.from<n:l.to>n:e[i].level>l.level))&&(i=a)}}if(i<0)throw new RangeError("Index out of range");return i}}function gI(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],s=e[n];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!gI(r.inner,s.inner))return!1}return!0}const Qn=[];function Rre(t,e,n,r,s){for(let i=0;i<=r.length;i++){let a=i?r[i-1].to:e,l=i<r.length?r[i].from:n,c=i?256:s;for(let h=a,f=c,m=c;h<l;h++){let g=pI(t.charCodeAt(h));g==512?g=f:g==8&&m==4&&(g=16),Qn[h]=g==4?2:g,g&7&&(m=g),f=g}for(let h=a,f=c,m=c;h<l;h++){let g=Qn[h];if(g==128)h<l-1&&f==Qn[h+1]&&f&24?g=Qn[h]=f:Qn[h]=256;else if(g==64){let x=h+1;for(;x<l&&Qn[x]==64;)x++;let y=h&&f==8||x<n&&Qn[x]==8?m==1?1:8:256;for(let w=h;w<x;w++)Qn[w]=y;h=x-1}else g==8&&m==1&&(Qn[h]=1);f=g,g&7&&(m=g)}}}function Dre(t,e,n,r,s){let i=s==1?2:1;for(let a=0,l=0,c=0;a<=r.length;a++){let h=a?r[a-1].to:e,f=a<r.length?r[a].from:n;for(let m=h,g,x,y;m<f;m++)if(x=cS[g=t.charCodeAt(m)])if(x<0){for(let w=l-3;w>=0;w-=3)if(Ba[w+1]==-x){let S=Ba[w+2],k=S&2?s:S&4?S&1?i:s:0;k&&(Qn[m]=Qn[Ba[w]]=k),l=w;break}}else{if(Ba.length==189)break;Ba[l++]=m,Ba[l++]=g,Ba[l++]=c}else if((y=Qn[m])==2||y==1){let w=y==s;c=w?0:1;for(let S=l-3;S>=0;S-=3){let k=Ba[S+2];if(k&2)break;if(w)Ba[S+2]|=2;else{if(k&4)break;Ba[S+2]|=4}}}}}function zre(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let a=s?n[s-1].to:t,l=s<n.length?n[s].from:e;for(let c=a;c<l;){let h=Qn[c];if(h==256){let f=c+1;for(;;)if(f==l){if(s==n.length)break;f=n[s++].to,l=s<n.length?n[s].from:e}else if(Qn[f]==256)f++;else break;let m=i==1,g=(f<e?Qn[f]:r)==1,x=m==g?m?1:2:r;for(let y=f,w=s,S=w?n[w-1].to:t;y>c;)y==S&&(y=n[--w].from,S=w?n[w-1].to:t),Qn[--y]=x;c=f}else i=h,c++}}}function uS(t,e,n,r,s,i,a){let l=r%2?2:1;if(r%2==s%2)for(let c=e,h=0;c<n;){let f=!0,m=!1;if(h==i.length||c<i[h].from){let w=Qn[c];w!=l&&(f=!1,m=w==16)}let g=!f&&l==1?[]:null,x=f?r:r+1,y=c;e:for(;;)if(h<i.length&&y==i[h].from){if(m)break e;let w=i[h];if(!f)for(let S=w.to,k=h+1;;){if(S==n)break e;if(k<i.length&&i[k].from==S)S=i[k++].to;else{if(Qn[S]==l)break e;break}}if(h++,g)g.push(w);else{w.from>c&&a.push(new cc(c,w.from,x));let S=w.direction==Eu!=!(x%2);dS(t,S?r+1:r,s,w.inner,w.from,w.to,a),c=w.to}y=w.to}else{if(y==n||(f?Qn[y]!=l:Qn[y]==l))break;y++}g?uS(t,c,y,r+1,s,g,a):c<y&&a.push(new cc(c,y,x)),c=y}else for(let c=n,h=i.length;c>e;){let f=!0,m=!1;if(!h||c>i[h-1].to){let w=Qn[c-1];w!=l&&(f=!1,m=w==16)}let g=!f&&l==1?[]:null,x=f?r:r+1,y=c;e:for(;;)if(h&&y==i[h-1].to){if(m)break e;let w=i[--h];if(!f)for(let S=w.from,k=h;;){if(S==e)break e;if(k&&i[k-1].to==S)S=i[--k].from;else{if(Qn[S-1]==l)break e;break}}if(g)g.push(w);else{w.to<c&&a.push(new cc(w.to,c,x));let S=w.direction==Eu!=!(x%2);dS(t,S?r+1:r,s,w.inner,w.from,w.to,a),c=w.from}y=w.from}else{if(y==e||(f?Qn[y-1]!=l:Qn[y-1]==l))break;y--}g?uS(t,y,c,r+1,s,g,a):y<c&&a.push(new cc(y,c,x)),c=y}}function dS(t,e,n,r,s,i,a){let l=e%2?2:1;Rre(t,s,i,r,l),Dre(t,s,i,r,l),zre(s,i,r,l),uS(t,s,i,e,n,r,a)}function Pre(t,e,n){if(!t)return[new cc(0,0,e==w6?1:0)];if(e==Eu&&!n.length&&!Are.test(t))return xI(t.length);if(n.length)for(;t.length>Qn.length;)Qn[Qn.length]=256;let r=[],s=e==Eu?0:1;return dS(t,s,s,n,0,t.length,r),r}function xI(t){return[new cc(0,t,0)]}let vI="";function Lre(t,e,n,r,s){var i;let a=r.head-t.from,l=cc.find(e,a,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),c=e[l],h=c.side(s,n);if(a==h){let g=l+=s?1:-1;if(g<0||g>=e.length)return null;c=e[l=g],a=c.side(!s,n),h=c.side(s,n)}let f=hs(t.text,a,c.forward(s,n));(f<c.from||f>c.to)&&(f=h),vI=t.text.slice(Math.min(a,f),Math.max(a,f));let m=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return m&&f==h&&m.level+(s?0:1)<c.level?Ae.cursor(m.side(!s,n)+t.from,m.forward(s,n)?1:-1,m.level):Ae.cursor(f+t.from,c.forward(s,n)?-1:1,c.level)}function Ire(t,e,n){for(let r=e;r<n;r++){let s=pI(t.charCodeAt(r));if(s==1)return Eu;if(s==2||s==4)return w6}return Eu}const yI=et.define(),bI=et.define(),wI=et.define(),SI=et.define(),hS=et.define(),kI=et.define(),OI=et.define(),S6=et.define(),k6=et.define(),jI=et.define({combine:t=>t.some(e=>e)}),NI=et.define({combine:t=>t.some(e=>e)}),CI=et.define();class th{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 th(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 th(Ae.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Xg=Et.define({map:(t,e)=>t.map(e)}),TI=Et.define();function Zs(t,e,n){let r=t.facet(SI);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 Yo=et.define({combine:t=>t.length?t[0]:!0});let Bre=0;const Hd=et.define({combine(t){return t.filter((e,n)=>{for(let r=0;r<n;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class jr{constructor(e,n,r,s,i){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Hd.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Hd.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:a}=n||{};return new jr(Bre++,e,r,s,l=>{let c=[];return a&&c.push(Um.of(h=>{let f=h.plugin(l);return f?a(f):ft.none})),i&&c.push(i(l)),c})}static fromClass(e,n){return jr.define((r,s)=>new e(r,s),n)}}class lw{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(Zs(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){Zs(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){Zs(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const EI=et.define(),O6=et.define(),Um=et.define(),_I=et.define(),H0=et.define(),MI=et.define();function z9(t,e){let n=t.state.facet(MI);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return ln.spans(r,e.from,e.to,{point(){},span(i,a,l,c){let h=i-e.from,f=a-e.from,m=s;for(let g=l.length-1;g>=0;g--,c--){let x=l[g].spec.bidiIsolate,y;if(x==null&&(x=Ire(e.text,h,f)),c>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 AI=et.define();function j6(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(AI)){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 hm=et.define();class ta{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new ta(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.toA<r.fromA)break;r=r.join(s),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let s=0,i=0,a=0,l=0;;s++){let c=s==e.length?null:e[s],h=a-l,f=c?c.fromB:1e9;for(;i<n.length&&n[i]<f;){let m=n[i],g=n[i+1],x=Math.max(l,m),y=Math.min(f,g);if(x<=y&&new ta(x+h,y+h,x,y).addToSet(r),g>f)break;i+=2}if(!c)return r;new ta(c.fromA,c.toA,c.fromB,c.toB).addToSet(r),a=c.toA,l=c.toB}}}class R1{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=$r.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,a,l,c)=>s.push(new ta(i,a,l,c))),this.changedRanges=s}static create(e,n,r){return new R1(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 P9 extends In{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=ft.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 Rr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ta(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})=>f<this.minWidthFrom||h>this.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:!Ure(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?Fre(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;r=new ta(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,(Ye.ie||Ye.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,l=this.updateDeco(),c=Hre(a,l,e.changes);return r=ta.extendWithRanges(r,c),!(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=Ye.chrome||Ye.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<this.view.state.doc.length)for(let a of this.children)a instanceof sl&&a.widget instanceof lS&&i.push(a.dom);s.updateGaps(i)}updateChildren(e,n,r){let s=r?r.range.addToSet(e.slice()):e,i=this.childCursor(n);for(let a=s.length-1;;a--){let l=a>=0?s[a]:null;if(!l)break;let{fromA:c,toA:h,fromB:f,toB:m}=l,g,x,y,w;if(r&&r.range.fromB<m&&r.range.toB>f){let T=Cm.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),_=Cm.build(this.view.state.doc,r.range.toB,m,this.decorations,this.dynamicDecorationMap);x=T.breakAtStart,y=T.openStart,w=_.openEnd;let E=this.compositionView(r);_.breakAtStart?E.breakAfter=1:_.content.length&&E.merge(E.length,E.length,_.content[0],!1,_.openStart,0)&&(E.breakAfter=_.content[0].breakAfter,_.content.shift()),T.content.length&&E.merge(0,0,T.content[T.content.length-1],!0,0,T.openEnd)&&T.content.pop(),g=T.content.concat(E).concat(_.content)}else({content:g,breakAtStart:x,openStart:y,openEnd:w}=Cm.build(this.view.state.doc,f,m,this.decorations,this.dynamicDecorationMap));let{i:S,off:k}=i.findPos(h,1),{i:N,off:C}=i.findPos(c,-1);lI(this,N,C,S,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(TI)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new ka(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new hl(s,[n],n.length);let r=new Rr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,a)=>{a.flags|=8|(a.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(a);let l=In.get(i);l&&l!=a&&(l.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(Yo)||this.dom.tabIndex>-1)&&e1(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?c:this.moveToLine(this.domAtPos(l.head));if(Ye.gecko&&l.empty&&!this.hasComposition&&qre(c)){let m=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(m,c.node.childNodes[c.offset]||null)),c=h=new ws(m,0),a=!0}let f=this.view.observer.selectionRange;(a||!f.focusNode||(!Nm(c.node,c.offset,f.anchorNode,f.anchorOffset)||!Nm(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,l))&&(this.view.observer.ignore(()=>{Ye.android&&Ye.chrome&&this.dom.contains(f.focusNode)&&Vre(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let m=Vm(this.view.root);if(m)if(l.empty){if(Ye.gecko){let g=$re(c.node,c.offset);if(g&&g!=3){let x=(g==1?iI:aI)(c.node,c.offset);x&&(c=new ws(x.node,x.offset))}}m.collapse(c.node,c.offset),l.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=l.bidiLevel)}else if(m.extend){m.collapse(c.node,c.offset);try{m.extend(h.node,h.offset)}catch{}}else{let g=document.createRange();l.anchor>l.head&&([c,h]=[h,c]),g.setEnd(h.node,h.offset),g.setStart(c.node,c.offset),m.removeAllRanges(),m.addRange(g)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new ws(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new ws(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&Nm(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=Vm(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=Rr.find(this,n.head);if(!a)return;let l=a.posAtStart;if(n.head==l||n.head==l+a.length)return;let c=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!c||!h||c.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<n.childNodes.length;s++){let i=In.get(n.childNodes[s]);i instanceof Rr&&(r=i.domAtPos(0))}for(let s=e.offset-1;!r&&s>=0;s--){let i=In.get(n.childNodes[s]);i instanceof Rr&&(r=i.domAtPos(i.length))}return r?new ws(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=In.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<this.children.length-1;){let s=this.children[n];if(r<s.length||s instanceof Rr)break;n++,r=0}return this.children[n].domAtPos(r)}coordsAt(e,n){let r=null,s=0;for(let i=this.length,a=this.children.length-1;a>=0;a--){let l=this.children[a],c=i-l.breakAfter,h=c-l.length;if(c<e)break;if(h<=e&&(h<e||l.covers(-1))&&(c>e||l.covers(1))&&(!r||l instanceof Rr&&!(r instanceof Rr&&n>=0)))r=l,s=h;else if(r&&h==e&&c==e&&l instanceof sl&&Math.abs(n)<2){if(l.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 Rr))return null;for(;s.children.length;){let{i:l,off:c}=s.childPos(r,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}r=c}if(!(s instanceof ka))return null;let i=hs(s.text,r);if(i==r)return null;let a=Tu(s.dom,r,i).getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(l==a.length-1||c.top<c.bottom&&c.left<c.right)return c}return null}measureVisibleLineHeights(e){let n=[],{from:r,to:s}=e,i=this.view.contentDOM.clientWidth,a=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,c=this.view.textDirection==Jn.LTR;for(let h=0,f=0;f<this.children.length;f++){let m=this.children[f],g=h+m.length;if(g>s)break;if(h>=r){let x=m.dom.getBoundingClientRect();if(n.push(x.height),a){let y=m.dom.lastChild,w=y?vh(y):[];if(w.length){let S=w[w.length-1],k=c?S.right-x.left:x.right-S.left;k>l&&(l=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"?Jn.RTL:Jn.LTR}measureTextSize(){for(let i of this.children)if(i instanceof Rr){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=vh(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 oI(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 l=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(ft.replace({widget:new lS(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!i)break;r=i.to+1}return ft.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Um).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(_I).map((i,a)=>{let l=typeof i=="function";return l&&(r=!0),l?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(ln.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(CI))try{if(h(this.view,e.range,e))return!0}catch(f){Zs(this.view.state,f,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.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=j6(this.view),a={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;yre(this.view.scrollDOM,a,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==Jn.LTR)}lineHasWidget(e){let{i:n}=this.childCursor().findPos(e);if(n==this.children.length)return!1;let r=s=>s instanceof Ko||s.children.some(r);return r(this.children[n])}}function qre(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 RI(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=iI(n.focusNode,n.focusOffset),s=aI(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let l=In.get(s.node);if(!l||l instanceof ka&&l.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let c=In.get(r.node);!c||c instanceof ka&&c.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 Fre(t,e,n){let r=RI(t,n);if(!r)return null;let{node:s,from:i,to:a}=r,l=s.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(r.from,r.to)!=l)return null;let c=e.invertedDesc,h=new ta(c.mapPos(i),c.mapPos(a),i,a),f=[];for(let m=s.parentNode;;m=m.parentNode){let g=In.get(m);if(g instanceof hl)f.push({node:m,deco:g.mark});else{if(g instanceof Rr||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 $0({inclusive:!0,attributes:Tre(m),tagName:m.tagName.toLowerCase()})});else return null}}}function $re(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let Qre=class{constructor(){this.changes=[]}compareRange(e,n){t1(e,n,this.changes)}comparePoint(e,n){t1(e,n,this.changes)}boundChange(e){t1(e,e,this.changes)}};function Hre(t,e,n){let r=new Qre;return ln.compare(t,e,n,r),r.changes}function Vre(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function Ure(t,e){let n=!1;return e&&t.iterChangedRanges((r,s)=>{r<e.to&&s>e.from&&(n=!0)}),n}function Wre(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Ae.cursor(e);i==0?n=1:i==s.length&&(n=-1);let a=i,l=i;n<0?a=hs(s.text,i,!1):l=hs(s.text,i);let c=r(s.text.slice(a,l));for(;a>0;){let h=hs(s.text,a,!1);if(r(s.text.slice(h,a))!=c)break;a=h}for(;l<s.length;){let h=hs(s.text,l);if(r(s.text.slice(l,h))!=c)break;l=h}return Ae.range(a+s.from,l+s.from)}function Gre(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function Xre(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function cw(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function L9(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function I9(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function fS(t,e,n){let r,s,i,a,l=!1,c,h,f,m;for(let y=t.firstChild;y;y=y.nextSibling){let w=vh(y);for(let S=0;S<w.length;S++){let k=w[S];s&&cw(s,k)&&(k=L9(I9(k,s.bottom),s.top));let N=Gre(e,k),C=Xre(n,k);if(N==0&&C==0)return y.nodeType==3?B9(y,e,n):fS(y,e,n);(!r||a>C||a==C&&i>N)&&(r=y,s=k,i=N,a=C,l=N?e<k.left?S>0:S<w.length-1:!0),N==0?n>k.bottom&&(!f||f.bottom<k.bottom)?(c=y,f=k):n<k.top&&(!m||m.top>k.top)&&(h=y,m=k):f&&cw(f,k)?f=I9(f,k.bottom):m&&cw(m,k)&&(m=L9(m,k.top))}}if(f&&f.bottom>=n?(r=c,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 B9(r,g,n);if(l&&r.contentEditable!="false")return fS(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 B9(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,a=0;for(let l=0;l<r;l++){let c=Tu(t,l,l+1).getClientRects();for(let h=0;h<c.length;h++){let f=c[h];if(f.top==f.bottom)continue;a||(a=e-f.left);let m=(f.top>n?f.top-n:n-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&m<i){let g=e>=(f.left+f.right)/2,x=g;if(Ye.chrome||Ye.gecko){let y=Tu(t,l).getBoundingClientRect();Math.abs(y.left-f.right)<.1&&(x=!g)}if(m<=0)return{node:t,offset:l+(x?1:0)};s=l+(x?1:0),i=m}}}return{node:t,offset:s>-1?s:a>0?t.nodeValue.length:0}}function DI(t,e,n,r=-1){var s,i;let a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,c,{docHeight:h}=t.viewState,{x:f,y:m}=e,g=m-l;if(g<0)return 0;if(g>h)return t.state.doc.length;for(let T=t.viewState.heightOracle.textHeight/2,_=!1;c=t.elementAtHeight(g),c.type!=As.Text;)for(;g=r>0?c.bottom+T:c.top-T,!(g>=0&&g<=h);){if(_)return n?null:0;_=!0,r=-r}m=l+g;let x=c.from;if(x<t.viewport.from)return t.viewport.from==0?0:n?null:q9(t,a,c,f,m);if(x>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:q9(t,a,c,f,m);let y=t.dom.ownerDocument,w=t.root.elementFromPoint?t.root:y,S=w.elementFromPoint(f,m);S&&!t.contentDOM.contains(S)&&(S=null),S||(f=Math.max(a.left+1,Math.min(a.right-1,f)),S=w.elementFromPoint(f,m),S&&!t.contentDOM.contains(S)&&(S=null));let k,N=-1;if(S&&((s=t.docView.nearest(S))===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)||Ye.safari&&Yre(k,N,f)||Ye.chrome&&Kre(k,N,f))&&(k=void 0),k&&(N=Math.min(io(k),N))}if(!k||!t.docView.dom.contains(k)){let T=Rr.find(t.docView,x);if(!T)return g>c.top+c.height/2?c.to:c.from;({node:k,offset:N}=fS(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.y<T.top||e.y<=T.bottom&&e.x<=(T.left+T.right)/2?C.posAtStart:C.posAtEnd}else return C.localPosFromDOM(k,N)+C.posAtStart}function q9(t,e,n,r,s){let i=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,c=Math.floor((s-n.top-(t.defaultLineHeight-l)*.5)/l);i+=c*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(n.from,n.to);return n.from+Z3(a,i,t.state.tabSize)}function zI(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 Tu(t,r-1,r).getBoundingClientRect().right>n}function Yre(t,e,n){return zI(t,e,n)}function Kre(t,e,n){if(e!=0)return zI(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():Tu(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function mS(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.to<e)){if(i.from<e&&i.to>e)return i;(!s||i.type==As.Text&&(s.type!=i.type||(n<0?i.from<e:i.to>e)))&&(s=i)}}return s||r}return r}function Zre(t,e,n,r){let s=mS(t,e.head,e.assoc||-1),i=!r||s.type!=As.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(),l=t.textDirectionAt(s.from),c=t.posAtCoords({x:n==(l==Jn.LTR)?a.right-1:a.left+1,y:(i.top+i.bottom)/2});if(c!=null)return Ae.cursor(c,n?-1:1)}return Ae.cursor(n?s.to:s.from,n?-1:1)}function F9(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),a=t.textDirectionAt(s.from);for(let l=e,c=null;;){let h=Lre(s,i,a,l,n),f=vI;if(!h){if(s.number==(n?t.state.doc.lines:1))return l;f=`
`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(c){if(!c(f))return l}else{if(!r)return h;c=r(f)}l=h}}function Jre(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let a=r(i);return s==rr.Space&&(s=a),s==a}}function ese(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Ae.cursor(s,e.assoc);let a=e.goalColumn,l,c=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),f=t.documentTop;if(h)a==null&&(a=h.left-c.left),l=i<0?h.top:h.bottom;else{let x=t.viewState.lineBlockAt(s);a==null&&(a=Math.min(c.right-c.left,t.defaultCharacterWidth*(s-x.from))),l=(i<0?x.top:x.bottom)+f}let m=c.left+a,g=r??t.viewState.heightOracle.textHeight>>1;for(let x=0;;x+=10){let y=l+(g+x)*i,w=DI(t,{x:m,y},!1,i);if(y<c.top||y>c.bottom||(i<0?w<s:w>s)){let S=t.docView.coordsForChar(w),k=!S||y<S.top?-1:1;return Ae.cursor(w,k,void 0,a)}}}function Tm(t,e,n){for(;;){let r=0;for(let s of t)s.between(e-1,e+1,(i,a,l)=>{if(e>i&&e<a){let c=r||n||(e-i<a-e?-1:1);e=c<0?i:a,r=c}});if(!r)return e}}function PI(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let s=e.ranges[r],i=null;if(s.empty){let a=Tm(t,s.from,0);a!=s.from&&(i=Ae.cursor(a,-1))}else{let a=Tm(t,s.from,-1),l=Tm(t,s.to,1);(a!=s.from||l!=s.to)&&(i=Ae.range(s.from==s.anchor?a:l,s.from==s.head?a:l))}i&&(n||(n=e.ranges.slice()),n[r]=i)}return n?Ae.create(n,e.mainIndex):e}function uw(t,e,n){let r=Tm(t.state.facet(H0).map(s=>s(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ae.cursor(r,r<n.from?1:-1)}const fm="￿";class tse{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(rn.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=fm}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let s=e;;){this.findPointBefore(r,s);let i=this.text.length;this.readNode(s);let a=s.nextSibling;if(a==n)break;let l=In.get(s),c=In.get(a);(l&&c?l.breakAfter:(l?l.breakAfter:M1(s))||M1(a)&&(s.nodeName!="BR"||s.cmIgnore)&&this.text.length>i)&&!rse(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,l;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(l=s.exec(n))&&(i=l.index,a=l[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=a-1);r=i+a}}readNode(e){if(e.cmIgnore)return;let n=In.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+(nse(e,r.node,r.offset)?n:0))}}function nse(t,e,n){for(;;){if(!e||n<io(e))return!1;if(e==t)return!0;n=Cu(e)+1,e=e.parentNode}}function rse(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=In.get(t);if(!(r?.isWidget||t.cmIgnore))return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let s=r.overrideDOMText;if(s?.length)return!1}return!0}class $9{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class sse{constructor(e,n,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=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 l=i||a?[]:ase(e),c=new tse(l,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=ose(l,this.bounds.from)}else{let l=e.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!iS(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=a&&a.node==l.anchorNode&&a.offset==l.anchorOffset||!iS(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),f=e.viewport;if((Ye.ios||Ye.chrome)&&e.state.selection.main.empty&&c!=h&&(f.from>0||f.to<e.state.doc.length)){let m=Math.min(c,h),g=Math.max(c,h),x=f.from-m,y=f.to-g;(x==0||x==1||m==0)&&(y==0||y==-1||g==e.state.doc.length)&&(c=0,h=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ae.range(h,c)):this.newSel=Ae.single(h,c)}}}function LI(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:l}=e.bounds,c=s.from,h=null;(i===8||Ye.android&&e.text.length<l-a)&&(c=s.to,h="end");let f=II(t.state.doc.sliceString(a,l,fm),e.text,c-a,h);f&&(Ye.chrome&&i==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==fm+fm&&f.toB--,n={from:a+f.from,to:a+f.toA,insert:an.of(e.text.slice(f.from,f.toB).split(fm))})}else r&&(!t.hasFocus&&t.state.facet(Yo)||r.main.eq(s))&&(r=null);if(!n&&!r)return!1;if(!n&&e.typeOver&&!s.empty&&r&&r.main.empty?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,s.to)}:(Ye.mac||Ye.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=Ae.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:an.of([n.insert.toString().replace("."," ")])}):n&&n.from>=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).to<s.to&&t.docView.lineHasWidget(s.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Ye.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==`
`&&t.lineWrapping&&(r&&(r=Ae.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:an.of([" "])}),n)return N6(t,n,r,i);if(r&&!r.main.eq(s)){let a=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=PI(t.state.facet(H0).map(c=>c(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function N6(t,e,n,r=-1){if(Ye.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Ye.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&&eh(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&eh(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&eh(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,l=()=>a||(a=ise(t,e,n));return t.state.facet(kI).some(c=>c(t,e.from,e.to,i,l))||t.dispatch(l()),!0}function ise(t,e,n){let r,s=t.state,i=s.selection.main,a=-1;if(e.from==e.to&&e.from<i.from||e.from>i.to){let c=e.from<i.from?-1:1,h=c<0?i.from:i.to,f=Tm(s.facet(H0).map(m=>m(t)),h,c);e.from==f&&(a=f)}if(a>-1)r={changes:e,selection:Ae.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 c=i.from<e.from?s.sliceDoc(i.from,e.from):"",h=i.to>e.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(c+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let c=s.changes(e),h=n&&n.main.to<=c.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&&RI(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:c,range:h||y.map(c)};let w=y.to-x,S=w-f.length;if(t.state.sliceDoc(S,w)!=f||w>=m.from&&S<=m.to)return{range:y};let k=s.changes({from:S,to:w,insert:e.insert}),N=y.to-i.to;return{changes:k,range:h?Ae.range(Math.max(0,h.anchor+N),Math.max(0,h.head+N)):y.map(k)}})}else r={changes:c,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:l,scrollIntoView:!0})}function II(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i<s&&t.charCodeAt(i)==e.charCodeAt(i);)i++;if(i==s&&t.length==e.length)return null;let a=t.length,l=e.length;for(;a>0&&l>0&&t.charCodeAt(a-1)==e.charCodeAt(l-1);)a--,l--;if(r=="end"){let c=Math.max(0,i-Math.min(a,l));n-=a+c-i}if(a<i&&t.length<e.length){let c=n<=i&&n>=a?i-n:0;i-=c,l=i+(l-a),a=i}else if(l<i){let c=n<=i&&n>=l?i-n:0;i-=c,a=i+(a-l),l=i}return{from:i,toA:a,toB:l}}function ase(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 $9(n,r)),(s!=n||i!=r)&&e.push(new $9(s,i))),e}function ose(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?Ae.single(n+e,r+e):null}class lse{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,Ye.safari&&e.contentDOM.addEventListener("input",()=>null),Ye.gecko&&Ose(e.contentDOM.ownerDocument)}handleEvent(e){!gse(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=cse(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let a=!n[i].handlers.length,l=r[i];l&&a!=!l.handlers.length&&(s.removeEventListener(i,this.handleEvent),l=null),l||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&&qI.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Ye.android&&Ye.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Ye.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=BI.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||use.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.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,eh(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Ye.safari&&!Ye.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 Q9(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){Zs(n.state,s)}}}function cse(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 l in i){let c=i[l];c&&n(l).handlers.push(Q9(r.value,c))}if(a)for(let l in a){let c=a[l];c&&n(l).observers.push(Q9(r.value,c))}}for(let r in Oa)n(r).handlers.push(Oa[r]);for(let r in ia)n(r).observers.push(ia[r]);return e}const BI=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],use="dthko",qI=[16,17,18,20,91,92,224,225],Yg=6;function Kg(t){return Math.max(0,t)*.7+8}function dse(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class hse{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=bre(e.contentDOM),this.atoms=e.state.facet(H0).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(rn.allowMultipleSelections)&&fse(e,n),this.dragging=pse(e,n)&&QI(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&&dse(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=j6(this.view);e.clientX-c.left<=s+Yg?n=-Kg(s-e.clientX):e.clientX+c.right>=a-Yg&&(n=Kg(e.clientX-a)),e.clientY-c.top<=i+Yg?r=-Kg(i-e.clientY):e.clientY+c.bottom>=l-Yg&&(r=Kg(e.clientY-l)),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=PI(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 fse(t,e){let n=t.state.facet(yI);return n.length?n[0](e):Ye.mac?e.metaKey:e.ctrlKey}function mse(t,e){let n=t.state.facet(bI);return n.length?n[0](e):Ye.mac?!e.altKey:!e.ctrlKey}function pse(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Vm(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let a=s[i];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function gse(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=In.get(n))&&r.ignoreEvent(e))return!1;return!0}const Oa=Object.create(null),ia=Object.create(null),FI=Ye.ie&&Ye.ie_version<15||Ye.ios&&Ye.webkit_version<604;function xse(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(),$I(t,n.value)},50)}function Hv(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function $I(t,e){e=Hv(t.state,S6,e);let{state:n}=t,r,s=1,i=n.toText(e),a=i.lines==n.selection.ranges.length;if(pS!=null&&n.selection.ranges.every(c=>c.empty)&&pS==i.toString()){let c=-1;r=n.changeByRange(h=>{let f=n.doc.lineAt(h.from);if(f.from==c)return{range:h};c=f.from;let m=n.toText((a?i.line(s++).text:e)+n.lineBreak);return{changes:{from:f.from,insert:m},range:Ae.cursor(h.from+m.length)}})}else a?r=n.changeByRange(c=>{let h=i.line(s++);return{changes:{from:c.from,to:c.to,insert:h.text},range:Ae.cursor(c.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}ia.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Oa.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);ia.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};ia.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Oa.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(wI))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=bse(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new hse(t,e,n,r)),r&&t.observer.ignore(()=>{nI(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 H9(t,e,n,r){if(r==1)return Ae.cursor(e,n);if(r==2)return Wre(t.state,e,n);{let s=Rr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),a=s?s.posAtStart:i.from,l=s?s.posAtEnd:i.to;return l<t.state.doc.length&&l==i.to&&l++,Ae.range(a,l)}}let V9=(t,e,n)=>e>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function vse(t,e,n,r){let s=Rr.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&&V9(n,r,a))return-1;let l=s.coordsAt(i,1);return l&&V9(n,r,l)?1:a&&a.bottom>=r?-1:1}function U9(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:vse(t,n,e.clientX,e.clientY)}}const yse=Ye.ie&&Ye.ie_version<=11;let W9=null,G9=0,X9=0;function QI(t){if(!yse)return t.detail;let e=W9,n=X9;return W9=t,X9=Date.now(),G9=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(G9+1)%3:1}function bse(t,e){let n=U9(t,e),r=QI(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,l){let c=U9(t,i),h,f=H9(t,c.pos,c.bias,r);if(n.pos!=c.pos&&!a){let m=H9(t,n.pos,n.bias,r),g=Math.min(m.from,f.from),x=Math.max(m.to,f.to);f=g<f.from?Ae.range(g,x):Ae.range(x,g)}return a?s.replaceRange(s.main.extend(f.from,f.to)):l&&r==1&&s.ranges.length>1&&(h=wse(s,c.pos))?h:l?s.addRange(f):Ae.create([f])}}}function wse(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:s}=t.ranges[n];if(r<=e&&s>=e)return Ae.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}Oa.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=Ae.range(i,a))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Hv(t.state,k6,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Oa.dragend=t=>(t.inputState.draggedContent=null,!1);function Y9(t,e,n,r){if(n=Hv(t.state,S6,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,a=r&&i&&mse(t,e)?{from:i.from,to:i.to}:null,l={from:s,insert:n},c=t.state.changes(a?[a,l]:l);t.focus(),t.dispatch({changes:c,selection:{anchor:c.mapPos(s,-1),head:c.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Oa.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&&Y9(t,e,r.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a<n.length;a++){let l=new FileReader;l.onerror=i,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[a]=l.result),i()},l.readAsText(n[a])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Y9(t,e,r,!0),!0}return!1};Oa.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=FI?null:e.clipboardData;return n?($I(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(xse(t),!1)};function Sse(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 kse(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:Hv(t,k6,e.join(t.lineBreak)),ranges:n,linewise:r}}let pS=null;Oa.copy=Oa.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=kse(t.state);if(!n&&!s)return!1;pS=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=FI?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(Sse(t,n),!1)};const HI=lo.define();function VI(t,e){let n=[];for(let r of t.facet(OI)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:HI.of(!0)}):null}function UI(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=VI(t.state,e);n?t.dispatch(n):t.update([])}},10)}ia.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),UI(t)};ia.blur=t=>{t.observer.clearSelectionRange(),UI(t)};ia.compositionstart=ia.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};ia.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,Ye.chrome&&Ye.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};ia.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Oa.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 l=a[0],c=t.posAtDOM(l.startContainer,l.startOffset),h=t.posAtDOM(l.endContainer,l.endOffset);return N6(t,{from:c,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Ye.chrome&&Ye.android&&(s=BI.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 Ye.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Ye.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>ia.compositionend(t,e),20),!1};const K9=new Set;function Ose(t){K9.has(t)||(K9.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Z9=["pre-wrap","normal","pre-line","break-spaces"];let wh=!1;function J9(){wh=!1}class jse{constructor(e){this.lineWrapping=e,this.doc=an.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 Z9.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(n=!0,this.heightSamples[Math.floor(s*10)]=!0)}return n}refresh(e,n,r,s,i,a){let l=Z9.indexOf(e)>-1,c=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,c){this.heightSamples={};for(let h=0;h<a.length;h++){let f=a[h];f<0?h++:this.heightSamples[Math.floor(f*10)]=!0}}return c}}class Nse{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Wa{constructor(e,n,r,s,i){this.from=e,this.length=n,this.top=r,this.height=s,this._content=i}get type(){return typeof this._content=="number"?As.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof vc?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Wa(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Zn=(function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t})(Zn||(Zn={}));const n1=.001;class Rs{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>n1&&(wh=!0),this.height=e)}replace(e,n,r){return Rs.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 l=s.length-1;l>=0;l--){let{fromA:c,toA:h,fromB:f,toB:m}=s[l],g=i.lineAt(c,Zn.ByPosNoHeight,r.setDoc(n),0,0),x=g.to>=h?g:i.lineAt(h,Zn.ByPosNoHeight,r,0,0);for(m+=x.to-h,h=x.to;l>0&&g.from<=s[l-1].toA;)c=s[l-1].fromA,f=s[l-1].fromB,l--,c<g.from&&(g=i.lineAt(c,Zn.ByPosNoHeight,r,0,0));f+=g.from-c,c=g.from;let y=C6.build(r.setDoc(a),e,f,m);i=D1(i,i.replace(c,h,y))}return i.updateHeight(r,0)}static empty(){return new Oi(0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,s=0,i=0;for(;;)if(n==r)if(s>i*2){let l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),r+=1+l.break,s-=l.size}else if(i>s*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,i-=l.size}else break;else if(s<i){let l=e[n++];l&&(s+=l.size)}else{let l=e[--r];l&&(i+=l.size)}let a=0;return e[n-1]==null?(a=1,n--):e[n]==null&&(a=1,r++),new Cse(Rs.of(e.slice(0,n)),a,Rs.of(e.slice(r)))}}function D1(t,e){return t==e?t:(t.constructor!=e.constructor&&(wh=!0),e)}Rs.prototype.size=1;class WI extends Rs{constructor(e,n,r){super(e,n),this.deco=r}blockAt(e,n,r,s){return new Wa(s,this.length,r,this.height,this.deco||0)}lineAt(e,n,r,s,i){return this.blockAt(0,r,s,i)}forEachLine(e,n,r,s,i,a){e<=i+this.length&&n>=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 WI{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new Wa(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 cs&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof cs?s=new Oi(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):Rs.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 cs extends Rs{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,l=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*i);a=c/i,this.length>i+1&&(l=(this.height-c)/(this.length-i-1))}else a=this.height/i;return{firstLine:r,lastLine:s,perLine:a,perChar:l}}blockAt(e,n,r,s){let{firstLine:i,lastLine:a,perLine:l,perChar:c}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),f=n.doc.lineAt(h),m=l+f.length*c,g=Math.max(r,e-m/2);return new Wa(f.from,f.length,g,m,0)}else{let h=Math.max(0,Math.min(a-i,Math.floor((e-r)/l))),{from:f,length:m}=n.doc.line(i+h);return new Wa(f,m,r+l*h,l,0)}}lineAt(e,n,r,s,i){if(n==Zn.ByHeight)return this.blockAt(e,r,s,i);if(n==Zn.ByPosNoHeight){let{from:x,to:y}=r.doc.lineAt(e);return new Wa(x,y-x,0,0,0)}let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,i),h=r.doc.lineAt(e),f=l+h.length*c,m=h.number-a,g=s+l*m+c*(h.from-i-m);return new Wa(h.from,h.length,Math.max(s,Math.min(g,s+this.height-f)),f,0)}forEachLine(e,n,r,s,i,a){e=Math.max(e,i),n=Math.min(n,i+this.length);let{firstLine:l,perLine:c,perChar:h}=this.heightMetrics(r,i);for(let f=e,m=s;f<=n;){let g=r.doc.lineAt(f);if(f==e){let y=g.number-l;m+=c*y+h*(e-i-y)}let x=c+h*g.length;a(new Wa(g.from,g.length,m,x,0)),m+=x,f=g.to+1}}replace(e,n,r){let s=this.length-n;if(s>0){let i=r[r.length-1];i instanceof cs?r[r.length-1]=new cs(i.length+s):r.push(null,new cs(s-1))}if(e>0){let i=r[0];i instanceof cs?r[0]=new cs(e+i.length):r.unshift(new cs(e-1),null)}return Rs.of(r)}decomposeLeft(e,n){n.push(new cs(e-1),null)}decomposeRight(e,n){n.push(null,new cs(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=[],l=Math.max(n,s.from),c=-1;for(s.from>n&&a.push(new cs(s.from-n-1).updateHeight(e,n));l<=i&&s.more;){let f=e.doc.lineAt(l).length;a.length&&a.push(null);let m=s.heights[s.index++];c==-1?c=m:Math.abs(m-c)>=n1&&(c=-2);let g=new Oi(f,m);g.outdated=!1,a.push(g),l+=f+1}l<=i&&a.push(null,new cs(i-l).updateHeight(e,l));let h=Rs.of(a);return(c<0||Math.abs(h.height-this.height)>=n1||Math.abs(c-this.heightMetrics(e,n).perLine)>=n1)&&(wh=!0),D1(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 Cse extends Rs{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 e<i?this.left.blockAt(e,n,r,s):this.right.blockAt(e,n,i,s+this.left.length+this.break)}lineAt(e,n,r,s,i){let a=s+this.left.height,l=i+this.left.length+this.break,c=n==Zn.ByHeight?e<a:e<l,h=c?this.left.lineAt(e,n,r,s,i):this.right.lineAt(e,n,r,a,l);if(this.break||(c?h.to<l:h.from>l))return h;let f=n==Zn.ByPosNoHeight?Zn.ByPosNoHeight:Zn.ByPos;return c?h.join(this.right.lineAt(l,f,r,a,l)):this.left.lineAt(l,f,r,s,i).join(h)}forEachLine(e,n,r,s,i,a){let l=s+this.left.height,c=i+this.left.length+this.break;if(this.break)e<c&&this.left.forEachLine(e,n,r,s,i,a),n>=c&&this.right.forEachLine(e,n,r,l,c,a);else{let h=this.lineAt(c,Zn.ByPos,r,s,i);e<h.from&&this.left.forEachLine(e,h.from-1,r,s,i,a),h.to>=e&&h.from<=n&&a(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,l,c,a)}}replace(e,n,r){let s=this.left.length+this.break;if(n<s)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.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 l of r)i.push(l);if(e>0&&eT(i,a-1),n<this.length){let l=i.length;this.decomposeRight(n,i),eT(i,l)}return Rs.of(i)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=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);e<r&&this.left.decomposeRight(e,n),this.break&&e<s&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?Rs.of(this.break?[e,null,n]:[e,n]):(this.left=D1(this.left,e),this.right=D1(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,l=n+i.length+this.break,c=null;return s&&s.from<=n+i.length&&s.more?c=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=l+a.length&&s.more?c=a=a.updateHeight(e,l,r,s):a.updateHeight(e,l,r),c?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 eT(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof cs&&(r=t[e+1])instanceof cs&&t.splice(e-1,3,new cs(n.length+1+r.length))}const Tse=5;class C6{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<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,i=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let a=n-e;r.block?this.addBlock(new WI(a,s,r)):(a||i||s>=Tse)&&this.addLineDeco(s,i,a)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Oi(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new cs(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.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let s of this.nodes)s instanceof Oi&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(e,n,r,s){let i=new C6(r,e);return ln.spans(n,r,s,i,0),i.finish(r)}}function Ese(t,e,n){let r=new _se;return ln.compare(t,e,n,r,0),r.changes}class _se{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,s){(e<n||r&&r.heightRelevant||s&&s.heightRelevant)&&t1(e,n,this.changes,5)}}function Mse(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,s=r.defaultView||window,i=Math.max(0,n.left),a=Math.min(s.innerWidth,n.right),l=Math.max(0,n.top),c=Math.min(s.innerHeight,n.bottom);for(let h=t.parentNode;h&&h!=r.body;)if(h.nodeType==1){let f=h,m=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&m.overflow!="visible"){let g=f.getBoundingClientRect();i=Math.max(i,g.left),a=Math.min(a,g.right),l=Math.max(l,g.top),c=Math.min(h==t.parentNode?s.innerHeight:c,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:l-(n.top+e),bottom:Math.max(l,c)-(n.top+e)}}function Ase(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function Rse(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class dw{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;r<e.length;r++){let s=e[r],i=n[r];if(s.from!=i.from||s.to!=i.to||s.size!=i.size)return!1}return!0}draw(e,n){return ft.replace({widget:new Dse(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class Dse extends uo{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class tT{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=nT,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Jn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(O6).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new jse(n),this.stateDeco=e.facet(Um).filter(r=>typeof r!="function"),this.heightMap=Rs.empty().applyChanges(this.stateDeco,an.empty,this.heightOracle.setDoc(e.doc),[new ta(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=ft.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 Zg(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?nT:new T6(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(mm(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Um).filter(f=>typeof f!="function");let s=e.changedRanges,i=ta.extendWithRanges(s,Ese(r,this.stateDeco,e?e.changes:$r.empty(this.state.doc.length))),a=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);J9(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||wh)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let c=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<c.from||n.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,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(NI)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Jn.RTL:Jn.LTR;let a=this.heightOracle.mustRefreshForWrapping(i),l=n.getBoundingClientRect(),c=a||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,f=0;if(l.width&&l.height){let{scaleX:T,scaleY:_}=tI(n,l);(T>.005&&Math.abs(this.scaleX-T)>.005||_>.005&&Math.abs(this.scaleY-_)>.005)&&(this.scaleX=T,this.scaleY=_,h|=16,a=c=!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&&(c=!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=sI(e.scrollDOM);let y=(this.printing?Rse:Mse)(n,this.paddingTop),w=y.top-this.pixelViewport.top,S=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&&(c=!0)),!this.inView&&!this.scrollTarget&&!Ase(e.dom))return 0;let N=l.width;if((this.contentDOMWidth!=N||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),c){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:_,charWidth:E,textHeight:M}=e.docView.measureTextSize();a=_>0&&s.refresh(i,_,E,M,Math.max(5,N/E),T),a&&(e.docView.minWidth=0,h|=16)}w>0&&S>0?f=Math.max(w,S):w<0&&S<0&&(f=Math.min(w,S)),J9();for(let _ of this.viewports){let E=_.from==this.viewport.from?T:e.docView.measureVisibleLineHeights(_);this.heightMap=(a?Rs.empty().applyChanges(this.stateDeco,an.empty,this.heightOracle,[new ta(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new Nse(_.from,E))}wh&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.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:l}=this,c=new Zg(s.lineAt(a-r*1e3,Zn.ByHeight,i,0,0).from,s.lineAt(l+(1-r)*1e3,Zn.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(h<c.from||h>c.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),m=s.lineAt(h,Zn.ByPos,i,0,0),g;n.y=="center"?g=(m.top+m.bottom)/2-f/2:n.y=="start"||n.y=="nearest"&&h<c.from?g=m.top:g=m.bottom-f,c=new Zg(s.lineAt(g-1e3/2,Zn.ByHeight,i,0,0).from,s.lineAt(g+f+1e3/2,Zn.ByHeight,i,0,0).to)}}return c}mapViewport(e,n){let r=n.mapPos(e.from,-1),s=n.mapPos(e.to,1);return new Zg(this.heightMap.lineAt(r,Zn.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Zn.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,Zn.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Zn.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:l}=this;return(e==0||s<=a-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||i>=l+Math.max(10,Math.min(r,250)))&&s>a-2*1e3&&i<l+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let s of e)n.touchesRange(s.from,s.to)||r.push(new dw(n.mapPos(s.from),n.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,i=s>>1,a=s<<1;if(this.defaultTextDirection!=Jn.LTR&&!r)return[];let l=[],c=(f,m,g,x)=>{if(m-f<i)return;let y=this.state.selection.main,w=[y.from];y.empty||w.push(y.to);for(let k of w)if(k>f&&k<m){c(f,k-10,g,x),c(k+10,m,g,x);return}let S=Pse(e,k=>k.from>=g.from&&k.to<=g.to&&Math.abs(k.from-f)<i&&Math.abs(k.to-m)<i&&!w.some(N=>k.from<N&&k.to>N));if(!S){if(m<g.to&&n&&r&&n.visibleRanges.some(C=>C.from<=m&&C.to>=m)){let C=n.moveToLineBoundary(Ae.cursor(m),!1,!0).head;C>f&&(m=C)}let k=this.gapSize(g,f,m,x),N=r||k<2e6?k:2e6;S=new dw(f,m,k,N)}l.push(S)},h=f=>{if(f.length<a||f.type!=As.Text)return;let m=zse(f.from,f.to,this.stateDeco);if(m.total<a)return;let g=this.scrollTarget?this.scrollTarget.range.head:null,x,y;if(r){let w=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,S,k;if(g!=null){let N=ex(m,g),C=((this.visibleBottom-this.visibleTop)/2+w)/f.height;S=N-C,k=N+C}else S=(this.visibleTop-f.top-w)/f.height,k=(this.visibleBottom-f.top+w)/f.height;x=Jg(m,S),y=Jg(m,k)}else{let w=m.total*this.heightOracle.charWidth,S=s*this.heightOracle.charWidth,k=0;if(w>2e6)for(let E of e)E.from>=f.from&&E.from<f.to&&E.size!=E.displaySize&&E.from*this.heightOracle.charWidth+k<this.pixelViewport.left&&(k=E.size-E.displaySize);let N=this.pixelViewport.left+k,C=this.pixelViewport.right+k,T,_;if(g!=null){let E=ex(m,g),M=((C-N)/2+S)/w;T=E-M,_=E+M}else T=(N-S)/w,_=(C+S)/w;x=Jg(m,T),y=Jg(m,_)}x>f.from&&c(f.from,x,f,m),y<f.to&&c(y,f.to,f,m)};for(let f of this.viewportLines)Array.isArray(f.type)?f.type.forEach(h):h(f);return l}gapSize(e,n,r,s){let i=ex(s,r)-ex(s,n);return this.heightOracle.lineWrapping?e.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(e){dw.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ft.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];ln.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<r.length&&!(s&8);i++){let a=this.visibleRanges[i],l=r[i];(a.from!=l.from||a.to!=l.to)&&(s|=4,e&&e.mapPos(a.from,-1)==l.from&&e.mapPos(a.to,1)==l.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||mm(this.heightMap.lineAt(e,Zn.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)||mm(this.heightMap.lineAt(this.scaler.fromDOM(e),Zn.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 mm(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 Zg=class{constructor(e,n){this.from=e,this.to=n}};function zse(t,e,n){let r=[],s=t,i=0;return ln.spans(n,t,e,{span(){},point(a,l){a>s&&(r.push({from:s,to:a}),i+=a-s),s=l}},20),s<e&&(r.push({from:s,to:e}),i+=e-s),{total:i,ranges:r}}function Jg({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=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],l=a-i;if(r<=l)return i+r;r-=l}}function ex(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 Pse(t,e){for(let n of t)if(e(n))return n}const nT={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class T6{constructor(e,n,r){let s=0,i=0,a=0;this.viewports=r.map(({from:l,to:c})=>{let h=n.lineAt(l,Zn.ByPos,e,0,0).top,f=n.lineAt(c,Zn.ByPos,e,0,0).bottom;return s+=f-h,{from:l,to:c,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let l of this.viewports)l.domTop=a+(l.top-i)*this.scale,a=l.domBottom=l.domTop+(l.bottom-l.top),i=l.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.top)return s+(e-r)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);r=i.bottom,s=i.domBottom}}fromDOM(e){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.domTop)return r+(e-s)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);r=i.bottom,s=i.domBottom}}eq(e){return e instanceof T6?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function mm(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Wa(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>mm(s,e)):t._content)}const tx=et.define({combine:t=>t.join(" ")}),gS=et.define({combine:t=>t.indexOf(!0)>-1}),xS=gc.newName(),GI=gc.newName(),XI=gc.newName(),YI={"&light":"."+GI,"&dark":"."+XI};function vS(t,e,n){return new gc(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 Lse=vS("."+xS,{"&":{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,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,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"}},YI),Ise={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},hw=Ye.ie&&Ye.ie_version<=11;class Bse{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new wre,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);(Ye.ie&&Ye.ie_version<=11||Ye.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&&Ye.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Ye.chrome&&Ye.chrome_version<126)&&(this.editContext=new Fse(e),e.state.facet(Yo)&&(e.contentDOM.editContext=this.editContext.editContext)),hw&&(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)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{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(Yo)?r.root.activeElement!=this.dom:!e1(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Ye.ie&&Ye.ie_version<=11||Ye.android&&Ye.chrome)&&!r.state.selection.main.empty&&s.focusNode&&Nm(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Vm(e.root);if(!n)return!1;let r=Ye.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&qse(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=e1(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&kre(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Ise),hw&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),hw&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let s=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&eh(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<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{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&&e1(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 sse(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=LI(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=rT(n,e.previousSibling||e.target.previousSibling,-1),s=rT(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(Yo)!=e.state.facet(Yo)&&(e.view.contentDOM.editContext=e.state.facet(Yo)?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 rT(t,e,n){for(;e;){let r=In.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 sT(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 Nm(a.node,a.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function qse(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return sT(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?sT(t,n):null}class Fse{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,l=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let h=c-l>r.text.length;l==this.from&&i<this.from?l=i:c==this.to&&i>this.to&&(c=i);let f=II(e.state.sliceDoc(l,c),r.text,(h?s.from:s.to)-l,h?"end":null);if(!f){let g=Ae.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+l,to:f.toA+l,insert:an.of(r.text.slice(f.from,f.toB).split(`
`))};if((Ye.mac||Ye.android)&&m.from==a-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(m={from:l,to:c,insert:an.of([r.text.replace("."," ")])}),this.pendingContextChange=m,!e.state.readOnly){let g=this.to-this.from+(m.to-m.from+m.insert.length);N6(e,m,Ae.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),m.from<m.to&&!m.insert.length&&e.inputState.composing>=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),l=this.toEditorPos(r.rangeEnd);a<l;a++){let c=e.coordsForChar(a);i=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||i||new DOMRect,s.push(i)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let i of r.getTextFormats()){let a=i.underlineStyle,l=i.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(l)){let c=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(c<h){let f=`text-decoration: underline ${/^[a-z]/.test(a)?a+" ":a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;s.push(ft.mark({attributes:{style:f}}).range(c,h))}}}e.dispatch({effects:TI.of(ft.set(s))})},this.handlers.compositionstart=()=>{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=Vm(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,l,c,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(i<this.to){if(i<this.from||a>this.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.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*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 We{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||Sre(e.parent)||document,this.viewState=new tT(e.state||rn.create(e)),e.scrollTo&&e.scrollTo.is(Xg)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Hd).map(s=>new lw(s));for(let s of this.plugins)s.update(this);this.observer=new Bse(this),this.inputState=new lse(this),this.inputState.ensureHandlers(this.plugins),this.docView=new P9(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 Dr?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,l=0,c=null;e.some(g=>g.annotation(HI))?(this.inputState.notifiedFocused=a,l=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=VI(i,a),c||(l=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(rn.phrases)!=this.state.facet(rn.phrases))return this.setState(i);s=R1.create(this,i,e),s.flags|=l;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 th(x.empty?x:Ae.cursor(x.head,x.head>x.anchor?-1:1))}for(let x of g.effects)x.is(Xg)&&(m=x.value.clip(this.state))}this.viewState.update(s,m),this.bidiCache=z1.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(hm)!=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(tx)!=s.state.facet(tx)&&(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(hS))try{g(s)}catch(x){Zs(this.state,x,"update listener")}(c||f)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),f&&!LI(this,f)&&h.force&&eh(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 tT(e),this.plugins=e.facet(Hd).map(r=>new lw(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new P9(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(Hd),r=e.state.facet(Hd);if(n!=r){let s=[];for(let i of r){let a=n.indexOf(i);if(a<0)s.push(new lw(i));else{let l=this.plugins[a];l.mustUpdate=e,s.push(l)}}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<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){Zs(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-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 l=0;;l++){if(a<0)if(sI(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 c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];c&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(x=>{try{return x.read(this)}catch(y){return Zs(this.state,y),iT}}),m=R1.create(this,this.state,[]),g=!1;m.flags|=c,n?n.flags|=c: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;x<h.length;x++)if(f[x]!=iT)try{let y=h[x];y.write&&y.write(f[x],this)}catch(y){Zs(this.state,y)}if(g&&this.docView.updateSelection(!0),!m.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let y=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-a;if(y>1||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 l of this.state.facet(hS))l(n)}get themeClasses(){return xS+" "+(this.state.facet(gS)?XI:GI)+" "+this.state.facet(tx)}updateAttrs(){let e=aT(this,EI,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Yo)?"true":"false",class:"cm-content",style:`${Ye.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),aT(this,O6,n);let r=this.observer.ignore(()=>{let s=oS(this.contentDOM,this.contentAttrs,n),i=oS(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(We.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(hm);let e=this.state.facet(We.cspNonce);gc.mount(this.root,this.styleModules.concat(Lse).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;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.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 uw(this,e,F9(this,e,n,r))}moveByGroup(e,n){return uw(this,e,F9(this,e,n,r=>Jre(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 Ae.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return Zre(this,e,n,r)}moveVertically(e,n,r){return uw(this,e,ese(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(),DI(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[cc.find(i,e-s.from,-1,n)];return F0(r,a.dir==Jn.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(jI)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>$se)return xI(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||gI(i.isolates,r=z9(this,e))))return i.order;r||(r=z9(this,e));let s=Pre(e.text,n,r);return this.bidiCache.push(new z1(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ye.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{nI(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 Xg.of(new th(typeof e=="number"?Ae.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 Xg.of(new th(Ae.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 jr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return jr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=gc.newName(),s=[tx.of(r),hm.of(vS(`.${r}`,e))];return n&&n.dark&&s.push(gS.of(!0)),s}static baseTheme(e){return _c.lowest(hm.of(vS("."+xS,e,YI)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&In.get(r)||In.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}We.styleModule=hm;We.inputHandler=kI;We.clipboardInputFilter=S6;We.clipboardOutputFilter=k6;We.scrollHandler=CI;We.focusChangeEffect=OI;We.perLineTextDirection=jI;We.exceptionSink=SI;We.updateListener=hS;We.editable=Yo;We.mouseSelectionStyle=wI;We.dragMovesSelection=bI;We.clickAddsSelectionRange=yI;We.decorations=Um;We.outerDecorations=_I;We.atomicRanges=H0;We.bidiIsolatedRanges=MI;We.scrollMargins=AI;We.darkTheme=gS;We.cspNonce=et.define({combine:t=>t.length?t[0]:""});We.contentAttributes=O6;We.editorAttributes=EI;We.lineWrapping=We.contentAttributes.of({class:"cm-lineWrapping"});We.announce=Et.define();const $se=4096,iT={};class z1{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:Jn.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let a=e[i];a.dir==s&&!n.touchesRange(a.from,a.to)&&r.push(new z1(n.mapPos(a.from,1),n.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return r}}function aT(t,e,n){for(let r=t.state.facet(e),s=r.length-1;s>=0;s--){let i=r[s],a=typeof i=="function"?i(t):i;a&&aS(a,n)}return n}const Qse=Ye.mac?"mac":Ye.windows?"win":Ye.linux?"linux":"key";function Hse(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,a,l;for(let c=0;c<n.length-1;++c){const h=n[c];if(/^(cmd|meta|m)$/i.test(h))l=!0;else if(/^a(lt)?$/i.test(h))s=!0;else if(/^(c|ctrl|control)$/i.test(h))i=!0;else if(/^s(hift)?$/i.test(h))a=!0;else if(/^mod$/i.test(h))e=="mac"?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+h)}return s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),l&&(r="Meta-"+r),a&&(r="Shift-"+r),r}function nx(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const Vse=_c.default(We.domEventHandlers({keydown(t,e){return ZI(KI(e.state),t,e,"editor")}})),V0=et.define({enables:Vse}),oT=new WeakMap;function KI(t){let e=t.facet(V0),n=oT.get(e);return n||oT.set(e,n=Gse(e.reduce((r,s)=>r.concat(s),[]))),n}function Use(t,e,n){return ZI(KI(t.state),e,t,n)}let ac=null;const Wse=4e3;function Gse(t,e=Qse){let n=Object.create(null),r=Object.create(null),s=(a,l)=>{let c=r[a];if(c==null)r[a]=l;else if(c!=l)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},i=(a,l,c,h,f)=>{var m,g;let x=n[a]||(n[a]=Object.create(null)),y=l.split(/ (?!$)/).map(k=>Hse(k,e));for(let k=1;k<y.length;k++){let N=y.slice(0,k).join(" ");s(N,!0),x[N]||(x[N]={preventDefault:!0,stopPropagation:!1,run:[C=>{let T=ac={view:C,prefix:N,scope:a};return setTimeout(()=>{ac==T&&(ac=null)},Wse),!0}]})}let w=y.join(" ");s(w,!1);let S=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())||[]});c&&S.run.push(c),h&&(S.preventDefault=!0),f&&(S.stopPropagation=!0)};for(let a of t){let l=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let h of l){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,yS))}let c=a[e]||a.key;if(c)for(let h of l)i(h,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&i(h,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return n}let yS=null;function ZI(t,e,n,r){yS=e;let s=gre(e),i=Ys(s,0),a=Ua(i)==s.length&&s!=" ",l="",c=!1,h=!1,f=!1;ac&&ac.view==n&&ac.scope==r&&(l=ac.prefix+" ",qI.indexOf(e.keyCode)<0&&(h=!0,ac=null));let m=new Set,g=S=>{if(S){for(let k of S.run)if(!m.has(k)&&(m.add(k),k(n)))return S.stopPropagation&&(f=!0),!0;S.preventDefault&&(S.stopPropagation&&(f=!0),h=!0)}return!1},x=t[r],y,w;return x&&(g(x[l+nx(s,e,!a)])?c=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ye.windows&&e.ctrlKey&&e.altKey)&&!(Ye.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(y=xc[e.keyCode])&&y!=s?(g(x[l+nx(y,e,!0)])||e.shiftKey&&(w=Hm[e.keyCode])!=s&&w!=y&&g(x[l+nx(w,e,!1)]))&&(c=!0):a&&e.shiftKey&&g(x[l+nx(s,e,!0)])&&(c=!0),!c&&g(x._any)&&(c=!0)),h&&(c=!0),c&&f&&e.stopPropagation(),yS=null,c}class U0{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=JI(e);return[new U0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return Xse(e,n,r)}}function JI(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Jn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function lT(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,l=t.posAtCoords({x:i.left+1,y:a}),c=t.posAtCoords({x:i.right-1,y:a});return l==null||c==null?r:{from:Math.max(r.from,Math.min(l,c)),to:Math.min(r.to,Math.max(l,c))}}function Xse(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==Jn.LTR,a=t.contentDOM,l=a.getBoundingClientRect(),c=JI(t),h=a.querySelector(".cm-line"),f=h&&window.getComputedStyle(h),m=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),g=l.right-(f?parseInt(f.paddingRight):0),x=mS(t,r,1),y=mS(t,s,-1),w=x.type==As.Text?x:null,S=y.type==As.Text?y:null;if(w&&(t.lineWrapping||x.widgetLineBreaks)&&(w=lT(t,r,1,w)),S&&(t.lineWrapping||y.widgetLineBreaks)&&(S=lT(t,s,-1,S)),w&&S&&w.from==S.from&&w.to==S.to)return N(C(n.from,n.to,w));{let _=w?C(n.from,null,w):T(x,!1),E=S?C(null,n.to,S):T(y,!0),M=[];return(w||x).to<(S||y).from-(w&&S?1:0)||x.widgetLineBreaks>1&&_.bottom+t.defaultLineHeight/2<E.top?M.push(k(m,_.bottom,g,E.top)):_.bottom<E.top&&t.elementAtHeight((_.bottom+E.top)/2).type==As.Text&&(_.bottom=E.top=(_.bottom+E.top)/2),N(_).concat(M).concat(N(E))}function k(_,E,M,q){return new U0(e,_-c.left,E-c.top,M-_,q-E)}function N({top:_,bottom:E,horizontal:M}){let q=[];for(let L=0;L<M.length;L+=2)q.push(k(M[L],_,M[L+1],E));return q}function C(_,E,M){let q=1e9,L=-1e9,I=[];function $(z,H,P,W,J){let X=t.coordsAtPos(z,z==M.to?-2:2),R=t.coordsAtPos(P,P==M.from?2:-2);!X||!R||(q=Math.min(X.top,R.top,q),L=Math.max(X.bottom,R.bottom,L),J==Jn.LTR?I.push(i&&H?m:X.left,i&&W?g:R.right):I.push(!i&&W?m:R.left,!i&&H?g:X.right))}let V=_??M.from,ee=E??M.to;for(let z of t.visibleRanges)if(z.to>V&&z.from<ee)for(let H=Math.max(z.from,V),P=Math.min(z.to,ee);;){let W=t.state.doc.lineAt(H);for(let J of t.bidiSpans(W)){let X=J.from+W.from,R=J.to+W.from;if(X>=P)break;R>H&&$(Math.max(X,H),_==null&&X<=V,Math.min(R,P),E==null&&R>=ee,J.dir)}if(H=W.to+1,H>=P)break}return I.length==0&&$(V,_==null,ee,E==null,t.textDirection),{top:q,bottom:L,horizontal:I}}function T(_,E){let M=l.top+(E?_.top:_.bottom);return{top:M,bottom:M,horizontal:[]}}}function Yse(t,e){return t.constructor==e.constructor&&t.eq(e)}class Kse{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(r1)!=e.state.facet(r1)&&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(r1);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!Yse(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,Ye.safari&&Ye.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 r1=et.define();function eB(t){return[jr.define(e=>new Kse(e,t)),r1.of(t)]}const Wm=et.define({combine(t){return co(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Zse(t={}){return[Wm.of(t),Jse,eie,tie,NI.of(!0)]}function tB(t){return t.startState.facet(Wm)!=t.state.facet(Wm)}const Jse=eB({above:!0,markers(t){let{state:e}=t,n=e.facet(Wm),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",l=s.empty?s:Ae.cursor(s.head,s.head>s.anchor?-1:1);for(let c of U0.forRange(t,a,l))r.push(c)}}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=tB(t);return n&&cT(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){cT(e.state,t)},class:"cm-cursorLayer"});function cT(t,e){e.style.animationDuration=t.facet(Wm).cursorBlinkRate+"ms"}const eie=eB({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:U0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||tB(t)},class:"cm-selectionLayer"}),tie=_c.highest(We.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"}}}})),nB=Et.define({map(t,e){return t==null?null:e.mapPos(t)}}),pm=rs.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(nB)?r.value:n,t)}}),nie=jr.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(pm);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(pm)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(pm),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(pm)!=t&&this.view.dispatch({effects:nB.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 rie(){return[pm,nie]}function uT(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),a=n,l;!i.next().done;a+=i.value.length)if(!i.lineBreak)for(;l=e.exec(i.value);)s(a+l.index,l)}function sie(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 iie{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=(l,c,h,f)=>s(f,h,h+l[0].length,l,c);else if(typeof r=="function")this.addMatch=(l,c,h,f)=>{let m=r(l,c,h);m&&f(h,h+l[0].length,m)};else if(r)this.addMatch=(l,c,h,f)=>f(h,h+l[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 dl,r=n.add.bind(n);for(let{from:s,to:i}of sie(e,this.maxLength))uT(e.state.doc,this.regexp,s,i,(a,l)=>this.addMatch(l,e,a,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,a,l,c)=>{c>=e.view.viewport.from&&l<=e.view.viewport.to&&(r=Math.min(l,r),s=Math.max(c,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),l=Math.min(i.to,s);if(l>=a){let c=e.state.doc.lineAt(a),h=c.to<l?e.state.doc.lineAt(l):c,f=Math.max(i.from,c.from),m=Math.min(i.to,h.to);if(this.boundary){for(;a>c.from;a--)if(this.boundary.test(c.text[a-1-c.from])){f=a;break}for(;l<h.to;l++)if(this.boundary.test(h.text[l-h.from])){m=l;break}}let g=[],x,y=(w,S,k)=>g.push(k.range(w,S));if(c==h)for(this.regexp.lastIndex=f-c.from;(x=this.regexp.exec(c.text))&&x.index<m-c.from;)this.addMatch(x,e,x.index+c.from,y);else uT(e.state.doc,this.regexp,f,m,(w,S)=>this.addMatch(S,e,w,y));n=n.update({filterFrom:f,filterTo:m,filter:(w,S)=>w<f||S>m,add:g})}}return n}}const bS=/x/.unicode!=null?"gu":"g",aie=new RegExp(`[\0-\b
--Ÿ­؜\u2028\u2029\uFEFF-]`,bS),oie={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 fw=null;function lie(){var t;if(fw==null&&typeof document<"u"&&document.body){let e=document.body.style;fw=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return fw||!1}const s1=et.define({combine(t){let e=co(t,{render:null,specialChars:aie,addSpecialChars:null});return(e.replaceTabs=!lie())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,bS)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,bS)),e}});function cie(t={}){return[s1.of(t),uie()]}let dT=null;function uie(){return dT||(dT=jr.fromClass(class{constructor(t){this.view=t,this.decorations=ft.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(s1)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new iie({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=Ys(e[0],0);if(i==9){let a=s.lineAt(r),l=n.state.tabSize,c=Bh(a.text,l,r-a.from);return ft.replace({widget:new mie((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=ft.replace({widget:new fie(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(s1);t.startState.facet(s1)!=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 die="•";function hie(t){return t>=32?die:t==10?"␤":String.fromCharCode(9216+t)}class fie extends uo{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=hie(this.code),r=e.state.phrase("Control character")+" "+(oie[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 mie extends uo{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 pie(){return xie}const gie=ft.line({class:"cm-activeLine"}),xie=jr.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(gie.range(s.from)),e=s.from)}return ft.set(n)}},{decorations:t=>t.decorations});class vie extends uo{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?vh(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=F0(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 yie(t){let e=jr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?ft.set([ft.widget({widget:new vie(t),side:1}).range(0)]):ft.none}get decorations(){return this.view.state.doc.length?ft.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,We.contentAttributes.of({"aria-placeholder":t})]:e}const wS=2e3;function bie(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>wS||n.off>wS||e.col<0||n.col<0){let a=Math.min(e.off,n.off),l=Math.max(e.off,n.off);for(let c=r;c<=s;c++){let h=t.doc.line(c);h.length<=l&&i.push(Ae.range(h.from+a,h.to+l))}}else{let a=Math.min(e.col,n.col),l=Math.max(e.col,n.col);for(let c=r;c<=s;c++){let h=t.doc.line(c),f=Z3(h.text,a,t.tabSize,!0);if(f<0)i.push(Ae.cursor(h.to));else{let m=Z3(h.text,l,t.tabSize);i.push(Ae.range(h.from+f,h.from+m))}}}return i}function wie(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function hT(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>wS?-1:s==r.length?wie(t,e.clientX):Bh(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function Sie(t,e){let n=hT(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 l=hT(t,s);if(!l)return r;let c=bie(t.state,n,l);return c.length?a?Ae.create(c.concat(r.ranges)):Ae.create(c):r}}:null}function kie(t){let e=(n=>n.altKey&&n.button==0);return We.mouseSelectionStyle.of((n,r)=>e(r)?Sie(n,r):null)}const Oie={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},jie={style:"cursor: crosshair"};function Nie(t={}){let[e,n]=Oie[t.key||"Alt"],r=jr.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,We.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?jie:null})]}const rx="-10000px";class rB{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(c=>c);if(s===this.input){for(let c of this.tooltipViews)c.update&&c.update(e);return!1}let a=[],l=n?[]:null;for(let c=0;c<i.length;c++){let h=i[c],f=-1;if(h){for(let m=0;m<this.tooltips.length;m++){let g=this.tooltips[m];g&&g.create==h.create&&(f=m)}if(f<0)a[c]=this.createTooltipView(h,c?a[c-1]:null),l&&(l[c]=!!h.above);else{let m=a[c]=this.tooltipViews[f];l&&(l[c]=n[f]),m.update&&m.update(e)}}}for(let c of this.tooltipViews)a.indexOf(c)<0&&(this.removeTooltipView(c),(r=c.destroy)===null||r===void 0||r.call(c));return n&&(l.forEach((c,h)=>n[h]=c),n.length=l.length),this.input=s,this.tooltips=i,this.tooltipViews=a,!0}}function Cie(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const mw=et.define({combine:t=>{var e,n,r;return{position:Ye.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)||Cie}}}),fT=new WeakMap,E6=jr.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(mw);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 rB(t,_6,(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(mw);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=rx,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(Ye.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=j6(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 l=this.manager.tooltipViews[a];return l.getCoords?l.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(mw).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,a=[];for(let l=0;l<this.manager.tooltips.length;l++){let c=this.manager.tooltips[l],h=this.manager.tooltipViews[l],{dom:f}=h,m=t.pos[l],g=t.size[l];if(!m||c.clip!==!1&&(m.bottom<=Math.max(n.top,r.top)||m.top>=Math.min(n.bottom,r.bottom)||m.right<Math.max(n.left,r.left)-.1||m.left>Math.min(n.right,r.right)+.1)){f.style.top=rx;continue}let x=c.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,y=x?7:0,w=g.right-g.left,S=(e=fT.get(h))!==null&&e!==void 0?e:g.bottom-g.top,k=h.offset||Eie,N=this.view.textDirection==Jn.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[l];!c.strictSide&&(T?m.top-S-y-k.y<r.top:m.bottom+S+y+k.y>r.bottom)&&T==r.bottom-m.bottom>m.top-r.top&&(T=this.above[l]=!T);let _=(T?m.top-r.top:r.bottom-m.bottom)-y;if(_<S&&h.resize!==!1){if(_<this.view.defaultLineHeight){f.style.top=rx;continue}fT.set(h,S),f.style.height=(S=_)/i+"px"}else f.style.height&&(f.style.height="");let E=T?m.top-S-y-k.y:m.bottom+y+k.y,M=C+w;if(h.overlap!==!0)for(let q of a)q.left<M&&q.right>C&&q.top<E+S&&q.bottom>E&&(E=T?q.top-S-2-y:q.bottom+y+2);if(this.position=="absolute"?(f.style.top=(E-t.parent.top)/i+"px",mT(f,(C-t.parent.left)/s)):(f.style.top=E/i+"px",mT(f,C/s)),x){let q=m.left+(N?k.x:-k.x)-(C+14-7);x.style.left=q/s+"px"}h.overlap!==!0&&a.push({left:C,top:E,right:M,bottom:E+S}),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=rx}},{eventObservers:{scroll(){this.maybeMeasure()}}});function mT(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const Tie=We.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"}}}),Eie={x:0,y:0},_6=et.define({enables:[E6,Tie]}),P1=et.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Vv{static create(e){return new Vv(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new rB(e,P1,(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 _ie=_6.compute([P1],t=>{let e=t.facet(P1);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:Vv.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class Mie{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;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.nearest(n.target);if(!r)return;let s,i=1;if(r instanceof Ko)s=r.posAtStart;else{if(s=e.posAtCoords(n),s==null)return;let l=e.coordsAtPos(s);if(!l||n.y<l.top||n.y>l.bottom||n.x<l.left-e.defaultCharacterWidth||n.x>l.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(s)).find(f=>f.from<=s&&f.to>=s),h=c&&c.dir==Jn.RTL?-1:1;i=n.x<l.left?-h:h}let a=this.source(e,s,i);if(a?.then){let l=this.pending={pos:s};a.then(c=>{this.pending==l&&(this.pending=null,c&&!(Array.isArray(c)&&!c.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(c)?c:[c])}))},c=>Zs(e.state,c,"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(E6),n=e?e.manager.tooltips.findIndex(r=>r.create==Vv.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&&!Aie(i.dom,e)||this.pending){let{pos:a}=s[0]||this.pending,l=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==l?this.view.posAtCoords(this.lastMove)!=a:!Rie(this.view,a,l,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 sx=4;function Aie(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let l=a.getBoundingClientRect();s=Math.min(l.top,s),i=Math.max(l.bottom,i)}return e.clientX>=n-sx&&e.clientX<=r+sx&&e.clientY>=s-sx&&e.clientY<=i+sx}function Rie(t,e,n,r,s,i){let a=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>r||a.right<r||a.top>s||Math.min(a.bottom,l)<s)return!1;let c=t.posAtCoords({x:r,y:s},!1);return c>=e&&c<=n}function Die(t,e={}){let n=Et.define(),r=rs.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 l of s){let c=i.changes.mapPos(l.pos,-1,ds.TrackDel);if(c!=null){let h=Object.assign(Object.create(null),l);h.pos=c,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(zie)&&(s=[]);return s},provide:s=>P1.from(s)});return{active:r,extension:[r,jr.define(s=>new Mie(s,t,r,n,e.hoverTime||300)),_ie]}}function sB(t,e){let n=t.plugin(E6);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const zie=Et.define(),pT=et.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 Gm(t,e){let n=t.plugin(iB),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const iB=jr.fromClass(class{constructor(t){this.input=t.state.facet(Xm),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(pT);this.top=new ix(t,!0,e.topContainer),this.bottom=new ix(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(pT);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ix(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ix(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Xm);if(n!=this.input){let r=n.filter(c=>c),s=[],i=[],a=[],l=[];for(let c of r){let h=this.specs.indexOf(c),f;h<0?(f=c(t.view),l.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 c of l)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>We.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class ix{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=gT(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=gT(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 gT(t){let e=t.nextSibling;return t.remove(),e}const Xm=et.define({enables:iB});class fl extends Nu{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}fl.prototype.elementClass="";fl.prototype.toDOM=void 0;fl.prototype.mapMode=ds.TrackBefore;fl.prototype.startSide=fl.prototype.endSide=-1;fl.prototype.point=!0;const i1=et.define(),Pie=et.define(),Lie={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ln.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Em=et.define();function Iie(t){return[aB(),Em.of({...Lie,...t})]}const xT=et.define({combine:t=>t.some(e=>e)});function aB(t){return[Bie]}const Bie=jr.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(Em).map(e=>new yT(t,e)),this.fixed=!t.state.facet(xT);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(xT)!=!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=ln.iter(this.view.state.facet(i1),this.view.viewport.from),r=[],s=this.gutters.map(i=>new qie(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 l of i.type)if(l.type==As.Text&&a){SS(n,r,l.from);for(let c of s)c.line(this.view,l,r);a=!1}else if(l.widget)for(let c of s)c.widget(this.view,l)}else if(i.type==As.Text){SS(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(Em),n=t.state.facet(Em),r=t.docChanged||t.heightChanged||t.viewportChanged||!ln.eq(t.startState.facet(i1),t.state.facet(i1),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 yT(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=>We.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==Jn.LTR?{left:r,right:s}:{right:r,left:s}})});function vT(t){return Array.isArray(t)?t:[t]}function SS(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class qie{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=ln.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 l=new oB(e,a,i,r);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,a,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];SS(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(Pie)){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 yT{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 c=i.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=s.clientY;let l=e.lineBlockAtHeight(a-e.documentTop);n.domEventHandlers[r](e,l,s)&&s.preventDefault()});this.markers=vT(n.markers(e)),n.initialSpacer&&(this.spacer=new oB(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=vT(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!ln.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 oB{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":""),Fie(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 l=a,c=i<n.length?n[i++]:null,h=!1;if(c){let f=c.elementClass;f&&(r+=" "+f);for(let m=a;m<this.markers.length;m++)if(this.markers[m].compare(c)){l=m,h=!0;break}}else l=this.markers.length;for(;a<l;){let f=this.markers[a++];if(f.toDOM){f.destroy(s);let m=s.nextSibling;s.remove(),s=m}}if(!c)break;c.toDOM&&(h?s=s.nextSibling:this.dom.insertBefore(c.toDOM(e),s)),h&&a++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function Fie(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const $ie=et.define(),Qie=et.define(),Vd=et.define({combine(t){return co(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let s in n){let i=r[s],a=n[s];r[s]=i?(l,c,h)=>i(l,c,h)||a(l,c,h):a}return r}})}});class pw extends fl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function gw(t,e){return t.state.facet(Vd).formatNumber(e,t.state)}const Hie=Em.compute([Vd],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet($ie)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new pw(gw(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(Qie)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Vd)!=e.state.facet(Vd),initialSpacer(e){return new pw(gw(e,bT(e.state.doc.lines)))},updateSpacer(e,n){let r=gw(n.view,bT(n.view.state.doc.lines));return r==e.number?e:new pw(r)},domEventHandlers:t.facet(Vd).domEventHandlers,side:"before"}));function Vie(t={}){return[Vd.of(t),aB(),Hie]}function bT(t){let e=9;for(;e<t;)e=e*10+9;return e}const Uie=new class extends fl{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Wie=i1.compute(["selection"],t=>{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(Uie.range(s)))}return ln.of(e)});function Gie(){return Wie}const lB=1024;let Xie=0;class xw{constructor(e,n){this.from=e,this.to=n}}class Qt{constructor(e={}){this.id=Xie++,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=zs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Qt.closedBy=new Qt({deserialize:t=>t.split(" ")});Qt.openedBy=new Qt({deserialize:t=>t.split(" ")});Qt.group=new Qt({deserialize:t=>t.split(" ")});Qt.isolate=new Qt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Qt.contextHash=new Qt({perNode:!0});Qt.lookAhead=new Qt({perNode:!0});Qt.mounted=new Qt({perNode:!0});class L1{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Qt.mounted.id]}}const Yie=Object.create(null);class zs{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):Yie,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new zs(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(Qt.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(Qt.group),i=-1;i<(s?s.length:0);i++){let a=n[i<0?r.name:s[i]];if(a)return a}}}}zs.none=new zs("",Object.create(null),0,8);class Uv{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let s=null;for(let i of e){let a=i(r);if(a){s||(s=Object.assign({},r.props));let l=a[1],c=a[0];c.combine&&c.id in s&&(l=c.combine(s[c.id],l)),s[c.id]=l}}n.push(s?new zs(r.name,s,r.id,r.flags):r)}return new Uv(n)}}const ax=new WeakMap,wT=new WeakMap;var Hr;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(Hr||(Hr={}));class Hn{constructor(e,n,r,s,i){if(this.type=e,this.children=n,this.positions=r,this.length=s,this.props=null,i&&i.length){this.props=Object.create(null);for(let[a,l]of i)this.props[typeof a=="number"?a:a.id]=l}}toString(){let e=L1.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new OS(this.topNode,e)}cursorAt(e,n=0,r=0){let s=ax.get(this)||this.topNode,i=new OS(s);return i.moveTo(e,n),ax.set(this,i._tree),i}get topNode(){return new ni(this,0,0,null)}resolve(e,n=0){let r=Ym(ax.get(this)||this.topNode,e,n,!1);return ax.set(this,r),r}resolveInner(e,n=0){let r=Ym(wT.get(this)||this.topNode,e,n,!0);return wT.set(this,r),r}resolveStack(e,n=0){return Jie(this,e,n)}iterate(e){let{enter:n,leave:r,from:s=0,to:i=this.length}=e,a=e.mode||0,l=(a&Hr.IncludeAnonymous)>0;for(let c=this.cursor(a|Hr.IncludeAnonymous);;){let h=!1;if(c.from<=i&&c.to>=s&&(!l&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;h=!0}for(;h&&r&&(l||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.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:R6(zs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Hn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Hn(zs.none,n,r,s)))}static build(e){return eae(e)}}Hn.empty=new Hn(zs.none,[],[],0);class M6{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 M6(this.buffer,this.index)}}class yc{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return zs.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],s=this.set.types[n],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),e+=4,r==e)return i;let a=[];for(;e<r;)a.push(this.childString(e)),e=this.buffer[e+3];return i+"("+a.join(",")+")"}findChild(e,n,r,s,i){let{buffer:a}=this,l=-1;for(let c=e;c!=n&&!(cB(i,s,a[c+1],a[c+2])&&(l=c,r>0));c=a[c+3]);return l}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),a=0;for(let l=e,c=0;l<n;){i[c++]=s[l++],i[c++]=s[l++]-r;let h=i[c++]=s[l++]-r;i[c++]=s[l++]-e,a=Math.max(a,h)}return new yc(i,a,this.set)}}function cB(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ym(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.to<e);){let a=!r&&t instanceof ni&&t.index<0?null:t.parent;if(!a)return t;t=a}let i=r?0:Hr.IgnoreOverlays;if(r)for(let a=t,l=a.parent;l;a=l,l=a.parent)a instanceof ni&&a.index<0&&((s=l.enter(e,n,i))===null||s===void 0?void 0:s.from)!=a.from&&(t=l);for(;;){let a=t.enter(e,n,i);if(!a)return t;t=a}}class uB{cursor(e=0){return new OS(this,e)}getChild(e,n=null,r=null){let s=ST(this,e,n,r);return s.length?s[0]:null}getChildren(e,n=null,r=null){return ST(this,e,n,r)}resolve(e,n=0){return Ym(this,e,n,!1)}resolveInner(e,n=0){return Ym(this,e,n,!0)}matchContext(e){return kS(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let s=n.lastChild;if(!s||s.to!=n.to)break;s.type.isError&&s.from==s.to?(r=n,n=s.prevSibling):n=s}return r}get node(){return this}get next(){return this.parent}}class ni extends uB{constructor(e,n,r,s){super(),this._tree=e,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,s,i=0){for(let a=this;;){for(let{children:l,positions:c}=a._tree,h=n>0?l.length:-1;e!=h;e+=n){let f=l[e],m=c[e]+a.from;if(cB(s,r,m,m+f.length)){if(f instanceof yc){if(i&Hr.ExcludeBuffers)continue;let g=f.findChild(0,f.buffer.length,n,r-m,s);if(g>-1)return new Ya(new Kie(a,f,e,m),null,g)}else if(i&Hr.IncludeAnonymous||!f.type.isAnonymous||A6(f)){let g;if(!(i&Hr.IgnoreMounts)&&(g=L1.get(f))&&!g.overlay)return new ni(g.tree,m,e,a);let x=new ni(f,m,e,a);return i&Hr.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(n<0?f.children.length-1:0,n,r,s)}}}if(i&Hr.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&Hr.IgnoreOverlays)&&(s=L1.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:a,to:l}of s.overlay)if((n>0?a<=i:a<i)&&(n<0?l>=i:l>i))return new ni(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 ST(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 kS(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 Kie{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class Ya extends uB{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 Ya(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&Hr.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 Ya(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 Ya(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 Ya(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 Hn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function dB(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;i<t.length;i++){let a=t[i];(a.from>n.from||a.to<n.to)&&(n=a,e=i)}let r=n instanceof ni&&n.index<0?null:n.parent,s=t.slice();return r?s[e]=r:s.splice(e,1),new Zie(s,n)}class Zie{constructor(e,n){this.heads=e,this.node=n}get next(){return dB(this.heads)}}function Jie(t,e,n){let r=t.resolveInner(e,n),s=null;for(let i=r instanceof ni?r:r.context.parent;i;i=i.parent)if(i.index<0){let a=i.parent;(s||(s=[r])).push(a.resolve(e,n)),i=a}else{let a=L1.get(i.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let l=new ni(a.tree,a.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Ym(l,e,n,!1))}}return s?dB(s):r}class OS{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 ni)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 ni?(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&Hr.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Hr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Hr.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<s.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(s.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let i=n+e,a=e<0?-1:r._tree.children.length;i!=a;i+=e){let l=r._tree.children[i];if(this.mode&Hr.IncludeAnonymous||l instanceof yc||!l.type.isAnonymous||A6(l))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<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let s=this.index,i=this.stack.length;i>=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<this.stack.length;s++)n=new Ya(this.buffer,n,this.stack[s]);return this.bufferNode=new Ya(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&n&&n(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(e){if(!this.buffer)return kS(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let s=e.length-1,i=this.stack.length-1;s>=0;i--){if(i<0)return kS(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 A6(t){return t.children.some(e=>e instanceof yc||!e.type.isAnonymous||A6(e))}function eae(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=lB,reused:i=[],minRepeatType:a=r.types.length}=t,l=Array.isArray(n)?new M6(n,n.length):n,c=r.types,h=0,f=0;function m(_,E,M,q,L,I){let{id:$,start:V,end:ee,size:z}=l,H=f,P=h;if(z<0)if(l.next(),z==-1){let se=i[$];M.push(se),q.push(V-_);return}else if(z==-3){h=$;return}else if(z==-4){f=$;return}else throw new RangeError(`Unrecognized record size: ${z}`);let W=c[$],J,X,R=V-_;if(ee-V<=s&&(X=S(l.pos-E,L))){let se=new Uint16Array(X.size-X.skip),G=l.pos-X.size,F=se.length;for(;l.pos>G;)F=k(X.start,se,F);J=new yc(se,ee-X.start,r),R=X.start-_}else{let se=l.pos-z;l.next();let G=[],F=[],U=$>=a?$:-1,te=0,ne=ee;for(;l.pos>se;)U>=0&&l.id==U&&l.size>=0?(l.end<=ne-s&&(y(G,F,V,te,l.end,ne,U,H,P),te=G.length,ne=l.end),l.next()):I>2500?g(V,se,G,F):m(V,se,G,F,U,I+1);if(U>=0&&te>0&&te<G.length&&y(G,F,V,te,V,ne,U,H,P),G.reverse(),F.reverse(),U>-1&&te>0){let Y=x(W,P);J=R6(W,G,F,0,G.length,0,ee-V,Y,Y)}else J=w(W,G,F,ee-V,H-ee,P)}M.push(J),q.push(R)}function g(_,E,M,q){let L=[],I=0,$=-1;for(;l.pos>E;){let{id:V,start:ee,end:z,size:H}=l;if(H>4)l.next();else{if($>-1&&ee<$)break;$<0&&($=z-s),L.push(V,ee,z),I++,l.next()}}if(I){let V=new Uint16Array(I*4),ee=L[L.length-2];for(let z=L.length-3,H=0;z>=0;z-=3)V[H++]=L[z],V[H++]=L[z+1]-ee,V[H++]=L[z+2]-ee,V[H++]=H;M.push(new yc(V,L[2]-ee,r)),q.push(ee-_)}}function x(_,E){return(M,q,L)=>{let I=0,$=M.length-1,V,ee;if($>=0&&(V=M[$])instanceof Hn){if(!$&&V.type==_&&V.length==L)return V;(ee=V.prop(Qt.lookAhead))&&(I=q[$]+V.length+ee)}return w(_,M,q,L,I,E)}}function y(_,E,M,q,L,I,$,V,ee){let z=[],H=[];for(;_.length>q;)z.push(_.pop()),H.push(E.pop()+M-L);_.push(w(r.types[$],z,H,I-L,V-I,ee)),E.push(L-M)}function w(_,E,M,q,L,I,$){if(I){let V=[Qt.contextHash,I];$=$?[V].concat($):[V]}if(L>25){let V=[Qt.lookAhead,L];$=$?[V].concat($):[V]}return new Hn(_,E,M,q,$)}function S(_,E){let M=l.fork(),q=0,L=0,I=0,$=M.end-s,V={size:0,start:0,skip:0};e:for(let ee=M.pos-_;M.pos>ee;){let z=M.size;if(M.id==E&&z>=0){V.size=q,V.start=L,V.skip=I,I+=4,q+=4,M.next();continue}let H=M.pos-z;if(z<0||H<ee||M.start<$)break;let P=M.id>=a?4:0,W=M.start;for(M.next();M.pos>H;){if(M.size<0)if(M.size==-3)P+=4;else break e;else M.id>=a&&(P+=4);M.next()}L=W,q+=z,I+=P}return(E<0||q==_)&&(V.size=q,V.start=L,V.skip=I),V.size>4?V:void 0}function k(_,E,M){let{id:q,start:L,end:I,size:$}=l;if(l.next(),$>=0&&q<a){let V=M;if($>4){let ee=l.pos-($-4);for(;l.pos>ee;)M=k(_,E,M)}E[--M]=V,E[--M]=I-_,E[--M]=L-_,E[--M]=q}else $==-3?h=q:$==-4&&(f=q);return M}let N=[],C=[];for(;l.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 Hn(c[t.topID],N.reverse(),C.reverse(),T)}const kT=new WeakMap;function a1(t,e){if(!t.isAnonymous||e instanceof yc||e.type!=t)return 1;let n=kT.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Hn)){n=1;break}n+=a1(t,r)}kT.set(e,n)}return n}function R6(t,e,n,r,s,i,a,l,c){let h=0;for(let y=r;y<s;y++)h+=a1(t,e[y]);let f=Math.ceil(h*1.5/8),m=[],g=[];function x(y,w,S,k,N){for(let C=S;C<k;){let T=C,_=w[C],E=a1(t,y[C]);for(C++;C<k;C++){let M=a1(t,y[C]);if(E+M>=f)break;E+=M}if(C==T+1){if(E>f){let M=y[T];x(M.children,M.positions,0,M.children.length,w[T]+N);continue}m.push(y[T])}else{let M=w[C-1]+y[C-1].length-_;m.push(R6(t,y,w,T,C,_,M,null,c))}g.push(_+N-i)}}return x(e,n,r,s,0),(l||c)(m,g,a)}class tae{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 Ya?this.setBuffer(e.context.buffer,e.index,n):e instanceof ni&&this.map.set(e.tree,n)}get(e){return e instanceof Ya?this.getBuffer(e.context.buffer,e.index):e instanceof ni?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 wu{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 wu(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 l=0,c=0,h=0;;l++){let f=l<n.length?n[l]:null,m=f?f.fromA:1e9;if(m-c>=r)for(;a&&a.from<m;){let g=a;if(c>=g.from||m<=g.to||h){let x=Math.max(g.from,c)-h,y=Math.min(g.to,m)-h;g=x>=y?null:new wu(x,y,g.tree,g.offset+h,l>0,!!f)}if(g&&s.push(g),a.to>m)break;a=i<e.length?e[i++]:null}if(!f)break;c=f.toA,h=f.toA-f.toB}return s}}let D6=class{startParse(e,n,r){return typeof e=="string"&&(e=new nae(e)),r=r?r.length?r.map(s=>new xw(s.from,s.to)):[new xw(0,0)]:[new xw(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 nae{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 Qt({perNode:!0});let rae=0;class Ui{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=rae++}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 Ui&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new Ui(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 I1(e);return r=>r.modified.indexOf(n)>-1?r:I1.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let sae=0;class I1{constructor(e){this.name=e,this.instances=[],this.id=sae++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&iae(n,l.modified));if(r)return r;let s=[],i=new Ui(e.name,s,e,n);for(let l of n)l.instances.push(i);let a=aae(n);for(let l of e.set)if(!l.modified.length)for(let c of a)s.push(I1.get(l,c));return i}}function iae(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function aae(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,s=e.length;r<s;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function z6(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,l=s;for(let m=0;;){if(l=="..."&&m>0&&m+3==s.length){a=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);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);l=s.slice(m)}let c=i.length-1,h=i[c];if(!h)throw new RangeError("Invalid path: "+s);let f=new Km(r,a,c>0?i.slice(0,c):null);e[h]=f.sort(e[h])}}return hB.add(e)}const hB=new Qt({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 Km(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Km{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<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Km.empty=new Km([],2,null);function fB(t,e){let n=Object.create(null);for(let i of t)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let a of i.tag)n[a.id]=i.class;let{scope:r,all:s=null}=e||{};return{style:i=>{let a=s;for(let l of i)for(let c of l.set){let h=n[c.id];if(h){a=a?a+" "+h:h;break}}return a},scope:r}}function oae(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function lae(t,e,n,r=0,s=t.length){let i=new cae(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class cae{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:l,to:c}=e;if(l>=r||c<=n)return;a.isTop&&(i=this.highlighters.filter(x=>!x.scope||x.scope(a)));let h=s,f=uae(e)||Km.empty,m=oae(i,f.tags);if(m&&(h&&(h+=" "),h+=m,f.mode==1&&(s+=(s?" ":"")+m)),this.startSpan(Math.max(n,l),h),f.opaque)return;let g=e.tree&&e.tree.prop(Qt.mounted);if(g&&g.overlay){let x=e.node.enter(g.overlay[0].from+l,1),y=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),w=e.firstChild();for(let S=0,k=l;;S++){let N=S<g.overlay.length?g.overlay[S]:null,C=N?N.from+l:c,T=Math.max(n,k),_=Math.min(r,C);if(T<_&&w)for(;e.from<_&&(this.highlightRange(e,T,_,s,i),this.startSpan(Math.min(_,e.to),h),!(e.to>=C||!e.nextSibling())););if(!N||C>r)break;k=N.to+l,k>n&&(this.highlightRange(x.cursor(),Math.max(n,N.from+l),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 uae(t){let e=t.type.prop(hB);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ue=Ui.define,ox=Ue(),nc=Ue(),OT=Ue(nc),jT=Ue(nc),rc=Ue(),lx=Ue(rc),vw=Ue(rc),$a=Ue(),nu=Ue($a),qa=Ue(),Fa=Ue(),jS=Ue(),Zf=Ue(jS),cx=Ue(),ve={comment:ox,lineComment:Ue(ox),blockComment:Ue(ox),docComment:Ue(ox),name:nc,variableName:Ue(nc),typeName:OT,tagName:Ue(OT),propertyName:jT,attributeName:Ue(jT),className:Ue(nc),labelName:Ue(nc),namespace:Ue(nc),macroName:Ue(nc),literal:rc,string:lx,docString:Ue(lx),character:Ue(lx),attributeValue:Ue(lx),number:vw,integer:Ue(vw),float:Ue(vw),bool:Ue(rc),regexp:Ue(rc),escape:Ue(rc),color:Ue(rc),url:Ue(rc),keyword:qa,self:Ue(qa),null:Ue(qa),atom:Ue(qa),unit:Ue(qa),modifier:Ue(qa),operatorKeyword:Ue(qa),controlKeyword:Ue(qa),definitionKeyword:Ue(qa),moduleKeyword:Ue(qa),operator:Fa,derefOperator:Ue(Fa),arithmeticOperator:Ue(Fa),logicOperator:Ue(Fa),bitwiseOperator:Ue(Fa),compareOperator:Ue(Fa),updateOperator:Ue(Fa),definitionOperator:Ue(Fa),typeOperator:Ue(Fa),controlOperator:Ue(Fa),punctuation:jS,separator:Ue(jS),bracket:Zf,angleBracket:Ue(Zf),squareBracket:Ue(Zf),paren:Ue(Zf),brace:Ue(Zf),content:$a,heading:nu,heading1:Ue(nu),heading2:Ue(nu),heading3:Ue(nu),heading4:Ue(nu),heading5:Ue(nu),heading6:Ue(nu),contentSeparator:Ue($a),list:Ue($a),quote:Ue($a),emphasis:Ue($a),strong:Ue($a),link:Ue($a),monospace:Ue($a),strikethrough:Ue($a),inserted:Ue(),deleted:Ue(),changed:Ue(),invalid:Ue(),meta:cx,documentMeta:Ue(cx),annotation:Ue(cx),processingInstruction:Ue(cx),definition:Ui.defineModifier("definition"),constant:Ui.defineModifier("constant"),function:Ui.defineModifier("function"),standard:Ui.defineModifier("standard"),local:Ui.defineModifier("local"),special:Ui.defineModifier("special")};for(let t in ve){let e=ve[t];e instanceof Ui&&(e.name=t)}fB([{tag:ve.link,class:"tok-link"},{tag:ve.heading,class:"tok-heading"},{tag:ve.emphasis,class:"tok-emphasis"},{tag:ve.strong,class:"tok-strong"},{tag:ve.keyword,class:"tok-keyword"},{tag:ve.atom,class:"tok-atom"},{tag:ve.bool,class:"tok-bool"},{tag:ve.url,class:"tok-url"},{tag:ve.labelName,class:"tok-labelName"},{tag:ve.inserted,class:"tok-inserted"},{tag:ve.deleted,class:"tok-deleted"},{tag:ve.literal,class:"tok-literal"},{tag:ve.string,class:"tok-string"},{tag:ve.number,class:"tok-number"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],class:"tok-string2"},{tag:ve.variableName,class:"tok-variableName"},{tag:ve.local(ve.variableName),class:"tok-variableName tok-local"},{tag:ve.definition(ve.variableName),class:"tok-variableName tok-definition"},{tag:ve.special(ve.variableName),class:"tok-variableName2"},{tag:ve.definition(ve.propertyName),class:"tok-propertyName tok-definition"},{tag:ve.typeName,class:"tok-typeName"},{tag:ve.namespace,class:"tok-namespace"},{tag:ve.className,class:"tok-className"},{tag:ve.macroName,class:"tok-macroName"},{tag:ve.propertyName,class:"tok-propertyName"},{tag:ve.operator,class:"tok-operator"},{tag:ve.comment,class:"tok-comment"},{tag:ve.meta,class:"tok-meta"},{tag:ve.invalid,class:"tok-invalid"},{tag:ve.punctuation,class:"tok-punctuation"}]);var yw;const mu=new Qt;function mB(t){return et.define({combine:t?e=>e.concat(t):void 0})}const dae=new Qt;class Xi{constructor(e,n,r=[],s=""){this.data=e,this.name=s,rn.prototype.hasOwnProperty("tree")||Object.defineProperty(rn.prototype,"tree",{get(){return es(this)}}),this.parser=n,this.extension=[bc.of(this),rn.languageData.of((i,a,l)=>{let c=NT(i,a,l),h=c.type.prop(mu);if(!h)return[];let f=i.facet(h),m=c.type.prop(dae);if(m){let g=c.resolve(a-c.from,l);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 NT(e,n,r).type.prop(mu)==this.data}findRegions(e){let n=e.facet(bc);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(mu)==this.data){r.push({from:a,to:a+i.length});return}let l=i.prop(Qt.mounted);if(l){if(l.tree.prop(mu)==this.data){if(l.overlay)for(let c of l.overlay)r.push({from:c.from+a,to:c.to+a});else r.push({from:a,to:a+i.length});return}else if(l.overlay){let c=r.length;if(s(l.tree,l.overlay[0].from+a),r.length>c)return}}for(let c=0;c<i.children.length;c++){let h=i.children[c];h instanceof Hn&&s(h,i.positions[c]+a)}};return s(es(e),0),r}get allowsNesting(){return!0}}Xi.setState=Et.define();function NT(t,e,n){let r=t.facet(bc),s=es(t).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(e,n,Hr.ExcludeBuffers))i.type.isTop&&(s=i);return s}class Zm extends Xi{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=mB(e.languageData);return new Zm(n,e.parser.configure({props:[mu.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new Zm(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function es(t){let e=t.field(Xi.state,!1);return e?e.tree:Hn.empty}class hae{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<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Jf=null;class Sh{constructor(e,n,r=[],s,i,a,l,c){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=a,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new Sh(e,n,[],Hn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new hae(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Hn.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.state.doc.length&&this.parse.stopAt(n);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(wu.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=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(wu.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Jf;Jf=this;try{return e()}finally{Jf=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=CT(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:a,skipped:l}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((h,f,m,g)=>c.push({fromA:h,toA:f,fromB:m,toB:g})),r=wu.applyChanges(r,c),s=Hn.empty,i=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),m=e.mapPos(h.to,-1);f<m&&l.push({from:f,to:m})}}}return new Sh(this.parser,n,r,s,i,a,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:i}=this.skipped[r];s<e.to&&i>e.from&&(this.fragments=CT(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 D6{createParse(n,r,s){let i=s[0].from,a=s[s.length-1].to;return{parsedPos:i,advance(){let c=Jf;if(c){for(let h of s)c.tempSkipped.push(h);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=a,new Hn(zs.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 Jf}}function CT(t,e,n){return wu.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class kh{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 kh(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=Sh.create(e.facet(bc).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new kh(r)}}Xi.state=rs.define({create:kh.init,update(t,e){for(let n of e.effects)if(n.is(Xi.setState))return n.value;return e.startState.facet(bc)!=e.state.facet(bc)?kh.init(e.state):t.apply(e)}});let pB=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(pB=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const bw=typeof navigator<"u"&&(!((yw=navigator.scheduling)===null||yw===void 0)&&yw.isInputPending)?()=>navigator.scheduling.isInputPending():null,fae=jr.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(Xi.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(Xi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=pB(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,i=r.field(Xi.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!bw?Math.max(25,e.timeRemaining()-5):1e9),l=i.context.treeLen<s&&r.doc.length>s+1e3,c=i.context.work(()=>bw&&bw()||Date.now()>a,s+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Xi.setState.of(new kh(i.context))})),this.chunkBudget>0&&!(c&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Zs(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()}}}),bc=et.define({combine(t){return t.length?t[0]:null},enables:t=>[Xi.state,fae,We.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class gB{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const mae=et.define(),W0=et.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 _u(t){let e=t.facet(W0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Jm(t,e){let n="",r=t.tabSize,s=t.facet(W0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i<e;i++)n+=s;return n}function P6(t,e){t instanceof rn&&(t=new Wv(t));for(let r of t.state.facet(mae)){let s=r(t,e);if(s!==void 0)return s}let n=es(t.state);return n.length>=e?pae(t,n,e):null}class Wv{constructor(e,n={}){this.state=e,this.options=n,this.unit=_u(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<e:s<=e)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(e,n);return r.slice(e-s,Math.min(r.length,e+100-s))}column(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.countColumn(r,e-s),a=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return a>-1&&(i+=a-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Bh(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 Gv=new Qt;function pae(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.from<r.node.from||a.to>r.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 xB(r,t,n)}function xB(t,e,n){for(let r=t;r;r=r.next){let s=xae(r.node);if(s)return s(L6.create(e,n,r))}return 0}function gae(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function xae(t){let e=t.type.prop(Gv);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Qt.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return a=>vB(a,!0,1,void 0,i&&!gae(a)?s.from:void 0)}return t.parent==null?vae:null}function vae(){return 0}class L6 extends Wv{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 L6(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(yae(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return xB(this.context.next,this.base,this.pos)}}function yae(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function bae(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 l=n.to;;){let c=e.childAfter(l);if(!c||c==r)return null;if(!c.type.isSkipped){if(c.from>=a)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}l=c.to}}function ww({closing:t,align:e=!0,units:n=1}){return r=>vB(r,e,n,t)}function vB(t,e,n,r,s){let i=t.textAfter,a=i.match(/^\s*/)[0].length,l=r&&i.slice(a,a+r.length)==r||s==t.pos+a,c=e?bae(t):null;return c?l?t.column(c.from):t.column(c.to):t.baseIndent+(l?0:t.unit*n)}function TT({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const wae=200;function Sae(){return rn.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+wae)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:a}=t,l=-1,c=[];for(let{head:h}of a.selection.ranges){let f=a.doc.lineAt(h);if(f.from==l)continue;l=f.from;let m=P6(a,f.from);if(m==null)continue;let g=/^\s*/.exec(f.text)[0],x=Jm(a,m);g!=x&&c.push({from:f.from,to:f.from+g.length,insert:x})}return c.length?[t,{changes:c,sequential:!0}]:t})}const kae=et.define(),I6=new Qt;function yB(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function Oae(t,e,n){let r=es(t);if(r.length<n)return null;let s=r.resolveStack(n,1),i=null;for(let a=s;a;a=a.next){let l=a.node;if(l.to<=n||l.from>n)continue;if(i&&l.from<e)break;let c=l.type.prop(I6);if(c&&(l.to<r.length-50||r.length==t.doc.length||!jae(l))){let h=c(l,t);h&&h.from<=n&&h.from>=e&&h.to>n&&(i=h)}}return i}function jae(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function B1(t,e,n){for(let r of t.facet(kae)){let s=r(t,e,n);if(s)return s}return Oae(t,e,n)}function bB(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 Xv=Et.define({map:bB}),G0=Et.define({map:bB});function wB(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 Mu=rs.define({create(){return ft.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=ET(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Xv)&&!Nae(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(OB),s=r?ft.replace({widget:new Rae(r(e.state,n.value))}):_T;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(G0)&&(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=ET(t,e.selection.main.head)),t},provide:t=>We.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<t.length;){let r=t[n++],s=t[n++];if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push(_T.range(r,s))}return ft.set(e,!0)}});function ET(t,e,n=e){let r=!1;return t.between(e,n,(s,i)=>{s<n&&i>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function q1(t,e,n){var r;let s=null;return(r=t.field(Mu,!1))===null||r===void 0||r.between(e,n,(i,a)=>{(!s||s.from>i)&&(s={from:i,to:a})}),s}function Nae(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function SB(t,e){return t.field(Mu,!1)?e:e.concat(Et.appendConfig.of(jB()))}const Cae=t=>{for(let e of wB(t)){let n=B1(t.state,e.from,e.to);if(n)return t.dispatch({effects:SB(t.state,[Xv.of(n),kB(t,n)])}),!0}return!1},Tae=t=>{if(!t.state.field(Mu,!1))return!1;let e=[];for(let n of wB(t)){let r=q1(t.state,n.from,n.to);r&&e.push(G0.of(r),kB(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function kB(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return We.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const Eae=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let s=t.lineBlockAt(r),i=B1(e,s.from,s.to);i&&n.push(Xv.of(i)),r=(i?t.lineBlockAt(i.to):s).to+1}return n.length&&t.dispatch({effects:SB(t.state,n)}),!!n.length},_ae=t=>{let e=t.state.field(Mu,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(G0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},Mae=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Cae},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Tae},{key:"Ctrl-Alt-[",run:Eae},{key:"Ctrl-Alt-]",run:_ae}],Aae={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},OB=et.define({combine(t){return co(t,Aae)}});function jB(t){return[Mu,Pae]}function NB(t,e){let{state:n}=t,r=n.facet(OB),s=a=>{let l=t.lineBlockAt(t.posAtDOM(a.target)),c=q1(t.state,l.from,l.to);c&&t.dispatch({effects:G0.of(c)}),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 _T=ft.replace({widget:new class extends uo{toDOM(t){return NB(t,null)}}});class Rae extends uo{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return NB(e,this.value)}}const Dae={openText:"⌄",closedText:"",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Sw extends fl{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 zae(t={}){let e={...Dae,...t},n=new Sw(e,!0),r=new Sw(e,!1),s=jr.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(bc)!=a.state.facet(bc)||a.startState.field(Mu,!1)!=a.state.field(Mu,!1)||es(a.startState)!=es(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let l=new dl;for(let c of a.viewportLineBlocks){let h=q1(a.state,c.from,c.to)?r:B1(a.state,c.from,c.to)?n:null;h&&l.add(c.from,c.from,h)}return l.finish()}}),{domEventHandlers:i}=e;return[s,Iie({class:"cm-foldGutter",markers(a){var l;return((l=a.plugin(s))===null||l===void 0?void 0:l.markers)||ln.empty},initialSpacer(){return new Sw(e,!1)},domEventHandlers:{...i,click:(a,l,c)=>{if(i.click&&i.click(a,l,c))return!0;let h=q1(a.state,l.from,l.to);if(h)return a.dispatch({effects:G0.of(h)}),!0;let f=B1(a.state,l.from,l.to);return f?(a.dispatch({effects:Xv.of(f)}),!0):!1}}}),jB()]}const Pae=We.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 X0{constructor(e,n){this.specs=e;let r;function s(l){let c=gc.newName();return(r||(r=Object.create(null)))["."+c]=l,c}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,a=n.scope;this.scope=a instanceof Xi?l=>l.prop(mu)==a.data:a?l=>l==a:void 0,this.style=fB(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:i}).style,this.module=r?new gc(r):null,this.themeType=n.themeType}static define(e,n){return new X0(e,n||{})}}const NS=et.define(),CB=et.define({combine(t){return t.length?[t[0]]:null}});function kw(t){let e=t.facet(NS);return e.length?e:t.facet(CB)}function TB(t,e){let n=[Iae],r;return t instanceof X0&&(t.module&&n.push(We.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(CB.of(t)):r?n.push(NS.computeN([We.darkTheme],s=>s.facet(We.darkTheme)==(r=="dark")?[t]:[])):n.push(NS.of(t)),n}class Lae{constructor(e){this.markCache=Object.create(null),this.tree=es(e.state),this.decorations=this.buildDeco(e,kw(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=es(e.state),r=kw(e.state),s=r!=kw(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!s&&n.type==this.tree.type&&a>=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 ft.none;let r=new dl;for(let{from:s,to:i}of e.visibleRanges)lae(this.tree,n,(a,l,c)=>{r.add(a,l,this.markCache[c]||(this.markCache[c]=ft.mark({class:c})))},s,i);return r.finish()}}const Iae=_c.high(jr.fromClass(Lae,{decorations:t=>t.decorations})),Bae=X0.define([{tag:ve.meta,color:"#404740"},{tag:ve.link,textDecoration:"underline"},{tag:ve.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strong,fontWeight:"bold"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.keyword,color:"#708"},{tag:[ve.atom,ve.bool,ve.url,ve.contentSeparator,ve.labelName],color:"#219"},{tag:[ve.literal,ve.inserted],color:"#164"},{tag:[ve.string,ve.deleted],color:"#a11"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],color:"#e40"},{tag:ve.definition(ve.variableName),color:"#00f"},{tag:ve.local(ve.variableName),color:"#30a"},{tag:[ve.typeName,ve.namespace],color:"#085"},{tag:ve.className,color:"#167"},{tag:[ve.special(ve.variableName),ve.macroName],color:"#256"},{tag:ve.definition(ve.propertyName),color:"#00c"},{tag:ve.comment,color:"#940"},{tag:ve.invalid,color:"#f00"}]),qae=We.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),EB=1e4,_B="()[]{}",MB=et.define({combine(t){return co(t,{afterCursor:!0,brackets:_B,maxScanDistance:EB,renderMatch:Qae})}}),Fae=ft.mark({class:"cm-matchingBracket"}),$ae=ft.mark({class:"cm-nonmatchingBracket"});function Qae(t){let e=[],n=t.matched?Fae:$ae;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 Hae=rs.define({create(){return ft.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(MB);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=Ka(e.state,s.head,-1,r)||s.head>0&&Ka(e.state,s.head-1,1,r)||r.afterCursor&&(Ka(e.state,s.head,1,r)||s.head<e.state.doc.length&&Ka(e.state,s.head+1,-1,r));i&&(n=n.concat(r.renderMatch(i,e.state)))}return ft.set(n,!0)},provide:t=>We.decorations.from(t)}),Vae=[Hae,qae];function Uae(t={}){return[MB.of(t),Vae]}const Wae=new Qt;function CS(t,e,n){let r=t.prop(e<0?Qt.openedBy:Qt.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 TS(t){let e=t.type.prop(Wae);return e?e(t.node):t}function Ka(t,e,n,r={}){let s=r.maxScanDistance||EB,i=r.brackets||_B,a=es(t),l=a.resolveInner(e,n);for(let c=l;c;c=c.parent){let h=CS(c.type,n,i);if(h&&c.from<c.to){let f=TS(c);if(f&&(n>0?e>=f.from&&e<f.to:e>f.from&&e<=f.to))return Gae(t,e,n,c,f,h,i)}}return Xae(t,e,n,a,l.type,s,i)}function Gae(t,e,n,r,s,i,a){let l=r.parent,c={from:s.from,to:s.to},h=0,f=l?.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.from<f.to){let m=TS(f);return{start:c,end:m?{from:m.from,to:m.to}:void 0,matched:!0}}else if(CS(f.type,n,a))h++;else if(CS(f.type,-n,a)){if(h==0){let m=TS(f);return{start:c,end:m&&m.from<m.to?{from:m.from,to:m.to}:void 0,matched:!1}}h--}}while(n<0?f.prevSibling():f.nextSibling());return{start:c,matched:!1}}function Xae(t,e,n,r,s,i,a){let l=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),c=a.indexOf(l);if(c<0||c%2==0!=n>0)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,S=n>0?x.length:-1;w!=S;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==c>>1};m--}}n>0&&(g+=x.length)}return f.done?{start:h,matched:!1}:null}function MT(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<e;a++)t.charCodeAt(a)==9?i+=n-i%n:i++;return i}class AB{constructor(e,n,r,s){this.string=e,this.tabSize=n,this.indentUnit=r,this.overrideIndent=s,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let n=this.string.charAt(this.pos),r;if(typeof e=="string"?r=n==e:r=n&&(e instanceof RegExp?e.test(n):e(n)),r)return++this.pos,n}eatWhile(e){let n=this.pos;for(;this.eat(e););return this.pos>n}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.lastColumnPos<this.start&&(this.lastColumnValue=MT(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:MT(this.string,null,this.tabSize)}match(e,n,r){if(typeof e=="string"){let s=a=>r?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 Yae(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||Kae,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||F6,mergeTokens:t.mergeTokens!==!1}}function Kae(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 AT=new WeakMap;class B6 extends Xi{constructor(e){let n=mB(e.languageData),r=Yae(e),s,i=new class extends D6{createParse(a,l,c){return new Jae(s,a,l,c)}};super(n,i,[],e.name),this.topNode=noe(n,this),s=this,this.streamParser=r,this.stateAfter=new Qt({perNode:!0}),this.tokenTable=e.tokenTable?new PB(r.tokenTable):toe}static define(e){return new B6(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=AT.get(e.state),n!=null&&n<e.pos-1e4&&(n=void 0));let s=q6(this,e.node.tree,e.node.from,e.node.from,n??e.pos),i,a;if(s?(a=s.state,i=s.pos+1):(a=this.streamParser.startState(e.unit),i=e.node.from),e.pos-i>1e4)return null;for(;i<e.pos;){let c=e.state.doc.lineAt(i),h=Math.min(e.pos,c.to);if(c.length){let f=r?r(c.from):-1,m=new AB(c.text,e.state.tabSize,e.unit,f<0?void 0:f);for(;m.pos<h-c.from;)DB(this.streamParser.token,m,a)}else this.streamParser.blankLine(a,e.unit);if(h==e.pos)break;i=c.to+1}let l=e.lineAt(e.pos);return r&&n==null&&AT.set(e.state,l.from),this.streamParser.indent(a,/^\s*(.*)/.exec(l.text)[1],e)}get allowsNesting(){return!1}}function q6(t,e,n,r,s){let i=n>=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 l=e.children[a],c=n+e.positions[a],h=l instanceof Hn&&c<s&&q6(t,l,c,r,s);if(h)return h}return null}function RB(t,e,n,r,s){if(s&&n<=0&&r>=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],l=e.children[i],c;if(a<r&&l instanceof Hn){if(!(c=RB(t,l,n-a,r-a,s)))break;return s?new Hn(e.type,e.children.slice(0,i).concat(c),e.positions.slice(0,i+1),a+c.length):c}}return null}function Zae(t,e,n,r,s){for(let i of e){let a=i.from+(i.openStart?25:0),l=i.to-(i.openEnd?25:0),c=a<=n&&l>n&&q6(t,i.tree,0-i.offset,n,l),h;if(c&&c.pos<=r&&(h=RB(t,i.tree,n+i.offset,c.pos+i.offset,!1)))return{state:c.state,tree:h}}return{state:t.streamParser.startState(s?_u(s):4),tree:Hn.empty}}let Jae=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=Sh.get(),a=s[0].from,{state:l,tree:c}=Zae(e,r,a,this.to,i?.state);this.state=l,this.parsedPos=this.chunkStart=a+c.length;for(let h=0;h<c.children.length;h++)this.chunks.push(c.children[h]),this.chunkPos.push(c.positions[h]);i&&this.parsedPos<i.viewport.from-1e5&&s.some(h=>h.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(_u(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=Sh.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<r;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),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,l=this.lineAfter(a);n+=l,r=a+l.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].to<this.parsedPos;)this.rangeIndex++}emitToken(e,n,r,s){let i=4;if(this.ranges.length>1){s=this.skipGapsTo(n,s,1),n+=s;let l=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-l}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 AB(n,e?e.state.tabSize:4,e?_u(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let l=DB(i.token,a,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+a.start,this.parsedPos+a.pos,s)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Hn.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:eoe,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Hn(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Hn(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function DB(t,e,n){e.start=e.pos;for(let r=0;r<10;r++){let s=t(e,n);if(e.pos>e.start)return s}throw new Error("Stream parser failed to advance stream.")}const F6=Object.create(null),e0=[zs.none],eoe=new Uv(e0),RT=[],DT=Object.create(null),zB=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"]])zB[t]=LB(F6,e);class PB{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),zB)}resolve(e){return e?this.table[e]||(this.table[e]=LB(this.extra,e)):0}}const toe=new PB(F6);function Ow(t,e){RT.indexOf(t)>-1||(RT.push(t),console.warn(e))}function LB(t,e){let n=[];for(let l of e.split(" ")){let c=[];for(let h of l.split(".")){let f=t[h]||ve[h];f?typeof f=="function"?c.length?c=c.map(f):Ow(h,`Modifier ${h} used at start of tag`):c.length?Ow(h,`Tag ${h} used as modifier`):c=Array.isArray(f)?f:[f]:Ow(h,`Unknown highlighting tag ${h}`)}for(let h of c)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(l=>l.id),i=DT[s];if(i)return i.id;let a=DT[s]=zs.define({id:e0.length,name:r,props:[z6({[r]:n})]});return e0.push(a),a.id}function noe(t,e){let n=zs.define({id:e0.length,name:"Document",props:[mu.add(()=>t),Gv.add(()=>r=>e.getIndent(r))],top:!0});return e0.push(n),n}Jn.RTL,Jn.LTR;const roe=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Q6(t.state,n.from);return r.line?soe(t):r.block?aoe(t):!1};function $6(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 soe=$6(coe,0),ioe=$6(IB,0),aoe=$6((t,e)=>IB(t,e,loe(e)),0);function Q6(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const em=50;function ooe(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-em,r),a=t.sliceDoc(s,s+em),l=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(a)[0].length,h=i.length-l;if(i.slice(h-e.length,h)==e&&a.slice(c,c+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:s+c,margin:c&&1}};let f,m;s-r<=2*em?f=m=t.sliceDoc(r,s):(f=t.sliceDoc(r,r+em),m=t.sliceDoc(s-em,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 loe(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 IB(t,e,n=e.selection.ranges){let r=n.map(i=>Q6(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,a)=>ooe(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,l;a<s.length;a++)if(l=s[a]){let c=r[a],{open:h,close:f}=l;i.push({from:h.pos-c.open.length,to:h.pos+h.margin},{from:f.pos-f.margin,to:f.pos+c.close.length})}return{changes:i}}return null}function coe(t,e,n=e.selection.ranges){let r=[],s=-1;for(let{from:i,to:a}of n){let l=r.length,c=1e9,h=Q6(e,i).line;if(h){for(let f=i;f<=a;){let m=e.doc.lineAt(f);if(m.from>s&&(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;g<m.text.length&&g<c&&(c=g),r.push({line:m,comment:y,token:h,indent:g,empty:x,single:!1})}f=m.to+1}if(c<1e9)for(let f=l;f<r.length;f++)r[f].indent<r[f].line.text.length&&(r[f].indent=c);r.length==l+1&&(r[l].single=!0)}}if(t!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:l,token:c,indent:h,empty:f,single:m}of r)(m||!f)&&i.push({from:l.from+h,insert:c+" "});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:l,token:c}of r)if(l>=0){let h=a.from+l,f=h+c.length;a.text[f-a.from]==" "&&f++,i.push({from:h,to:f})}return{changes:i}}return null}const ES=lo.define(),uoe=lo.define(),doe=et.define(),BB=et.define({combine(t){return co(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)})}}),qB=rs.define({create(){return Za.empty},update(t,e){let n=e.state.facet(BB),r=e.annotation(ES);if(r){let c=Js.fromTransaction(e,r.selection),h=r.side,f=h==0?t.undone:t.done;return c?f=F1(f,f.length,n.minDepth,c):f=QB(f,e.startState.selection),new Za(h==0?r.rest:f,h==0?f:r.rest)}let s=e.annotation(uoe);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(Dr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=Js.fromTransaction(e),a=e.annotation(Dr.time),l=e.annotation(Dr.userEvent);return i?t=t.addChanges(i,a,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,a,l,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 Za(t.done.map(Js.fromJSON),t.undone.map(Js.fromJSON))}});function hoe(t={}){return[qB,BB.of(t),We.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?FB:e.inputType=="historyRedo"?_S:null;return r?(e.preventDefault(),r(n)):!1}})]}function Yv(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(qB,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const FB=Yv(0,!1),_S=Yv(1,!1),foe=Yv(0,!0),moe=Yv(1,!0);class Js{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 Js(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 Js(e.changes&&$r.fromJSON(e.changes),[],e.mapped&&no.fromJSON(e.mapped),e.startSelection&&Ae.fromJSON(e.startSelection),e.selectionsAfter.map(Ae.fromJSON))}static fromTransaction(e,n){let r=Yi;for(let s of e.startState.facet(doe)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new Js(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Yi)}static selection(e){return new Js(void 0,Yi,void 0,void 0,e)}}function F1(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 poe(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,a,l)=>{for(let c=0;c<n.length;){let h=n[c++],f=n[c++];l>=h&&a<=f&&(r=!0)}}),r}function goe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function $B(t,e){return t.length?e.length?t.concat(e):t:e}const Yi=[],xoe=200;function QB(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-xoe));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),F1(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Js.selection([e])]}function voe(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 jw(t,e){if(!t.length)return t;let n=t.length,r=Yi;for(;n;){let s=yoe(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?[Js.selection(r)]:Yi}function yoe(t,e,n){let r=$B(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):Yi,n);if(!t.changes)return Js.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(i):i;return new Js(s,Et.mapEffects(t.effects,e),a,t.startSelection.map(i),r)}const boe=/^(input\.type|delete)($|\.)/;class Za{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 Za(this.done,this.undone):this}addChanges(e,n,r,s,i){let a=this.done,l=a[a.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||boe.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,poe(l.changes,e.changes))||r=="input.type.compose")?a=F1(a,a.length-1,s.minDepth,new Js(e.changes.compose(l.changes),$B(Et.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,Yi)):a=F1(a,a.length,s.minDepth,e),new Za(a,Yi,n,r)}addSelection(e,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Yi;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&goe(i[i.length-1],e)?this:new Za(QB(this.done,e),this.undone,n,r)}addMapping(e){return new Za(jw(this.done,e),jw(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],a=i.selectionsAfter[0]||n.selection;if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:ES.of({side:e,rest:voe(s),selection:a}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let l=s.length==1?Yi:s.slice(0,s.length-1);return i.mapped&&(l=jw(l,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:ES.of({side:e,rest:l,selection:a}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Za.empty=new Za(Yi,Yi);const woe=[{key:"Mod-z",run:FB,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:_S,preventDefault:!0},{linux:"Ctrl-Shift-z",run:_S,preventDefault:!0},{key:"Mod-u",run:foe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:moe,preventDefault:!0}];function qh(t,e){return Ae.create(t.ranges.map(e),t.mainIndex)}function _a(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Ma({state:t,dispatch:e},n){let r=qh(t.selection,n);return r.eq(t.selection,!0)?!1:(e(_a(t,r)),!0)}function Kv(t,e){return Ae.cursor(e?t.to:t.from)}function HB(t,e){return Ma(t,n=>n.empty?t.moveByChar(n,e):Kv(n,e))}function ks(t){return t.textDirectionAt(t.state.selection.main.head)==Jn.LTR}const VB=t=>HB(t,!ks(t)),UB=t=>HB(t,ks(t));function WB(t,e){return Ma(t,n=>n.empty?t.moveByGroup(n,e):Kv(n,e))}const Soe=t=>WB(t,!ks(t)),koe=t=>WB(t,ks(t));function Ooe(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 Zv(t,e,n){let r=es(t).resolveInner(e.head),s=n?Qt.closedBy:Qt.openedBy;for(let c=e.head;;){let h=n?r.childAfter(c):r.childBefore(c);if(!h)break;Ooe(t,h,s)?r=h:c=n?h.to:h.from}let i=r.type.prop(s),a,l;return i&&(a=n?Ka(t,r.from,1):Ka(t,r.to,-1))&&a.matched?l=n?a.end.to:a.end.from:l=n?r.to:r.from,Ae.cursor(l,n?-1:1)}const joe=t=>Ma(t,e=>Zv(t.state,e,!ks(t))),Noe=t=>Ma(t,e=>Zv(t.state,e,ks(t)));function GB(t,e){return Ma(t,n=>{if(!n.empty)return Kv(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const XB=t=>GB(t,!1),YB=t=>GB(t,!0);function KB(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,s;if(e){for(let i of t.state.facet(We.scrollMargins)){let a=i(t);a?.top&&(n=Math.max(a?.top,n)),a?.bottom&&(r=Math.max(a?.bottom,r))}s=t.scrollDOM.clientHeight-n-r}else s=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,s-5)}}function ZB(t,e){let n=KB(t),{state:r}=t,s=qh(r.selection,a=>a.empty?t.moveVertically(a,e,n.height):Kv(a,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let a=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,h=l.bottom-n.marginBottom;a&&a.top>c&&a.bottom<h&&(i=We.scrollIntoView(s.main.head,{y:"start",yMargin:a.top-c}))}return t.dispatch(_a(r,s),{effects:i}),!0}const zT=t=>ZB(t,!1),MS=t=>ZB(t,!0);function Mc(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=Ae.cursor(r.from+i))}return s}const Coe=t=>Ma(t,e=>Mc(t,e,!0)),Toe=t=>Ma(t,e=>Mc(t,e,!1)),Eoe=t=>Ma(t,e=>Mc(t,e,!ks(t))),_oe=t=>Ma(t,e=>Mc(t,e,ks(t))),Moe=t=>Ma(t,e=>Ae.cursor(t.lineBlockAt(e.head).from,1)),Aoe=t=>Ma(t,e=>Ae.cursor(t.lineBlockAt(e.head).to,-1));function Roe(t,e,n){let r=!1,s=qh(t.selection,i=>{let a=Ka(t,i.head,-1)||Ka(t,i.head,1)||i.head>0&&Ka(t,i.head-1,1)||i.head<t.doc.length&&Ka(t,i.head+1,-1);if(!a||!a.end)return i;r=!0;let l=a.start.from==i.head?a.end.to:a.end.from;return Ae.cursor(l)});return r?(e(_a(t,s)),!0):!1}const Doe=({state:t,dispatch:e})=>Roe(t,e);function ca(t,e){let n=qh(t.state.selection,r=>{let s=e(r);return Ae.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(_a(t.state,n)),!0)}function JB(t,e){return ca(t,n=>t.moveByChar(n,e))}const eq=t=>JB(t,!ks(t)),tq=t=>JB(t,ks(t));function nq(t,e){return ca(t,n=>t.moveByGroup(n,e))}const zoe=t=>nq(t,!ks(t)),Poe=t=>nq(t,ks(t)),Loe=t=>ca(t,e=>Zv(t.state,e,!ks(t))),Ioe=t=>ca(t,e=>Zv(t.state,e,ks(t)));function rq(t,e){return ca(t,n=>t.moveVertically(n,e))}const sq=t=>rq(t,!1),iq=t=>rq(t,!0);function aq(t,e){return ca(t,n=>t.moveVertically(n,e,KB(t).height))}const PT=t=>aq(t,!1),LT=t=>aq(t,!0),Boe=t=>ca(t,e=>Mc(t,e,!0)),qoe=t=>ca(t,e=>Mc(t,e,!1)),Foe=t=>ca(t,e=>Mc(t,e,!ks(t))),$oe=t=>ca(t,e=>Mc(t,e,ks(t))),Qoe=t=>ca(t,e=>Ae.cursor(t.lineBlockAt(e.head).from)),Hoe=t=>ca(t,e=>Ae.cursor(t.lineBlockAt(e.head).to)),IT=({state:t,dispatch:e})=>(e(_a(t,{anchor:0})),!0),BT=({state:t,dispatch:e})=>(e(_a(t,{anchor:t.doc.length})),!0),qT=({state:t,dispatch:e})=>(e(_a(t,{anchor:t.selection.main.anchor,head:0})),!0),FT=({state:t,dispatch:e})=>(e(_a(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Voe=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Uoe=({state:t,dispatch:e})=>{let n=Jv(t).map(({from:r,to:s})=>Ae.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ae.create(n),userEvent:"select"})),!0},Woe=({state:t,dispatch:e})=>{let n=qh(t.selection,r=>{let s=es(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:l}=a;if((l.from<r.from&&l.to>=r.to||l.to>r.to&&l.from<=r.from)&&a.next)return Ae.range(l.to,l.from)}return r});return n.eq(t.selection)?!1:(e(_a(t,n)),!0)};function oq(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.to<t.state.doc.length:a.from>0)for(let l=i;;){let c=t.moveVertically(l,e);if(c.head<a.from||c.head>a.to){s.some(h=>h.head==c.head)||s.push(c);break}else{if(c.head==l.head)break;l=c}}}return s.length==r.ranges.length?!1:(t.dispatch(_a(n,Ae.create(s,s.length-1))),!0)}const Goe=t=>oq(t,!1),Xoe=t=>oq(t,!0),Yoe=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ae.create([n.main]):n.main.empty||(r=Ae.create([Ae.cursor(n.main.head)])),r?(e(_a(t,r)),!0):!1};function Y0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:a,to:l}=i;if(a==l){let c=e(i);c<a?(n="delete.backward",c=ux(t,c,!1)):c>a&&(n="delete.forward",c=ux(t,c,!0)),a=Math.min(a,c),l=Math.max(l,c)}else a=ux(t,a,!1),l=ux(t,l,!0);return a==l?{range:i}:{changes:{from:a,to:l},range:Ae.cursor(a,a<i.head?-1:1)}});return s.changes.empty?!1:(t.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?We.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function ux(t,e,n){if(t instanceof We)for(let r of t.state.facet(We.atomicRanges).map(s=>s(t)))r.between(e,e,(s,i)=>{s<e&&i>e&&(e=n?i:s)});return e}const lq=(t,e,n)=>Y0(t,r=>{let s=r.from,{state:i}=t,a=i.doc.lineAt(s),l,c;if(n&&!e&&s>a.from&&s<a.from+200&&!/[^ \t]/.test(l=a.text.slice(0,s-a.from))){if(l[l.length-1]==" ")return s-1;let h=Bh(l,i.tabSize),f=h%_u(i)||_u(i);for(let m=0;m<f&&l[l.length-1-m]==" ";m++)s--;c=s}else c=hs(a.text,s-a.from,e,e)+a.from,c==s&&a.number!=(e?i.doc.lines:1)?c+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(c-a.from,s-a.from))&&(c=hs(a.text,c-a.from,!1,!1)+a.from);return c}),AS=t=>lq(t,!1,!0),cq=t=>lq(t,!0,!1),uq=(t,e)=>Y0(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),a=s.charCategorizer(r);for(let l=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let c=hs(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,c)-i.from,Math.max(r,c)-i.from),f=a(h);if(l!=null&&f!=l)break;(h!=" "||r!=n.head)&&(l=f),r=c}return r}),dq=t=>uq(t,!1),Koe=t=>uq(t,!0),Zoe=t=>Y0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Joe=t=>Y0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),ele=t=>Y0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),tle=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:an.of(["",""])},range:Ae.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},nle=({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:hs(i.text,s-i.from,!1)+i.from,l=s==i.to?s+1:hs(i.text,s-i.from,!0)+i.from;return{changes:{from:a,to:l,insert:t.doc.slice(s,l).append(t.doc.slice(a,s))},range:Ae.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Jv(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 hq(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of Jv(t)){if(n?i.to==t.doc.length:i.from==0)continue;let a=t.doc.lineAt(n?i.to+1:i.from-1),l=a.length+1;if(n){r.push({from:i.to,to:a.to},{from:i.from,insert:a.text+t.lineBreak});for(let c of i.ranges)s.push(Ae.range(Math.min(t.doc.length,c.anchor+l),Math.min(t.doc.length,c.head+l)))}else{r.push({from:a.from,to:i.from},{from:i.to,insert:t.lineBreak+a.text});for(let c of i.ranges)s.push(Ae.range(c.anchor-l,c.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ae.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const rle=({state:t,dispatch:e})=>hq(t,e,!1),sle=({state:t,dispatch:e})=>hq(t,e,!0);function fq(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of Jv(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 ile=({state:t,dispatch:e})=>fq(t,e,!1),ale=({state:t,dispatch:e})=>fq(t,e,!0),ole=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Jv(e).map(({from:s,to:i})=>(s>0?s--:i<e.doc.length&&i++,{from:s,to:i}))),r=qh(e.selection,s=>{let i;if(t.lineWrapping){let a=t.lineBlockAt(s.head),l=t.coordsAtPos(s.head,s.assoc||1);l&&(i=a.bottom+t.documentTop-l.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 lle(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=es(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(Qt.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 $T=mq(!1),cle=mq(!0);function mq(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:a}=s,l=e.doc.lineAt(i),c=!t&&i==a&&lle(e,i);t&&(i=a=(a<=l.to?l:e.doc.lineAt(a)).to);let h=new Wv(e,{simulateBreak:i,simulateDoubleBreak:!!c}),f=P6(h,i);for(f==null&&(f=Bh(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));a<l.to&&/\s/.test(l.text[a-l.from]);)a++;c?{from:i,to:a}=c:i>l.from&&i<l.from+100&&!/\S/.test(l.text.slice(0,i))&&(i=l.from);let m=["",Jm(e,f)];return c&&m.push(Jm(e,h.lineIndent(l.from,-1))),{changes:{from:i,to:a,insert:an.of(m)},range:Ae.cursor(i+1+m[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function H6(t,e){let n=-1;return t.changeByRange(r=>{let s=[];for(let a=r.from;a<=r.to;){let l=t.doc.lineAt(a);l.number>n&&(r.empty||r.to>l.from)&&(e(l,s,r),n=l.number),a=l.to+1}let i=t.changes(s);return{changes:s,range:Ae.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const ule=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Wv(t,{overrideIndentation:i=>{let a=n[i];return a??-1}}),s=H6(t,(i,a,l)=>{let c=P6(r,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let h=/^\s*/.exec(i.text)[0],f=Jm(t,c);(h!=f||l.from<i.from+h.length)&&(n[i.from]=c,a.push({from:i.from,to:i.from+h.length,insert:f}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0},pq=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(H6(t,(n,r)=>{r.push({from:n.from,insert:t.facet(W0)})}),{userEvent:"input.indent"})),!0),gq=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(H6(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Bh(s,t.tabSize),a=0,l=Jm(t,Math.max(0,i-_u(t)));for(;a<s.length&&a<l.length&&s.charCodeAt(a)==l.charCodeAt(a);)a++;r.push({from:n.from+a,to:n.from+s.length,insert:l.slice(a)})}),{userEvent:"delete.dedent"})),!0),dle=t=>(t.setTabFocusMode(),!0),hle=[{key:"Ctrl-b",run:VB,shift:eq,preventDefault:!0},{key:"Ctrl-f",run:UB,shift:tq},{key:"Ctrl-p",run:XB,shift:sq},{key:"Ctrl-n",run:YB,shift:iq},{key:"Ctrl-a",run:Moe,shift:Qoe},{key:"Ctrl-e",run:Aoe,shift:Hoe},{key:"Ctrl-d",run:cq},{key:"Ctrl-h",run:AS},{key:"Ctrl-k",run:Zoe},{key:"Ctrl-Alt-h",run:dq},{key:"Ctrl-o",run:tle},{key:"Ctrl-t",run:nle},{key:"Ctrl-v",run:MS}],fle=[{key:"ArrowLeft",run:VB,shift:eq,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Soe,shift:zoe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Eoe,shift:Foe,preventDefault:!0},{key:"ArrowRight",run:UB,shift:tq,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:koe,shift:Poe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:_oe,shift:$oe,preventDefault:!0},{key:"ArrowUp",run:XB,shift:sq,preventDefault:!0},{mac:"Cmd-ArrowUp",run:IT,shift:qT},{mac:"Ctrl-ArrowUp",run:zT,shift:PT},{key:"ArrowDown",run:YB,shift:iq,preventDefault:!0},{mac:"Cmd-ArrowDown",run:BT,shift:FT},{mac:"Ctrl-ArrowDown",run:MS,shift:LT},{key:"PageUp",run:zT,shift:PT},{key:"PageDown",run:MS,shift:LT},{key:"Home",run:Toe,shift:qoe,preventDefault:!0},{key:"Mod-Home",run:IT,shift:qT},{key:"End",run:Coe,shift:Boe,preventDefault:!0},{key:"Mod-End",run:BT,shift:FT},{key:"Enter",run:$T,shift:$T},{key:"Mod-a",run:Voe},{key:"Backspace",run:AS,shift:AS,preventDefault:!0},{key:"Delete",run:cq,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:dq,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Koe,preventDefault:!0},{mac:"Mod-Backspace",run:Joe,preventDefault:!0},{mac:"Mod-Delete",run:ele,preventDefault:!0}].concat(hle.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),mle=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:joe,shift:Loe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Noe,shift:Ioe},{key:"Alt-ArrowUp",run:rle},{key:"Shift-Alt-ArrowUp",run:ile},{key:"Alt-ArrowDown",run:sle},{key:"Shift-Alt-ArrowDown",run:ale},{key:"Mod-Alt-ArrowUp",run:Goe},{key:"Mod-Alt-ArrowDown",run:Xoe},{key:"Escape",run:Yoe},{key:"Mod-Enter",run:cle},{key:"Alt-l",mac:"Ctrl-l",run:Uoe},{key:"Mod-i",run:Woe,preventDefault:!0},{key:"Mod-[",run:gq},{key:"Mod-]",run:pq},{key:"Mod-Alt-\\",run:ule},{key:"Shift-Mod-k",run:ole},{key:"Shift-Mod-\\",run:Doe},{key:"Mod-/",run:roe},{key:"Alt-A",run:ioe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:dle}].concat(fle),ple={key:"Tab",run:pq,shift:gq},QT=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Oh{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?l=>i(QT(l)):QT,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 Ys(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=g6(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Ua(e);let s=this.normalize(n);if(s.length)for(let i=0,a=r;;i++){let l=s.charCodeAt(i),c=this.match(l,a,this.bufferPos+this.bufferStart);if(i==s.length-1){if(c)return this.value=c,this;break}a==r&&i<n.length&&n.charCodeAt(i)==l&&a++}}}match(e,n,r){let s=null;for(let i=0;i<this.matches.length;i+=2){let a=this.matches[i],l=!1;this.query.charCodeAt(a)==e&&(a==this.query.length-1?s={from:this.matches[i+1],to:r}:(this.matches[i]++,l=!0)),l||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:n,to:r}:this.matches.push(1,n)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Oh.prototype[Symbol.iterator]=function(){return this});const xq={from:-1,to:-1,match:/.*/.exec("")},V6="gm"+(/x/.unicode==null?"":"u");class vq{constructor(e,n,r,s=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=xq,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new yq(e,n,r,s,i);this.re=new RegExp(n,V6+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let a=e.lineAt(s);this.curLineStart=a.from,this.matchPos=$1(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.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=$1(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.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<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const Nw=new WeakMap;class nh{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let s=Nw.get(e);if(!s||s.from>=r||s.to<=n){let l=new nh(n,e.sliceString(n,r));return Nw.set(e,l),l}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<r&&(i+=e.sliceString(s.to,r)),Nw.set(e,new nh(a,i)),new nh(n,i.slice(n-a,r-a))}}class yq{constructor(e,n,r,s,i){this.text=e,this.to=i,this.done=!1,this.value=xq,this.matchPos=$1(e,s),this.re=new RegExp(n,V6+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=nh.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=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=$1(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=nh.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(vq.prototype[Symbol.iterator]=yq.prototype[Symbol.iterator]=function(){return this});function gle(t){try{return new RegExp(t,V6),!0}catch{return!1}}function $1(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}function RS(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=$n("input",{class:"cm-textfield",name:"line",value:e}),r=$n("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:_m.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},$n("label",t.state.phrase("Go to line"),": ",n)," ",$n("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),$n("button",{name:"close",onclick:()=>{t.dispatch({effects:_m.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,l=a.doc.lineAt(a.selection.main.head),[,c,h,f,m]=i,g=f?+f.slice(1):0,x=h?+h:l.number;if(h&&m){let S=x/100;c&&(S=S*(c=="-"?-1:1)+l.number/a.doc.lines),x=Math.round(a.doc.lines*S)}else h&&c&&(x=x*(c=="-"?-1:1)+l.number);let y=a.doc.line(Math.max(1,Math.min(a.doc.lines,x))),w=Ae.cursor(y.from+Math.max(0,Math.min(g,y.length)));t.dispatch({effects:[_m.of(!1),We.scrollIntoView(w.from,{y:"center"})],selection:w}),t.focus()}return{dom:r}}const _m=Et.define(),HT=rs.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(_m)&&(t=n.value);return t},provide:t=>Xm.from(t,e=>e?RS:null)}),xle=t=>{let e=Gm(t,RS);if(!e){let n=[_m.of(!0)];t.state.field(HT,!1)==null&&n.push(Et.appendConfig.of([HT,vle])),t.dispatch({effects:n}),e=Gm(t,RS)}return e&&e.dom.querySelector("input").select(),!0},vle=We.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"}}}),yle={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ble=et.define({combine(t){return co(t,yle,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function wle(t){return[Nle,jle]}const Sle=ft.mark({class:"cm-selectionMatch"}),kle=ft.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function VT(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=rr.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=rr.Word)}function Ole(t,e,n,r){return t(e.sliceDoc(n,n+1))==rr.Word&&t(e.sliceDoc(r-1,r))==rr.Word}const jle=jr.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(ble),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ft.none;let s=r.main,i,a=null;if(s.empty){if(!e.highlightWordAroundCursor)return ft.none;let c=n.wordAt(s.head);if(!c)return ft.none;a=n.charCategorizer(s.head),i=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<e.minSelectionLength||c>200)return ft.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),a=n.charCategorizer(s.head),!(VT(a,n,s.from,s.to)&&Ole(a,n,s.from,s.to)))return ft.none}else if(i=n.sliceDoc(s.from,s.to),!i)return ft.none}let l=[];for(let c of t.visibleRanges){let h=new Oh(n.doc,i,c.from,c.to);for(;!h.next().done;){let{from:f,to:m}=h.value;if((!a||VT(a,n,f,m))&&(s.empty&&f<=s.from&&m>=s.to?l.push(kle.range(f,m)):(f>=s.to||m<=s.from)&&l.push(Sle.range(f,m)),l.length>e.maxMatches))return ft.none}}return ft.set(l)}},{decorations:t=>t.decorations}),Nle=We.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Cle=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ae.create(n.ranges.map(s=>t.wordAt(s.head)||Ae.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Tle(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,l=new Oh(t.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(a)return null;l=new Oh(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(c=>c.from==l.value.from))continue;if(i){let c=t.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const Ele=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return Cle({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=Tle(t,r);return s?(e(t.update({selection:t.selection.addRange(Ae.range(s.from,s.to),!1),effects:We.scrollIntoView(s.to)})),!0):!1},Fh=et.define({combine(t){return co(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Fle(e),scrollToMatch:e=>We.scrollIntoView(e)})}});class bq{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||gle(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 Rle(this):new Mle(this)}getCursor(e,n=0,r){let s=e.doc?e:rn.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?Id(this,s,n,r):Ld(this,s,n,r)}}class wq{constructor(e){this.spec=e}}function Ld(t,e,n,r){return new Oh(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?_le(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function _le(t,e){return(n,r,s,i)=>((i>n||i+s.length<r)&&(i=Math.max(0,n-2),s=t.sliceString(i,Math.min(t.length,r+2))),(e(Q1(s,n-i))!=rr.Word||e(H1(s,n-i))!=rr.Word)&&(e(H1(s,r-i))!=rr.Word||e(Q1(s,r-i))!=rr.Word))}class Mle extends wq{constructor(e){super(e)}nextMatch(e,n,r){let s=Ld(this.spec,e,r,e.doc.length).nextOverlapping();if(s.done){let i=Math.min(e.doc.length,n+this.spec.unquoted.length);s=Ld(this.spec,e,0,i).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==r?null:s.value}prevMatchInRange(e,n,r){for(let s=r;;){let i=Math.max(n,s-1e4-this.spec.unquoted.length),a=Ld(this.spec,e,i,s),l=null;for(;!a.nextOverlapping().done;)l=a.value;if(l)return l;if(i==n)return null;s-=1e4}}prevMatch(e,n,r){let s=this.prevMatchInRange(e,0,n);return s||(s=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=n||s.to!=r)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=Ld(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Ld(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 Id(t,e,n,r){return new vq(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Ale(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Q1(t,e){return t.slice(hs(t,e,!1),e)}function H1(t,e){return t.slice(e,hs(t,e))}function Ale(t){return(e,n,r)=>!r[0].length||(t(Q1(r.input,r.index))!=rr.Word||t(H1(r.input,r.index))!=rr.Word)&&(t(H1(r.input,r.index+r[0].length))!=rr.Word||t(Q1(r.input,r.index+r[0].length))!=rr.Word)}class Rle extends wq{nextMatch(e,n,r){let s=Id(this.spec,e,r,e.doc.length).next();return s.done&&(s=Id(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=Id(this.spec,e,i,r),l=null;for(;!a.next().done;)l=a.value;if(l&&(i==n||l.from>i+10))return l;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<e.match.length)return e.match[i]+r.slice(s)}return n})}matchAll(e,n){let r=Id(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Id(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 t0=Et.define(),U6=Et.define(),hc=rs.define({create(t){return new Cw(DS(t).create(),null)},update(t,e){for(let n of e.effects)n.is(t0)?t=new Cw(n.value.create(),t.panel):n.is(U6)&&(t=new Cw(t.query,n.value?W6:null));return t},provide:t=>Xm.from(t,e=>e.panel)});class Cw{constructor(e,n){this.query=e,this.panel=n}}const Dle=ft.mark({class:"cm-searchMatch"}),zle=ft.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Ple=jr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(hc))}update(t){let e=t.state.field(hc);(e!=t.startState.field(hc)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ft.none;let{view:n}=this,r=new dl;for(let s=0,i=n.visibleRanges,a=i.length;s<a;s++){let{from:l,to:c}=i[s];for(;s<a-1&&c>i[s+1].from-500;)c=i[++s].to;t.highlight(n.state,l,c,(h,f)=>{let m=n.state.selection.ranges.some(g=>g.from==h&&g.to==f);r.add(h,f,m?zle:Dle)})}return r.finish()}},{decorations:t=>t.decorations});function K0(t){return e=>{let n=e.state.field(hc,!1);return n&&n.query.spec.valid?t(e,n):Oq(e)}}const V1=K0((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ae.single(r.from,r.to),i=t.state.facet(Fh);return t.dispatch({selection:s,effects:[G6(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),kq(t),!0}),U1=K0((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ae.single(s.from,s.to),a=t.state.facet(Fh);return t.dispatch({selection:i,effects:[G6(t,s),a.scrollToMatch(i.main,t)],userEvent:"select.search"}),kq(t),!0}),Lle=K0((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ae.create(n.map(r=>Ae.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),Ile=({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 l=new Oh(t.doc,t.sliceDoc(r,s));!l.next().done;){if(i.length>1e3)return!1;l.value.from==r&&(a=i.length),i.push(Ae.range(l.value.from,l.value.to))}return e(t.update({selection:Ae.create(i,a),userEvent:"select.search.matches"})),!0},UT=K0((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,l=[],c,h,f=[];a.from==r&&a.to==s&&(h=n.toText(e.getReplacement(a)),l.push({from:a.from,to:a.to,insert:h}),a=e.nextMatch(n,a.from,a.to),f.push(We.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let m=t.state.changes(l);return a&&(c=Ae.single(a.from,a.to).map(m),f.push(G6(t,a)),f.push(n.facet(Fh).scrollToMatch(c.main,t))),t.dispatch({changes:m,selection:c,effects:f,userEvent:"input.replace"}),!0}),Ble=K0((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:We.announce.of(r),userEvent:"input.replace.all"}),!0});function W6(t){return t.state.facet(Fh).createPanel(t)}function DS(t,e){var n,r,s,i,a;let l=t.selection.main,c=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!c)return e;let h=t.facet(Fh);return new bq({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?c:c.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 Sq(t){let e=Gm(t,W6);return e&&e.dom.querySelector("[main-field]")}function kq(t){let e=Sq(t);e&&e==t.root.activeElement&&e.select()}const Oq=t=>{let e=t.state.field(hc,!1);if(e&&e.panel){let n=Sq(t);if(n&&n!=t.root.activeElement){let r=DS(t.state,e.query.spec);r.valid&&t.dispatch({effects:t0.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[U6.of(!0),e?t0.of(DS(t.state,e.query.spec)):Et.appendConfig.of(Qle)]});return!0},jq=t=>{let e=t.state.field(hc,!1);if(!e||!e.panel)return!1;let n=Gm(t,W6);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:U6.of(!1)}),!0},qle=[{key:"Mod-f",run:Oq,scope:"editor search-panel"},{key:"F3",run:V1,shift:U1,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:V1,shift:U1,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:jq,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Ile},{key:"Mod-Alt-g",run:xle},{key:"Mod-d",run:Ele,preventDefault:!0}];class Fle{constructor(e){this.view=e;let n=this.query=e.state.field(hc).query.spec;this.commit=this.commit.bind(this),this.searchField=$n("input",{value:n.search,placeholder:bi(e,"Find"),"aria-label":bi(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=$n("input",{value:n.replace,placeholder:bi(e,"Replace"),"aria-label":bi(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=$n("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=$n("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=$n("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,a){return $n("button",{class:"cm-button",name:s,onclick:i,type:"button"},a)}this.dom=$n("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>V1(e),[bi(e,"next")]),r("prev",()=>U1(e),[bi(e,"previous")]),r("select",()=>Lle(e),[bi(e,"all")]),$n("label",null,[this.caseField,bi(e,"match case")]),$n("label",null,[this.reField,bi(e,"regexp")]),$n("label",null,[this.wordField,bi(e,"by word")]),...e.state.readOnly?[]:[$n("br"),this.replaceField,r("replace",()=>UT(e),[bi(e,"replace")]),r("replaceAll",()=>Ble(e),[bi(e,"replace all")])],$n("button",{name:"close",onclick:()=>jq(e),"aria-label":bi(e,"close"),type:"button"},["×"])])}commit(){let e=new bq({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:t0.of(e)}))}keydown(e){Use(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?U1:V1)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),UT(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(t0)&&!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(Fh).top}}function bi(t,e){return t.state.phrase(e)}const dx=30,hx=/[\s\.,:;?!]/;function G6(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-dx),a=Math.min(s,n+dx),l=t.state.sliceDoc(i,a);if(i!=r.from){for(let c=0;c<dx;c++)if(!hx.test(l[c+1])&&hx.test(l[c])){l=l.slice(c);break}}if(a!=s){for(let c=l.length-1;c>l.length-dx;c--)if(!hx.test(l[c-1])&&hx.test(l[c])){l=l.slice(0,c);break}}return We.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${r.number}.`)}const $le=We.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"}}),Qle=[hc,_c.low(Ple),$le];class Nq{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=es(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(Tq(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 WT(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 Hle(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;i<s.length;i++)n[s[i]]=!0}let r=WT(e)+WT(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function Cq(t){let e=t.map(s=>typeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Hle(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function Vle(t,e){return n=>{for(let r=es(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 GT=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function Su(t){return t.selection.main.from}function Tq(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 X6=lo.define();function Ule(t,e,n,r){let{main:s}=t.selection,i=n-s.from,a=r-s.from;return{...t.changeByRange(l=>{if(l!=s&&n!=r&&t.sliceDoc(l.from+i,l.from+a)!=t.sliceDoc(n,r))return{range:l};let c=t.toText(e);return{changes:{from:l.from+i,to:r==s.from?l.to:l.from+a,insert:c},range:Ae.cursor(l.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const XT=new WeakMap;function Wle(t){if(!Array.isArray(t))return t;let e=XT.get(t);return e||XT.set(t,e=Cq(t)),e}const W1=Et.define(),n0=Et.define();class Gle{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<e.length;){let r=Ys(e,n),s=Ua(r);this.chars.push(r);let i=e.slice(n,n+s),a=i.toUpperCase();this.folded.push(Ys(a==i?i.toLowerCase():a,0)),n+=s}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:s,precise:i,byWord:a}=this;if(n.length==1){let N=Ys(e,0),C=Ua(N),T=C==e.length?0:-100;if(N!=n[0])if(N==r[0])T+=-200;else return null;return this.ret(T,[0,C])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=n.length,h=0;if(l<0){for(let N=0,C=Math.min(e.length,200);N<C&&h<c;){let T=Ys(e,N);(T==n[h]||T==r[h])&&(s[h++]=N),N+=Ua(T)}if(h<c)return null}let f=0,m=0,g=!1,x=0,y=-1,w=-1,S=/[a-z]/.test(e),k=!0;for(let N=0,C=Math.min(e.length,200),T=0;N<C&&m<c;){let _=Ys(e,N);l<0&&(f<c&&_==n[f]&&(i[f++]=N),x<c&&(_==n[x]||_==r[x]?(x==0&&(y=N),w=N+1,x++):x=0));let E,M=_<255?_>=48&&_<=57||_>=97&&_<=122?2:_>=65&&_<=90?1:0:(E=g6(_))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!N||M==1&&S||T==0&&M!=0)&&(n[m]==_||r[m]==_&&(g=!0)?a[m++]=N:a.length&&(k=!1)),T=M,N+=Ua(_)}return m==c&&a[0]==0&&k?this.result(-100+(g?-200:0),a,e):x==c&&y==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):x==c?this.ret(-900-e.length,[y,w]):m==c?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 l=a+(this.astral?Ua(Ys(r,a)):1);i&&s[i-1]==a?s[i-1]=l:(s[i++]=a,s[i++]=l)}return this.ret(e-r.length,s)}}class Xle{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const Jr=et.define({combine(t){return co(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Yle,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=>YT(e(r),n(r)),optionClass:(e,n)=>r=>YT(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function YT(t,e){return t?e?t+" "+e:t:e}function Yle(t,e,n,r,s,i){let a=t.textDirection==Jn.RTL,l=a,c=!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(l&&g<Math.min(y,x)?l=!1:!l&&x<Math.min(y,g)&&(l=!0),y<=(l?g:x))f=Math.max(s.top,Math.min(n.top,s.bottom-w))-e.top,m=Math.min(400,l?g:x);else{c=!0,m=Math.min(400,(a?e.right:s.right-e.left)-30);let N=s.bottom-e.bottom;N>=w||N>e.top?f=n.bottom-e.top:(h="bottom",f=e.bottom-n.top)}let S=(e.bottom-e.top)/i.offsetHeight,k=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${f/S}px; max-width: ${m/k}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":l?"left":"right")}}function Kle(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 l=n.displayLabel||n.label,c=0;for(let h=0;h<i.length;){let f=i[h++],m=i[h++];f>c&&a.appendChild(document.createTextNode(l.slice(c,f)));let g=a.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(l.slice(f,m))),g.className="cm-completionMatchedText",c=m}return c<l.length&&a.appendChild(document.createTextNode(l.slice(c))),a},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function Tw(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 Zle{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:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:a}=s.open,l=e.state.facet(Jr);this.optionContent=Kle(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Tw(i.length,a,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",c=>{let{options:h}=e.state.field(n).open;for(let f=c.target,m;f&&f!=this.dom;f=f.parentNode)if(f.nodeName=="LI"&&(m=/-(\d+)$/.exec(f.id))&&+m[1]<h.length){this.applyCompletion(e,h[+m[1]]),c.preventDefault();return}}),this.dom.addEventListener("focusout",c=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Jr).closeOnBlur&&c.relatedTarget!=e.contentDOM&&e.dispatch({effects:n0.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:l}=r.open;(!s.open||s.open.options!=i)&&(this.range=Tw(i.length,a,e.state.facet(Jr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),l!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}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.from||n.selected>=this.range.to)&&(this.range=Tw(n.options.length,n.selected,this.view.state.facet(Jr).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(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>Zs(this.view.state,l,"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&&ece(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<Math.max(i.top,n.top)+10?null:this.view.state.facet(Jr).positionInfo(this.view,n,s,r,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",a=>{a.target==s&&a.preventDefault()});let i=null;for(let a=r.from;a<r.to;a++){let{completion:l,match:c}=e[a],{section:h}=l;if(h){let g=typeof h=="string"?h:h.name;if(g!=i&&(a>r.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(l);m&&(f.className=m);for(let g of this.optionContent){let x=g(l,this.view.state,this.view,c);x&&f.appendChild(x)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Jle(t,e){return n=>new Zle(n,t,e)}function ece(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/s:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function KT(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function tce(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(Jr);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 GT(g,f.source,m?m(g):[],1e9-n.length));else{let g=e.sliceDoc(f.from,f.to),x,y=a.filterStrict?new Xle(g):new Gle(g);for(let w of f.result.options)if(x=y.match(w.label)){let S=w.displayLabel?m?m(w,x.matched):[]:x.matched,k=x.score+(w.boost||0);if(i(new GT(w,f.source,S,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.name<y.name?-1:1);for(let x of r.sort(g))m-=1e5,f[x.name]=m;for(let x of n){let{section:y}=x.completion;y&&(x.score+=f[typeof y=="string"?y:y.name])}}let l=[],c=null,h=a.compareCompletions;for(let f of n.sort((m,g)=>g.score-m.score||h(m.completion,g.completion))){let m=f.completion;!c||c.label!=m.label||c.detail!=m.detail||c.type!=null&&m.type!=null&&c.type!=m.type||c.apply!=m.apply||c.boost!=m.boost?l.push(f):KT(f.completion)>KT(c)&&(l[l.length-1]=f),c=f.completion}return l}class Ud{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 Ud(this.options,ZT(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 l=tce(e,n);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let c=n.facet(Jr).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let h=s.options[s.selected].completion;for(let f=0;f<l.length;f++)if(l[f].completion==h){c=f;break}}return new Ud(l,ZT(r,c),{pos:e.reduce((h,f)=>f.hasResult()?Math.min(h,f.from):h,1e8),create:oce,above:i.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(e){return new Ud(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Ud(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class G1{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new G1(ice,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Jr),i=(r.override||n.languageDataAt("autocomplete",Su(n)).map(Wle)).map(c=>(this.active.find(f=>f.source==c)||new Ki(c,this.active.some(f=>f.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((c,h)=>c==this.active[h])&&(i=this.active);let a=this.open,l=e.effects.some(c=>c.is(Y6));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||i.some(c=>c.hasResult()&&e.changes.touchesRange(c.from,c.to))||!nce(i,this.active)||l?a=Ud.build(i,n,this.id,a,r,l):a&&a.disabled&&!i.some(c=>c.isPending)&&(a=null),!a&&i.every(c=>!c.isPending)&&i.some(c=>c.hasResult())&&(i=i.map(c=>c.hasResult()?new Ki(c.source,0):c));for(let c of e.effects)c.is(_q)&&(a=a&&a.setSelected(c.value,this.id));return i==this.active&&a==this.open?this:new G1(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?rce:sce}}function nce(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let s=n==t.length,i=r==e.length;if(s||i)return s==i;if(t[n++].result!=e[r++].result)return!1}}const rce={"aria-autocomplete":"list"},sce={};function ZT(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const ice=[];function Eq(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(X6);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 Ki{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=Eq(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new Ki(s.source,0)),r&4&&s.state==0&&(s=new Ki(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(W1))s=new Ki(s.source,1,i.value);else if(i.is(n0))s=new Ki(s.source,0);else if(i.is(Y6))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(Su(e.state))}}class rh extends Ki{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),l=Su(e.state);if(l>a||!s||n&2&&(Su(e.startState)==this.from||l<this.limit))return new Ki(this.source,n&4?1:0);let c=e.changes.mapPos(this.limit);return ace(s.validFor,e.state,i,a)?new rh(this.source,this.explicit,c,s,i,a):s.update&&(s=s.update(s,i,a,new Nq(e.state,l,!1)))?new rh(this.source,this.explicit,c,s,s.from,(r=s.to)!==null&&r!==void 0?r:Su(e.state)):new Ki(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new rh(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Ki(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function ace(t,e,n,r){if(!t)return!1;let s=e.sliceDoc(n,r);return typeof t=="function"?t(s,n,r,e):Tq(t,!0).test(s)}const Y6=Et.define({map(t,e){return t.map(n=>n.map(e))}}),_q=Et.define(),Ks=rs.define({create(){return G1.start()},update(t,e){return t.update(e)},provide:t=>[_6.from(t,e=>e.tooltip),We.contentAttributes.from(t,e=>e.attrs)]});function K6(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Ks).active.find(s=>s.source==e.source);return r instanceof rh?(typeof n=="string"?t.dispatch({...Ule(t.state,n,r.from,r.to),annotations:X6.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const oce=Jle(Ks,K6);function fx(t,e="option"){return n=>{let r=n.state.field(Ks,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Jr).interactionDelay)return!1;let s=1,i;e=="page"&&(i=sB(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:a}=r.open.options,l=r.open.selected>-1?r.open.selected+s*(t?1:-1):t?0:a-1;return l<0?l=e=="page"?0:a-1:l>=a&&(l=e=="page"?a-1:0),n.dispatch({effects:_q.of(l)}),!0}}const lce=t=>{let e=t.state.field(Ks,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Jr).interactionDelay?!1:K6(t,e.open.options[e.open.selected])},Ew=t=>t.state.field(Ks,!1)?(t.dispatch({effects:W1.of(!0)}),!0):!1,cce=t=>{let e=t.state.field(Ks,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:n0.of(null)}),!0)};class uce{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const dce=50,hce=1e3,fce=jr.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(Ks).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Ks),n=t.state.facet(Jr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Ks)==e)return;let r=t.transactions.some(i=>{let a=Eq(i,n);return a&8||(i.selection||i.docChanged)&&!(a&3)});for(let i=0;i<this.running.length;i++){let a=this.running[i];if(r||a.context.abortOnDocChange&&t.docChanged||a.updates.length+t.transactions.length>dce&&Date.now()-a.time>hce){for(let l of a.context.abortListeners)try{l()}catch(c){Zs(this.view.state,c)}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(W1)))&&(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(Ks);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(Jr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Su(e),r=new Nq(e,n,t.explicit,this.view),s=new uce(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:n0.of(null)}),Zs(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(Jr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Jr),r=this.view.state.field(Ks);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let l=Su(i.updates.length?i.updates[0].startState:this.view.state),c=Math.min(l,i.done.from+(i.active.explicit?0:1)),h=new rh(i.active.source,i.active.explicit,c,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:l);for(let f of i.updates)h=h.update(f,n);if(h.hasResult()){e.push(h);continue}}let a=r.active.find(l=>l.source==i.active.source);if(a&&a.isPending)if(i.done==null){let l=new Ki(i.active.source,0);for(let c of i.updates)l=l.update(c,n);l.isPending||e.push(l)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Y6.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Ks,!1);if(e&&e.tooltip&&this.view.state.facet(Jr).closeOnBlur){let n=e.open&&sB(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:n0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:W1.of(!1)}),20),this.composing=0}}}),mce=typeof navigator=="object"&&/Win/.test(navigator.platform),pce=_c.highest(We.domEventHandlers({keydown(t,e){let n=e.state.field(Ks,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(mce&&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&&K6(e,r),!1}})),Mq=We.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 gce{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class Z6{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,ds.TrackDel),r=e.mapPos(this.to,1,ds.TrackDel);return n==null||r==null?null:new Z6(this.field,n,r)}}class J6{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 c of this.lines){if(r.length){let h=a,f=/^\t*/.exec(c)[0].length;for(let m=0;m<f;m++)h+=e.facet(W0);s.push(n+h.length-f),c=h+c.slice(f)}r.push(c),n+=c.length+1}let l=this.fieldPositions.map(c=>new Z6(c.field,s[c.line]+c.from,s[c.line]+c.to));return{text:r,ranges:l}}static parse(e){let n=[],r=[],s=[],i;for(let a of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let l=i[1]?+i[1]:null,c=i[2]||i[3]||"",h=-1,f=c.replace(/\\[{}]/g,m=>m[1]);for(let m=0;m<n.length;m++)(l!=null?n[m].seq==l:f&&n[m].name==f)&&(h=m);if(h<0){let m=0;for(;m<n.length&&(l==null||n[m].seq!=null&&n[m].seq<l);)m++;n.splice(m,0,{seq:l,name:f}),h=m;for(let g of s)g.field>=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 gce(h,r.length,i.index,i.index+f.length)),a=a.slice(0,i.index)+c+a.slice(i.index+i[0].length)}a=a.replace(/\\([{}])/g,(l,c,h)=>{for(let f of s)f.line==r.length&&f.from>h&&(f.from--,f.to--);return c}),r.push(a)}return new J6(r,s)}}let xce=ft.widget({widget:new class extends uo{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),vce=ft.mark({class:"cm-snippetField"});class $h{constructor(e,n){this.ranges=e,this.active=n,this.deco=ft.set(e.map(r=>(r.from==r.to?xce:vce).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 $h(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 Z0=Et.define({map(t,e){return t&&t.map(e)}}),yce=Et.define(),r0=rs.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(Z0))return n.value;if(n.is(yce)&&t)return new $h(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=>We.decorations.from(t,e=>e?e.deco:ft.none)});function eO(t,e){return Ae.create(t.filter(n=>n.field==e).map(n=>Ae.range(n.from,n.to)))}function bce(t){let e=J6.parse(t);return(n,r,s,i)=>{let{text:a,ranges:l}=e.instantiate(n.state,s),{main:c}=n.state.selection,h={changes:{from:s,to:i==c.from?c.to:i,insert:an.of(a)},scrollIntoView:!0,annotations:r?[X6.of(r),Dr.userEvent.of("input.complete")]:void 0};if(l.length&&(h.selection=eO(l,0)),l.some(f=>f.field>0)){let f=new $h(l,0),m=h.effects=[Z0.of(f)];n.state.field(r0,!1)===void 0&&m.push(Et.appendConfig.of([r0,jce,Nce,Mq]))}n.dispatch(n.state.update(h))}}function Aq(t){return({state:e,dispatch:n})=>{let r=e.field(r0,!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:eO(r.ranges,s),effects:Z0.of(i?null:new $h(r.ranges,s)),scrollIntoView:!0})),!0}}const wce=({state:t,dispatch:e})=>t.field(r0,!1)?(e(t.update({effects:Z0.of(null)})),!0):!1,Sce=Aq(1),kce=Aq(-1),Oce=[{key:"Tab",run:Sce,shift:kce},{key:"Escape",run:wce}],JT=et.define({combine(t){return t.length?t[0]:Oce}}),jce=_c.highest(V0.compute([JT],t=>t.facet(JT)));function qo(t,e){return{...e,apply:bce(t)}}const Nce=We.domEventHandlers({mousedown(t,e){let n=e.state.field(r0,!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:eO(n.ranges,s.field),effects:Z0.of(n.ranges.some(i=>i.field>s.field)?new $h(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),s0={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},pu=Et.define({map(t,e){let n=e.mapPos(t,-1,ds.TrackAfter);return n??void 0}}),tO=new class extends Nu{};tO.startSide=1;tO.endSide=-1;const Rq=rs.define({create(){return ln.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(pu)&&(t=t.update({add:[tO.range(n.value,n.value+1)]}));return t}});function Cce(){return[Ece,Rq]}const _w="()[]{}<>«»»«[]{}";function Dq(t){for(let e=0;e<_w.length;e+=2)if(_w.charCodeAt(e)==t)return _w.charAt(e+1);return g6(t<128?t:t+1)}function zq(t,e){return t.languageDataAt("closeBrackets",e)[0]||s0}const Tce=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ece=We.inputHandler.of((t,e,n,r)=>{if((Tce?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&Ua(Ys(r,0))==1||e!=s.from||n!=s.to)return!1;let i=Ace(t.state,r);return i?(t.dispatch(i),!0):!1}),_ce=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=zq(t,t.selection.main.head).brackets||s0.brackets,s=null,i=t.changeByRange(a=>{if(a.empty){let l=Rce(t.doc,a.head);for(let c of r)if(c==l&&ey(t.doc,a.head)==Dq(Ys(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:Ae.cursor(a.head-c.length)}}return{range:s=a}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Mce=[{key:"Backspace",run:_ce}];function Ace(t,e){let n=zq(t,t.selection.main.head),r=n.brackets||s0.brackets;for(let s of r){let i=Dq(Ys(s,0));if(e==s)return i==s?Pce(t,s,r.indexOf(s+s+s)>-1,n):Dce(t,s,i,n.before||s0.before);if(e==i&&Pq(t,t.selection.main.from))return zce(t,s,i)}return null}function Pq(t,e){let n=!1;return t.field(Rq).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function ey(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Ua(Ys(n,0)))}function Rce(t,e){let n=t.sliceString(e-2,e);return Ua(Ys(n,0))==n.length?n:n.slice(1)}function Dce(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:pu.of(a.to+e.length),range:Ae.range(a.anchor+e.length,a.head+e.length)};let l=ey(t.doc,a.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:a.head},effects:pu.of(a.head+e.length),range:Ae.cursor(a.head+e.length)}:{range:s=a}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function zce(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&ey(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ae.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Pce(t,e,n,r){let s=r.stringPrefixes||s0.stringPrefixes,i=null,a=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:pu.of(l.to+e.length),range:Ae.range(l.anchor+e.length,l.head+e.length)};let c=l.head,h=ey(t.doc,c),f;if(h==e){if(eE(t,c))return{changes:{insert:e+e,from:c},effects:pu.of(c+e.length),range:Ae.cursor(c+e.length)};if(Pq(t,c)){let g=n&&t.sliceDoc(c,c+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:c,to:c+g.length,insert:g},range:Ae.cursor(c+g.length)}}}else{if(n&&t.sliceDoc(c-2*e.length,c)==e+e&&(f=tE(t,c-2*e.length,s))>-1&&eE(t,f))return{changes:{insert:e+e+e+e,from:c},effects:pu.of(c+e.length),range:Ae.cursor(c+e.length)};if(t.charCategorizer(c)(h)!=rr.Word&&tE(t,c,s)>-1&&!Lce(t,c,e,s))return{changes:{insert:e+e,from:c},effects:pu.of(c+e.length),range:Ae.cursor(c+e.length)}}return{range:i=l}});return i?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function eE(t,e){let n=es(t).resolveInner(e+1);return n.parent&&n.from==e}function Lce(t,e,n,r){let s=es(t).resolveInner(e,-1),i=r.reduce((a,l)=>Math.max(a,l.length),0);for(let a=0;a<5;a++){let l=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),c=l.indexOf(n);if(!c||c>-1&&r.indexOf(l.slice(0,c))>-1){let f=s.firstChild;for(;f&&f.from==s.from&&f.to-f.from>n.length+c;){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 tE(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=rr.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))!=rr.Word)return i}return-1}function Ice(t={}){return[pce,Ks,Jr.of(t),fce,Bce,Mq]}const Lq=[{key:"Ctrl-Space",run:Ew},{mac:"Alt-`",run:Ew},{mac:"Alt-i",run:Ew},{key:"Escape",run:cce},{key:"ArrowDown",run:fx(!0)},{key:"ArrowUp",run:fx(!1)},{key:"PageDown",run:fx(!0,"page")},{key:"PageUp",run:fx(!1,"page")},{key:"Enter",run:lce}],Bce=_c.highest(V0.computeN([Jr],t=>t.facet(Jr).defaultKeymap?[Lq]:[]));class nE{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class uu{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(i0).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((x,y)=>x.from-y.from||x.to-y.to),a=new dl,l=[],c=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&&!l.length)break;let w,S;if(l.length)w=c,S=l.reduce((C,T)=>Math.min(C,T.to),y&&y.from>w?y.from:1e8);else{if(w=y.from,w>m)break;S=y.to,l.push(y),x++}for(;x<i.length;){let C=i[x];if(C.from==w&&(C.to>C.from||C.to==w))l.push(C),x++,S=Math.min(C.to,S);else{S=Math.min(C.from,S);break}}S=Math.min(S,m);let k=!1;if(l.some(C=>C.from==w&&(C.to==S||S==m))&&(k=w==S,!k&&S-w<10)){let C=w-(f+h.value.length);C>0&&(h.next(C),f=w);for(let T=w;;){if(T>=S){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=Zce(l);if(k)a.add(w,w,ft.widget({widget:new Gce(N),diagnostics:l.slice()}));else{let C=l.reduce((T,_)=>_.markClass?T+" "+_.markClass:T,"");a.add(w,S,ft.mark({class:"cm-lintRange cm-lintRange-"+N+C,diagnostics:l.slice(),inclusiveEnd:l.some(T=>T.to>S)}))}if(c=S,c==m)break;for(let C=0;C<l.length;C++)l[C].to<=c&&l.splice(C--,1)}let g=a.finish();return new uu(g,n,jh(g))}}function jh(t,e=null,n=0){let r=null;return t.between(n,1e9,(s,i,{spec:a})=>{if(!(e&&a.diagnostics.indexOf(e)<0))if(!r)r=new nE(s,i,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new nE(r.from,i,r.diagnostic)}}),r}function qce(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(i0).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is(Iq))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function Fce(t,e){return t.field(Ci,!1)?e:e.concat(Et.appendConfig.of(Jce))}const Iq=Et.define(),nO=Et.define(),Bq=Et.define(),Ci=rs.define({create(){return new uu(ft.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=jh(n,t.selected.diagnostic,i)||jh(n,null,i)}!n.size&&s&&e.state.facet(i0).autoPanel&&(s=null),t=new uu(n,s,r)}for(let n of e.effects)if(n.is(Iq)){let r=e.state.facet(i0).autoPanel?n.value.length?a0.open:null:t.panel;t=uu.init(n.value,r,e.state)}else n.is(nO)?t=new uu(t.diagnostics,n.value?a0.open:null,t.selected):n.is(Bq)&&(t=new uu(t.diagnostics,t.panel,n.value));return t},provide:t=>[Xm.from(t,e=>e.panel),We.decorations.from(t,e=>e.diagnostics)]}),$ce=ft.mark({class:"cm-lintRange cm-lintRange-active"});function Qce(t,e,n){let{diagnostics:r}=t.state.field(Ci),s,i=-1,a=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(c,h,{spec:f})=>{if(e>=c&&e<=h&&(c==h||(e>c||n>0)&&(e<h||n<0)))return s=f.diagnostics,i=c,a=h,!1});let l=t.state.facet(i0).tooltipFilter;return s&&l&&(s=l(s,t.state)),s?{pos:i,end:a,above:t.state.doc.lineAt(i).to<a,create(){return{dom:Hce(t,s)}}}:null}function Hce(t,e){return $n("ul",{class:"cm-tooltip-lint"},e.map(n=>Fq(t,n,!1)))}const Vce=t=>{let e=t.state.field(Ci,!1);(!e||!e.panel)&&t.dispatch({effects:Fce(t.state,[nO.of(!0)])});let n=Gm(t,a0.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},rE=t=>{let e=t.state.field(Ci,!1);return!e||!e.panel?!1:(t.dispatch({effects:nO.of(!1)}),!0)},Uce=t=>{let e=t.state.field(Ci,!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)},Wce=[{key:"Mod-Shift-m",run:Vce,preventDefault:!0},{key:"F8",run:Uce}],i0=et.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...co(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:sE,tooltipFilter:sE,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 sE(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function qq(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let s=n[r];if(/[a-zA-Z]/.test(s)&&!e.some(i=>i.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Fq(t,e,n){var r;let s=n?qq(e.actions):[];return $n("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},$n("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 l=!1,c=x=>{if(x.preventDefault(),l)return;l=!0;let y=jh(t.state.field(Ci).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),$n("u",h.slice(f,f+1)),h.slice(f+1)],g=i.markClass?" "+i.markClass:"";return $n("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:c,onmousedown:c,"aria-label":` Action: ${h}${f<0?"":` (access key "${s[a]})"`}.`},m)}),e.source&&$n("div",{class:"cm-diagnosticSource"},e.source))}class Gce extends uo{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return $n("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class iE{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Fq(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class a0{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)rE(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=qq(i.actions);for(let l=0;l<a.length;l++)if(a[l].toUpperCase().charCodeAt(0)==s.keyCode){let c=jh(this.view.state.field(Ci).diagnostics,i);c&&i.actions[l].apply(e,c.from,c.to)}}else return;s.preventDefault()},r=s=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(s.target)&&this.moveSelection(i)};this.list=$n("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=$n("div",{class:"cm-panel-lint"},this.list,$n("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>rE(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ci).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(Ci),r=0,s=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(l,c,{spec:h})=>{for(let f of h.diagnostics){if(a.has(f))continue;a.add(f);let m=-1,g;for(let x=r;x<this.items.length;x++)if(this.items[x].diagnostic==f){m=x;break}m<0?(g=new iE(this.view,f),this.items.splice(r,0,g),s=!0):(g=this.items[m],m>r&&(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<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new iE(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let h=c.height/this.list.offsetHeight;l.top<c.top?this.list.scrollTop-=(c.top-l.top)/h:l.bottom>c.bottom&&(this.list.scrollTop+=(l.bottom-c.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(Ci),r=jh(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Bq.of(r)})}static open(e){return new a0(e)}}function Xce(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function mx(t){return Xce(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Yce=We.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:mx("#d11")},".cm-lintRange-warning":{backgroundImage:mx("orange")},".cm-lintRange-info":{backgroundImage:mx("#999")},".cm-lintRange-hint":{backgroundImage:mx("#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 Kce(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function Zce(t){let e="hint",n=1;for(let r of t){let s=Kce(r.severity);s>n&&(n=s,e=r.severity)}return e}const Jce=[Ci,We.decorations.compute([Ci],t=>{let{selected:e,panel:n}=t.field(Ci);return!e||!n||e.from==e.to?ft.none:ft.set([$ce.range(e.from,e.to)])}),Die(Qce,{hideOn:qce}),Yce];var aE=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(Mce)),e.defaultKeymap!==!1&&(r=r.concat(mle)),e.searchKeymap!==!1&&(r=r.concat(qle)),e.historyKeymap!==!1&&(r=r.concat(woe)),e.foldKeymap!==!1&&(r=r.concat(Mae)),e.completionKeymap!==!1&&(r=r.concat(Lq)),e.lintKeymap!==!1&&(r=r.concat(Wce));var s=[];return e.lineNumbers!==!1&&s.push(Vie()),e.highlightActiveLineGutter!==!1&&s.push(Gie()),e.highlightSpecialChars!==!1&&s.push(cie()),e.history!==!1&&s.push(hoe()),e.foldGutter!==!1&&s.push(zae()),e.drawSelection!==!1&&s.push(Zse()),e.dropCursor!==!1&&s.push(rie()),e.allowMultipleSelections!==!1&&s.push(rn.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(Sae()),e.syntaxHighlighting!==!1&&s.push(TB(Bae,{fallback:!0})),e.bracketMatching!==!1&&s.push(Uae()),e.closeBrackets!==!1&&s.push(Cce()),e.autocompletion!==!1&&s.push(Ice()),e.rectangularSelection!==!1&&s.push(kie()),n!==!1&&s.push(Nie()),e.highlightActiveLine!==!1&&s.push(pie()),e.highlightSelectionMatches!==!1&&s.push(wle()),e.tabSize&&typeof e.tabSize=="number"&&s.push(W0.of(" ".repeat(e.tabSize))),s.concat([V0.of(r.flat())]).filter(Boolean)};const eue="#e5c07b",oE="#e06c75",tue="#56b6c2",nue="#ffffff",o1="#abb2bf",zS="#7d8799",rue="#61afef",sue="#98c379",lE="#d19a66",iue="#c678dd",aue="#21252b",cE="#2c313a",uE="#282c34",Mw="#353a42",oue="#3E4451",dE="#528bff",lue=We.theme({"&":{color:o1,backgroundColor:uE},".cm-content":{caretColor:dE},".cm-cursor, .cm-dropCursor":{borderLeftColor:dE},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:oue},".cm-panels":{backgroundColor:aue,color:o1},".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:uE,color:zS,border:"none"},".cm-activeLineGutter":{backgroundColor:cE},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Mw},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Mw,borderBottomColor:Mw},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:cE,color:o1}}},{dark:!0}),cue=X0.define([{tag:ve.keyword,color:iue},{tag:[ve.name,ve.deleted,ve.character,ve.propertyName,ve.macroName],color:oE},{tag:[ve.function(ve.variableName),ve.labelName],color:rue},{tag:[ve.color,ve.constant(ve.name),ve.standard(ve.name)],color:lE},{tag:[ve.definition(ve.name),ve.separator],color:o1},{tag:[ve.typeName,ve.className,ve.number,ve.changed,ve.annotation,ve.modifier,ve.self,ve.namespace],color:eue},{tag:[ve.operator,ve.operatorKeyword,ve.url,ve.escape,ve.regexp,ve.link,ve.special(ve.string)],color:tue},{tag:[ve.meta,ve.comment],color:zS},{tag:ve.strong,fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.link,color:zS,textDecoration:"underline"},{tag:ve.heading,fontWeight:"bold",color:oE},{tag:[ve.atom,ve.bool,ve.special(ve.variableName)],color:lE},{tag:[ve.processingInstruction,ve.string,ve.inserted],color:sue},{tag:ve.invalid,color:nue}]),$q=[lue,TB(cue)];var uue=We.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),due=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:a="",basicSetup:l=!0}=e,c=[];switch(n&&c.unshift(V0.of([ple])),l&&(typeof l=="boolean"?c.unshift(aE()):c.unshift(aE(l))),a&&c.unshift(yie(a)),i){case"light":c.push(uue);break;case"dark":c.push($q);break;case"none":break;default:c.push(i);break}return r===!1&&c.push(We.editable.of(!1)),s&&c.push(rn.readOnly.of(!0)),[...c]},hue=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 fue{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 hE{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 Aw=null,mue=()=>typeof window>"u"?new hE:(Aw||(Aw=new hE),Aw),fE=lo.define(),pue=200,gue=[];function xue(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:a,extensions:l=gue,autoFocus:c,theme:h="light",height:f=null,minHeight:m=null,maxHeight:g=null,width:x=null,minWidth:y=null,maxWidth:w=null,placeholder:S="",editable:k=!0,readOnly:N=!1,indentWithTab:C=!0,basicSetup:T=!0,root:_,initialState:E}=t,[M,q]=b.useState(),[L,I]=b.useState(),[$,V]=b.useState(),ee=b.useState(()=>({current:null}))[0],z=b.useState(()=>({current:null}))[0],H=We.theme({"&":{height:f,minHeight:m,maxHeight:g,width:x,minWidth:y,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),P=We.updateListener.of(X=>{if(X.docChanged&&typeof r=="function"&&!X.transactions.some(G=>G.annotation(fE))){ee.current?ee.current.reset():(ee.current=new fue(()=>{if(z.current){var G=z.current;z.current=null,G()}ee.current=null},pue),mue().add(ee.current));var R=X.state.doc,se=R.toString();r(se,X)}s&&s(hue(X))}),W=due({theme:h,editable:k,readOnly:N,placeholder:S,indentWithTab:C,basicSetup:T}),J=[P,H,...W];return a&&typeof a=="function"&&J.push(We.updateListener.of(a)),J=J.concat(l),b.useLayoutEffect(()=>{if(M&&!$){var X={doc:e,selection:n,extensions:J},R=E?rn.fromJSON(E.json,X,E.fields):rn.create(X);if(V(R),!L){var se=new We({state:R,parent:M,root:_});I(se),i&&i(se,R)}}return()=>{L&&(V(void 0),I(void 0))}},[M,$]),b.useEffect(()=>{t.container&&q(t.container)},[t.container]),b.useEffect(()=>()=>{L&&(L.destroy(),I(void 0)),ee.current&&(ee.current.cancel(),ee.current=null)},[L]),b.useEffect(()=>{c&&L&&L.focus()},[c,L]),b.useEffect(()=>{L&&L.dispatch({effects:Et.reconfigure.of(J)})},[h,l,f,m,g,x,y,w,S,k,N,C,T,r,a]),b.useEffect(()=>{if(e!==void 0){var X=L?L.state.doc.toString():"";if(L&&e!==X){var R=ee.current&&!ee.current.isDone,se=()=>{L&&e!==L.state.doc.toString()&&L.dispatch({changes:{from:0,to:L.state.doc.toString().length,insert:e||""},annotations:[fE.of(!0)]})};R?z.current=se:se()}}},[e,L]),{state:$,setState:V,view:L,setView:I,container:M,setContainer:q}}var vue=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Qq=b.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:a,onStatistics:l,onCreateEditor:c,onUpdate:h,autoFocus:f,theme:m="light",height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:_,readOnly:E,root:M,initialState:q}=t,L=oY(t,vue),I=b.useRef(null),{state:$,view:V,container:ee,setContainer:z}=xue({root:M,value:r,autoFocus:f,theme:m,height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:_,readOnly:E,selection:s,onChange:a,onStatistics:l,onCreateEditor:c,onUpdate:h,extensions:i,initialState:q});b.useImperativeHandle(e,()=>({editor:I.current,state:$,view:V}),[I,ee,$,V]);var H=b.useCallback(W=>{I.current=W,z(W)},[z]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var P=typeof m=="string"?"cm-theme-"+m:"cm-theme";return o.jsx("div",lY({ref:H,className:""+P+(n?" "+n:"")},L))});Qq.displayName="CodeMirror";var mE={};class X1{constructor(e,n,r,s,i,a,l,c,h,f=0,m){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=a,this.buffer=l,this.bufferBase=c,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 X1(e,[],n,r,r,0,[],0,s?new pE(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<this.pos-25;a&&this.setLookAhead(this.pos);let l=i.dynamicPrecedence(s);if(l&&(this.score+=l),r==0){this.pushState(i.getGoto(this.state,s,!0),this.reducePos),s<i.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(s,this.reducePos);return}let c=this.stack.length-(r-1)*3-(e&262144?6:0),h=c?this.stack[c-2]:this.p.ranges[0].from,f=this.reducePos-h;f>=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.lastBigReductionSize<f&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=f));let m=c?this.stack[c-1]:0,g=this.bufferBase+this.buffer.length-m;if(s<i.minRepeatTerm||e&131072){let x=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,h,x,g+4,!0)}if(e&262144)this.state=this.stack[c];else{let x=this.stack[c-3];this.state=i.getGoto(x,s,!0)}for(;this.stack.length>c;)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]<this.buffer.length+this.bufferBase)){let a=this,l=this.buffer.length;if(l==0&&a.parent&&(l=a.bufferBase-a.parent.bufferBase,a=a.parent),l>0&&a.buffer[l-4]==0&&a.buffer[l-1]>-1){if(n==r)return;if(a.buffer[l-2]>=n){a.buffer[l-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 l=!1;for(let c=a;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){l=!0;break}if(l)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 X1(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 yue(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;i<n.length;i+=2)(a=n[i+1])!=this.state&&this.p.parser.hasAction(a,e)&&s.push(n[i],a);if(this.stack.length<120)for(let i=0;s.length<8&&i<n.length;i+=2){let a=n[i+1];s.some((l,c)=>c&1&&l==a)||s.push(n[i],a)}n=s}let r=[];for(let s=0;s<n.length&&r.length<4;s+=2){let i=n[s+1];if(i==this.state)continue;let a=this.split();a.pushState(i,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(n[s],this.pos),a.reducePos=this.pos,a.score-=200,r.push(a)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>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 l=(a>>19)-i;if(l>1){let c=a&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],c,!1)>=0)return l<<19|65536|c}}else{let l=r(a,i+1);if(l!=null)return l}})};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;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new pE(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class pE{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class yue{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 Y1{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 Y1(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 Y1(this.stack,this.pos,this.index)}}function px(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r<t.length;){let i=0;for(;;){let a=t.charCodeAt(r++),l=!1;if(a==126){i=65535;break}a>=92&&a--,a>=34&&a--;let c=a-32;if(c>=46&&(c-=46,l=!0),i+=c,l)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class l1{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const gE=new l1;class bue{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=gE,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(;i<r.from;){if(!s)return null;let a=this.ranges[--s];i-=r.from-a.to,r=a}for(;n<0?i>r.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&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n<this.chunk.length)r=this.pos+e,s=this.chunk.charCodeAt(n);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(r=i,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let a=this.rangeIndex,l=this.range;for(;l.to<=r;)l=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.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.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.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=gE,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(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 sh{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;wue(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}sh.prototype.contextual=sh.prototype.fallback=sh.prototype.extend=!1;sh.prototype.fallback=sh.prototype.extend=!1;class ty{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function wue(t,e,n,r,s,i){let a=0,l=1<<r,{dialect:c}=n.p.parser;e:for(;(l&t[a])!=0;){let h=t[a+1];for(let x=a+3;x<h;x+=2)if((t[x+1]&l)>0){let y=t[x];if(c.allows(y)&&(e.token.value==-1||e.token.value==y||Sue(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<g;){let x=m+g>>1,y=h+x+(x<<1),w=t[y],S=t[y+1]||65536;if(f<w)g=x;else if(f>=S)m=x+1;else{a=t[y+2],e.advance();continue e}}break}}function xE(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function Sue(t,e,n,r){let s=xE(n,r,e);return s<0||xE(n,r,t)<s}const wi=typeof process<"u"&&mE&&/\bparse\b/.test(mE.LOG);let Rw=null;function vE(t,e,n){let r=t.cursor(Hr.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>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 kue{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?vE(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?vE(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(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],s=this.index[n];if(s==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=r.children[s],a=this.start[n]+r.positions[s];if(a>e)return this.nextStart=a,null;if(i instanceof Hn){if(a==e){if(a<this.safeFrom)return null;let l=a+i.length;if(l<=this.safeTo){let c=i.prop(Qt.lookAhead);if(!c||l+c<this.fragment.to)return i}}this.index[n]++,a+i.length>=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 Oue{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new l1)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,a=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,c=0;for(let h=0;h<i.length;h++){if((1<<h&a)==0)continue;let f=i[h],m=this.tokens[h];if(!(r&&!f.fallback)&&((f.contextual||m.start!=e.pos||m.mask!=a||m.context!=l)&&(this.updateCachedToken(m,f,e),m.mask=a,m.context=l),m.lookAhead>m.end+25&&(c=Math.max(m.lookAhead,c)),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 c&&e.setLookAhead(c),!r&&e.pos==this.stream.end&&(r=new l1,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 l1,{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<i.specialized.length;a++)if(i.specialized[a]==e.value){let l=i.specializers[a](this.stream.read(e.start,e.end),r);if(l>=0&&r.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;i<s;i+=3)if(this.actions[i]==e)return s;return this.actions[s++]=e,this.actions[s++]=n,this.actions[s++]=r,s}addActions(e,n,r,s){let{state:i}=e,{parser:a}=e.p,{data:l}=a;for(let c=0;c<2;c++)for(let h=a.stateSlot(i,c?2:1);;h+=3){if(l[h]==65535)if(l[h+1]==1)h=Go(l,h+2);else{s==0&&l[h+1]==2&&(s=this.putAction(Go(l,h+2),n,r,s));break}l[h]==n&&(s=this.putAction(Go(l,h+1),n,r,s))}return s}}class jue{constructor(e,n,r,s){this.parser=e,this.input=n,this.ranges=s,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new bue(n,s),this.tokens=new Oue(e,this.stream),this.topTerm=e.top[1];let{from:i}=s[0];this.stacks=[X1.start(this,e.top[0],i)],this.fragments=r.length&&this.stream.end-i>e.bufferLength*4?new kue(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;a<e.length;a++){let l=e[a];for(;;){if(this.tokens.mainToken=null,l.pos>n)r.push(l);else{if(this.advanceStack(l,r,e))continue;{s||(s=[],i=[]),s.push(l);let c=this.tokens.getMainToken(l);i.push(c.value,c.end)}}break}}if(!r.length){let a=s&&Tue(s);if(a)return wi&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw wi&&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 wi&&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((l,c)=>c.score-l.score);r.length>a;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a<r.length-1;a++){let l=r[a];for(let c=a+1;c<r.length;c++){let h=r[c];if(l.sameState(h)||l.buffer.length>500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)r.splice(c--,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<r.length;a++)r[a].pos<this.minStackPos&&(this.minStackPos=r[a].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let s=e.pos,{parser:i}=this,a=wi?this.stackID(e)+" -> ":"";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(Qt.contextHash)||0)==f))return e.useNode(m,g),wi&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(m.type.id)})`),!0;if(!(m instanceof Hn)||m.children.length==0||m.positions[0]>0)break;let x=m.children[0];if(x instanceof Hn&&m.positions[0]==0)m=x;else break}}let l=i.stateSlot(e.state,4);if(l>0)return e.reduce(l),wi&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let h=0;h<c.length;){let f=c[h++],m=c[h++],g=c[h++],x=h==c.length||!r,y=x?e:e.split(),w=this.tokens.mainToken;if(y.apply(f,m,w?w.start:y.pos,g),wi&&console.log(a+this.stackID(y)+` (via ${(f&65536)==0?"shift":`reduce of ${i.getName(f&65535)}`} for ${i.getName(m)} @ ${s}${y==e?"":", split"})`),x)return!0;y.pos>s?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 yE(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let a=0;a<e.length;a++){let l=e[a],c=n[a<<1],h=n[(a<<1)+1],f=wi?this.stackID(l)+" -> ":"";if(l.deadEnd&&(i||(i=!0,l.restart(),wi&&console.log(f+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let m=l.split(),g=f;for(let x=0;x<10&&m.forceReduce()&&(wi&&console.log(g+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,r));x++)wi&&(g=this.stackID(m)+" -> ");for(let x of l.recoverByInsert(c))wi&&console.log(f+this.stackID(x)+" (via recover-insert)"),this.advanceFully(x,r);this.stream.end>l.pos?(h==l.pos&&(h++,c=0),l.recoverByDelete(c,h),wi&&console.log(f+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),yE(l,r)):(!s||s.score<l.score)&&(s=l)}return s}stackToTree(e){return e.close(),Hn.build({buffer:Y1.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(Rw||(Rw=new WeakMap)).get(e);return n||Rw.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function yE(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class Nue{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const Dw=t=>t;class Cue{constructor(e){this.start=e.start,this.shift=e.shift||Dw,this.reduce=e.reduce||Dw,this.reuse=e.reuse||Dw,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class o0 extends D6{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 l=0;l<e.repeatNodeCount;l++)n.push("");let r=Object.keys(e.topRules).map(l=>e.topRules[l][1]),s=[];for(let l=0;l<n.length;l++)s.push([]);function i(l,c,h){s[l].push([c,c.deserialize(String(h))])}if(e.nodeProps)for(let l of e.nodeProps){let c=l[0];typeof c=="string"&&(c=Qt[c]);for(let h=1;h<l.length;){let f=l[h++];if(f>=0)i(f,c,l[h++]);else{let m=l[h+-f];for(let g=-f;g>0;g--)i(l[h++],c,m);h++}}}this.nodeSet=new Uv(n.map((l,c)=>zs.define({name:c>=this.minRepeatTerm?void 0:l,id:c,props:s[c],top:r.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=lB;let a=px(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(bE),this.states=px(e.states,Uint32Array),this.data=px(e.stateData),this.goto=px(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new sh(a,l):l),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 jue(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++],l=a&1,c=s[i++];if(l&&r)return c;for(let h=i+(a>>1);i<h;i++)if(s[i]==e)return c;if(l)return-1}}hasAction(e,n){let r=this.data;for(let s=0;s<2;s++)for(let i=this.stateSlot(e,s?2:1),a;;i+=3){if((a=r[i])==65535)if(r[i+1]==1)a=r[i=Go(r,i+2)];else{if(r[i+1]==2)return Go(r,i+2);break}if(a==n||a==0)return Go(r,i+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}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=Go(this.data,i+2);else break;s=n(Go(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=Go(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(o0.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(l=>l.from==r.external);if(!i)return r;let a=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=bE(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;i<n.length;i++)if(!r[i])for(let a=this.dialects[n[i]],l;(l=this.data[a++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[l]=1;return new Nue(e,r,s)}static deserialize(e){return new o0(e)}}function Go(t,e){return t[e]|t[e+1]<<16}function Tue(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function bE(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}const Eue=1,Hq=194,Vq=195,_ue=196,wE=197,Mue=198,Aue=199,Rue=200,Due=2,Uq=3,SE=201,zue=24,Pue=25,Lue=49,Iue=50,Bue=55,que=56,Fue=57,$ue=59,Que=60,Hue=61,Vue=62,Uue=63,Wue=65,Gue=238,Xue=71,Yue=241,Kue=242,Zue=243,Jue=244,ede=245,tde=246,nde=247,rde=248,Wq=72,sde=249,ide=250,ade=251,ode=252,lde=253,cde=254,ude=255,dde=256,hde=73,fde=77,mde=263,pde=112,gde=130,xde=151,vde=152,yde=155,Au=10,l0=13,rO=32,ny=9,sO=35,bde=40,wde=46,PS=123,kE=125,Gq=39,Xq=34,OE=92,Sde=111,kde=120,Ode=78,jde=117,Nde=85,Cde=new Set([Pue,Lue,Iue,mde,Wue,gde,que,Fue,Gue,Vue,Uue,Wq,hde,fde,Que,Hue,xde,vde,yde,pde]);function zw(t){return t==Au||t==l0}function Pw(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const Tde=new ty((t,e)=>{let n;if(t.next<0)t.acceptToken(Aue);else if(e.context.flags&c1)zw(t.next)&&t.acceptToken(Mue,1);else if(((n=t.peek(-1))<0||zw(n))&&e.canShift(wE)){let r=0;for(;t.next==rO||t.next==ny;)t.advance(),r++;(t.next==Au||t.next==l0||t.next==sO)&&t.acceptToken(wE,-r)}else zw(t.next)&&t.acceptToken(_ue,1)},{contextual:!0}),Ede=new ty((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==Au||r==l0){let s=0,i=0;for(;;){if(t.next==rO)s++;else if(t.next==ny)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=Au&&t.next!=l0&&t.next!=sO&&(s<n.indent?t.acceptToken(Vq,-i):t.acceptToken(Hq))}}),c1=1,Yq=2,Ho=4,Vo=8,Uo=16,Wo=32;function u1(t,e,n){this.parent=t,this.indent=e,this.flags=n,this.hash=(t?t.hash+t.hash<<8:0)+e+(e<<4)+n+(n<<6)}const _de=new u1(null,0,0);function Mde(t){let e=0;for(let n=0;n<t.length;n++)e+=t.charCodeAt(n)==ny?8-e%8:1;return e}const jE=new Map([[Yue,0],[Kue,Ho],[Zue,Vo],[Jue,Vo|Ho],[ede,Uo],[tde,Uo|Ho],[nde,Uo|Vo],[rde,Uo|Vo|Ho],[sde,Wo],[ide,Wo|Ho],[ade,Wo|Vo],[ode,Wo|Vo|Ho],[lde,Wo|Uo],[cde,Wo|Uo|Ho],[ude,Wo|Uo|Vo],[dde,Wo|Uo|Vo|Ho]].map(([t,e])=>[t,e|Yq])),Ade=new Cue({start:_de,reduce(t,e,n,r){return t.flags&c1&&Cde.has(e)||(e==Xue||e==Wq)&&t.flags&Yq?t.parent:t},shift(t,e,n,r){return e==Hq?new u1(t,Mde(r.read(r.pos,n.pos)),0):e==Vq?t.parent:e==zue||e==Bue||e==$ue||e==Uq?new u1(t,0,c1):jE.has(e)?new u1(t,0,jE.get(e)|t.flags&c1):t},hash(t){return t.hash}}),Rde=new ty(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==rO||n==ny)){n!=bde&&n!=wde&&n!=Au&&n!=l0&&n!=sO&&t.acceptToken(Eue);return}}}),Dde=new ty((t,e)=>{let{flags:n}=e.context,r=n&Ho?Xq:Gq,s=(n&Vo)>0,i=!(n&Uo),a=(n&Wo)>0,l=t.pos;for(;!(t.next<0);)if(a&&t.next==PS)if(t.peek(1)==PS)t.advance(2);else{if(t.pos==l){t.acceptToken(Uq,1);return}break}else if(i&&t.next==OE){if(t.pos==l){t.advance();let c=t.next;c>=0&&(t.advance(),zde(t,c)),t.acceptToken(Due);return}break}else if(t.next==OE&&!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==l){t.acceptToken(SE,s?3:1);return}break}else if(t.next==Au){if(s)t.advance();else if(t.pos==l){t.acceptToken(SE);return}break}else t.advance();t.pos>l&&t.acceptToken(Rue)});function zde(t,e){if(e==Sde)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==kde)for(let n=0;n<2&&Pw(t.next);n++)t.advance();else if(e==jde)for(let n=0;n<4&&Pw(t.next);n++)t.advance();else if(e==Nde)for(let n=0;n<8&&Pw(t.next);n++)t.advance();else if(e==Ode&&t.next==PS){for(t.advance();t.next>=0&&t.next!=kE&&t.next!=Gq&&t.next!=Xq&&t.next!=Au;)t.advance();t.next==kE&&t.advance()}}const Pde=z6({'async "*" "**" FormatConversion FormatSpec':ve.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":ve.controlKeyword,"in not and or is del":ve.operatorKeyword,"from def class global nonlocal lambda":ve.definitionKeyword,import:ve.moduleKeyword,"with as print":ve.keyword,Boolean:ve.bool,None:ve.null,VariableName:ve.variableName,"CallExpression/VariableName":ve.function(ve.variableName),"FunctionDefinition/VariableName":ve.function(ve.definition(ve.variableName)),"ClassDefinition/VariableName":ve.definition(ve.className),PropertyName:ve.propertyName,"CallExpression/MemberExpression/PropertyName":ve.function(ve.propertyName),Comment:ve.lineComment,Number:ve.number,String:ve.string,FormatString:ve.special(ve.string),Escape:ve.escape,UpdateOp:ve.updateOperator,"ArithOp!":ve.arithmeticOperator,BitOp:ve.bitwiseOperator,CompareOp:ve.compareOperator,AssignOp:ve.definitionOperator,Ellipsis:ve.punctuation,At:ve.meta,"( )":ve.paren,"[ ]":ve.squareBracket,"{ }":ve.brace,".":ve.derefOperator,", ;":ve.separator}),Lde={__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},Ide=o0.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'#FyO<POWO,5:aOOQS,5:a,5:aO<[QdO'#HwOOOW'#Dw'#DwOOOW'#Fz'#FzO<lOWO,5:bOOQS,5:b,5:bOOQS'#F}'#F}O<zQtO,5:iO?lQtO,5=`O@VQ#xO,5=`O@vQtO,5=`OOQS,5:},5:}OA_QeO'#GWOBqQdO,5;^OOQV,5=^,5=^OB|QtO'#IPOCkQdO,5;tOOQS-E:[-E:[OOQV,5;s,5;sO4dQdO'#FQOOQV-E9o-E9oOCsQtO,59]OEzQtO,59iOFeQdO'#HVOFpQdO'#HVO1XQdO'#HVOF{QdO'#DTOGTQdO,59mOGYQdO'#HZO'vQdO'#HZO0rQdO,5=tOOQS,5=t,5=tO0rQdO'#EROOQS'#ES'#ESOGwQdO'#GPOHXQdO,58|OHXQdO,58|O*xQdO,5:oOHgQtO'#H]OOQS,5:r,5:rOOQS,5:z,5:zOHzQdO,5;OOI]QdO'#IOO1XQdO'#H}OOQS,5;Q,5;QOOQS'#GT'#GTOIqQtO,5;QOJPQdO,5;QOJUQdO'#IQOOQS,5;T,5;TOJdQdO'#H|OOQS,5;W,5;WOJuQdO,5;YO4iQdO,5;`O4iQdO,5;cOJ}QtO'#ITO'vQdO'#ITOKXQdO,5;eO4VQdO,5;eO0rQdO,5;jO1XQdO,5;lOK^QeO'#EuOLjQgO,5;fO!!kQdO'#IUO4iQdO,5;jO!!vQdO,5;lO!#OQdO,5;qO!#ZQtO,5;vO'vQdO,5;vPOOO,5=[,5=[P!#bOSO,5=[P!#jOdO,5=[O!&bQtO1G.jO!&iQtO1G.jO!)YQtO1G.jO!)dQtO1G.jO!+}QtO1G.jO!,bQtO1G.jO!,uQdO'#HcO!-TQtO'#GuO0rQdO'#HcO!-_QdO'#HbOOQS,5:Z,5:ZO!-gQdO,5:ZO!-lQdO'#HeO!-wQdO'#HeO!.[QdO,5>OOOQS'#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,5<jOOQS,5<j,5<jOOQS-E9|-E9|OOQS,5<r,5<rOOQS-E:U-E:UOOQV1G0x1G0xO1XQdO'#GRO!7dQtO,5>kOOQS1G1`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,5<k,5<kOOQS-E9}-E9}O!9wQdO1G.hOOQS1G0Z1G0ZO!:VQdO,5=wO!:gQdO,5=wO0rQdO1G0jO0rQdO1G0jO!:xQdO,5>jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!<RQdO,5>lO!<aQdO,5>lO!<oQdO,5>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,5<m,5<mOOQS-E:P-E:POOQS7+&z7+&zOOQS1G3]1G3]OOQS,5<^,5<^OOQS-E9p-E9pOOQS7+$s7+$sO#)bQdO,5=`O#){QdO,5=`O#*^QtO,5<aO#*qQdO1G3cOOQS-E9s-E9sOOQS7+&U7+&UO#+RQdO7+&UO#+aQdO,5<nO#+uQdO1G4UOOQS-E:Q-E:QO#,WQdO1G4UOOQS1G4T1G4TOOQS7+&W7+&WO#,iQdO7+&WOOQS,5<p,5<pO#,tQdO1G4WOOQS-E:S-E:SOOQS,5<l,5<lO#-SQdO1G4SOOQS-E:O-E:OO1XQdO'#EqO#-jQdO'#EqO#-uQdO'#IRO#-}QdO,5;[OOQS7+&`7+&`O0rQdO7+&`O#.SQgO7+&fO!JmQdO'#GXO4iQdO7+&fO4iQdO7+&iO#2QQtO,5<tO'vQdO,5<tO#2[QdO1G4ZOOQS-E:W-E:WO#2fQdO1G4ZO4iQdO7+&kO0rQdO7+&kOOQV7+&p7+&pO!KrQ!fO7+&rO!KzQdO7+&rO`QeO1G0{OOQV-E:X-E:XO4iQdO7+&lO4iQdO7+&lOOQV,5<u,5<uO#2nQdO,5<uO!JmQdO,5<uOOQV7+&l7+&lO#2yQgO7+&lO#6tQdO,5<vO#7PQdO1G4[OOQS-E:Y-E:YO#7^QdO1G4[O#7fQdO'#IWO#7tQdO'#IWO1XQdO'#IWOOQS'#IW'#IWO#8PQdO'#IVOOQS,5;n,5;nO#8XQdO,5;nO0rQdO'#FUOOQV7+&r7+&rO4iQdO7+&rOOQV7+&w7+&wO4iQdO7+&wO#8^QfO,5;xOOQV7+&|7+&|POOO7+(b7+(bO#8cQdO1G3iOOQS,5<c,5<cO#8qQdO1G3hOOQS-E9u-E9uO#9UQdO,5<dO#9aQdO,5<dO#9tQdO1G3kOOQS-E9v-E9vO#:UQdO1G3kO#:^QdO1G3kO#:nQdO1G3kO#:UQdO1G3kOOQS<<H[<<H[O#:yQtO1G1zOOQS<<Hk<<HkP#;WQdO'#FtO8vQdO1G3bO#;eQdO1G3bO#;jQdO<<HkOOQS<<Hl<<HlO#;zQdO7+)QOOQS<<Hs<<HsO#<[QtO1G1yP#<{QdO'#FsO#=YQdO7+)RO#=jQdO7+)RO#=rQdO<<HwO#=wQdO7+({OOQS<<Hy<<HyO#>nQdO,5<bO'vQdO,5<bOOQS-E9t-E9tOOQS<<Hw<<HwOOQS,5<g,5<gO0rQdO,5<gO#>sQdO1G4OOOQS-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<<IpO1XQdO1G2YP1XQdO'#GSO#AOQdO7+)pO#AaQdO7+)pOOQS<<Ir<<IrP1XQdO'#GUP0rQdO'#GQOOQS,5;],5;]O#ArQdO,5>mO#BQQdO,5>mOOQS1G0v1G0vOOQS<<Iz<<IzOOQV-E:V-E:VO4iQdO<<JQOOQV,5<s,5<sO4iQdO,5<sOOQV<<JQ<<JQOOQV<<JT<<JTO#BYQtO1G2`P#BdQdO'#GYO#BkQdO7+)uO#BuQgO<<JVO4iQdO<<JVOOQV<<J^<<J^O4iQdO<<J^O!KrQ!fO<<J^O#FpQgO7+&gOOQV<<JW<<JWO#FzQgO<<JWOOQV1G2a1G2aO1XQdO1G2aO#JuQdO1G2aO4iQdO<<JWO1XQdO1G2bP0rQdO'#G[O#KQQdO7+)vO#K_QdO7+)vOOQS'#FT'#FTO0rQdO,5>rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<<Jc<<JcO#LhQdO1G1dOOQS7+)T7+)TP#LmQdO'#FwO#L}QdO1G2OO#MbQdO1G2OO#MrQdO1G2OP#M}QdO'#FxO#N[QdO7+)VO#NlQdO7+)VO#NlQdO7+)VO#NtQdO7+)VO$ UQdO7+(|O8vQdO7+(|OOQSAN>VAN>VO$ oQdO<<LmOOQSAN>cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<<MT<<MTO$#nQdO7+(fOOQSAN?[AN?[OOQS7+'t7+'tO$$XQdO<<M[OOQS,5<q,5<qO$$jQdO1G4XOOQS-E:T-E:TOOQVAN?lAN?lOOQV1G2_1G2_O4iQdOAN?qO$$xQgOAN?qOOQVAN?xAN?xO4iQdOAN?xOOQV<<JR<<JRO4iQdOAN?rO4iQdO7+'{OOQV7+'{7+'{O1XQdO7+'{OOQVAN?rAN?rOOQS7+'|7+'|O$(sQdO<<MbOOQS1G4^1G4^O0rQdO1G4^OOQS,5<w,5<wO$)QQdO1G4]OOQS-E:Z-E:ZOOQU'#G_'#G_O$)cQfO7+'OO$)nQdO'#F_O$*uQdO7+'jO$+VQdO7+'jOOQS7+'j7+'jO$+bQdO<<LqO$+rQdO<<LqO$+rQdO<<LqO$+zQdO'#H^OOQS<<Lh<<LhO$,UQdO<<LhOOQS7+'h7+'hOOQS'#D|'#D|OOOO1G4R1G4RO$,oQdO1G4RO$,wQdO1G4RP!=hQdO'#GVOOQVG25]G25]O4iQdOG25]OOQVG25dG25dOOQVG25^G25^OOQV<<Kg<<KgO4iQdO<<KgOOQS7+)x7+)xP$-SQdO'#G]OOQU-E:]-E:]OOQV<<Jj<<JjO$-vQtO'#FaOOQS'#Fc'#FcO$.WQdO'#FbO$.xQdO'#FbOOQS'#Fb'#FbO$.}QdO'#IYO$)nQdO'#FiO$)nQdO'#FiO$/fQdO'#FjO$)nQdO'#FkO$/mQdO'#IZOOQS'#IZ'#IZO$0[QdO,5;yOOQS<<KU<<KUO$0dQdO<<KUO$0tQdOANB]O$1UQdOANB]O$1^QdO'#H_OOQS'#H_'#H_O1sQdO'#DcO$1wQdO,5=xOOQSANBSANBSOOOO7+)m7+)mO$2`QdO7+)mOOQVLD*wLD*wOOQVANARANARO5uQ!fO'#GaO$2hQtO,5<SO$)nQdO'#FmOOQS,5<W,5<WOOQS'#Fd'#FdO$3YQdO,5;|O$3_QdO,5;|OOQS'#Fg'#FgO$)nQdO'#G`O$4PQdO,5<QO$4kQdO,5>tO$4{QdO,5>tO1XQdO,5<PO$5^QdO,5<TO$5cQdO,5<TO$)nQdO'#I[O$5hQdO'#I[O$5mQdO,5<UOOQS,5<V,5<VO0rQdO'#FpOOQU1G1e1G1eO4iQdO1G1eOOQSAN@pAN@pO$5rQdOG27wO$6SQdO,59}OOQS1G3d1G3dOOOO<<MX<<MXOOQS,5<{,5<{OOQS-E:_-E:_O$6XQtO'#FaO$6`QdO'#I]O$6nQdO'#I]O$6vQdO,5<XOOQS1G1h1G1hO$6{QdO1G1hO$7QQdO,5<zOOQS-E:^-E:^O$7lQdO,5=OO$8TQdO1G4`OOQS-E:b-E:bOOQS1G1k1G1kOOQS1G1o1G1oO$8eQdO,5>vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5<YO$8sQdO,5>wO$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,5<ZP$)nQdO'#GcO$;XQdO1G2hO$)nQdO1G2hP$;gQdO'#GbO$;nQdO<<MhO$;xQdO1G1uO$<WQdO7+(SO8vQdO'#C}O8vQdO,59bO8vQdO,59bO8vQdO,59bO$<fQtO,5=`O8vQdO1G.|O0rQdO1G/XO0rQdO7+$pP$<yQdO'#GOO'vQdO'#GtO$=WQdO,59bO$=]QdO,59bO$=dQdO,59mO$=iQdO1G/UO1sQdO'#DRO8vQdO,59j",stateData:"$>S~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!;|!<S!<VP!<_!<h!=d!=g]eOn#g$j)t,P'}`OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0r{!cQ#c#p$R$d$p%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g}!dQ#c#p$R$d$p$u%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!P!eQ#c#p$R$d$p$u$v%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!R!fQ#c#p$R$d$p$u$v$w%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!T!gQ#c#p$R$d$p$u$v$w$x%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!V!hQ#c#p$R$d$p$u$v$w$x$y%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!Z!hQ!n#c#p$R$d$p$u$v$w$x$y$z%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g'}TOTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0r&eVOYZ[dnprxy}!P!Q!U!i!k!o!p!q!s!t#[#d#g#y#{#}$Q$h$j$}%S%Z%^%`%g%l%n%w%|&Z&_&j&k&u&x'P'W'Z'l'm'p'r's'w(O(W(^(d(g(p(r(z)^)e)g)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+U+V+Y+a+d+k,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0n0r%oXOYZ[dnrxy}!P!Q!U!i!k#[#d#g#y#{#}$Q$h$j$}%S%^%`%g%l%n%w%|&Z&_&j&k&u&x'P'W'Z'l'm'p'r's'w(O(W(^(d(g(p(r(z)^)e)g)p)t)z*O*Y*d*g*h*k*q*t*v*y*z*}+U+V+Y+a+d+k,P,X,Y,],g,h,i,k,l,o,s,u,w,y,z-O-d-f-m-p.f.g/V/Z0i0j0kQ#vqQ/[.kR0o0q't`OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0rh#jhz{$W$Z&l&q)S)X+f+g-RW#rq&].k0qQ$]|Q$a!OQ$n!VQ$o!WW$|!i'm*d,gS&[#s#tQ'S$iQ(s&UQ)U&nU)Y&s)Z+jW)a&w+m-T-{Q*Q']W*R'_,`-h.TQ+l)`S,_*S*TQ-Q+eQ-_,TQ-c,WQ.R-al.W-l.^._.a.z.|/R/j/o/t/y0U0Z0^Q/S.`Q/a.tQ/l/OU0P/u0S0[X0V/z0W0_0`R&Z#r!_!wYZ!P!Q!k%S%`%g'p'r's(O(W)g*g*h*k*q*t*v,h,i,k,l,o-m-p.f.g/ZR%^!vQ!{YQ%x#[Q&d#}Q&g$QR,{+YT.j-s/s!Y!jQ!n#c#p$R$d$p$u$v$w$x$y$z%e%j%p%q&`'O'g(q(|)j*o*x+w,v0gQ&X#kQ'c$oR*^'dR'l$|Q%V!mR/_.r'|_OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0rS#a_#b!P.[-l.^._.`.a.t.z.|/R/j/o/t/u/y/z0S0U0W0Z0[0^0_0`'|_OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0rT#a_#bT#^^#_R(o%xa(l%x(n(o+`,{-y-z.oT+[(k+]R-z,{Q$PsQ+l)aQ,^*RR-e,_X#}s$O$P&fQ&y$aQ'a$nQ'd$oR)s'SQ)b&wV-S+m-T-{ZgOn$j)t,PXkOn)t,PQ$k!TQ&z$bQ&{$cQ'^$mQ'b$oQ)q'RQ)x'WQ){'XQ)|'YQ*Z'`S*]'c'dQ+s)gQ+u)hQ+v)iQ+z)oS+|)r*[Q,Q)vQ,R)wS,S)y)zQ,d*^Q-V+rQ-W+tQ-Y+{S-Z+},OQ-`,UQ-b,VQ-|-XQ.O-[Q.P-^Q.Q-_Q.p-}Q.q.RQ/W.dR/r/XWkOn)t,PR#mjQ'`$nS)r'S'aR,O)sQ,]*RR-f,^Q*['`Q+})rR-[,OZiOjn)t,PQ'f$pR*`'gT-j,e-ku.c-l.^._.a.t.z.|/R/j/o/t/u/y0S0U0Z0[0^t.c-l.^._.a.t.z.|/R/j/o/t/u/y0S0U0Z0[0^Q/S.`X0V/z0W0_0`!P.Z-l.^._.`.a.t.z.|/R/j/o/t/u/y/z0S0U0W0Z0[0^0_0`Q.w.YR/f.xg.z.].{/b/i/n/|0O0Q0]0a0bu.b-l.^._.a.t.z.|/R/j/o/t/u/y0S0U0Z0[0^X.u.W.b/a0PR/c.tV0R/u0S0[R/X.dQnOS#on,PR,P)tQ&^#uR(x&^S%m#R#wS(_%m(bT(b%p&`Q%a!yQ%h!}W(P%a%h(U(YQ(U%eR(Y%jQ&i$RR)O&iQ(e%qQ*{(`T+R(e*{Q'n%OR*e'nS'q%R%SY*i'q*j,m-q.hU*j'r's'tU,m*k*l*mS-q,n,oR.h-rQ#Y]R%t#YQ#_^R%y#_Q(h%vS+W(h+XR+X(iQ+](kR,|+]Q#b_R%{#bQ#ebQ%}#cW&Q#e%}({+bQ({&cR+b0gQ$OsS&e$O&fR&f$PQ&v$_R)_&vQ&V#jR(t&VQ&m$VS)T&m+hR+h)UQ$Z{R&p$ZQ&t$]R)[&tQ+n)bR-U+nQ#hfR&S#hQ)f&zR+q)fQ&}$dS)m&})nR)n'OQ'V$kR)u'VQ'[$lS*P'[,ZR,Z*QQ,a*VR-i,aWjOn)t,PR#ljQ-k,eR.U-kd.{.]/b/i/n/|0O0Q0]0a0bR/h.{U.s.W/a0PR/`.sQ/{/nS0X/{0YR0Y/|S/v/b/cR0T/vQ.}.]R/k.}R!ZPXmOn)t,PWlOn)t,PR'T$jYfOn$j)t,PR&R#g[sOn#g$j)t,PR&d#}&dQOYZ[dnprxy}!P!Q!U!i!k!o!p!q!s!t#[#d#g#y#{#}$Q$h$j$}%S%Z%^%`%g%l%n%w%|&Z&_&j&k&u&x'P'W'Z'l'm'p'r's'w(O(W(^(d(g(p(r(z)^)e)g)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+U+V+Y+a+d+k,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0n0rQ!nTQ#caQ#poU$Rt%c(SS$d!R$gQ$p!XQ$u!cQ$v!dQ$w!eQ$x!fQ$y!gQ$z!hQ%e!zQ%j#OQ%p#SQ%q#TQ&`#xQ'O$eQ'g$qQ(q&OU(|&h(}+cW)j&|)l+x+yQ*o'|Q*x(]Q+w)kQ,v+QR0g0lQ!yYQ!}ZQ$b!PQ$c!QQ%R!kQ't%S^'{%`%g(O(W*q*t*v^*f'p*h,k,l-p.g/ZQ*l'rQ*m'sQ+t)gQ,j*gQ,n*kQ-n,hQ-o,iQ-r,oQ.e-mR/Y.f[bOn#g$j)t,P!^!vYZ!P!Q!k%S%`%g'p'r's(O(W)g*g*h*k*q*t*v,h,i,k,l,o-m-p.f.g/ZQ#R[Q#fdS#wrxQ$UyW$_}$Q'P)pS$l!U$hW${!i'm*d,gS%v#[+Y`&P#d%|(p(r(z+a-O0kQ&a#yQ&b#{Q&c#}Q'j$}Q'z%^W([%l(^*y*}Q(`%nQ(i%wQ(v&ZS(y&_0iQ)P&jQ)Q&kU)]&u)^+kQ)d&xQ)y'WY)}'Z*O,X,Y-dQ*b'lS*n'w0jW+P(d*z,s,wW+T(g+V,y,zQ+p)eQ,U)zQ,c*YQ,x+UQ-P+dQ-e,]Q-v,uQ.S-fR/q/VhUOn#d#g$j%|&_'w(p(r)t,P%U!uYZ[drxy}!P!Q!U!i!k#[#y#{#}$Q$h$}%S%^%`%g%l%n%w&Z&j&k&u&x'P'W'Z'l'm'p'r's(O(W(^(d(g(z)^)e)g)p)z*O*Y*d*g*h*k*q*t*v*y*z*}+U+V+Y+a+d+k,X,Y,],g,h,i,k,l,o,s,u,w,y,z-O-d-f-m-p.f.g/V/Z0i0j0kQ#qpW%W!o!s0d0nQ%X!pQ%Y!qQ%[!tQ%f0cS'v%Z0hQ'x0eQ'y0fQ,p*rQ-u,qS.i-s/sR0p0rU#uq.k0qR(w&][cOn#g$j)t,PZ!xY#[#}$Q+YQ#W[Q#zrR$TxQ%b!yQ%i!}Q%o#RQ'j${Q(V%eQ(Z%jQ(c%pQ(f%qQ*|(`Q,f*bQ-t,pQ.m-uR/].lQ$StQ(R%cR*s(SQ.l-sR/}/sR#QZR#V[R%Q!iQ%O!iV*c'm*d,g!Z!lQ!n#c#p$R$d$p$u$v$w$x$y$z%e%j%p%q&`'O'g(q(|)j*o*x+w,v0gR%T!kT#]^#_Q%x#[R,{+YQ(m%xS+_(n(oQ,}+`Q-x,{S.n-y-zR/^.oT+Z(k+]Q$`}Q&g$QQ)o'PR+{)pQ$XzQ)W&qR+i)XQ$XzQ&o$WQ)W&qR+i)XQ#khW$Vz$W&q)XQ$[{Q&r$ZZ)R&l)S+f+g-RR$^|R)c&wXlOn)t,PQ$f!RR'Q$gQ$m!UR'R$hR*X'_Q*V'_V-g,`-h.TQ.d-lQ/P.^R/Q._U.]-l.^._Q/U.aQ/b.tQ/g.zU/i.|/j/yQ/n/RQ/|/oQ0O/tU0Q/u0S0[Q0]0UQ0a0ZR0b0^R/T.`R/d.t",nodeNames:"⚠ print Escape { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard",maxTerm:277,context:Ade,nodeProps:[["isolate",-5,4,71,72,73,77,""],["group",-15,6,85,87,88,90,92,94,96,98,99,100,102,105,108,110,"Statement Statement",-22,8,18,21,25,40,49,50,56,57,60,61,62,63,64,67,70,71,72,79,80,81,82,"Expression",-10,114,116,119,121,122,126,128,133,135,138,"Statement",-9,143,144,147,148,150,151,152,153,154,"Pattern"],["openedBy",23,"(",54,"[",58,"{"],["closedBy",24,")",55,"]",59,"}"]],propSources:[Pde],skippedNodes:[0,4],repeatNodeCount:34,tokenData:"!2|~R!`OX%TXY%oY[%T[]%o]p%Tpq%oqr'ars)Yst*xtu%Tuv,dvw-hwx.Uxy/tyz0[z{0r{|2S|}2p}!O3W!O!P4_!P!Q:Z!Q!R;k!R![>_![!]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:[Rde,Ede,Tde,Dde,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Lde[t]||-1}],tokenPrec:7668}),NE=new tae,Kq=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function gx(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const Bde={FunctionDefinition:gx("function"),ClassDefinition:gx("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:gx("variable"),AsPattern:gx("variable"),__proto__:null};function Zq(t,e){let n=NE.get(e);if(n)return n;let r=[],s=!0;function i(a,l){let c=t.sliceString(a.from,a.to);r.push({label:c,type:l})}return e.cursor(Hr.IncludeAnonymous).iterate(a=>{if(a.name){let l=Bde[a.name];if(l&&l(a,i,s)||!s&&Kq.has(a.name))return!1;s=!1}else if(a.to-a.from>8192){for(let l of Zq(t,a.node))r.push(l);return!1}}),NE.set(e,r),r}const CE=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,Jq=["String","FormatString","Comment","PropertyName"];function qde(t){let e=es(t.state).resolveInner(t.pos,-1);if(Jq.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&CE.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)Kq.has(s.name)&&(r=r.concat(Zq(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:CE}}const Fde=["__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"}))),$de=[qo("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),qo("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),qo("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),qo("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),qo(`if \${}:
`,{label:"if",detail:"block",type:"keyword"}),qo("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),qo("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),qo("import ${module}",{label:"import",detail:"statement",type:"keyword"}),qo("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],Qde=Vle(Jq,Cq(Fde.concat($de)));function Lw(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 Iw(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.to<s+100&&!/\S/.test(t.state.sliceDoc(s,t.node.to))&&t.lineIndent(t.pos,-1)<=n||/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(t.textAfter)&&t.lineIndent(t.pos,-1)>n?null:n+t.unit}const Bw=Zm.define({name:"python",parser:Ide.configure({props:[Gv.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&Lw(t)||t.node;return(e=Iw(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=Lw(t);return(e=Iw(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":ww({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":ww({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":ww({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=Lw(t);return(e=n&&Iw(t,n))!==null&&e!==void 0?e:t.continue()}}),I6.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":yB,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 Hde(){return new gB(Bw,[Bw.data.of({autocomplete:qde}),Bw.data.of({autocomplete:Qde})])}const Vde=z6({String:ve.string,Number:ve.number,"True False":ve.bool,PropertyName:ve.propertyName,Null:ve.null,", :":ve.separator,"[ ]":ve.squareBracket,"{ }":ve.brace}),Ude=o0.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:[Vde],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}),Wde=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=Gde(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function Gde(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 Xde=Zm.define({name:"json",parser:Ude.configure({props:[Gv.add({Object:TT({except:/^\s*\}/}),Array:TT({except:/^\s*\]/})}),I6.add({"Object Array":yB})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Yde(){return new gB(Xde)}const Kde={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:"#"}}},Zde={python:[Hde()],json:[Yde(),Wde()],toml:[B6.define(Kde)],text:[]};function Jde({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:a,placeholder:l,theme:c="dark",className:h=""}){const[f,m]=b.useState(!1);if(b.useEffect(()=>{m(!0)},[]),!f)return o.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:a}});const g=[...Zde[n]||[],We.lineWrapping];return r&&g.push(We.editable.of(!1)),o.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:o.jsx(Qq,{value:t,height:s,minHeight:i,maxHeight:a,theme:c==="dark"?$q:void 0,extensions:g,onChange:e,placeholder:l,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 ehe(){const[t,e]=b.useState(!0),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState("visual"),[y,w]=b.useState(""),[S,k]=b.useState(!1),{toast:N}=Wr(),[C,T]=b.useState(null),[_,E]=b.useState(null),[M,q]=b.useState(null),[L,I]=b.useState(null),[$,V]=b.useState(null),[ee,z]=b.useState(null),[H,P]=b.useState(null),[W,J]=b.useState(null),[X,R]=b.useState(null),[se,G]=b.useState(null),[F,U]=b.useState(null),[te,ne]=b.useState(null),[Y,ae]=b.useState(null),[re,oe]=b.useState(null),[_e,Ge]=b.useState(null),[tt,Xe]=b.useState(null),[je,Qe]=b.useState(null),[He,$e]=b.useState(null),bt=b.useRef(null),ot=b.useRef(!0),on=b.useRef({}),Tn=b.useCallback(async()=>{try{const ie=await Qne();w(ie),k(!1)}catch(ie){N({variant:"destructive",title:"加载失败",description:ie instanceof Error?ie.message:"加载源代码失败"})}},[N]),Nn=b.useCallback(async()=>{try{e(!0);const ie=await g9();on.current=ie,T(ie.bot),E(ie.personality);const xe=ie.chat;xe.talk_value_rules||(xe.talk_value_rules=[]),q(xe),I(ie.expression),V(ie.emoji),z(ie.memory),P(ie.tool),J(ie.mood),R(ie.voice),G(ie.lpmm_knowledge),U(ie.keyword_reaction),ne(ie.response_post_process),ae(ie.chinese_typo),oe(ie.response_splitter),Ge(ie.log),Xe(ie.debug),Qe(ie.maim_message),$e(ie.telemetry),l(!1),ot.current=!1,await Tn()}catch(ie){console.error("加载配置失败:",ie),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[N,Tn]);b.useEffect(()=>{Nn()},[Nn]);const Rt=b.useCallback(async(ie,xe)=>{if(!ot.current)try{i(!0),await Vne(ie,xe),l(!1)}catch(Je){console.error(`自动保存 ${ie} 失败:`,Je),l(!0)}finally{i(!1)}},[]),xt=b.useCallback((ie,xe)=>{ot.current||(l(!0),bt.current&&clearTimeout(bt.current),bt.current=setTimeout(()=>{Rt(ie,xe)},2e3))},[Rt]);b.useEffect(()=>{C&&!ot.current&&xt("bot",C)},[C,xt]),b.useEffect(()=>{_&&!ot.current&&xt("personality",_)},[_,xt]),b.useEffect(()=>{M&&!ot.current&&xt("chat",M)},[M,xt]),b.useEffect(()=>{L&&!ot.current&&xt("expression",L)},[L,xt]),b.useEffect(()=>{$&&!ot.current&&xt("emoji",$)},[$,xt]),b.useEffect(()=>{ee&&!ot.current&&xt("memory",ee)},[ee,xt]),b.useEffect(()=>{H&&!ot.current&&xt("tool",H)},[H,xt]),b.useEffect(()=>{W&&!ot.current&&xt("mood",W)},[W,xt]),b.useEffect(()=>{X&&!ot.current&&xt("voice",X)},[X,xt]),b.useEffect(()=>{se&&!ot.current&&xt("lpmm_knowledge",se)},[se,xt]),b.useEffect(()=>{F&&!ot.current&&xt("keyword_reaction",F)},[F,xt]),b.useEffect(()=>{te&&!ot.current&&xt("response_post_process",te)},[te,xt]),b.useEffect(()=>{Y&&!ot.current&&xt("chinese_typo",Y)},[Y,xt]),b.useEffect(()=>{re&&!ot.current&&xt("response_splitter",re)},[re,xt]),b.useEffect(()=>{_e&&!ot.current&&xt("log",_e)},[_e,xt]),b.useEffect(()=>{tt&&!ot.current&&xt("debug",tt)},[tt,xt]),b.useEffect(()=>{je&&!ot.current&&xt("maim_message",je)},[je,xt]),b.useEffect(()=>{He&&!ot.current&&xt("telemetry",He)},[He,xt]);const Te=async()=>{try{r(!0),await Hne(y),l(!1),k(!1),N({title:"保存成功",description:"配置已保存"}),await Nn()}catch(ie){k(!0),N({variant:"destructive",title:"保存失败",description:ie instanceof Error?ie.message:"保存配置失败"})}finally{r(!1)}},Re=async ie=>{if(a){N({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(x(ie),ie==="source")await Tn();else try{const xe=await g9();on.current=xe,T(xe.bot),E(xe.personality);const Je=xe.chat;Je.talk_value_rules||(Je.talk_value_rules=[]),q(Je),I(xe.expression),V(xe.emoji),z(xe.memory),P(xe.tool),J(xe.mood),R(xe.voice),G(xe.lpmm_knowledge),U(xe.keyword_reaction),ne(xe.response_post_process),ae(xe.chinese_typo),oe(xe.response_splitter),Ge(xe.log),Xe(xe.debug),Qe(xe.maim_message),$e(xe.telemetry),l(!1)}catch(xe){console.error("加载配置失败:",xe),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},qe=async()=>{try{r(!0),bt.current&&clearTimeout(bt.current);const ie={...on.current,bot:C,personality:_,chat:M,expression:L,emoji:$,memory:ee,tool:H,mood:W,voice:X,lpmm_knowledge:se,keyword_reaction:F,response_post_process:te,chinese_typo:Y,response_splitter:re,log:_e,debug:tt,maim_message:je,telemetry:He};await x9(ie),l(!1),N({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(ie){console.error("保存配置失败:",ie),N({title:"保存失败",description:ie.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),Bv().catch(()=>{}),m(!0)}catch(ie){console.error("重启失败:",ie),m(!1),N({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},wt=async()=>{try{r(!0),bt.current&&clearTimeout(bt.current);const ie={...on.current,bot:C,personality:_,chat:M,expression:L,emoji:$,memory:ee,tool:H,mood:W,voice:X,lpmm_knowledge:se,keyword_reaction:F,response_post_process:te,chinese_typo:Y,response_splitter:re,log:_e,debug:tt,maim_message:je,telemetry:He};await x9(ie),l(!1),N({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(xe=>setTimeout(xe,500)),await rt()}catch(ie){console.error("保存失败:",ie),N({title:"保存失败",description:ie.message,variant:"destructive"})}finally{r(!1)}},jt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ne=()=>{m(!1),h(!1),N({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?o.jsx(kn,{className:"h-full",children:o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[o.jsx(ll,{value:g,onValueChange:ie=>Re(ie),className:"w-auto",children:o.jsxs(ro,{className:"h-9",children:[o.jsxs(Jt,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[o.jsx(kK,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),o.jsxs(Jt,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[o.jsx(OK,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),o.jsxs(me,{onClick:g==="visual"?qe:Te,disabled:n||s||!a||c,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[o.jsx(Tv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":a?"保存配置":"已保存"]}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs(me,{disabled:n||s||c,size:"sm",className:"flex-1 sm:flex-none",children:[o.jsx(Yk,{className:"mr-2 h-4 w-4"}),c?"重启中...":a?"保存并重启":"重启麦麦"]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认重启麦麦?"}),o.jsxs(fn,{className:"space-y-3",children:[o.jsx("p",{children:a?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(nl,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(wa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(rl,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})]})]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:a?wt:rt,children:a?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(nl,{children:[o.jsx(wa,{className:"h-4 w-4"}),o.jsxs(rl,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),g==="source"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs(nl,{children:[o.jsx(wa,{className:"h-4 w-4"}),o.jsxs(rl,{children:[o.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",S&&o.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),o.jsx(Jde,{value:y,onChange:ie=>{w(ie),l(!0),S&&k(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),g==="visual"&&o.jsx(o.Fragment,{children:o.jsxs(ll,{defaultValue:"bot",className:"w-full",children:[o.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:o.jsxs(ro,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[o.jsx(Jt,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),o.jsx(Jt,{value:"personality",className:"flex-shrink-0",children:"人格"}),o.jsx(Jt,{value:"chat",className:"flex-shrink-0",children:"聊天"}),o.jsx(Jt,{value:"expression",className:"flex-shrink-0",children:"表达"}),o.jsx(Jt,{value:"features",className:"flex-shrink-0",children:"功能"}),o.jsx(Jt,{value:"processing",className:"flex-shrink-0",children:"处理"}),o.jsx(Jt,{value:"mood",className:"flex-shrink-0",children:"情绪"}),o.jsx(Jt,{value:"voice",className:"flex-shrink-0",children:"语音"}),o.jsx(Jt,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),o.jsx(Jt,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),o.jsx(Pn,{value:"bot",className:"space-y-4",children:C&&o.jsx(the,{config:C,onChange:T})}),o.jsx(Pn,{value:"personality",className:"space-y-4",children:_&&o.jsx(nhe,{config:_,onChange:E})}),o.jsx(Pn,{value:"chat",className:"space-y-4",children:M&&o.jsx(rhe,{config:M,onChange:q})}),o.jsx(Pn,{value:"expression",className:"space-y-4",children:L&&o.jsx(she,{config:L,onChange:I})}),o.jsx(Pn,{value:"features",className:"space-y-4",children:$&&ee&&H&&o.jsx(ihe,{emojiConfig:$,memoryConfig:ee,toolConfig:H,onEmojiChange:V,onMemoryChange:z,onToolChange:P})}),o.jsx(Pn,{value:"processing",className:"space-y-4",children:F&&te&&Y&&re&&o.jsx(ahe,{keywordReactionConfig:F,responsePostProcessConfig:te,chineseTypoConfig:Y,responseSplitterConfig:re,onKeywordReactionChange:U,onResponsePostProcessChange:ne,onChineseTypoChange:ae,onResponseSplitterChange:oe})}),o.jsx(Pn,{value:"mood",className:"space-y-4",children:W&&o.jsx(ohe,{config:W,onChange:J})}),o.jsx(Pn,{value:"voice",className:"space-y-4",children:X&&o.jsx(lhe,{config:X,onChange:R})}),o.jsx(Pn,{value:"lpmm",className:"space-y-4",children:se&&o.jsx(che,{config:se,onChange:G})}),o.jsxs(Pn,{value:"other",className:"space-y-4",children:[_e&&o.jsx(uhe,{config:_e,onChange:Ge}),tt&&o.jsx(dhe,{config:tt,onChange:Xe}),je&&o.jsx(hhe,{config:je,onChange:Qe}),He&&o.jsx(fhe,{config:He,onChange:$e})]})]})}),f&&o.jsx(p6,{onRestartComplete:jt,onRestartFailed:Ne})]})})}function the({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=c=>{e({...t,platforms:t.platforms.filter((h,f)=>f!==c)})},s=(c,h)=>{const f=[...t.platforms];f[c]=h,e({...t,platforms:f})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},a=c=>{e({...t,alias_names:t.alias_names.filter((h,f)=>f!==c)})},l=(c,h)=>{const f=[...t.alias_names];f[c]=h,e({...t,alias_names:f})};return o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"platform",children:"平台"}),o.jsx(Pe,{id:"platform",value:t.platform,onChange:c=>e({...t,platform:c.target.value}),placeholder:"qq"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"qq_account",children:"QQ账号"}),o.jsx(Pe,{id:"qq_account",value:t.qq_account,onChange:c=>e({...t,qq_account:c.target.value}),placeholder:"123456789"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"nickname",children:"昵称"}),o.jsx(Pe,{id:"nickname",value:t.nickname,onChange:c=>e({...t,nickname:c.target.value}),placeholder:"麦麦"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{children:"其他平台账号"}),o.jsxs(me,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加"]})]}),o.jsxs("div",{className:"space-y-2",children:[t.platforms.map((c,h)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{value:c,onChange:f=>s(h,f.target.value),placeholder:"wx:114514"}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除平台账号 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{children:"别名"}),o.jsxs(me,{onClick:i,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加"]})]}),o.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((c,h)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{value:c,onChange:f=>l(h,f.target.value),placeholder:"小麦"}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除别名 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>a(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function nhe({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((a,l)=>l!==i)})},s=(i,a)=>{const l=[...t.states];l[i]=a,e({...t,states:l})};return o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"personality",children:"人格特质"}),o.jsx(nr,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征建议120字以内",rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内描述人格特质和身份特征"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"reply_style",children:"表达风格"}),o.jsx(nr,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"interest",children:"兴趣"}),o.jsx(nr,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"plan_style",children:"说话规则与行为风格"}),o.jsx(nr,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"visual_style",children:"识图规则"}),o.jsx(nr,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"private_plan_style",children:"私聊规则"}),o.jsx(nr,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{children:"状态列表(人格多样性)"}),o.jsxs(me,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),o.jsx("div",{className:"space-y-2",children:t.states.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(nr,{value:i,onChange:l=>s(a,l.target.value),placeholder:"描述一个人格状态",rows:2}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsx(fn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r(a),children:"删除"})]})]})]})]},a))})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"state_probability",children:"状态替换概率"}),o.jsx(Pe,{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)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率0.0-1.0"})]})]})]})})}function rhe({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=l=>{e({...t,talk_value_rules:t.talk_value_rules.filter((c,h)=>h!==l)})},s=(l,c,h)=>{const f=[...t.talk_value_rules];f[l]={...f[l],[c]:h},e({...t,talk_value_rules:f})},i=({value:l,onChange:c})=>{const[h,f]=b.useState("00"),[m,g]=b.useState("00"),[x,y]=b.useState("23"),[w,S]=b.useState("59");b.useEffect(()=>{const N=l.split("-");if(N.length===2){const[C,T]=N,[_,E]=C.split(":"),[M,q]=T.split(":");_&&f(_.padStart(2,"0")),E&&g(E.padStart(2,"0")),M&&y(M.padStart(2,"0")),q&&S(q.padStart(2,"0"))}},[l]);const k=(N,C,T,_)=>{const E=`${N}:${C}-${T}:${_}`;c(E)};return o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[o.jsx(Gd,{className:"h-4 w-4 mr-2"}),l||"选择时间段"]})}),o.jsx(so,{className:"w-80",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"小时"}),o.jsxs(Dt,{value:h,onValueChange:N=>{f(N),k(N,m,x,w)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:Array.from({length:24},(N,C)=>C).map(N=>o.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"分钟"}),o.jsxs(Dt,{value:m,onValueChange:N=>{g(N),k(h,N,x,w)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:Array.from({length:60},(N,C)=>C).map(N=>o.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"小时"}),o.jsxs(Dt,{value:x,onValueChange:N=>{y(N),k(h,m,N,w)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:Array.from({length:24},(N,C)=>C).map(N=>o.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"分钟"}),o.jsxs(Dt,{value:w,onValueChange:N=>{S(N),k(h,m,x,N)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:Array.from({length:60},(N,C)=>C).map(N=>o.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]})]})})]})},a=({rule:l})=>{const c=`{ target = "${l.target}", time = "${l.time}", value = ${l.value.toFixed(1)} }`;return o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(so,{className:"w-96",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:c}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),o.jsx(Pe,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:l=>e({...t,talk_value:parseFloat(l.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"mentioned_bot_reply",checked:t.mentioned_bot_reply,onCheckedChange:l=>e({...t,mentioned_bot_reply:l})}),o.jsx(de,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_context_size",children:"上下文长度"}),o.jsx(Pe,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:l=>e({...t,max_context_size:parseInt(l.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"planner_smooth",children:"规划器平滑"}),o.jsx(Pe,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:l=>e({...t,planner_smooth:parseFloat(l.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-50 为关闭"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:l=>e({...t,enable_talk_value_rules:l})}),o.jsx(de,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:l=>e({...t,include_planner_reasoning:l})}),o.jsx(de,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&o.jsxs("div",{className:"border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率优先匹配具体聊天再匹配全局规则"})]}),o.jsxs(me,{onClick:n,size:"sm",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?o.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((l,c)=>o.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",c+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(a,{rule:l}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"sm",children:o.jsx(sn,{className:"h-4 w-4 text-destructive"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除规则 #",c+1," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r(c),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"配置类型"}),o.jsxs(Dt,{value:l.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(c,"target",""):s(c,"target","qq::group")},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"global",children:"全局配置"}),o.jsx(ze,{value:"specific",children:"详细配置"})]})]})]}),l.target!==""&&(()=>{const h=l.target.split(":"),f=h[0]||"qq",m=h[1]||"",g=h[2]||"group";return o.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"平台"}),o.jsxs(Dt,{value:f,onValueChange:x=>{s(c,"target",`${x}:${m}:${g}`)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"qq",children:"QQ"}),o.jsx(ze,{value:"wx",children:"微信"})]})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"群 ID"}),o.jsx(Pe,{value:m,onChange:x=>{s(c,"target",`${f}:${x.target.value}:${g}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"类型"}),o.jsxs(Dt,{value:g,onValueChange:x=>{s(c,"target",`${f}:${m}:${x}`)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"group",children:"群组group"}),o.jsx(ze,{value:"private",children:"私聊private"})]})]})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID",l.target||"(未设置)"]})]})})(),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"时间段 (Time)"}),o.jsx(i,{value:l.time,onChange:h=>s(c,"time",h)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{htmlFor:`rule-value-${c}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),o.jsx(Pe,{id:`rule-value-${c}`,type:"number",step:"0.01",min:"0",max:"1",value:l.value,onChange:h=>{const f=parseFloat(h.target.value);isNaN(f)||s(c,"value",Math.max(0,Math.min(1,f)))},className:"w-20 h-8 text-xs"})]}),o.jsx(B0,{value:[l.value],onValueChange:h=>s(c,"value",h[0]),min:0,max:1,step:.01,className:"w-full"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"0 (完全沉默)"}),o.jsx("span",{children:"0.5"}),o.jsx("span",{children:"1.0 (正常)"})]})]})]})]},c))}):o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:o.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),o.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:[o.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),o.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[o.jsxs("li",{children:["• ",o.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"Target 指定"}),"仅对特定聊天流生效格式platform:id:type"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"数值范围"}),":建议 0-10 表示完全沉默1 表示正常发言"]})]})]})]})]})}function she({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 o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(so,{className:"w-96",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:x}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},a=({member:g,groupIndex:x,memberIndex:y,availableChatIds:w})=>{const S=w.includes(g)||g==="*",[k,N]=b.useState(!S);return o.jsxs("div",{className:"flex gap-2",children:[o.jsx("div",{className:"flex-1 flex gap-2",children:k?o.jsxs(o.Fragment,{children:[o.jsx(Pe,{value:g,onChange:C=>m(x,y,C.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),w.length>0&&o.jsx(me,{size:"sm",variant:"outline",onClick:()=>N(!1),title:"切换到下拉选择",children:"下拉"})]}):o.jsxs(o.Fragment,{children:[o.jsxs(Dt,{value:g,onValueChange:C=>m(x,y,C),children:[o.jsx(Mt,{className:"flex-1",children:o.jsx(zt,{placeholder:"选择聊天流"})}),o.jsxs(At,{children:[o.jsx(ze,{value:"*",children:"* (全局共享)"}),w.map((C,T)=>o.jsx(ze,{value:C,children:C},T))]})]}),o.jsx(me,{size:"sm",variant:"outline",onClick:()=>N(!0),title:"切换到手动输入",children:"输入"})]})}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除组成员 "',g||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>f(x,y),children:"删除"})]})]})]})]})},l=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},c=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,S)=>S!==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 o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),o.jsxs(me,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),o.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((g,x)=>{const y=t.learning_list.some((T,_)=>_!==x&&T[0]===""),w=g[0]==="",S=g[0].split(":"),k=S[0]||"qq",N=S[1]||"",C=S[2]||"group";return o.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["规则 ",x+1," ",w&&"(全局配置)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(i,{rule:g}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"sm",variant:"ghost",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除学习规则 ",x+1," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r(x),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"配置类型"}),o.jsxs(Dt,{value:w?"global":"specific",onValueChange:T=>{T==="global"?s(x,0,""):s(x,0,"qq::group")},disabled:y&&!w,children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"global",children:"全局配置"}),o.jsx(ze,{value:"specific",disabled:y&&!w,children:"详细配置"})]})]}),y&&!w&&o.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!w&&o.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"平台"}),o.jsxs(Dt,{value:k,onValueChange:T=>{s(x,0,`${T}:${N}:${C}`)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"qq",children:"QQ"}),o.jsx(ze,{value:"wx",children:"微信"})]})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"群 ID"}),o.jsx(Pe,{value:N,onChange:T=>{s(x,0,`${k}:${T.target.value}:${C}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"类型"}),o.jsxs(Dt,{value:C,onValueChange:T=>{s(x,0,`${k}:${N}:${T}`)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"group",children:"群组group"}),o.jsx(ze,{value:"private",children:"私聊private"})]})]})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID",g[0]||"(未设置)"]})]}),o.jsx("div",{className:"grid gap-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs font-medium",children:"使用学到的表达"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),o.jsx(Tt,{checked:g[1]==="enable",onCheckedChange:T=>s(x,1,T?"enable":"disable")})]})}),o.jsx("div",{className:"grid gap-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs font-medium",children:"学习表达"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),o.jsx(Tt,{checked:g[2]==="enable",onCheckedChange:T=>s(x,2,T?"enable":"disable")})]})}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{className:"text-xs font-medium",children:"学习强度"}),o.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"5",value:g[3],onChange:T=>{const _=parseFloat(T.target.value);isNaN(_)||s(x,3,Math.max(0,Math.min(5,_)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),o.jsx(B0,{value:[parseFloat(g[3])||1],onValueChange:T=>s(x,3,T[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"0 (不学习)"}),o.jsx("span",{children:"2.5"}),o.jsx("span",{children:"5.0 (快速学习)"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},x)}),t.learning_list.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),o.jsxs(me,{onClick:l,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),o.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 o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",x+1,g.length===1&&g[0]==="*"&&"(全局共享)"]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(me,{onClick:()=>h(x),size:"sm",variant:"outline",children:o.jsx(ms,{className:"h-4 w-4"})}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"sm",variant:"ghost",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除共享组 ",x+1," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>c(x),children:"删除"})]})]})]})]})]}),o.jsx("div",{className:"space-y-2",children:g.map((w,S)=>o.jsx(a,{member:w,groupIndex:x,memberIndex:S,availableChatIds:y},S))}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},x)}),t.expression_groups.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function ihe({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:a=>i({...n,enable_tool:a})}),o.jsx(de,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),o.jsx(Pe,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:a=>s({...e,max_agent_iterations:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1不深入思考"})]})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"emoji_chance",children:"表情包激活概率"}),o.jsx(Pe,{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)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1越大越容易发送表情包"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_reg_num",children:"最大注册数量"}),o.jsx(Pe,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:a=>r({...t,max_reg_num:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),o.jsx(Pe,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:a=>r({...t,check_interval:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"do_replace",checked:t.do_replace,onCheckedChange:a=>r({...t,do_replace:a})}),o.jsx(de,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:a=>r({...t,steal_emoji:a})}),o.jsx(de,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),o.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:a=>r({...t,content_filtration:a})}),o.jsx(de,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&o.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[o.jsx(de,{htmlFor:"filtration_prompt",children:"过滤要求"}),o.jsx(Pe,{id:"filtration_prompt",value:t.filtration_prompt,onChange:a=>r({...t,filtration_prompt:a.target.value}),placeholder:"符合公序良俗"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function ahe({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:a,onResponseSplitterChange:l}){const c=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=T=>{s({...t,regex_rules:t.regex_rules.filter((_,E)=>E!==T)})},f=(T,_,E)=>{const M=[...t.regex_rules];_==="regex"&&typeof E=="string"?M[T]={...M[T],regex:[E]}:_==="reaction"&&typeof E=="string"&&(M[T]={...M[T],reaction:E}),s({...t,regex_rules:M})},m=({regex:T,reaction:_,onRegexChange:E,onReactionChange:M})=>{const[q,L]=b.useState(!1),[I,$]=b.useState(""),[V,ee]=b.useState(null),[z,H]=b.useState(""),[P,W]=b.useState({}),[J,X]=b.useState(""),R=b.useRef(null),[se,G]=b.useState("build"),F=Y=>Y.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),U=(Y,ae=0)=>{const re=R.current;if(!re)return;const oe=re.selectionStart||0,_e=re.selectionEnd||0,Ge=T.substring(0,oe)+Y+T.substring(_e);E(Ge),setTimeout(()=>{const tt=oe+Y.length+ae;re.setSelectionRange(tt,tt),re.focus()},0)};b.useEffect(()=>{if(!T||!I){ee(null),W({}),X(_),H("");return}try{const Y=F(T),ae=new RegExp(Y,"g"),re=I.match(ae);ee(re),H("");const _e=new RegExp(Y).exec(I);if(_e&&_e.groups){W(_e.groups);let Ge=_;Object.entries(_e.groups).forEach(([tt,Xe])=>{Ge=Ge.replace(new RegExp(`\\[${tt}\\]`,"g"),Xe||"")}),X(Ge)}else W({}),X(_)}catch(Y){H(Y.message),ee(null),W({}),X(_)}},[T,I,_]);const te=()=>{if(!I||!V||V.length===0)return o.jsx("span",{className:"text-muted-foreground",children:I||"请输入测试文本"});try{const Y=F(T),ae=new RegExp(Y,"g");let re=0;const oe=[];let _e;for(;(_e=ae.exec(I))!==null;)_e.index>re&&oe.push(o.jsx("span",{children:I.substring(re,_e.index)},`text-${re}`)),oe.push(o.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:_e[0]},`match-${_e.index}`)),re=_e.index+_e[0].length;return re<I.length&&oe.push(o.jsx("span",{children:I.substring(re)},`text-${re}`)),o.jsx(o.Fragment,{children:oe})}catch{return o.jsx("span",{children:I})}},ne=[{category:"基础匹配",items:[{label:"任意字符",pattern:".",desc:"匹配除换行符外的任意字符"},{label:"数字",pattern:"\\d",desc:"匹配 0-9"},{label:"非数字",pattern:"\\D",desc:"匹配非数字字符"},{label:"字母数字",pattern:"\\w",desc:"匹配字母、数字、下划线"},{label:"非字母数字",pattern:"\\W",desc:"匹配非字母数字字符"},{label:"空白符",pattern:"\\s",desc:"匹配空格、制表符等"},{label:"非空白符",pattern:"\\S",desc:"匹配非空白字符"}]},{category:"位置锚点",items:[{label:"行首",pattern:"^",desc:"匹配行的开始"},{label:"行尾",pattern:"$",desc:"匹配行的结束"},{label:"单词边界",pattern:"\\b",desc:"匹配单词边界"}]},{category:"重复次数",items:[{label:"0或多次",pattern:"*",desc:"匹配前面的元素0次或多次"},{label:"1或多次",pattern:"+",desc:"匹配前面的元素1次或多次"},{label:"0或1次",pattern:"?",desc:"匹配前面的元素0次或1次"},{label:"指定次数",pattern:"{n}",desc:"匹配n次将n替换为数字"},{label:"次数范围",pattern:"{m,n}",desc:"匹配m到n次"}]},{category:"分组和捕获",items:[{label:"普通分组",pattern:"()",desc:"分组但不捕获",moveCursor:-1},{label:"命名捕获",pattern:"(?P<name>)",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<word>\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P<sentence>.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P<num>\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return o.jsxs(zr,{open:q,onOpenChange:L,children:[o.jsx(h6,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(S1,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"正则表达式编辑器"}),o.jsx(ps,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),o.jsx(kn,{className:"max-h-[calc(90vh-120px)]",children:o.jsxs(ll,{value:se,onValueChange:Y=>G(Y),className:"w-full",children:[o.jsxs(ro,{className:"grid w-full grid-cols-2",children:[o.jsx(Jt,{value:"build",children:"🔧 构建器"}),o.jsx(Jt,{value:"test",children:"🧪 测试器"})]}),o.jsxs(Pn,{value:"build",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"正则表达式"}),o.jsx(Pe,{ref:R,value:T,onChange:Y=>E(Y.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"Reaction 内容"}),o.jsx(nr,{value:_,onChange:Y=>M(Y.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),o.jsxs("div",{className:"space-y-4 border-t pt-4",children:[ne.map(Y=>o.jsxs("div",{className:"space-y-2",children:[o.jsx("h5",{className:"text-xs font-semibold text-primary",children:Y.category}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:Y.items.map(ae=>o.jsx(me,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>U(ae.pattern,ae.moveCursor||0),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[o.jsx("span",{className:"text-xs font-medium",children:ae.label}),o.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:ae.pattern})]}),o.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:ae.desc})]})},ae.label))})]},Y.category)),o.jsxs("div",{className:"space-y-2 border-t pt-4",children:[o.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(me,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P<n>\\S{1,20})是这样的$"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P<n>\\S","{1,20}",")是这样的$"]}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),o.jsx(me,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+\\s*)?我(?:也)?[没沒]要求你\\s*(?P<action>.+?)[.。,]?$"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+\\s*)?我(?:也)?[没沒]要求你\\s*(?P<action>.+?)[.。,]?$"}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),o.jsx(me,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P<subject>.+?)(?:是|为什么|怎么)"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P<subject>.+?)(?:是|为什么|怎么)"}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),o.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:[o.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),o.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),o.jsxs("li",{children:["命名捕获组格式:",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),o.jsxs("li",{children:["在 reaction 中使用 ",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),o.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),o.jsxs(Pn,{value:"test",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"当前正则表达式"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:T||"(未设置)"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),o.jsx(nr,{id:"test-text",value:I,onChange:Y=>$(Y.target.value),placeholder:`在此输入要测试的文本...
例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),z&&o.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[o.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),o.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:z})]}),!z&&I&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),o.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"匹配高亮"}),o.jsx(kn,{className:"h-40 rounded-md bg-muted p-3",children:o.jsx("div",{className:"text-sm break-words",children:te()})})]}),Object.keys(P).length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"命名捕获组"}),o.jsx(kn,{className:"h-32 rounded-md border p-3",children:o.jsx("div",{className:"space-y-2",children:Object.entries(P).map(([Y,ae])=>o.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[o.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",Y,"]"]}),o.jsx("span",{className:"text-muted-foreground",children:"="}),o.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:ae})]},Y))})})]}),Object.keys(P).length>0&&_&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"Reaction 替换预览"}),o.jsx(kn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:o.jsx("div",{className:"text-sm break-words",children:J})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),o.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:[o.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),o.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),o.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),o.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),o.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},g=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},x=T=>{s({...t,keyword_rules:t.keyword_rules.filter((_,E)=>E!==T)})},y=(T,_,E)=>{const M=[...t.keyword_rules];typeof E=="string"&&(M[T]={...M[T],reaction:E}),s({...t,keyword_rules:M})},w=T=>{const _=[...t.keyword_rules];_[T]={..._[T],keywords:[..._[T].keywords||[],""]},s({...t,keyword_rules:_})},S=(T,_)=>{const E=[...t.keyword_rules];E[T]={...E[T],keywords:(E[T].keywords||[]).filter((M,q)=>q!==_)},s({...t,keyword_rules:E})},k=(T,_,E)=>{const M=[...t.keyword_rules],q=[...M[T].keywords||[]];q[_]=E,M[T]={...M[T],keywords:q},s({...t,keyword_rules:M})},N=({rule:T})=>{const _=`{ regex = [${(T.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${T.reaction}" }`;return o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(so,{className:"w-[95vw] sm:w-[500px]",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx(kn,{className:"h-60 rounded-md bg-muted p-3",children:o.jsx("pre",{className:"font-mono text-xs break-all",children:_})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},C=({rule:T})=>{const _=`[[keyword_reaction.keyword_rules]]
keywords = [${(T.keywords||[]).map(E=>`"${E}"`).join(", ")}]
reaction = "${T.reaction}"`;return o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(so,{className:"w-[95vw] sm:w-[500px]",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx(kn,{className:"h-60 rounded-md bg-muted p-3",children:o.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:_})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),o.jsxs(me,{onClick:c,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),o.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((T,_)=>o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",_+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(m,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:E=>f(_,"regex",E),onReactionChange:E=>f(_,"reaction",E)}),o.jsx(N,{rule:T}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"sm",variant:"ghost",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除正则规则 ",_+1," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>h(_),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"正则表达式Python 语法)"}),o.jsx(Pe,{value:T.regex&&T.regex[0]||"",onChange:E=>f(_,"regex",E.target.value),placeholder:"例如:^(?P<n>\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?P<name>pattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"反应内容"}),o.jsx(nr,{value:T.reaction,onChange:E=>f(_,"reaction",E.target.value),placeholder:`触发后麦麦的反应...
可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},_)),t.regex_rules.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),o.jsxs("div",{className:"space-y-4 border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),o.jsxs(me,{onClick:g,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),o.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((T,_)=>o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",_+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(C,{rule:T}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"sm",variant:"ghost",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除关键词规则 ",_+1," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>x(_),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{className:"text-xs font-medium",children:"关键词列表"}),o.jsxs(me,{onClick:()=>w(_),size:"sm",variant:"ghost",children:[o.jsx(ms,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),o.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((E,M)=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{value:E,onChange:q=>k(_,M,q.target.value),placeholder:"关键词",className:"flex-1"}),o.jsx(me,{onClick:()=>S(_,M),size:"sm",variant:"ghost",children:o.jsx(sn,{className:"h-4 w-4"})})]},M)),(!T.keywords||T.keywords.length===0)&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"反应内容"}),o.jsx(nr,{value:T.reaction,onChange:E=>y(_,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},_)),t.keyword_rules.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:T=>i({...e,enable_response_post_process:T})}),o.jsx(de,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t pt-6 space-y-4",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[o.jsx(Tt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:T=>a({...n,enable:T})}),o.jsx(de,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&o.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),o.jsx(Pe,{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)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),o.jsx(Pe,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:T=>a({...n,min_freq:parseInt(T.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),o.jsx(Pe,{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)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),o.jsx(Pe,{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)})})]})]})]})}),o.jsx("div",{className:"border-t pt-6 space-y-4",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[o.jsx(Tt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:T=>l({...r,enable:T})}),o.jsx(de,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&o.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),o.jsx(Pe,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:T=>l({...r,max_length:parseInt(T.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),o.jsx(Pe,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:T=>l({...r,max_sentence_num:parseInt(T.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:T=>l({...r,enable_kaomoji_protection:T})}),o.jsx(de,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:T=>l({...r,enable_overflow_return_all:T})}),o.jsx(de,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),o.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function ohe({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),o.jsx(de,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"情绪更新阈值"}),o.jsx(Pe,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"情感特征"}),o.jsx(nr,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function lhe({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),o.jsx(de,{className:"cursor-pointer",children:"启用语音识别"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function che({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),o.jsx(de,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"LPMM 模式"}),o.jsxs(Dt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[o.jsx(Mt,{children:o.jsx(zt,{placeholder:"选择 LPMM 模式"})}),o.jsxs(At,{children:[o.jsx(ze,{value:"classic",children:"经典模式"}),o.jsx(ze,{value:"agent",children:"Agent 模式"})]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"同义词搜索 TopK"}),o.jsx(Pe,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"同义词阈值"}),o.jsx(Pe,{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)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"实体提取线程数"}),o.jsx(Pe,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"嵌入向量维度"}),o.jsx(Pe,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function uhe({config:t,onChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState("WARNING"),a=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},l=x=>{e({...t,suppress_libraries:t.suppress_libraries.filter(y=>y!==x)})},c=()=>{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 o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"日期格式"}),o.jsx(Pe,{value:t.date_style,onChange:x=>e({...t,date_style:x.target.value}),placeholder:"例如: m-d H:i:s"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"日志级别样式"}),o.jsxs(Dt,{value:t.log_level_style,onValueChange:x=>e({...t,log_level_style:x}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:m.map(x=>o.jsx(ze,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"日志文本颜色"}),o.jsxs(Dt,{value:t.color_text,onValueChange:x=>e({...t,color_text:x}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:g.map(x=>o.jsx(ze,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"全局日志级别"}),o.jsxs(Dt,{value:t.log_level,onValueChange:x=>e({...t,log_level:x}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:f.map(x=>o.jsx(ze,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"控制台日志级别"}),o.jsxs(Dt,{value:t.console_log_level,onValueChange:x=>e({...t,console_log_level:x}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:f.map(x=>o.jsx(ze,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"文件日志级别"}),o.jsxs(Dt,{value:t.file_log_level,onValueChange:x=>e({...t,file_log_level:x}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:f.map(x=>o.jsx(ze,{value:x,children:x},x))})]})]})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"mb-2 block",children:"完全屏蔽的库"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),a())}}),o.jsx(me,{onClick:a,size:"sm",className:"flex-shrink-0",children:o.jsx(ms,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(x=>o.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[o.jsx("span",{className:"text-sm",children:x}),o.jsx(me,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>l(x),children:o.jsx(sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},x))})]}),o.jsxs("div",{children:[o.jsx(de,{className:"mb-2 block",children:"特定库的日志级别"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1"}),o.jsxs(Dt,{value:s,onValueChange:i,children:[o.jsx(Mt,{className:"w-32",children:o.jsx(zt,{})}),o.jsx(At,{children:f.map(x=>o.jsx(ze,{value:x,children:x},x))})]}),o.jsx(me,{onClick:c,size:"sm",children:o.jsx(ms,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([x,y])=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[o.jsx("span",{className:"text-sm font-medium",children:x}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:y}),o.jsx(me,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(x),children:o.jsx(sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},x))})]})]})}function dhe({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),o.jsx(Tt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示回复器 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),o.jsx(Tt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示回复器推理"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),o.jsx(Tt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示 Jargon Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),o.jsx(Tt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示记忆检索 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),o.jsx(Tt,{checked:t.show_memory_prompt,onCheckedChange:n=>e({...t,show_memory_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示 Planner Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),o.jsx(Tt,{checked:t.show_planner_prompt,onCheckedChange:n=>e({...t,show_planner_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示 LPMM 相关文段"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),o.jsx(Tt,{checked:t.show_lpmm_paragraph,onCheckedChange:n=>e({...t,show_lpmm_paragraph:n})})]})]})]})}function hhe({config:t,onChange:e}){const[n,r]=b.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((l,c)=>c!==a)})};return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"启用自定义服务器"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),o.jsx(Tt,{checked:t.use_custom,onCheckedChange:a=>e({...t,use_custom:a})})]}),t.use_custom&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"主机地址"}),o.jsx(Pe,{value:t.host,onChange:a=>e({...t,host:a.target.value}),placeholder:"127.0.0.1"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"端口号"}),o.jsx(Pe,{type:"number",value:t.port,onChange:a=>e({...t,port:parseInt(a.target.value)}),placeholder:"8090"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"连接模式"}),o.jsxs(Dt,{value:t.mode,onValueChange:a=>e({...t,mode:a}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"ws",children:"WebSocket (ws)"}),o.jsx(ze,{value:"tcp",children:"TCP"})]})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{checked:t.use_wss,onCheckedChange:a=>e({...t,use_wss:a}),disabled:t.mode!=="ws"}),o.jsx(de,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"SSL 证书文件路径"}),o.jsx(Pe,{value:t.cert_file,onChange:a=>e({...t,cert_file:a.target.value}),placeholder:"cert.pem"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"SSL 密钥文件路径"}),o.jsx(Pe,{value:t.key_file,onChange:a=>e({...t,key_file:a.target.value}),placeholder:"key.pem"})]})]})]})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"mb-2 block",children:"认证令牌"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(Pe,{value:n,onChange:a=>r(a.target.value),placeholder:"输入认证令牌",onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),s())}}),o.jsx(me,{onClick:s,size:"sm",children:o.jsx(ms,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"space-y-2",children:t.auth_token.map((a,l)=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[o.jsx("span",{className:"text-sm font-mono",children:a}),o.jsx(me,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(l),children:o.jsx(sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},l))})]})]})}function fhe({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"启用统计信息发送"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),o.jsx(Tt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Qh=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{className:"relative w-full overflow-auto",children:o.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Qh.displayName="Table";const Hh=b.forwardRef(({className:t,...e},n)=>o.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Hh.displayName="TableHeader";const Vh=b.forwardRef(({className:t,...e},n)=>o.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));Vh.displayName="TableBody";const mhe=b.forwardRef(({className:t,...e},n)=>o.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));mhe.displayName="TableFooter";const fs=b.forwardRef(({className:t,...e},n)=>o.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));fs.displayName="TableRow";const en=b.forwardRef(({className:t,...e},n)=>o.jsx("th",{ref:n,className:ye("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}));en.displayName="TableHead";const Lt=b.forwardRef(({className:t,...e},n)=>o.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));Lt.displayName="TableCell";const phe=b.forwardRef(({className:t,...e},n)=>o.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));phe.displayName="TableCaption";var TE=1,ghe=.9,xhe=.8,vhe=.17,qw=.1,Fw=.999,yhe=.9999,bhe=.99,whe=/[\\\/_+.#"@\[\(\{&]/,She=/[\\\/_+.#"@\[\(\{&]/g,khe=/[\s-]/,eF=/[\s-]/g;function LS(t,e,n,r,s,i,a){if(i===e.length)return s===t.length?TE:bhe;var l=`${s},${i}`;if(a[l]!==void 0)return a[l];for(var c=r.charAt(i),h=n.indexOf(c,s),f=0,m,g,x,y;h>=0;)m=LS(t,e,n,r,h+1,i+1,a),m>f&&(h===s?m*=TE:whe.test(t.charAt(h-1))?(m*=xhe,x=t.slice(s,h-1).match(She),x&&s>0&&(m*=Math.pow(Fw,x.length))):khe.test(t.charAt(h-1))?(m*=ghe,y=t.slice(s,h-1).match(eF),y&&s>0&&(m*=Math.pow(Fw,y.length))):(m*=vhe,s>0&&(m*=Math.pow(Fw,h-s))),t.charAt(h)!==e.charAt(i)&&(m*=yhe)),(m<qw&&n.charAt(h-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(h-1)!==r.charAt(i))&&(g=LS(t,e,n,r,h+1,i+2,a),g*qw>m&&(m=g*qw)),m>f&&(f=m),h=n.indexOf(c,h+1);return a[l]=f,f}function EE(t){return t.toLowerCase().replace(eF," ")}function Ohe(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,LS(t,e,EE(t),EE(e),0,0,{})}var jhe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ac=jhe.reduce((t,e)=>{const n=qk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),tm='[cmdk-group=""]',$w='[cmdk-group-items=""]',Nhe='[cmdk-group-heading=""]',tF='[cmdk-item=""]',_E=`${tF}:not([aria-disabled="true"])`,IS="cmdk-item-select",Bd="data-value",Che=(t,e,n)=>Ohe(t,e,n),nF=b.createContext(void 0),J0=()=>b.useContext(nF),rF=b.createContext(void 0),iO=()=>b.useContext(rF),sF=b.createContext(void 0),iF=b.forwardRef((t,e)=>{let n=qd(()=>{var G,F;return{search:"",value:(F=(G=t.value)!=null?G:t.defaultValue)!=null?F:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=qd(()=>new Set),s=qd(()=>new Map),i=qd(()=>new Map),a=qd(()=>new Set),l=aF(t),{label:c,children:h,value:f,onValueChange:m,filter:g,shouldFilter:x,loop:y,disablePointerSelection:w=!1,vimBindings:S=!0,...k}=t,N=ea(),C=ea(),T=ea(),_=b.useRef(null),E=Ihe();Ru(()=>{if(f!==void 0){let G=f.trim();n.current.value=G,M.emit()}},[f]),Ru(()=>{E(6,ee)},[]);let M=b.useMemo(()=>({subscribe:G=>(a.current.add(G),()=>a.current.delete(G)),snapshot:()=>n.current,setState:(G,F,U)=>{var te,ne,Y,ae;if(!Object.is(n.current[G],F)){if(n.current[G]=F,G==="search")V(),I(),E(1,$);else if(G==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(T);re?re.focus():(te=document.getElementById(N))==null||te.focus()}if(E(7,()=>{var re;n.current.selectedItemId=(re=z())==null?void 0:re.id,M.emit()}),U||E(5,ee),((ne=l.current)==null?void 0:ne.value)!==void 0){let re=F??"";(ae=(Y=l.current).onValueChange)==null||ae.call(Y,re);return}}M.emit()}},emit:()=>{a.current.forEach(G=>G())}}),[]),q=b.useMemo(()=>({value:(G,F,U)=>{var te;F!==((te=i.current.get(G))==null?void 0:te.value)&&(i.current.set(G,{value:F,keywords:U}),n.current.filtered.items.set(G,L(F,U)),E(2,()=>{I(),M.emit()}))},item:(G,F)=>(r.current.add(G),F&&(s.current.has(F)?s.current.get(F).add(G):s.current.set(F,new Set([G]))),E(3,()=>{V(),I(),n.current.value||$(),M.emit()}),()=>{i.current.delete(G),r.current.delete(G),n.current.filtered.items.delete(G);let U=z();E(4,()=>{V(),U?.getAttribute("id")===G&&$(),M.emit()})}),group:G=>(s.current.has(G)||s.current.set(G,new Set),()=>{i.current.delete(G),s.current.delete(G)}),filter:()=>l.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:N,inputId:T,labelId:C,listInnerRef:_}),[]);function L(G,F){var U,te;let ne=(te=(U=l.current)==null?void 0:U.filter)!=null?te:Che;return G?ne(G,n.current.search,F):0}function I(){if(!n.current.search||l.current.shouldFilter===!1)return;let G=n.current.filtered.items,F=[];n.current.filtered.groups.forEach(te=>{let ne=s.current.get(te),Y=0;ne.forEach(ae=>{let re=G.get(ae);Y=Math.max(re,Y)}),F.push([te,Y])});let U=_.current;H().sort((te,ne)=>{var Y,ae;let re=te.getAttribute("id"),oe=ne.getAttribute("id");return((Y=G.get(oe))!=null?Y:0)-((ae=G.get(re))!=null?ae:0)}).forEach(te=>{let ne=te.closest($w);ne?ne.appendChild(te.parentElement===ne?te:te.closest(`${$w} > *`)):U.appendChild(te.parentElement===U?te:te.closest(`${$w} > *`))}),F.sort((te,ne)=>ne[1]-te[1]).forEach(te=>{var ne;let Y=(ne=_.current)==null?void 0:ne.querySelector(`${tm}[${Bd}="${encodeURIComponent(te[0])}"]`);Y?.parentElement.appendChild(Y)})}function $(){let G=H().find(U=>U.getAttribute("aria-disabled")!=="true"),F=G?.getAttribute(Bd);M.setState("value",F||void 0)}function V(){var G,F,U,te;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let Y of r.current){let ae=(F=(G=i.current.get(Y))==null?void 0:G.value)!=null?F:"",re=(te=(U=i.current.get(Y))==null?void 0:U.keywords)!=null?te:[],oe=L(ae,re);n.current.filtered.items.set(Y,oe),oe>0&&ne++}for(let[Y,ae]of s.current)for(let re of ae)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(Y);break}n.current.filtered.count=ne}function ee(){var G,F,U;let te=z();te&&(((G=te.parentElement)==null?void 0:G.firstChild)===te&&((U=(F=te.closest(tm))==null?void 0:F.querySelector(Nhe))==null||U.scrollIntoView({block:"nearest"})),te.scrollIntoView({block:"nearest"}))}function z(){var G;return(G=_.current)==null?void 0:G.querySelector(`${tF}[aria-selected="true"]`)}function H(){var G;return Array.from(((G=_.current)==null?void 0:G.querySelectorAll(_E))||[])}function P(G){let F=H()[G];F&&M.setState("value",F.getAttribute(Bd))}function W(G){var F;let U=z(),te=H(),ne=te.findIndex(ae=>ae===U),Y=te[ne+G];(F=l.current)!=null&&F.loop&&(Y=ne+G<0?te[te.length-1]:ne+G===te.length?te[0]:te[ne+G]),Y&&M.setState("value",Y.getAttribute(Bd))}function J(G){let F=z(),U=F?.closest(tm),te;for(;U&&!te;)U=G>0?Phe(U,tm):Lhe(U,tm),te=U?.querySelector(_E);te?M.setState("value",te.getAttribute(Bd)):W(G)}let X=()=>P(H().length-1),R=G=>{G.preventDefault(),G.metaKey?X():G.altKey?J(1):W(1)},se=G=>{G.preventDefault(),G.metaKey?P(0):G.altKey?J(-1):W(-1)};return b.createElement(Ac.div,{ref:e,tabIndex:-1,...k,"cmdk-root":"",onKeyDown:G=>{var F;(F=k.onKeyDown)==null||F.call(k,G);let U=G.nativeEvent.isComposing||G.keyCode===229;if(!(G.defaultPrevented||U))switch(G.key){case"n":case"j":{S&&G.ctrlKey&&R(G);break}case"ArrowDown":{R(G);break}case"p":case"k":{S&&G.ctrlKey&&se(G);break}case"ArrowUp":{se(G);break}case"Home":{G.preventDefault(),P(0);break}case"End":{G.preventDefault(),X();break}case"Enter":{G.preventDefault();let te=z();if(te){let ne=new Event(IS);te.dispatchEvent(ne)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:q.inputId,id:q.labelId,style:qhe},c),ry(t,G=>b.createElement(rF.Provider,{value:M},b.createElement(nF.Provider,{value:q},G))))}),The=b.forwardRef((t,e)=>{var n,r;let s=ea(),i=b.useRef(null),a=b.useContext(sF),l=J0(),c=aF(t),h=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;Ru(()=>{if(!h)return l.item(s,a?.id)},[h]);let f=oF(s,i,[t.value,t.children,i],t.keywords),m=iO(),g=wc(E=>E.value&&E.value===f.current),x=wc(E=>h||l.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);b.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener(IS,y),()=>E.removeEventListener(IS,y)},[x,t.onSelect,t.disabled]);function y(){var E,M;w(),(M=(E=c.current).onSelect)==null||M.call(E,f.current)}function w(){m.setState("value",f.current,!0)}if(!x)return null;let{disabled:S,value:k,onSelect:N,forceMount:C,keywords:T,..._}=t;return b.createElement(Ac.div,{ref:mc(i,e),..._,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||l.getDisablePointerSelection()?void 0:w,onClick:S?void 0:y},t.children)}),Ehe=b.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,a=ea(),l=b.useRef(null),c=b.useRef(null),h=ea(),f=J0(),m=wc(x=>s||f.filter()===!1?!0:x.search?x.filtered.groups.has(a):!0);Ru(()=>f.group(a),[]),oF(a,l,[t.value,t.heading,c]);let g=b.useMemo(()=>({id:a,forceMount:s}),[s]);return b.createElement(Ac.div,{ref:mc(l,e),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),ry(t,x=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(sF.Provider,{value:g},x))))}),_he=b.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=b.useRef(null),i=wc(a=>!a.search);return!n&&!i?null:b.createElement(Ac.div,{ref:mc(s,e),...r,"cmdk-separator":"",role:"separator"})}),Mhe=b.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=iO(),a=wc(h=>h.search),l=wc(h=>h.selectedItemId),c=J0();return b.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),b.createElement(Ac.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?t.value:a,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),Ahe=b.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=b.useRef(null),a=b.useRef(null),l=wc(h=>h.selectedItemId),c=J0();return b.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)}}},[]),b.createElement(Ac.div,{ref:mc(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},ry(t,h=>b.createElement("div",{ref:mc(a,c.listInnerRef),"cmdk-list-sizer":""},h)))}),Rhe=b.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:a,...l}=t;return b.createElement(Vk,{open:n,onOpenChange:r},b.createElement(Fk,{container:a},b.createElement(kv,{"cmdk-overlay":"",className:s}),b.createElement(Ov,{"aria-label":t.label,"cmdk-dialog":"",className:i},b.createElement(iF,{ref:e,...l}))))}),Dhe=b.forwardRef((t,e)=>wc(n=>n.filtered.count===0)?b.createElement(Ac.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),zhe=b.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return b.createElement(Ac.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},ry(t,a=>b.createElement("div",{"aria-hidden":!0},a)))}),oi=Object.assign(iF,{List:Ahe,Item:The,Input:Mhe,Group:Ehe,Separator:_he,Dialog:Rhe,Empty:Dhe,Loading:zhe});function Phe(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Lhe(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function aF(t){let e=b.useRef(t);return Ru(()=>{e.current=t}),e}var Ru=typeof window>"u"?b.useEffect:b.useLayoutEffect;function qd(t){let e=b.useRef();return e.current===void 0&&(e.current=t()),e}function wc(t){let e=iO(),n=()=>t(e.snapshot());return b.useSyncExternalStore(e.subscribe,n,n)}function oF(t,e,n,r=[]){let s=b.useRef(),i=J0();return Ru(()=>{var a;let l=(()=>{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}})(),c=r.map(h=>h.trim());i.value(t,l,c),(a=e.current)==null||a.setAttribute(Bd,l),s.current=l}),s}var Ihe=()=>{let[t,e]=b.useState(),n=qd(()=>new Map);return Ru(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function Bhe(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function ry({asChild:t,children:e},n){return t&&b.isValidElement(e)?b.cloneElement(Bhe(e),{ref:e.ref},n(e.props.children)):n(e)}var qhe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const aO=b.forwardRef(({className:t,...e},n)=>o.jsx(oi,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));aO.displayName=oi.displayName;const oO=b.forwardRef(({className:t,...e},n)=>o.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[o.jsx(ii,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),o.jsx(oi.Input,{ref:n,className:ye("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})]}));oO.displayName=oi.Input.displayName;const lO=b.forwardRef(({className:t,...e},n)=>o.jsx(oi.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));lO.displayName=oi.List.displayName;const cO=b.forwardRef((t,e)=>o.jsx(oi.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));cO.displayName=oi.Empty.displayName;const uO=b.forwardRef(({className:t,...e},n)=>o.jsx(oi.Group,{ref:n,className:ye("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}));uO.displayName=oi.Group.displayName;const Fhe=b.forwardRef(({className:t,...e},n)=>o.jsx(oi.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));Fhe.displayName=oi.Separator.displayName;const dO=b.forwardRef(({className:t,...e},n)=>o.jsx(oi.Item,{ref:n,className:ye("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}));dO.displayName=oi.Item.displayName;const ri=b.forwardRef(({className:t,...e},n)=>o.jsx(QD,{ref:n,className:ye("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:o.jsx(oK,{className:ye("grid place-content-center text-current"),children:o.jsx(dc,{className:"h-4 w-4"})})}));ri.displayName=QD.displayName;const xx=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)"},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek"},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI"},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)"},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)"},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)"},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)"},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)"},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)"},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)"},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)"},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI"},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)"},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini"},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq"},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI"},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI"},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI"},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function $he(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(null),[N,C]=b.useState(null),[T,_]=b.useState("custom"),[E,M]=b.useState(!1),[q,L]=b.useState(!1),[I,$]=b.useState(null),[V,ee]=b.useState(!1),[z,H]=b.useState(""),[P,W]=b.useState(new Set),[J,X]=b.useState(!1),[R,se]=b.useState(1),[G,F]=b.useState(20),[U,te]=b.useState(""),{toast:ne}=Wr(),Y=b.useRef(null),ae=b.useRef(!0);b.useEffect(()=>{re()},[]);const re=async()=>{try{r(!0);const Ne=await Zd();e(Ne.api_providers||[]),h(!1),ae.current=!1}catch(Ne){console.error("加载配置失败:",Ne)}finally{r(!1)}},oe=async()=>{try{m(!0),Bv().catch(()=>{}),x(!0)}catch(Ne){console.error("重启失败:",Ne),x(!1),ne({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),m(!1)}},_e=async()=>{try{i(!0),Y.current&&clearTimeout(Y.current);const Ne=await Zd();Ne.api_providers=t,await T1(Ne),h(!1),ne({title:"保存成功",description:"正在重启麦麦..."}),await oe()}catch(Ne){console.error("保存配置失败:",Ne),ne({title:"保存失败",description:Ne.message,variant:"destructive"}),i(!1)}},Ge=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},tt=()=>{x(!1),m(!1),ne({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Xe=b.useCallback(async Ne=>{if(!ae.current)try{l(!0),await B3("api_providers",Ne),h(!1)}catch(ie){console.error("自动保存失败:",ie),h(!0)}finally{l(!1)}},[]);b.useEffect(()=>{if(!ae.current)return h(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{Xe(t)},2e3),()=>{Y.current&&clearTimeout(Y.current)}},[t,Xe]);const je=async()=>{try{i(!0),Y.current&&clearTimeout(Y.current);const Ne=await Zd();Ne.api_providers=t,await T1(Ne),h(!1),ne({title:"保存成功",description:"模型提供商配置已保存"})}catch(Ne){console.error("保存配置失败:",Ne),ne({title:"保存失败",description:Ne.message,variant:"destructive"})}finally{i(!1)}},Qe=(Ne,ie)=>{if(Ne){const xe=xx.find(Je=>Je.base_url===Ne.base_url&&Je.client_type===Ne.client_type);_(xe?.id||"custom"),k(Ne)}else _("custom"),k({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});C(ie),ee(!1),w(!0)},He=Ne=>{_(Ne),M(!1);const ie=xx.find(xe=>xe.id===Ne);ie&&ie.id!=="custom"?k(xe=>({...xe,name:ie.name,base_url:ie.base_url,client_type:ie.client_type})):ie?.id==="custom"&&k(xe=>({...xe,name:"",base_url:"",client_type:"openai"}))},$e=b.useMemo(()=>T!=="custom",[T]),bt=async()=>{if(S?.api_key)try{await navigator.clipboard.writeText(S.api_key),ne({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{ne({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},ot=()=>{if(!S)return;const Ne={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};if(N!==null){const ie=[...t];ie[N]=Ne,e(ie)}else e([...t,Ne]);w(!1),k(null),C(null)},on=Ne=>{if(!Ne&&S){const ie={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};k(ie)}w(Ne)},Tn=Ne=>{$(Ne),L(!0)},Nn=()=>{if(I!==null){const Ne=t.filter((ie,xe)=>xe!==I);e(Ne),ne({title:"删除成功",description:"提供商已从列表中移除"})}L(!1),$(null)},Rt=Ne=>{const ie=new Set(P);ie.has(Ne)?ie.delete(Ne):ie.add(Ne),W(ie)},xt=()=>{if(P.size===qe.length)W(new Set);else{const Ne=qe.map((ie,xe)=>t.findIndex(Je=>Je===qe[xe]));W(new Set(Ne))}},Te=()=>{if(P.size===0){ne({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}X(!0)},Re=()=>{const Ne=t.filter((ie,xe)=>!P.has(xe));e(Ne),W(new Set),X(!1),ne({title:"批量删除成功",description:`已删除 ${P.size} 个提供商`})},qe=t.filter(Ne=>{if(!z)return!0;const ie=z.toLowerCase();return Ne.name.toLowerCase().includes(ie)||Ne.base_url.toLowerCase().includes(ie)||Ne.client_type.toLowerCase().includes(ie)}),rt=Math.ceil(qe.length/G),wt=qe.slice((R-1)*G,R*G),jt=()=>{const Ne=parseInt(U);Ne>=1&&Ne<=rt&&(se(Ne),te(""))};return n?o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[P.size>0&&o.jsxs(me,{onClick:Te,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(sn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",P.size,")"]}),o.jsxs(me,{onClick:()=>Qe(null,null),size:"sm",className:"w-full sm:w-auto",children:[o.jsx(ms,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),o.jsxs(me,{onClick:je,disabled:s||a||!c||f,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(Tv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":a?"自动保存中...":c?"保存配置":"已保存"]}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs(me,{disabled:s||a||f,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(Yk,{className:"mr-2 h-4 w-4"}),f?"重启中...":c?"保存并重启":"重启麦麦"]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认重启麦麦?"}),o.jsxs(fn,{className:"space-y-3",children:[o.jsx("p",{children:c?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(nl,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(wa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(rl,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})]})]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:c?_e:oe,children:c?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(nl,{children:[o.jsx(wa,{className:"h-4 w-4"}),o.jsxs(rl,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),o.jsxs(kn,{className:"h-[calc(100vh-260px)]",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[o.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索提供商名称、URL 或类型...",value:z,onChange:Ne=>H(Ne.target.value),className:"pl-9"})]}),z&&o.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qe.length," 个结果"]})]}),o.jsx("div",{className:"md:hidden space-y-3",children:qe.length===0?o.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):wt.map((Ne,ie)=>{const xe=t.findIndex(Je=>Je===Ne);return o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"font-semibold text-base truncate",children:Ne.name}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:Ne.base_url})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>Qe(Ne,xe),children:[o.jsx(hh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(me,{size:"sm",onClick:()=>Tn(xe),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),o.jsx("p",{className:"font-medium",children:Ne.client_type})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),o.jsx("p",{className:"font-medium",children:Ne.max_retry})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),o.jsx("p",{className:"font-medium",children:Ne.timeout})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),o.jsx("p",{className:"font-medium",children:Ne.retry_interval})]})]})]},ie)})}),o.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(Qh,{children:[o.jsx(Hh,{children:o.jsxs(fs,{children:[o.jsx(en,{className:"w-12",children:o.jsx(ri,{checked:P.size===qe.length&&qe.length>0,onCheckedChange:xt})}),o.jsx(en,{children:"名称"}),o.jsx(en,{children:"基础URL"}),o.jsx(en,{children:"客户端类型"}),o.jsx(en,{className:"text-right",children:"最大重试"}),o.jsx(en,{className:"text-right",children:"超时(秒)"}),o.jsx(en,{className:"text-right",children:"重试间隔(秒)"}),o.jsx(en,{className:"text-right",children:"操作"})]})}),o.jsx(Vh,{children:wt.length===0?o.jsx(fs,{children:o.jsx(Lt,{colSpan:8,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):wt.map((Ne,ie)=>{const xe=t.findIndex(Je=>Je===Ne);return o.jsxs(fs,{children:[o.jsx(Lt,{children:o.jsx(ri,{checked:P.has(xe),onCheckedChange:()=>Rt(xe)})}),o.jsx(Lt,{className:"font-medium",children:Ne.name}),o.jsx(Lt,{className:"max-w-xs truncate",title:Ne.base_url,children:Ne.base_url}),o.jsx(Lt,{children:Ne.client_type}),o.jsx(Lt,{className:"text-right",children:Ne.max_retry}),o.jsx(Lt,{className:"text-right",children:Ne.timeout}),o.jsx(Lt,{className:"text-right",children:Ne.retry_interval}),o.jsx(Lt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>Qe(Ne,xe),children:[o.jsx(hh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(me,{size:"sm",onClick:()=>Tn(xe),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},ie)})})]})})}),qe.length>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Dt,{value:G.toString(),onValueChange:Ne=>{F(parseInt(Ne)),se(1),W(new Set)},children:[o.jsx(Mt,{id:"page-size-provider",className:"w-20",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"10",children:"10"}),o.jsx(ze,{value:"20",children:"20"}),o.jsx(ze,{value:"50",children:"50"}),o.jsx(ze,{value:"100",children:"100"})]})]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*G+1," 到"," ",Math.min(R*G,qe.length)," 条,共 ",qe.length," 条"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>se(1),disabled:R===1,className:"hidden sm:flex",children:o.jsx(M0,{className:"h-4 w-4"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>se(Ne=>Math.max(1,Ne-1)),disabled:R===1,children:[o.jsx(Iu,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:U,onChange:Ne=>te(Ne.target.value),onKeyDown:Ne=>Ne.key==="Enter"&&jt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),o.jsx(me,{variant:"outline",size:"sm",onClick:jt,disabled:!U,className:"h-8",children:"跳转"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>se(Ne=>Ne+1),disabled:R>=rt,children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Bu,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>se(rt),disabled:R>=rt,className:"hidden sm:flex",children:o.jsx(A0,{className:"h-4 w-4"})})]})]})]}),o.jsx(zr,{open:y,onOpenChange:on,children:o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:N!==null?"编辑提供商":"添加提供商"}),o.jsx(ps,{children:"配置 API 提供商的连接信息和参数"})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"template",children:"提供商模板"}),o.jsxs(cl,{open:E,onOpenChange:M,children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",role:"combobox","aria-expanded":E,className:"w-full justify-between",children:[T?xx.find(Ne=>Ne.id===T)?.display_name:"选择提供商模板...",o.jsx(YD,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(so,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:o.jsxs(aO,{children:[o.jsx(oO,{placeholder:"搜索提供商模板..."}),o.jsx(kn,{className:"h-[300px]",children:o.jsxs(lO,{className:"max-h-none overflow-visible",children:[o.jsx(cO,{children:"未找到匹配的模板"}),o.jsx(uO,{children:xx.map(Ne=>o.jsxs(dO,{value:Ne.display_name,onSelect:()=>He(Ne.id),children:[o.jsx(dc,{className:`mr-2 h-4 w-4 ${T===Ne.id?"opacity-100":"opacity-0"}`}),Ne.display_name]},Ne.id))})]})})]})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"name",children:"名称 *"}),o.jsx(Pe,{id:"name",value:S?.name||"",onChange:Ne=>k(ie=>ie?{...ie,name:Ne.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"base_url",children:"基础 URL *"}),o.jsx(Pe,{id:"base_url",value:S?.base_url||"",onChange:Ne=>k(ie=>ie?{...ie,base_url:Ne.target.value}:null),placeholder:"https://api.example.com/v1",disabled:$e,className:$e?"bg-muted cursor-not-allowed":""}),$e&&o.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"api_key",children:"API Key *"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{id:"api_key",type:V?"text":"password",value:S?.api_key||"",onChange:Ne=>k(ie=>ie?{...ie,api_key:Ne.target.value}:null),placeholder:"sk-...",className:"flex-1"}),o.jsx(me,{type:"button",variant:"outline",size:"icon",onClick:()=>ee(!V),title:V?"隐藏密钥":"显示密钥",children:V?o.jsx(b1,{className:"h-4 w-4"}):o.jsx(sa,{className:"h-4 w-4"})}),o.jsx(me,{type:"button",variant:"outline",size:"icon",onClick:bt,title:"复制密钥",children:o.jsx(S3,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"client_type",children:"客户端类型"}),o.jsxs(Dt,{value:S?.client_type||"openai",onValueChange:Ne=>k(ie=>ie?{...ie,client_type:Ne}:null),disabled:$e,children:[o.jsx(Mt,{id:"client_type",className:$e?"bg-muted cursor-not-allowed":"",children:o.jsx(zt,{placeholder:"选择客户端类型"})}),o.jsxs(At,{children:[o.jsx(ze,{value:"openai",children:"OpenAI"}),o.jsx(ze,{value:"gemini",children:"Gemini"})]})]}),$e&&o.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_retry",children:"最大重试"}),o.jsx(Pe,{id:"max_retry",type:"number",min:"0",value:S?.max_retry??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,max_retry:ie}:null)},placeholder:"默认: 2"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"timeout",children:"超时(秒)"}),o.jsx(Pe,{id:"timeout",type:"number",min:"1",value:S?.timeout??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,timeout:ie}:null)},placeholder:"默认: 30"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),o.jsx(Pe,{id:"retry_interval",type:"number",min:"1",value:S?.retry_interval??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,retry_interval:ie}:null)},placeholder:"默认: 10"})]})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>w(!1),children:"取消"}),o.jsx(me,{onClick:ot,children:"保存"})]})]})}),o.jsx(jn,{open:q,onOpenChange:L,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除提供商 "',I!==null?t[I]?.name:"",'" 吗? 此操作无法撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:Nn,children:"删除"})]})]})}),o.jsx(jn,{open:J,onOpenChange:X,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认批量删除"}),o.jsxs(fn,{children:["确定要删除选中的 ",P.size," 个提供商吗? 此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:Re,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),g&&o.jsx(p6,{onRestartComplete:Ge,onRestartFailed:tt})]})}function Qhe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return b.useMemo(()=>r=>{e.forEach(s=>s(r))},e)}const sy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Uh(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function hO(t){return"nodeType"in t}function li(t){var e,n;return t?Uh(t)?t:hO(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function fO(t){const{Document:e}=li(t);return t instanceof e}function ep(t){return Uh(t)?!1:t instanceof li(t).HTMLElement}function lF(t){return t instanceof li(t).SVGElement}function Wh(t){return t?Uh(t)?t.document:hO(t)?fO(t)?t:ep(t)||lF(t)?t.ownerDocument:document:document:document}const ao=sy?b.useLayoutEffect:b.useEffect;function mO(t){const e=b.useRef(t);return ao(()=>{e.current=t}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return e.current==null?void 0:e.current(...r)},[])}function Hhe(){const t=b.useRef(null),e=b.useCallback((r,s)=>{t.current=setInterval(r,s)},[]),n=b.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function c0(t,e){e===void 0&&(e=[t]);const n=b.useRef(t);return ao(()=>{n.current!==t&&(n.current=t)},e),n}function tp(t,e){const n=b.useRef();return b.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function K1(t){const e=mO(t),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function BS(t){const e=b.useRef();return b.useEffect(()=>{e.current=t},[t]),e.current}let Qw={};function np(t,e){return b.useMemo(()=>{if(e)return e;const n=Qw[t]==null?0:Qw[t]+1;return Qw[t]=n,t+"-"+n},[t,e])}function cF(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,a)=>{const l=Object.entries(a);for(const[c,h]of l){const f=i[c];f!=null&&(i[c]=f+t*h)}return i},{...e})}}const ih=cF(1),u0=cF(-1);function Vhe(t){return"clientX"in t&&"clientY"in t}function pO(t){if(!t)return!1;const{KeyboardEvent:e}=li(t.target);return e&&t instanceof e}function Uhe(t){if(!t)return!1;const{TouchEvent:e}=li(t.target);return e&&t instanceof e}function qS(t){if(Uhe(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return Vhe(t)?{x:t.clientX,y:t.clientY}:null}const d0=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[d0.Translate.toString(t),d0.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),ME="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Whe(t){return t.matches(ME)?t:t.querySelector(ME)}const Ghe={display:"none"};function Xhe(t){let{id:e,value:n}=t;return he.createElement("div",{id:e,style:Ghe},n)}function Yhe(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return he.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function Khe(){const[t,e]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const uF=b.createContext(null);function Zhe(t){const e=b.useContext(uF);b.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Jhe(){const[t]=b.useState(()=>new Set),e=b.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[b.useCallback(r=>{let{type:s,event:i}=r;t.forEach(a=>{var l;return(l=a[s])==null?void 0:l.call(a,i)})},[t]),e]}const efe={draggable:`
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`},tfe={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function nfe(t){let{announcements:e=tfe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=efe}=t;const{announce:i,announcement:a}=Khe(),l=np("DndLiveRegion"),[c,h]=b.useState(!1);if(b.useEffect(()=>{h(!0)},[]),Zhe(b.useMemo(()=>({onDragStart(m){let{active:g}=m;i(e.onDragStart({active:g}))},onDragMove(m){let{active:g,over:x}=m;e.onDragMove&&i(e.onDragMove({active:g,over:x}))},onDragOver(m){let{active:g,over:x}=m;i(e.onDragOver({active:g,over:x}))},onDragEnd(m){let{active:g,over:x}=m;i(e.onDragEnd({active:g,over:x}))},onDragCancel(m){let{active:g,over:x}=m;i(e.onDragCancel({active:g,over:x}))}}),[i,e])),!c)return null;const f=he.createElement(he.Fragment,null,he.createElement(Xhe,{id:r,value:s.draggable}),he.createElement(Yhe,{id:l,announcement:a}));return n?du.createPortal(f,n):f}var Qr;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Qr||(Qr={}));function Z1(){}function AE(t,e){return b.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function rfe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return b.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const ja=Object.freeze({x:0,y:0});function dF(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function hF(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function sfe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function RE(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function fF(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function DE(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const ife=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=DE(e,e.left,e.top),i=[];for(const a of r){const{id:l}=a,c=n.get(l);if(c){const h=dF(DE(c),s);i.push({id:l,data:{droppableContainer:a,value:h}})}}return i.sort(hF)},afe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=RE(e),i=[];for(const a of r){const{id:l}=a,c=n.get(l);if(c){const h=RE(c),f=s.reduce((g,x,y)=>g+dF(h[y],x),0),m=Number((f/4).toFixed(4));i.push({id:l,data:{droppableContainer:a,value:m}})}}return i.sort(hF)};function ofe(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),a=s-r,l=i-n;if(r<s&&n<i){const c=e.width*e.height,h=t.width*t.height,f=a*l,m=f/(c+h-f);return Number(m.toFixed(4))}return 0}const lfe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=ofe(l,e);c>0&&s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(sfe)};function cfe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function mF(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:ja}function ufe(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((a,l)=>({...a,top:a.top+t*l.y,bottom:a.bottom+t*l.y,left:a.left+t*l.x,right:a.right+t*l.x}),{...n})}}const dfe=ufe(1);function hfe(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function ffe(t,e,n){const r=hfe(e);if(!r)return t;const{scaleX:s,scaleY:i,x:a,y:l}=r,c=t.left-a-(1-s)*parseFloat(n),h=t.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=s?t.width/s:t.width,m=i?t.height/i:t.height;return{width:f,height:m,top:h,right:c+f,bottom:h+m,left:c}}const mfe={ignoreTransform:!1};function Gh(t,e){e===void 0&&(e=mfe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:h,transformOrigin:f}=li(t).getComputedStyle(t);h&&(n=ffe(n,h,f))}const{top:r,left:s,width:i,height:a,bottom:l,right:c}=n;return{top:r,left:s,width:i,height:a,bottom:l,right:c}}function zE(t){return Gh(t,{ignoreTransform:!0})}function pfe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function gfe(t,e){return e===void 0&&(e=li(t).getComputedStyle(t)),e.position==="fixed"}function xfe(t,e){e===void 0&&(e=li(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?n.test(i):!1})}function iy(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(fO(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!ep(s)||lF(s)||n.includes(s))return n;const i=li(t).getComputedStyle(s);return s!==t&&xfe(s,i)&&n.push(s),gfe(s,i)?n:r(s.parentNode)}return t?r(t):n}function pF(t){const[e]=iy(t,1);return e??null}function Hw(t){return!sy||!t?null:Uh(t)?t:hO(t)?fO(t)||t===Wh(t).scrollingElement?window:ep(t)?t:null:null}function gF(t){return Uh(t)?t.scrollX:t.scrollLeft}function xF(t){return Uh(t)?t.scrollY:t.scrollTop}function FS(t){return{x:gF(t),y:xF(t)}}var Zr;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Zr||(Zr={}));function vF(t){return!sy||!t?!1:t===document.scrollingElement}function yF(t){const e={x:0,y:0},n=vF(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,a=t.scrollTop>=r.y,l=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:a,isRight:l,maxScroll:r,minScroll:e}}const vfe={x:.2,y:.2};function yfe(t,e,n,r,s){let{top:i,left:a,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=vfe);const{isTop:h,isBottom:f,isLeft:m,isRight:g}=yF(t),x={x:0,y:0},y={x:0,y:0},w={height:e.height*s.y,width:e.width*s.x};return!h&&i<=e.top+w.height?(x.y=Zr.Backward,y.y=r*Math.abs((e.top+w.height-i)/w.height)):!f&&c>=e.bottom-w.height&&(x.y=Zr.Forward,y.y=r*Math.abs((e.bottom-w.height-c)/w.height)),!g&&l>=e.right-w.width?(x.x=Zr.Forward,y.x=r*Math.abs((e.right-w.width-l)/w.width)):!m&&a<=e.left+w.width&&(x.x=Zr.Backward,y.x=r*Math.abs((e.left+w.width-a)/w.width)),{direction:x,speed:y}}function bfe(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function bF(t){return t.reduce((e,n)=>ih(e,FS(n)),ja)}function wfe(t){return t.reduce((e,n)=>e+gF(n),0)}function Sfe(t){return t.reduce((e,n)=>e+xF(n),0)}function kfe(t,e){if(e===void 0&&(e=Gh),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);pF(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const Ofe=[["x",["left","right"],wfe],["y",["top","bottom"],Sfe]];class gO{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=iy(n),s=bF(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,a,l]of Ofe)for(const c of a)Object.defineProperty(this,c,{get:()=>{const h=l(r),f=s[i]-h;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Mm{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function jfe(t){const{EventTarget:e}=li(t);return t instanceof e?t:Wh(t)}function Vw(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var Vi;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Vi||(Vi={}));function PE(t){t.preventDefault()}function Nfe(t){t.stopPropagation()}var nn;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(nn||(nn={}));const wF={start:[nn.Space,nn.Enter],cancel:[nn.Esc],end:[nn.Space,nn.Enter,nn.Tab]},Cfe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case nn.Right:return{...n,x:n.x+25};case nn.Left:return{...n,x:n.x-25};case nn.Down:return{...n,y:n.y+25};case nn.Up:return{...n,y:n.y-25}}};class xO{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Mm(Wh(n)),this.windowListeners=new Mm(li(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Vi.Resize,this.handleCancel),this.windowListeners.add(Vi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Vi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&kfe(r),n(ja)}handleKeyDown(e){if(pO(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=wF,coordinateGetter:a=Cfe,scrollBehavior:l="smooth"}=s,{code:c}=e;if(i.end.includes(c)){this.handleEnd(e);return}if(i.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:h}=r.current,f=h?{x:h.left,y:h.top}:ja;this.referenceCoordinates||(this.referenceCoordinates=f);const m=a(e,{active:n,context:r.current,currentCoordinates:f});if(m){const g=u0(m,f),x={x:0,y:0},{scrollableAncestors:y}=r.current;for(const w of y){const S=e.code,{isTop:k,isRight:N,isLeft:C,isBottom:T,maxScroll:_,minScroll:E}=yF(w),M=bfe(w),q={x:Math.min(S===nn.Right?M.right-M.width/2:M.right,Math.max(S===nn.Right?M.left:M.left+M.width/2,m.x)),y:Math.min(S===nn.Down?M.bottom-M.height/2:M.bottom,Math.max(S===nn.Down?M.top:M.top+M.height/2,m.y))},L=S===nn.Right&&!N||S===nn.Left&&!C,I=S===nn.Down&&!T||S===nn.Up&&!k;if(L&&q.x!==m.x){const $=w.scrollLeft+g.x,V=S===nn.Right&&$<=_.x||S===nn.Left&&$>=E.x;if(V&&!g.y){w.scrollTo({left:$,behavior:l});return}V?x.x=w.scrollLeft-$:x.x=S===nn.Right?w.scrollLeft-_.x:w.scrollLeft-E.x,x.x&&w.scrollBy({left:-x.x,behavior:l});break}else if(I&&q.y!==m.y){const $=w.scrollTop+g.y,V=S===nn.Down&&$<=_.y||S===nn.Up&&$>=E.y;if(V&&!g.x){w.scrollTo({top:$,behavior:l});return}V?x.y=w.scrollTop-$:x.y=S===nn.Down?w.scrollTop-_.y:w.scrollTop-E.y,x.y&&w.scrollBy({top:-x.y,behavior:l});break}}this.handleMove(e,ih(u0(m,this.referenceCoordinates),x))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}xO.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=wF,onActivation:s}=e,{active:i}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const l=i.activatorNode.current;return l&&t.target!==l?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function LE(t){return!!(t&&"distance"in t)}function IE(t){return!!(t&&"delay"in t)}class vO{constructor(e,n,r){var s;r===void 0&&(r=jfe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:a}=i;this.props=e,this.events=n,this.document=Wh(a),this.documentListeners=new Mm(this.document),this.listeners=new Mm(r),this.windowListeners=new Mm(li(a)),this.initialCoordinates=(s=qS(i))!=null?s:ja,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Vi.Resize,this.handleCancel),this.windowListeners.add(Vi.DragStart,PE),this.windowListeners.add(Vi.VisibilityChange,this.handleCancel),this.windowListeners.add(Vi.ContextMenu,PE),this.documentListeners.add(Vi.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(IE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(LE(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Vi.Click,Nfe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Vi.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:l}}=i;if(!s)return;const c=(n=qS(e))!=null?n:ja,h=u0(s,c);if(!r&&l){if(LE(l)){if(l.tolerance!=null&&Vw(h,l.tolerance))return this.handleCancel();if(Vw(h,l.distance))return this.handleStart()}if(IE(l)&&Vw(h,l.tolerance))return this.handleCancel();this.handlePending(l,h);return}e.cancelable&&e.preventDefault(),a(c)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===nn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Tfe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class yO extends vO{constructor(e){const{event:n}=e,r=Wh(n.target);super(e,Tfe,r)}}yO.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Efe={move:{name:"mousemove"},end:{name:"mouseup"}};var $S;(function(t){t[t.RightClick=2]="RightClick"})($S||($S={}));class _fe extends vO{constructor(e){super(e,Efe,Wh(e.event.target))}}_fe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===$S.RightClick?!1:(r?.({event:n}),!0)}}];const Uw={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Mfe extends vO{constructor(e){super(e,Uw)}static setup(){return window.addEventListener(Uw.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Uw.move.name,e)};function e(){}}}Mfe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var Am;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Am||(Am={}));var J1;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(J1||(J1={}));function Afe(t){let{acceleration:e,activator:n=Am.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:a=5,order:l=J1.TreeOrder,pointerCoordinates:c,scrollableAncestors:h,scrollableAncestorRects:f,delta:m,threshold:g}=t;const x=Dfe({delta:m,disabled:!i}),[y,w]=Hhe(),S=b.useRef({x:0,y:0}),k=b.useRef({x:0,y:0}),N=b.useMemo(()=>{switch(n){case Am.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Am.DraggableRect:return s}},[n,s,c]),C=b.useRef(null),T=b.useCallback(()=>{const E=C.current;if(!E)return;const M=S.current.x*k.current.x,q=S.current.y*k.current.y;E.scrollBy(M,q)},[]),_=b.useMemo(()=>l===J1.TreeOrder?[...h].reverse():h,[l,h]);b.useEffect(()=>{if(!i||!h.length||!N){w();return}for(const E of _){if(r?.(E)===!1)continue;const M=h.indexOf(E),q=f[M];if(!q)continue;const{direction:L,speed:I}=yfe(E,q,N,e,g);for(const $ of["x","y"])x[$][L[$]]||(I[$]=0,L[$]=0);if(I.x>0||I.y>0){w(),C.current=E,y(T,a),S.current=I,k.current=L;return}}S.current={x:0,y:0},k.current={x:0,y:0},w()},[e,T,r,w,i,a,JSON.stringify(N),JSON.stringify(x),y,h,_,f,JSON.stringify(g)])}const Rfe={x:{[Zr.Backward]:!1,[Zr.Forward]:!1},y:{[Zr.Backward]:!1,[Zr.Forward]:!1}};function Dfe(t){let{delta:e,disabled:n}=t;const r=BS(e);return tp(s=>{if(n||!r||!s)return Rfe;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Zr.Backward]:s.x[Zr.Backward]||i.x===-1,[Zr.Forward]:s.x[Zr.Forward]||i.x===1},y:{[Zr.Backward]:s.y[Zr.Backward]||i.y===-1,[Zr.Forward]:s.y[Zr.Forward]||i.y===1}}},[n,e,r])}function zfe(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return tp(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function Pfe(t,e){return b.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,r)}));return[...n,...i]},[]),[t,e])}var h0;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(h0||(h0={}));var QS;(function(t){t.Optimized="optimized"})(QS||(QS={}));const BE=new Map;function Lfe(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,a]=b.useState(null),{frequency:l,measure:c,strategy:h}=s,f=b.useRef(t),m=S(),g=c0(m),x=b.useCallback(function(k){k===void 0&&(k=[]),!g.current&&a(N=>N===null?k:N.concat(k.filter(C=>!N.includes(C))))},[g]),y=b.useRef(null),w=tp(k=>{if(m&&!n)return BE;if(!k||k===BE||f.current!==t||i!=null){const N=new Map;for(let C of t){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){N.set(C.id,C.rect.current);continue}const T=C.node.current,_=T?new gO(c(T),T):null;C.rect.current=_,_&&N.set(C.id,_)}return N}return k},[t,i,n,m,c]);return b.useEffect(()=>{f.current=t},[t]),b.useEffect(()=>{m||x()},[n,m]),b.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),b.useEffect(()=>{m||typeof l!="number"||y.current!==null||(y.current=setTimeout(()=>{x(),y.current=null},l))},[l,m,x,...r]),{droppableRects:w,measureDroppableContainers:x,measuringScheduled:i!=null};function S(){switch(h){case h0.Always:return!1;case h0.BeforeDragging:return n;default:return!n}}}function SF(t,e){return tp(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function Ife(t,e){return SF(t,e)}function Bfe(t){let{callback:e,disabled:n}=t;const r=mO(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function ay(t){let{callback:e,disabled:n}=t;const r=mO(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function qfe(t){return new gO(Gh(t),t)}function qE(t,e,n){e===void 0&&(e=qfe);const[r,s]=b.useState(null);function i(){s(c=>{if(!t)return null;if(t.isConnected===!1){var h;return(h=c??n)!=null?h:null}const f=e(t);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const a=Bfe({callback(c){if(t)for(const h of c){const{type:f,target:m}=h;if(f==="childList"&&m instanceof HTMLElement&&m.contains(t)){i();break}}}}),l=ay({callback:i});return ao(()=>{i(),t?(l?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),a?.disconnect())},[t]),r}function Ffe(t){const e=SF(t);return mF(t,e)}const FE=[];function $fe(t){const e=b.useRef(t),n=tp(r=>t?r&&r!==FE&&t&&e.current&&t.parentNode===e.current.parentNode?r:iy(t):FE,[t]);return b.useEffect(()=>{e.current=t},[t]),n}function Qfe(t){const[e,n]=b.useState(null),r=b.useRef(t),s=b.useCallback(i=>{const a=Hw(i.target);a&&n(l=>l?(l.set(a,FS(a)),new Map(l)):null)},[]);return b.useEffect(()=>{const i=r.current;if(t!==i){a(i);const l=t.map(c=>{const h=Hw(c);return h?(h.addEventListener("scroll",s,{passive:!0}),[h,FS(h)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=t}return()=>{a(t),a(i)};function a(l){l.forEach(c=>{const h=Hw(c);h?.removeEventListener("scroll",s)})}},[s,t]),b.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>ih(i,a),ja):bF(t):ja,[t,e])}function $E(t,e){e===void 0&&(e=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},e),b.useEffect(()=>{const r=t!==ja;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?u0(t,n.current):ja}function Hfe(t){b.useEffect(()=>{if(!sy)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function Vfe(t,e){return b.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=a=>{i(a,e)},n},{}),[t,e])}function kF(t){return b.useMemo(()=>t?pfe(t):null,[t])}const QE=[];function Ufe(t,e){e===void 0&&(e=Gh);const[n]=t,r=kF(n?li(n):null),[s,i]=b.useState(QE);function a(){i(()=>t.length?t.map(c=>vF(c)?r:new gO(e(c),c)):QE)}const l=ay({callback:a});return ao(()=>{l?.disconnect(),a(),t.forEach(c=>l?.observe(c))},[t]),s}function Wfe(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return ep(e)?e:t}function Gfe(t){let{measure:e}=t;const[n,r]=b.useState(null),s=b.useCallback(h=>{for(const{target:f}of h)if(ep(f)){r(m=>{const g=e(f);return m?{...m,width:g.width,height:g.height}:g});break}},[e]),i=ay({callback:s}),a=b.useCallback(h=>{const f=Wfe(h);i?.disconnect(),f&&i?.observe(f),r(f?e(f):null)},[e,i]),[l,c]=K1(a);return b.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const Xfe=[{sensor:yO,options:{}},{sensor:xO,options:{}}],Yfe={current:{}},d1={draggable:{measure:zE},droppable:{measure:zE,strategy:h0.WhileDragging,frequency:QS.Optimized},dragOverlay:{measure:Gh}};class Rm extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const Kfe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Rm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Z1},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:d1,measureDroppableContainers:Z1,windowRect:null,measuringScheduled:!1},Zfe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Z1,draggableNodes:new Map,over:null,measureDroppableContainers:Z1},oy=b.createContext(Zfe),OF=b.createContext(Kfe);function Jfe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Rm}}}function eme(t,e){switch(e.type){case Qr.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Qr.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Qr.DragEnd:case Qr.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Qr.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new Rm(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case Qr.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const a=new Rm(t.droppable.containers);return a.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:a}}}case Qr.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new Rm(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function tme(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=b.useContext(oy),i=BS(r),a=BS(n?.id);return b.useEffect(()=>{if(!e&&!r&&i&&a!=null){if(!pO(i)||document.activeElement===i.target)return;const l=s.get(a);if(!l)return;const{activatorNode:c,node:h}=l;if(!c.current&&!h.current)return;requestAnimationFrame(()=>{for(const f of[c.current,h.current]){if(!f)continue;const m=Whe(f);if(m){m.focus();break}}})}},[r,e,s,a,i]),null}function nme(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function rme(t){return b.useMemo(()=>({draggable:{...d1.draggable,...t?.draggable},droppable:{...d1.droppable,...t?.droppable},dragOverlay:{...d1.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function sme(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=b.useRef(!1),{x:a,y:l}=typeof s=="boolean"?{x:s,y:s}:s;ao(()=>{if(!a&&!l||!e){i.current=!1;return}if(i.current||!r)return;const h=e?.node.current;if(!h||h.isConnected===!1)return;const f=n(h),m=mF(f,r);if(a||(m.x=0),l||(m.y=0),i.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const g=pF(h);g&&g.scrollBy({top:m.y,left:m.x})}},[e,a,l,r,n])}const jF=b.createContext({...ja,scaleX:1,scaleY:1});var sc;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(sc||(sc={}));const ime=b.memo(function(e){var n,r,s,i;let{id:a,accessibility:l,autoScroll:c=!0,children:h,sensors:f=Xfe,collisionDetection:m=lfe,measuring:g,modifiers:x,...y}=e;const w=b.useReducer(eme,void 0,Jfe),[S,k]=w,[N,C]=Jhe(),[T,_]=b.useState(sc.Uninitialized),E=T===sc.Initialized,{draggable:{active:M,nodes:q,translate:L},droppable:{containers:I}}=S,$=M!=null?q.get(M):null,V=b.useRef({initial:null,translated:null}),ee=b.useMemo(()=>{var Ht;return M!=null?{id:M,data:(Ht=$?.data)!=null?Ht:Yfe,rect:V}:null},[M,$]),z=b.useRef(null),[H,P]=b.useState(null),[W,J]=b.useState(null),X=c0(y,Object.values(y)),R=np("DndDescribedBy",a),se=b.useMemo(()=>I.getEnabled(),[I]),G=rme(g),{droppableRects:F,measureDroppableContainers:U,measuringScheduled:te}=Lfe(se,{dragging:E,dependencies:[L.x,L.y],config:G.droppable}),ne=zfe(q,M),Y=b.useMemo(()=>W?qS(W):null,[W]),ae=Wt(),re=Ife(ne,G.draggable.measure);sme({activeNode:M!=null?q.get(M):null,config:ae.layoutShiftCompensation,initialRect:re,measure:G.draggable.measure});const oe=qE(ne,G.draggable.measure,re),_e=qE(ne?ne.parentElement:null),Ge=b.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:q,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),tt=I.getNodeFor((n=Ge.current.over)==null?void 0:n.id),Xe=Gfe({measure:G.dragOverlay.measure}),je=(r=Xe.nodeRef.current)!=null?r:ne,Qe=E?(s=Xe.rect)!=null?s:oe:null,He=!!(Xe.nodeRef.current&&Xe.rect),$e=Ffe(He?null:oe),bt=kF(je?li(je):null),ot=$fe(E?tt??ne:null),on=Ufe(ot),Tn=nme(x,{transform:{x:L.x-$e.x,y:L.y-$e.y,scaleX:1,scaleY:1},activatorEvent:W,active:ee,activeNodeRect:oe,containerNodeRect:_e,draggingNodeRect:Qe,over:Ge.current.over,overlayNodeRect:Xe.rect,scrollableAncestors:ot,scrollableAncestorRects:on,windowRect:bt}),Nn=Y?ih(Y,L):null,Rt=Qfe(ot),xt=$E(Rt),Te=$E(Rt,[oe]),Re=ih(Tn,xt),qe=Qe?dfe(Qe,Tn):null,rt=ee&&qe?m({active:ee,collisionRect:qe,droppableRects:F,droppableContainers:se,pointerCoordinates:Nn}):null,wt=fF(rt,"id"),[jt,Ne]=b.useState(null),ie=He?Tn:ih(Tn,Te),xe=cfe(ie,(i=jt?.rect)!=null?i:null,oe),Je=b.useRef(null),dt=b.useCallback((Ht,lt)=>{let{sensor:ur,options:Xr}=lt;if(z.current==null)return;const Yr=q.get(z.current);if(!Yr)return;const dr=Ht.nativeEvent,Nr=new ur({active:z.current,activeNode:Yr,event:dr,options:Xr,context:Ge,onAbort(xr){if(!q.get(xr))return;const{onDragAbort:Ns}=X.current,Bs={id:xr};Ns?.(Bs),N({type:"onDragAbort",event:Bs})},onPending(xr,di,Ns,Bs){if(!q.get(xr))return;const{onDragPending:ha}=X.current,hi={id:xr,constraint:di,initialCoordinates:Ns,offset:Bs};ha?.(hi),N({type:"onDragPending",event:hi})},onStart(xr){const di=z.current;if(di==null)return;const Ns=q.get(di);if(!Ns)return;const{onDragStart:Bs}=X.current,da={activatorEvent:dr,active:{id:di,data:Ns.data,rect:V}};du.unstable_batchedUpdates(()=>{Bs?.(da),_(sc.Initializing),k({type:Qr.DragStart,initialCoordinates:xr,active:di}),N({type:"onDragStart",event:da}),P(Je.current),J(dr)})},onMove(xr){k({type:Qr.DragMove,coordinates:xr})},onEnd:Is(Qr.DragEnd),onCancel:Is(Qr.DragCancel)});Je.current=Nr;function Is(xr){return async function(){const{active:Ns,collisions:Bs,over:da,scrollAdjustedTranslate:ha}=Ge.current;let hi=null;if(Ns&&ha){const{cancelDrop:Ra}=X.current;hi={activatorEvent:dr,active:Ns,collisions:Bs,delta:ha,over:da},xr===Qr.DragEnd&&typeof Ra=="function"&&await Promise.resolve(Ra(hi))&&(xr=Qr.DragCancel)}z.current=null,du.unstable_batchedUpdates(()=>{k({type:xr}),_(sc.Uninitialized),Ne(null),P(null),J(null),Je.current=null;const Ra=xr===Qr.DragEnd?"onDragEnd":"onDragCancel";if(hi){const qs=X.current[Ra];qs?.(hi),N({type:Ra,event:hi})}})}}},[q]),er=b.useCallback((Ht,lt)=>(ur,Xr)=>{const Yr=ur.nativeEvent,dr=q.get(Xr);if(z.current!==null||!dr||Yr.dndKit||Yr.defaultPrevented)return;const Nr={active:dr};Ht(ur,lt.options,Nr)===!0&&(Yr.dndKit={capturedBy:lt.sensor},z.current=Xr,dt(ur,lt))},[q,dt]),pt=Pfe(f,er);Hfe(f),ao(()=>{oe&&T===sc.Initializing&&_(sc.Initialized)},[oe,T]),b.useEffect(()=>{const{onDragMove:Ht}=X.current,{active:lt,activatorEvent:ur,collisions:Xr,over:Yr}=Ge.current;if(!lt||!ur)return;const dr={active:lt,activatorEvent:ur,collisions:Xr,delta:{x:Re.x,y:Re.y},over:Yr};du.unstable_batchedUpdates(()=>{Ht?.(dr),N({type:"onDragMove",event:dr})})},[Re.x,Re.y]),b.useEffect(()=>{const{active:Ht,activatorEvent:lt,collisions:ur,droppableContainers:Xr,scrollAdjustedTranslate:Yr}=Ge.current;if(!Ht||z.current==null||!lt||!Yr)return;const{onDragOver:dr}=X.current,Nr=Xr.get(wt),Is=Nr&&Nr.rect.current?{id:Nr.id,rect:Nr.rect.current,data:Nr.data,disabled:Nr.disabled}:null,xr={active:Ht,activatorEvent:lt,collisions:ur,delta:{x:Yr.x,y:Yr.y},over:Is};du.unstable_batchedUpdates(()=>{Ne(Is),dr?.(xr),N({type:"onDragOver",event:xr})})},[wt]),ao(()=>{Ge.current={activatorEvent:W,active:ee,activeNode:ne,collisionRect:qe,collisions:rt,droppableRects:F,draggableNodes:q,draggingNode:je,draggingNodeRect:Qe,droppableContainers:I,over:jt,scrollableAncestors:ot,scrollAdjustedTranslate:Re},V.current={initial:Qe,translated:qe}},[ee,ne,rt,qe,q,je,Qe,F,I,jt,ot,Re]),Afe({...ae,delta:L,draggingRect:qe,pointerCoordinates:Nn,scrollableAncestors:ot,scrollableAncestorRects:on});const vn=b.useMemo(()=>({active:ee,activeNode:ne,activeNodeRect:oe,activatorEvent:W,collisions:rt,containerNodeRect:_e,dragOverlay:Xe,draggableNodes:q,droppableContainers:I,droppableRects:F,over:jt,measureDroppableContainers:U,scrollableAncestors:ot,scrollableAncestorRects:on,measuringConfiguration:G,measuringScheduled:te,windowRect:bt}),[ee,ne,oe,W,rt,_e,Xe,q,I,F,jt,U,ot,on,G,te,bt]),vt=b.useMemo(()=>({activatorEvent:W,activators:pt,active:ee,activeNodeRect:oe,ariaDescribedById:{draggable:R},dispatch:k,draggableNodes:q,over:jt,measureDroppableContainers:U}),[W,pt,ee,oe,k,R,q,jt,U]);return he.createElement(uF.Provider,{value:C},he.createElement(oy.Provider,{value:vt},he.createElement(OF.Provider,{value:vn},he.createElement(jF.Provider,{value:xe},h)),he.createElement(tme,{disabled:l?.restoreFocus===!1})),he.createElement(nfe,{...l,hiddenTextDescribedById:R}));function Wt(){const Ht=H?.autoScrollEnabled===!1,lt=typeof c=="object"?c.enabled===!1:c===!1,ur=E&&!Ht&&!lt;return typeof c=="object"?{...c,enabled:ur}:{enabled:ur}}}),ame=b.createContext(null),HE="button",ome="Draggable";function lme(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=np(ome),{activators:a,activatorEvent:l,active:c,activeNodeRect:h,ariaDescribedById:f,draggableNodes:m,over:g}=b.useContext(oy),{role:x=HE,roleDescription:y="draggable",tabIndex:w=0}=s??{},S=c?.id===e,k=b.useContext(S?jF:ame),[N,C]=K1(),[T,_]=K1(),E=Vfe(a,e),M=c0(n);ao(()=>(m.set(e,{id:e,key:i,node:N,activatorNode:T,data:M}),()=>{const L=m.get(e);L&&L.key===i&&m.delete(e)}),[m,e]);const q=b.useMemo(()=>({role:x,tabIndex:w,"aria-disabled":r,"aria-pressed":S&&x===HE?!0:void 0,"aria-roledescription":y,"aria-describedby":f.draggable}),[r,x,w,S,y,f.draggable]);return{active:c,activatorEvent:l,activeNodeRect:h,attributes:q,isDragging:S,listeners:r?void 0:E,node:N,over:g,setNodeRef:C,setActivatorNodeRef:_,transform:k}}function cme(){return b.useContext(OF)}const ume="Droppable",dme={timeout:25};function hme(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=np(ume),{active:a,dispatch:l,over:c,measureDroppableContainers:h}=b.useContext(oy),f=b.useRef({disabled:n}),m=b.useRef(!1),g=b.useRef(null),x=b.useRef(null),{disabled:y,updateMeasurementsFor:w,timeout:S}={...dme,...s},k=c0(w??r),N=b.useCallback(()=>{if(!m.current){m.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{h(Array.isArray(k.current)?k.current:[k.current]),x.current=null},S)},[S]),C=ay({callback:N,disabled:y||!a}),T=b.useCallback((q,L)=>{C&&(L&&(C.unobserve(L),m.current=!1),q&&C.observe(q))},[C]),[_,E]=K1(T),M=c0(e);return b.useEffect(()=>{!C||!_.current||(C.disconnect(),m.current=!1,C.observe(_.current))},[_,C]),b.useEffect(()=>(l({type:Qr.RegisterDroppable,element:{id:r,key:i,disabled:n,node:_,rect:g,data:M}}),()=>l({type:Qr.UnregisterDroppable,key:i,id:r})),[r]),b.useEffect(()=>{n!==f.current.disabled&&(l({type:Qr.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,l]),{active:a,rect:g,isOver:c?.id===r,node:_,over:c,setNodeRef:E}}function bO(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function fme(t,e){return t.reduce((n,r,s)=>{const i=e.get(r);return i&&(n[s]=i),n},Array(t.length))}function vx(t){return t!==null&&t>=0}function mme(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function pme(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const yx={scaleX:1,scaleY:1},gme=t=>{var e;let{rects:n,activeNodeRect:r,activeIndex:s,overIndex:i,index:a}=t;const l=(e=n[s])!=null?e:r;if(!l)return null;const c=xme(n,a,s);if(a===s){const h=n[i];return h?{x:s<i?h.left+h.width-(l.left+l.width):h.left-l.left,y:0,...yx}:null}return a>s&&a<=i?{x:-l.width-c,y:0,...yx}:a<s&&a>=i?{x:l.width+c,y:0,...yx}:{x:0,y:0,...yx}};function xme(t,e,n){const r=t[e],s=t[e-1],i=t[e+1];return!r||!s&&!i?0:n<e?s?r.left-(s.left+s.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(s.left+s.width)}const NF=t=>{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const i=bO(e,r,n),a=e[s],l=i[s];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},CF="Sortable",TF=he.createContext({activeIndex:-1,containerId:CF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:NF,disabled:{draggable:!1,droppable:!1}});function vme(t){let{children:e,id:n,items:r,strategy:s=NF,disabled:i=!1}=t;const{active:a,dragOverlay:l,droppableRects:c,over:h,measureDroppableContainers:f}=cme(),m=np(CF,n),g=l.rect!==null,x=b.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),y=a!=null,w=a?x.indexOf(a.id):-1,S=h?x.indexOf(h.id):-1,k=b.useRef(x),N=!mme(x,k.current),C=S!==-1&&w===-1||N,T=pme(i);ao(()=>{N&&y&&f(x)},[N,x,y,f]),b.useEffect(()=>{k.current=x},[x]);const _=b.useMemo(()=>({activeIndex:w,containerId:m,disabled:T,disableTransforms:C,items:x,overIndex:S,useDragOverlay:g,sortedRects:fme(x,c),strategy:s}),[w,m,T.draggable,T.droppable,C,x,S,c,g,s]);return he.createElement(TF.Provider,{value:_},e)}const yme=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return bO(n,r,s).indexOf(e)},bme=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:i,newIndex:a,previousItems:l,previousContainerId:c,transition:h}=t;return!h||!r||l!==i&&s===a?!1:n?!0:a!==s&&e===c},wme={duration:200,easing:"ease"},EF="transform",Sme=d0.Transition.toString({property:EF,duration:0,easing:"linear"}),kme={roleDescription:"sortable"};function Ome(t){let{disabled:e,index:n,node:r,rect:s}=t;const[i,a]=b.useState(null),l=b.useRef(n);return ao(()=>{if(!e&&n!==l.current&&r.current){const c=s.current;if(c){const h=Gh(r.current,{ignoreTransform:!0}),f={x:c.left-h.left,y:c.top-h.top,scaleX:c.width/h.width,scaleY:c.height/h.height};(f.x||f.y)&&a(f)}}n!==l.current&&(l.current=n)},[e,n,r,s]),b.useEffect(()=>{i&&a(null)},[i]),i}function jme(t){let{animateLayoutChanges:e=bme,attributes:n,disabled:r,data:s,getNewIndex:i=yme,id:a,strategy:l,resizeObserverConfig:c,transition:h=wme}=t;const{items:f,containerId:m,activeIndex:g,disabled:x,disableTransforms:y,sortedRects:w,overIndex:S,useDragOverlay:k,strategy:N}=b.useContext(TF),C=Nme(r,x),T=f.indexOf(a),_=b.useMemo(()=>({sortable:{containerId:m,index:T,items:f},...s}),[m,s,T,f]),E=b.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:M,node:q,isOver:L,setNodeRef:I}=hme({id:a,data:_,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...c}}),{active:$,activatorEvent:V,activeNodeRect:ee,attributes:z,setNodeRef:H,listeners:P,isDragging:W,over:J,setActivatorNodeRef:X,transform:R}=lme({id:a,data:_,attributes:{...kme,...n},disabled:C.draggable}),se=Qhe(I,H),G=!!$,F=G&&!y&&vx(g)&&vx(S),U=!k&&W,te=U&&F?R:null,Y=F?te??(l??N)({rects:w,activeNodeRect:ee,activeIndex:g,overIndex:S,index:T}):null,ae=vx(g)&&vx(S)?i({id:a,items:f,activeIndex:g,overIndex:S}):T,re=$?.id,oe=b.useRef({activeId:re,items:f,newIndex:ae,containerId:m}),_e=f!==oe.current.items,Ge=e({active:$,containerId:m,isDragging:W,isSorting:G,id:a,index:T,items:f,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:h,wasDragging:oe.current.activeId!=null}),tt=Ome({disabled:!Ge,index:T,node:q,rect:M});return b.useEffect(()=>{G&&oe.current.newIndex!==ae&&(oe.current.newIndex=ae),m!==oe.current.containerId&&(oe.current.containerId=m),f!==oe.current.items&&(oe.current.items=f)},[G,ae,m,f]),b.useEffect(()=>{if(re===oe.current.activeId)return;if(re!=null&&oe.current.activeId==null){oe.current.activeId=re;return}const je=setTimeout(()=>{oe.current.activeId=re},50);return()=>clearTimeout(je)},[re]),{active:$,activeIndex:g,attributes:z,data:_,rect:M,index:T,newIndex:ae,items:f,isOver:L,isSorting:G,isDragging:W,listeners:P,node:q,overIndex:S,over:J,setNodeRef:se,setActivatorNodeRef:X,setDroppableNodeRef:I,setDraggableNodeRef:H,transform:tt??Y,transition:Xe()};function Xe(){if(tt||_e&&oe.current.newIndex===T)return Sme;if(!(U&&!pO(V)||!h)&&(G||Ge))return d0.Transition.toString({...h,property:EF})}}function Nme(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function ev(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Cme=[nn.Down,nn.Right,nn.Up,nn.Left],Tme=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:a,scrollableAncestors:l}}=e;if(Cme.includes(t.code)){if(t.preventDefault(),!n||!r)return;const c=[];i.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const g=s.get(m.id);if(g)switch(t.code){case nn.Down:r.top<g.top&&c.push(m);break;case nn.Up:r.top>g.top&&c.push(m);break;case nn.Left:r.left>g.left&&c.push(m);break;case nn.Right:r.left<g.left&&c.push(m);break}});const h=afe({collisionRect:r,droppableRects:s,droppableContainers:c});let f=fF(h,"id");if(f===a?.id&&h.length>1&&(f=h[1].id),f!=null){const m=i.get(n.id),g=i.get(f),x=g?s.get(g.id):null,y=g?.node.current;if(y&&x&&m&&g){const S=iy(y).some((E,M)=>l[M]!==E),k=_F(m,g),N=Eme(m,g),C=S||!k?{x:0,y:0}:{x:N?r.width-x.width:0,y:N?r.height-x.height:0},T={x:x.left,y:x.top};return C.x&&C.y?T:u0(T,C)}}}};function _F(t,e){return!ev(t)||!ev(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Eme(t,e){return!ev(t)||!ev(e)||!_F(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function _me({value:t,label:e,onRemove:n}){const{attributes:r,listeners:s,setNodeRef:i,transform:a,transition:l,isDragging:c}=jme({id:t}),h={transform:d0.Transform.toString(a),transition:l,opacity:c?.5:1};return o.jsx("div",{ref:i,style:h,className:ye("inline-flex items-center gap-1",c&&"shadow-lg"),children:o.jsxs(Ln,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[o.jsx("div",{...r,...s,className:"cursor-grab active:cursor-grabbing flex items-center",children:o.jsx(jK,{className:"h-3 w-3 text-muted-foreground"})}),o.jsx("span",{children:e}),o.jsx(_0,{className:"ml-1 h-3 w-3 cursor-pointer hover:text-destructive",strokeWidth:2,fill:"none",onClick:f=>{f.stopPropagation(),n(t)}})]})})}function Mme({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[a,l]=b.useState(!1),c=rfe(AE(yO,{activationConstraint:{distance:8}}),AE(xO,{coordinateGetter:Tme})),h=g=>{e.includes(g)?n(e.filter(x=>x!==g)):n([...e,g])},f=g=>{n(e.filter(x=>x!==g))},m=g=>{const{active:x,over:y}=g;if(y&&x.id!==y.id){const w=e.indexOf(x.id),S=e.indexOf(y.id);n(bO(e,w,S))}};return o.jsxs(cl,{open:a,onOpenChange:l,children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",role:"combobox","aria-expanded":a,className:ye("w-full justify-between min-h-10 h-auto",i),children:[o.jsx(ime,{sensors:c,collisionDetection:ife,onDragEnd:m,children:o.jsx(vme,{items:e,strategy:gme,children:o.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?o.jsx("span",{className:"text-muted-foreground",children:r}):e.map(g=>{const x=t.find(y=>y.value===g);return o.jsx(_me,{value:g,label:x?.label||g,onRemove:f},g)})})})}),o.jsx(YD,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),o.jsx(so,{className:"w-full p-0",align:"start",children:o.jsxs(aO,{children:[o.jsx(oO,{placeholder:"搜索...",className:"h-9"}),o.jsxs(lO,{children:[o.jsx(cO,{children:s}),o.jsx(uO,{children:t.map(g=>{const x=e.includes(g.value);return o.jsxs(dO,{value:g.value,onSelect:()=>h(g.value),children:[o.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:o.jsx(dc,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),o.jsx("span",{children:g.label})]},g.value)})})]})]})})]})}function Ame(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[a,l]=b.useState(null),[c,h]=b.useState(!0),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(!1),[E,M]=b.useState(null),[q,L]=b.useState(null),[I,$]=b.useState(!1),[V,ee]=b.useState(null),[z,H]=b.useState(""),[P,W]=b.useState(new Set),[J,X]=b.useState(!1),[R,se]=b.useState(1),[G,F]=b.useState(20),[U,te]=b.useState(""),{toast:ne}=Wr(),Y=b.useRef(null),ae=b.useRef(null),re=b.useRef(!0);b.useEffect(()=>{oe()},[]);const oe=async()=>{try{h(!0);const ie=await Zd(),xe=ie.models||[];e(xe),i(xe.map(dt=>dt.name));const Je=ie.api_providers||[];r(Je.map(dt=>dt.name)),l(ie.model_task_config||null),w(!1),re.current=!1}catch(ie){console.error("加载配置失败:",ie)}finally{h(!1)}},_e=async()=>{try{k(!0),Bv().catch(()=>{}),C(!0)}catch(ie){console.error("重启失败:",ie),C(!1),ne({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),k(!1)}},Ge=async()=>{try{m(!0),Y.current&&clearTimeout(Y.current),ae.current&&clearTimeout(ae.current);const ie=await Zd();ie.models=t,ie.model_task_config=a,await T1(ie),w(!1),ne({title:"保存成功",description:"正在重启麦麦..."}),await _e()}catch(ie){console.error("保存配置失败:",ie),ne({title:"保存失败",description:ie.message,variant:"destructive"}),m(!1)}},tt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Xe=()=>{C(!1),k(!1),ne({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},je=b.useCallback(async ie=>{if(!re.current)try{x(!0),await B3("models",ie),w(!1)}catch(xe){console.error("自动保存模型列表失败:",xe),w(!0)}finally{x(!1)}},[]),Qe=b.useCallback(async ie=>{if(!re.current)try{x(!0),await B3("model_task_config",ie),w(!1)}catch(xe){console.error("自动保存任务配置失败:",xe),w(!0)}finally{x(!1)}},[]);b.useEffect(()=>{if(!re.current)return w(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{je(t)},2e3),()=>{Y.current&&clearTimeout(Y.current)}},[t,je]),b.useEffect(()=>{if(!(re.current||!a))return w(!0),ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>{Qe(a)},2e3),()=>{ae.current&&clearTimeout(ae.current)}},[a,Qe]);const He=async()=>{try{m(!0),Y.current&&clearTimeout(Y.current),ae.current&&clearTimeout(ae.current);const ie=await Zd();ie.models=t,ie.model_task_config=a,await T1(ie),w(!1),ne({title:"保存成功",description:"模型配置已保存"}),await oe()}catch(ie){console.error("保存配置失败:",ie),ne({title:"保存失败",description:ie.message,variant:"destructive"})}finally{m(!1)}},$e=(ie,xe)=>{M(ie||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),L(xe),_(!0)},bt=()=>{if(!E)return;const ie={...E,price_in:E.price_in??0,price_out:E.price_out??0};let xe;q!==null?(xe=[...t],xe[q]=ie):xe=[...t,ie],e(xe),i(xe.map(Je=>Je.name)),_(!1),M(null),L(null)},ot=ie=>{if(!ie&&E){const xe={...E,price_in:E.price_in??0,price_out:E.price_out??0};M(xe)}_(ie)},on=ie=>{ee(ie),$(!0)},Tn=()=>{if(V!==null){const ie=t.filter((xe,Je)=>Je!==V);e(ie),i(ie.map(xe=>xe.name)),ne({title:"删除成功",description:"模型已从列表中移除"})}$(!1),ee(null)},Nn=ie=>{const xe=new Set(P);xe.has(ie)?xe.delete(ie):xe.add(ie),W(xe)},Rt=()=>{if(P.size===qe.length)W(new Set);else{const ie=qe.map((xe,Je)=>t.findIndex(dt=>dt===qe[Je]));W(new Set(ie))}},xt=()=>{if(P.size===0){ne({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}X(!0)},Te=()=>{const ie=t.filter((xe,Je)=>!P.has(Je));e(ie),i(ie.map(xe=>xe.name)),W(new Set),X(!1),ne({title:"批量删除成功",description:`已删除 ${P.size} 个模型`})},Re=(ie,xe,Je)=>{a&&l({...a,[ie]:{...a[ie],[xe]:Je}})},qe=t.filter(ie=>{if(!z)return!0;const xe=z.toLowerCase();return ie.name.toLowerCase().includes(xe)||ie.model_identifier.toLowerCase().includes(xe)||ie.api_provider.toLowerCase().includes(xe)}),rt=Math.ceil(qe.length/G),wt=qe.slice((R-1)*G,R*G),jt=()=>{const ie=parseInt(U);ie>=1&&ie<=rt&&(se(ie),te(""))},Ne=ie=>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(Je=>Je.includes(ie)):!1;return c?o.jsx(kn,{className:"h-full",children:o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(me,{onClick:He,disabled:f||g||!y||S,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[o.jsx(Tv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),f?"保存中...":g?"自动保存中...":y?"保存配置":"已保存"]}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs(me,{disabled:f||g||S,size:"sm",className:"flex-1 sm:flex-none",children:[o.jsx(Yk,{className:"mr-2 h-4 w-4"}),S?"重启中...":y?"保存并重启":"重启麦麦"]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认重启麦麦?"}),o.jsxs(fn,{className:"space-y-3",children:[o.jsx("p",{children:y?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(nl,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(wa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(rl,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})]})]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:y?Ge:_e,children:y?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(nl,{children:[o.jsx(wa,{className:"h-4 w-4"}),o.jsxs(rl,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),o.jsxs(ll,{defaultValue:"models",className:"w-full",children:[o.jsxs(ro,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[o.jsx(Jt,{value:"models",children:"添加模型"}),o.jsx(Jt,{value:"tasks",children:"为模型分配功能"})]}),o.jsxs(Pn,{value:"models",className:"space-y-4 mt-0",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[P.size>0&&o.jsxs(me,{onClick:xt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(sn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",P.size,")"]}),o.jsxs(me,{onClick:()=>$e(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(ms,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[o.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索模型名称、标识符或提供商...",value:z,onChange:ie=>H(ie.target.value),className:"pl-9"})]}),z&&o.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qe.length," 个结果"]})]}),o.jsx("div",{className:"md:hidden space-y-3",children:wt.length===0?o.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的模型":"暂无模型配置"}):wt.map((ie,xe)=>{const Je=t.findIndex(er=>er===ie),dt=Ne(ie.name);return o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("h3",{className:"font-semibold text-base",children:ie.name}),o.jsx(Ln,{variant:dt?"default":"secondary",className:dt?"bg-green-600 hover:bg-green-700":"",children:dt?"已使用":"未使用"})]}),o.jsx("p",{className:"text-xs text-muted-foreground break-all",title:ie.model_identifier,children:ie.model_identifier})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>$e(ie,Je),children:[o.jsx(hh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(me,{size:"sm",onClick:()=>on(Je),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),o.jsx("p",{className:"font-medium",children:ie.api_provider})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),o.jsx("p",{className:"font-medium",children:ie.force_stream_mode?"是":"否"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),o.jsxs("p",{className:"font-medium",children:["¥",ie.price_in,"/M"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),o.jsxs("p",{className:"font-medium",children:["¥",ie.price_out,"/M"]})]})]})]},xe)})}),o.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(Qh,{children:[o.jsx(Hh,{children:o.jsxs(fs,{children:[o.jsx(en,{className:"w-12",children:o.jsx(ri,{checked:P.size===qe.length&&qe.length>0,onCheckedChange:Rt})}),o.jsx(en,{className:"w-24",children:"使用状态"}),o.jsx(en,{children:"模型名称"}),o.jsx(en,{children:"模型标识符"}),o.jsx(en,{children:"提供商"}),o.jsx(en,{className:"text-right",children:"输入价格"}),o.jsx(en,{className:"text-right",children:"输出价格"}),o.jsx(en,{className:"text-center",children:"强制流式"}),o.jsx(en,{className:"text-right",children:"操作"})]})}),o.jsx(Vh,{children:wt.length===0?o.jsx(fs,{children:o.jsx(Lt,{colSpan:9,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的模型":"暂无模型配置"})}):wt.map((ie,xe)=>{const Je=t.findIndex(er=>er===ie),dt=Ne(ie.name);return o.jsxs(fs,{children:[o.jsx(Lt,{children:o.jsx(ri,{checked:P.has(Je),onCheckedChange:()=>Nn(Je)})}),o.jsx(Lt,{children:o.jsx(Ln,{variant:dt?"default":"secondary",className:dt?"bg-green-600 hover:bg-green-700":"",children:dt?"已使用":"未使用"})}),o.jsx(Lt,{className:"font-medium",children:ie.name}),o.jsx(Lt,{className:"max-w-xs truncate",title:ie.model_identifier,children:ie.model_identifier}),o.jsx(Lt,{children:ie.api_provider}),o.jsxs(Lt,{className:"text-right",children:["¥",ie.price_in,"/M"]}),o.jsxs(Lt,{className:"text-right",children:["¥",ie.price_out,"/M"]}),o.jsx(Lt,{className:"text-center",children:ie.force_stream_mode?"是":"否"}),o.jsx(Lt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>$e(ie,Je),children:[o.jsx(hh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(me,{size:"sm",onClick:()=>on(Je),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},xe)})})]})})}),qe.length>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Dt,{value:G.toString(),onValueChange:ie=>{F(parseInt(ie)),se(1),W(new Set)},children:[o.jsx(Mt,{id:"page-size-model",className:"w-20",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"10",children:"10"}),o.jsx(ze,{value:"20",children:"20"}),o.jsx(ze,{value:"50",children:"50"}),o.jsx(ze,{value:"100",children:"100"})]})]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*G+1," 到"," ",Math.min(R*G,qe.length)," 条,共 ",qe.length," 条"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>se(1),disabled:R===1,className:"hidden sm:flex",children:o.jsx(M0,{className:"h-4 w-4"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>se(ie=>Math.max(1,ie-1)),disabled:R===1,children:[o.jsx(Iu,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:U,onChange:ie=>te(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&jt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),o.jsx(me,{variant:"outline",size:"sm",onClick:jt,disabled:!U,className:"h-8",children:"跳转"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>se(ie=>ie+1),disabled:R>=rt,children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Bu,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>se(rt),disabled:R>=rt,className:"hidden sm:flex",children:o.jsx(A0,{className:"h-4 w-4"})})]})]})]}),o.jsxs(Pn,{value:"tasks",className:"space-y-6 mt-0",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),a&&o.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[o.jsx(ga,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:a.utils,modelNames:s,onChange:(ie,xe)=>Re("utils",ie,xe)}),o.jsx(ga,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:a.utils_small,modelNames:s,onChange:(ie,xe)=>Re("utils_small",ie,xe)}),o.jsx(ga,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:a.tool_use,modelNames:s,onChange:(ie,xe)=>Re("tool_use",ie,xe)}),o.jsx(ga,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:a.replyer,modelNames:s,onChange:(ie,xe)=>Re("replyer",ie,xe)}),o.jsx(ga,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:a.planner,modelNames:s,onChange:(ie,xe)=>Re("planner",ie,xe)}),o.jsx(ga,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:a.vlm,modelNames:s,onChange:(ie,xe)=>Re("vlm",ie,xe),hideTemperature:!0}),o.jsx(ga,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:a.voice,modelNames:s,onChange:(ie,xe)=>Re("voice",ie,xe),hideTemperature:!0,hideMaxTokens:!0}),o.jsx(ga,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:a.embedding,modelNames:s,onChange:(ie,xe)=>Re("embedding",ie,xe),hideTemperature:!0,hideMaxTokens:!0}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),o.jsx(ga,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:a.lpmm_entity_extract,modelNames:s,onChange:(ie,xe)=>Re("lpmm_entity_extract",ie,xe)}),o.jsx(ga,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:a.lpmm_rdf_build,modelNames:s,onChange:(ie,xe)=>Re("lpmm_rdf_build",ie,xe)}),o.jsx(ga,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:a.lpmm_qa,modelNames:s,onChange:(ie,xe)=>Re("lpmm_qa",ie,xe)})]})]})]})]}),o.jsx(zr,{open:T,onOpenChange:ot,children:o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:q!==null?"编辑模型":"添加模型"}),o.jsx(ps,{children:"配置模型的基本信息和参数"})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"model_name",children:"模型名称 *"}),o.jsx(Pe,{id:"model_name",value:E?.name||"",onChange:ie=>M(xe=>xe?{...xe,name:ie.target.value}:null),placeholder:"例如: qwen3-30b"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"model_identifier",children:"模型标识符 *"}),o.jsx(Pe,{id:"model_identifier",value:E?.model_identifier||"",onChange:ie=>M(xe=>xe?{...xe,model_identifier:ie.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"api_provider",children:"API 提供商 *"}),o.jsxs(Dt,{value:E?.api_provider||"",onValueChange:ie=>M(xe=>xe?{...xe,api_provider:ie}:null),children:[o.jsx(Mt,{id:"api_provider",children:o.jsx(zt,{placeholder:"选择提供商"})}),o.jsx(At,{children:n.map(ie=>o.jsx(ze,{value:ie,children:ie},ie))})]})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),o.jsx(Pe,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:ie=>{const xe=ie.target.value===""?null:parseFloat(ie.target.value);M(Je=>Je?{...Je,price_in:xe}:null)},placeholder:"默认: 0"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),o.jsx(Pe,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:ie=>{const xe=ie.target.value===""?null:parseFloat(ie.target.value);M(Je=>Je?{...Je,price_out:xe}:null)},placeholder:"默认: 0"})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:ie=>M(xe=>xe?{...xe,force_stream_mode:ie}:null)}),o.jsx(de,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>_(!1),children:"取消"}),o.jsx(me,{onClick:bt,children:"保存"})]})]})}),o.jsx(jn,{open:I,onOpenChange:$,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:Tn,children:"删除"})]})]})}),o.jsx(jn,{open:J,onOpenChange:X,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认批量删除"}),o.jsxs(fn,{children:["确定要删除选中的 ",P.size," 个模型吗? 此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:Te,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),N&&o.jsx(p6,{onRestartComplete:tt,onRestartFailed:Xe})]})})}function ga({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:a=!1}){const l=c=>{s("model_list",c)};return o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"模型列表"}),o.jsx(Mme,{options:r.map(c=>({label:c,value:c})),selected:n.model_list||[],onChange:l,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{children:"温度"}),o.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:c=>{const h=parseFloat(c.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),o.jsx(B0,{value:[n.temperature??.3],onValueChange:c=>s("temperature",c[0]),min:0,max:1,step:.1,className:"w-full"})]}),!a&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"最大 Token"}),o.jsx(Pe,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:c=>s("max_tokens",parseInt(c.target.value))})]})]})]})]})}const ly="/api/webui/config";async function Rme(){const e=await(await mt(`${ly}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function VE(t){const n=await(await mt(`${ly}/adapter-config/path`,{method:"POST",headers:Nt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function UE(t){const n=await(await mt(`${ly}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function WE(t,e){const r=await(await mt(`${ly}/adapter-config`,{method:"POST",headers:Nt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Si={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"}},Ww={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:fh},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"./docker-config/adapters/config.toml",icon:NK}};function Dme(){const[t,e]=b.useState("upload"),[n,r]=b.useState(null),[s,i]=b.useState(""),[a,l]=b.useState(""),[c,h]=b.useState("oneclick"),[f,m]=b.useState(""),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(null),E=b.useRef(null),{toast:M}=Wr(),q=b.useRef(null),L=Y=>{if(!Y.trim())return{valid:!1,error:"路径不能为空"};if(!Y.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const ae=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,re=/^(\/|~\/).+\.toml$/i,oe=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,_e=ae.test(Y),Ge=re.test(Y),tt=oe.test(Y);return!_e&&!Ge&&!tt?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(Y)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}},I=Y=>{if(l(Y),Y.trim()){const ae=L(Y);m(ae.error)}else m("")},$=b.useCallback(async Y=>{const ae=Ww[Y];w(!0);try{const re=await UE(ae.path),oe=G(re);r(oe),h(Y),l(ae.path),await VE(ae.path),M({title:"加载成功",description:`已从${ae.name}预设加载配置`})}catch(re){console.error("加载预设配置失败:",re),M({title:"加载失败",description:re instanceof Error?re.message:"无法读取预设配置文件",variant:"destructive"})}finally{w(!1)}},[M]),V=b.useCallback(async Y=>{const ae=L(Y);if(!ae.valid){m(ae.error),M({title:"路径无效",description:ae.error,variant:"destructive"});return}m(""),w(!0);try{const re=await UE(Y),oe=G(re);r(oe),l(Y),await VE(Y),M({title:"加载成功",description:"已从配置文件加载"})}catch(re){console.error("加载配置失败:",re),M({title:"加载失败",description:re instanceof Error?re.message:"无法读取配置文件",variant:"destructive"})}finally{w(!1)}},[M]);b.useEffect(()=>{(async()=>{try{const ae=await Rme();if(ae&&ae.path){l(ae.path);const re=Object.entries(Ww).find(([,oe])=>oe.path===ae.path);re?(e("preset"),h(re[0]),await $(re[0])):(e("path"),await V(ae.path))}}catch(ae){console.error("加载保存的路径失败:",ae)}})()},[V,$]);const ee=b.useCallback(Y=>{t!=="path"&&t!=="preset"||!a||(q.current&&clearTimeout(q.current),q.current=setTimeout(async()=>{x(!0);try{const ae=F(Y);await WE(a,ae),M({title:"自动保存成功",description:"配置已保存到文件"})}catch(ae){console.error("自动保存失败:",ae),M({title:"自动保存失败",description:ae instanceof Error?ae.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},1e3))},[t,a,M]),z=async()=>{if(!n||!a)return;const Y=L(a);if(!Y.valid){M({title:"保存失败",description:Y.error,variant:"destructive"});return}x(!0);try{const ae=F(n);await WE(a,ae),M({title:"保存成功",description:"配置已保存到文件"})}catch(ae){console.error("保存失败:",ae),M({title:"保存失败",description:ae instanceof Error?ae.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},H=async()=>{a&&await V(a)},P=Y=>{if(Y!==t){if(n){_(Y),k(!0);return}W(Y)}},W=Y=>{r(null),i(""),m(""),e(Y),Y==="preset"&&$("oneclick"),M({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[Y]})},J=()=>{T&&(W(T),_(null)),k(!1)},X=()=>{if(n){C(!0);return}R()},R=()=>{l(""),r(null),m(""),M({title:"已清空",description:"路径和配置已清空"})},se=()=>{R(),C(!1)},G=Y=>{const ae=JSON.parse(JSON.stringify(Si)),re=Y.split(`
`);let oe="";for(const _e of re){const Ge=_e.trim();if(!Ge||Ge.startsWith("#"))continue;const tt=Ge.match(/^\[(\w+)\]/);if(tt){oe=tt[1];continue}const Xe=Ge.match(/^(\w+)\s*=\s*(.+)$/);if(Xe&&oe){const[,je,Qe]=Xe;let He=Qe.trim();const $e=He.match(/^("[^"]*")/);if($e)He=$e[1];else{const ot=He.indexOf("#");ot!==-1&&(He=He.substring(0,ot).trim())}let bt;if(He==="true")bt=!0;else if(He==="false")bt=!1;else if(He.startsWith("[")&&He.endsWith("]")){const ot=He.slice(1,-1).trim();if(ot){const on=ot.split(",").map(Nn=>{const Rt=Nn.trim();return isNaN(Number(Rt))?Rt.replace(/"/g,""):Number(Rt)}),Tn=typeof on[0];bt=on.every(Nn=>typeof Nn===Tn)?on:on.filter(Nn=>typeof Nn=="number")}else bt=[]}else He.startsWith('"')&&He.endsWith('"')?bt=He.slice(1,-1):isNaN(Number(He))?bt=He.replace(/"/g,""):bt=Number(He);if(oe in ae){const ot=ae[oe];ot[je]=bt}}}return ae},F=Y=>{const ae=[],re=(oe,_e)=>oe===""||oe===null||oe===void 0?_e:oe;return ae.push("[inner]"),ae.push(`version = "${re(Y.inner.version,Si.inner.version)}" # 版本号`),ae.push("# 请勿修改版本号,除非你知道自己在做什么"),ae.push(""),ae.push("[nickname] # 现在没用"),ae.push(`nickname = "${re(Y.nickname.nickname,Si.nickname.nickname)}"`),ae.push(""),ae.push("[napcat_server] # Napcat连接的ws服务设置"),ae.push(`host = "${re(Y.napcat_server.host,Si.napcat_server.host)}" # Napcat设定的主机地址`),ae.push(`port = ${re(Y.napcat_server.port||0,Si.napcat_server.port)} # Napcat设定的端口`),ae.push(`token = "${re(Y.napcat_server.token,Si.napcat_server.token)}" # Napcat设定的访问令牌若无则留空`),ae.push(`heartbeat_interval = ${re(Y.napcat_server.heartbeat_interval||0,Si.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同按秒计`),ae.push(""),ae.push("[maibot_server] # 连接麦麦的ws服务设置"),ae.push(`host = "${re(Y.maibot_server.host,Si.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址即HOST字段`),ae.push(`port = ${re(Y.maibot_server.port||0,Si.maibot_server.port)} # 麦麦在.env文件中设置的端口即PORT字段`),ae.push(""),ae.push("[chat] # 黑白名单功能"),ae.push(`group_list_type = "${re(Y.chat.group_list_type,Si.chat.group_list_type)}" # 群组名单类型可选为whitelist, blacklist`),ae.push(`group_list = [${Y.chat.group_list.join(", ")}] # 群组名单`),ae.push("# 当group_list_type为whitelist时只有群组名单中的群组可以聊天"),ae.push("# 当group_list_type为blacklist时群组名单中的任何群组无法聊天"),ae.push(`private_list_type = "${re(Y.chat.private_list_type,Si.chat.private_list_type)}" # 私聊名单类型可选为whitelist, blacklist`),ae.push(`private_list = [${Y.chat.private_list.join(", ")}] # 私聊名单`),ae.push("# 当private_list_type为whitelist时只有私聊名单中的用户可以聊天"),ae.push("# 当private_list_type为blacklist时私聊名单中的任何用户无法聊天"),ae.push(`ban_user_id = [${Y.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),ae.push(`ban_qq_bot = ${Y.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),ae.push(`enable_poke = ${Y.chat.enable_poke} # 是否启用戳一戳功能`),ae.push(""),ae.push("[voice] # 发送语音设置"),ae.push(`use_tts = ${Y.voice.use_tts} # 是否使用tts语音请确保你配置了tts并有对应的adapter`),ae.push(""),ae.push("[debug]"),ae.push(`level = "${re(Y.debug.level,Si.debug.level)}" # 日志等级DEBUG, INFO, WARNING, ERROR, CRITICAL`),ae.join(`
`)},U=Y=>{const ae=Y.target.files?.[0];if(!ae)return;const re=new FileReader;re.onload=oe=>{try{const _e=oe.target?.result,Ge=G(_e);r(Ge),i(ae.name),M({title:"上传成功",description:`已加载配置文件:${ae.name}`})}catch(_e){console.error("解析配置文件失败:",_e),M({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},re.readAsText(ae)},te=()=>{if(!n)return;const Y=F(n),ae=new Blob([Y],{type:"text/plain;charset=utf-8"}),re=URL.createObjectURL(ae),oe=document.createElement("a");oe.href=re,oe.download=s||"config.toml",document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),URL.revokeObjectURL(re),M({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},ne=()=>{r(JSON.parse(JSON.stringify(Si))),i("config.toml"),M({title:"已加载默认配置",description:"可以开始编辑配置"})};return o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"工作模式"}),o.jsx(Fr,{children:"选择配置文件的管理方式"})]}),o.jsxs(An,{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[o.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>P("preset"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(fh,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),o.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:()=>P("upload"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(_C,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),o.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:()=>P("path"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(CK,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="preset"&&o.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[o.jsx(de,{className:"text-sm md:text-base",children:"选择部署方式"}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Ww).map(([Y,ae])=>{const re=ae.icon,oe=c===Y;return o.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${oe?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{h(Y),$(Y)},children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h4",{className:"font-semibold text-sm",children:ae.name}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ae.description}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:ae.path})]})]})},Y)})})]}),t==="path"&&o.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs("div",{className:"flex-1 space-y-1",children:[o.jsx(Pe,{id:"config-path",value:a,onChange:Y=>I(Y.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${f?"border-destructive":""}`}),f&&o.jsx("p",{className:"text-xs text-destructive",children:f})]}),o.jsx(me,{onClick:()=>V(a),disabled:y||!a||!!f,className:"w-full sm:w-auto",children:y?o.jsxs(o.Fragment,{children:[o.jsx(Ti,{className:"h-4 w-4 animate-spin mr-2"}),o.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sm:hidden",children:"加载配置"}),o.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),o.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[o.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[o.jsx("span",{children:"路径格式说明"}),o.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),o.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),o.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[o.jsx("div",{children:"C:\\Adapter\\config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),o.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[o.jsx("div",{children:"/opt/adapter/config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),o.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),o.jsxs(nl,{children:[o.jsx(wa,{className:"h-4 w-4"}),o.jsx(rl,{children:t==="preset"?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]}):t==="upload"?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]})})]}),t==="upload"&&!n&&o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[o.jsx("input",{ref:E,type:"file",accept:".toml",className:"hidden",onChange:U}),o.jsxs(me,{onClick:()=>E.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(_C,{className:"mr-2 h-4 w-4"}),"上传配置"]}),o.jsxs(me,{onClick:ne,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(tl,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&o.jsx("div",{className:"flex gap-2",children:o.jsxs(me,{onClick:te,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(yu,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(t==="preset"||t==="path")&&n&&o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs(me,{onClick:z,size:"sm",disabled:g||!!f,className:"w-full sm:w-auto",children:[o.jsx(Tv,{className:"mr-2 h-4 w-4"}),g?"保存中...":"立即保存"]}),o.jsxs(me,{onClick:H,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[o.jsx(Ti,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),t==="path"&&o.jsxs(me,{onClick:X,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(sn,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?o.jsxs(ll,{defaultValue:"napcat",className:"w-full",children:[o.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:o.jsxs(ro,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[o.jsxs(Jt,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),o.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),o.jsxs(Jt,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),o.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),o.jsxs(Jt,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),o.jsx("span",{className:"sm:hidden",children:"聊天"})]}),o.jsxs(Jt,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),o.jsx("span",{className:"sm:hidden",children:"语音"})]}),o.jsx(Jt,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),o.jsx(Pn,{value:"napcat",className:"space-y-4",children:o.jsx(zme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),o.jsx(Pn,{value:"maibot",className:"space-y-4",children:o.jsx(Pme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),o.jsx(Pn,{value:"chat",className:"space-y-4",children:o.jsx(Lme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),o.jsx(Pn,{value:"voice",className:"space-y-4",children:o.jsx(Ime,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),o.jsx(Pn,{value:"debug",className:"space-y-4",children:o.jsx(Bme,{config:n,onChange:Y=>{r(Y),ee(Y)}})})]}):o.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:o.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[o.jsx(tl,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="preset"?"请选择预设的部署方式":t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),o.jsx(jn,{open:S,onOpenChange:k,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认切换模式"}),o.jsxs(fn,{children:["切换模式将清空当前配置,确定要继续吗?",o.jsx("br",{}),o.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),o.jsxs(dn,{children:[o.jsx(pn,{onClick:()=>{k(!1),_(null)},children:"取消"}),o.jsx(mn,{onClick:J,children:"确认切换"})]})]})}),o.jsx(jn,{open:N,onOpenChange:C,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认清空路径"}),o.jsxs(fn,{children:["清空路径将清除当前配置,确定要继续吗?",o.jsx("br",{}),o.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),o.jsxs(dn,{children:[o.jsx(pn,{onClick:()=>C(!1),children:"取消"}),o.jsx(mn,{onClick:se,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function zme({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),o.jsxs("div",{className:"grid gap-3 md:gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),o.jsx(Pe,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),o.jsx(Pe,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌Token"}),o.jsx(Pe,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),o.jsx(Pe,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30"})]})]})]})})}function Pme({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),o.jsxs("div",{className:"grid gap-3 md:gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),o.jsx(Pe,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),o.jsx(Pe,{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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000"})]})]})]})})}function Lme({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 l={...t};i==="group"?l.chat.group_list=l.chat.group_list.filter((c,h)=>h!==a):i==="private"?l.chat.private_list=l.chat.private_list.filter((c,h)=>h!==a):l.chat.ban_user_id=l.chat.ban_user_id.filter((c,h)=>h!==a),e(l)},s=(i,a,l)=>{const c={...t};i==="group"?c.chat.group_list[a]=l:i==="private"?c.chat.private_list[a]=l:c.chat.ban_user_id[a]=l,e(c)};return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),o.jsxs("div",{className:"grid gap-4 md:gap-6",children:[o.jsxs("div",{className:"space-y-3 md:space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-sm md:text-base",children:"群组名单类型"}),o.jsxs(Dt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),o.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsx(de,{className:"text-sm md:text-base",children:"群组列表"}),o.jsxs(me,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(tl,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{type:"number",value:i,onChange:l=>s("group",a,parseInt(l.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r("group",a),children:"删除"})]})]})]})]},a)),t.chat.group_list.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),o.jsxs("div",{className:"space-y-3 md:space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-sm md:text-base",children:"私聊名单类型"}),o.jsxs(Dt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),o.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsx(de,{className:"text-sm md:text-base",children:"私聊列表"}),o.jsxs(me,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(tl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{type:"number",value:i,onChange:l=>s("private",a,parseInt(l.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r("private",a),children:"删除"})]})]})]})]},a)),t.chat.private_list.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-sm md:text-base",children:"全局禁止名单"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),o.jsxs(me,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(tl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{type:"number",value:i,onChange:l=>s("ban",a,parseInt(l.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r("ban",a),children:"删除"})]})]})]})]},a)),t.chat.ban_user_id.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),o.jsx(Tt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),o.jsx(Tt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Ime({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),o.jsx(Tt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Bme({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),o.jsx("div",{className:"grid gap-3 md:gap-4",children:o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-sm md:text-base",children:"日志等级"}),o.jsxs(Dt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"DEBUG",children:"DEBUG调试"}),o.jsx(ze,{value:"INFO",children:"INFO信息"}),o.jsx(ze,{value:"WARNING",children:"WARNING警告"}),o.jsx(ze,{value:"ERROR",children:"ERROR错误"}),o.jsx(ze,{value:"CRITICAL",children:"CRITICAL严重"})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function GE(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 qme(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Fme=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$me=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Qme={};function XE(t,e){return(Qme.jsx?$me:Fme).test(t)}const Hme=/[ \t\n\f\r]/g;function Vme(t){return typeof t=="object"?t.type==="text"?YE(t.value):!1:YE(t)}function YE(t){return t.replace(Hme,"")===""}class rp{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}rp.prototype.normal={};rp.prototype.property={};rp.prototype.space=void 0;function MF(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new rp(n,r,e)}function f0(t){return t.toLowerCase()}class ci{constructor(e,n){this.attribute=n,this.property=e}}ci.prototype.attribute="";ci.prototype.booleanish=!1;ci.prototype.boolean=!1;ci.prototype.commaOrSpaceSeparated=!1;ci.prototype.commaSeparated=!1;ci.prototype.defined=!1;ci.prototype.mustUseProperty=!1;ci.prototype.number=!1;ci.prototype.overloadedBoolean=!1;ci.prototype.property="";ci.prototype.spaceSeparated=!1;ci.prototype.space=void 0;let Ume=0;const qt=qu(),Ar=qu(),HS=qu(),Fe=qu(),Wn=qu(),ah=qu(),ki=qu();function qu(){return 2**++Ume}const VS=Object.freeze(Object.defineProperty({__proto__:null,boolean:qt,booleanish:Ar,commaOrSpaceSeparated:ki,commaSeparated:ah,number:Fe,overloadedBoolean:HS,spaceSeparated:Wn},Symbol.toStringTag,{value:"Module"})),Gw=Object.keys(VS);class wO extends ci{constructor(e,n,r,s){let i=-1;if(super(e,n),KE(this,"space",s),typeof r=="number")for(;++i<Gw.length;){const a=Gw[i];KE(this,Gw[i],(r&VS[a])===VS[a])}}}wO.prototype.defined=!0;function KE(t,e,n){n&&(t[e]=n)}function Xh(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const i=new wO(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),e[r]=i,n[f0(r)]=r,n[f0(i.attribute)]=r}return new rp(e,n,t.space)}const AF=Xh({properties:{ariaActiveDescendant:null,ariaAtomic:Ar,ariaAutoComplete:null,ariaBusy:Ar,ariaChecked:Ar,ariaColCount:Fe,ariaColIndex:Fe,ariaColSpan:Fe,ariaControls:Wn,ariaCurrent:null,ariaDescribedBy:Wn,ariaDetails:null,ariaDisabled:Ar,ariaDropEffect:Wn,ariaErrorMessage:null,ariaExpanded:Ar,ariaFlowTo:Wn,ariaGrabbed:Ar,ariaHasPopup:null,ariaHidden:Ar,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Wn,ariaLevel:Fe,ariaLive:null,ariaModal:Ar,ariaMultiLine:Ar,ariaMultiSelectable:Ar,ariaOrientation:null,ariaOwns:Wn,ariaPlaceholder:null,ariaPosInSet:Fe,ariaPressed:Ar,ariaReadOnly:Ar,ariaRelevant:null,ariaRequired:Ar,ariaRoleDescription:Wn,ariaRowCount:Fe,ariaRowIndex:Fe,ariaRowSpan:Fe,ariaSelected:Ar,ariaSetSize:Fe,ariaSort:null,ariaValueMax:Fe,ariaValueMin:Fe,ariaValueNow:Fe,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function RF(t,e){return e in t?t[e]:e}function DF(t,e){return RF(t,e.toLowerCase())}const Wme=Xh({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ah,acceptCharset:Wn,accessKey:Wn,action:null,allow:null,allowFullScreen:qt,allowPaymentRequest:qt,allowUserMedia:qt,alt:null,as:null,async:qt,autoCapitalize:null,autoComplete:Wn,autoFocus:qt,autoPlay:qt,blocking:Wn,capture:null,charSet:null,checked:qt,cite:null,className:Wn,cols:Fe,colSpan:null,content:null,contentEditable:Ar,controls:qt,controlsList:Wn,coords:Fe|ah,crossOrigin:null,data:null,dateTime:null,decoding:null,default:qt,defer:qt,dir:null,dirName:null,disabled:qt,download:HS,draggable:Ar,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:qt,formTarget:null,headers:Wn,height:Fe,hidden:HS,high:Fe,href:null,hrefLang:null,htmlFor:Wn,httpEquiv:Wn,id:null,imageSizes:null,imageSrcSet:null,inert:qt,inputMode:null,integrity:null,is:null,isMap:qt,itemId:null,itemProp:Wn,itemRef:Wn,itemScope:qt,itemType:Wn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:qt,low:Fe,manifest:null,max:null,maxLength:Fe,media:null,method:null,min:null,minLength:Fe,multiple:qt,muted:qt,name:null,nonce:null,noModule:qt,noValidate:qt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:qt,optimum:Fe,pattern:null,ping:Wn,placeholder:null,playsInline:qt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:qt,referrerPolicy:null,rel:Wn,required:qt,reversed:qt,rows:Fe,rowSpan:Fe,sandbox:Wn,scope:null,scoped:qt,seamless:qt,selected:qt,shadowRootClonable:qt,shadowRootDelegatesFocus:qt,shadowRootMode:null,shape:null,size:Fe,sizes:null,slot:null,span:Fe,spellCheck:Ar,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Fe,step:null,style:null,tabIndex:Fe,target:null,title:null,translate:null,type:null,typeMustMatch:qt,useMap:null,value:Ar,width:Fe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Wn,axis:null,background:null,bgColor:null,border:Fe,borderColor:null,bottomMargin:Fe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:qt,declare:qt,event:null,face:null,frame:null,frameBorder:null,hSpace:Fe,leftMargin:Fe,link:null,longDesc:null,lowSrc:null,marginHeight:Fe,marginWidth:Fe,noResize:qt,noHref:qt,noShade:qt,noWrap:qt,object:null,profile:null,prompt:null,rev:null,rightMargin:Fe,rules:null,scheme:null,scrolling:Ar,standby:null,summary:null,text:null,topMargin:Fe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Fe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:qt,disableRemotePlayback:qt,prefix:null,property:null,results:Fe,security:null,unselectable:null},space:"html",transform:DF}),Gme=Xh({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ki,accentHeight:Fe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Fe,amplitude:Fe,arabicForm:null,ascent:Fe,attributeName:null,attributeType:null,azimuth:Fe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Fe,by:null,calcMode:null,capHeight:Fe,className:Wn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Fe,diffuseConstant:Fe,direction:null,display:null,dur:null,divisor:Fe,dominantBaseline:null,download:qt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Fe,enableBackground:null,end:null,event:null,exponent:Fe,externalResourcesRequired:null,fill:null,fillOpacity:Fe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ah,g2:ah,glyphName:ah,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Fe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Fe,horizOriginX:Fe,horizOriginY:Fe,id:null,ideographic:Fe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Fe,k:Fe,k1:Fe,k2:Fe,k3:Fe,k4:Fe,kernelMatrix:ki,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Fe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Fe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Fe,overlineThickness:Fe,paintOrder:null,panose1:null,path:null,pathLength:Fe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Wn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Fe,pointsAtY:Fe,pointsAtZ:Fe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ki,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ki,rev:ki,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ki,requiredFeatures:ki,requiredFonts:ki,requiredFormats:ki,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Fe,specularExponent:Fe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Fe,strikethroughThickness:Fe,string:null,stroke:null,strokeDashArray:ki,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Fe,strokeOpacity:Fe,strokeWidth:null,style:null,surfaceScale:Fe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ki,tabIndex:Fe,tableValues:null,target:null,targetX:Fe,targetY:Fe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ki,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Fe,underlineThickness:Fe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Fe,values:null,vAlphabetic:Fe,vMathematical:Fe,vectorEffect:null,vHanging:Fe,vIdeographic:Fe,version:null,vertAdvY:Fe,vertOriginX:Fe,vertOriginY:Fe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Fe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:RF}),zF=Xh({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),PF=Xh({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:DF}),LF=Xh({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),Xme={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Yme=/[A-Z]/g,ZE=/-[a-z]/g,Kme=/^data[-\w.:]+$/i;function IF(t,e){const n=f0(e);let r=e,s=ci;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Kme.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(ZE,Jme);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!ZE.test(i)){let a=i.replace(Yme,Zme);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=wO}return new s(r,e)}function Zme(t){return"-"+t.toLowerCase()}function Jme(t){return t.charAt(1).toUpperCase()}const BF=MF([AF,Wme,zF,PF,LF],"html"),cy=MF([AF,Gme,zF,PF,LF],"svg");function JE(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function e0e(t){return t.join(" ").trim()}var jd={},Xw,e_;function t0e(){if(e_)return Xw;e_=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
`,h="/",f="*",m="",g="comment",x="declaration";function y(S,k){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];k=k||{};var N=1,C=1;function T(z){var H=z.match(e);H&&(N+=H.length);var P=z.lastIndexOf(c);C=~P?z.length-P:C+z.length}function _(){var z={line:N,column:C};return function(H){return H.position=new E(z),L(),H}}function E(z){this.start=z,this.end={line:N,column:C},this.source=k.source}E.prototype.content=S;function M(z){var H=new Error(k.source+":"+N+":"+C+": "+z);if(H.reason=z,H.filename=k.source,H.line=N,H.column=C,H.source=S,!k.silent)throw H}function q(z){var H=z.exec(S);if(H){var P=H[0];return T(P),S=S.slice(P.length),H}}function L(){q(n)}function I(z){var H;for(z=z||[];H=$();)H!==!1&&z.push(H);return z}function $(){var z=_();if(!(h!=S.charAt(0)||f!=S.charAt(1))){for(var H=2;m!=S.charAt(H)&&(f!=S.charAt(H)||h!=S.charAt(H+1));)++H;if(H+=2,m===S.charAt(H-1))return M("End of comment missing");var P=S.slice(2,H-2);return C+=2,T(P),S=S.slice(H),C+=2,z({type:g,comment:P})}}function V(){var z=_(),H=q(r);if(H){if($(),!q(s))return M("property missing ':'");var P=q(i),W=z({type:x,property:w(H[0].replace(t,m)),value:P?w(P[0].replace(t,m)):m});return q(a),W}}function ee(){var z=[];I(z);for(var H;H=V();)H!==!1&&(z.push(H),I(z));return z}return L(),ee()}function w(S){return S?S.replace(l,m):m}return Xw=y,Xw}var t_;function n0e(){if(t_)return jd;t_=1;var t=jd&&jd.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(jd,"__esModule",{value:!0}),jd.default=n;const e=t(t0e());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,e.default)(r),l=typeof s=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:h,value:f}=c;l?s(h,f,c):f&&(i=i||{},i[h]=f)}),i}return jd}var nm={},n_;function r0e(){if(n_)return nm;n_=1,Object.defineProperty(nm,"__esModule",{value:!0}),nm.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()},l=function(h,f){return"".concat(f,"-")},c=function(h,f){return f===void 0&&(f={}),i(h)?h:(h=h.toLowerCase(),f.reactCompat?h=h.replace(s,l):h=h.replace(r,l),h.replace(e,a))};return nm.camelCase=c,nm}var rm,r_;function s0e(){if(r_)return rm;r_=1;var t=rm&&rm.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(n0e()),n=r0e();function r(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(l,c){l&&c&&(a[(0,n.camelCase)(l,i)]=c)}),a}return r.default=r,rm=r,rm}var i0e=s0e();const a0e=Mk(i0e),qF=FF("end"),SO=FF("start");function FF(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 o0e(t){const e=SO(t),n=qF(t);if(e&&n)return{start:e,end:n}}function Dm(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?s_(t.position):"start"in t||"end"in t?s_(t):"line"in t||"column"in t?US(t):""}function US(t){return i_(t&&t.line)+":"+i_(t&&t.column)}function s_(t){return US(t&&t.start)+"-"+US(t&&t.end)}function i_(t){return t&&typeof t=="number"?t:1}class Os 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 c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=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=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.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}}Os.prototype.file="";Os.prototype.name="";Os.prototype.reason="";Os.prototype.message="";Os.prototype.stack="";Os.prototype.column=void 0;Os.prototype.line=void 0;Os.prototype.ancestors=void 0;Os.prototype.cause=void 0;Os.prototype.fatal=void 0;Os.prototype.place=void 0;Os.prototype.ruleId=void 0;Os.prototype.source=void 0;const kO={}.hasOwnProperty,l0e=new Map,c0e=/[A-Z]/g,u0e=new Set(["table","tbody","thead","tfoot","tr"]),d0e=new Set(["td","th"]),$F="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function h0e(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=b0e(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=y0e(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"?cy:BF,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=QF(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function QF(t,e,n){if(e.type==="element")return f0e(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return m0e(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return g0e(t,e,n);if(e.type==="mdxjsEsm")return p0e(t,e);if(e.type==="root")return x0e(t,e,n);if(e.type==="text")return v0e(t,e)}function f0e(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=cy,t.schema=s),t.ancestors.push(e);const i=VF(t,e.tagName,!1),a=w0e(t,e);let l=jO(t,e);return u0e.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Vme(c):!0})),HF(t,a,i,e),OO(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function m0e(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)}m0(t,e.position)}function p0e(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);m0(t,e.position)}function g0e(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=cy,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:VF(t,e.name,!0),a=S0e(t,e),l=jO(t,e);return HF(t,a,i,e),OO(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function x0e(t,e,n){const r={};return OO(r,jO(t,e)),t.create(e,t.Fragment,r,n)}function v0e(t,e){return e.value}function HF(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function OO(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function y0e(t,e,n){return r;function r(s,i,a,l){const h=Array.isArray(a.children)?n:e;return l?h(i,a,l):h(i,a)}}function b0e(t,e){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=SO(r);return e(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function w0e(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&kO.call(e.properties,s)){const i=k0e(t,s,e.properties[s]);if(i){const[a,l]=i;t.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&d0e.has(e.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function S0e(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 l=a.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else m0(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 l=r.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else m0(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function jO(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:l0e;for(;++r<e.children.length;){const i=e.children[r];let a;if(t.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const h=s.get(c)||0;a=c+"-"+h,s.set(c,h+1)}}const l=QF(t,i,a);l!==void 0&&n.push(l)}return n}function k0e(t,e,n){const r=IF(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?qme(n):e0e(n)),r.property==="style"){let s=typeof n=="object"?n:O0e(t,String(n));return t.stylePropertyNameCase==="css"&&(s=j0e(s)),["style",s]}return[t.elementAttributeNameCase==="react"&&r.space?Xme[r.property]||r.property:r.attribute,n]}}function O0e(t,e){try{return a0e(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,s=new Os("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=t.filePath||void 0,s.url=$F+"#cannot-parse-style-attribute",s}}function VF(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const s=e.split(".");let i=-1,a;for(;++i<s.length;){const l=XE(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=a}else r=XE(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const s=r.value;return kO.call(t.components,s)?t.components[s]:s}if(t.evaluater)return t.evaluater.evaluateExpression(r);m0(t)}function m0(t,e){const n=new Os("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=$F+"#cannot-handle-mdx-estrees-without-createevaluater",n}function j0e(t){const e={};let n;for(n in t)kO.call(t,n)&&(e[N0e(n)]=t[n]);return e}function N0e(t){let e=t.replace(c0e,C0e);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function C0e(t){return"-"+t.toLowerCase()}const Yw={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},T0e={};function NO(t,e){const n=T0e,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return UF(t,r,s)}function UF(t,e,n){if(E0e(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return a_(t.children,e,n)}return Array.isArray(t)?a_(t,e,n):""}function a_(t,e,n){const r=[];let s=-1;for(;++s<t.length;)r[s]=UF(t[s],e,n);return r.join("")}function E0e(t){return!!(t&&typeof t=="object")}const o_=document.createElement("i");function CO(t){const e="&"+t+";";o_.innerHTML=e;const n=o_.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Ei(t,e,n,r){const s=t.length;let i=0,a;if(e<0?e=-e>s?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);i<r.length;)a=r.slice(i,i+1e4),a.unshift(e,0),t.splice(...a),i+=1e4,e+=1e4}function Wi(t,e){return t.length>0?(Ei(t,t.length,0,e),t):e}const l_={}.hasOwnProperty;function WF(t){const e={};let n=-1;for(;++n<t.length;)_0e(e,t[n]);return e}function _0e(t,e){let n;for(n in e){const s=(l_.call(t,n)?t[n]:void 0)||(t[n]={}),i=e[n];let a;if(i)for(a in i){l_.call(s,a)||(s[a]=[]);const l=i[a];M0e(s[a],Array.isArray(l)?l:l?[l]:[])}}}function M0e(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Ei(t,0,0,r)}function GF(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"<22>":String.fromCodePoint(n)}function Sa(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const _s=Rc(/[A-Za-z]/),Ss=Rc(/[\dA-Za-z]/),A0e=Rc(/[#-'*+\--9=?A-Z^-~]/);function tv(t){return t!==null&&(t<32||t===127)}const WS=Rc(/\d/),R0e=Rc(/[\dA-Fa-f]/),D0e=Rc(/[!-/:-@[-`{-~]/);function ut(t){return t!==null&&t<-2}function Vn(t){return t!==null&&(t<0||t===32)}function Yt(t){return t===-2||t===-1||t===32}const uy=Rc(new RegExp("\\p{P}|\\p{S}","u")),Du=Rc(/\s/);function Rc(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Yh(t){const e=[];let n=-1,r=0,s=0;for(;++n<t.length;){const i=t.charCodeAt(n);let a="";if(i===37&&Ss(t.charCodeAt(n+1))&&Ss(t.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=t.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),s=1):a="<22>"}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 Ut(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Yt(c)?(t.enter(n),l(c)):e(c)}function l(c){return Yt(c)&&i++<s?(t.consume(c),l):(t.exit(n),e(c))}}const z0e={tokenize:P0e};function P0e(t){const e=t.attempt(this.parser.constructs.contentInitial,r,s);let n;return e;function r(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Ut(t,e,"linePrefix")}function s(l){return t.enter("paragraph"),i(l)}function i(l){const c=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(l);return}return ut(l)?(t.consume(l),t.exit("chunkText"),i):(t.consume(l),a)}}const L0e={tokenize:I0e},c_={tokenize:B0e};function I0e(t){const e=this,n=[];let r=0,s,i,a;return l;function l(C){if(r<n.length){const T=n[r];return e.containerState=T[1],t.attempt(T[0].continuation,c,h)(C)}return h(C)}function c(C){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,s&&N();const T=e.events.length;let _=T,E;for(;_--;)if(e.events[_][0]==="exit"&&e.events[_][1].type==="chunkFlow"){E=e.events[_][1].end;break}k(r);let M=T;for(;M<e.events.length;)e.events[M][1].end={...E},M++;return Ei(e.events,_+1,0,e.events.slice(T)),e.events.length=M,h(C)}return l(C)}function h(C){if(r===n.length){if(!s)return g(C);if(s.currentConstruct&&s.currentConstruct.concrete)return y(C);e.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(c_,f,m)(C)}function f(C){return s&&N(),k(r),g(C)}function m(C){return e.parser.lazy[e.now().line]=r!==n.length,a=e.now().offset,y(C)}function g(C){return e.containerState={},t.attempt(c_,x,y)(C)}function x(C){return r++,n.push([e.currentConstruct,e.containerState]),g(C)}function y(C){if(C===null){s&&N(),k(0),t.consume(C);return}return s=s||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),w(C)}function w(C){if(C===null){S(t.exit("chunkFlow"),!0),k(0),t.consume(C);return}return ut(C)?(t.consume(C),S(t.exit("chunkFlow")),r=0,e.interrupt=void 0,l):(t.consume(C),w)}function S(C,T){const _=e.sliceStream(C);if(T&&_.push(null),C.previous=i,i&&(i.next=C),i=C,s.defineSkip(C.start),s.write(_),e.parser.lazy[C.start.line]){let E=s.events.length;for(;E--;)if(s.events[E][1].start.offset<a&&(!s.events[E][1].end||s.events[E][1].end.offset>a))return;const M=e.events.length;let q=M,L,I;for(;q--;)if(e.events[q][0]==="exit"&&e.events[q][1].type==="chunkFlow"){if(L){I=e.events[q][1].end;break}L=!0}for(k(r),E=M;E<e.events.length;)e.events[E][1].end={...I},E++;Ei(e.events,q+1,0,e.events.slice(M)),e.events.length=E}}function k(C){let T=n.length;for(;T-- >C;){const _=n[T];e.containerState=_[1],_[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 B0e(t,e,n){return Ut(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Nh(t){if(t===null||Vn(t)||Du(t))return 1;if(uy(t))return 2}function dy(t,e,n){const r=[];let s=-1;for(;++s<t.length;){const i=t[s].resolveAll;i&&!r.includes(i)&&(e=i(e,n),r.push(i))}return e}const GS={name:"attention",resolveAll:q0e,tokenize:F0e};function q0e(t,e){let n=-1,r,s,i,a,l,c,h,f;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;c=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};u_(m,-c),u_(g,c),a={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},i={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},t[r][1].end={...a.start},t[n][1].start={...l.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=Wi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=Wi(h,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),h=Wi(h,dy(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=Wi(h,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,h=Wi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,Ei(t,r-1,n-r+3,h),n=r+h.length-f-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function F0e(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Nh(r);let i;return a;function a(c){return i=c,t.enter("attentionSequence"),l(c)}function l(c){if(c===i)return t.consume(c),l;const h=t.exit("attentionSequence"),f=Nh(c),m=!f||f===2&&s||n.includes(c),g=!s||s===2&&f||n.includes(r);return h._open=!!(i===42?m:m&&(s||!g)),h._close=!!(i===42?g:g&&(f||!m)),e(c)}}function u_(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const $0e={name:"autolink",tokenize:Q0e};function Q0e(t,e,n){let r=0;return s;function s(x){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(x){return _s(x)?(t.consume(x),a):x===64?n(x):h(x)}function a(x){return x===43||x===45||x===46||Ss(x)?(r=1,l(x)):h(x)}function l(x){return x===58?(t.consume(x),r=0,c):(x===43||x===45||x===46||Ss(x))&&r++<32?(t.consume(x),l):(r=0,h(x))}function c(x){return x===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),e):x===null||x===32||x===60||tv(x)?n(x):(t.consume(x),c)}function h(x){return x===64?(t.consume(x),f):A0e(x)?(t.consume(x),h):n(x)}function f(x){return Ss(x)?m(x):n(x)}function m(x){return x===46?(t.consume(x),r=0,f):x===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),e):g(x)}function g(x){if((x===45||Ss(x))&&r++<63){const y=x===45?g:m;return t.consume(x),y}return n(x)}}const sp={partial:!0,tokenize:H0e};function H0e(t,e,n){return r;function r(i){return Yt(i)?Ut(t,s,"linePrefix")(i):s(i)}function s(i){return i===null||ut(i)?e(i):n(i)}}const XF={continuation:{tokenize:U0e},exit:W0e,name:"blockQuote",tokenize:V0e};function V0e(t,e,n){const r=this;return s;function s(a){if(a===62){const l=r.containerState;return l.open||(t.enter("blockQuote",{_container:!0}),l.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),i}return n(a)}function i(a){return Yt(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function U0e(t,e,n){const r=this;return s;function s(a){return Yt(a)?Ut(t,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return t.attempt(XF,e,n)(a)}}function W0e(t){t.exit("blockQuote")}const YF={name:"characterEscape",tokenize:G0e};function G0e(t,e,n){return r;function r(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),s}function s(i){return D0e(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(i)}}const KF={name:"characterReference",tokenize:X0e};function X0e(t,e,n){const r=this;let s=0,i,a;return l;function l(m){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),c}function c(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),h):(t.enter("characterReferenceValue"),i=31,a=Ss,f(m))}function h(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,a=R0e,f):(t.enter("characterReferenceValue"),i=7,a=WS,f(m))}function f(m){if(m===59&&s){const g=t.exit("characterReferenceValue");return a===Ss&&!CO(r.sliceSerialize(g))?n(m):(t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(m)&&s++<i?(t.consume(m),f):n(m)}}const d_={partial:!0,tokenize:K0e},h_={concrete:!0,name:"codeFenced",tokenize:Y0e};function Y0e(t,e,n){const r=this,s={partial:!0,tokenize:_};let i=0,a=0,l;return c;function c(E){return h(E)}function h(E){const M=r.events[r.events.length-1];return i=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,l=E,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),f(E)}function f(E){return E===l?(a++,t.consume(E),f):a<3?n(E):(t.exit("codeFencedFenceSequence"),Yt(E)?Ut(t,m,"whitespace")(E):m(E))}function m(E){return E===null||ut(E)?(t.exit("codeFencedFence"),r.interrupt?e(E):t.check(d_,w,T)(E)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(E))}function g(E){return E===null||ut(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(E)):Yt(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ut(t,x,"whitespace")(E)):E===96&&E===l?n(E):(t.consume(E),g)}function x(E){return E===null||ut(E)?m(E):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),y(E))}function y(E){return E===null||ut(E)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(E)):E===96&&E===l?n(E):(t.consume(E),y)}function w(E){return t.attempt(s,T,S)(E)}function S(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),k}function k(E){return i>0&&Yt(E)?Ut(t,N,"linePrefix",i+1)(E):N(E)}function N(E){return E===null||ut(E)?t.check(d_,w,T)(E):(t.enter("codeFlowValue"),C(E))}function C(E){return E===null||ut(E)?(t.exit("codeFlowValue"),N(E)):(t.consume(E),C)}function T(E){return t.exit("codeFenced"),e(E)}function _(E,M,q){let L=0;return I;function I(H){return E.enter("lineEnding"),E.consume(H),E.exit("lineEnding"),$}function $(H){return E.enter("codeFencedFence"),Yt(H)?Ut(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):V(H)}function V(H){return H===l?(E.enter("codeFencedFenceSequence"),ee(H)):q(H)}function ee(H){return H===l?(L++,E.consume(H),ee):L>=a?(E.exit("codeFencedFenceSequence"),Yt(H)?Ut(E,z,"whitespace")(H):z(H)):q(H)}function z(H){return H===null||ut(H)?(E.exit("codeFencedFence"),M(H)):q(H)}}}function K0e(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 Kw={name:"codeIndented",tokenize:J0e},Z0e={partial:!0,tokenize:epe};function J0e(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),Ut(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?c(h):ut(h)?t.attempt(Z0e,a,c)(h):(t.enter("codeFlowValue"),l(h))}function l(h){return h===null||ut(h)?(t.exit("codeFlowValue"),a(h)):(t.consume(h),l)}function c(h){return t.exit("codeIndented"),e(h)}}function epe(t,e,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):ut(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):Ut(t,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):ut(a)?s(a):n(a)}}const tpe={name:"codeText",previous:rpe,resolve:npe,tokenize:spe};function npe(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<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)s===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(s=r):(r===e||t[r][1].type==="lineEnding")&&(t[s][1].type="codeTextData",r!==s+2&&(t[s][1].end=t[r-1][1].end,t.splice(s+2,r-s-2),e-=r-s-2,r=s+2),s=void 0);return t}function rpe(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function spe(t,e,n){let r=0,s,i;return a;function a(m){return t.enter("codeText"),t.enter("codeTextSequence"),l(m)}function l(m){return m===96?(t.consume(m),r++,l):(t.exit("codeTextSequence"),c(m))}function c(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),c):m===96?(i=t.enter("codeTextSequence"),s=0,f(m)):ut(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),c):(t.enter("codeTextData"),h(m))}function h(m){return m===null||m===32||m===96||ut(m)?(t.exit("codeTextData"),c(m)):(t.consume(m),h)}function f(m){return m===96?(t.consume(m),s++,f):s===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(i.type="codeTextData",h(m))}}class ipe{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=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 e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.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&&sm(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),sm(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),sm(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<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);sm(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);sm(this.left,n.reverse())}}}function sm(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function ZF(t){const e={};let n=-1,r,s,i,a,l,c,h;const f=new ipe(t);for(;++n<f.length;){for(;n in e;)n=e[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,ape(f,n)),n=e[n],h=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=f.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(f.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...f.get(s)[1].start},l=f.slice(s,n),l.unshift(r),f.splice(s,n-s+1,l))}}return Ei(t,0,Number.POSITIVE_INFINITY,f.slice(0)),!h}function ape(t,e){const n=t.get(e)[1],r=t.get(e)[2];let s=e-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],h={};let f,m,g=-1,x=n,y=0,w=0;const S=[w];for(;x;){for(;t.get(++s)[1]!==x;);i.push(s),x._tokenizer||(f=r.sliceStream(x),x.next||f.push(null),m&&a.defineSkip(x.start),x._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(f),x._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),m=x,x=x.next}for(x=n;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(w=g+1,S.push(w),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(a.events=[],x?(x._tokenizer=void 0,x.previous=void 0):S.pop(),g=S.length;g--;){const k=l.slice(S[g],S[g+1]),N=i.pop();c.push([N,N+k.length-1]),t.splice(N,2,k)}for(c.reverse(),g=-1;++g<c.length;)h[y+c[g][0]]=y+c[g][1],y+=c[g][1]-c[g][0]-1;return h}const ope={resolve:cpe,tokenize:upe},lpe={partial:!0,tokenize:dpe};function cpe(t){return ZF(t),t}function upe(t,e){let n;return r;function r(l){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):ut(l)?t.check(lpe,a,i)(l):(t.consume(l),s)}function i(l){return t.exit("chunkContent"),t.exit("content"),e(l)}function a(l){return t.consume(l),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function dpe(t,e,n){const r=this;return s;function s(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Ut(t,i,"linePrefix")}function i(a){if(a===null||ut(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function JF(t,e,n,r,s,i,a,l,c){const h=c||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||tv(k)?n(k):(t.enter(r),t.enter(a),t.enter(l),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(l),t.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===62?(t.exit("chunkString"),t.exit(l),g(k)):k===null||k===60||ut(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||Vn(k))?(t.exit("chunkString"),t.exit(l),t.exit(a),t.exit(r),e(k)):f<h&&k===40?(t.consume(k),f++,w):k===41?(t.consume(k),f--,w):k===null||k===32||k===40||tv(k)?n(k):(t.consume(k),k===92?S:w)}function S(k){return k===40||k===41||k===92?(t.consume(k),w):w(k)}}function e$(t,e,n,r,s,i){const a=this;let l=0,c;return h;function h(x){return t.enter(r),t.enter(s),t.consume(x),t.exit(s),t.enter(i),f}function f(x){return l>999||x===null||x===91||x===93&&!c||x===94&&!l&&"_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):ut(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||ut(x)||l++>999?(t.exit("chunkString"),f(x)):(t.consume(x),c||(c=!Yt(x)),x===92?g:m)}function g(x){return x===91||x===92||x===93?(t.consume(x),l++,m):m(x)}}function t$(t,e,n,r,s,i){let a;return l;function l(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,c):n(g)}function c(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),c(a)):g===null?n(g):ut(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Ut(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===a||g===null||ut(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 zm(t,e){let n;return r;function r(s){return ut(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):Yt(s)?Ut(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const hpe={name:"definition",tokenize:mpe},fpe={partial:!0,tokenize:ppe};function mpe(t,e,n){const r=this;let s;return i;function i(x){return t.enter("definition"),a(x)}function a(x){return e$.call(r,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function l(x){return s=Sa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),c):n(x)}function c(x){return Vn(x)?zm(t,h)(x):h(x)}function h(x){return JF(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function f(x){return t.attempt(fpe,m,m)(x)}function m(x){return Yt(x)?Ut(t,g,"whitespace")(x):g(x)}function g(x){return x===null||ut(x)?(t.exit("definition"),r.parser.defined.push(s),e(x)):n(x)}}function ppe(t,e,n){return r;function r(l){return Vn(l)?zm(t,s)(l):n(l)}function s(l){return t$(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Yt(l)?Ut(t,a,"whitespace")(l):a(l)}function a(l){return l===null||ut(l)?e(l):n(l)}}const gpe={name:"hardBreakEscape",tokenize:xpe};function xpe(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return ut(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const vpe={name:"headingAtx",resolve:ype,tokenize:bpe};function ype(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"},Ei(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function bpe(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||Vn(f)?(t.exit("atxHeadingSequence"),l(f)):n(f)}function l(f){return f===35?(t.enter("atxHeadingSequence"),c(f)):f===null||ut(f)?(t.exit("atxHeading"),e(f)):Yt(f)?Ut(t,l,"whitespace")(f):(t.enter("atxHeadingText"),h(f))}function c(f){return f===35?(t.consume(f),c):(t.exit("atxHeadingSequence"),l(f))}function h(f){return f===null||f===35||Vn(f)?(t.exit("atxHeadingText"),l(f)):(t.consume(f),h)}}const wpe=["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"],f_=["pre","script","style","textarea"],Spe={concrete:!0,name:"htmlFlow",resolveTo:jpe,tokenize:Npe},kpe={partial:!0,tokenize:Tpe},Ope={partial:!0,tokenize:Cpe};function jpe(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 Npe(t,e,n){const r=this;let s,i,a,l,c;return h;function h(F){return f(F)}function f(F){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(F),m}function m(F){return F===33?(t.consume(F),g):F===47?(t.consume(F),i=!0,w):F===63?(t.consume(F),s=3,r.interrupt?e:R):_s(F)?(t.consume(F),a=String.fromCharCode(F),S):n(F)}function g(F){return F===45?(t.consume(F),s=2,x):F===91?(t.consume(F),s=5,l=0,y):_s(F)?(t.consume(F),s=4,r.interrupt?e:R):n(F)}function x(F){return F===45?(t.consume(F),r.interrupt?e:R):n(F)}function y(F){const U="CDATA[";return F===U.charCodeAt(l++)?(t.consume(F),l===U.length?r.interrupt?e:V:y):n(F)}function w(F){return _s(F)?(t.consume(F),a=String.fromCharCode(F),S):n(F)}function S(F){if(F===null||F===47||F===62||Vn(F)){const U=F===47,te=a.toLowerCase();return!U&&!i&&f_.includes(te)?(s=1,r.interrupt?e(F):V(F)):wpe.includes(a.toLowerCase())?(s=6,U?(t.consume(F),k):r.interrupt?e(F):V(F)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(F):i?N(F):C(F))}return F===45||Ss(F)?(t.consume(F),a+=String.fromCharCode(F),S):n(F)}function k(F){return F===62?(t.consume(F),r.interrupt?e:V):n(F)}function N(F){return Yt(F)?(t.consume(F),N):I(F)}function C(F){return F===47?(t.consume(F),I):F===58||F===95||_s(F)?(t.consume(F),T):Yt(F)?(t.consume(F),C):I(F)}function T(F){return F===45||F===46||F===58||F===95||Ss(F)?(t.consume(F),T):_(F)}function _(F){return F===61?(t.consume(F),E):Yt(F)?(t.consume(F),_):C(F)}function E(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(t.consume(F),c=F,M):Yt(F)?(t.consume(F),E):q(F)}function M(F){return F===c?(t.consume(F),c=null,L):F===null||ut(F)?n(F):(t.consume(F),M)}function q(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||Vn(F)?_(F):(t.consume(F),q)}function L(F){return F===47||F===62||Yt(F)?C(F):n(F)}function I(F){return F===62?(t.consume(F),$):n(F)}function $(F){return F===null||ut(F)?V(F):Yt(F)?(t.consume(F),$):n(F)}function V(F){return F===45&&s===2?(t.consume(F),P):F===60&&s===1?(t.consume(F),W):F===62&&s===4?(t.consume(F),se):F===63&&s===3?(t.consume(F),R):F===93&&s===5?(t.consume(F),X):ut(F)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(kpe,G,ee)(F)):F===null||ut(F)?(t.exit("htmlFlowData"),ee(F)):(t.consume(F),V)}function ee(F){return t.check(Ope,z,G)(F)}function z(F){return t.enter("lineEnding"),t.consume(F),t.exit("lineEnding"),H}function H(F){return F===null||ut(F)?ee(F):(t.enter("htmlFlowData"),V(F))}function P(F){return F===45?(t.consume(F),R):V(F)}function W(F){return F===47?(t.consume(F),a="",J):V(F)}function J(F){if(F===62){const U=a.toLowerCase();return f_.includes(U)?(t.consume(F),se):V(F)}return _s(F)&&a.length<8?(t.consume(F),a+=String.fromCharCode(F),J):V(F)}function X(F){return F===93?(t.consume(F),R):V(F)}function R(F){return F===62?(t.consume(F),se):F===45&&s===2?(t.consume(F),R):V(F)}function se(F){return F===null||ut(F)?(t.exit("htmlFlowData"),G(F)):(t.consume(F),se)}function G(F){return t.exit("htmlFlow"),e(F)}}function Cpe(t,e,n){const r=this;return s;function s(a){return ut(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 Tpe(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(sp,e,n)}}const Epe={name:"htmlText",tokenize:_pe};function _pe(t,e,n){const r=this;let s,i,a;return l;function l(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),c}function c(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),_):R===63?(t.consume(R),C):_s(R)?(t.consume(R),q):n(R)}function h(R){return R===45?(t.consume(R),f):R===91?(t.consume(R),i=0,y):_s(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):ut(R)?(a=m,W(R)):(t.consume(R),m)}function g(R){return R===45?(t.consume(R),x):m(R)}function x(R){return R===62?P(R):R===45?g(R):m(R)}function y(R){const se="CDATA[";return R===se.charCodeAt(i++)?(t.consume(R),i===se.length?w:y):n(R)}function w(R){return R===null?n(R):R===93?(t.consume(R),S):ut(R)?(a=w,W(R)):(t.consume(R),w)}function S(R){return R===93?(t.consume(R),k):w(R)}function k(R){return R===62?P(R):R===93?(t.consume(R),k):w(R)}function N(R){return R===null||R===62?P(R):ut(R)?(a=N,W(R)):(t.consume(R),N)}function C(R){return R===null?n(R):R===63?(t.consume(R),T):ut(R)?(a=C,W(R)):(t.consume(R),C)}function T(R){return R===62?P(R):C(R)}function _(R){return _s(R)?(t.consume(R),E):n(R)}function E(R){return R===45||Ss(R)?(t.consume(R),E):M(R)}function M(R){return ut(R)?(a=M,W(R)):Yt(R)?(t.consume(R),M):P(R)}function q(R){return R===45||Ss(R)?(t.consume(R),q):R===47||R===62||Vn(R)?L(R):n(R)}function L(R){return R===47?(t.consume(R),P):R===58||R===95||_s(R)?(t.consume(R),I):ut(R)?(a=L,W(R)):Yt(R)?(t.consume(R),L):P(R)}function I(R){return R===45||R===46||R===58||R===95||Ss(R)?(t.consume(R),I):$(R)}function $(R){return R===61?(t.consume(R),V):ut(R)?(a=$,W(R)):Yt(R)?(t.consume(R),$):L(R)}function V(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,ee):ut(R)?(a=V,W(R)):Yt(R)?(t.consume(R),V):(t.consume(R),z)}function ee(R){return R===s?(t.consume(R),s=void 0,H):R===null?n(R):ut(R)?(a=ee,W(R)):(t.consume(R),ee)}function z(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Vn(R)?L(R):(t.consume(R),z)}function H(R){return R===47||R===62||Vn(R)?L(R):n(R)}function P(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function W(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),J}function J(R){return Yt(R)?Ut(t,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):X(R)}function X(R){return t.enter("htmlTextData"),a(R)}}const TO={name:"labelEnd",resolveAll:Dpe,resolveTo:zpe,tokenize:Ppe},Mpe={tokenize:Lpe},Ape={tokenize:Ipe},Rpe={tokenize:Bpe};function Dpe(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",e+=s}}return t.length!==n.length&&Ei(t,0,t.length,n),t}function zpe(t,e){let n=t.length,r=0,s,i,a,l;for(;n--;)if(s=t[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;t[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(t[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const c={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},h={type:"label",start:{...t[i][1].start},end:{...t[a][1].end}},f={type:"labelText",start:{...t[i+r+2][1].end},end:{...t[a-2][1].start}};return l=[["enter",c,e],["enter",h,e]],l=Wi(l,t.slice(i+1,i+r+3)),l=Wi(l,[["enter",f,e]]),l=Wi(l,dy(e.parser.constructs.insideSpan.null,t.slice(i+r+4,a-3),e)),l=Wi(l,[["exit",f,e],t[a-2],t[a-1],["exit",h,e]]),l=Wi(l,t.slice(a+1)),l=Wi(l,[["exit",c,e]]),Ei(t,i,t.length,l),t}function Ppe(t,e,n){const r=this;let s=r.events.length,i,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(g){return i?i._inactive?m(g):(a=r.parser.defined.includes(Sa(r.sliceSerialize({start:i.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),c):n(g)}function c(g){return g===40?t.attempt(Mpe,f,a?f:m)(g):g===91?t.attempt(Ape,f,a?h:m)(g):a?f(g):m(g)}function h(g){return t.attempt(Rpe,f,m)(g)}function f(g){return e(g)}function m(g){return i._balanced=!0,n(g)}}function Lpe(t,e,n){return r;function r(m){return t.enter("resource"),t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),s}function s(m){return Vn(m)?zm(t,i)(m):i(m)}function i(m){return m===41?f(m):JF(t,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function a(m){return Vn(m)?zm(t,c)(m):f(m)}function l(m){return n(m)}function c(m){return m===34||m===39||m===40?t$(t,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):f(m)}function h(m){return Vn(m)?zm(t,f)(m):f(m)}function f(m){return m===41?(t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e):n(m)}}function Ipe(t,e,n){const r=this;return s;function s(l){return e$.call(r,t,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Sa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(l):n(l)}function a(l){return n(l)}}function Bpe(t,e,n){return r;function r(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),s}function s(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):n(i)}}const qpe={name:"labelStartImage",resolveAll:TO.resolveAll,tokenize:Fpe};function Fpe(t,e,n){const r=this;return s;function s(l){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(l),t.exit("labelImageMarker"),i}function i(l){return l===91?(t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):e(l)}}const $pe={name:"labelStartLink",resolveAll:TO.resolveAll,tokenize:Qpe};function Qpe(t,e,n){const r=this;return s;function s(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const Zw={name:"lineEnding",tokenize:Hpe};function Hpe(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Ut(t,e,"linePrefix")}}const h1={name:"thematicBreak",tokenize:Vpe};function Vpe(t,e,n){let r=0,s;return i;function i(h){return t.enter("thematicBreak"),a(h)}function a(h){return s=h,l(h)}function l(h){return h===s?(t.enter("thematicBreakSequence"),c(h)):r>=3&&(h===null||ut(h))?(t.exit("thematicBreak"),e(h)):n(h)}function c(h){return h===s?(t.consume(h),r++,c):(t.exit("thematicBreakSequence"),Yt(h)?Ut(t,l,"whitespace")(h):l(h))}}const Ws={continuation:{tokenize:Xpe},exit:Kpe,name:"list",tokenize:Gpe},Upe={partial:!0,tokenize:Zpe},Wpe={partial:!0,tokenize:Ype};function Gpe(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 l;function l(x){const y=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:WS(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(h1,n,h)(x):h(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(x)}return n(x)}function c(x){return WS(x)&&++a<10?(t.consume(x),c):(!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(sp,r.interrupt?n:f,t.attempt(Upe,g,m))}function f(x){return r.containerState.initialBlankLine=!0,i++,g(x)}function m(x){return Yt(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 Xpe(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(sp,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ut(t,e,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Yt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Wpe,e,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ut(t,t.attempt(Ws,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Ype(t,e,n){const r=this;return Ut(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 Kpe(t){t.exit(this.containerState.type)}function Zpe(t,e,n){const r=this;return Ut(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!Yt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const m_={name:"setextUnderline",resolveTo:Jpe,tokenize:ege};function Jpe(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 ege(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"),l(h)}function l(h){return h===s?(t.consume(h),l):(t.exit("setextHeadingLineSequence"),Yt(h)?Ut(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||ut(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const tge={tokenize:nge};function nge(t){const e=this,n=t.attempt(sp,r,t.attempt(this.parser.constructs.flowInitial,s,Ut(t,t.attempt(this.parser.constructs.flow,s,t.attempt(ope,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 rge={resolveAll:r$()},sge=n$("string"),ige=n$("text");function n$(t){return{resolveAll:r$(t==="text"?age:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,a,l);return a;function a(f){return h(f)?i(f):l(f)}function l(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return h(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function h(f){if(f===null)return!0;const m=s[f];let g=-1;if(m)for(;++g<m.length;){const x=m[g];if(!x.previous||x.previous.call(r,r.previous))return!0}return!1}}}function r$(t){return e;function e(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return t?t(n,r):n}}function age(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],s=e.sliceStream(r);let i=s.length,a=-1,l=0,c;for(;i--;){const h=s[i];if(typeof h=="string"){for(a=h.length;h.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(h===-2)c=!0,l++;else if(h!==-1){i++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(l=0),l){const h={type:n===t.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...h.start},r.start.offset===r.end.offset?Object.assign(r,h):(t.splice(n,0,["enter",h,e],["exit",h,e]),n+=2)}n++}return t}const oge={42:Ws,43:Ws,45:Ws,48:Ws,49:Ws,50:Ws,51:Ws,52:Ws,53:Ws,54:Ws,55:Ws,56:Ws,57:Ws,62:XF},lge={91:hpe},cge={[-2]:Kw,[-1]:Kw,32:Kw},uge={35:vpe,42:h1,45:[m_,h1],60:Spe,61:m_,95:h1,96:h_,126:h_},dge={38:KF,92:YF},hge={[-5]:Zw,[-4]:Zw,[-3]:Zw,33:qpe,38:KF,42:GS,60:[$0e,Epe],91:$pe,92:[gpe,YF],93:TO,95:GS,96:tpe},fge={null:[GS,rge]},mge={null:[42,95]},pge={null:[]},gge=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:mge,contentInitial:lge,disable:pge,document:oge,flow:uge,flowInitial:cge,insideSpan:fge,string:dge,text:hge},Symbol.toStringTag,{value:"Module"}));function xge(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let a=[],l=[];const c={attempt:M(_),check:M(E),consume:N,enter:C,exit:T,interrupt:M(E,{interrupt:!0})},h={code:null,containerState:{},defineSkip:w,events:[],now:y,parser:t,previous:null,sliceSerialize:g,sliceStream:x,write:m};let f=e.tokenize.call(h,c);return e.resolveAll&&i.push(e),h;function m($){return a=Wi(a,$),S(),a[a.length-1]!==null?[]:(q(e,0),h.events=dy(i,h.events,h),h.events)}function g($,V){return yge(x($),V)}function x($){return vge(a,$)}function y(){const{_bufferIndex:$,_index:V,line:ee,column:z,offset:H}=r;return{_bufferIndex:$,_index:V,line:ee,column:z,offset:H}}function w($){s[$.line]=$.column,I()}function S(){let $;for(;r._index<a.length;){const V=a[r._index];if(typeof V=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<V.length;)k(V.charCodeAt(r._bufferIndex));else k(V)}}function k($){f=f($)}function N($){ut($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,I()):$!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=$}function C($,V){const ee=V||{};return ee.type=$,ee.start=y(),h.events.push(["enter",ee,h]),l.push(ee),ee}function T($){const V=l.pop();return V.end=y(),h.events.push(["exit",V,h]),V}function _($,V){q($,V.from)}function E($,V){V.restore()}function M($,V){return ee;function ee(z,H,P){let W,J,X,R;return Array.isArray(z)?G(z):"tokenize"in z?G([z]):se(z);function se(ne){return Y;function Y(ae){const re=ae!==null&&ne[ae],oe=ae!==null&&ne.null,_e=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(oe)?oe:oe?[oe]:[]];return G(_e)(ae)}}function G(ne){return W=ne,J=0,ne.length===0?P:F(ne[J])}function F(ne){return Y;function Y(ae){return R=L(),X=ne,ne.partial||(h.currentConstruct=ne),ne.name&&h.parser.constructs.disable.null.includes(ne.name)?te():ne.tokenize.call(V?Object.assign(Object.create(h),V):h,c,U,te)(ae)}}function U(ne){return $(X,R),H}function te(ne){return R.restore(),++J<W.length?F(W[J]):P}}}function q($,V){$.resolveAll&&!i.includes($)&&i.push($),$.resolve&&Ei(h.events,V,h.events.length-V,$.resolve(h.events.slice(V),h)),$.resolveTo&&(h.events=$.resolveTo(h.events,h))}function L(){const $=y(),V=h.previous,ee=h.currentConstruct,z=h.events.length,H=Array.from(l);return{from:z,restore:P};function P(){r=$,h.previous=V,h.currentConstruct=ee,h.events.length=z,l=H,I()}}function I(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function vge(t,e){const n=e.start._index,r=e.start._bufferIndex,s=e.end._index,i=e.end._bufferIndex;let a;if(n===s)a=[t[n].slice(r,i)];else{if(a=t.slice(n,s),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function yge(t,e){let n=-1;const r=[];let s;for(;++n<t.length;){const i=t[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
`;break}case-3:{a=`\r
`;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,r.push(a)}return r.join("")}function bge(t){const r={constructs:WF([gge,...(t||{}).extensions||[]]),content:s(z0e),defined:[],document:s(L0e),flow:s(tge),lazy:{},string:s(sge),text:s(ige)};return r;function s(i){return a;function a(l){return xge(r,i,l)}}}function wge(t){for(;!ZF(t););return t}const p_=/[\0\t\n\r]/g;function Sge(){let t=1,e="",n=!0,r;return s;function s(i,a,l){const c=[];let h,f,m,g,x;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),m=0,e="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(p_.lastIndex=m,h=p_.exec(i),g=h&&h.index!==void 0?h.index:i.length,x=i.charCodeAt(g),!h){e=i.slice(m);break}if(x===10&&m===g&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),m<g&&(c.push(i.slice(m,g)),t+=g-m),x){case 0:{c.push(65533),t++;break}case 9:{for(f=Math.ceil(t/4)*4,c.push(-2);t++<f;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:r=!0,t=1}m=g+1}return l&&(r&&c.push(-5),e&&c.push(e),c.push(null)),c}}const kge=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Oge(t){return t.replace(kge,jge)}function jge(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return GF(n.slice(i?2:1),i?16:10)}return CO(n)||t}const s$={}.hasOwnProperty;function Nge(t,e,n){return typeof e!="string"&&(n=e,e=void 0),Cge(n)(wge(bge(n).document().write(Sge()(t,e,!0))))}function Cge(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(bt),autolinkProtocol:L,autolinkEmail:L,atxHeading:i(je),blockQuote:i(oe),characterEscape:L,characterReference:L,codeFenced:i(_e),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(_e,a),codeText:i(Ge,a),codeTextData:L,data:L,codeFlowValue:L,definition:i(tt),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Xe),hardBreakEscape:i(Qe),hardBreakTrailing:i(Qe),htmlFlow:i(He,a),htmlFlowData:L,htmlText:i(He,a),htmlTextData:L,image:i($e),label:a,link:i(bt),listItem:i(on),listItemValue:g,listOrdered:i(ot,m),listUnordered:i(ot),paragraph:i(Tn),reference:F,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(je),strong:i(Nn),thematicBreak:i(xt)},exit:{atxHeading:c(),atxHeadingSequence:_,autolink:c(),autolinkEmail:re,autolinkProtocol:ae,blockQuote:c(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:ne,characterReference:Y,codeFenced:c(S),codeFencedFence:w,codeFencedFenceInfo:x,codeFencedFenceMeta:y,codeFlowValue:I,codeIndented:c(k),codeText:c(H),codeTextData:I,data:I,definition:c(),definitionDestinationString:T,definitionLabelString:N,definitionTitleString:C,emphasis:c(),hardBreakEscape:c(V),hardBreakTrailing:c(V),htmlFlow:c(ee),htmlFlowData:I,htmlText:c(z),htmlTextData:I,image:c(W),label:X,labelText:J,lineEnding:$,link:c(P),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:U,resourceDestinationString:R,resourceTitleString:se,resource:G,setextHeading:c(q),setextHeadingLineSequence:M,setextHeadingText:E,strong:c(),thematicBreak:c()}};i$(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(Te){let Re={type:"root",children:[]};const qe={stack:[Re],tokenStack:[],config:e,enter:l,exit:h,buffer:a,resume:f,data:n},rt=[];let wt=-1;for(;++wt<Te.length;)if(Te[wt][1].type==="listOrdered"||Te[wt][1].type==="listUnordered")if(Te[wt][0]==="enter")rt.push(wt);else{const jt=rt.pop();wt=s(Te,jt,wt)}for(wt=-1;++wt<Te.length;){const jt=e[Te[wt][0]];s$.call(jt,Te[wt][1].type)&&jt[Te[wt][1].type].call(Object.assign({sliceSerialize:Te[wt][2].sliceSerialize},qe),Te[wt][1])}if(qe.tokenStack.length>0){const jt=qe.tokenStack[qe.tokenStack.length-1];(jt[1]||g_).call(qe,void 0,jt[0])}for(Re.position={start:Yl(Te.length>0?Te[0][1].start:{line:1,column:1,offset:0}),end:Yl(Te.length>0?Te[Te.length-2][1].end:{line:1,column:1,offset:0})},wt=-1;++wt<e.transforms.length;)Re=e.transforms[wt](Re)||Re;return Re}function s(Te,Re,qe){let rt=Re-1,wt=-1,jt=!1,Ne,ie,xe,Je;for(;++rt<=qe;){const dt=Te[rt];switch(dt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{dt[0]==="enter"?wt++:wt--,Je=void 0;break}case"lineEndingBlank":{dt[0]==="enter"&&(Ne&&!Je&&!wt&&!xe&&(xe=rt),Je=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Je=void 0}if(!wt&&dt[0]==="enter"&&dt[1].type==="listItemPrefix"||wt===-1&&dt[0]==="exit"&&(dt[1].type==="listUnordered"||dt[1].type==="listOrdered")){if(Ne){let er=rt;for(ie=void 0;er--;){const pt=Te[er];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;ie&&(Te[ie][1].type="lineEndingBlank",jt=!0),pt[1].type="lineEnding",ie=er}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}xe&&(!ie||xe<ie)&&(Ne._spread=!0),Ne.end=Object.assign({},ie?Te[ie][1].start:dt[1].end),Te.splice(ie||rt,0,["exit",Ne,dt[2]]),rt++,qe++}if(dt[1].type==="listItemPrefix"){const er={type:"listItem",_spread:!1,start:Object.assign({},dt[1].start),end:void 0};Ne=er,Te.splice(rt,0,["enter",er,dt[2]]),rt++,qe++,xe=void 0,Je=!0}}}return Te[Re][1]._spread=jt,qe}function i(Te,Re){return qe;function qe(rt){l.call(this,Te(rt),rt),Re&&Re.call(this,rt)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(Te,Re,qe){this.stack[this.stack.length-1].children.push(Te),this.stack.push(Te),this.tokenStack.push([Re,qe||void 0]),Te.position={start:Yl(Re.start),end:void 0}}function c(Te){return Re;function Re(qe){Te&&Te.call(this,qe),h.call(this,qe)}}function h(Te,Re){const qe=this.stack.pop(),rt=this.tokenStack.pop();if(rt)rt[0].type!==Te.type&&(Re?Re.call(this,Te,rt[0]):(rt[1]||g_).call(this,Te,rt[0]));else throw new Error("Cannot close `"+Te.type+"` ("+Dm({start:Te.start,end:Te.end})+"): its not open");qe.position.end=Yl(Te.end)}function f(){return NO(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function g(Te){if(this.data.expectingFirstListItemValue){const Re=this.stack[this.stack.length-2];Re.start=Number.parseInt(this.sliceSerialize(Te),10),this.data.expectingFirstListItemValue=void 0}}function x(){const Te=this.resume(),Re=this.stack[this.stack.length-1];Re.lang=Te}function y(){const Te=this.resume(),Re=this.stack[this.stack.length-1];Re.meta=Te}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const Te=this.resume(),Re=this.stack[this.stack.length-1];Re.value=Te.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const Te=this.resume(),Re=this.stack[this.stack.length-1];Re.value=Te.replace(/(\r?\n|\r)$/g,"")}function N(Te){const Re=this.resume(),qe=this.stack[this.stack.length-1];qe.label=Re,qe.identifier=Sa(this.sliceSerialize(Te)).toLowerCase()}function C(){const Te=this.resume(),Re=this.stack[this.stack.length-1];Re.title=Te}function T(){const Te=this.resume(),Re=this.stack[this.stack.length-1];Re.url=Te}function _(Te){const Re=this.stack[this.stack.length-1];if(!Re.depth){const qe=this.sliceSerialize(Te).length;Re.depth=qe}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function M(Te){const Re=this.stack[this.stack.length-1];Re.depth=this.sliceSerialize(Te).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function L(Te){const qe=this.stack[this.stack.length-1].children;let rt=qe[qe.length-1];(!rt||rt.type!=="text")&&(rt=Rt(),rt.position={start:Yl(Te.start),end:void 0},qe.push(rt)),this.stack.push(rt)}function I(Te){const Re=this.stack.pop();Re.value+=this.sliceSerialize(Te),Re.position.end=Yl(Te.end)}function $(Te){const Re=this.stack[this.stack.length-1];if(this.data.atHardBreak){const qe=Re.children[Re.children.length-1];qe.position.end=Yl(Te.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Re.type)&&(L.call(this,Te),I.call(this,Te))}function V(){this.data.atHardBreak=!0}function ee(){const Te=this.resume(),Re=this.stack[this.stack.length-1];Re.value=Te}function z(){const Te=this.resume(),Re=this.stack[this.stack.length-1];Re.value=Te}function H(){const Te=this.resume(),Re=this.stack[this.stack.length-1];Re.value=Te}function P(){const Te=this.stack[this.stack.length-1];if(this.data.inReference){const Re=this.data.referenceType||"shortcut";Te.type+="Reference",Te.referenceType=Re,delete Te.url,delete Te.title}else delete Te.identifier,delete Te.label;this.data.referenceType=void 0}function W(){const Te=this.stack[this.stack.length-1];if(this.data.inReference){const Re=this.data.referenceType||"shortcut";Te.type+="Reference",Te.referenceType=Re,delete Te.url,delete Te.title}else delete Te.identifier,delete Te.label;this.data.referenceType=void 0}function J(Te){const Re=this.sliceSerialize(Te),qe=this.stack[this.stack.length-2];qe.label=Oge(Re),qe.identifier=Sa(Re).toLowerCase()}function X(){const Te=this.stack[this.stack.length-1],Re=this.resume(),qe=this.stack[this.stack.length-1];if(this.data.inReference=!0,qe.type==="link"){const rt=Te.children;qe.children=rt}else qe.alt=Re}function R(){const Te=this.resume(),Re=this.stack[this.stack.length-1];Re.url=Te}function se(){const Te=this.resume(),Re=this.stack[this.stack.length-1];Re.title=Te}function G(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function U(Te){const Re=this.resume(),qe=this.stack[this.stack.length-1];qe.label=Re,qe.identifier=Sa(this.sliceSerialize(Te)).toLowerCase(),this.data.referenceType="full"}function te(Te){this.data.characterReferenceType=Te.type}function ne(Te){const Re=this.sliceSerialize(Te),qe=this.data.characterReferenceType;let rt;qe?(rt=GF(Re,qe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):rt=CO(Re);const wt=this.stack[this.stack.length-1];wt.value+=rt}function Y(Te){const Re=this.stack.pop();Re.position.end=Yl(Te.end)}function ae(Te){I.call(this,Te);const Re=this.stack[this.stack.length-1];Re.url=this.sliceSerialize(Te)}function re(Te){I.call(this,Te);const Re=this.stack[this.stack.length-1];Re.url="mailto:"+this.sliceSerialize(Te)}function oe(){return{type:"blockquote",children:[]}}function _e(){return{type:"code",lang:null,meta:null,value:""}}function Ge(){return{type:"inlineCode",value:""}}function tt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Xe(){return{type:"emphasis",children:[]}}function je(){return{type:"heading",depth:0,children:[]}}function Qe(){return{type:"break"}}function He(){return{type:"html",value:""}}function $e(){return{type:"image",title:null,url:"",alt:null}}function bt(){return{type:"link",title:null,url:"",children:[]}}function ot(Te){return{type:"list",ordered:Te.type==="listOrdered",start:null,spread:Te._spread,children:[]}}function on(Te){return{type:"listItem",spread:Te._spread,checked:null,children:[]}}function Tn(){return{type:"paragraph",children:[]}}function Nn(){return{type:"strong",children:[]}}function Rt(){return{type:"text",value:""}}function xt(){return{type:"thematicBreak"}}}function Yl(t){return{line:t.line,column:t.column,offset:t.offset}}function i$(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?i$(t,r):Tge(t,r)}}function Tge(t,e){let n;for(n in e)if(s$.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function g_(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Dm({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Dm({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Dm({start:e.start,end:e.end})+") is still open")}function Ege(t){const e=this;e.parser=n;function n(r){return Nge(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function _ge(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function Mge(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
`}]}function Age(t,e){const n=e.value?e.value+`
`:"",r={};e.lang&&(r.className=["language-"+e.lang]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function Rge(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Dge(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function zge(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),s=Yh(r.toLowerCase()),i=t.footnoteOrder.indexOf(r);let a,l=t.footnoteCounts.get(r);l===void 0?(l=0,t.footnoteOrder.push(r),a=t.footnoteOrder.length):a=i+1,l+=1,t.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const h={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,h),t.applyData(e,h)}function Pge(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 Lge(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function a$(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 Ige(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return a$(t,e);const s={src:Yh(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 Bge(t,e){const n={src:Yh(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 qge(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 Fge(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return a$(t,e);const s={href:Yh(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 $ge(t,e){const n={href:Yh(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 Qge(t,e,n){const r=t.all(e),s=n?Hge(n):o$(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 l=-1;for(;++l<r.length;){const f=r[l];(s||l!==0||f.type!=="element"||f.tagName!=="p")&&a.push({type:"text",value:`
`}),f.type==="element"&&f.tagName==="p"&&!s?a.push(...f.children):a.push(f)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
`});const h={type:"element",tagName:"li",properties:i,children:a};return t.patch(e,h),t.applyData(e,h)}function Hge(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=o$(n[r])}return e}function o$(t){const e=t.spread;return e??t.children.length>1}function Vge(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s<r.length;){const a=r[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,i),t.applyData(e,i)}function Uge(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Wge(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function Gge(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Xge(t,e){const n=t.all(e),r=n.shift(),s=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),s.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=SO(e.children[1]),c=qF(e.children[e.children.length-1]);l&&c&&(a.position={start:l,end:c}),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 Yge(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,l=a?a.length:e.children.length;let c=-1;const h=[];for(;++c<l;){const m=e.children[c],g={},x=a?a[c]:void 0;x&&(g.align=x);let y={type:"element",tagName:i,properties:g,children:[]};m&&(y.children=t.all(m),t.patch(m,y),y=t.applyData(m,y)),h.push(y)}const f={type:"element",tagName:"tr",properties:{},children:t.wrap(h,!0)};return t.patch(e,f),t.applyData(e,f)}function Kge(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const x_=9,v_=32;function Zge(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),s=0;const i=[];for(;r;)i.push(y_(e.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(y_(e.slice(s),s>0,!1)),i.join("")}function y_(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===x_||i===v_;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===x_||i===v_;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function Jge(t,e){const n={type:"text",value:Zge(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function exe(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const txe={blockquote:_ge,break:Mge,code:Age,delete:Rge,emphasis:Dge,footnoteReference:zge,heading:Pge,html:Lge,imageReference:Ige,image:Bge,inlineCode:qge,linkReference:Fge,link:$ge,listItem:Qge,list:Vge,paragraph:Uge,root:Wge,strong:Gge,table:Xge,tableCell:Kge,tableRow:Yge,text:Jge,thematicBreak:exe,toml:bx,yaml:bx,definition:bx,footnoteDefinition:bx};function bx(){}const l$=-1,hy=0,Pm=1,nv=2,EO=3,_O=4,MO=5,AO=6,c$=7,u$=8,b_=typeof self=="object"?self:globalThis,nxe=(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 hy:case l$:return n(a,s);case Pm:{const l=n([],s);for(const c of a)l.push(r(c));return l}case nv:{const l=n({},s);for(const[c,h]of a)l[r(c)]=r(h);return l}case EO:return n(new Date(a),s);case _O:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case MO:{const l=n(new Map,s);for(const[c,h]of a)l.set(r(c),r(h));return l}case AO:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case c$:{const{name:l,message:c}=a;return n(new b_[l](c),s)}case u$: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:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new b_[i](a),s)};return r},w_=t=>nxe(new Map,t)(0),Nd="",{toString:rxe}={},{keys:sxe}=Object,im=t=>{const e=typeof t;if(e!=="object"||!t)return[hy,e];const n=rxe.call(t).slice(8,-1);switch(n){case"Array":return[Pm,Nd];case"Object":return[nv,Nd];case"Date":return[EO,Nd];case"RegExp":return[_O,Nd];case"Map":return[MO,Nd];case"Set":return[AO,Nd];case"DataView":return[Pm,n]}return n.includes("Array")?[Pm,n]:n.includes("Error")?[c$,n]:[nv,n]},wx=([t,e])=>t===hy&&(e==="function"||e==="symbol"),ixe=(t,e,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=im(a);switch(l){case hy:{let f=a;switch(c){case"bigint":l=u$,f=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([l$],a)}return s([l,f],a)}case Pm:{if(c){let g=a;return c==="DataView"?g=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(g=new Uint8Array(a)),s([c,[...g]],a)}const f=[],m=s([l,f],a);for(const g of a)f.push(i(g));return m}case nv:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(e&&"toJSON"in a)return i(a.toJSON());const f=[],m=s([l,f],a);for(const g of sxe(a))(t||!wx(im(a[g])))&&f.push([i(g),i(a[g])]);return m}case EO:return s([l,a.toISOString()],a);case _O:{const{source:f,flags:m}=a;return s([l,{source:f,flags:m}],a)}case MO:{const f=[],m=s([l,f],a);for(const[g,x]of a)(t||!(wx(im(g))||wx(im(x))))&&f.push([i(g),i(x)]);return m}case AO:{const f=[],m=s([l,f],a);for(const g of a)(t||!wx(im(g)))&&f.push(i(g));return m}}const{message:h}=a;return s([l,{name:c,message:h}],a)};return i},S_=(t,{json:e,lossy:n}={})=>{const r=[];return ixe(!(e||n),!!e,new Map,r)(t),r},rv=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?w_(S_(t,e)):structuredClone(t):(t,e)=>w_(S_(t,e));function axe(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 oxe(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function lxe(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||axe,r=t.options.footnoteBackLabel||oxe,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<t.footnoteOrder.length;){const h=t.footnoteById.get(t.footnoteOrder[c]);if(!h)continue;const f=t.all(h),m=String(h.identifier).toUpperCase(),g=Yh(m.toLowerCase());let x=0;const y=[],w=t.footnoteCounts.get(m);for(;w!==void 0&&++x<=w;){y.length>0&&y.push({type:"text",value:" "});let N=typeof n=="string"?n:n(c,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(c,x),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const S=f[f.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const N=S.children[S.children.length-1];N&&N.type==="text"?N.value+=" ":S.children.push({type:"text",value:" "}),S.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),l.push(k)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...rv(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:`
`}]}}const ip=(function(t){if(t==null)return hxe;if(typeof t=="function")return fy(t);if(typeof t=="object")return Array.isArray(t)?cxe(t):uxe(t);if(typeof t=="string")return dxe(t);throw new Error("Expected function, string, or object as test")});function cxe(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=ip(t[n]);return fy(r);function r(...s){let i=-1;for(;++i<e.length;)if(e[i].apply(this,s))return!0;return!1}}function uxe(t){const e=t;return fy(n);function n(r){const s=r;let i;for(i in t)if(s[i]!==e[i])return!1;return!0}}function dxe(t){return fy(e);function e(n){return n&&n.type===t}}function fy(t){return e;function e(n,r,s){return!!(fxe(n)&&t.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function hxe(){return!0}function fxe(t){return t!==null&&typeof t=="object"&&"type"in t}const d$=[],mxe=!0,XS=!1,h$="skip";function RO(t,e,n,r){let s;typeof e=="function"&&typeof n!="function"?(r=n,n=e):s=e;const i=ip(s),a=r?-1:1;l(t,void 0,[])();function l(c,h,f){const m=c&&typeof c=="object"?c:{};if(typeof m.type=="string"){const x=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(c.type+(x?"<"+x+">":""))+")"})}return g;function g(){let x=d$,y,w,S;if((!e||i(c,h,f[f.length-1]||void 0))&&(x=pxe(n(c,f)),x[0]===XS))return x;if("children"in c&&c.children){const k=c;if(k.children&&x[0]!==h$)for(w=(r?k.children.length:-1)+a,S=f.concat(k);w>-1&&w<k.children.length;){const N=k.children[w];if(y=l(N,w,S)(),y[0]===XS)return y;w=typeof y[1]=="number"?y[1]:w+a}}return x}}}function pxe(t){return Array.isArray(t)?t:typeof t=="number"?[mxe,t]:t==null?d$:[t]}function DO(t,e,n,r){let s,i,a;typeof e=="function"&&typeof n!="function"?(i=void 0,a=e,s=n):(i=e,a=n,s=r),RO(t,i,l,s);function l(c,h){const f=h[h.length-1],m=f?f.children.indexOf(c):void 0;return a(c,m,f)}}const YS={}.hasOwnProperty,gxe={};function xxe(t,e){const n=e||gxe,r=new Map,s=new Map,i=new Map,a={...txe,...n.handlers},l={all:h,applyData:yxe,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:vxe,wrap:wxe};return DO(t,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const m=f.type==="definition"?r:s,g=String(f.identifier).toUpperCase();m.has(g)||m.set(g,f)}}),l;function c(f,m){const g=f.type,x=l.handlers[g];if(YS.call(l.handlers,g)&&x)return x(l,f,m);if(l.options.passThrough&&l.options.passThrough.includes(g)){if("children"in f){const{children:w,...S}=f,k=rv(S);return k.children=l.all(f),k}return rv(f)}return(l.options.unknownHandler||bxe)(l,f,m)}function h(f){const m=[];if("children"in f){const g=f.children;let x=-1;for(;++x<g.length;){const y=l.one(g[x],f);if(y){if(x&&g[x-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=k_(y.value)),!Array.isArray(y)&&y.type==="element")){const w=y.children[0];w&&w.type==="text"&&(w.value=k_(w.value))}Array.isArray(y)?m.push(...y):m.push(y)}}}return m}}function vxe(t,e){t.position&&(e.position=o0e(t))}function yxe(t,e){let n=e;if(t&&t.data){const r=t.data.hName,s=t.data.hChildren,i=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,rv(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function bxe(t,e){const n=e.data||{},r="value"in e&&!(YS.call(n,"hProperties")||YS.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function wxe(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
`});++r<t.length;)r&&n.push({type:"text",value:`
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
`}),n}function k_(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function O_(t,e){const n=xxe(t,e),r=n.one(t,void 0),s=lxe(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
`},s),i}function Sxe(t,e){return t&&"run"in t?async function(n,r){const s=O_(n,{file:r,...e});await t.run(s,r)}:function(n,r){return O_(n,{file:r,...t||e})}}function j_(t){if(t)throw t}var Jw,N_;function kxe(){if(N_)return Jw;N_=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},l=function(h,f){if(f==="__proto__")if(t.call(h,f)){if(r)return r(h,f).value}else return;return h[f]};return Jw=function c(){var h,f,m,g,x,y,w=arguments[0],S=1,k=arguments.length,N=!1;for(typeof w=="boolean"&&(N=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});S<k;++S)if(h=arguments[S],h!=null)for(f in h)m=l(w,f),g=l(h,f),w!==g&&(N&&g&&(i(g)||(x=s(g)))?(x?(x=!1,y=m&&s(m)?m:[]):y=m&&i(m)?m:{},a(w,{name:f,newValue:c(N,y,g)})):typeof g<"u"&&a(w,{name:f,newValue:g}));return w},Jw}var Oxe=kxe();const e4=Mk(Oxe);function KS(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function jxe(){const t=[],e={run:n,use:r};return e;function n(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...s);function l(c,...h){const f=t[++i];let m=-1;if(c){a(c);return}for(;++m<s.length;)(h[m]===null||h[m]===void 0)&&(h[m]=s[m]);s=h,f?Nxe(f,l)(...h):a(null,...h)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function Nxe(t,e){let n;return r;function r(...a){const l=t.length>a.length;let c;l&&a.push(s);try{c=t.apply(this,a)}catch(h){const f=h;if(l&&n)throw f;return s(f)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,e(a,...l))}function i(a){s(null,a)}}const Qa={basename:Cxe,dirname:Txe,extname:Exe,join:_xe,sep:"/"};function Cxe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ap(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,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(r=s):(l=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function Txe(t){if(ap(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 Exe(t){ap(t);let e=t.length,n=-1,r=0,s=-1,i=0,a;for(;e--;){const l=t.codePointAt(e);if(l===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),l===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 _xe(...t){let e=-1,n;for(;++e<t.length;)ap(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":Mxe(n)}function Mxe(t){ap(t);const e=t.codePointAt(0)===47;let n=Axe(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Axe(t,e){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=t.length;){if(a<t.length)l=t.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),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 l===46&&i>-1?i++:i=-1}return n}function ap(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Rxe={cwd:Dxe};function Dxe(){return"/"}function ZS(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function zxe(t){if(typeof t=="string")t=new URL(t);else if(!ZS(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 Pxe(t)}function Pxe(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(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const t4=["history","path","basename","stem","extname","dirname"];class f${constructor(e){let n;e?ZS(e)?n={path:e}:typeof e=="string"||Lxe(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":Rxe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<t4.length;){const i=t4[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)t4.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Qa.basename(this.path):void 0}set basename(e){r4(e,"basename"),n4(e,"basename"),this.path=Qa.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Qa.dirname(this.path):void 0}set dirname(e){C_(this.basename,"dirname"),this.path=Qa.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Qa.extname(this.path):void 0}set extname(e){if(n4(e,"extname"),C_(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Qa.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){ZS(e)&&(e=zxe(e)),r4(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Qa.basename(this.path,this.extname):void 0}set stem(e){r4(e,"stem"),n4(e,"stem"),this.path=Qa.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const s=this.message(e,n,r);throw s.fatal=!0,s}info(e,n,r){const s=this.message(e,n,r);return s.fatal=void 0,s}message(e,n,r){const s=new Os(e,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function n4(t,e){if(t&&t.includes(Qa.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Qa.sep+"`")}function r4(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function C_(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function Lxe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Ixe=(function(t){const r=this.constructor.prototype,s=r[t],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),Bxe={}.hasOwnProperty;class zO extends Ixe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=jxe()}copy(){const e=new zO;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(e4(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(a4("data",this.frozen),this.namespace[e]=n,this):Bxe.call(this.namespace,e)&&this.namespace[e]||void 0:e?(a4("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(e,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Sx(e),r=this.parser||this.Parser;return s4("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),s4("process",this.parser||this.Parser),i4("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=Sx(e),c=r.parse(l);r.run(c,l,function(f,m,g){if(f||!m||!g)return h(f);const x=m,y=r.stringify(x,g);$xe(y)?g.value=y:g.result=y,h(f,g)});function h(f,m){f||!m?a(f):i?i(m):n(void 0,m)}}}processSync(e){let n=!1,r;return this.freeze(),s4("processSync",this.parser||this.Parser),i4("processSync",this.compiler||this.Compiler),this.process(e,s),E_("processSync","process",n),r;function s(i,a){n=!0,j_(i),r=a}}run(e,n,r){T_(e),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const c=Sx(n);s.run(e,c,h);function h(f,m,g){const x=m||e;f?l(f):a?a(x):r(void 0,x,g)}}}runSync(e,n){let r=!1,s;return this.run(e,n,i),E_("runSync","run",r),s;function i(a,l){j_(a),s=l,r=!0}}stringify(e,n){this.freeze();const r=Sx(n),s=this.compiler||this.Compiler;return i4("stringify",s),T_(e),s(e,r)}use(e,...n){const r=this.attachers,s=this.namespace;if(a4("use",this.frozen),e!=null)if(typeof e=="function")c(e,n);else if(typeof e=="object")Array.isArray(e)?l(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(h){if(typeof h=="function")c(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[f,...m]=h;c(f,m)}else a(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function a(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(h.plugins),h.settings&&(s.settings=e4(!0,s.settings,h.settings))}function l(h){let f=-1;if(h!=null)if(Array.isArray(h))for(;++f<h.length;){const m=h[f];i(m)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function c(h,f){let m=-1,g=-1;for(;++m<r.length;)if(r[m][0]===h){g=m;break}if(g===-1)r.push([h,...f]);else if(f.length>0){let[x,...y]=f;const w=r[g][1];KS(w)&&KS(x)&&(x=e4(!0,w,x)),r[g]=[h,x,...y]}}}}const qxe=new zO().freeze();function s4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function i4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function a4(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 T_(t){if(!KS(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function E_(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Sx(t){return Fxe(t)?t:new f$(t)}function Fxe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function $xe(t){return typeof t=="string"||Qxe(t)}function Qxe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Hxe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",__=[],M_={allowDangerousHtml:!0},Vxe=/^(https?|ircs?|mailto|xmpp)$/i,Uxe=[{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 Wxe(t){const e=Gxe(t),n=Xxe(t);return Yxe(e.runSync(e.parse(n),n),t)}function Gxe(t){const e=t.rehypePlugins||__,n=t.remarkPlugins||__,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...M_}:M_;return qxe().use(Ege).use(n).use(Sxe,r).use(e)}function Xxe(t){const e=t.children||"",n=new f$;return typeof e=="string"&&(n.value=e),n}function Yxe(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||Kxe;for(const f of Uxe)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+Hxe+f.id,void 0);return DO(t,h),h0e(t,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.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 Yw)if(Object.hasOwn(Yw,x)&&Object.hasOwn(f.properties,x)){const y=f.properties[x],w=Yw[x];(w===null||w.includes(f.tagName))&&(f.properties[x]=c(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 l&&f.children?g.children.splice(m,1,...f.children):g.children.splice(m,1),m}}}function Kxe(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||Vxe.test(t.slice(0,e))?t:""}function A_(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 Zxe(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Jxe(t,e,n){const s=ip((n||{}).ignore||[]),i=e1e(e);let a=-1;for(;++a<i.length;)RO(t,"text",l);function l(h,f){let m=-1,g;for(;++m<f.length;){const x=f[m],y=g?g.children:void 0;if(s(x,y?y.indexOf(x):void 0,g))return;g=x}if(g)return c(h,f)}function c(h,f){const m=f[f.length-1],g=i[a][0],x=i[a][1];let y=0;const S=m.children.indexOf(h);let k=!1,N=[];g.lastIndex=0;let C=g.exec(h.value);for(;C;){const T=C.index,_={index:C.index,input:C.input,stack:[...f,h]};let E=x(...C,_);if(typeof E=="string"&&(E=E.length>0?{type:"text",value:E}:void 0),E===!1?g.lastIndex=T+1:(y!==T&&N.push({type:"text",value:h.value.slice(y,T)}),Array.isArray(E)?N.push(...E):E&&N.push(E),y=T+C[0].length,k=!0),!g.global)break;C=g.exec(h.value)}return k?(y<h.value.length&&N.push({type:"text",value:h.value.slice(y)}),m.children.splice(S,1,...N)):N=[h],S+N.length}}function e1e(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const s=n[r];e.push([t1e(s[0]),n1e(s[1])])}return e}function t1e(t){return typeof t=="string"?new RegExp(Zxe(t),"g"):t}function n1e(t){return typeof t=="function"?t:function(){return t}}const o4="phrasing",l4=["autolink","link","image","label"];function r1e(){return{transforms:[u1e],enter:{literalAutolink:i1e,literalAutolinkEmail:c4,literalAutolinkHttp:c4,literalAutolinkWww:c4},exit:{literalAutolink:c1e,literalAutolinkEmail:l1e,literalAutolinkHttp:a1e,literalAutolinkWww:o1e}}}function s1e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:o4,notInConstruct:l4},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:o4,notInConstruct:l4},{character:":",before:"[ps]",after:"\\/",inConstruct:o4,notInConstruct:l4}]}}function i1e(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function c4(t){this.config.enter.autolinkProtocol.call(this,t)}function a1e(t){this.config.exit.autolinkProtocol.call(this,t)}function o1e(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function l1e(t){this.config.exit.autolinkEmail.call(this,t)}function c1e(t){this.exit(t)}function u1e(t){Jxe(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,d1e],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),h1e]],{ignore:["link","linkReference"]})}function d1e(t,e,n,r,s){let i="";if(!m$(s)||(/^w/i.test(e)&&(n=e+n,e="",i="http://"),!f1e(n)))return!1;const a=m1e(n+r);if(!a[0])return!1;const l={type:"link",title:null,url:i+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[l,{type:"text",value:a[1]}]:l}function h1e(t,e,n,r){return!m$(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function f1e(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function m1e(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=A_(t,"(");let i=A_(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 m$(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Du(n)||uy(n))&&(!e||n!==47)}p$.peek=k1e;function p1e(){this.buffer()}function g1e(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function x1e(){this.buffer()}function v1e(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function y1e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Sa(this.sliceSerialize(t)).toLowerCase(),n.label=e}function b1e(t){this.exit(t)}function w1e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Sa(this.sliceSerialize(t)).toLowerCase(),n.label=e}function S1e(t){this.exit(t)}function k1e(){return"["}function p$(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),l(),a(),i+=s.move("]"),i}function O1e(){return{enter:{gfmFootnoteCallString:p1e,gfmFootnoteCall:g1e,gfmFootnoteDefinitionLabelString:x1e,gfmFootnoteDefinition:v1e},exit:{gfmFootnoteCallString:y1e,gfmFootnoteCall:b1e,gfmFootnoteDefinitionLabelString:w1e,gfmFootnoteDefinition:S1e}}}function j1e(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:p$},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const l=i.createTracker(a);let c=l.move("[^");const h=i.enter("footnoteDefinition"),f=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),f(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((e?`
`:" ")+i.indentLines(i.containerFlow(r,l.current()),e?g$:N1e))),h(),c}}function N1e(t,e,n){return e===0?t:g$(t,e,n)}function g$(t,e,n){return(n?"":" ")+t}const C1e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];x$.peek=A1e;function T1e(){return{canContainEols:["delete"],enter:{strikethrough:_1e},exit:{strikethrough:M1e}}}function E1e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:C1e}],handlers:{delete:x$}}}function _1e(t){this.enter({type:"delete",children:[]},t)}function M1e(t){this.exit(t)}function x$(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 A1e(){return"~"}function R1e(t){return t.length}function D1e(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||R1e,i=[],a=[],l=[],c=[];let h=0,f=-1;for(;++f<t.length;){const w=[],S=[];let k=-1;for(t[f].length>h&&(h=t[f].length);++k<t[f].length;){const N=z1e(t[f][k]);if(n.alignDelimiters!==!1){const C=s(N);S[k]=C,(c[k]===void 0||C>c[k])&&(c[k]=C)}w.push(N)}a[f]=w,l[f]=S}let m=-1;if(typeof r=="object"&&"length"in r)for(;++m<h;)i[m]=R_(r[m]);else{const w=R_(r);for(;++m<h;)i[m]=w}m=-1;const g=[],x=[];for(;++m<h;){const w=i[m];let S="",k="";w===99?(S=":",k=":"):w===108?S=":":w===114&&(k=":");let N=n.alignDelimiters===!1?1:Math.max(1,c[m]-S.length-k.length);const C=S+"-".repeat(N)+k;n.alignDelimiters!==!1&&(N=S.length+N+k.length,N>c[m]&&(c[m]=N),x[m]=N),g[m]=C}a.splice(1,0,g),l.splice(1,0,x),f=-1;const y=[];for(;++f<a.length;){const w=a[f],S=l[f];m=-1;const k=[];for(;++m<h;){const N=w[m]||"";let C="",T="";if(n.alignDelimiters!==!1){const _=c[m]-(S[m]||0),E=i[m];E===114?C=" ".repeat(_):E===99?_%2?(C=" ".repeat(_/2+.5),T=" ".repeat(_/2-.5)):(C=" ".repeat(_/2),T=C):T=" ".repeat(_)}n.delimiterStart!==!1&&!m&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||m)&&k.push(" "),n.alignDelimiters!==!1&&k.push(C),k.push(N),n.alignDelimiters!==!1&&k.push(T),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||m!==h-1)&&k.push("|")}y.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return y.join(`
`)}function z1e(t){return t==null?"":String(t)}function R_(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function P1e(t,e,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const a=n.indentLines(n.containerFlow(t,i.current()),L1e);return s(),a}function L1e(t,e,n){return">"+(n?"":" ")+t}function I1e(t,e){return D_(t,e.inConstruct,!0)&&!D_(t,e.notInConstruct,!1)}function D_(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function z_(t,e,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
`&&I1e(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function v$(t,e){const n=String(t);let r=n.indexOf(e),s=r,i=0,a=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>a&&(a=i):i=1,s=r+e.length,r=n.indexOf(e,s);return a}function B1e(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 q1e(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 F1e(t,e,n,r){const s=q1e(n),i=t.value||"",a=s==="`"?"GraveAccent":"Tilde";if(B1e(t,n)){const m=n.enter("codeIndented"),g=n.indentLines(i,$1e);return m(),g}const l=n.createTracker(r),c=s.repeat(Math.max(v$(i,s)+1,3)),h=n.enter("codeFenced");let f=l.move(c);if(t.lang){const m=n.enter(`codeFencedLang${a}`);f+=l.move(n.safe(t.lang,{before:f,after:" ",encode:["`"],...l.current()})),m()}if(t.lang&&t.meta){const m=n.enter(`codeFencedMeta${a}`);f+=l.move(" "),f+=l.move(n.safe(t.meta,{before:f,after:`
`,encode:["`"],...l.current()})),m()}return f+=l.move(`
`),i&&(f+=l.move(i+`
`)),f+=l.move(c),h(),f}function $1e(t,e,n){return(n?"":" ")+t}function PO(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 Q1e(t,e,n,r){const s=PO(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("[");return h+=c.move(n.safe(n.associationId(t),{before:h,after:"]",...c.current()})),h+=c.move("]: "),l(),!t.url||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(l=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":`
`,...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),h+=c.move(" "+s),h+=c.move(n.safe(t.title,{before:h,after:s,...c.current()})),h+=c.move(s),l()),a(),h}function H1e(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 p0(t){return"&#x"+t.toString(16).toUpperCase()+";"}function sv(t,e,n){const r=Nh(t),s=Nh(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}}y$.peek=V1e;function y$(t,e,n,r){const s=H1e(n),i=n.enter("emphasis"),a=n.createTracker(r),l=a.move(s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const h=c.charCodeAt(0),f=sv(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(c=p0(h)+c.slice(1));const m=c.charCodeAt(c.length-1),g=sv(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+p0(m));const x=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},l+c+x}function V1e(t,e,n){return n.options.emphasis||"*"}function U1e(t,e){let n=!1;return DO(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,XS}),!!((!t.depth||t.depth<3)&&NO(t)&&(e.options.setext||n))}function W1e(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(U1e(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),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(a+" ");let h=n.containerPhrasing(t,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(h)&&(h=p0(h.charCodeAt(0))+h.slice(1)),h=h?a+" "+h:a,n.options.closeAtx&&(h+=" "+a),c(),l(),h}b$.peek=G1e;function b$(t){return t.value||""}function G1e(){return"<"}w$.peek=X1e;function w$(t,e,n,r){const s=PO(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("![");return h+=c.move(n.safe(t.alt,{before:h,after:"]",...c.current()})),h+=c.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(l=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":")",...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),h+=c.move(" "+s),h+=c.move(n.safe(t.title,{before:h,after:s,...c.current()})),h+=c.move(s),l()),h+=c.move(")"),a(),h}function X1e(){return"!"}S$.peek=Y1e;function S$(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const h=n.safe(t.alt,{before:c,after:"]",...l.current()});c+=l.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Y1e(){return"!"}k$.peek=K1e;function k$(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<n.unsafe.length;){const a=n.unsafe[i],l=n.compilePattern(a);let c;if(a.atBreak)for(;c=l.exec(r);){let h=c.index;r.charCodeAt(h)===10&&r.charCodeAt(h-1)===13&&h--,r=r.slice(0,h)+" "+r.slice(c.index+1)}}return s+r+s}function K1e(){return"`"}function O$(t,e){const n=NO(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}j$.peek=Z1e;function j$(t,e,n,r){const s=PO(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(O$(t,n)){const f=n.stack;n.stack=[],l=n.enter("autolink");let m=a.move("<");return m+=a.move(n.containerPhrasing(t,{before:m,after:">",...a.current()})),m+=a.move(">"),l(),n.stack=f,m}l=n.enter("link"),c=n.enter("label");let h=a.move("[");return h+=a.move(n.containerPhrasing(t,{before:h,after:"](",...a.current()})),h+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=a.move("<"),h+=a.move(n.safe(t.url,{before:h,after:">",...a.current()})),h+=a.move(">")):(c=n.enter("destinationRaw"),h+=a.move(n.safe(t.url,{before:h,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=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),c()),h+=a.move(")"),l(),h}function Z1e(t,e,n){return O$(t,n)?"<":"["}N$.peek=J1e;function N$(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const h=n.containerPhrasing(t,{before:c,after:"]",...l.current()});c+=l.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function J1e(){return"["}function LO(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 eve(t){const e=LO(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 tve(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 C$(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 nve(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=t.ordered?tve(n):LO(n);const l=t.ordered?a==="."?")":".":eve(n);let c=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&&(c=!0),C$(n)===a&&f){let m=-1;for(;++m<t.children.length;){const g=t.children[m];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=l),n.bulletCurrent=a;const h=n.containerFlow(t,r);return n.bulletLastUsed=a,n.bulletCurrent=i,s(),h}function rve(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function sve(t,e,n,r){const s=rve(n);let i=n.bulletCurrent||LO(n);e&&e.type==="list"&&e.ordered&&(i=(typeof e.start=="number"&&e.start>-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 l=n.createTracker(r);l.move(i+" ".repeat(a-i.length)),l.shift(a);const c=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,l.current()),f);return c(),h;function f(m,g,x){return g?(x?"":" ".repeat(a))+m:(x?i:i+" ".repeat(a-i.length))+m}}function ive(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(t,r);return i(),s(),a}const ave=ip(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ove(t,e,n,r){return(t.children.some(function(a){return ave(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function lve(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}T$.peek=cve;function T$(t,e,n,r){const s=lve(n),i=n.enter("strong"),a=n.createTracker(r),l=a.move(s+s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const h=c.charCodeAt(0),f=sv(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(c=p0(h)+c.slice(1));const m=c.charCodeAt(c.length-1),g=sv(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+p0(m));const x=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},l+c+x}function cve(t,e,n){return n.options.strong||"*"}function uve(t,e,n,r){return n.safe(t.value,r)}function dve(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 hve(t,e,n){const r=(C$(n)+(n.options.ruleSpaces?" ":"")).repeat(dve(n));return n.options.ruleSpaces?r.slice(0,-1):r}const E$={blockquote:P1e,break:z_,code:F1e,definition:Q1e,emphasis:y$,hardBreak:z_,heading:W1e,html:b$,image:w$,imageReference:S$,inlineCode:k$,link:j$,linkReference:N$,list:nve,listItem:sve,paragraph:ive,root:ove,strong:T$,text:uve,thematicBreak:hve};function fve(){return{enter:{table:mve,tableData:P_,tableHeader:P_,tableRow:gve},exit:{codeText:xve,table:pve,tableData:u4,tableHeader:u4,tableRow:u4}}}function mve(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 pve(t){this.exit(t),this.data.inTable=void 0}function gve(t){this.enter({type:"tableRow",children:[]},t)}function u4(t){this.exit(t)}function P_(t){this.enter({type:"tableCell",children:[]},t)}function xve(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,vve));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function vve(t,e){return e==="|"?e:t}function yve(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:c,tableRow:l}};function a(x,y,w,S){return h(f(x,w,S),x.align)}function l(x,y,w,S){const k=m(x,w,S),N=h([k]);return N.slice(0,N.indexOf(`
`))}function c(x,y,w,S){const k=w.enter("tableCell"),N=w.enter("phrasing"),C=w.containerPhrasing(x,{...S,before:i,after:i});return N(),k(),C}function h(x,y){return D1e(x,{align:y,alignDelimiters:r,padding:n,stringLength:s})}function f(x,y,w){const S=x.children;let k=-1;const N=[],C=y.enter("table");for(;++k<S.length;)N[k]=m(S[k],y,w);return C(),N}function m(x,y,w){const S=x.children;let k=-1;const N=[],C=y.enter("tableRow");for(;++k<S.length;)N[k]=c(S[k],x,y,w);return C(),N}function g(x,y,w){let S=E$.inlineCode(x,y,w);return w.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function bve(){return{exit:{taskListCheckValueChecked:L_,taskListCheckValueUnchecked:L_,paragraph:Sve}}}function wve(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:kve}}}function L_(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function Sve(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=e.children;let i=-1,a;for(;++i<s.length;){const l=s[i];if(l.type==="paragraph"){a=l;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function kve(t,e,n,r){const s=t.children[0],i=typeof t.checked=="boolean"&&s&&s.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(a);let c=E$.listItem(t,e,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),c;function h(f){return f+a}}function Ove(){return[r1e(),O1e(),T1e(),fve(),bve()]}function jve(t){return{extensions:[s1e(),j1e(t),E1e(),yve(t),wve()]}}const Nve={tokenize:Ave,partial:!0},_$={tokenize:Rve,partial:!0},M$={tokenize:Dve,partial:!0},A$={tokenize:zve,partial:!0},Cve={tokenize:Pve,partial:!0},R$={name:"wwwAutolink",tokenize:_ve,previous:z$},D$={name:"protocolAutolink",tokenize:Mve,previous:P$},bl={name:"emailAutolink",tokenize:Eve,previous:L$},ho={};function Tve(){return{text:ho}}let ru=48;for(;ru<123;)ho[ru]=bl,ru++,ru===58?ru=65:ru===91&&(ru=97);ho[43]=bl;ho[45]=bl;ho[46]=bl;ho[95]=bl;ho[72]=[bl,D$];ho[104]=[bl,D$];ho[87]=[bl,R$];ho[119]=[bl,R$];function Eve(t,e,n){const r=this;let s,i;return a;function a(m){return!JS(m)||!L$.call(r,r.previous)||IO(r.events)?n(m):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),l(m))}function l(m){return JS(m)?(t.consume(m),l):m===64?(t.consume(m),c):n(m)}function c(m){return m===46?t.check(Cve,f,h)(m):m===45||m===95||Ss(m)?(i=!0,t.consume(m),c):f(m)}function h(m){return t.consume(m),s=!0,c}function f(m){return i&&s&&_s(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(m)):n(m)}}function _ve(t,e,n){const r=this;return s;function s(a){return a!==87&&a!==119||!z$.call(r,r.previous)||IO(r.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Nve,t.attempt(_$,t.attempt(M$,i),n),n)(a))}function i(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function Mve(t,e,n){const r=this;let s="",i=!1;return a;function a(m){return(m===72||m===104)&&P$.call(r,r.previous)&&!IO(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(m),t.consume(m),l):n(m)}function l(m){if(_s(m)&&s.length<5)return s+=String.fromCodePoint(m),t.consume(m),l;if(m===58){const g=s.toLowerCase();if(g==="http"||g==="https")return t.consume(m),c}return n(m)}function c(m){return m===47?(t.consume(m),i?h:(i=!0,c)):n(m)}function h(m){return m===null||tv(m)||Vn(m)||Du(m)||uy(m)?n(m):t.attempt(_$,t.attempt(M$,f),n)(m)}function f(m){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(m)}}function Ave(t,e,n){let r=0;return s;function s(a){return(a===87||a===119)&&r<3?(r++,t.consume(a),s):a===46&&r===3?(t.consume(a),i):n(a)}function i(a){return a===null?n(a):e(a)}}function Rve(t,e,n){let r,s,i;return a;function a(h){return h===46||h===95?t.check(A$,c,l)(h):h===null||Vn(h)||Du(h)||h!==45&&uy(h)?c(h):(i=!0,t.consume(h),a)}function l(h){return h===95?r=!0:(s=r,r=void 0),t.consume(h),a}function c(h){return s||r||!i?n(h):e(h)}}function Dve(t,e){let n=0,r=0;return s;function s(a){return a===40?(n++,t.consume(a),s):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(A$,e,i)(a):a===null||Vn(a)||Du(a)?e(a):(t.consume(a),s)}function i(a){return a===41&&r++,t.consume(a),s}}function zve(t,e,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(t.consume(l),r):l===38?(t.consume(l),i):l===93?(t.consume(l),s):l===60||l===null||Vn(l)||Du(l)?e(l):n(l)}function s(l){return l===null||l===40||l===91||Vn(l)||Du(l)?e(l):r(l)}function i(l){return _s(l)?a(l):n(l)}function a(l){return l===59?(t.consume(l),r):_s(l)?(t.consume(l),a):n(l)}}function Pve(t,e,n){return r;function r(i){return t.consume(i),s}function s(i){return Ss(i)?n(i):e(i)}}function z$(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Vn(t)}function P$(t){return!_s(t)}function L$(t){return!(t===47||JS(t))}function JS(t){return t===43||t===45||t===46||t===95||Ss(t)}function IO(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Lve={tokenize:Vve,partial:!0};function Ive(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:$ve,continuation:{tokenize:Qve},exit:Hve}},text:{91:{name:"gfmFootnoteCall",tokenize:Fve},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Bve,resolveTo:qve}}}}function Bve(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const h=Sa(r.sliceSerialize({start:a.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function qve(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)},l=[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,...l),t}function Fve(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return l;function l(m){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),c}function c(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||Vn(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return s.includes(Sa(r.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return Vn(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 $ve(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,l;return c;function c(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&&!l||y===null||y===91||Vn(y))return n(y);if(y===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return i=Sa(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return Vn(y)||(l=!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),Ut(t,x,"gfmFootnoteDefinitionWhitespace")):n(y)}function x(y){return e(y)}}function Qve(t,e,n){return t.check(sp,e,t.attempt(Lve,e,n))}function Hve(t){t.exit("gfmFootnoteDefinition")}function Vve(t,e,n){const r=this;return Ut(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 Uve(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,l){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let h=c;for(;h--;)if(a[h][0]==="exit"&&a[h][1].type==="strikethroughSequenceTemporary"&&a[h][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[h][1].end.offset-a[h][1].start.offset){a[c][1].type="strikethroughSequence",a[h][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},a[h][1].start),end:Object.assign({},a[c][1].end)},m={type:"strikethroughText",start:Object.assign({},a[h][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",f,l],["enter",a[h][1],l],["exit",a[h][1],l],["enter",m,l]],x=l.parser.constructs.insideSpan.null;x&&Ei(g,g.length,0,dy(x,a.slice(h+1,c),l)),Ei(g,g.length,0,[["exit",m,l],["enter",a[c][1],l],["exit",a[c][1],l],["exit",f,l]]),Ei(a,h-1,c-h+3,g),c=h+g.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function i(a,l,c){const h=this.previous,f=this.events;let m=0;return g;function g(y){return h===126&&f[f.length-1][1].type!=="characterEscape"?c(y):(a.enter("strikethroughSequenceTemporary"),x(y))}function x(y){const w=Nh(h);if(y===126)return m>1?c(y):(a.consume(y),m++,x);if(m<2&&!n)return c(y);const S=a.exit("strikethroughSequenceTemporary"),k=Nh(y);return S._open=!k||k===2&&!!w,S._close=!w||w===2&&!!k,l(y)}}}class Wve{constructor(){this.map=[]}add(e,n,r){Gve(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 Gve(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<t.map.length;){if(t.map[s][0]===e){t.map[s][1]+=n,t.map[s][2].push(...r);return}s+=1}t.map.push([e,n,r])}}function Xve(t,e){let n=!1;const r=[];for(;e<t.length;){const s=t[e];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function Yve(){return{flow:{null:{name:"table",tokenize:Kve,resolveAll:Zve}}}}function Kve(t,e,n){const r=this;let s=0,i=0,a;return l;function l(I){let $=r.events.length-1;for(;$>-1;){const z=r.events[$][1].type;if(z==="lineEnding"||z==="linePrefix")$--;else break}const V=$>-1?r.events[$][1].type:null,ee=V==="tableHead"||V==="tableRow"?E:c;return ee===E&&r.parser.lazy[r.now().line]?n(I):ee(I)}function c(I){return t.enter("tableHead"),t.enter("tableRow"),h(I)}function h(I){return I===124||(a=!0,i+=1),f(I)}function f(I){return I===null?n(I):ut(I)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),x):n(I):Yt(I)?Ut(t,f,"whitespace")(I):(i+=1,a&&(a=!1,s+=1),I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),a=!0,f):(t.enter("data"),m(I)))}function m(I){return I===null||I===124||Vn(I)?(t.exit("data"),f(I)):(t.consume(I),I===92?g:m)}function g(I){return I===92||I===124?(t.consume(I),m):m(I)}function x(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(t.enter("tableDelimiterRow"),a=!1,Yt(I)?Ut(t,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):y(I))}function y(I){return I===45||I===58?S(I):I===124?(a=!0,t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),w):_(I)}function w(I){return Yt(I)?Ut(t,S,"whitespace")(I):S(I)}function S(I){return I===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),k):I===45?(i+=1,k(I)):I===null||ut(I)?T(I):_(I)}function k(I){return I===45?(t.enter("tableDelimiterFiller"),N(I)):_(I)}function N(I){return I===45?(t.consume(I),N):I===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),C):(t.exit("tableDelimiterFiller"),C(I))}function C(I){return Yt(I)?Ut(t,T,"whitespace")(I):T(I)}function T(I){return I===124?y(I):I===null||ut(I)?!a||s!==i?_(I):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(I)):_(I)}function _(I){return n(I)}function E(I){return t.enter("tableRow"),M(I)}function M(I){return I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),M):I===null||ut(I)?(t.exit("tableRow"),e(I)):Yt(I)?Ut(t,M,"whitespace")(I):(t.enter("data"),q(I))}function q(I){return I===null||I===124||Vn(I)?(t.exit("data"),M(I)):(t.consume(I),I===92?L:q)}function L(I){return I===92||I===124?(t.consume(I),q):q(I)}}function Zve(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,h,f,m;const g=new Wve;for(;++n<t.length;){const x=t[n],y=x[1];x[0]==="enter"?y.type==="tableHead"?(l=!1,c!==0&&(I_(g,e,c,h,f),f=void 0,c=0),h={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},g.add(n,0,[["enter",h,e]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(r=!0,m=void 0,i=[0,0,0,0],a=[0,n+1,0,0],l&&(l=!1,f={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},g.add(n,0,[["enter",f,e]])),s=y.type==="tableDelimiterRow"?2:f?3:1):s&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],m=kx(g,e,i,s,void 0,m),i=[0,0,0,0]),a[2]=n)):y.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],m=kx(g,e,i,s,void 0,m)),i=a,a=[i[1],n,0,0])):y.type==="tableHead"?(l=!0,c=n):y.type==="tableRow"||y.type==="tableDelimiterRow"?(c=n,i[1]!==0?(a[0]=a[1],m=kx(g,e,i,s,n,m)):a[1]!==0&&(m=kx(g,e,a,s,n,m)),s=0):s&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&I_(g,e,c,h,f),g.consume(e.events),n=-1;++n<e.events.length;){const x=e.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=Xve(e.events,n))}return t}function kx(t,e,n,r,s,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},Fd(e.events,n[0])),t.add(n[0],0,[["exit",i,e]]));const c=Fd(e.events,n[1]);if(i={type:a,start:Object.assign({},c),end:Object.assign({},c)},t.add(n[1],0,[["enter",i,e]]),n[2]!==0){const h=Fd(e.events,n[2]),f=Fd(e.events,n[3]),m={type:l,start:Object.assign({},h),end:Object.assign({},f)};if(t.add(n[2],0,[["enter",m,e]]),r!==2){const g=e.events[n[2]],x=e.events[n[3]];if(g[1].end=Object.assign({},x[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[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({},Fd(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function I_(t,e,n,r,s){const i=[],a=Fd(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 Fd(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const Jve={name:"tasklistCheck",tokenize:tye};function eye(){return{text:{91:Jve}}}function tye(t,e,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),i)}function i(c){return Vn(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),l):n(c)}function l(c){return ut(c)?e(c):Yt(c)?t.check({tokenize:nye},e,n)(c):n(c)}}function nye(t,e,n){return Ut(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function rye(t){return WF([Tve(),Ive(),Uve(t),Yve(),eye()])}const sye={};function iye(t){const e=this,n=t||sye,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(rye(n)),i.push(Ove()),a.push(jve(n))}function aye(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:l,mathText:a,mathTextData:l}};function t(c){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]}},c)}function e(){this.buffer()}function n(){const c=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=c}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(c){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),f=this.stack[this.stack.length-1];f.type,this.exit(c),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(c){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},c),this.buffer()}function a(c){const h=this.resume(),f=this.stack[this.stack.length-1];f.type,this.exit(c),f.value=h,f.data.hChildren.push({type:"text",value:h})}function l(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function oye(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,l,c){const h=i.value||"",f=l.createTracker(c),m="$".repeat(Math.max(v$(h,"$")+1,2)),g=l.enter("mathFlow");let x=f.move(m);if(i.meta){const y=l.enter("mathFlowMeta");x+=f.move(l.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,l){let c=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(c);)h++;const f="$".repeat(h);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");let m=-1;for(;++m<l.unsafe.length;){const g=l.unsafe[m];if(!g.atBreak)continue;const x=l.compilePattern(g);let y;for(;y=x.exec(c);){let w=y.index;c.codePointAt(w)===10&&c.codePointAt(w-1)===13&&w--,c=c.slice(0,w)+" "+c.slice(y.index+1)}}return f+c+f}function s(){return"$"}}const lye={tokenize:cye,concrete:!0,name:"mathFlow"},B_={tokenize:uye,partial:!0};function cye(t,e,n){const r=this,s=r.events[r.events.length-1],i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0;let a=0;return l;function l(N){return t.enter("mathFlow"),t.enter("mathFlowFence"),t.enter("mathFlowFenceSequence"),c(N)}function c(N){return N===36?(t.consume(N),a++,c):a<2?n(N):(t.exit("mathFlowFenceSequence"),Ut(t,h,"whitespace")(N))}function h(N){return N===null||ut(N)?m(N):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(N))}function f(N){return N===null||ut(N)?(t.exit("chunkString"),t.exit("mathFlowFenceMeta"),m(N)):N===36?n(N):(t.consume(N),f)}function m(N){return t.exit("mathFlowFence"),r.interrupt?e(N):t.attempt(B_,g,S)(N)}function g(N){return t.attempt({tokenize:k,partial:!0},S,x)(N)}function x(N){return(i?Ut(t,y,"linePrefix",i+1):y)(N)}function y(N){return N===null?S(N):ut(N)?t.attempt(B_,g,S)(N):(t.enter("mathFlowValue"),w(N))}function w(N){return N===null||ut(N)?(t.exit("mathFlowValue"),y(N)):(t.consume(N),w)}function S(N){return t.exit("mathFlow"),e(N)}function k(N,C,T){let _=0;return Ut(N,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function E(L){return N.enter("mathFlowFence"),N.enter("mathFlowFenceSequence"),M(L)}function M(L){return L===36?(_++,N.consume(L),M):_<a?T(L):(N.exit("mathFlowFenceSequence"),Ut(N,q,"whitespace")(L))}function q(L){return L===null||ut(L)?(N.exit("mathFlowFence"),C(L)):T(L)}}}function uye(t,e,n){const r=this;return s;function s(a){return a===null?e(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)}}function dye(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:hye,previous:fye,name:"mathText"};function r(s,i,a){let l=0,c,h;return f;function f(w){return s.enter("mathText"),s.enter("mathTextSequence"),m(w)}function m(w){return w===36?(s.consume(w),l++,m):l<2&&!n?a(w):(s.exit("mathTextSequence"),g(w))}function g(w){return w===null?a(w):w===36?(h=s.enter("mathTextSequence"),c=0,y(w)):w===32?(s.enter("space"),s.consume(w),s.exit("space"),g):ut(w)?(s.enter("lineEnding"),s.consume(w),s.exit("lineEnding"),g):(s.enter("mathTextData"),x(w))}function x(w){return w===null||w===32||w===36||ut(w)?(s.exit("mathTextData"),g(w)):(s.consume(w),x)}function y(w){return w===36?(s.consume(w),c++,y):c===l?(s.exit("mathTextSequence"),s.exit("mathText"),i(w)):(h.type="mathTextData",x(w))}}}function hye(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<e;)if(t[r][1].type==="mathTextData"){t[e][1].type="mathTextPadding",t[n][1].type="mathTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)s===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(s=r):(r===e||t[r][1].type==="lineEnding")&&(t[s][1].type="mathTextData",r!==s+2&&(t[s][1].end=t[r-1][1].end,t.splice(s+2,r-s-2),e-=r-s-2,r=s+2),s=void 0);return t}function fye(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function mye(t){return{flow:{36:lye},text:{36:dye(t)}}}class Xs{constructor(e,n,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=n,this.end=r}static range(e,n){return n?!e||!e.loc||!n.loc||e.loc.lexer!==n.loc.lexer?null:new Xs(e.loc.lexer,e.loc.start,n.loc.end):e&&e.loc}}class _i{constructor(e,n){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=n}range(e,n){return new _i(n,Xs.range(this,e))}}class Be{constructor(e,n){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var r="KaTeX parse error: "+e,s,i,a=n&&n.loc;if(a&&a.start<=a.end){var l=a.lexer.input;s=a.start,i=a.end,s===l.length?r+=" at end of input: ":r+=" at position "+(s+1)+": ";var c=l.slice(s,i).replace(/[^]/g,"$&̲"),h;s>15?h="…"+l.slice(s-15,s):h=l.slice(0,s);var f;i+15<l.length?f=l.slice(i,i+15)+"…":f=l.slice(i),r+=h+c+f}var m=new Error(r);return m.name="ParseError",m.__proto__=Be.prototype,m.position=s,s!=null&&i!=null&&(m.length=i-s),m.rawMessage=e,m}}Be.prototype.__proto__=Error.prototype;var pye=function(e,n){return e===void 0?n:e},gye=/([A-Z])/g,xye=function(e){return e.replace(gye,"-$1").toLowerCase()},vye={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},yye=/[&><"']/g;function bye(t){return String(t).replace(yye,e=>vye[e])}var I$=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},wye=function(e){var n=I$(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Sye=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},kye=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},On={deflt:pye,escape:bye,hyphenate:xye,getBaseElem:I$,isCharacterBox:wye,protocolFromUrl:kye},f1={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 <type>"},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 <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 <def>",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 <size>",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 <n>",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 <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Oye(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 BO{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 f1)if(f1.hasOwnProperty(n)){var r=f1[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Oye(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=On.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 Kl{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 Va[jye[this.id]]}sub(){return Va[Nye[this.id]]}fracNum(){return Va[Cye[this.id]]}fracDen(){return Va[Tye[this.id]]}cramp(){return Va[Eye[this.id]]}text(){return Va[_ye[this.id]]}isTight(){return this.size>=2}}var qO=0,iv=1,oh=2,il=3,g0=4,Zi=5,Ch=6,Ms=7,Va=[new Kl(qO,0,!1),new Kl(iv,0,!0),new Kl(oh,1,!1),new Kl(il,1,!0),new Kl(g0,2,!1),new Kl(Zi,2,!0),new Kl(Ch,3,!1),new Kl(Ms,3,!0)],jye=[g0,Zi,g0,Zi,Ch,Ms,Ch,Ms],Nye=[Zi,Zi,Zi,Zi,Ms,Ms,Ms,Ms],Cye=[oh,il,g0,Zi,Ch,Ms,Ch,Ms],Tye=[il,il,Zi,Zi,Ms,Ms,Ms,Ms],Eye=[iv,iv,il,il,Zi,Zi,Ms,Ms],_ye=[qO,iv,oh,il,oh,il,oh,il],kt={DISPLAY:Va[qO],TEXT:Va[oh],SCRIPT:Va[g0],SCRIPTSCRIPT:Va[Ch]},ek=[{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 Mye(t){for(var e=0;e<ek.length;e++)for(var n=ek[e],r=0;r<n.blocks.length;r++){var s=n.blocks[r];if(t>=s[0]&&t<=s[1])return n.name}return null}var m1=[];ek.forEach(t=>t.blocks.forEach(e=>m1.push(...e)));function B$(t){for(var e=0;e<m1.length;e+=2)if(t>=m1[e]&&t<=m1[e+1])return!0;return!1}var Cd=80,Aye=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"},Rye=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"},Dye=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"},zye=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"},Pye=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"},Lye=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},Iye=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"},Bye=function(e,n,r){n=1e3*n;var s="";switch(e){case"sqrtMain":s=Aye(n,Cd);break;case"sqrtSize1":s=Rye(n,Cd);break;case"sqrtSize2":s=Dye(n,Cd);break;case"sqrtSize3":s=zye(n,Cd);break;case"sqrtSize4":s=Pye(n,Cd);break;case"sqrtTall":s=Iye(n,Cd,r)}return s},qye=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""}},q_={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`},Fye=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 op{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;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){for(var e="",n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e}toText(){var e=n=>n.toText();return this.children.map(e).join("")}}var Ja={"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]}},Ox={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]},F_={Å:"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 $ye(t,e){Ja[t]=e}function FO(t,e,n){if(!Ja[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=Ja[e][r];if(!s&&t[0]in F_&&(r=F_[t[0]].charCodeAt(0),s=Ja[e][r]),!s&&n==="text"&&B$(r)&&(s=Ja[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var d4={};function Qye(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!d4[e]){var n=d4[e]={cssEmPerMu:Ox.quad[e]/18};for(var r in Ox)Ox.hasOwnProperty(r)&&(n[r]=Ox[r][e])}return d4[e]}var Hye=[[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]],$_=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Q_=function(e,n){return n.size<2?e:Hye[e-1][n.size-1]};class Xo{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||Xo.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=$_[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 Xo(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:Q_(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:$_[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=Q_(Xo.BASESIZE,e);return this.size===n&&this.textSize===Xo.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!==Xo.BASESIZE?["sizing","reset-size"+this.size,"size"+Xo.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Qye(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Xo.BASESIZE=6;var tk={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},Vye={ex:!0,em:!0,mu:!0},q$=function(e){return typeof e!="string"&&(e=e.unit),e in tk||e in Vye||e==="ex"},cr=function(e,n){var r;if(e.unit in tk)r=tk[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)},Ve=function(e){return+e.toFixed(4)+"em"},Sc=function(e){return e.filter(n=>n).join(" ")},F$=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)}},$$=function(e){var n=document.createElement(e);n.className=Sc(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<this.children.length;i++)n.appendChild(this.children[i].toNode());return n},Uye=/[\s"'>/=\x00-\x1f]/,Q$=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+On.escape(Sc(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=On.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+On.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(Uye.test(i))throw new Be("Invalid attribute name '"+i+"'");n+=" "+i+'="'+On.escape(this.attributes[i])+'"'}n+=">";for(var a=0;a<this.children.length;a++)n+=this.children[a].toMarkup();return n+="</"+e+">",n};class lp{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,F$.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return $$.call(this,"span")}toMarkup(){return Q$.call(this,"span")}}class $O{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,F$.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 $$.call(this,"a")}toMarkup(){return Q$.call(this,"a")}}class Wye{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='<img src="'+On.escape(this.src)+'"'+(' alt="'+On.escape(this.alt)+'"'),n="";for(var r in this.style)this.style.hasOwnProperty(r)&&(n+=On.hyphenate(r)+":"+this.style[r]+";");return n&&(e+=' style="'+On.escape(n)+'"'),e+="'/>",e}}var Gye={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class aa{constructor(e,n,r,s,i,a,l,c){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=n||0,this.depth=r||0,this.italic=s||0,this.skew=i||0,this.width=a||0,this.classes=l||[],this.style=c||{},this.maxFontSize=0;var h=Mye(this.text.charCodeAt(0));h&&this.classes.push(h+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Gye[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),n=null;this.italic>0&&(n=document.createElement("span"),n.style.marginRight=Ve(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Sc(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="<span";this.classes.length&&(e=!0,n+=' class="',n+=On.escape(Sc(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=On.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+On.escape(r)+'"');var i=On.escape(this.text);return e?(n+=">",n+=i,n+="</span>",n):i}}class ml{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<this.children.length;s++)n.appendChild(this.children[s].toNode());return n}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="'+On.escape(this.attributes[n])+'"');e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class kc{constructor(e,n){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=n}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"path");return this.alternate?n.setAttribute("d",this.alternate):n.setAttribute("d",q_[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+On.escape(this.alternate)+'"/>':'<path d="'+On.escape(q_[this.pathName])+'"/>'}}class nk{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="<line";for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="'+On.escape(this.attributes[n])+'"');return e+="/>",e}}function H_(t){if(t instanceof aa)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function Xye(t){if(t instanceof lp)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var Yye={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Kye={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Gn={math:{},text:{}};function A(t,e,n,r,s,i){Gn[t][s]={font:e,group:n,replace:r},i&&r&&(Gn[t][r]=Gn[t][s])}var D="math",Le="text",Q="main",le="ams",sr="accent-token",nt="bin",Ps="close",Kh="inner",St="mathord",Lr="op-token",Ri="open",my="punct",ce="rel",wl="spacing",pe="textord";A(D,Q,ce,"≡","\\equiv",!0);A(D,Q,ce,"≺","\\prec",!0);A(D,Q,ce,"≻","\\succ",!0);A(D,Q,ce,"","\\sim",!0);A(D,Q,ce,"⊥","\\perp");A(D,Q,ce,"⪯","\\preceq",!0);A(D,Q,ce,"⪰","\\succeq",!0);A(D,Q,ce,"≃","\\simeq",!0);A(D,Q,ce,"","\\mid",!0);A(D,Q,ce,"≪","\\ll",!0);A(D,Q,ce,"≫","\\gg",!0);A(D,Q,ce,"≍","\\asymp",!0);A(D,Q,ce,"∥","\\parallel");A(D,Q,ce,"⋈","\\bowtie",!0);A(D,Q,ce,"⌣","\\smile",!0);A(D,Q,ce,"⊑","\\sqsubseteq",!0);A(D,Q,ce,"⊒","\\sqsupseteq",!0);A(D,Q,ce,"≐","\\doteq",!0);A(D,Q,ce,"⌢","\\frown",!0);A(D,Q,ce,"∋","\\ni",!0);A(D,Q,ce,"∝","\\propto",!0);A(D,Q,ce,"⊢","\\vdash",!0);A(D,Q,ce,"⊣","\\dashv",!0);A(D,Q,ce,"∋","\\owns");A(D,Q,my,".","\\ldotp");A(D,Q,my,"⋅","\\cdotp");A(D,Q,pe,"#","\\#");A(Le,Q,pe,"#","\\#");A(D,Q,pe,"&","\\&");A(Le,Q,pe,"&","\\&");A(D,Q,pe,"ℵ","\\aleph",!0);A(D,Q,pe,"∀","\\forall",!0);A(D,Q,pe,"ℏ","\\hbar",!0);A(D,Q,pe,"∃","\\exists",!0);A(D,Q,pe,"∇","\\nabla",!0);A(D,Q,pe,"♭","\\flat",!0);A(D,Q,pe,"","\\ell",!0);A(D,Q,pe,"♮","\\natural",!0);A(D,Q,pe,"♣","\\clubsuit",!0);A(D,Q,pe,"℘","\\wp",!0);A(D,Q,pe,"♯","\\sharp",!0);A(D,Q,pe,"♢","\\diamondsuit",!0);A(D,Q,pe,"","\\Re",!0);A(D,Q,pe,"♡","\\heartsuit",!0);A(D,Q,pe,"","\\Im",!0);A(D,Q,pe,"♠","\\spadesuit",!0);A(D,Q,pe,"§","\\S",!0);A(Le,Q,pe,"§","\\S");A(D,Q,pe,"¶","\\P",!0);A(Le,Q,pe,"¶","\\P");A(D,Q,pe,"†","\\dag");A(Le,Q,pe,"†","\\dag");A(Le,Q,pe,"†","\\textdagger");A(D,Q,pe,"‡","\\ddag");A(Le,Q,pe,"‡","\\ddag");A(Le,Q,pe,"‡","\\textdaggerdbl");A(D,Q,Ps,"⎱","\\rmoustache",!0);A(D,Q,Ri,"⎰","\\lmoustache",!0);A(D,Q,Ps,"⟯","\\rgroup",!0);A(D,Q,Ri,"⟮","\\lgroup",!0);A(D,Q,nt,"∓","\\mp",!0);A(D,Q,nt,"⊖","\\ominus",!0);A(D,Q,nt,"⊎","\\uplus",!0);A(D,Q,nt,"⊓","\\sqcap",!0);A(D,Q,nt,"","\\ast");A(D,Q,nt,"⊔","\\sqcup",!0);A(D,Q,nt,"◯","\\bigcirc",!0);A(D,Q,nt,"∙","\\bullet",!0);A(D,Q,nt,"‡","\\ddagger");A(D,Q,nt,"≀","\\wr",!0);A(D,Q,nt,"⨿","\\amalg");A(D,Q,nt,"&","\\And");A(D,Q,ce,"⟵","\\longleftarrow",!0);A(D,Q,ce,"⇐","\\Leftarrow",!0);A(D,Q,ce,"⟸","\\Longleftarrow",!0);A(D,Q,ce,"⟶","\\longrightarrow",!0);A(D,Q,ce,"⇒","\\Rightarrow",!0);A(D,Q,ce,"⟹","\\Longrightarrow",!0);A(D,Q,ce,"↔","\\leftrightarrow",!0);A(D,Q,ce,"⟷","\\longleftrightarrow",!0);A(D,Q,ce,"⇔","\\Leftrightarrow",!0);A(D,Q,ce,"⟺","\\Longleftrightarrow",!0);A(D,Q,ce,"↦","\\mapsto",!0);A(D,Q,ce,"⟼","\\longmapsto",!0);A(D,Q,ce,"↗","\\nearrow",!0);A(D,Q,ce,"↩","\\hookleftarrow",!0);A(D,Q,ce,"↪","\\hookrightarrow",!0);A(D,Q,ce,"↘","\\searrow",!0);A(D,Q,ce,"↼","\\leftharpoonup",!0);A(D,Q,ce,"⇀","\\rightharpoonup",!0);A(D,Q,ce,"↙","\\swarrow",!0);A(D,Q,ce,"↽","\\leftharpoondown",!0);A(D,Q,ce,"⇁","\\rightharpoondown",!0);A(D,Q,ce,"↖","\\nwarrow",!0);A(D,Q,ce,"⇌","\\rightleftharpoons",!0);A(D,le,ce,"≮","\\nless",!0);A(D,le,ce,"","\\@nleqslant");A(D,le,ce,"","\\@nleqq");A(D,le,ce,"⪇","\\lneq",!0);A(D,le,ce,"≨","\\lneqq",!0);A(D,le,ce,"","\\@lvertneqq");A(D,le,ce,"⋦","\\lnsim",!0);A(D,le,ce,"⪉","\\lnapprox",!0);A(D,le,ce,"⊀","\\nprec",!0);A(D,le,ce,"⋠","\\npreceq",!0);A(D,le,ce,"⋨","\\precnsim",!0);A(D,le,ce,"⪹","\\precnapprox",!0);A(D,le,ce,"≁","\\nsim",!0);A(D,le,ce,"","\\@nshortmid");A(D,le,ce,"∤","\\nmid",!0);A(D,le,ce,"⊬","\\nvdash",!0);A(D,le,ce,"⊭","\\nvDash",!0);A(D,le,ce,"⋪","\\ntriangleleft");A(D,le,ce,"⋬","\\ntrianglelefteq",!0);A(D,le,ce,"⊊","\\subsetneq",!0);A(D,le,ce,"","\\@varsubsetneq");A(D,le,ce,"⫋","\\subsetneqq",!0);A(D,le,ce,"","\\@varsubsetneqq");A(D,le,ce,"≯","\\ngtr",!0);A(D,le,ce,"","\\@ngeqslant");A(D,le,ce,"","\\@ngeqq");A(D,le,ce,"⪈","\\gneq",!0);A(D,le,ce,"≩","\\gneqq",!0);A(D,le,ce,"","\\@gvertneqq");A(D,le,ce,"⋧","\\gnsim",!0);A(D,le,ce,"⪊","\\gnapprox",!0);A(D,le,ce,"⊁","\\nsucc",!0);A(D,le,ce,"⋡","\\nsucceq",!0);A(D,le,ce,"⋩","\\succnsim",!0);A(D,le,ce,"⪺","\\succnapprox",!0);A(D,le,ce,"≆","\\ncong",!0);A(D,le,ce,"","\\@nshortparallel");A(D,le,ce,"∦","\\nparallel",!0);A(D,le,ce,"⊯","\\nVDash",!0);A(D,le,ce,"⋫","\\ntriangleright");A(D,le,ce,"⋭","\\ntrianglerighteq",!0);A(D,le,ce,"","\\@nsupseteqq");A(D,le,ce,"⊋","\\supsetneq",!0);A(D,le,ce,"","\\@varsupsetneq");A(D,le,ce,"⫌","\\supsetneqq",!0);A(D,le,ce,"","\\@varsupsetneqq");A(D,le,ce,"⊮","\\nVdash",!0);A(D,le,ce,"⪵","\\precneqq",!0);A(D,le,ce,"⪶","\\succneqq",!0);A(D,le,ce,"","\\@nsubseteqq");A(D,le,nt,"⊴","\\unlhd");A(D,le,nt,"⊵","\\unrhd");A(D,le,ce,"↚","\\nleftarrow",!0);A(D,le,ce,"↛","\\nrightarrow",!0);A(D,le,ce,"⇍","\\nLeftarrow",!0);A(D,le,ce,"⇏","\\nRightarrow",!0);A(D,le,ce,"↮","\\nleftrightarrow",!0);A(D,le,ce,"⇎","\\nLeftrightarrow",!0);A(D,le,ce,"△","\\vartriangle");A(D,le,pe,"ℏ","\\hslash");A(D,le,pe,"▽","\\triangledown");A(D,le,pe,"◊","\\lozenge");A(D,le,pe,"Ⓢ","\\circledS");A(D,le,pe,"®","\\circledR");A(Le,le,pe,"®","\\circledR");A(D,le,pe,"∡","\\measuredangle",!0);A(D,le,pe,"∄","\\nexists");A(D,le,pe,"℧","\\mho");A(D,le,pe,"Ⅎ","\\Finv",!0);A(D,le,pe,"⅁","\\Game",!0);A(D,le,pe,"","\\backprime");A(D,le,pe,"▲","\\blacktriangle");A(D,le,pe,"▼","\\blacktriangledown");A(D,le,pe,"■","\\blacksquare");A(D,le,pe,"⧫","\\blacklozenge");A(D,le,pe,"★","\\bigstar");A(D,le,pe,"∢","\\sphericalangle",!0);A(D,le,pe,"∁","\\complement",!0);A(D,le,pe,"ð","\\eth",!0);A(Le,Q,pe,"ð","ð");A(D,le,pe,"","\\diagup");A(D,le,pe,"╲","\\diagdown");A(D,le,pe,"□","\\square");A(D,le,pe,"□","\\Box");A(D,le,pe,"◊","\\Diamond");A(D,le,pe,"¥","\\yen",!0);A(Le,le,pe,"¥","\\yen",!0);A(D,le,pe,"✓","\\checkmark",!0);A(Le,le,pe,"✓","\\checkmark");A(D,le,pe,"ℶ","\\beth",!0);A(D,le,pe,"ℸ","\\daleth",!0);A(D,le,pe,"ℷ","\\gimel",!0);A(D,le,pe,"ϝ","\\digamma",!0);A(D,le,pe,"ϰ","\\varkappa");A(D,le,Ri,"┌","\\@ulcorner",!0);A(D,le,Ps,"┐","\\@urcorner",!0);A(D,le,Ri,"└","\\@llcorner",!0);A(D,le,Ps,"┘","\\@lrcorner",!0);A(D,le,ce,"≦","\\leqq",!0);A(D,le,ce,"⩽","\\leqslant",!0);A(D,le,ce,"⪕","\\eqslantless",!0);A(D,le,ce,"≲","\\lesssim",!0);A(D,le,ce,"⪅","\\lessapprox",!0);A(D,le,ce,"≊","\\approxeq",!0);A(D,le,nt,"⋖","\\lessdot");A(D,le,ce,"⋘","\\lll",!0);A(D,le,ce,"≶","\\lessgtr",!0);A(D,le,ce,"⋚","\\lesseqgtr",!0);A(D,le,ce,"⪋","\\lesseqqgtr",!0);A(D,le,ce,"≑","\\doteqdot");A(D,le,ce,"≓","\\risingdotseq",!0);A(D,le,ce,"≒","\\fallingdotseq",!0);A(D,le,ce,"∽","\\backsim",!0);A(D,le,ce,"⋍","\\backsimeq",!0);A(D,le,ce,"⫅","\\subseteqq",!0);A(D,le,ce,"⋐","\\Subset",!0);A(D,le,ce,"⊏","\\sqsubset",!0);A(D,le,ce,"≼","\\preccurlyeq",!0);A(D,le,ce,"⋞","\\curlyeqprec",!0);A(D,le,ce,"≾","\\precsim",!0);A(D,le,ce,"⪷","\\precapprox",!0);A(D,le,ce,"⊲","\\vartriangleleft");A(D,le,ce,"⊴","\\trianglelefteq");A(D,le,ce,"⊨","\\vDash",!0);A(D,le,ce,"⊪","\\Vvdash",!0);A(D,le,ce,"⌣","\\smallsmile");A(D,le,ce,"⌢","\\smallfrown");A(D,le,ce,"≏","\\bumpeq",!0);A(D,le,ce,"≎","\\Bumpeq",!0);A(D,le,ce,"≧","\\geqq",!0);A(D,le,ce,"⩾","\\geqslant",!0);A(D,le,ce,"⪖","\\eqslantgtr",!0);A(D,le,ce,"≳","\\gtrsim",!0);A(D,le,ce,"⪆","\\gtrapprox",!0);A(D,le,nt,"⋗","\\gtrdot");A(D,le,ce,"⋙","\\ggg",!0);A(D,le,ce,"≷","\\gtrless",!0);A(D,le,ce,"⋛","\\gtreqless",!0);A(D,le,ce,"⪌","\\gtreqqless",!0);A(D,le,ce,"≖","\\eqcirc",!0);A(D,le,ce,"≗","\\circeq",!0);A(D,le,ce,"≜","\\triangleq",!0);A(D,le,ce,"","\\thicksim");A(D,le,ce,"≈","\\thickapprox");A(D,le,ce,"⫆","\\supseteqq",!0);A(D,le,ce,"⋑","\\Supset",!0);A(D,le,ce,"⊐","\\sqsupset",!0);A(D,le,ce,"≽","\\succcurlyeq",!0);A(D,le,ce,"⋟","\\curlyeqsucc",!0);A(D,le,ce,"≿","\\succsim",!0);A(D,le,ce,"⪸","\\succapprox",!0);A(D,le,ce,"⊳","\\vartriangleright");A(D,le,ce,"⊵","\\trianglerighteq");A(D,le,ce,"⊩","\\Vdash",!0);A(D,le,ce,"","\\shortmid");A(D,le,ce,"∥","\\shortparallel");A(D,le,ce,"≬","\\between",!0);A(D,le,ce,"⋔","\\pitchfork",!0);A(D,le,ce,"∝","\\varpropto");A(D,le,ce,"◀","\\blacktriangleleft");A(D,le,ce,"∴","\\therefore",!0);A(D,le,ce,"∍","\\backepsilon");A(D,le,ce,"▶","\\blacktriangleright");A(D,le,ce,"∵","\\because",!0);A(D,le,ce,"⋘","\\llless");A(D,le,ce,"⋙","\\gggtr");A(D,le,nt,"⊲","\\lhd");A(D,le,nt,"⊳","\\rhd");A(D,le,ce,"≂","\\eqsim",!0);A(D,Q,ce,"⋈","\\Join");A(D,le,ce,"≑","\\Doteq",!0);A(D,le,nt,"∔","\\dotplus",!0);A(D,le,nt,"","\\smallsetminus");A(D,le,nt,"⋒","\\Cap",!0);A(D,le,nt,"⋓","\\Cup",!0);A(D,le,nt,"⩞","\\doublebarwedge",!0);A(D,le,nt,"⊟","\\boxminus",!0);A(D,le,nt,"⊞","\\boxplus",!0);A(D,le,nt,"⋇","\\divideontimes",!0);A(D,le,nt,"⋉","\\ltimes",!0);A(D,le,nt,"⋊","\\rtimes",!0);A(D,le,nt,"⋋","\\leftthreetimes",!0);A(D,le,nt,"⋌","\\rightthreetimes",!0);A(D,le,nt,"⋏","\\curlywedge",!0);A(D,le,nt,"⋎","\\curlyvee",!0);A(D,le,nt,"⊝","\\circleddash",!0);A(D,le,nt,"⊛","\\circledast",!0);A(D,le,nt,"⋅","\\centerdot");A(D,le,nt,"⊺","\\intercal",!0);A(D,le,nt,"⋒","\\doublecap");A(D,le,nt,"⋓","\\doublecup");A(D,le,nt,"⊠","\\boxtimes",!0);A(D,le,ce,"⇢","\\dashrightarrow",!0);A(D,le,ce,"⇠","\\dashleftarrow",!0);A(D,le,ce,"⇇","\\leftleftarrows",!0);A(D,le,ce,"⇆","\\leftrightarrows",!0);A(D,le,ce,"⇚","\\Lleftarrow",!0);A(D,le,ce,"↞","\\twoheadleftarrow",!0);A(D,le,ce,"↢","\\leftarrowtail",!0);A(D,le,ce,"↫","\\looparrowleft",!0);A(D,le,ce,"⇋","\\leftrightharpoons",!0);A(D,le,ce,"↶","\\curvearrowleft",!0);A(D,le,ce,"↺","\\circlearrowleft",!0);A(D,le,ce,"↰","\\Lsh",!0);A(D,le,ce,"⇈","\\upuparrows",!0);A(D,le,ce,"↿","\\upharpoonleft",!0);A(D,le,ce,"⇃","\\downharpoonleft",!0);A(D,Q,ce,"⊶","\\origof",!0);A(D,Q,ce,"⊷","\\imageof",!0);A(D,le,ce,"⊸","\\multimap",!0);A(D,le,ce,"↭","\\leftrightsquigarrow",!0);A(D,le,ce,"⇉","\\rightrightarrows",!0);A(D,le,ce,"⇄","\\rightleftarrows",!0);A(D,le,ce,"↠","\\twoheadrightarrow",!0);A(D,le,ce,"↣","\\rightarrowtail",!0);A(D,le,ce,"↬","\\looparrowright",!0);A(D,le,ce,"↷","\\curvearrowright",!0);A(D,le,ce,"↻","\\circlearrowright",!0);A(D,le,ce,"↱","\\Rsh",!0);A(D,le,ce,"⇊","\\downdownarrows",!0);A(D,le,ce,"↾","\\upharpoonright",!0);A(D,le,ce,"⇂","\\downharpoonright",!0);A(D,le,ce,"⇝","\\rightsquigarrow",!0);A(D,le,ce,"⇝","\\leadsto");A(D,le,ce,"⇛","\\Rrightarrow",!0);A(D,le,ce,"↾","\\restriction");A(D,Q,pe,"","`");A(D,Q,pe,"$","\\$");A(Le,Q,pe,"$","\\$");A(Le,Q,pe,"$","\\textdollar");A(D,Q,pe,"%","\\%");A(Le,Q,pe,"%","\\%");A(D,Q,pe,"_","\\_");A(Le,Q,pe,"_","\\_");A(Le,Q,pe,"_","\\textunderscore");A(D,Q,pe,"∠","\\angle",!0);A(D,Q,pe,"∞","\\infty",!0);A(D,Q,pe,"","\\prime");A(D,Q,pe,"△","\\triangle");A(D,Q,pe,"Γ","\\Gamma",!0);A(D,Q,pe,"Δ","\\Delta",!0);A(D,Q,pe,"Θ","\\Theta",!0);A(D,Q,pe,"Λ","\\Lambda",!0);A(D,Q,pe,"Ξ","\\Xi",!0);A(D,Q,pe,"Π","\\Pi",!0);A(D,Q,pe,"Σ","\\Sigma",!0);A(D,Q,pe,"Υ","\\Upsilon",!0);A(D,Q,pe,"Φ","\\Phi",!0);A(D,Q,pe,"Ψ","\\Psi",!0);A(D,Q,pe,"Ω","\\Omega",!0);A(D,Q,pe,"A","Α");A(D,Q,pe,"B","Β");A(D,Q,pe,"E","Ε");A(D,Q,pe,"Z","Ζ");A(D,Q,pe,"H","Η");A(D,Q,pe,"I","Ι");A(D,Q,pe,"K","Κ");A(D,Q,pe,"M","Μ");A(D,Q,pe,"N","Ν");A(D,Q,pe,"O","Ο");A(D,Q,pe,"P","Ρ");A(D,Q,pe,"T","Τ");A(D,Q,pe,"X","Χ");A(D,Q,pe,"¬","\\neg",!0);A(D,Q,pe,"¬","\\lnot");A(D,Q,pe,"","\\top");A(D,Q,pe,"⊥","\\bot");A(D,Q,pe,"∅","\\emptyset");A(D,le,pe,"∅","\\varnothing");A(D,Q,St,"α","\\alpha",!0);A(D,Q,St,"β","\\beta",!0);A(D,Q,St,"γ","\\gamma",!0);A(D,Q,St,"δ","\\delta",!0);A(D,Q,St,"ϵ","\\epsilon",!0);A(D,Q,St,"ζ","\\zeta",!0);A(D,Q,St,"η","\\eta",!0);A(D,Q,St,"θ","\\theta",!0);A(D,Q,St,"ι","\\iota",!0);A(D,Q,St,"κ","\\kappa",!0);A(D,Q,St,"λ","\\lambda",!0);A(D,Q,St,"μ","\\mu",!0);A(D,Q,St,"ν","\\nu",!0);A(D,Q,St,"ξ","\\xi",!0);A(D,Q,St,"ο","\\omicron",!0);A(D,Q,St,"π","\\pi",!0);A(D,Q,St,"ρ","\\rho",!0);A(D,Q,St,"σ","\\sigma",!0);A(D,Q,St,"τ","\\tau",!0);A(D,Q,St,"υ","\\upsilon",!0);A(D,Q,St,"ϕ","\\phi",!0);A(D,Q,St,"χ","\\chi",!0);A(D,Q,St,"ψ","\\psi",!0);A(D,Q,St,"ω","\\omega",!0);A(D,Q,St,"ε","\\varepsilon",!0);A(D,Q,St,"ϑ","\\vartheta",!0);A(D,Q,St,"ϖ","\\varpi",!0);A(D,Q,St,"ϱ","\\varrho",!0);A(D,Q,St,"ς","\\varsigma",!0);A(D,Q,St,"φ","\\varphi",!0);A(D,Q,nt,"","*",!0);A(D,Q,nt,"+","+");A(D,Q,nt,"","-",!0);A(D,Q,nt,"⋅","\\cdot",!0);A(D,Q,nt,"∘","\\circ",!0);A(D,Q,nt,"÷","\\div",!0);A(D,Q,nt,"±","\\pm",!0);A(D,Q,nt,"×","\\times",!0);A(D,Q,nt,"∩","\\cap",!0);A(D,Q,nt,"","\\cup",!0);A(D,Q,nt,"","\\setminus",!0);A(D,Q,nt,"∧","\\land");A(D,Q,nt,"","\\lor");A(D,Q,nt,"∧","\\wedge",!0);A(D,Q,nt,"","\\vee",!0);A(D,Q,pe,"√","\\surd");A(D,Q,Ri,"⟨","\\langle",!0);A(D,Q,Ri,"","\\lvert");A(D,Q,Ri,"∥","\\lVert");A(D,Q,Ps,"?","?");A(D,Q,Ps,"!","!");A(D,Q,Ps,"⟩","\\rangle",!0);A(D,Q,Ps,"","\\rvert");A(D,Q,Ps,"∥","\\rVert");A(D,Q,ce,"=","=");A(D,Q,ce,":",":");A(D,Q,ce,"≈","\\approx",!0);A(D,Q,ce,"≅","\\cong",!0);A(D,Q,ce,"≥","\\ge");A(D,Q,ce,"≥","\\geq",!0);A(D,Q,ce,"←","\\gets");A(D,Q,ce,">","\\gt",!0);A(D,Q,ce,"∈","\\in",!0);A(D,Q,ce,"","\\@not");A(D,Q,ce,"⊂","\\subset",!0);A(D,Q,ce,"⊃","\\supset",!0);A(D,Q,ce,"⊆","\\subseteq",!0);A(D,Q,ce,"⊇","\\supseteq",!0);A(D,le,ce,"⊈","\\nsubseteq",!0);A(D,le,ce,"⊉","\\nsupseteq",!0);A(D,Q,ce,"⊨","\\models");A(D,Q,ce,"←","\\leftarrow",!0);A(D,Q,ce,"≤","\\le");A(D,Q,ce,"≤","\\leq",!0);A(D,Q,ce,"<","\\lt",!0);A(D,Q,ce,"→","\\rightarrow",!0);A(D,Q,ce,"→","\\to");A(D,le,ce,"≱","\\ngeq",!0);A(D,le,ce,"≰","\\nleq",!0);A(D,Q,wl," ","\\ ");A(D,Q,wl," ","\\space");A(D,Q,wl," ","\\nobreakspace");A(Le,Q,wl," ","\\ ");A(Le,Q,wl," "," ");A(Le,Q,wl," ","\\space");A(Le,Q,wl," ","\\nobreakspace");A(D,Q,wl,null,"\\nobreak");A(D,Q,wl,null,"\\allowbreak");A(D,Q,my,",",",");A(D,Q,my,";",";");A(D,le,nt,"⊼","\\barwedge",!0);A(D,le,nt,"⊻","\\veebar",!0);A(D,Q,nt,"⊙","\\odot",!0);A(D,Q,nt,"⊕","\\oplus",!0);A(D,Q,nt,"⊗","\\otimes",!0);A(D,Q,pe,"∂","\\partial",!0);A(D,Q,nt,"⊘","\\oslash",!0);A(D,le,nt,"⊚","\\circledcirc",!0);A(D,le,nt,"⊡","\\boxdot",!0);A(D,Q,nt,"△","\\bigtriangleup");A(D,Q,nt,"▽","\\bigtriangledown");A(D,Q,nt,"†","\\dagger");A(D,Q,nt,"⋄","\\diamond");A(D,Q,nt,"⋆","\\star");A(D,Q,nt,"◃","\\triangleleft");A(D,Q,nt,"▹","\\triangleright");A(D,Q,Ri,"{","\\{");A(Le,Q,pe,"{","\\{");A(Le,Q,pe,"{","\\textbraceleft");A(D,Q,Ps,"}","\\}");A(Le,Q,pe,"}","\\}");A(Le,Q,pe,"}","\\textbraceright");A(D,Q,Ri,"{","\\lbrace");A(D,Q,Ps,"}","\\rbrace");A(D,Q,Ri,"[","\\lbrack",!0);A(Le,Q,pe,"[","\\lbrack",!0);A(D,Q,Ps,"]","\\rbrack",!0);A(Le,Q,pe,"]","\\rbrack",!0);A(D,Q,Ri,"(","\\lparen",!0);A(D,Q,Ps,")","\\rparen",!0);A(Le,Q,pe,"<","\\textless",!0);A(Le,Q,pe,">","\\textgreater",!0);A(D,Q,Ri,"⌊","\\lfloor",!0);A(D,Q,Ps,"⌋","\\rfloor",!0);A(D,Q,Ri,"⌈","\\lceil",!0);A(D,Q,Ps,"⌉","\\rceil",!0);A(D,Q,pe,"\\","\\backslash");A(D,Q,pe,"","|");A(D,Q,pe,"","\\vert");A(Le,Q,pe,"|","\\textbar",!0);A(D,Q,pe,"∥","\\|");A(D,Q,pe,"∥","\\Vert");A(Le,Q,pe,"∥","\\textbardbl");A(Le,Q,pe,"~","\\textasciitilde");A(Le,Q,pe,"\\","\\textbackslash");A(Le,Q,pe,"^","\\textasciicircum");A(D,Q,ce,"↑","\\uparrow",!0);A(D,Q,ce,"⇑","\\Uparrow",!0);A(D,Q,ce,"↓","\\downarrow",!0);A(D,Q,ce,"⇓","\\Downarrow",!0);A(D,Q,ce,"↕","\\updownarrow",!0);A(D,Q,ce,"⇕","\\Updownarrow",!0);A(D,Q,Lr,"∐","\\coprod");A(D,Q,Lr,"","\\bigvee");A(D,Q,Lr,"⋀","\\bigwedge");A(D,Q,Lr,"⨄","\\biguplus");A(D,Q,Lr,"⋂","\\bigcap");A(D,Q,Lr,"","\\bigcup");A(D,Q,Lr,"∫","\\int");A(D,Q,Lr,"∫","\\intop");A(D,Q,Lr,"∬","\\iint");A(D,Q,Lr,"∭","\\iiint");A(D,Q,Lr,"∏","\\prod");A(D,Q,Lr,"∑","\\sum");A(D,Q,Lr,"⨂","\\bigotimes");A(D,Q,Lr,"⨁","\\bigoplus");A(D,Q,Lr,"⨀","\\bigodot");A(D,Q,Lr,"∮","\\oint");A(D,Q,Lr,"∯","\\oiint");A(D,Q,Lr,"∰","\\oiiint");A(D,Q,Lr,"⨆","\\bigsqcup");A(D,Q,Lr,"∫","\\smallint");A(Le,Q,Kh,"…","\\textellipsis");A(D,Q,Kh,"…","\\mathellipsis");A(Le,Q,Kh,"…","\\ldots",!0);A(D,Q,Kh,"…","\\ldots",!0);A(D,Q,Kh,"⋯","\\@cdots",!0);A(D,Q,Kh,"⋱","\\ddots",!0);A(D,Q,pe,"⋮","\\varvdots");A(Le,Q,pe,"⋮","\\varvdots");A(D,Q,sr,"ˊ","\\acute");A(D,Q,sr,"ˋ","\\grave");A(D,Q,sr,"¨","\\ddot");A(D,Q,sr,"~","\\tilde");A(D,Q,sr,"ˉ","\\bar");A(D,Q,sr,"˘","\\breve");A(D,Q,sr,"ˇ","\\check");A(D,Q,sr,"^","\\hat");A(D,Q,sr,"⃗","\\vec");A(D,Q,sr,"˙","\\dot");A(D,Q,sr,"˚","\\mathring");A(D,Q,St,"","\\@imath");A(D,Q,St,"","\\@jmath");A(D,Q,pe,"ı","ı");A(D,Q,pe,"ȷ","ȷ");A(Le,Q,pe,"ı","\\i",!0);A(Le,Q,pe,"ȷ","\\j",!0);A(Le,Q,pe,"ß","\\ss",!0);A(Le,Q,pe,"æ","\\ae",!0);A(Le,Q,pe,"œ","\\oe",!0);A(Le,Q,pe,"ø","\\o",!0);A(Le,Q,pe,"Æ","\\AE",!0);A(Le,Q,pe,"Œ","\\OE",!0);A(Le,Q,pe,"Ø","\\O",!0);A(Le,Q,sr,"ˊ","\\'");A(Le,Q,sr,"ˋ","\\`");A(Le,Q,sr,"ˆ","\\^");A(Le,Q,sr,"˜","\\~");A(Le,Q,sr,"ˉ","\\=");A(Le,Q,sr,"˘","\\u");A(Le,Q,sr,"˙","\\.");A(Le,Q,sr,"¸","\\c");A(Le,Q,sr,"˚","\\r");A(Le,Q,sr,"ˇ","\\v");A(Le,Q,sr,"¨",'\\"');A(Le,Q,sr,"˝","\\H");A(Le,Q,sr,"◯","\\textcircled");var H$={"--":!0,"---":!0,"``":!0,"''":!0};A(Le,Q,pe,"","--",!0);A(Le,Q,pe,"","\\textendash");A(Le,Q,pe,"—","---",!0);A(Le,Q,pe,"—","\\textemdash");A(Le,Q,pe,"","`",!0);A(Le,Q,pe,"","\\textquoteleft");A(Le,Q,pe,"","'",!0);A(Le,Q,pe,"","\\textquoteright");A(Le,Q,pe,"“","``",!0);A(Le,Q,pe,"“","\\textquotedblleft");A(Le,Q,pe,"”","''",!0);A(Le,Q,pe,"”","\\textquotedblright");A(D,Q,pe,"°","\\degree",!0);A(Le,Q,pe,"°","\\degree");A(Le,Q,pe,"°","\\textdegree",!0);A(D,Q,pe,"£","\\pounds");A(D,Q,pe,"£","\\mathsterling",!0);A(Le,Q,pe,"£","\\pounds");A(Le,Q,pe,"£","\\textsterling",!0);A(D,le,pe,"✠","\\maltese");A(Le,le,pe,"✠","\\maltese");var V_='0123456789/@."';for(var h4=0;h4<V_.length;h4++){var U_=V_.charAt(h4);A(D,Q,pe,U_,U_)}var W_='0123456789!@*()-=+";:?/.,';for(var f4=0;f4<W_.length;f4++){var G_=W_.charAt(f4);A(Le,Q,pe,G_,G_)}var av="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var m4=0;m4<av.length;m4++){var jx=av.charAt(m4);A(D,Q,St,jx,jx),A(Le,Q,pe,jx,jx)}A(D,le,pe,"C","");A(Le,le,pe,"C","");A(D,le,pe,"H","");A(Le,le,pe,"H","");A(D,le,pe,"N","");A(Le,le,pe,"N","");A(D,le,pe,"P","");A(Le,le,pe,"P","");A(D,le,pe,"Q","");A(Le,le,pe,"Q","");A(D,le,pe,"R","");A(Le,le,pe,"R","");A(D,le,pe,"Z","");A(Le,le,pe,"Z","");A(D,Q,St,"h","");A(Le,Q,St,"h","");var Ct="";for(var Ts=0;Ts<av.length;Ts++){var mr=av.charAt(Ts);Ct=String.fromCharCode(55349,56320+Ts),A(D,Q,St,mr,Ct),A(Le,Q,pe,mr,Ct),Ct=String.fromCharCode(55349,56372+Ts),A(D,Q,St,mr,Ct),A(Le,Q,pe,mr,Ct),Ct=String.fromCharCode(55349,56424+Ts),A(D,Q,St,mr,Ct),A(Le,Q,pe,mr,Ct),Ct=String.fromCharCode(55349,56580+Ts),A(D,Q,St,mr,Ct),A(Le,Q,pe,mr,Ct),Ct=String.fromCharCode(55349,56684+Ts),A(D,Q,St,mr,Ct),A(Le,Q,pe,mr,Ct),Ct=String.fromCharCode(55349,56736+Ts),A(D,Q,St,mr,Ct),A(Le,Q,pe,mr,Ct),Ct=String.fromCharCode(55349,56788+Ts),A(D,Q,St,mr,Ct),A(Le,Q,pe,mr,Ct),Ct=String.fromCharCode(55349,56840+Ts),A(D,Q,St,mr,Ct),A(Le,Q,pe,mr,Ct),Ct=String.fromCharCode(55349,56944+Ts),A(D,Q,St,mr,Ct),A(Le,Q,pe,mr,Ct),Ts<26&&(Ct=String.fromCharCode(55349,56632+Ts),A(D,Q,St,mr,Ct),A(Le,Q,pe,mr,Ct),Ct=String.fromCharCode(55349,56476+Ts),A(D,Q,St,mr,Ct),A(Le,Q,pe,mr,Ct))}Ct="𝕜";A(D,Q,St,"k",Ct);A(Le,Q,pe,"k",Ct);for(var su=0;su<10;su++){var Zl=su.toString();Ct=String.fromCharCode(55349,57294+su),A(D,Q,St,Zl,Ct),A(Le,Q,pe,Zl,Ct),Ct=String.fromCharCode(55349,57314+su),A(D,Q,St,Zl,Ct),A(Le,Q,pe,Zl,Ct),Ct=String.fromCharCode(55349,57324+su),A(D,Q,St,Zl,Ct),A(Le,Q,pe,Zl,Ct),Ct=String.fromCharCode(55349,57334+su),A(D,Q,St,Zl,Ct),A(Le,Q,pe,Zl,Ct)}var rk="ÐÞþ";for(var p4=0;p4<rk.length;p4++){var Nx=rk.charAt(p4);A(D,Q,St,Nx,Nx),A(Le,Q,pe,Nx,Nx)}var Cx=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],X_=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],Zye=function(e,n){var r=e.charCodeAt(0),s=e.charCodeAt(1),i=(r-55296)*1024+(s-56320)+65536,a=n==="math"?0:1;if(119808<=i&&i<120484){var l=Math.floor((i-119808)/26);return[Cx[l][2],Cx[l][a]]}else if(120782<=i&&i<=120831){var c=Math.floor((i-120782)/10);return[X_[c][2],X_[c][a]]}else{if(i===120485||i===120486)return[Cx[0][2],Cx[0][a]];if(120486<i&&i<120782)return["",""];throw new Be("Unsupported character: "+e)}},py=function(e,n,r){return Gn[r][e]&&Gn[r][e].replace&&(e=Gn[r][e].replace),{value:e,metrics:FO(e,n,r)}},va=function(e,n,r,s,i){var a=py(e,n,r),l=a.metrics;e=a.value;var c;if(l){var h=l.italic;(r==="text"||s&&s.font==="mathit")&&(h=0),c=new aa(e,l.height,l.depth,h,l.skew,l.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+n+"' and mode '"+r+"'")),c=new aa(e,0,0,0,0,0,i);if(s){c.maxFontSize=s.sizeMultiplier,s.style.isTight()&&c.classes.push("mtight");var f=s.getColor();f&&(c.style.color=f)}return c},Jye=function(e,n,r,s){return s===void 0&&(s=[]),r.font==="boldsymbol"&&py(e,"Main-Bold",n).metrics?va(e,"Main-Bold",n,r,s.concat(["mathbf"])):e==="\\"||Gn[n][e].font==="main"?va(e,"Main-Regular",n,r,s):va(e,"AMS-Regular",n,r,s.concat(["amsrm"]))},ebe=function(e,n,r,s,i){return i!=="textord"&&py(e,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},tbe=function(e,n,r){var s=e.mode,i=e.text,a=["mord"],l=s==="math"||s==="text"&&n.font,c=l?n.font:n.fontFamily,h="",f="";if(i.charCodeAt(0)===55349&&([h,f]=Zye(i,s)),h.length>0)return va(i,h,s,n,a.concat(f));if(c){var m,g;if(c==="boldsymbol"){var x=ebe(i,s,n,a,r);m=x.fontName,g=[x.fontClass]}else l?(m=W$[c].fontName,g=[c]):(m=Tx(c,n.fontWeight,n.fontShape),g=[c,n.fontWeight,n.fontShape]);if(py(i,m,s).metrics)return va(i,m,s,n,a.concat(g));if(H$.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w<i.length;w++)y.push(va(i[w],m,s,n,a.concat(g)));return U$(y)}}if(r==="mathord")return va(i,"Math-Italic",s,n,a.concat(["mathnormal"]));if(r==="textord"){var S=Gn[s][i]&&Gn[s][i].font;if(S==="ams"){var k=Tx("amsrm",n.fontWeight,n.fontShape);return va(i,k,s,n,a.concat("amsrm",n.fontWeight,n.fontShape))}else if(S==="main"||!S){var N=Tx("textrm",n.fontWeight,n.fontShape);return va(i,N,s,n,a.concat(n.fontWeight,n.fontShape))}else{var C=Tx(S,n.fontWeight,n.fontShape);return va(i,C,s,n,a.concat(C,n.fontWeight,n.fontShape))}}else throw new Error("unexpected type: "+r+" in makeOrd")},nbe=(t,e)=>{if(Sc(t.classes)!==Sc(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},rbe=t=>{for(var e=0;e<t.length-1;e++){var n=t[e],r=t[e+1];n instanceof aa&&r instanceof aa&&nbe(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,t.splice(e+1,1),e--)}return t},QO=function(e){for(var n=0,r=0,s=0,i=0;i<e.children.length;i++){var a=e.children[i];a.height>n&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Gs=function(e,n,r,s){var i=new lp(e,n,r,s);return QO(i),i},V$=(t,e,n,r)=>new lp(t,e,n,r),sbe=function(e,n,r){var s=Gs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Ve(s.height),s.maxFontSize=1,s},ibe=function(e,n,r,s){var i=new $O(e,n,r,s);return QO(i),i},U$=function(e){var n=new op(e);return QO(n),n},abe=function(e,n){return e instanceof op?Gs([],[e],n):e},obe=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<n.length;a++){var l=-n[a].shift-i-n[a].elem.depth,c=l-(n[a-1].elem.height+n[a-1].elem.depth);i=i+l,r.push({type:"kern",size:c}),r.push(n[a])}return{children:r,depth:s}}var h;if(e.positionType==="top"){for(var f=e.positionData,m=0;m<e.children.length;m++){var g=e.children[m];f-=g.type==="kern"?g.size:g.elem.height+g.elem.depth}h=f}else if(e.positionType==="bottom")h=-e.positionData;else{var x=e.children[0];if(x.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")h=-x.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")h=-x.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:h}},lbe=function(e,n){for(var{children:r,depth:s}=obe(e),i=0,a=0;a<r.length;a++){var l=r[a];if(l.type==="elem"){var c=l.elem;i=Math.max(i,c.maxFontSize,c.height)}}i+=2;var h=Gs(["pstrut"],[]);h.style.height=Ve(i);for(var f=[],m=s,g=s,x=s,y=0;y<r.length;y++){var w=r[y];if(w.type==="kern")x+=w.size;else{var S=w.elem,k=w.wrapperClasses||[],N=w.wrapperStyle||{},C=Gs(k,[h,S],void 0,N);C.style.top=Ve(-i-x-S.depth),w.marginLeft&&(C.style.marginLeft=w.marginLeft),w.marginRight&&(C.style.marginRight=w.marginRight),f.push(C),x+=S.height+S.depth}m=Math.min(m,x),g=Math.max(g,x)}var T=Gs(["vlist"],f);T.style.height=Ve(g);var _;if(m<0){var E=Gs([],[]),M=Gs(["vlist"],[E]);M.style.height=Ve(-m);var q=Gs(["vlist-s"],[new aa("")]);_=[Gs(["vlist-r"],[T,q]),Gs(["vlist-r"],[M])]}else _=[Gs(["vlist-r"],[T])];var L=Gs(["vlist-t"],_);return _.length===2&&L.classes.push("vlist-t2"),L.height=g,L.depth=-m,L},cbe=(t,e)=>{var n=Gs(["mspace"],[],e),r=cr(t,e);return n.style.marginRight=Ve(r),n},Tx=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},W$={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"}},G$={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},ube=function(e,n){var[r,s,i]=G$[e],a=new kc(r),l=new ml([a],{width:Ve(s),height:Ve(i),style:"width:"+Ve(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=V$(["overlay"],[l],n);return c.height=i,c.style.height=Ve(i),c.style.width=Ve(s),c},we={fontMap:W$,makeSymbol:va,mathsym:Jye,makeSpan:Gs,makeSvgSpan:V$,makeLineSpan:sbe,makeAnchor:ibe,makeFragment:U$,wrapFragment:abe,makeVList:lbe,makeOrd:tbe,makeGlue:cbe,staticSvg:ube,svgData:G$,tryCombineChars:rbe},or={number:3,unit:"mu"},iu={number:4,unit:"mu"},Fo={number:5,unit:"mu"},dbe={mord:{mop:or,mbin:iu,mrel:Fo,minner:or},mop:{mord:or,mop:or,mrel:Fo,minner:or},mbin:{mord:iu,mop:iu,mopen:iu,minner:iu},mrel:{mord:Fo,mop:Fo,mopen:Fo,minner:Fo},mopen:{},mclose:{mop:or,mbin:iu,mrel:Fo,minner:or},mpunct:{mord:or,mop:or,mrel:Fo,mopen:or,mclose:or,mpunct:or,minner:or},minner:{mord:or,mop:or,mbin:iu,mrel:Fo,mopen:or,mpunct:or,minner:or}},hbe={mord:{mop:or},mop:{mord:or,mop:or},mbin:{},mrel:{},mopen:{},mclose:{mop:or},mpunct:{},minner:{mop:or}},X$={},ov={},lv={};function Ke(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,l={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},c=0;c<n.length;++c)X$[n[c]]=l;e&&(i&&(ov[e]=i),a&&(lv[e]=a))}function Fu(t){var{type:e,htmlBuilder:n,mathmlBuilder:r}=t;Ke({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var cv=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},wr=function(e){return e.type==="ordgroup"?e.body:[e]},pl=we.makeSpan,fbe=["leftmost","mbin","mopen","mrel","mop","mpunct"],mbe=["rightmost","mrel","mclose","mpunct"],pbe={display:kt.DISPLAY,text:kt.TEXT,script:kt.SCRIPT,scriptscript:kt.SCRIPTSCRIPT},gbe={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Ur=function(e,n,r,s){s===void 0&&(s=[null,null]);for(var i=[],a=0;a<e.length;a++){var l=gn(e[a],n);if(l instanceof op){var c=l.children;i.push(...c)}else i.push(l)}if(we.tryCombineChars(i),!r)return i;var h=n;if(e.length===1){var f=e[0];f.type==="sizing"?h=n.havingSize(f.size):f.type==="styling"&&(h=n.havingStyle(pbe[f.style]))}var m=pl([s[0]||"leftmost"],[],n),g=pl([s[1]||"rightmost"],[],n),x=r==="root";return Y_(i,(y,w)=>{var S=w.classes[0],k=y.classes[0];S==="mbin"&&mbe.includes(k)?w.classes[0]="mord":k==="mbin"&&fbe.includes(S)&&(y.classes[0]="mord")},{node:m},g,x),Y_(i,(y,w)=>{var S=sk(w),k=sk(y),N=S&&k?y.hasClass("mtight")?hbe[S][k]:dbe[S][k]:null;if(N)return we.makeGlue(N,h)},{node:m},g,x),i},Y_=function t(e,n,r,s,i){s&&e.push(s);for(var a=0;a<e.length;a++){var l=e[a],c=Y$(l);if(c){t(c.children,n,r,null,i);continue}var h=!l.hasClass("mspace");if(h){var f=n(l,r.node);f&&(r.insertAfter?r.insertAfter(f):(e.unshift(f),a++))}h?r.node=l:i&&l.hasClass("newline")&&(r.node=pl(["leftmost"])),r.insertAfter=(m=>g=>{e.splice(m+1,0,g),a++})(a)}s&&e.pop()},Y$=function(e){return e instanceof op||e instanceof $O||e instanceof lp&&e.hasClass("enclosing")?e:null},xbe=function t(e,n){var r=Y$(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},sk=function(e,n){return e?(n&&(e=xbe(e,n)),gbe[e.classes[0]]||null):null},x0=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return pl(n.concat(r))},gn=function(e,n,r){if(!e)return pl();if(ov[e.type]){var s=ov[e.type](e,n);if(r&&n.size!==r.size){s=pl(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 Ex(t,e){var n=pl(["base"],t,e),r=pl(["strut"]);return r.style.height=Ve(n.height+n.depth),n.depth&&(r.style.verticalAlign=Ve(-n.depth)),n.children.unshift(r),n}function ik(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Ur(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],l=0;l<r.length;l++)if(a.push(r[l]),r[l].hasClass("mbin")||r[l].hasClass("mrel")||r[l].hasClass("allowbreak")){for(var c=!1;l<r.length-1&&r[l+1].hasClass("mspace")&&!r[l+1].hasClass("newline");)l++,a.push(r[l]),r[l].hasClass("nobreak")&&(c=!0);c||(i.push(Ex(a,e)),a=[])}else r[l].hasClass("newline")&&(a.pop(),a.length>0&&(i.push(Ex(a,e)),a=[]),i.push(r[l]));a.length>0&&i.push(Ex(a,e));var h;n?(h=Ex(Ur(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var f=pl(["katex-html"],i);if(f.setAttribute("aria-hidden","true"),h){var m=h.children[0];m.style.height=Ve(f.height+f.depth),f.depth&&(m.style.verticalAlign=Ve(-f.depth))}return f}function K$(t){return new op(t)}class Ni{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=Sc(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof eo&&this.children[r+1]instanceof eo){for(var s=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof eo;)s+=this.children[++r].toText();e.appendChild(new eo(s).toNode())}else e.appendChild(this.children[r].toNode());return e}toMarkup(){var e="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="',e+=On.escape(this.attributes[n]),e+='"');this.classes.length>0&&(e+=' class ="'+On.escape(Sc(this.classes))+'"'),e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class eo{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return On.escape(this.toText())}toText(){return this.text}}class vbe{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",Ve(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Ve(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var Ie={MathNode:Ni,TextNode:eo,SpaceNode:vbe,newDocumentFragment:K$},oa=function(e,n,r){return Gn[n][e]&&Gn[n][e].replace&&e.charCodeAt(0)!==55349&&!(H$.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Gn[n][e].replace),new Ie.TextNode(e)},HO=function(e){return e.length===1?e[0]:new Ie.MathNode("mrow",e)},VO=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;Gn[s][i]&&Gn[s][i].replace&&(i=Gn[s][i].replace);var a=we.fontMap[r].fontName;return FO(i,a,s)?we.fontMap[r].variant:null};function g4(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof eo&&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 eo&&n.text===","}else return!1}var ui=function(e,n,r){if(e.length===1){var s=Un(e[0],n);return r&&s instanceof Ni&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,l=0;l<e.length;l++){var c=Un(e[l],n);if(c instanceof Ni&&a instanceof Ni){if(c.type==="mtext"&&a.type==="mtext"&&c.getAttribute("mathvariant")===a.getAttribute("mathvariant")){a.children.push(...c.children);continue}else if(c.type==="mn"&&a.type==="mn"){a.children.push(...c.children);continue}else if(g4(c)&&a.type==="mn"){a.children.push(...c.children);continue}else if(c.type==="mn"&&g4(a))c.children=[...a.children,...c.children],i.pop();else if((c.type==="msup"||c.type==="msub")&&c.children.length>=1&&(a.type==="mn"||g4(a))){var h=c.children[0];h instanceof Ni&&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 eo&&f.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var m=c.children[0];m instanceof eo&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),i.pop())}}}i.push(c),a=c}return i},Oc=function(e,n,r){return HO(ui(e,n,r))},Un=function(e,n){if(!e)return new Ie.MathNode("mrow");if(lv[e.type]){var r=lv[e.type](e,n);return r}else throw new Be("Got group of unknown type: '"+e.type+"'")};function K_(t,e,n,r,s){var i=ui(t,n),a;i.length===1&&i[0]instanceof Ni&&["mrow","mtable"].includes(i[0].type)?a=i[0]:a=new Ie.MathNode("mrow",i);var l=new Ie.MathNode("annotation",[new Ie.TextNode(e)]);l.setAttribute("encoding","application/x-tex");var c=new Ie.MathNode("semantics",[a,l]),h=new Ie.MathNode("math",[c]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var f=s?"katex":"katex-mathml";return we.makeSpan([f],[h])}var Z$=function(e){return new Xo({style:e.displayMode?kt.DISPLAY:kt.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},J$=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=we.makeSpan(r,[e])}return e},ybe=function(e,n,r){var s=Z$(r),i;if(r.output==="mathml")return K_(e,n,s,r.displayMode,!0);if(r.output==="html"){var a=ik(e,s);i=we.makeSpan(["katex"],[a])}else{var l=K_(e,n,s,r.displayMode,!1),c=ik(e,s);i=we.makeSpan(["katex"],[l,c])}return J$(i,r)},bbe=function(e,n,r){var s=Z$(r),i=ik(e,s),a=we.makeSpan(["katex"],[i]);return J$(a,r)},wbe={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":"="},Sbe=function(e){var n=new Ie.MathNode("mo",[new Ie.TextNode(wbe[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},kbe={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]},Obe=function(e){return e.type==="ordgroup"?e.body.length:1},jbe=function(e,n){function r(){var l=4e5,c=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(c)){var h=e,f=Obe(h.base),m,g,x;if(f>5)c==="widehat"||c==="widecheck"?(m=420,l=2364,x=.42,g=c+"4"):(m=312,l=2340,x=.34,g="tilde4");else{var y=[1,1,2,2,3,3][f];c==="widehat"||c==="widecheck"?(l=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],x=[0,.24,.3,.3,.36,.42][y],g=c+y):(l=[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 kc(g),S=new ml([w],{width:"100%",height:Ve(x),viewBox:"0 0 "+l+" "+m,preserveAspectRatio:"none"});return{span:we.makeSvgSpan([],[S],n),minWidth:0,height:x}}else{var k=[],N=kbe[c],[C,T,_]=N,E=_/1e3,M=C.length,q,L;if(M===1){var I=N[3];q=["hide-tail"],L=[I]}else if(M===2)q=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(M===3)q=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
`+M+" children.");for(var $=0;$<M;$++){var V=new kc(C[$]),ee=new ml([V],{width:"400em",height:Ve(E),viewBox:"0 0 "+l+" "+_,preserveAspectRatio:L[$]+" slice"}),z=we.makeSvgSpan([q[$]],[ee],n);if(M===1)return{span:z,minWidth:T,height:E};z.style.height=Ve(E),k.push(z)}return{span:we.makeSpan(["stretchy"],k,n),minWidth:T,height:E}}}var{span:s,minWidth:i,height:a}=r();return s.height=a,s.style.height=Ve(a),i>0&&(s.style.minWidth=Ve(i)),s},Nbe=function(e,n,r,s,i){var a,l=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(a=we.makeSpan(["stretchy",n],[],i),n==="fbox"){var c=i.color&&i.getColor();c&&(a.style.borderColor=c)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new nk({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new nk({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var f=new ml(h,{width:"100%",height:Ve(l)});a=we.makeSvgSpan([],[f],i)}return a.height=l,a.style.height=Ve(l),a},gl={encloseSpan:Nbe,mathMLnode:Sbe,svgSpan:jbe};function Ft(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 UO(t){var e=gy(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 gy(t){return t&&(t.type==="atom"||Kye.hasOwnProperty(t.type))?t:null}var WO=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=Ft(t.base,"accent"),n=r.base,t.base=n,s=Xye(gn(t,e)),t.base=r):(r=Ft(t,"accent"),n=r.base);var i=gn(n,e.havingCrampedStyle()),a=r.isShifty&&On.isCharacterBox(n),l=0;if(a){var c=On.getBaseElem(n),h=gn(c,e.havingCrampedStyle());l=H_(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=gl.svgSpan(r,e),g=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+Ve(2*l)+")",marginLeft:Ve(2*l)}:void 0}]},e);else{var x,y;r.label==="\\vec"?(x=we.staticSvg("vec",e),y=we.svgData.vec[1]):(x=we.makeOrd({mode:r.mode,text:r.label},e,"textord"),x=H_(x),x.italic=0,y=x.width,f&&(m+=x.depth)),g=we.makeSpan(["accent-body"],[x]);var w=r.label==="\\textcircled";w&&(g.classes.push("accent-full"),m=i.height);var S=l;w||(S-=y/2),g.style.left=Ve(S),r.label==="\\textcircled"&&(g.style.top=".2em"),g=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:g}]},e)}var k=we.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},eQ=(t,e)=>{var n=t.isStretchy?gl.mathMLnode(t.label):new Ie.MathNode("mo",[oa(t.label,t.mode)]),r=new Ie.MathNode("mover",[Un(t.base,e),n]);return r.setAttribute("accent","true"),r},Cbe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Ke({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=cv(e[0]),r=!Cbe.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:WO,mathmlBuilder:eQ});Ke({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:WO,mathmlBuilder:eQ});Ke({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=gn(t.base,e),r=gl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=we.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return we.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=gl.mathMLnode(t.label),r=new Ie.MathNode("munder",[Un(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var _x=t=>{var e=new Ie.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Ke({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=we.wrapFragment(gn(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=we.wrapFragment(gn(t.below,r,e),e),a.classes.push(i+"-arrow-pad"));var l=gl.svgSpan(t,e),c=-e.fontMetrics().axisHeight+.5*l.height,h=-e.fontMetrics().axisHeight-.5*l.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var f;if(a){var m=-e.fontMetrics().axisHeight+a.height+.5*l.height+.111;f=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:l,shift:c},{type:"elem",elem:a,shift:m}]},e)}else f=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:l,shift:c}]},e);return f.children[0].children[0].children[1].classes.push("svg-align"),we.makeSpan(["mrel","x-arrow"],[f],e)},mathmlBuilder(t,e){var n=gl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=_x(Un(t.body,e));if(t.below){var i=_x(Un(t.below,e));r=new Ie.MathNode("munderover",[n,i,s])}else r=new Ie.MathNode("mover",[n,s])}else if(t.below){var a=_x(Un(t.below,e));r=new Ie.MathNode("munder",[n,a])}else r=_x(),r=new Ie.MathNode("mover",[n,r]);return r}});var Tbe=we.makeSpan;function tQ(t,e){var n=Ur(t.body,e,!0);return Tbe([t.mclass],n,e)}function nQ(t,e){var n,r=ui(t.body,e);return t.mclass==="minner"?n=new Ie.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new Ie.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new Ie.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}Ke({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:wr(s),isCharacterBox:On.isCharacterBox(s)}},htmlBuilder:tQ,mathmlBuilder:nQ});var xy=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"};Ke({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:xy(e[0]),body:wr(e[1]),isCharacterBox:On.isCharacterBox(e[1])}}});Ke({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=xy(s):a="mrel";var l={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:wr(s)},c={type:"supsub",mode:i.mode,base:l,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:a,body:[c],isCharacterBox:On.isCharacterBox(c)}},htmlBuilder:tQ,mathmlBuilder:nQ});Ke({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:xy(e[0]),body:wr(e[0])}},htmlBuilder(t,e){var n=Ur(t.body,e,!0),r=we.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=ui(t.body,e),r=new Ie.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Ebe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Z_=()=>({type:"styling",body:[],mode:"math",style:"display"}),J_=t=>t.type==="textord"&&t.text==="@",_be=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Mbe(t,e,n){var r=Ebe[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],[]),l=n.callFunction("\\\\cdright",[e[1]],[]),c={type:"ordgroup",mode:"math",body:[s,a,l]};return n.callFunction("\\\\cdparent",[c],[])}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 Abe(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<e.length;i++){for(var a=e[i],l=Z_(),c=0;c<a.length;c++)if(!J_(a[c]))l.body.push(a[c]);else{r.push(l),c+=1;var h=UO(a[c]).text,f=new Array(2);if(f[0]={type:"ordgroup",mode:"math",body:[]},f[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(h)>-1))if("<>AV".indexOf(h)>-1)for(var m=0;m<2;m++){for(var g=!0,x=c+1;x<a.length;x++){if(_be(a[x],h)){g=!1,c=x;break}if(J_(a[x]))throw new Be("Missing a "+h+" character to complete a CD arrow.",a[x]);f[m].body.push(a[x])}if(g)throw new Be("Missing a "+h+" character to complete a CD arrow.",a[c])}else throw new Be('Expected one of "<>AV=|." after @',a[c]);var y=Mbe(h,f,t),w={type:"styling",body:[y],mode:"math",style:"display"};r.push(w),l=Z_()}i%2===0?r.push(l):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var S=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:S,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Ke({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=we.wrapFragment(gn(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Ve(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new Ie.MathNode("mrow",[Un(t.label,e)]);return n=new Ie.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Ie.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Ke({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=we.wrapFragment(gn(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new Ie.MathNode("mrow",[Un(t.fragment,e)])}});Ke({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Ft(e[0],"ordgroup"),s=r.body,i="",a=0;a<s.length;a++){var l=Ft(s[a],"textord");i+=l.text}var c=parseInt(i),h;if(isNaN(c))throw new Be("\\@char has non-numeric argument "+i);if(c<0||c>=1114111)throw new Be("\\@char with invalid code point "+i);return c<=65535?h=String.fromCharCode(c):(c-=65536,h=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var rQ=(t,e)=>{var n=Ur(t.body,e.withColor(t.color),!1);return we.makeFragment(n)},sQ=(t,e)=>{var n=ui(t.body,e.withColor(t.color)),r=new Ie.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Ke({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Ft(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:wr(s)}},htmlBuilder:rQ,mathmlBuilder:sQ});Ke({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=Ft(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:rQ,mathmlBuilder:sQ});Ke({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&&Ft(s,"size").value}},htmlBuilder(t,e){var n=we.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Ve(cr(t.size,e)))),n},mathmlBuilder(t,e){var n=new Ie.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Ve(cr(t.size,e)))),n}});var ak={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},iQ=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new Be("Expected a control sequence",t);return e},Rbe=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},aQ=(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)};Ke({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(ak[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=ak[r.text]),Ft(e.parseFunction(),"internal");throw new Be("Invalid token after macro prefix",r)}});Ke({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,l=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),l[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++,l.push([])}else{if(r.text==="EOF")throw new Be("Expected a macro definition");l[i].push(r.text)}var{tokens:c}=e.gullet.consumeArg();return a&&c.unshift(a),(n==="\\edef"||n==="\\xdef")&&(c=e.gullet.expandTokens(c),c.reverse()),e.gullet.macros.set(s,{tokens:c,numArgs:i,delimiters:l},n===ak[n]),{type:"internal",mode:e.mode}}});Ke({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=iQ(e.gullet.popToken());e.gullet.consumeSpaces();var s=Rbe(e);return aQ(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Ke({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=iQ(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return aQ(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var gm=function(e,n,r){var s=Gn.math[e]&&Gn.math[e].replace,i=FO(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},GO=function(e,n,r,s){var i=r.havingBaseStyle(n),a=we.makeSpan(s.concat(i.sizingClasses(r)),[e],r),l=i.sizeMultiplier/r.sizeMultiplier;return a.height*=l,a.depth*=l,a.maxFontSize=i.sizeMultiplier,a},oQ=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=Ve(i),e.height-=i,e.depth+=i},Dbe=function(e,n,r,s,i,a){var l=we.makeSymbol(e,"Main-Regular",i,s),c=GO(l,n,s,a);return r&&oQ(c,s,n),c},zbe=function(e,n,r,s){return we.makeSymbol(e,"Size"+n+"-Regular",r,s)},lQ=function(e,n,r,s,i,a){var l=zbe(e,n,i,s),c=GO(we.makeSpan(["delimsizing","size"+n],[l],s),kt.TEXT,s,a);return r&&oQ(c,s,kt.TEXT),c},x4=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=we.makeSpan(["delimsizinginner",s],[we.makeSpan([],[we.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},v4=function(e,n,r){var s=Ja["Size4-Regular"][e.charCodeAt(0)]?Ja["Size4-Regular"][e.charCodeAt(0)][4]:Ja["Size1-Regular"][e.charCodeAt(0)][4],i=new kc("inner",qye(e,Math.round(1e3*n))),a=new ml([i],{width:Ve(s),height:Ve(n),style:"width:"+Ve(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),l=we.makeSvgSpan([],[a],r);return l.height=n,l.style.height=Ve(n),l.style.width=Ve(s),{type:"elem",elem:l}},ok=.008,Mx={type:"kern",size:-1*ok},Pbe=["|","\\lvert","\\rvert","\\vert"],Lbe=["\\|","\\lVert","\\rVert","\\Vert"],cQ=function(e,n,r,s,i,a){var l,c,h,f,m="",g=0;l=h=f=e,c=null;var x="Size1-Regular";e==="\\uparrow"?h=f="⏐":e==="\\Uparrow"?h=f="‖":e==="\\downarrow"?l=h="⏐":e==="\\Downarrow"?l=h="‖":e==="\\updownarrow"?(l="\\uparrow",h="⏐",f="\\downarrow"):e==="\\Updownarrow"?(l="\\Uparrow",h="‖",f="\\Downarrow"):Pbe.includes(e)?(h="",m="vert",g=333):Lbe.includes(e)?(h="∥",m="doublevert",g=556):e==="["||e==="\\lbrack"?(l="⎡",h="⎢",f="⎣",x="Size4-Regular",m="lbrack",g=667):e==="]"||e==="\\rbrack"?(l="⎤",h="⎥",f="⎦",x="Size4-Regular",m="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(h=l="⎢",f="⎣",x="Size4-Regular",m="lfloor",g=667):e==="\\lceil"||e==="⌈"?(l="⎡",h=f="⎢",x="Size4-Regular",m="lceil",g=667):e==="\\rfloor"||e==="⌋"?(h=l="⎥",f="⎦",x="Size4-Regular",m="rfloor",g=667):e==="\\rceil"||e==="⌉"?(l="⎤",h=f="⎥",x="Size4-Regular",m="rceil",g=667):e==="("||e==="\\lparen"?(l="⎛",h="⎜",f="⎝",x="Size4-Regular",m="lparen",g=875):e===")"||e==="\\rparen"?(l="⎞",h="⎟",f="⎠",x="Size4-Regular",m="rparen",g=875):e==="\\{"||e==="\\lbrace"?(l="⎧",c="⎨",f="⎩",h="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(l="⎫",c="⎬",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(l="⎧",f="⎩",h="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(l="⎫",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(l="⎧",f="⎭",h="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(l="⎫",f="⎩",h="⎪",x="Size4-Regular");var y=gm(l,x,i),w=y.height+y.depth,S=gm(h,x,i),k=S.height+S.depth,N=gm(f,x,i),C=N.height+N.depth,T=0,_=1;if(c!==null){var E=gm(c,x,i);T=E.height+E.depth,_=2}var M=w+C+T,q=Math.max(0,Math.ceil((n-M)/(_*k))),L=M+q*_*k,I=s.fontMetrics().axisHeight;r&&(I*=s.sizeMultiplier);var $=L/2-I,V=[];if(m.length>0){var ee=L-w-C,z=Math.round(L*1e3),H=Fye(m,Math.round(ee*1e3)),P=new kc(m,H),W=(g/1e3).toFixed(3)+"em",J=(z/1e3).toFixed(3)+"em",X=new ml([P],{width:W,height:J,viewBox:"0 0 "+g+" "+z}),R=we.makeSvgSpan([],[X],s);R.height=z/1e3,R.style.width=W,R.style.height=J,V.push({type:"elem",elem:R})}else{if(V.push(x4(f,x,i)),V.push(Mx),c===null){var se=L-w-C+2*ok;V.push(v4(h,se,s))}else{var G=(L-w-C-T)/2+2*ok;V.push(v4(h,G,s)),V.push(Mx),V.push(x4(c,x,i)),V.push(Mx),V.push(v4(h,G,s))}V.push(Mx),V.push(x4(l,x,i))}var F=s.havingBaseStyle(kt.TEXT),U=we.makeVList({positionType:"bottom",positionData:$,children:V},F);return GO(we.makeSpan(["delimsizing","mult"],[U],F),kt.TEXT,s,a)},y4=80,b4=.08,w4=function(e,n,r,s,i){var a=Bye(e,s,r),l=new kc(e,a),c=new ml([l],{width:"400em",height:Ve(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return we.makeSvgSpan(["hide-tail"],[c],i)},Ibe=function(e,n){var r=n.havingBaseSizing(),s=fQ("\\surd",e*r.sizeMultiplier,hQ,r),i=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),l,c=0,h=0,f=0,m;return s.type==="small"?(f=1e3+1e3*a+y4,e<1?i=1:e<1.4&&(i=.7),c=(1+a+b4)/i,h=(1+a)/i,l=w4("sqrtMain",c,f,a,n),l.style.minWidth="0.853em",m=.833/i):s.type==="large"?(f=(1e3+y4)*Lm[s.size],h=(Lm[s.size]+a)/i,c=(Lm[s.size]+a+b4)/i,l=w4("sqrtSize"+s.size,c,f,a,n),l.style.minWidth="1.02em",m=1/i):(c=e+a+b4,h=e+a,f=Math.floor(1e3*e+a)+y4,l=w4("sqrtTall",c,f,a,n),l.style.minWidth="0.742em",m=1.056),l.height=h,l.style.height=Ve(c),{span:l,advanceWidth:m,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*i}},uQ=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Bbe=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],dQ=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Lm=[0,1.2,1.8,2.4,3],qbe=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),uQ.includes(e)||dQ.includes(e))return lQ(e,n,!1,r,s,i);if(Bbe.includes(e))return cQ(e,Lm[n],!1,r,s,i);throw new Be("Illegal delimiter: '"+e+"'")},Fbe=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],$be=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"stack"}],hQ=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Qbe=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.")},fQ=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),a=i;a<r.length&&r[a].type!=="stack";a++){var l=gm(e,Qbe(r[a]),"math"),c=l.height+l.depth;if(r[a].type==="small"){var h=s.havingBaseStyle(r[a].style);c*=h.sizeMultiplier}if(c>n)return r[a]}return r[r.length-1]},mQ=function(e,n,r,s,i,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var l;dQ.includes(e)?l=Fbe:uQ.includes(e)?l=hQ:l=$be;var c=fQ(e,n,l,s);return c.type==="small"?Dbe(e,c.style,r,s,i,a):c.type==="large"?lQ(e,c.size,r,s,i,a):cQ(e,n,r,s,i,a)},Hbe=function(e,n,r,s,i,a){var l=s.fontMetrics().axisHeight*s.sizeMultiplier,c=901,h=5/s.fontMetrics().ptPerEm,f=Math.max(n-l,r+l),m=Math.max(f/500*c,2*f-h);return mQ(e,m,!0,s,i,a)},al={sqrtImage:Ibe,sizedDelim:qbe,sizeToMaxHeight:Lm,customSizedDelim:mQ,leftRightDelim:Hbe},eM={"\\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}},Vbe=["(","\\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 vy(t,e){var n=gy(t);if(n&&Vbe.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)}Ke({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=vy(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:eM[t.funcName].size,mclass:eM[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?we.makeSpan([t.mclass]):al.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(oa(t.delim,t.mode));var n=new Ie.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Ve(al.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function tM(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Ke({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:vy(e[0],t).text,color:n}}});Ke({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=vy(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Ft(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{tM(t);for(var n=Ur(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a<n.length;a++)n[a].isMiddle?i=!0:(r=Math.max(n[a].height,r),s=Math.max(n[a].depth,s));r*=e.sizeMultiplier,s*=e.sizeMultiplier;var l;if(t.left==="."?l=x0(e,["mopen"]):l=al.leftRightDelim(t.left,r,s,e,t.mode,["mopen"]),n.unshift(l),i)for(var c=1;c<n.length;c++){var h=n[c],f=h.isMiddle;f&&(n[c]=al.leftRightDelim(f.delim,r,s,f.options,t.mode,[]))}var m;if(t.right===".")m=x0(e,["mclose"]);else{var g=t.rightColor?e.withColor(t.rightColor):e;m=al.leftRightDelim(t.right,r,s,g,t.mode,["mclose"])}return n.push(m),we.makeSpan(["minner"],n,e)},mathmlBuilder:(t,e)=>{tM(t);var n=ui(t.body,e);if(t.left!=="."){var r=new Ie.MathNode("mo",[oa(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new Ie.MathNode("mo",[oa(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return HO(n)}});Ke({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=vy(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=x0(e,[]);else{n=al.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==="|"?oa("|","text"):oa(t.delim,t.mode),r=new Ie.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var XO=(t,e)=>{var n=we.wrapFragment(gn(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,a=0,l=On.isCharacterBox(t.body);if(r==="sout")i=we.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,a=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var c=cr({number:.6,unit:"pt"},e),h=cr({number:.35,unit:"ex"},e),f=e.havingBaseSizing();s=s/f.sizeMultiplier;var m=n.height+n.depth+c+h;n.style.paddingLeft=Ve(m/2+c);var g=Math.floor(1e3*m*s),x=Lye(g),y=new ml([new kc("phase",x)],{width:"400em",height:Ve(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});i=we.makeSvgSpan(["hide-tail"],[y],e),i.style.height=Ve(m),a=n.depth+c+h}else{/cancel/.test(r)?l||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var w=0,S=0,k=0;/box/.test(r)?(k=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),w=e.fontMetrics().fboxsep+(r==="colorbox"?0:k),S=w):r==="angl"?(k=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),w=4*k,S=Math.max(0,.25-n.depth)):(w=l?.2:0,S=w),i=gl.encloseSpan(n,r,w,S,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Ve(k)):r==="angl"&&k!==.049&&(i.style.borderTopWidth=Ve(k),i.style.borderRightWidth=Ve(k)),a=n.depth+S,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var N;if(t.backgroundColor)N=we.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=we.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)&&!l?we.makeSpan(["mord","cancel-lap"],[N],e):we.makeSpan(["mord"],[N],e)},YO=(t,e)=>{var n=0,r=new Ie.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Un(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};Ke({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Ft(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:XO,mathmlBuilder:YO});Ke({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Ft(e[0],"color-token").color,a=Ft(e[1],"color-token").color,l=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:l}},htmlBuilder:XO,mathmlBuilder:YO});Ke({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]}}});Ke({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:XO,mathmlBuilder:YO});Ke({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 pQ={};function fo(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,l={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},c=0;c<n.length;++c)pQ[n[c]]=l;i&&(ov[e]=i),a&&(lv[e]=a)}var gQ={};function Z(t,e){gQ[t]=e}function nM(t){var e=[];t.consumeSpaces();var n=t.fetch().text;for(n==="\\relax"&&(t.consume(),t.consumeSpaces(),n=t.fetch().text);n==="\\hline"||n==="\\hdashline";)t.consume(),e.push(n==="\\hdashline"),t.consumeSpaces(),n=t.fetch().text;return e}var yy=t=>{var e=t.parser.settings;if(!e.displayMode)throw new Be("{"+t.envName+"} can be used only in display mode.")};function KO(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function Dc(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:l,autoTag:c,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],S=[],k=[],N=c!=null?[]:void 0;function C(){c&&t.gullet.macros.set("\\@eqnsw","1",!0)}function T(){N&&(t.gullet.macros.get("\\df@tag")?(N.push(t.subparse([new _i("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):N.push(!!c&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(C(),k.push(nM(t));;){var _=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),_={type:"ordgroup",mode:t.mode,body:_},n&&(_={type:"styling",mode:t.mode,style:n,body:[_]}),y.push(_);var E=t.fetch().text;if(E==="&"){if(m&&y.length===m){if(h||l)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(E==="\\end"){T(),y.length===1&&_.type==="styling"&&_.body[0].body.length===0&&(w.length>1||!f)&&w.pop(),k.length<w.length+1&&k.push([]);break}else if(E==="\\\\"){t.consume();var M=void 0;t.gullet.future().text!==" "&&(M=t.parseSizeGroup(!0)),S.push(M?M.value:null),T(),k.push(nM(t)),y=[],w.push(y),C()}else throw new Be("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:s,arraystretch:a,body:w,cols:i,rowGaps:S,hskipBeforeAndAfter:r,hLinesBeforeRow:k,colSeparationType:l,tags:N,leqno:g}}function ZO(t){return t.slice(0,1)==="d"?"display":"text"}var mo=function(e,n){var r,s,i=e.body.length,a=e.hLinesBeforeRow,l=0,c=new Array(i),h=[],f=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),m=1/n.fontMetrics().ptPerEm,g=5*m;if(e.colSeparationType&&e.colSeparationType==="small"){var x=n.havingStyle(kt.SCRIPT).sizeMultiplier;g=.2778*(x/n.sizeMultiplier)}var y=e.colSeparationType==="CD"?cr({number:3,unit:"ex"},n):12*m,w=3*m,S=e.arraystretch*y,k=.7*S,N=.3*S,C=0;function T($e){for(var bt=0;bt<$e.length;++bt)bt>0&&(C+=.25),h.push({pos:C,isDashed:$e[bt]})}for(T(a[0]),r=0;r<e.body.length;++r){var _=e.body[r],E=k,M=N;l<_.length&&(l=_.length);var q=new Array(_.length);for(s=0;s<_.length;++s){var L=gn(_[s],n);M<L.depth&&(M=L.depth),E<L.height&&(E=L.height),q[s]=L}var I=e.rowGaps[r],$=0;I&&($=cr(I,n),$>0&&($+=N,M<$&&(M=$),$=0)),e.addJot&&(M+=w),q.height=E,q.depth=M,C+=E,q.pos=C,C+=M+$,c[r]=q,T(a[r+1])}var V=C/2+n.fontMetrics().axisHeight,ee=e.cols||[],z=[],H,P,W=[];if(e.tags&&e.tags.some($e=>$e))for(r=0;r<i;++r){var J=c[r],X=J.pos-V,R=e.tags[r],se=void 0;R===!0?se=we.makeSpan(["eqn-num"],[],n):R===!1?se=we.makeSpan([],[],n):se=we.makeSpan([],Ur(R,n,!0),n),se.depth=J.depth,se.height=J.height,W.push({type:"elem",elem:se,shift:X})}for(s=0,P=0;s<l||P<ee.length;++s,++P){for(var G=ee[P]||{},F=!0;G.type==="separator";){if(F||(H=we.makeSpan(["arraycolsep"],[]),H.style.width=Ve(n.fontMetrics().doubleRuleSep),z.push(H)),G.separator==="|"||G.separator===":"){var U=G.separator==="|"?"solid":"dashed",te=we.makeSpan(["vertical-separator"],[],n);te.style.height=Ve(C),te.style.borderRightWidth=Ve(f),te.style.borderRightStyle=U,te.style.margin="0 "+Ve(-f/2);var ne=C-V;ne&&(te.style.verticalAlign=Ve(-ne)),z.push(te)}else throw new Be("Invalid separator type: "+G.separator);P++,G=ee[P]||{},F=!1}if(!(s>=l)){var Y=void 0;(s>0||e.hskipBeforeAndAfter)&&(Y=On.deflt(G.pregap,g),Y!==0&&(H=we.makeSpan(["arraycolsep"],[]),H.style.width=Ve(Y),z.push(H)));var ae=[];for(r=0;r<i;++r){var re=c[r],oe=re[s];if(oe){var _e=re.pos-V;oe.depth=re.depth,oe.height=re.height,ae.push({type:"elem",elem:oe,shift:_e})}}ae=we.makeVList({positionType:"individualShift",children:ae},n),ae=we.makeSpan(["col-align-"+(G.align||"c")],[ae]),z.push(ae),(s<l-1||e.hskipBeforeAndAfter)&&(Y=On.deflt(G.postgap,g),Y!==0&&(H=we.makeSpan(["arraycolsep"],[]),H.style.width=Ve(Y),z.push(H)))}}if(c=we.makeSpan(["mtable"],z),h.length>0){for(var Ge=we.makeLineSpan("hline",n,f),tt=we.makeLineSpan("hdashline",n,f),Xe=[{type:"elem",elem:c,shift:0}];h.length>0;){var je=h.pop(),Qe=je.pos-V;je.isDashed?Xe.push({type:"elem",elem:tt,shift:Qe}):Xe.push({type:"elem",elem:Ge,shift:Qe})}c=we.makeVList({positionType:"individualShift",children:Xe},n)}if(W.length===0)return we.makeSpan(["mord"],[c],n);var He=we.makeVList({positionType:"individualShift",children:W},n);return He=we.makeSpan(["tag"],[He],n),we.makeFragment([c,He])},Ube={c:"center ",l:"left ",r:"right "},po=function(e,n){for(var r=[],s=new Ie.MathNode("mtd",[],["mtr-glue"]),i=new Ie.MathNode("mtd",[],["mml-eqn-num"]),a=0;a<e.body.length;a++){for(var l=e.body[a],c=[],h=0;h<l.length;h++)c.push(new Ie.MathNode("mtd",[Un(l[h],n)]));e.tags&&e.tags[a]&&(c.unshift(s),c.push(s),e.leqno?c.unshift(i):c.push(i)),r.push(new Ie.MathNode("mtr",c))}var f=new Ie.MathNode("mtable",r),m=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);f.setAttribute("rowspacing",Ve(m));var g="",x="";if(e.cols&&e.cols.length>0){var y=e.cols,w="",S=!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;C<N;C++)y[C].type==="align"?(x+=Ube[y[C].align],S&&(w+="none "),S=!0):y[C].type==="separator"&&S&&(w+=y[C].separator==="|"?"solid ":"dashed ",S=!1);f.setAttribute("columnalign",x.trim()),/[sd]/.test(w)&&f.setAttribute("columnlines",w.trim())}if(e.colSeparationType==="align"){for(var T=e.cols||[],_="",E=1;E<T.length;E++)_+=E%2?"0em ":"1em ";f.setAttribute("columnspacing",_.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?f.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?f.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?f.setAttribute("columnspacing","0.5em"):f.setAttribute("columnspacing","1em");var M="",q=e.hLinesBeforeRow;g+=q[0].length>0?"left ":"",g+=q[q.length-1].length>0?"right ":"";for(var L=1;L<q.length-1;L++)M+=q[L].length===0?"none ":q[L][0]?"dashed ":"solid ";return/[sd]/.test(M)&&f.setAttribute("rowlines",M.trim()),g!==""&&(f=new Ie.MathNode("menclose",[f]),f.setAttribute("notation",g.trim())),e.arraystretch&&e.arraystretch<1&&(f=new Ie.MathNode("mstyle",[f]),f.setAttribute("scriptlevel","1")),f},xQ=function(e,n){e.envName.indexOf("ed")===-1&&yy(e);var r=[],s=e.envName.indexOf("at")>-1?"alignat":"align",i=e.envName==="split",a=Dc(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:KO(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),l,c=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var f="",m=0;m<n[0].body.length;m++){var g=Ft(n[0].body[m],"textord");f+=g.text}l=Number(f),c=l*2}var x=!c;a.body.forEach(function(k){for(var N=1;N<k.length;N+=2){var C=Ft(k[N],"styling"),T=Ft(C.body[0],"ordgroup");T.body.unshift(h)}if(x)c<k.length&&(c=k.length);else{var _=k.length/2;if(l<_)throw new Be("Too many math in a row: "+("expected "+l+", but got "+_),k[0])}});for(var y=0;y<c;++y){var w="r",S=0;y%2===1?w="l":y>0&&x&&(S=1),r[y]={type:"align",align:w,pregap:S,postgap:0}}return a.colSeparationType=x?"align":"alignat",a};fo({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=gy(e[0]),r=n?[e[0]]:Ft(e[0],"ordgroup").body,s=r.map(function(a){var l=UO(a),c=l.text;if("lcr".indexOf(c)!==-1)return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new Be("Unknown column alignment: "+c,a)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Dc(t.parser,i,ZO(t.envName))},htmlBuilder:mo,mathmlBuilder:po});fo({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=Dc(t.parser,r,ZO(t.envName)),a=Math.max(0,...i.body.map(l=>l.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:mo,mathmlBuilder:po});fo({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Dc(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=gy(e[0]),r=n?[e[0]]:Ft(e[0],"ordgroup").body,s=r.map(function(a){var l=UO(a),c=l.text;if("lc".indexOf(c)!==-1)return{type:"align",align:c};throw new Be("Unknown column alignment: "+c,a)});if(s.length>1)throw new Be("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Dc(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:mo,mathmlBuilder:po});fo({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=Dc(t.parser,e,ZO(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:mo,mathmlBuilder:po});fo({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:xQ,htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&yy(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:KO(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Dc(t.parser,e,"display")},htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:xQ,htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){yy(t);var e={autoTag:KO(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Dc(t.parser,e,"display")},htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["CD"],props:{numArgs:0},handler(t){return yy(t),Abe(t.parser)},htmlBuilder:mo,mathmlBuilder:po});Z("\\nonumber","\\gdef\\@eqnsw{0}");Z("\\notag","\\nonumber");Ke({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 rM=pQ;Ke({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<s.body.length;++a)i+=Ft(s.body[a],"textord").text;if(r==="\\begin"){if(!rM.hasOwnProperty(i))throw new Be("No such environment: "+i,s);var l=rM[i],{args:c,optArgs:h}=n.parseArguments("\\begin{"+i+"}",l),f={mode:n.mode,envName:i,parser:n},m=l.handler(f,c,h);n.expect("\\end",!1);var g=n.nextToken,x=Ft(n.parseFunction(),"environment");if(x.name!==i)throw new Be("Mismatch: \\begin{"+i+"} matched by \\end{"+x.name+"}",g);return m}return{type:"environment",mode:n.mode,name:i,nameGroup:s}}});var vQ=(t,e)=>{var n=t.font,r=e.withFont(n);return gn(t.body,r)},yQ=(t,e)=>{var n=t.font,r=e.withFont(n);return Un(t.body,r)},sM={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Ke({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=cv(e[0]),i=r;return i in sM&&(i=sM[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:vQ,mathmlBuilder:yQ});Ke({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=On.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:xy(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Ke({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),l="math"+r.slice(1);return{type:"font",mode:i,font:l,body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:vQ,mathmlBuilder:yQ});var bQ=(t,e)=>{var n=e;return t==="display"?n=n.id>=kt.SCRIPT.id?n.text():kt.DISPLAY:t==="text"&&n.size===kt.DISPLAY.size?n=kt.TEXT:t==="script"?n=kt.SCRIPT:t==="scriptscript"&&(n=kt.SCRIPTSCRIPT),n},JO=(t,e)=>{var n=bQ(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var a=gn(t.numer,i,e);if(t.continued){var l=8.5/e.fontMetrics().ptPerEm,c=3.5/e.fontMetrics().ptPerEm;a.height=a.height<l?l:a.height,a.depth=a.depth<c?c:a.depth}i=e.havingStyle(s);var h=gn(t.denom,i,e),f,m,g;t.hasBarLine?(t.barSize?(m=cr(t.barSize,e),f=we.makeLineSpan("frac-line",e,m)):f=we.makeLineSpan("frac-line",e),m=f.height,g=f.height):(f=null,m=0,g=e.fontMetrics().defaultRuleThickness);var x,y,w;n.size===kt.DISPLAY.size||t.size==="display"?(x=e.fontMetrics().num1,m>0?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 S;if(f){var N=e.fontMetrics().axisHeight;x-a.depth-(N+.5*m)<y&&(x+=y-(x-a.depth-(N+.5*m))),N-.5*m-(h.height-w)<y&&(w+=y-(N-.5*m-(h.height-w)));var C=-(N-.5*m);S=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:h,shift:w},{type:"elem",elem:f,shift:C},{type:"elem",elem:a,shift:-x}]},e)}else{var k=x-a.depth-(h.height-w);k<y&&(x+=.5*(y-k),w+=.5*(y-k)),S=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:h,shift:w},{type:"elem",elem:a,shift:-x}]},e)}i=e.havingStyle(n),S.height*=i.sizeMultiplier/e.sizeMultiplier,S.depth*=i.sizeMultiplier/e.sizeMultiplier;var T;n.size===kt.DISPLAY.size?T=e.fontMetrics().delim1:n.size===kt.SCRIPTSCRIPT.size?T=e.havingStyle(kt.SCRIPT).fontMetrics().delim2:T=e.fontMetrics().delim2;var _,E;return t.leftDelim==null?_=x0(e,["mopen"]):_=al.customSizedDelim(t.leftDelim,T,!0,e.havingStyle(n),t.mode,["mopen"]),t.continued?E=we.makeSpan([]):t.rightDelim==null?E=x0(e,["mclose"]):E=al.customSizedDelim(t.rightDelim,T,!0,e.havingStyle(n),t.mode,["mclose"]),we.makeSpan(["mord"].concat(i.sizingClasses(e)),[_,we.makeSpan(["mfrac"],[S]),E],e)},ej=(t,e)=>{var n=new Ie.MathNode("mfrac",[Un(t.numer,e),Un(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=cr(t.barSize,e);n.setAttribute("linethickness",Ve(r))}var s=bQ(t.size,e.style);if(s.size!==e.style.size){n=new Ie.MathNode("mstyle",[n]);var i=s.size===kt.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 l=new Ie.MathNode("mo",[new Ie.TextNode(t.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),a.push(l)}if(a.push(n),t.rightDelim!=null){var c=new Ie.MathNode("mo",[new Ie.TextNode(t.rightDelim.replace("\\",""))]);c.setAttribute("fence","true"),a.push(c)}return HO(a)}return n};Ke({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,l=null,c=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,l="(",c=")";break;case"\\\\bracefrac":a=!1,l="\\{",c="\\}";break;case"\\\\brackfrac":a=!1,l="[",c="]";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:l,rightDelim:c,size:h,barSize:null}},htmlBuilder:JO,mathmlBuilder:ej});Ke({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}}});Ke({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 iM=["display","text","script","scriptscript"],aM=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Ke({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=cv(e[0]),a=i.type==="atom"&&i.family==="open"?aM(i.text):null,l=cv(e[1]),c=l.type==="atom"&&l.family==="close"?aM(l.text):null,h=Ft(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=Ft(x.body[0],"textord");g=iM[Number(y.text)]}}else x=Ft(x,"textord"),g=iM[Number(x.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:f,barSize:m,leftDelim:a,rightDelim:c,size:g}},htmlBuilder:JO,mathmlBuilder:ej});Ke({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:Ft(e[0],"size").value,token:s}}});Ke({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Sye(Ft(e[1],"infix").size),a=e[2],l=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:a,continued:!1,hasBarLine:l,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:JO,mathmlBuilder:ej});var wQ=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?gn(t.sup,e.havingStyle(n.sup()),e):gn(t.sub,e.havingStyle(n.sub()),e),s=Ft(t.base,"horizBrace")):s=Ft(t,"horizBrace");var i=gn(s.base,e.havingBaseStyle(kt.DISPLAY)),a=gl.svgSpan(s,e),l;if(s.isOver?(l=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a}]},e),l.children[0].children[0].children[1].classes.push("svg-align")):(l=we.makeVList({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:i}]},e),l.children[0].children[0].children[0].classes.push("svg-align")),r){var c=we.makeSpan(["mord",s.isOver?"mover":"munder"],[l],e);s.isOver?l=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:r}]},e):l=we.makeVList({positionType:"bottom",positionData:c.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:c}]},e)}return we.makeSpan(["mord",s.isOver?"mover":"munder"],[l],e)},Wbe=(t,e)=>{var n=gl.mathMLnode(t.label);return new Ie.MathNode(t.isOver?"mover":"munder",[Un(t.base,e),n])};Ke({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:wQ,mathmlBuilder:Wbe});Ke({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=Ft(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:wr(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Ur(t.body,e,!1);return we.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=Oc(t.body,e);return n instanceof Ni||(n=new Ni("mrow",[n])),n.setAttribute("href",t.href),n}});Ke({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Ft(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i<r.length;i++){var a=r[i];a==="~"&&(a="\\textasciitilde"),s.push({type:"textord",mode:"text",text:a})}var l={type:"text",mode:n.mode,font:"\\texttt",body:s};return{type:"href",mode:n.mode,href:r,body:wr(l)}}});Ke({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(t,e){var{parser:n}=t;return{type:"hbox",mode:n.mode,body:wr(e[0])}},htmlBuilder(t,e){var n=Ur(t.body,e,!1);return we.makeFragment(n)},mathmlBuilder(t,e){return new Ie.MathNode("mrow",ui(t.body,e))}});Ke({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,token:s}=t,i=Ft(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l,c={};switch(r){case"\\htmlClass":c.class=i,l={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,l={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,l={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),f=0;f<h.length;f++){var m=h[f].split("=");if(m.length!==2)throw new Be("Error parsing key-value for \\htmlData");c["data-"+m[0].trim()]=m[1].trim()}l={command:"\\htmlData",attributes:c};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(l)?{type:"html",mode:n.mode,attributes:c,body:wr(a)}:n.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var n=Ur(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=we.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)=>Oc(t.body,e)});Ke({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:wr(e[0]),mathml:wr(e[1])}},htmlBuilder:(t,e)=>{var n=Ur(t.html,e,!1);return we.makeFragment(n)},mathmlBuilder:(t,e)=>Oc(t.mathml,e)});var S4=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(!q$(r))throw new Be("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Ke({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"},l="";if(n[0])for(var c=Ft(n[0],"raw").string,h=c.split(","),f=0;f<h.length;f++){var m=h[f].split("=");if(m.length===2){var g=m[1].trim();switch(m[0].trim()){case"alt":l=g;break;case"width":s=S4(g);break;case"height":i=S4(g);break;case"totalheight":a=S4(g);break;default:throw new Be("Invalid key: '"+m[0]+"' in \\includegraphics.")}}}var x=Ft(e[0],"url").url;return l===""&&(l=x,l=l.replace(/^.*[\\/]/,""),l=l.substring(0,l.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:x})?{type:"includegraphics",mode:r.mode,alt:l,width:s,height:i,totalheight:a,src:x}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var n=cr(t.height,e),r=0;t.totalheight.number>0&&(r=cr(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=cr(t.width,e));var i={height:Ve(n+r)};s>0&&(i.width=Ve(s)),r>0&&(i.verticalAlign=Ve(-r));var a=new Wye(t.src,t.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new Ie.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=cr(t.height,e),s=0;if(t.totalheight.number>0&&(s=cr(t.totalheight,e)-r,n.setAttribute("valign",Ve(-s))),n.setAttribute("height",Ve(r+s)),t.width.number>0){var i=cr(t.width,e);n.setAttribute("width",Ve(i))}return n.setAttribute("src",t.src),n}});Ke({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=Ft(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 we.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=cr(t.dimension,e);return new Ie.SpaceNode(n)}});Ke({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=we.makeSpan([],[gn(t.body,e)]),n=we.makeSpan(["inner"],[n],e)):n=we.makeSpan(["inner"],[gn(t.body,e)]);var r=we.makeSpan(["fix"],[]),s=we.makeSpan([t.alignment],[n,r],e),i=we.makeSpan(["strut"]);return i.style.height=Ve(s.height+s.depth),s.depth&&(i.style.verticalAlign=Ve(-s.depth)),s.children.unshift(i),s=we.makeSpan(["thinbox"],[s],e),we.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new Ie.MathNode("mpadded",[Un(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}});Ke({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}}});Ke({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new Be("Mismatched "+t.funcName)}});var oM=(t,e)=>{switch(e.style.size){case kt.DISPLAY.size:return t.display;case kt.TEXT.size:return t.text;case kt.SCRIPT.size:return t.script;case kt.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Ke({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:wr(e[0]),text:wr(e[1]),script:wr(e[2]),scriptscript:wr(e[3])}},htmlBuilder:(t,e)=>{var n=oM(t,e),r=Ur(n,e,!1);return we.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=oM(t,e);return Oc(n,e)}});var SQ=(t,e,n,r,s,i,a)=>{t=we.makeSpan([],[t]);var l=n&&On.isCharacterBox(n),c,h;if(e){var f=gn(e,r.havingStyle(s.sup()),r);h={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-f.depth)}}if(n){var m=gn(n,r.havingStyle(s.sub()),r);c={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-m.height)}}var g;if(h&&c){var x=r.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+t.depth+a;g=we.makeVList({positionType:"bottom",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Ve(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Ve(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(c){var y=t.height-a;g=we.makeVList({positionType:"top",positionData:y,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Ve(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t}]},r)}else if(h){var w=t.depth+a;g=we.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Ve(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var S=[g];if(c&&i!==0&&!l){var k=we.makeSpan(["mspace"],[],r);k.style.marginRight=Ve(i),S.unshift(k)}return we.makeSpan(["mop","op-limits"],S,r)},kQ=["\\smallint"],Zh=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Ft(t.base,"op"),s=!0):i=Ft(t,"op");var a=e.style,l=!1;a.size===kt.DISPLAY.size&&i.symbol&&!kQ.includes(i.name)&&(l=!0);var c;if(i.symbol){var h=l?"Size2-Regular":"Size1-Regular",f="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(f=i.name.slice(1),i.name=f==="oiint"?"\\iint":"\\iiint"),c=we.makeSymbol(i.name,h,"math",e,["mop","op-symbol",l?"large-op":"small-op"]),f.length>0){var m=c.italic,g=we.staticSvg(f+"Size"+(l?"2":"1"),e);c=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:g,shift:l?.08:0}]},e),i.name="\\"+f,c.classes.unshift("mop"),c.italic=m}}else if(i.body){var x=Ur(i.body,e,!0);x.length===1&&x[0]instanceof aa?(c=x[0],c.classes[0]="mop"):c=we.makeSpan(["mop"],x,e)}else{for(var y=[],w=1;w<i.name.length;w++)y.push(we.mathsym(i.name[w],i.mode,e));c=we.makeSpan(["mop"],y,e)}var S=0,k=0;return(c instanceof aa||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift&&(S=(c.height-c.depth)/2-e.fontMetrics().axisHeight,k=c.italic),s?SQ(c,n,r,e,a,k,S):(S&&(c.style.position="relative",c.style.top=Ve(S)),c)},cp=(t,e)=>{var n;if(t.symbol)n=new Ni("mo",[oa(t.name,t.mode)]),kQ.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Ni("mo",ui(t.body,e));else{n=new Ni("mi",[new eo(t.name.slice(1))]);var r=new Ni("mo",[oa("","text")]);t.parentIsSupSub?n=new Ni("mrow",[n,r]):n=K$([n,r])}return n},Gbe={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","":"\\bigvee","⋂":"\\bigcap","":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Ke({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=Gbe[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Zh,mathmlBuilder:cp});Ke({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:wr(r)}},htmlBuilder:Zh,mathmlBuilder:cp});var Xbe={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Ke({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:Zh,mathmlBuilder:cp});Ke({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:Zh,mathmlBuilder:cp});Ke({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=Xbe[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Zh,mathmlBuilder:cp});var OQ=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Ft(t.base,"operatorname"),s=!0):i=Ft(t,"operatorname");var a;if(i.body.length>0){for(var l=i.body.map(m=>{var g=m.text;return typeof g=="string"?{type:"textord",mode:m.mode,text:g}:m}),c=Ur(l,e.withFont("mathrm"),!0),h=0;h<c.length;h++){var f=c[h];f instanceof aa&&(f.text=f.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}a=we.makeSpan(["mop"],c,e)}else a=we.makeSpan(["mop"],[],e);return s?SQ(a,n,r,e,e.style,0,0):a},Ybe=(t,e)=>{for(var n=ui(t.body,e.withFont("mathrm")),r=!0,s=0;s<n.length;s++){var i=n[s];if(!(i instanceof Ie.SpaceNode))if(i instanceof Ie.MathNode)switch(i.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var a=i.children[0];i.children.length===1&&a instanceof Ie.TextNode?a.text=a.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var l=n.map(f=>f.toText()).join("");n=[new Ie.TextNode(l)]}var c=new Ie.MathNode("mi",n);c.setAttribute("mathvariant","normal");var h=new Ie.MathNode("mo",[oa("","text")]);return t.parentIsSupSub?new Ie.MathNode("mrow",[c,h]):Ie.newDocumentFragment([c,h])};Ke({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:wr(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:OQ,mathmlBuilder:Ybe});Z("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Fu({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?we.makeFragment(Ur(t.body,e,!1)):we.makeSpan(["mord"],Ur(t.body,e,!0),e)},mathmlBuilder(t,e){return Oc(t.body,e,!0)}});Ke({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=gn(t.body,e.havingCrampedStyle()),r=we.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return we.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[new Ie.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Ie.MathNode("mover",[Un(t.body,e),n]);return r.setAttribute("accent","true"),r}});Ke({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:wr(r)}},htmlBuilder:(t,e)=>{var n=Ur(t.body,e.withPhantom(),!1);return we.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=ui(t.body,e);return new Ie.MathNode("mphantom",n)}});Ke({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=we.makeSpan([],[gn(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r<n.children.length;r++)n.children[r].height=0,n.children[r].depth=0;return n=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},e),we.makeSpan(["mord"],[n],e)},mathmlBuilder:(t,e)=>{var n=ui(wr(t.body),e),r=new Ie.MathNode("mphantom",n),s=new Ie.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Ke({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=we.makeSpan(["inner"],[gn(t.body,e.withPhantom())]),r=we.makeSpan(["fix"],[]);return we.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=ui(wr(t.body),e),r=new Ie.MathNode("mphantom",n),s=new Ie.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Ke({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Ft(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=gn(t.body,e),r=cr(t.dy,e);return we.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mpadded",[Un(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Ke({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Ke({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=Ft(e[0],"size"),a=Ft(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Ft(s,"size").value,width:i.value,height:a.value}},htmlBuilder(t,e){var n=we.makeSpan(["mord","rule"],[],e),r=cr(t.width,e),s=cr(t.height,e),i=t.shift?cr(t.shift,e):0;return n.style.borderRightWidth=Ve(r),n.style.borderTopWidth=Ve(s),n.style.bottom=Ve(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=cr(t.width,e),r=cr(t.height,e),s=t.shift?cr(t.shift,e):0,i=e.color&&e.getColor()||"black",a=new Ie.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",Ve(n)),a.setAttribute("height",Ve(r));var l=new Ie.MathNode("mpadded",[a]);return s>=0?l.setAttribute("height",Ve(s)):(l.setAttribute("height",Ve(s)),l.setAttribute("depth",Ve(-s))),l.setAttribute("voffset",Ve(s)),l}});function jQ(t,e,n){for(var r=Ur(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i<r.length;i++){var a=r[i].classes.indexOf("sizing");a<0?Array.prototype.push.apply(r[i].classes,e.sizingClasses(n)):r[i].classes[a+1]==="reset-size"+e.size&&(r[i].classes[a+1]="reset-size"+n.size),r[i].height*=s,r[i].depth*=s}return we.makeFragment(r)}var lM=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],Kbe=(t,e)=>{var n=e.havingSize(t.size);return jQ(t.body,n,e)};Ke({type:"sizing",names:lM,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:lM.indexOf(r)+1,body:i}},htmlBuilder:Kbe,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=ui(t.body,n),s=new Ie.MathNode("mstyle",r);return s.setAttribute("mathsize",Ve(n.sizeMultiplier)),s}});Ke({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]&&Ft(n[0],"ordgroup");if(a)for(var l="",c=0;c<a.body.length;++c){var h=a.body[c];if(l=h.text,l==="t")s=!0;else if(l==="b")i=!0;else{s=!1,i=!1;break}}else s=!0,i=!0;var f=e[0];return{type:"smash",mode:r.mode,body:f,smashHeight:s,smashDepth:i}},htmlBuilder:(t,e)=>{var n=we.makeSpan([],[gn(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r<n.children.length;r++)n.children[r].height=0;if(t.smashDepth&&(n.depth=0,n.children))for(var s=0;s<n.children.length;s++)n.children[s].depth=0;var i=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},e);return we.makeSpan(["mord"],[i],e)},mathmlBuilder:(t,e)=>{var n=new Ie.MathNode("mpadded",[Un(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Ke({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=gn(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=we.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.id<kt.TEXT.id&&(i=e.fontMetrics().xHeight);var a=s+i/4,l=n.height+n.depth+a+s,{span:c,ruleWidth:h,advanceWidth:f}=al.sqrtImage(l,e),m=c.height-h;m>n.height+n.depth+a&&(a=(a+m-n.height-n.depth)/2);var g=c.height-n.height-a-h;n.style.paddingLeft=Ve(f);var x=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+g)},{type:"elem",elem:c},{type:"kern",size:h}]},e);if(t.index){var y=e.havingStyle(kt.SCRIPTSCRIPT),w=gn(t.index,y,e),S=.6*(x.height-x.depth),k=we.makeVList({positionType:"shift",positionData:-S,children:[{type:"elem",elem:w}]},e),N=we.makeSpan(["root"],[k]);return we.makeSpan(["mord","sqrt"],[N,x],e)}else return we.makeSpan(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new Ie.MathNode("mroot",[Un(n,e),Un(r,e)]):new Ie.MathNode("msqrt",[Un(n,e)])}});var cM={display:kt.DISPLAY,text:kt.TEXT,script:kt.SCRIPT,scriptscript:kt.SCRIPTSCRIPT};Ke({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=cM[t.style],r=e.havingStyle(n).withFont("");return jQ(t.body,r,e)},mathmlBuilder(t,e){var n=cM[t.style],r=e.havingStyle(n),s=ui(t.body,r),i=new Ie.MathNode("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},l=a[t.style];return i.setAttribute("scriptlevel",l[0]),i.setAttribute("displaystyle",l[1]),i}});var Zbe=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===kt.DISPLAY.size||r.alwaysHandleSupSub);return s?Zh:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===kt.DISPLAY.size||r.limits);return i?OQ:null}else{if(r.type==="accent")return On.isCharacterBox(r.base)?WO:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?wQ:null}else return null}else return null};Fu({type:"supsub",htmlBuilder(t,e){var n=Zbe(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,a=gn(r,e),l,c,h=e.fontMetrics(),f=0,m=0,g=r&&On.isCharacterBox(r);if(s){var x=e.havingStyle(e.style.sup());l=gn(s,x,e),g||(f=a.height-x.fontMetrics().supDrop*x.sizeMultiplier/e.sizeMultiplier)}if(i){var y=e.havingStyle(e.style.sub());c=gn(i,y,e),g||(m=a.depth+y.fontMetrics().subDrop*y.sizeMultiplier/e.sizeMultiplier)}var w;e.style===kt.DISPLAY?w=h.sup1:e.style.cramped?w=h.sup3:w=h.sup2;var S=e.sizeMultiplier,k=Ve(.5/h.ptPerEm/S),N=null;if(c){var C=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(a instanceof aa||C)&&(N=Ve(-a.italic))}var T;if(l&&c){f=Math.max(f,w,l.depth+.25*h.xHeight),m=Math.max(m,h.sub2);var _=h.defaultRuleThickness,E=4*_;if(f-l.depth-(c.height-m)<E){m=E-(f-l.depth)+c.height;var M=.8*h.xHeight-(f-l.depth);M>0&&(f+=M,m-=M)}var q=[{type:"elem",elem:c,shift:m,marginRight:k,marginLeft:N},{type:"elem",elem:l,shift:-f,marginRight:k}];T=we.makeVList({positionType:"individualShift",children:q},e)}else if(c){m=Math.max(m,h.sub1,c.height-.8*h.xHeight);var L=[{type:"elem",elem:c,marginLeft:N,marginRight:k}];T=we.makeVList({positionType:"shift",positionData:m,children:L},e)}else if(l)f=Math.max(f,w,l.depth+.25*h.xHeight),T=we.makeVList({positionType:"shift",positionData:-f,children:[{type:"elem",elem:l,marginRight:k}]},e);else throw new Error("supsub must have either sup or sub.");var I=sk(a,"right")||"mord";return we.makeSpan([I],[a,we.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=[Un(t.base,e)];t.sub&&i.push(Un(t.sub,e)),t.sup&&i.push(Un(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===kt.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===kt.DISPLAY||h.limits)?a="munderover":a="msubsup"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===kt.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===kt.DISPLAY)?a="munder":a="msub"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===kt.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===kt.DISPLAY)?a="mover":a="msup"}return new Ie.MathNode(a,i)}});Fu({type:"atom",htmlBuilder(t,e){return we.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[oa(t.text,t.mode)]);if(t.family==="bin"){var r=VO(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 NQ={mi:"italic",mn:"normal",mtext:"normal"};Fu({type:"mathord",htmlBuilder(t,e){return we.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new Ie.MathNode("mi",[oa(t.text,t.mode,e)]),r=VO(t,e)||"italic";return r!==NQ[n.type]&&n.setAttribute("mathvariant",r),n}});Fu({type:"textord",htmlBuilder(t,e){return we.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=oa(t.text,t.mode,e),r=VO(t,e)||"normal",s;return t.mode==="text"?s=new Ie.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new Ie.MathNode("mn",[n]):t.text==="\\prime"?s=new Ie.MathNode("mo",[n]):s=new Ie.MathNode("mi",[n]),r!==NQ[s.type]&&s.setAttribute("mathvariant",r),s}});var k4={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},O4={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Fu({type:"spacing",htmlBuilder(t,e){if(O4.hasOwnProperty(t.text)){var n=O4[t.text].className||"";if(t.mode==="text"){var r=we.makeOrd(t,e,"textord");return r.classes.push(n),r}else return we.makeSpan(["mspace",n],[we.mathsym(t.text,t.mode,e)],e)}else{if(k4.hasOwnProperty(t.text))return we.makeSpan(["mspace",k4[t.text]],[],e);throw new Be('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(O4.hasOwnProperty(t.text))n=new Ie.MathNode("mtext",[new Ie.TextNode(" ")]);else{if(k4.hasOwnProperty(t.text))return new Ie.MathNode("mspace");throw new Be('Unknown type of space "'+t.text+'"')}return n}});var uM=()=>{var t=new Ie.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Fu({type:"tag",mathmlBuilder(t,e){var n=new Ie.MathNode("mtable",[new Ie.MathNode("mtr",[uM(),new Ie.MathNode("mtd",[Oc(t.body,e)]),uM(),new Ie.MathNode("mtd",[Oc(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var dM={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},hM={"\\textbf":"textbf","\\textmd":"textmd"},Jbe={"\\textit":"textit","\\textup":"textup"},fM=(t,e)=>{var n=t.font;if(n){if(dM[n])return e.withTextFontFamily(dM[n]);if(hM[n])return e.withTextFontWeight(hM[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(Jbe[n])};Ke({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:wr(s),font:r}},htmlBuilder(t,e){var n=fM(t,e),r=Ur(t.body,n,!0);return we.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=fM(t,e);return Oc(t.body,n)}});Ke({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=gn(t.body,e),r=we.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=we.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 we.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[new Ie.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Ie.MathNode("munder",[Un(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Ke({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=gn(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return we.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new Ie.MathNode("mpadded",[Un(t.body,e)],["vcenter"])}});Ke({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=mM(t),r=[],s=e.havingStyle(e.style.text()),i=0;i<n.length;i++){var a=n[i];a==="~"&&(a="\\textasciitilde"),r.push(we.makeSymbol(a,"Typewriter-Regular",t.mode,s,["mord","texttt"]))}return we.makeSpan(["mord","text"].concat(s.sizingClasses(e)),we.tryCombineChars(r),s)},mathmlBuilder(t,e){var n=new Ie.TextNode(mM(t)),r=new Ie.MathNode("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var mM=t=>t.body.replace(/ /g,t.star?"␣":" "),uc=X$,CQ=`[ \r
]`,e2e="\\\\[a-zA-Z@]+",t2e="\\\\[^\uD800-\uDFFF]",n2e="("+e2e+")"+CQ+"*",r2e=`\\\\(
|[ \r ]+
?)[ \r ]*`,lk="[̀-ͯ]",s2e=new RegExp(lk+"+$"),i2e="("+CQ+"+)|"+(r2e+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(lk+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(lk+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+n2e)+("|"+t2e+")");class pM{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(i2e,"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 _i("EOF",new Xs(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new Be("Unexpected character: '"+e[n]+"'",new _i(e[n],new Xs(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 _i(s,new Xs(this,n,this.tokenRegex.lastIndex))}}class a2e{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;s<this.undefStack.length;s++)delete this.undefStack[s][e];this.undefStack.length>0&&(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 o2e=gQ;Z("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});Z("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});Z("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});Z("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});Z("\\@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}});Z("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Z("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var gM={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};Z("\\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=gM[e.text],r==null||r>=n)throw new Be("Invalid base-"+n+" digit "+e.text);for(var s;(s=gM[t.future().text])!=null&&s<n;)r*=n,r+=s,t.popToken()}return"\\@char{"+r+"}"});var tj=(t,e,n,r)=>{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 l=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var c="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)c+=h.text,h=t.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new Be("Invalid number of arguments: "+c);l=parseInt(c),s=t.consumeArg().tokens}return a&&r||t.macros.set(i,{tokens:s,numArgs:l}),""};Z("\\newcommand",t=>tj(t,!1,!0,!1));Z("\\renewcommand",t=>tj(t,!0,!1,!1));Z("\\providecommand",t=>tj(t,!0,!0,!0));Z("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});Z("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});Z("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),uc[n],Gn.math[n],Gn.text[n]),""});Z("\\bgroup","{");Z("\\egroup","}");Z("~","\\nobreakspace");Z("\\lq","`");Z("\\rq","'");Z("\\aa","\\r a");Z("\\AA","\\r A");Z("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");Z("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Z("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");Z("","\\mathscr{B}");Z("","\\mathscr{E}");Z("","\\mathscr{F}");Z("","\\mathscr{H}");Z("","\\mathscr{I}");Z("","\\mathscr{L}");Z("","\\mathscr{M}");Z("","\\mathscr{R}");Z("","\\mathfrak{C}");Z("","\\mathfrak{H}");Z("","\\mathfrak{Z}");Z("\\Bbbk","\\Bbb{k}");Z("·","\\cdotp");Z("\\llap","\\mathllap{\\textrm{#1}}");Z("\\rlap","\\mathrlap{\\textrm{#1}}");Z("\\clap","\\mathclap{\\textrm{#1}}");Z("\\mathstrut","\\vphantom{(}");Z("\\underbar","\\underline{\\text{#1}}");Z("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');Z("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");Z("\\ne","\\neq");Z("≠","\\neq");Z("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");Z("∉","\\notin");Z("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");Z("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");Z("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");Z("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");Z("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");Z("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");Z("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");Z("⟂","\\perp");Z("‼","\\mathclose{!\\mkern-0.8mu!}");Z("∌","\\notni");Z("⌜","\\ulcorner");Z("⌝","\\urcorner");Z("⌞","\\llcorner");Z("⌟","\\lrcorner");Z("©","\\copyright");Z("®","\\textregistered");Z("","\\textregistered");Z("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Z("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Z("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Z("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Z("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Z("⋮","\\vdots");Z("\\varGamma","\\mathit{\\Gamma}");Z("\\varDelta","\\mathit{\\Delta}");Z("\\varTheta","\\mathit{\\Theta}");Z("\\varLambda","\\mathit{\\Lambda}");Z("\\varXi","\\mathit{\\Xi}");Z("\\varPi","\\mathit{\\Pi}");Z("\\varSigma","\\mathit{\\Sigma}");Z("\\varUpsilon","\\mathit{\\Upsilon}");Z("\\varPhi","\\mathit{\\Phi}");Z("\\varPsi","\\mathit{\\Psi}");Z("\\varOmega","\\mathit{\\Omega}");Z("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Z("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Z("\\boxed","\\fbox{$\\displaystyle{#1}$}");Z("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Z("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Z("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Z("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Z("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var xM={",":"\\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"};Z("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in xM?e=xM[n]:(n.slice(0,4)==="\\not"||n in Gn.math&&["bin","rel"].includes(Gn.math[n].group))&&(e="\\dotsb"),e});var nj={")":!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};Z("\\dotso",function(t){var e=t.future().text;return e in nj?"\\ldots\\,":"\\ldots"});Z("\\dotsc",function(t){var e=t.future().text;return e in nj&&e!==","?"\\ldots\\,":"\\ldots"});Z("\\cdots",function(t){var e=t.future().text;return e in nj?"\\@cdots\\,":"\\@cdots"});Z("\\dotsb","\\cdots");Z("\\dotsm","\\cdots");Z("\\dotsi","\\!\\cdots");Z("\\dotsx","\\ldots\\,");Z("\\DOTSI","\\relax");Z("\\DOTSB","\\relax");Z("\\DOTSX","\\relax");Z("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Z("\\,","\\tmspace+{3mu}{.1667em}");Z("\\thinspace","\\,");Z("\\>","\\mskip{4mu}");Z("\\:","\\tmspace+{4mu}{.2222em}");Z("\\medspace","\\:");Z("\\;","\\tmspace+{5mu}{.2777em}");Z("\\thickspace","\\;");Z("\\!","\\tmspace-{3mu}{.1667em}");Z("\\negthinspace","\\!");Z("\\negmedspace","\\tmspace-{4mu}{.2222em}");Z("\\negthickspace","\\tmspace-{5mu}{.277em}");Z("\\enspace","\\kern.5em ");Z("\\enskip","\\hskip.5em\\relax");Z("\\quad","\\hskip1em\\relax");Z("\\qquad","\\hskip2em\\relax");Z("\\tag","\\@ifstar\\tag@literal\\tag@paren");Z("\\tag@paren","\\tag@literal{({#1})}");Z("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new Be("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Z("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Z("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Z("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Z("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Z("\\newline","\\\\\\relax");Z("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var TQ=Ve(Ja["Main-Regular"][84][1]-.7*Ja["Main-Regular"][65][1]);Z("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+TQ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Z("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+TQ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Z("\\hspace","\\@ifstar\\@hspacer\\@hspace");Z("\\@hspace","\\hskip #1\\relax");Z("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Z("\\ordinarycolon",":");Z("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Z("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Z("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Z("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Z("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Z("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Z("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Z("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Z("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Z("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Z("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Z("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Z("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Z("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Z("∷","\\dblcolon");Z("∹","\\eqcolon");Z("≔","\\coloneqq");Z("≕","\\eqqcolon");Z("⩴","\\Coloneqq");Z("\\ratio","\\vcentcolon");Z("\\coloncolon","\\dblcolon");Z("\\colonequals","\\coloneqq");Z("\\coloncolonequals","\\Coloneqq");Z("\\equalscolon","\\eqqcolon");Z("\\equalscoloncolon","\\Eqqcolon");Z("\\colonminus","\\coloneq");Z("\\coloncolonminus","\\Coloneq");Z("\\minuscolon","\\eqcolon");Z("\\minuscoloncolon","\\Eqcolon");Z("\\coloncolonapprox","\\Colonapprox");Z("\\coloncolonsim","\\Colonsim");Z("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");Z("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Z("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Z("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Z("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Z("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Z("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Z("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Z("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Z("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");Z("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");Z("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");Z("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");Z("\\nleqq","\\html@mathml{\\@nleqq}{≰}");Z("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");Z("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");Z("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");Z("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");Z("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");Z("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");Z("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");Z("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");Z("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");Z("\\imath","\\html@mathml{\\@imath}{ı}");Z("\\jmath","\\html@mathml{\\@jmath}{ȷ}");Z("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");Z("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");Z("⟦","\\llbracket");Z("⟧","\\rrbracket");Z("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");Z("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");Z("⦃","\\lBrace");Z("⦄","\\rBrace");Z("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");Z("⦵","\\minuso");Z("\\darr","\\downarrow");Z("\\dArr","\\Downarrow");Z("\\Darr","\\Downarrow");Z("\\lang","\\langle");Z("\\rang","\\rangle");Z("\\uarr","\\uparrow");Z("\\uArr","\\Uparrow");Z("\\Uarr","\\Uparrow");Z("\\N","\\mathbb{N}");Z("\\R","\\mathbb{R}");Z("\\Z","\\mathbb{Z}");Z("\\alef","\\aleph");Z("\\alefsym","\\aleph");Z("\\Alpha","\\mathrm{A}");Z("\\Beta","\\mathrm{B}");Z("\\bull","\\bullet");Z("\\Chi","\\mathrm{X}");Z("\\clubs","\\clubsuit");Z("\\cnums","\\mathbb{C}");Z("\\Complex","\\mathbb{C}");Z("\\Dagger","\\ddagger");Z("\\diamonds","\\diamondsuit");Z("\\empty","\\emptyset");Z("\\Epsilon","\\mathrm{E}");Z("\\Eta","\\mathrm{H}");Z("\\exist","\\exists");Z("\\harr","\\leftrightarrow");Z("\\hArr","\\Leftrightarrow");Z("\\Harr","\\Leftrightarrow");Z("\\hearts","\\heartsuit");Z("\\image","\\Im");Z("\\infin","\\infty");Z("\\Iota","\\mathrm{I}");Z("\\isin","\\in");Z("\\Kappa","\\mathrm{K}");Z("\\larr","\\leftarrow");Z("\\lArr","\\Leftarrow");Z("\\Larr","\\Leftarrow");Z("\\lrarr","\\leftrightarrow");Z("\\lrArr","\\Leftrightarrow");Z("\\Lrarr","\\Leftrightarrow");Z("\\Mu","\\mathrm{M}");Z("\\natnums","\\mathbb{N}");Z("\\Nu","\\mathrm{N}");Z("\\Omicron","\\mathrm{O}");Z("\\plusmn","\\pm");Z("\\rarr","\\rightarrow");Z("\\rArr","\\Rightarrow");Z("\\Rarr","\\Rightarrow");Z("\\real","\\Re");Z("\\reals","\\mathbb{R}");Z("\\Reals","\\mathbb{R}");Z("\\Rho","\\mathrm{P}");Z("\\sdot","\\cdot");Z("\\sect","\\S");Z("\\spades","\\spadesuit");Z("\\sub","\\subset");Z("\\sube","\\subseteq");Z("\\supe","\\supseteq");Z("\\Tau","\\mathrm{T}");Z("\\thetasym","\\vartheta");Z("\\weierp","\\wp");Z("\\Zeta","\\mathrm{Z}");Z("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Z("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Z("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Z("\\bra","\\mathinner{\\langle{#1}|}");Z("\\ket","\\mathinner{|{#1}\\rangle}");Z("\\braket","\\mathinner{\\langle{#1}\\rangle}");Z("\\Bra","\\left\\langle#1\\right|");Z("\\Ket","\\left|#1\\right\\rangle");var EQ=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,a=e.macros.get("|"),l=e.macros.get("\\|");e.macros.beginGroup();var c=m=>g=>{t&&(g.macros.set("|",a),s.length&&g.macros.set("\\|",l));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("|",c(!1)),s.length&&e.macros.set("\\|",c(!0));var h=e.consumeArg().tokens,f=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:f.reverse(),numArgs:0}};Z("\\bra@ket",EQ(!1));Z("\\bra@set",EQ(!0));Z("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Z("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Z("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Z("\\angln","{\\angl n}");Z("\\blue","\\textcolor{##6495ed}{#1}");Z("\\orange","\\textcolor{##ffa500}{#1}");Z("\\pink","\\textcolor{##ff00af}{#1}");Z("\\red","\\textcolor{##df0030}{#1}");Z("\\green","\\textcolor{##28ae7b}{#1}");Z("\\gray","\\textcolor{gray}{#1}");Z("\\purple","\\textcolor{##9d38bd}{#1}");Z("\\blueA","\\textcolor{##ccfaff}{#1}");Z("\\blueB","\\textcolor{##80f6ff}{#1}");Z("\\blueC","\\textcolor{##63d9ea}{#1}");Z("\\blueD","\\textcolor{##11accd}{#1}");Z("\\blueE","\\textcolor{##0c7f99}{#1}");Z("\\tealA","\\textcolor{##94fff5}{#1}");Z("\\tealB","\\textcolor{##26edd5}{#1}");Z("\\tealC","\\textcolor{##01d1c1}{#1}");Z("\\tealD","\\textcolor{##01a995}{#1}");Z("\\tealE","\\textcolor{##208170}{#1}");Z("\\greenA","\\textcolor{##b6ffb0}{#1}");Z("\\greenB","\\textcolor{##8af281}{#1}");Z("\\greenC","\\textcolor{##74cf70}{#1}");Z("\\greenD","\\textcolor{##1fab54}{#1}");Z("\\greenE","\\textcolor{##0d923f}{#1}");Z("\\goldA","\\textcolor{##ffd0a9}{#1}");Z("\\goldB","\\textcolor{##ffbb71}{#1}");Z("\\goldC","\\textcolor{##ff9c39}{#1}");Z("\\goldD","\\textcolor{##e07d10}{#1}");Z("\\goldE","\\textcolor{##a75a05}{#1}");Z("\\redA","\\textcolor{##fca9a9}{#1}");Z("\\redB","\\textcolor{##ff8482}{#1}");Z("\\redC","\\textcolor{##f9685d}{#1}");Z("\\redD","\\textcolor{##e84d39}{#1}");Z("\\redE","\\textcolor{##bc2612}{#1}");Z("\\maroonA","\\textcolor{##ffbde0}{#1}");Z("\\maroonB","\\textcolor{##ff92c6}{#1}");Z("\\maroonC","\\textcolor{##ed5fa6}{#1}");Z("\\maroonD","\\textcolor{##ca337c}{#1}");Z("\\maroonE","\\textcolor{##9e034e}{#1}");Z("\\purpleA","\\textcolor{##ddd7ff}{#1}");Z("\\purpleB","\\textcolor{##c6b9fc}{#1}");Z("\\purpleC","\\textcolor{##aa87ff}{#1}");Z("\\purpleD","\\textcolor{##7854ab}{#1}");Z("\\purpleE","\\textcolor{##543b78}{#1}");Z("\\mintA","\\textcolor{##f5f9e8}{#1}");Z("\\mintB","\\textcolor{##edf2df}{#1}");Z("\\mintC","\\textcolor{##e0e5cc}{#1}");Z("\\grayA","\\textcolor{##f6f7f7}{#1}");Z("\\grayB","\\textcolor{##f0f1f2}{#1}");Z("\\grayC","\\textcolor{##e3e5e6}{#1}");Z("\\grayD","\\textcolor{##d6d8da}{#1}");Z("\\grayE","\\textcolor{##babec2}{#1}");Z("\\grayF","\\textcolor{##888d93}{#1}");Z("\\grayG","\\textcolor{##626569}{#1}");Z("\\grayH","\\textcolor{##3b3e40}{#1}");Z("\\grayI","\\textcolor{##21242c}{#1}");Z("\\kaBlue","\\textcolor{##314453}{#1}");Z("\\kaGreen","\\textcolor{##71B307}{#1}");var _Q={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class l2e{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 a2e(o2e,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new pM(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 _i("EOF",r.loc)),this.pushTokens(s),new _i("",Xs.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,l=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[l]:"}")+"'",i);if(e&&r)if((a===0||a===1&&e[l]==="{")&&i.text===e[l]){if(++l,l===e.length){n.splice(-l,l);break}}else l=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;s<r.length;s++){var i=this.popToken();if(r[s]!==i.text)throw new Be("Use of the macro doesn't match its definition",i)}}for(var a=[],l=0;l<e;l++)a.push(this.consumeArg(n&&n[l+1]).tokens);return a}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.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 l=i.length-1;l>=0;--l){var c=i[l];if(c.text==="#"){if(l===0)throw new Be("Incomplete placeholder at end of macro body",c);if(c=i[--l],c.text==="#")i.splice(l+1,1);else if(/^[1-9]$/.test(c.text))i.splice(l,2,...a[+c.text-1]);else throw new Be("Not a valid argument number",c)}}}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 _i(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 l=new pM(s,this.settings),c=[],h=l.lex();h.text!=="EOF";)c.push(h),h=l.lex();c.reverse();var f={tokens:c,numArgs:i};return f}return s}isDefined(e){return this.macros.has(e)||uc.hasOwnProperty(e)||Gn.math.hasOwnProperty(e)||Gn.text.hasOwnProperty(e)||_Q.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:uc.hasOwnProperty(e)&&!uc[e].primitive}}var vM=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Ax=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),j4={"́":{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"}},yM={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class by{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 l2e(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 _i("}")),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(by.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&uc[s.text]&&uc[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<e.length;s++)if(e[s].type==="infix"){if(n!==-1)throw new Be("only one infix operator per group",e[s].token);n=s,r=e[s].replaceWith}if(n!==-1&&r){var i,a,l=e.slice(0,n),c=e.slice(n+1);l.length===1&&l[0].type==="ordgroup"?i=l[0]:i={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?a=c[0]:a={type:"ordgroup",mode:this.mode,body:c};var h;return r==="\\\\abovefrac"?h=this.callFunction(r,[i,e[n],a],[]):h=this.callFunction(r,[i,a],[]),[h]}else return e}handleSupSubscript(e){var n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();var s;do{var i;s=this.parseGroup(e)}while(((i=s)==null?void 0:i.type)==="internal");if(!s)throw new Be("Expected group after '"+r+"'",n);return s}formatUnsupportedCmd(e){for(var n=[],r=0;r<e.length;r++)n.push({type:"textord",mode:"text",text:e[r]});var s={type:"text",mode:this.mode,body:n},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[s]};return i}parseAtom(e){var n=this.parseGroup("atom",e);if(n?.type==="internal"||this.mode==="text")return n;for(var r,s;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(n&&n.type==="op"){var a=i.text==="\\limits";n.limits=a,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=i.text==="\\limits");else throw new Be("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new Be("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new Be("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new Be("Double superscript",i);var l={type:"textord",mode:this.mode,text:"\\prime"},c=[l];for(this.consume();this.fetch().text==="'";)c.push(l),this.consume();this.fetch().text==="^"&&c.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:c}}else if(Ax[i.text]){var h=vM.test(i.text),f=[];for(f.push(new _i(Ax[i.text])),this.consume();;){var m=this.fetch().text;if(!Ax[m]||vM.test(m)!==h)break;f.unshift(new _i(Ax[m])),this.consume()}var g=this.subparse(f);h?s={type:"ordgroup",mode:"math",body:g}:r={type:"ordgroup",mode:"math",body:g}}else break}return r||s?{type:"supsub",mode:this.mode,base:n,sup:r,sub:s}:n}parseFunction(e,n){var r=this.fetch(),s=r.text,i=uc[s];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new Be("Got function '"+s+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!i.allowedInText)throw new Be("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new Be("Can't use function '"+s+"' in math mode",r);var{args:a,optArgs:l}=this.parseArguments(s,i);return this.callFunction(s,a,l,r,e)}callFunction(e,n,r,s,i){var a={funcName:e,parser:this,token:s,breakOnTokenText:i},l=uc[e];if(l&&l.handler)return l.handler(a,n,r);throw new Be("No function handler for "+e)}parseArguments(e,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var s=[],i=[],a=0;a<r;a++){var l=n.argTypes&&n.argTypes[a],c=a<n.numOptionalArgs;(n.primitive&&l==null||n.type==="sqrt"&&a===1&&i[0]==null)&&(l="primitive");var h=this.parseGroupOfType("argument to '"+e+"'",l,c);if(c)i.push(h);else if(h!=null)s.push(h);else throw new Be("Null argument, please report this as a bug")}return{args:s,optArgs:i}}parseGroupOfType(e,n,r){switch(n){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,n);case"hbox":{var s=this.parseArgumentGroup(r,"text");return s!=null?{type:"styling",mode:s.mode,body:[s],style:"text"}:null}case"raw":{var i=this.parseStringGroup("raw",r);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(r)throw new Be("A primitive argument cannot be optional");var a=this.parseGroup(e);if(a==null)throw new Be("Expected group as "+e,this.fetch());return a}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new Be("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,n){var r=this.gullet.scanArgument(n);if(r==null)return null;for(var s="",i;(i=this.fetch()).text!=="EOF";)s+=i.text,this.consume();return this.consume(),r.text=s,r}parseRegexGroup(e,n){for(var r=this.fetch(),s=r,i="",a;(a=this.fetch()).text!=="EOF"&&e.test(i+a.text);)s=a,i+=s.text,this.consume();if(i==="")throw new Be("Invalid "+n+": '"+r.text+"'",r);return r.range(s,i)}parseColorGroup(e){var n=this.parseStringGroup("color",e);if(n==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!r)throw new Be("Invalid color: '"+n.text+"'",n);var s=r[0];return/^[0-9a-f]{6}$/i.test(s)&&(s="#"+s),{type:"color-token",mode:this.mode,color:s}}parseSizeGroup(e){var n,r=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",e),!n)return null;!e&&n.text.length===0&&(n.text="0pt",r=!0);var s=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!s)throw new Be("Invalid size: '"+n.text+"'",n);var i={number:+(s[1]+s[2]),unit:s[3]};if(!q$(i))throw new Be("Invalid unit: '"+i.unit+"'",n);return{type:"size",mode:this.mode,value:i,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,n){var r=this.gullet.scanArgument(e);if(r==null)return null;var s=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var a={type:"ordgroup",mode:this.mode,loc:r.loc,body:i};return n&&this.switchMode(s),a}parseGroup(e,n){var r=this.fetch(),s=r.text,i;if(s==="{"||s==="\\begingroup"){this.consume();var a=s==="{"?"}":"\\endgroup";this.gullet.beginGroup();var l=this.parseExpression(!1,a),c=this.fetch();this.expect(a),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:Xs.range(r,c),body:l,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,e)||this.parseSymbol(),i==null&&s[0]==="\\"&&!_Q.hasOwnProperty(s)){if(this.settings.throwOnError)throw new Be("Undefined control sequence: "+s,r);i=this.formatUnsupportedCmd(s),this.consume()}return i}formLigatures(e){for(var n=e.length-1,r=0;r<n;++r){var s=e[r],i=s.text;i==="-"&&e[r+1].text==="-"&&(r+1<n&&e[r+2].text==="-"?(e.splice(r,3,{type:"textord",mode:"text",loc:Xs.range(s,e[r+2]),text:"---"}),n-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:Xs.range(s,e[r+1]),text:"--"}),n-=1)),(i==="'"||i==="`")&&e[r+1].text===i&&(e.splice(r,2,{type:"textord",mode:"text",loc:Xs.range(s,e[r+1]),text:i+i}),n-=1)}}parseSymbol(){var e=this.fetch(),n=e.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var r=n.slice(5),s=r.charAt(0)==="*";if(s&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new Be(`\\verb assertion failed --
please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}yM.hasOwnProperty(n[0])&&!Gn[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',e),n=yM[n[0]]+n.slice(1));var i=s2e.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var a;if(Gn[this.mode][n]){this.settings.strict&&this.mode==="math"&&rk.indexOf(n)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var l=Gn[this.mode][n].group,c=Xs.range(e),h;if(Yye.hasOwnProperty(l)){var f=l;h={type:"atom",mode:this.mode,family:f,loc:c,text:n}}else h={type:l,mode:this.mode,loc:c,text:n};a=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(B$(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:Xs.range(e),text:n};else return null;if(this.consume(),i)for(var m=0;m<i[0].length;m++){var g=i[0][m];if(!j4[g])throw new Be("Unknown accent ' "+g+"'",e);var x=j4[g][this.mode]||j4[g].text;if(!x)throw new Be("Accent "+g+" unsupported in "+this.mode+" mode",e);a={type:"accent",mode:this.mode,loc:Xs.range(e),label:x,isStretchy:!1,isShifty:!0,base:a}}return a}}by.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var rj=function(e,n){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new by(e,n);delete r.gullet.macros.current["\\df@tag"];var s=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new Be("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:r.subparse([new _i("\\df@tag")])}]}return s},MQ=function(e,n,r){n.textContent="";var s=sj(e,r).toNode();n.appendChild(s)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),MQ=function(){throw new Be("KaTeX doesn't work in quirks mode.")});var c2e=function(e,n){var r=sj(e,n).toMarkup();return r},u2e=function(e,n){var r=new BO(n);return rj(e,r)},AQ=function(e,n,r){if(r.throwOnError||!(e instanceof Be))throw e;var s=we.makeSpan(["katex-error"],[new aa(n)]);return s.setAttribute("title",e.toString()),s.setAttribute("style","color:"+r.errorColor),s},sj=function(e,n){var r=new BO(n);try{var s=rj(e,r);return ybe(s,e,r)}catch(i){return AQ(i,e,r)}},d2e=function(e,n){var r=new BO(n);try{var s=rj(e,r);return bbe(s,e,r)}catch(i){return AQ(i,e,r)}},h2e="0.16.25",f2e={Span:lp,Anchor:$O,SymbolNode:aa,SvgNode:ml,PathNode:kc,LineNode:nk},bM={version:h2e,render:MQ,renderToString:c2e,ParseError:Be,SETTINGS_SCHEMA:f1,__parse:u2e,__renderToDomTree:sj,__renderToHTMLTree:d2e,__setFontMetrics:$ye,__defineSymbol:A,__defineFunction:Ke,__defineMacro:Z,__domTree:f2e};const m2e={};function p2e(t){const e=this,n=t||m2e,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(mye(n)),i.push(aye()),a.push(oye(n))}const wM=/[#.]/g;function g2e(t,e){const n=t||"",r={};let s=0,i,a;for(;s<n.length;){wM.lastIndex=s;const l=wM.exec(n),c=n.slice(s,l?l.index:n.length);c&&(i?i==="#"?r.id=c:Array.isArray(r.className)?r.className.push(c):r.className=[c]:a=c,s+=c.length),l&&(i=l[0],s++)}return{type:"element",tagName:a||e||"div",properties:r,children:[]}}function RQ(t,e,n){const r=n?b2e(n):void 0;function s(i,a,...l){let c;if(i==null){c={type:"root",children:[]};const h=a;l.unshift(h)}else{c=g2e(i,e);const h=c.tagName.toLowerCase(),f=r?r.get(h):void 0;if(c.tagName=f||h,x2e(a))l.unshift(a);else for(const[m,g]of Object.entries(a))v2e(t,c.properties,m,g)}for(const h of l)ck(c.children,h);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return s}function x2e(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const s=e[r];if(s&&typeof s=="object"){if(!Array.isArray(s))return!0;const i=s;for(const a of i)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function v2e(t,e,n,r){const s=IF(t,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?s.spaceSeparated?i=JE(r):s.commaSeparated?i=GE(r):s.commaOrSpaceSeparated?i=JE(GE(r).join(" ")):i=SM(s,s.property,r):Array.isArray(r)?i=[...r]:i=s.property==="style"?y2e(r):String(r);if(Array.isArray(i)){const a=[];for(const l of i)a.push(SM(s,s.property,l));i=a}s.property==="className"&&Array.isArray(e.className)&&(i=e.className.concat(i)),e[s.property]=i}}function ck(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)ck(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?ck(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function SM(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||f0(n)===f0(e)))return!0}return n}function y2e(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function b2e(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const w2e=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],S2e=RQ(BF,"div"),k2e=RQ(cy,"g",w2e),N4={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function O2e(t,e){return DQ(t,{})||{type:"root",children:[]}}function DQ(t,e){const n=j2e(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function j2e(t,e){switch(t.nodeType){case 1:return E2e(t,e);case 3:return C2e(t);case 8:return T2e(t);case 9:return kM(t,e);case 10:return N2e();case 11:return kM(t,e);default:return}}function kM(t,e){return{type:"root",children:zQ(t,e)}}function N2e(){return{type:"doctype"}}function C2e(t){return{type:"text",value:t.nodeValue||""}}function T2e(t){return{type:"comment",value:t.nodeValue||""}}function E2e(t,e){const n=t.namespaceURI,r=n===N4.svg?k2e:S2e,s=n===N4.html?t.tagName.toLowerCase():t.tagName,i=n===N4.html&&s==="template"?t.content:t,a=t.getAttributeNames(),l={};let c=-1;for(;++c<a.length;)l[a[c]]=t.getAttribute(a[c])||"";return r(s,l,zQ(i,e))}function zQ(t,e){const n=t.childNodes,r=[];let s=-1;for(;++s<n.length;){const i=DQ(n[s],e);i!==void 0&&r.push(i)}return r}new DOMParser;function _2e(t,e){const n=M2e(t);return O2e(n)}function M2e(t){const e=document.createElement("template");return e.innerHTML=t,e.content}const OM=(function(t,e,n){const r=ip(n);if(!t||!t.type||!t.children)throw new Error("Expected parent node");if(typeof e=="number"){if(e<0||e===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(e=t.children.indexOf(e),e<0)throw new Error("Expected child node or index");for(;++e<t.children.length;)if(r(t.children[e],e,t))return t.children[e]}),$u=(function(t){if(t==null)return D2e;if(typeof t=="string")return R2e(t);if(typeof t=="object")return A2e(t);if(typeof t=="function")return ij(t);throw new Error("Expected function, string, or array as `test`")});function A2e(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=$u(t[n]);return ij(r);function r(...s){let i=-1;for(;++i<e.length;)if(e[i].apply(this,s))return!0;return!1}}function R2e(t){return ij(e);function e(n){return n.tagName===t}}function ij(t){return e;function e(n,r,s){return!!(z2e(n)&&t.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function D2e(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function z2e(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const jM=/\n/g,NM=/[\t ]+/g,uk=$u("br"),CM=$u(Q2e),P2e=$u("p"),TM=$u("tr"),L2e=$u(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",$2e,H2e]),PQ=$u(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function I2e(t,e){const n=e||{},r="children"in t?t.children:[],s=PQ(t),i=BQ(t,{whitespace:n.whitespace||"normal"}),a=[];(t.type==="text"||t.type==="comment")&&a.push(...IQ(t,{breakBefore:!0,breakAfter:!0}));let l=-1;for(;++l<r.length;)a.push(...LQ(r[l],t,{whitespace:i,breakBefore:l?void 0:s,breakAfter:l<r.length-1?uk(r[l+1]):s}));const c=[];let h;for(l=-1;++l<a.length;){const f=a[l];typeof f=="number"?h!==void 0&&f>h&&(h=f):f&&(h!==void 0&&h>-1&&c.push(`
`.repeat(h)||" "),h=-1,c.push(f))}return c.join("")}function LQ(t,e,n){return t.type==="element"?B2e(t,e,n):t.type==="text"?n.whitespace==="normal"?IQ(t,n):q2e(t):[]}function B2e(t,e,n){const r=BQ(t,n),s=t.children||[];let i=-1,a=[];if(L2e(t))return a;let l,c;for(uk(t)||TM(t)&&OM(e,t,TM)?c=`
`:P2e(t)?(l=2,c=2):PQ(t)&&(l=1,c=1);++i<s.length;)a=a.concat(LQ(s[i],t,{whitespace:r,breakBefore:i?void 0:l,breakAfter:i<s.length-1?uk(s[i+1]):c}));return CM(t)&&OM(e,t,CM)&&a.push(" "),l&&a.unshift(l),c&&a.push(c),a}function IQ(t,e){const n=String(t.value),r=[],s=[];let i=0;for(;i<=n.length;){jM.lastIndex=i;const c=jM.exec(n),h=c&&"index"in c?c.index:n.length;r.push(F2e(n.slice(i,h).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?e.breakBefore:!0,h===n.length?e.breakAfter:!0)),i=h+1}let a=-1,l;for(;++a<r.length;)r[a].charCodeAt(r[a].length-1)===8203||a<r.length-1&&r[a+1].charCodeAt(0)===8203?(s.push(r[a]),l=void 0):r[a]?(typeof l=="number"&&s.push(l),s.push(r[a]),l=0):(a===0||a===r.length-1)&&s.push(0);return s}function q2e(t){return[String(t.value)]}function F2e(t,e,n){const r=[];let s=0,i;for(;s<t.length;){NM.lastIndex=s;const a=NM.exec(t);i=a?a.index:t.length,!s&&!i&&a&&!e&&r.push(""),s!==i&&r.push(t.slice(s,i)),s=a?i+a[0].length:i}return s!==i&&!n&&r.push(""),r.join(" ")}function BQ(t,e){if(t.type==="element"){const n=t.properties||{};switch(t.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}}return e.whitespace}function $2e(t){return!!(t.properties||{}).hidden}function Q2e(t){return t.tagName==="td"||t.tagName==="th"}function H2e(t){return t.tagName==="dialog"&&!(t.properties||{}).open}const V2e={},U2e=[];function W2e(t){const e=t||V2e;return function(n,r){RO(n,"element",function(s,i){const a=Array.isArray(s.properties.className)?s.properties.className:U2e,l=a.includes("language-math"),c=a.includes("math-display"),h=a.includes("math-inline");let f=c;if(!l&&!c&&!h)return;let m=i[i.length-1],g=s;if(s.tagName==="code"&&l&&m&&m.type==="element"&&m.tagName==="pre"&&(g=m,m=i[i.length-2],f=!0),!m)return;const x=I2e(g,{whitespace:"pre"});let y;try{y=bM.renderToString(x,{...e,displayMode:f,throwOnError:!0})}catch(S){const k=S,N=k.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,s],cause:k,place:s.position,ruleId:N,source:"rehype-katex"});try{y=bM.renderToString(x,{...e,displayMode:f,strict:"ignore",throwOnError:!1})}catch{y=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(e.errorColor||"#cc0000"),title:String(S)},children:[{type:"text",value:x}]}]}}typeof y=="string"&&(y=_2e(y).children);const w=m.children.indexOf(g);return m.children.splice(w,1,...y),h$})}}function G2e({content:t,className:e=""}){return o.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${e}`,children:o.jsx(Wxe,{remarkPlugins:[iye,p2e],rehypePlugins:[W2e],components:{code({inline:n,className:r,children:s,...i}){return n?o.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...i,children:s}):o.jsx("code",{className:`${r} block bg-muted p-4 rounded-lg overflow-x-auto`,...i,children:s})},table({children:n,...r}){return o.jsx("div",{className:"overflow-x-auto",children:o.jsx("table",{className:"border-collapse border border-border",...r,children:n})})},th({children:n,...r}){return o.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...r,children:n})},td({children:n,...r}){return o.jsx("td",{className:"border border-border px-4 py-2",...r,children:n})},a({children:n,...r}){return o.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...r,children:n})},blockquote({children:n,...r}){return o.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...r,children:n})},h1({children:n,...r}){return o.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...r,children:n})},h2({children:n,...r}){return o.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...r,children:n})},h3({children:n,...r}){return o.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...r,children:n})},h4({children:n,...r}){return o.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...r,children:n})},ul({children:n,...r}){return o.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...r,children:n})},ol({children:n,...r}){return o.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...r,children:n})},p({children:n,...r}){return o.jsx("p",{className:"my-2 leading-relaxed",...r,children:n})},hr({...n}){return o.jsx("hr",{className:"my-4 border-border",...n})}},children:t})})}function X2e({children:t,className:e}){return o.jsx(G2e,{content:t,className:e})}const Sl="/api/webui/emoji";async function Y2e(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_registered!==void 0&&e.append("is_registered",t.is_registered.toString()),t.is_banned!==void 0&&e.append("is_banned",t.is_banned.toString()),t.format&&e.append("format",t.format),t.sort_by&&e.append("sort_by",t.sort_by),t.sort_order&&e.append("sort_order",t.sort_order);const n=await mt(`${Sl}/list?${e}`,{headers:Nt()});if(!n.ok)throw new Error(`获取表情包列表失败: ${n.statusText}`);return n.json()}async function K2e(t){const e=await mt(`${Sl}/${t}`,{headers:Nt()});if(!e.ok)throw new Error(`获取表情包详情失败: ${e.statusText}`);return e.json()}async function Z2e(t,e){const n=await mt(`${Sl}/${t}`,{method:"PATCH",headers:Nt(),body:JSON.stringify(e)});if(!n.ok)throw new Error(`更新表情包失败: ${n.statusText}`);return n.json()}async function J2e(t){const e=await mt(`${Sl}/${t}`,{method:"DELETE",headers:Nt()});if(!e.ok)throw new Error(`删除表情包失败: ${e.statusText}`);return e.json()}async function ewe(){const t=await mt(`${Sl}/stats/summary`,{headers:Nt()});if(!t.ok)throw new Error(`获取统计数据失败: ${t.statusText}`);return t.json()}async function twe(t){const e=await mt(`${Sl}/${t}/register`,{method:"POST",headers:Nt()});if(!e.ok)throw new Error(`注册表情包失败: ${e.statusText}`);return e.json()}async function nwe(t){const e=await mt(`${Sl}/${t}/ban`,{method:"POST",headers:Nt()});if(!e.ok)throw new Error(`封禁表情包失败: ${e.statusText}`);return e.json()}function qQ(t){const e=localStorage.getItem("access-token");return`${Sl}/${t}/thumbnail?token=${encodeURIComponent(e||"")}`}async function rwe(t){const e=await mt(`${Sl}/batch/delete`,{method:"POST",headers:Nt(),body:JSON.stringify({emoji_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function swe(){const[t,e]=b.useState([]),[n,r]=b.useState(null),[s,i]=b.useState(!1),[a,l]=b.useState(1),[c,h]=b.useState(0),[f,m]=b.useState(20),[g,x]=b.useState("all"),[y,w]=b.useState("all"),[S,k]=b.useState("all"),[N,C]=b.useState("usage_count"),[T,_]=b.useState("desc"),[E,M]=b.useState(null),[q,L]=b.useState(!1),[I,$]=b.useState(!1),[V,ee]=b.useState(!1),[z,H]=b.useState(new Set),[P,W]=b.useState(!1),[J,X]=b.useState(""),[R,se]=b.useState("medium"),{toast:G}=Wr(),F=b.useCallback(async()=>{try{i(!0);const je=await Y2e({page:a,page_size:f,is_registered:g==="all"?void 0:g==="registered",is_banned:y==="all"?void 0:y==="banned",format:S==="all"?void 0:S,sort_by:N,sort_order:T});e(je.data),h(je.total)}catch(je){const Qe=je instanceof Error?je.message:"加载表情包列表失败";G({title:"错误",description:Qe,variant:"destructive"})}finally{i(!1)}},[a,f,g,y,S,N,T,G]),U=async()=>{try{const je=await ewe();r(je.data)}catch(je){console.error("加载统计数据失败:",je)}};b.useEffect(()=>{F()},[F]),b.useEffect(()=>{U()},[]);const te=async je=>{try{const Qe=await K2e(je.id);M(Qe.data),L(!0)}catch(Qe){const He=Qe instanceof Error?Qe.message:"加载详情失败";G({title:"错误",description:He,variant:"destructive"})}},ne=je=>{M(je),$(!0)},Y=je=>{M(je),ee(!0)},ae=async()=>{if(E)try{await J2e(E.id),G({title:"成功",description:"表情包已删除"}),ee(!1),M(null),F(),U()}catch(je){const Qe=je instanceof Error?je.message:"删除失败";G({title:"错误",description:Qe,variant:"destructive"})}},re=async je=>{try{await twe(je.id),G({title:"成功",description:"表情包已注册"}),F(),U()}catch(Qe){const He=Qe instanceof Error?Qe.message:"注册失败";G({title:"错误",description:He,variant:"destructive"})}},oe=async je=>{try{await nwe(je.id),G({title:"成功",description:"表情包已封禁"}),F(),U()}catch(Qe){const He=Qe instanceof Error?Qe.message:"封禁失败";G({title:"错误",description:He,variant:"destructive"})}},_e=je=>{const Qe=new Set(z);Qe.has(je)?Qe.delete(je):Qe.add(je),H(Qe)},Ge=async()=>{try{const je=await rwe(Array.from(z));G({title:"批量删除完成",description:je.message}),H(new Set),W(!1),F(),U()}catch(je){G({title:"批量删除失败",description:je instanceof Error?je.message:"批量删除失败",variant:"destructive"})}},tt=()=>{const je=parseInt(J),Qe=Math.ceil(c/f);je>=1&&je<=Qe?(l(je),X("")):G({title:"无效的页码",description:`请输入1-${Qe}之间的页码`,variant:"destructive"})},Xe=n?.formats?Object.keys(n.formats):[];return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsxs("div",{className:"mb-4 sm:mb-6",children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),o.jsx(kn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&o.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[o.jsx(_t,{children:o.jsxs(wn,{className:"pb-2",children:[o.jsx(Fr,{children:"总数"}),o.jsx(Sn,{className:"text-2xl",children:n.total})]})}),o.jsx(_t,{children:o.jsxs(wn,{className:"pb-2",children:[o.jsx(Fr,{children:"已注册"}),o.jsx(Sn,{className:"text-2xl text-green-600",children:n.registered})]})}),o.jsx(_t,{children:o.jsxs(wn,{className:"pb-2",children:[o.jsx(Fr,{children:"已封禁"}),o.jsx(Sn,{className:"text-2xl text-red-600",children:n.banned})]})}),o.jsx(_t,{children:o.jsxs(wn,{className:"pb-2",children:[o.jsx(Fr,{children:"未注册"}),o.jsx(Sn,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),o.jsxs(_t,{children:[o.jsx(wn,{children:o.jsxs(Sn,{className:"flex items-center gap-2",children:[o.jsx(N3,{className:"h-5 w-5"}),"筛选和排序"]})}),o.jsxs(An,{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"排序方式"}),o.jsxs(Dt,{value:`${N}-${T}`,onValueChange:je=>{const[Qe,He]=je.split("-");C(Qe),_(He),l(1)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"usage_count-desc",children:"使用次数 (多→少)"}),o.jsx(ze,{value:"usage_count-asc",children:"使用次数 (少→多)"}),o.jsx(ze,{value:"register_time-desc",children:"注册时间 (新→旧)"}),o.jsx(ze,{value:"register_time-asc",children:"注册时间 (旧→新)"}),o.jsx(ze,{value:"record_time-desc",children:"记录时间 (新→旧)"}),o.jsx(ze,{value:"record_time-asc",children:"记录时间 (旧→新)"}),o.jsx(ze,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),o.jsx(ze,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"注册状态"}),o.jsxs(Dt,{value:g,onValueChange:je=>{x(je),l(1)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部"}),o.jsx(ze,{value:"registered",children:"已注册"}),o.jsx(ze,{value:"unregistered",children:"未注册"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"封禁状态"}),o.jsxs(Dt,{value:y,onValueChange:je=>{w(je),l(1)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部"}),o.jsx(ze,{value:"banned",children:"已封禁"}),o.jsx(ze,{value:"unbanned",children:"未封禁"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"格式"}),o.jsxs(Dt,{value:S,onValueChange:je=>{k(je),l(1)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部"}),Xe.map(je=>o.jsxs(ze,{value:je,children:[je.toUpperCase()," (",n?.formats[je],")"]},je))]})]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[z.size>0&&o.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",z.size," 个表情包"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),o.jsxs(Dt,{value:R,onValueChange:je=>se(je),children:[o.jsx(Mt,{className:"w-24",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"small",children:"小"}),o.jsx(ze,{value:"medium",children:"中"}),o.jsx(ze,{value:"large",children:"大"})]})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Dt,{value:f.toString(),onValueChange:je=>{m(parseInt(je)),l(1),H(new Set)},children:[o.jsx(Mt,{id:"emoji-page-size",className:"w-20",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"20",children:"20"}),o.jsx(ze,{value:"40",children:"40"}),o.jsx(ze,{value:"60",children:"60"}),o.jsx(ze,{value:"100",children:"100"})]})]}),z.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>H(new Set),children:"取消选择"}),o.jsxs(me,{variant:"destructive",size:"sm",onClick:()=>W(!0),children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(me,{variant:"outline",size:"sm",onClick:F,disabled:s,children:[o.jsx(Ti,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"表情包列表"}),o.jsxs(Fr,{children:["共 ",c," 个表情包,当前第 ",a," 页"]})]}),o.jsxs(An,{children:[t.length===0?o.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):o.jsx("div",{className:`grid gap-3 ${R==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":R==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:t.map(je=>o.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${z.has(je.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>_e(je.id),children:[o.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${z.has(je.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:o.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${z.has(je.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:z.has(je.id)&&o.jsx(pc,{className:"h-3 w-3"})})}),o.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[je.is_registered&&o.jsx(Ln,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),je.is_banned&&o.jsx(Ln,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),o.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${R==="small"?"p-1":R==="medium"?"p-2":"p-3"}`,children:o.jsx("img",{src:qQ(je.id),alt:"表情包",className:"w-full h-full object-contain",loading:"lazy",onError:Qe=>{const He=Qe.target;He.style.display="none";const $e=He.parentElement;$e&&($e.innerHTML='<svg class="h-8 w-8 text-muted-foreground" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>')}})}),o.jsxs("div",{className:`border-t bg-card ${R==="small"?"p-1":"p-2"}`,children:[o.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[o.jsx(Ln,{variant:"outline",className:"text-[10px] px-1 py-0",children:je.format.toUpperCase()}),o.jsxs("span",{className:"font-mono",children:[je.usage_count,"次"]})]}),o.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${R==="small"?"flex-wrap":""}`,children:[o.jsx(me,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Qe=>{Qe.stopPropagation(),ne(je)},title:"编辑",children:o.jsx(Bm,{className:"h-3 w-3"})}),o.jsx(me,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Qe=>{Qe.stopPropagation(),te(je)},title:"详情",children:o.jsx(wa,{className:"h-3 w-3"})}),!je.is_registered&&o.jsx(me,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Qe=>{Qe.stopPropagation(),re(je)},title:"注册",children:o.jsx(pc,{className:"h-3 w-3"})}),!je.is_banned&&o.jsx(me,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Qe=>{Qe.stopPropagation(),oe(je)},title:"封禁",children:o.jsx(TK,{className:"h-3 w-3"})}),o.jsx(me,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Qe=>{Qe.stopPropagation(),Y(je)},title:"删除",children:o.jsx(sn,{className:"h-3 w-3"})})]})]})]},je.id))}),c>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(a-1)*f+1," 到"," ",Math.min(a*f,c)," 条,共 ",c," 条"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(M0,{className:"h-4 w-4"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(je=>Math.max(1,je-1)),disabled:a===1,children:[o.jsx(Iu,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:J,onChange:je=>X(je.target.value),onKeyDown:je=>je.key==="Enter"&&tt(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(c/f)}),o.jsx(me,{variant:"outline",size:"sm",onClick:tt,disabled:!J,className:"h-8",children:"跳转"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(je=>je+1),disabled:a>=Math.ceil(c/f),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Bu,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(c/f)),disabled:a>=Math.ceil(c/f),className:"hidden sm:flex",children:o.jsx(A0,{className:"h-4 w-4"})})]})]})]})]}),o.jsx(iwe,{emoji:E,open:q,onOpenChange:L}),o.jsx(awe,{emoji:E,open:I,onOpenChange:$,onSuccess:()=>{F(),U()}})]})}),o.jsx(jn,{open:P,onOpenChange:W,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认批量删除"}),o.jsxs(fn,{children:["你确定要删除选中的 ",z.size," 个表情包吗?此操作不可撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:Ge,children:"确认删除"})]})]})}),o.jsx(zr,{open:V,onOpenChange:ee,children:o.jsxs(Sr,{children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"确认删除"}),o.jsx(ps,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>ee(!1),children:"取消"}),o.jsx(me,{variant:"destructive",onClick:ae,children:"删除"})]})]})})]})}function iwe({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[90vh]",children:[o.jsx(kr,{children:o.jsx(Or,{children:"表情包详情"})}),o.jsx(kn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:o.jsx("img",{src:qQ(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='<svg class="h-16 w-16 text-muted-foreground" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>')}})})}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"ID"}),o.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"格式"}),o.jsx("div",{className:"mt-1",children:o.jsx(Ln,{variant:"outline",children:t.format.toUpperCase()})})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"文件路径"}),o.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"哈希值"}),o.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"描述"}),t.description?o.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:o.jsx(X2e,{className:"prose-sm",children:t.description})}):o.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"情绪"}),o.jsx("div",{className:"mt-1",children:t.emotion?o.jsx("span",{className:"text-sm",children:t.emotion}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"状态"}),o.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&o.jsx(Ln,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&o.jsx(Ln,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&o.jsx(Ln,{variant:"outline",children:"未注册"})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"使用次数"}),o.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"记录时间"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"注册时间"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"最后使用"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function awe({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState(""),[a,l]=b.useState(""),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState(!1),{toast:y}=Wr();b.useEffect(()=>{t&&(i(t.description||""),l(t.emotion||""),h(t.is_registered),m(t.is_banned))},[t]);const w=async()=>{if(t)try{x(!0);const S=a.split(/[,,]/).map(k=>k.trim()).filter(Boolean).join(",");await Z2e(t.id,{description:s||void 0,emotion:S||void 0,is_registered:c,is_banned:f}),y({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(S){const k=S instanceof Error?S.message:"保存失败";y({title:"错误",description:k,variant:"destructive"})}finally{x(!1)}};return t?o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑表情包"}),o.jsx(ps,{children:"修改表情包的描述和标签信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx(de,{children:"描述"}),o.jsx(nr,{value:s,onChange:S=>i(S.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{children:"情绪"}),o.jsx(nr,{value:a,onChange:S=>l(S.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ri,{id:"is_registered",checked:c,onCheckedChange:S=>{S===!0?(h(!0),m(!1)):h(!1)}}),o.jsx(de,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ri,{id:"is_banned",checked:f,onCheckedChange:S=>{S===!0?(m(!0),h(!1)):m(!1)}}),o.jsx(de,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(me,{onClick:w,disabled:g,children:g?"保存中...":"保存"})]})]})}):null}const zc="/api/webui/expression";async function owe(){const t=await mt(`${zc}/chats`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取聊天列表失败")}return t.json()}async function lwe(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 mt(`${zc}/list?${e}`,{headers:Nt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function cwe(t){const e=await mt(`${zc}/${t}`,{headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function uwe(t){const e=await mt(`${zc}/`,{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function dwe(t,e){const n=await mt(`${zc}/${t}`,{method:"PATCH",headers:Nt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function hwe(t){const e=await mt(`${zc}/${t}`,{method:"DELETE",headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function fwe(t){const e=await mt(`${zc}/batch/delete`,{method:"POST",headers:Nt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function mwe(){const t=await mt(`${zc}/stats/summary`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function pwe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(1),[c,h]=b.useState(20),[f,m]=b.useState(""),[g,x]=b.useState(null),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(null),[E,M]=b.useState(new Set),[q,L]=b.useState(!1),[I,$]=b.useState(""),[V,ee]=b.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[z,H]=b.useState([]),[P,W]=b.useState(new Map),{toast:J}=Wr(),X=async()=>{try{r(!0);const oe=await lwe({page:a,page_size:c,search:f||void 0});e(oe.data),i(oe.total)}catch(oe){J({title:"加载失败",description:oe instanceof Error?oe.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},R=async()=>{try{const oe=await mwe();oe?.data&&ee(oe.data)}catch(oe){console.error("加载统计数据失败:",oe)}},se=async()=>{try{const oe=await owe();if(oe?.data){H(oe.data);const _e=new Map;oe.data.forEach(Ge=>{_e.set(Ge.chat_id,Ge.chat_name)}),W(_e)}}catch(oe){console.error("加载聊天列表失败:",oe)}},G=oe=>P.get(oe)||oe;b.useEffect(()=>{X(),R(),se()},[a,c,f]);const F=async oe=>{try{const _e=await cwe(oe.id);x(_e.data),w(!0)}catch(_e){J({title:"加载详情失败",description:_e instanceof Error?_e.message:"无法加载表达方式详情",variant:"destructive"})}},U=oe=>{x(oe),k(!0)},te=async oe=>{try{await hwe(oe.id),J({title:"删除成功",description:`已删除表达方式: ${oe.situation}`}),_(null),X(),R()}catch(_e){J({title:"删除失败",description:_e instanceof Error?_e.message:"无法删除表达方式",variant:"destructive"})}},ne=oe=>{const _e=new Set(E);_e.has(oe)?_e.delete(oe):_e.add(oe),M(_e)},Y=()=>{E.size===t.length&&t.length>0?M(new Set):M(new Set(t.map(oe=>oe.id)))},ae=async()=>{try{await fwe(Array.from(E)),J({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),M(new Set),L(!1),X(),R()}catch(oe){J({title:"批量删除失败",description:oe instanceof Error?oe.message:"无法批量删除表达方式",variant:"destructive"})}},re=()=>{const oe=parseInt(I),_e=Math.ceil(s/c);oe>=1&&oe<=_e?(l(oe),$("")):J({title:"无效的页码",description:`请输入1-${_e}之间的页码`,variant:"destructive"})};return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsx("div",{className:"mb-4 sm:mb-6",children:o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[o.jsx(E0,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),o.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),o.jsxs(me,{onClick:()=>C(!0),className:"gap-2",children:[o.jsx(ms,{className:"h-4 w-4"}),"新增表达方式"]})]})}),o.jsx(kn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),o.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx(de,{htmlFor:"search",children:"搜索"}),o.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(ii,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{id:"search",placeholder:"搜索情境、风格或上下文...",value:f,onChange:oe=>m(oe.target.value),className:"pl-9"})]})}),o.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:[o.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&o.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Dt,{value:c.toString(),onValueChange:oe=>{h(parseInt(oe)),l(1),M(new Set)},children:[o.jsx(Mt,{id:"page-size",className:"w-20",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"10",children:"10"}),o.jsx(ze,{value:"20",children:"20"}),o.jsx(ze,{value:"50",children:"50"}),o.jsx(ze,{value:"100",children:"100"})]})]}),E.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>M(new Set),children:"取消选择"}),o.jsxs(me,{variant:"destructive",size:"sm",onClick:()=>L(!0),children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card",children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(Qh,{children:[o.jsx(Hh,{children:o.jsxs(fs,{children:[o.jsx(en,{className:"w-12",children:o.jsx(ri,{checked:E.size===t.length&&t.length>0,onCheckedChange:Y})}),o.jsx(en,{children:"情境"}),o.jsx(en,{children:"风格"}),o.jsx(en,{children:"聊天"}),o.jsx(en,{className:"text-right",children:"操作"})]})}),o.jsx(Vh,{children:n?o.jsx(fs,{children:o.jsx(Lt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?o.jsx(fs,{children:o.jsx(Lt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(oe=>o.jsxs(fs,{children:[o.jsx(Lt,{children:o.jsx(ri,{checked:E.has(oe.id),onCheckedChange:()=>ne(oe.id)})}),o.jsx(Lt,{className:"font-medium max-w-xs truncate",children:oe.situation}),o.jsx(Lt,{className:"max-w-xs truncate",children:oe.style}),o.jsx(Lt,{className:"max-w-[200px] truncate",title:G(oe.chat_id),style:{wordBreak:"keep-all"},children:o.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:G(oe.chat_id)})}),o.jsx(Lt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>U(oe),children:[o.jsx(Bm,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsx(me,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>F(oe),title:"查看详情",children:o.jsx(sa,{className:"h-4 w-4"})}),o.jsxs(me,{size:"sm",onClick:()=>_(oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},oe.id))})]})}),o.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(oe=>o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(ri,{checked:E.has(oe.id),onCheckedChange:()=>ne(oe.id),className:"mt-1"}),o.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),o.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:oe.situation,children:oe.situation})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),o.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:oe.style,children:oe.style})]})]})]}),o.jsxs("div",{className:"text-sm",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),o.jsx("p",{className:"text-sm truncate",title:G(oe.chat_id),style:{wordBreak:"keep-all"},children:G(oe.chat_id)})]}),o.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>U(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(Bm,{className:"h-3 w-3 mr-1"}),"编辑"]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>F(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:o.jsx(sa,{className:"h-3 w-3"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>_(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[o.jsx(sn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},oe.id))}),s>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(M0,{className:"h-4 w-4"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(a-1),disabled:a===1,children:[o.jsx(Iu,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:I,onChange:oe=>$(oe.target.value),onKeyDown:oe=>oe.key==="Enter"&&re(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),o.jsx(me,{variant:"outline",size:"sm",onClick:re,disabled:!I,className:"h-8",children:"跳转"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(a+1),disabled:a>=Math.ceil(s/c),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Bu,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:o.jsx(A0,{className:"h-4 w-4"})})]})]})]})]})}),o.jsx(gwe,{expression:g,open:y,onOpenChange:w,chatNameMap:P}),o.jsx(xwe,{open:N,onOpenChange:C,chatList:z,onSuccess:()=>{X(),R(),C(!1)}}),o.jsx(vwe,{expression:g,open:S,onOpenChange:k,chatList:z,onSuccess:()=>{X(),R(),k(!1)}}),o.jsx(jn,{open:!!T,onOpenChange:()=>_(null),children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除表达方式 "',T?.situation,'" 吗? 此操作不可撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>T&&te(T),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),o.jsx(ywe,{open:q,onOpenChange:L,onConfirm:ae,count:E.size})]})}function gwe({expression:t,open:e,onOpenChange:n,chatNameMap:r}){if(!t)return null;const s=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-",i=a=>r.get(a)||a;return o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"表达方式详情"}),o.jsx(ps,{children:"查看表达方式的完整信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(am,{label:"情境",value:t.situation}),o.jsx(am,{label:"风格",value:t.style}),o.jsx(am,{label:"聊天",value:i(t.chat_id)}),o.jsx(am,{icon:C3,label:"记录ID",value:t.id.toString(),mono:!0})]}),o.jsx("div",{className:"grid grid-cols-2 gap-4",children:o.jsx(am,{icon:Gd,label:"创建时间",value:s(t.create_date)})})]}),o.jsx(Ds,{children:o.jsx(me,{onClick:()=>n(!1),children:"关闭"})})]})})}function am({icon:t,label:e,value:n,mono:r=!1}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(de,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&o.jsx(t,{className:"h-3 w-3"}),e]}),o.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function xwe({open:t,onOpenChange:e,chatList:n,onSuccess:r}){const[s,i]=b.useState({situation:"",style:"",chat_id:""}),[a,l]=b.useState(!1),{toast:c}=Wr(),h=async()=>{if(!s.situation||!s.style||!s.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{l(!0),await uwe(s),c({title:"创建成功",description:"表达方式已创建"}),i({situation:"",style:"",chat_id:""}),r()}catch(f){c({title:"创建失败",description:f instanceof Error?f.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return o.jsx(zr,{open:t,onOpenChange:e,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"新增表达方式"}),o.jsx(ps,{children:"创建新的表达方式记录"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(de,{htmlFor:"situation",children:["情境 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(Pe,{id:"situation",value:s.situation,onChange:f=>i({...s,situation:f.target.value}),placeholder:"描述使用场景"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(de,{htmlFor:"style",children:["风格 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(Pe,{id:"style",value:s.style,onChange:f=>i({...s,style:f.target.value}),placeholder:"描述表达风格"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(de,{htmlFor:"chat_id",children:["聊天 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsxs(Dt,{value:s.chat_id,onValueChange:f=>i({...s,chat_id:f}),children:[o.jsx(Mt,{children:o.jsx(zt,{placeholder:"选择关联的聊天"})}),o.jsx(At,{children:n.map(f=>o.jsx(ze,{value:f.chat_id,children:o.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[f.chat_name,f.is_group&&o.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},f.chat_id))})]})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>e(!1),children:"取消"}),o.jsx(me,{onClick:h,disabled:a,children:a?"创建中...":"创建"})]})]})})}function vwe({expression:t,open:e,onOpenChange:n,chatList:r,onSuccess:s}){const[i,a]=b.useState({}),[l,c]=b.useState(!1),{toast:h}=Wr();b.useEffect(()=>{t&&a({situation:t.situation,style:t.style,chat_id:t.chat_id})},[t]);const f=async()=>{if(t)try{c(!0),await dwe(t.id,i),h({title:"保存成功",description:"表达方式已更新"}),s()}catch(m){h({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑表达方式"}),o.jsx(ps,{children:"修改表达方式的信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit_situation",children:"情境"}),o.jsx(Pe,{id:"edit_situation",value:i.situation||"",onChange:m=>a({...i,situation:m.target.value}),placeholder:"描述使用场景"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit_style",children:"风格"}),o.jsx(Pe,{id:"edit_style",value:i.style||"",onChange:m=>a({...i,style:m.target.value}),placeholder:"描述表达风格"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit_chat_id",children:"聊天"}),o.jsxs(Dt,{value:i.chat_id||"",onValueChange:m=>a({...i,chat_id:m}),children:[o.jsx(Mt,{children:o.jsx(zt,{placeholder:"选择关联的聊天"})}),o.jsx(At,{children:r.map(m=>o.jsx(ze,{value:m.chat_id,children:o.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[m.chat_name,m.is_group&&o.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},m.chat_id))})]})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(me,{onClick:f,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function ywe({open:t,onOpenChange:e,onConfirm:n,count:r}){return o.jsx(jn,{open:t,onOpenChange:e,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认批量删除"}),o.jsxs(fn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Jh="/api/webui/person";async function bwe(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 mt(`${Jh}/list?${e}`,{headers:Nt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function wwe(t){const e=await mt(`${Jh}/${t}`,{headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Swe(t,e){const n=await mt(`${Jh}/${t}`,{method:"PATCH",headers:Nt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function kwe(t){const e=await mt(`${Jh}/${t}`,{method:"DELETE",headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Owe(){const t=await mt(`${Jh}/stats/summary`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function jwe(t){const e=await mt(`${Jh}/batch/delete`,{method:"POST",headers:Nt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Nwe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(1),[c,h]=b.useState(20),[f,m]=b.useState(""),[g,x]=b.useState(void 0),[y,w]=b.useState(void 0),[S,k]=b.useState(null),[N,C]=b.useState(!1),[T,_]=b.useState(!1),[E,M]=b.useState(null),[q,L]=b.useState({total:0,known:0,unknown:0,platforms:{}}),[I,$]=b.useState(new Set),[V,ee]=b.useState(!1),[z,H]=b.useState(""),{toast:P}=Wr(),W=async()=>{try{r(!0);const re=await bwe({page:a,page_size:c,search:f||void 0,is_known:g,platform:y});e(re.data),i(re.total)}catch(re){P({title:"加载失败",description:re instanceof Error?re.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},J=async()=>{try{const re=await Owe();re?.data&&L(re.data)}catch(re){console.error("加载统计数据失败:",re)}};b.useEffect(()=>{W(),J()},[a,c,f,g,y]);const X=async re=>{try{const oe=await wwe(re.person_id);k(oe.data),C(!0)}catch(oe){P({title:"加载详情失败",description:oe instanceof Error?oe.message:"无法加载人物详情",variant:"destructive"})}},R=re=>{k(re),_(!0)},se=async re=>{try{await kwe(re.person_id),P({title:"删除成功",description:`已删除人物信息: ${re.person_name||re.nickname||re.user_id}`}),M(null),W(),J()}catch(oe){P({title:"删除失败",description:oe instanceof Error?oe.message:"无法删除人物信息",variant:"destructive"})}},G=b.useMemo(()=>Object.keys(q.platforms),[q.platforms]),F=re=>{const oe=new Set(I);oe.has(re)?oe.delete(re):oe.add(re),$(oe)},U=()=>{I.size===t.length&&t.length>0?$(new Set):$(new Set(t.map(re=>re.person_id)))},te=()=>{if(I.size===0){P({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ee(!0)},ne=async()=>{try{const re=await jwe(Array.from(I));P({title:"批量删除完成",description:re.message}),$(new Set),ee(!1),W(),J()}catch(re){P({title:"批量删除失败",description:re instanceof Error?re.message:"批量删除失败",variant:"destructive"})}},Y=()=>{const re=parseInt(z),oe=Math.ceil(s/c);re>=1&&re<=oe?(l(re),H("")):P({title:"无效的页码",description:`请输入1-${oe}之间的页码`,variant:"destructive"})},ae=re=>re?new Date(re*1e3).toLocaleString("zh-CN"):"-";return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsx("div",{className:"mb-4 sm:mb-6",children:o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[o.jsx(EK,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),o.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),o.jsx(kn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),o.jsx("div",{className:"text-2xl font-bold mt-1",children:q.total})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:q.known})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:q.unknown})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[o.jsxs("div",{className:"sm:col-span-2",children:[o.jsx(de,{htmlFor:"search",children:"搜索"}),o.jsxs("div",{className:"relative mt-1.5",children:[o.jsx(ii,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:f,onChange:re=>m(re.target.value),className:"pl-9"})]})]}),o.jsxs("div",{children:[o.jsx(de,{htmlFor:"filter-known",children:"认识状态"}),o.jsxs(Dt,{value:g===void 0?"all":g.toString(),onValueChange:re=>{x(re==="all"?void 0:re==="true"),l(1)},children:[o.jsx(Mt,{id:"filter-known",className:"mt-1.5",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部"}),o.jsx(ze,{value:"true",children:"已认识"}),o.jsx(ze,{value:"false",children:"未认识"})]})]})]}),o.jsxs("div",{children:[o.jsx(de,{htmlFor:"filter-platform",children:"平台"}),o.jsxs(Dt,{value:y||"all",onValueChange:re=>{w(re==="all"?void 0:re),l(1)},children:[o.jsx(Mt,{id:"filter-platform",className:"mt-1.5",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部平台"}),G.map(re=>o.jsxs(ze,{value:re,children:[re," (",q.platforms[re],")"]},re))]})]})]})]}),o.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:[o.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:I.size>0&&o.jsxs("span",{children:["已选择 ",I.size," 个人物"]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Dt,{value:c.toString(),onValueChange:re=>{h(parseInt(re)),l(1),$(new Set)},children:[o.jsx(Mt,{id:"page-size",className:"w-20",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"10",children:"10"}),o.jsx(ze,{value:"20",children:"20"}),o.jsx(ze,{value:"50",children:"50"}),o.jsx(ze,{value:"100",children:"100"})]})]}),I.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>$(new Set),children:"取消选择"}),o.jsxs(me,{variant:"destructive",size:"sm",onClick:te,children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card",children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(Qh,{children:[o.jsx(Hh,{children:o.jsxs(fs,{children:[o.jsx(en,{className:"w-12",children:o.jsx(ri,{checked:t.length>0&&I.size===t.length,onCheckedChange:U,"aria-label":"全选"})}),o.jsx(en,{children:"状态"}),o.jsx(en,{children:"名称"}),o.jsx(en,{children:"昵称"}),o.jsx(en,{children:"平台"}),o.jsx(en,{children:"用户ID"}),o.jsx(en,{children:"最后更新"}),o.jsx(en,{className:"text-right",children:"操作"})]})}),o.jsx(Vh,{children:n?o.jsx(fs,{children:o.jsx(Lt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?o.jsx(fs,{children:o.jsx(Lt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(re=>o.jsxs(fs,{children:[o.jsx(Lt,{children:o.jsx(ri,{checked:I.has(re.person_id),onCheckedChange:()=>F(re.person_id),"aria-label":`选择 ${re.person_name||re.nickname||re.user_id}`})}),o.jsx(Lt,{children:o.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",re.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:re.is_known?"已认识":"未认识"})}),o.jsx(Lt,{className:"font-medium",children:re.person_name||o.jsx("span",{className:"text-muted-foreground",children:"-"})}),o.jsx(Lt,{children:re.nickname||"-"}),o.jsx(Lt,{children:re.platform}),o.jsx(Lt,{className:"font-mono text-sm",children:re.user_id}),o.jsx(Lt,{className:"text-sm text-muted-foreground",children:ae(re.last_know)}),o.jsx(Lt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>X(re),children:[o.jsx(sa,{className:"h-4 w-4 mr-1"}),"详情"]}),o.jsxs(me,{variant:"default",size:"sm",onClick:()=>R(re),children:[o.jsx(Bm,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsxs(me,{size:"sm",onClick:()=>M(re),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},re.id))})]})}),o.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(re=>o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(ri,{checked:I.has(re.person_id),onCheckedChange:()=>F(re.person_id),className:"mt-1"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",re.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:re.is_known?"已认识":"未认识"}),o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:re.person_name||o.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),re.nickname&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",re.nickname]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),o.jsx("p",{className:"font-medium text-xs",children:re.platform})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),o.jsx("p",{className:"font-mono text-xs truncate",title:re.user_id,children:re.user_id})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),o.jsx("p",{className:"text-xs",children:ae(re.last_know)})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>X(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(sa,{className:"h-3 w-3 mr-1"}),"查看"]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>R(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(Bm,{className:"h-3 w-3 mr-1"}),"编辑"]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>M(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[o.jsx(sn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},re.id))}),s>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(M0,{className:"h-4 w-4"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(a-1),disabled:a===1,children:[o.jsx(Iu,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:z,onChange:re=>H(re.target.value),onKeyDown:re=>re.key==="Enter"&&Y(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),o.jsx(me,{variant:"outline",size:"sm",onClick:Y,disabled:!z,className:"h-8",children:"跳转"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(a+1),disabled:a>=Math.ceil(s/c),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Bu,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:o.jsx(A0,{className:"h-4 w-4"})})]})]})]})]})}),o.jsx(Cwe,{person:S,open:N,onOpenChange:C}),o.jsx(Twe,{person:S,open:T,onOpenChange:_,onSuccess:()=>{W(),J(),_(!1)}}),o.jsx(jn,{open:!!E,onOpenChange:()=>M(null),children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>E&&se(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),o.jsx(jn,{open:V,onOpenChange:ee,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认批量删除"}),o.jsxs(fn,{children:["确定要删除选中的 ",I.size," 个人物信息吗? 此操作不可撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:ne,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function Cwe({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"人物详情"}),o.jsxs(ps,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx($o,{icon:GD,label:"人物名称",value:t.person_name}),o.jsx($o,{icon:E0,label:"昵称",value:t.nickname}),o.jsx($o,{icon:C3,label:"用户ID",value:t.user_id,mono:!0}),o.jsx($o,{icon:C3,label:"人物ID",value:t.person_id,mono:!0}),o.jsx($o,{label:"平台",value:t.platform}),o.jsx($o,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(de,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),o.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(de,{className:"text-xs text-muted-foreground",children:"个人印象"}),o.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(de,{className:"text-xs text-muted-foreground",children:"群昵称"}),o.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>o.jsxs("div",{className:"text-sm flex items-center gap-2",children:[o.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),o.jsx("span",{children:"→"}),o.jsx("span",{children:s.group_nick_name})]},i))})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[o.jsx($o,{icon:Gd,label:"认识时间",value:r(t.know_times)}),o.jsx($o,{icon:Gd,label:"首次记录",value:r(t.know_since)}),o.jsx($o,{icon:Gd,label:"最后更新",value:r(t.last_know)})]})]}),o.jsx(Ds,{children:o.jsx(me,{onClick:()=>n(!1),children:"关闭"})})]})})}function $o({icon:t,label:e,value:n,mono:r=!1}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(de,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&o.jsx(t,{className:"h-3 w-3"}),e]}),o.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Twe({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState({}),[a,l]=b.useState(!1),{toast:c}=Wr();b.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{l(!0),await Swe(t.person_id,s),c({title:"保存成功",description:"人物信息已更新"}),r()}catch(f){c({title:"保存失败",description:f instanceof Error?f.message:"无法更新人物信息",variant:"destructive"})}finally{l(!1)}};return t?o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑人物信息"}),o.jsxs(ps,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"person_name",children:"人物名称"}),o.jsx(Pe,{id:"person_name",value:s.person_name||"",onChange:f=>i({...s,person_name:f.target.value}),placeholder:"为这个人设置一个名称"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"nickname",children:"昵称"}),o.jsx(Pe,{id:"nickname",value:s.nickname||"",onChange:f=>i({...s,nickname:f.target.value}),placeholder:"昵称"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"name_reason",children:"名称设定原因"}),o.jsx(nr,{id:"name_reason",value:s.name_reason||"",onChange:f=>i({...s,name_reason:f.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"memory_points",children:"个人印象"}),o.jsx(nr,{id:"memory_points",value:s.memory_points||"",onChange:f=>i({...s,memory_points:f.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),o.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[o.jsxs("div",{children:[o.jsx(de,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),o.jsx(Tt,{id:"is_known",checked:s.is_known,onCheckedChange:f=>i({...s,is_known:f})})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(me,{onClick:h,disabled:a,children:a?"保存中...":"保存"})]})]})}):null}function gs(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n<t.length;n++)(r=gs(t[n]))!==""&&(e+=(e&&" ")+r);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}const Ewe={},EM=t=>{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,c={setState:r,getState:s,getInitialState:()=>h,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Ewe?"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,c);return c},_we=t=>t?EM(t):EM,{useDebugValue:Mwe}=he,{useSyncExternalStoreWithSelector:Awe}=HX,Rwe=t=>t;function FQ(t,e=Rwe,n){const r=Awe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Mwe(r),r}const _M=(t,e)=>{const n=_we(t),r=(s,i=e)=>FQ(n,s,i);return Object.assign(r,n),r},Dwe=(t,e)=>t?_M(t,e):_M;function ts(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 zwe={value:()=>{}};function wy(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new p1(n)}function p1(t){this._=t}function Pwe(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=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}})}p1.prototype=wy.prototype={constructor:p1,on:function(t,e){var n=this._,r=Pwe(t+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(t=r[i]).type)&&(s=Lwe(n[s],t.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<a;)if(s=(t=r[i]).type)n[s]=MM(n[s],t.name,e);else if(e==null)for(s in n)n[s]=MM(n[s],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new p1(t)},call:function(t,e){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,s=i.length;r<s;++r)i[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],s=0,i=r.length;s<i;++s)r[s].value.apply(e,n)}};function Lwe(t,e){for(var n=0,r=t.length,s;n<r;++n)if((s=t[n]).name===e)return s.value}function MM(t,e,n){for(var r=0,s=t.length;r<s;++r)if(t[r].name===e){t[r]=zwe,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var dk="http://www.w3.org/1999/xhtml";const AM={svg:"http://www.w3.org/2000/svg",xhtml:dk,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Sy(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),AM.hasOwnProperty(e)?{space:AM[e],local:t}:t}function Iwe(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===dk&&e.documentElement.namespaceURI===dk?e.createElement(t):e.createElementNS(n,t)}}function Bwe(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function $Q(t){var e=Sy(t);return(e.local?Bwe:Iwe)(e)}function qwe(){}function aj(t){return t==null?qwe:function(){return this.querySelector(t)}}function Fwe(t){typeof t!="function"&&(t=aj(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],a=i.length,l=r[s]=new Array(a),c,h,f=0;f<a;++f)(c=i[f])&&(h=t.call(c,c.__data__,f,i))&&("__data__"in c&&(h.__data__=c.__data__),l[f]=h);return new Mi(r,this._parents)}function $we(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Qwe(){return[]}function QQ(t){return t==null?Qwe:function(){return this.querySelectorAll(t)}}function Hwe(t){return function(){return $we(t.apply(this,arguments))}}function Vwe(t){typeof t=="function"?t=Hwe(t):t=QQ(t);for(var e=this._groups,n=e.length,r=[],s=[],i=0;i<n;++i)for(var a=e[i],l=a.length,c,h=0;h<l;++h)(c=a[h])&&(r.push(t.call(c,c.__data__,h,a)),s.push(c));return new Mi(r,s)}function HQ(t){return function(){return this.matches(t)}}function VQ(t){return function(e){return e.matches(t)}}var Uwe=Array.prototype.find;function Wwe(t){return function(){return Uwe.call(this.children,t)}}function Gwe(){return this.firstElementChild}function Xwe(t){return this.select(t==null?Gwe:Wwe(typeof t=="function"?t:VQ(t)))}var Ywe=Array.prototype.filter;function Kwe(){return Array.from(this.children)}function Zwe(t){return function(){return Ywe.call(this.children,t)}}function Jwe(t){return this.selectAll(t==null?Kwe:Zwe(typeof t=="function"?t:VQ(t)))}function e4e(t){typeof t!="function"&&(t=HQ(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],a=i.length,l=r[s]=[],c,h=0;h<a;++h)(c=i[h])&&t.call(c,c.__data__,h,i)&&l.push(c);return new Mi(r,this._parents)}function UQ(t){return new Array(t.length)}function t4e(){return new Mi(this._enter||this._groups.map(UQ),this._parents)}function uv(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}uv.prototype={constructor:uv,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function n4e(t){return function(){return t}}function r4e(t,e,n,r,s,i){for(var a=0,l,c=e.length,h=i.length;a<h;++a)(l=e[a])?(l.__data__=i[a],r[a]=l):n[a]=new uv(t,i[a]);for(;a<c;++a)(l=e[a])&&(s[a]=l)}function s4e(t,e,n,r,s,i,a){var l,c,h=new Map,f=e.length,m=i.length,g=new Array(f),x;for(l=0;l<f;++l)(c=e[l])&&(g[l]=x=a.call(c,c.__data__,l,e)+"",h.has(x)?s[l]=c:h.set(x,c));for(l=0;l<m;++l)x=a.call(t,i[l],l,i)+"",(c=h.get(x))?(r[l]=c,c.__data__=i[l],h.delete(x)):n[l]=new uv(t,i[l]);for(l=0;l<f;++l)(c=e[l])&&h.get(g[l])===c&&(s[l]=c)}function i4e(t){return t.__data__}function a4e(t,e){if(!arguments.length)return Array.from(this,i4e);var n=e?s4e:r4e,r=this._parents,s=this._groups;typeof t!="function"&&(t=n4e(t));for(var i=s.length,a=new Array(i),l=new Array(i),c=new Array(i),h=0;h<i;++h){var f=r[h],m=s[h],g=m.length,x=o4e(t.call(f,f&&f.__data__,h,r)),y=x.length,w=l[h]=new Array(y),S=a[h]=new Array(y),k=c[h]=new Array(g);n(f,m,w,S,k,x,e);for(var N=0,C=0,T,_;N<y;++N)if(T=w[N]){for(N>=C&&(C=N+1);!(_=S[C])&&++C<y;);T._next=_||null}}return a=new Mi(a,r),a._enter=l,a._exit=c,a}function o4e(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function l4e(){return new Mi(this._exit||this._groups.map(UQ),this._parents)}function c4e(t,e,n){var r=this.enter(),s=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(s=e(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function u4e(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,s=n.length,i=r.length,a=Math.min(s,i),l=new Array(s),c=0;c<a;++c)for(var h=n[c],f=r[c],m=h.length,g=l[c]=new Array(m),x,y=0;y<m;++y)(x=h[y]||f[y])&&(g[y]=x);for(;c<s;++c)l[c]=n[c];return new Mi(l,this._parents)}function d4e(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],s=r.length-1,i=r[s],a;--s>=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function h4e(t){t||(t=f4e);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;i<r;++i){for(var a=n[i],l=a.length,c=s[i]=new Array(l),h,f=0;f<l;++f)(h=a[f])&&(c[f]=h);c.sort(e)}return new Mi(s,this._parents).order()}function f4e(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function m4e(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function p4e(){return Array.from(this)}function g4e(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],s=0,i=r.length;s<i;++s){var a=r[s];if(a)return a}return null}function x4e(){let t=0;for(const e of this)++t;return t}function v4e(){return!this.node()}function y4e(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var s=e[n],i=0,a=s.length,l;i<a;++i)(l=s[i])&&t.call(l,l.__data__,i,s);return this}function b4e(t){return function(){this.removeAttribute(t)}}function w4e(t){return function(){this.removeAttributeNS(t.space,t.local)}}function S4e(t,e){return function(){this.setAttribute(t,e)}}function k4e(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function O4e(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function j4e(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function N4e(t,e){var n=Sy(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?w4e:b4e:typeof e=="function"?n.local?j4e:O4e:n.local?k4e:S4e)(n,e))}function WQ(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function C4e(t){return function(){this.style.removeProperty(t)}}function T4e(t,e,n){return function(){this.style.setProperty(t,e,n)}}function E4e(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function _4e(t,e,n){return arguments.length>1?this.each((e==null?C4e:typeof e=="function"?E4e:T4e)(t,e,n??"")):Th(this.node(),t)}function Th(t,e){return t.style.getPropertyValue(e)||WQ(t).getComputedStyle(t,null).getPropertyValue(e)}function M4e(t){return function(){delete this[t]}}function A4e(t,e){return function(){this[t]=e}}function R4e(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function D4e(t,e){return arguments.length>1?this.each((e==null?M4e:typeof e=="function"?R4e:A4e)(t,e)):this.node()[t]}function GQ(t){return t.trim().split(/^|\s+/)}function oj(t){return t.classList||new XQ(t)}function XQ(t){this._node=t,this._names=GQ(t.getAttribute("class")||"")}XQ.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 YQ(t,e){for(var n=oj(t),r=-1,s=e.length;++r<s;)n.add(e[r])}function KQ(t,e){for(var n=oj(t),r=-1,s=e.length;++r<s;)n.remove(e[r])}function z4e(t){return function(){YQ(this,t)}}function P4e(t){return function(){KQ(this,t)}}function L4e(t,e){return function(){(e.apply(this,arguments)?YQ:KQ)(this,t)}}function I4e(t,e){var n=GQ(t+"");if(arguments.length<2){for(var r=oj(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof e=="function"?L4e:e?z4e:P4e)(n,e))}function B4e(){this.textContent=""}function q4e(t){return function(){this.textContent=t}}function F4e(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function $4e(t){return arguments.length?this.each(t==null?B4e:(typeof t=="function"?F4e:q4e)(t)):this.node().textContent}function Q4e(){this.innerHTML=""}function H4e(t){return function(){this.innerHTML=t}}function V4e(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function U4e(t){return arguments.length?this.each(t==null?Q4e:(typeof t=="function"?V4e:H4e)(t)):this.node().innerHTML}function W4e(){this.nextSibling&&this.parentNode.appendChild(this)}function G4e(){return this.each(W4e)}function X4e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Y4e(){return this.each(X4e)}function K4e(t){var e=typeof t=="function"?t:$Q(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Z4e(){return null}function J4e(t,e){var n=typeof t=="function"?t:$Q(t),r=e==null?Z4e:typeof e=="function"?e:aj(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function e5e(){var t=this.parentNode;t&&t.removeChild(this)}function t5e(){return this.each(e5e)}function n5e(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function r5e(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function s5e(t){return this.select(t?r5e:n5e)}function i5e(t){return arguments.length?this.property("__data__",t):this.node().__data__}function a5e(t){return function(e){t.call(this,e,this.__data__)}}function o5e(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function l5e(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,i;n<s;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++r]=i;++r?e.length=r:delete this.__on}}}function c5e(t,e,n){return function(){var r=this.__on,s,i=a5e(e);if(r){for(var a=0,l=r.length;a<l;++a)if((s=r[a]).type===t.type&&s.name===t.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=e;return}}this.addEventListener(t.type,i,n),s={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(s):this.__on=[s]}}function u5e(t,e,n){var r=o5e(t+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,h=l.length,f;c<h;++c)for(s=0,f=l[c];s<i;++s)if((a=r[s]).type===f.type&&a.name===f.name)return f.value}return}for(l=e?c5e:l5e,s=0;s<i;++s)this.each(l(r[s],e,n));return this}function ZQ(t,e,n){var r=WQ(t),s=r.CustomEvent;typeof s=="function"?s=new s(e,n):(s=r.document.createEvent("Event"),n?(s.initEvent(e,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(e,!1,!1)),t.dispatchEvent(s)}function d5e(t,e){return function(){return ZQ(this,t,e)}}function h5e(t,e){return function(){return ZQ(this,t,e.apply(this,arguments))}}function f5e(t,e){return this.each((typeof e=="function"?h5e:d5e)(t,e))}function*m5e(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],s=0,i=r.length,a;s<i;++s)(a=r[s])&&(yield a)}var JQ=[null];function Mi(t,e){this._groups=t,this._parents=e}function up(){return new Mi([[document.documentElement]],JQ)}function p5e(){return this}Mi.prototype=up.prototype={constructor:Mi,select:Fwe,selectAll:Vwe,selectChild:Xwe,selectChildren:Jwe,filter:e4e,data:a4e,enter:t4e,exit:l4e,join:c4e,merge:u4e,selection:p5e,order:d4e,sort:h4e,call:m4e,nodes:p4e,node:g4e,size:x4e,empty:v4e,each:y4e,attr:N4e,style:_4e,property:D4e,classed:I4e,text:$4e,html:U4e,raise:G4e,lower:Y4e,append:K4e,insert:J4e,remove:t5e,clone:s5e,datum:i5e,on:u5e,dispatch:f5e,[Symbol.iterator]:m5e};function Gi(t){return typeof t=="string"?new Mi([[document.querySelector(t)]],[document.documentElement]):new Mi([[t]],JQ)}function g5e(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ya(t,e){if(t=g5e(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}}return[t.pageX,t.pageY]}const x5e={passive:!1},v0={capture:!0,passive:!1};function C4(t){t.stopImmediatePropagation()}function lh(t){t.preventDefault(),t.stopImmediatePropagation()}function eH(t){var e=t.document.documentElement,n=Gi(t).on("dragstart.drag",lh,v0);"onselectstart"in e?n.on("selectstart.drag",lh,v0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function tH(t,e){var n=t.document.documentElement,r=Gi(t).on("dragstart.drag",null);e&&(r.on("click.drag",lh,v0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Rx=t=>()=>t;function hk(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,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:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:f}})}hk.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function v5e(t){return!t.ctrlKey&&!t.button}function y5e(){return this.parentNode}function b5e(t,e){return e??{x:t.x,y:t.y}}function w5e(){return navigator.maxTouchPoints||"ontouchstart"in this}function S5e(){var t=v5e,e=y5e,n=b5e,r=w5e,s={},i=wy("start","drag","end"),a=0,l,c,h,f,m=0;function g(T){T.on("mousedown.drag",x).filter(r).on("touchstart.drag",S).on("touchmove.drag",k,x5e).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(T,_){if(!(f||!t.call(this,T,_))){var E=C(this,e.call(this,T,_),T,_,"mouse");E&&(Gi(T.view).on("mousemove.drag",y,v0).on("mouseup.drag",w,v0),eH(T.view),C4(T),h=!1,l=T.clientX,c=T.clientY,E("start",T))}}function y(T){if(lh(T),!h){var _=T.clientX-l,E=T.clientY-c;h=_*_+E*E>m}s.mouse("drag",T)}function w(T){Gi(T.view).on("mousemove.drag mouseup.drag",null),tH(T.view,h),lh(T),s.mouse("end",T)}function S(T,_){if(t.call(this,T,_)){var E=T.changedTouches,M=e.call(this,T,_),q=E.length,L,I;for(L=0;L<q;++L)(I=C(this,M,T,_,E[L].identifier,E[L]))&&(C4(T),I("start",T,E[L]))}}function k(T){var _=T.changedTouches,E=_.length,M,q;for(M=0;M<E;++M)(q=s[_[M].identifier])&&(lh(T),q("drag",T,_[M]))}function N(T){var _=T.changedTouches,E=_.length,M,q;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),M=0;M<E;++M)(q=s[_[M].identifier])&&(C4(T),q("end",T,_[M]))}function C(T,_,E,M,q,L){var I=i.copy(),$=ya(L||E,_),V,ee,z;if((z=n.call(T,new hk("beforestart",{sourceEvent:E,target:g,identifier:q,active:a,x:$[0],y:$[1],dx:0,dy:0,dispatch:I}),M))!=null)return V=z.x-$[0]||0,ee=z.y-$[1]||0,function H(P,W,J){var X=$,R;switch(P){case"start":s[q]=H,R=a++;break;case"end":delete s[q],--a;case"drag":$=ya(J||W,_),R=a;break}I.call(P,T,new hk(P,{sourceEvent:W,subject:z,target:g,identifier:q,active:R,x:$[0]+V,y:$[1]+ee,dx:$[0]-X[0],dy:$[1]-X[1],dispatch:I}),M)}}return g.filter=function(T){return arguments.length?(t=typeof T=="function"?T:Rx(!!T),g):t},g.container=function(T){return arguments.length?(e=typeof T=="function"?T:Rx(T),g):e},g.subject=function(T){return arguments.length?(n=typeof T=="function"?T:Rx(T),g):n},g.touchable=function(T){return arguments.length?(r=typeof T=="function"?T:Rx(!!T),g):r},g.on=function(){var T=i.on.apply(i,arguments);return T===i?g:T},g.clickDistance=function(T){return arguments.length?(m=(T=+T)*T,g):Math.sqrt(m)},g}var Eh=0,xm=0,om=0,nH=1e3,dv,vm,hv=0,zu=0,ky=0,y0=typeof performance=="object"&&performance.now?performance:Date,rH=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function lj(){return zu||(rH(k5e),zu=y0.now()+ky)}function k5e(){zu=0}function fv(){this._call=this._time=this._next=null}fv.prototype=sH.prototype={constructor:fv,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?lj():+n)+(e==null?0:+e),!this._next&&vm!==this&&(vm?vm._next=this:dv=this,vm=this),this._call=t,this._time=n,fk()},stop:function(){this._call&&(this._call=null,this._time=1/0,fk())}};function sH(t,e,n){var r=new fv;return r.restart(t,e,n),r}function O5e(){lj(),++Eh;for(var t=dv,e;t;)(e=zu-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Eh}function RM(){zu=(hv=y0.now())+ky,Eh=xm=0;try{O5e()}finally{Eh=0,N5e(),zu=0}}function j5e(){var t=y0.now(),e=t-hv;e>nH&&(ky-=e,hv=t)}function N5e(){for(var t,e=dv,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:dv=n);vm=t,fk(r)}function fk(t){if(!Eh){xm&&(xm=clearTimeout(xm));var e=t-zu;e>24?(t<1/0&&(xm=setTimeout(RM,t-y0.now()-ky)),om&&(om=clearInterval(om))):(om||(hv=y0.now(),om=setInterval(j5e,nH)),Eh=1,rH(RM))}}function DM(t,e,n){var r=new fv;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var C5e=wy("start","end","cancel","interrupt"),T5e=[],iH=0,zM=1,mk=2,g1=3,PM=4,pk=5,x1=6;function Oy(t,e,n,r,s,i){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;E5e(t,n,{name:e,index:r,group:s,on:C5e,tween:T5e,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:iH})}function cj(t,e){var n=Aa(t,e);if(n.state>iH)throw new Error("too late; already scheduled");return n}function go(t,e){var n=Aa(t,e);if(n.state>g1)throw new Error("too late; already running");return n}function Aa(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function E5e(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=sH(i,0,n.time);function i(h){n.state=zM,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!==zM)return c();for(f in r)if(x=r[f],x.name===n.name){if(x.state===g1)return DM(a);x.state===PM?(x.state=x1,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete r[f]):+f<e&&(x.state=x1,x.timer.stop(),x.on.call("cancel",t,t.__data__,x.index,x.group),delete r[f])}if(DM(function(){n.state===g1&&(n.state=PM,n.timer.restart(l,n.delay,n.time),l(h))}),n.state=mk,n.on.call("start",t,t.__data__,n.index,n.group),n.state===mk){for(n.state=g1,s=new Array(g=n.tween.length),f=0,m=-1;f<g;++f)(x=n.tween[f].value.call(t,t.__data__,n.index,n.group))&&(s[++m]=x);s.length=m+1}}function l(h){for(var f=h<n.duration?n.ease.call(null,h/n.duration):(n.timer.restart(c),n.state=pk,1),m=-1,g=s.length;++m<g;)s[m].call(t,f);n.state===pk&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=x1,n.timer.stop(),delete r[e];for(var h in r)return;delete t.__transition}}function v1(t,e){var n=t.__transition,r,s,i=!0,a;if(n){e=e==null?null:e+"";for(a in n){if((r=n[a]).name!==e){i=!1;continue}s=r.state>mk&&r.state<pk,r.state=x1,r.timer.stop(),r.on.call(s?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[a]}i&&delete t.__transition}}function _5e(t){return this.each(function(){v1(this,t)})}function M5e(t,e){var n,r;return function(){var s=go(this,t),i=s.tween;if(i!==n){r=n=i;for(var a=0,l=r.length;a<l;++a)if(r[a].name===e){r=r.slice(),r.splice(a,1);break}}s.tween=r}}function A5e(t,e,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=go(this,t),a=i.tween;if(a!==r){s=(r=a).slice();for(var l={name:e,value:n},c=0,h=s.length;c<h;++c)if(s[c].name===e){s[c]=l;break}c===h&&s.push(l)}i.tween=s}}function R5e(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=Aa(this.node(),n).tween,s=0,i=r.length,a;s<i;++s)if((a=r[s]).name===t)return a.value;return null}return this.each((e==null?M5e:A5e)(n,t,e))}function uj(t,e,n){var r=t._id;return t.each(function(){var s=go(this,r);(s.value||(s.value={}))[e]=n.apply(this,arguments)}),function(s){return Aa(s,r).value[e]}}function aH(t,e){var n;return(typeof e=="number"?cY:e instanceof TC?CC:(n=TC(e))?(e=n,CC):uY)(t,e)}function D5e(t){return function(){this.removeAttribute(t)}}function z5e(t){return function(){this.removeAttributeNS(t.space,t.local)}}function P5e(t,e,n){var r,s=n+"",i;return function(){var a=this.getAttribute(t);return a===s?null:a===r?i:i=e(r=a,n)}}function L5e(t,e,n){var r,s=n+"",i;return function(){var a=this.getAttributeNS(t.space,t.local);return a===s?null:a===r?i:i=e(r=a,n)}}function I5e(t,e,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(t):(a=this.getAttribute(t),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=e(r=a,l)))}}function B5e(t,e,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=e(r=a,l)))}}function q5e(t,e){var n=Sy(t),r=n==="transform"?dY:aH;return this.attrTween(t,typeof e=="function"?(n.local?B5e:I5e)(n,r,uj(this,"attr."+t,e)):e==null?(n.local?z5e:D5e)(n):(n.local?L5e:P5e)(n,r,e))}function F5e(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function $5e(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Q5e(t,e){var n,r;function s(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&$5e(t,i)),n}return s._value=e,s}function H5e(t,e){var n,r;function s(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&F5e(t,i)),n}return s._value=e,s}function V5e(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Sy(t);return this.tween(n,(r.local?Q5e:H5e)(r,e))}function U5e(t,e){return function(){cj(this,t).delay=+e.apply(this,arguments)}}function W5e(t,e){return e=+e,function(){cj(this,t).delay=e}}function G5e(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?U5e:W5e)(e,t)):Aa(this.node(),e).delay}function X5e(t,e){return function(){go(this,t).duration=+e.apply(this,arguments)}}function Y5e(t,e){return e=+e,function(){go(this,t).duration=e}}function K5e(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?X5e:Y5e)(e,t)):Aa(this.node(),e).duration}function Z5e(t,e){if(typeof e!="function")throw new Error;return function(){go(this,t).ease=e}}function J5e(t){var e=this._id;return arguments.length?this.each(Z5e(e,t)):Aa(this.node(),e).ease}function e3e(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;go(this,t).ease=n}}function t3e(t){if(typeof t!="function")throw new Error;return this.each(e3e(this._id,t))}function n3e(t){typeof t!="function"&&(t=HQ(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],a=i.length,l=r[s]=[],c,h=0;h<a;++h)(c=i[h])&&t.call(c,c.__data__,h,i)&&l.push(c);return new xl(r,this._parents,this._name,this._id)}function r3e(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,s=n.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=e[l],h=n[l],f=c.length,m=a[l]=new Array(f),g,x=0;x<f;++x)(g=c[x]||h[x])&&(m[x]=g);for(;l<r;++l)a[l]=e[l];return new xl(a,this._parents,this._name,this._id)}function s3e(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function i3e(t,e,n){var r,s,i=s3e(e)?cj:go;return function(){var a=i(this,t),l=a.on;l!==r&&(s=(r=l).copy()).on(e,n),a.on=s}}function a3e(t,e){var n=this._id;return arguments.length<2?Aa(this.node(),n).on.on(t):this.each(i3e(n,t,e))}function o3e(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function l3e(){return this.on("end.remove",o3e(this._id))}function c3e(t){var e=this._name,n=this._id;typeof t!="function"&&(t=aj(t));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a<s;++a)for(var l=r[a],c=l.length,h=i[a]=new Array(c),f,m,g=0;g<c;++g)(f=l[g])&&(m=t.call(f,f.__data__,g,l))&&("__data__"in f&&(m.__data__=f.__data__),h[g]=m,Oy(h[g],e,n,g,h,Aa(f,n)));return new xl(i,this._parents,e,n)}function u3e(t){var e=this._name,n=this._id;typeof t!="function"&&(t=QQ(t));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var c=r[l],h=c.length,f,m=0;m<h;++m)if(f=c[m]){for(var g=t.call(f,f.__data__,m,c),x,y=Aa(f,n),w=0,S=g.length;w<S;++w)(x=g[w])&&Oy(x,e,n,w,g,y);i.push(g),a.push(f)}return new xl(i,a,e,n)}var d3e=up.prototype.constructor;function h3e(){return new d3e(this._groups,this._parents)}function f3e(t,e){var n,r,s;return function(){var i=Th(this,t),a=(this.style.removeProperty(t),Th(this,t));return i===a?null:i===n&&a===r?s:s=e(n=i,r=a)}}function oH(t){return function(){this.style.removeProperty(t)}}function m3e(t,e,n){var r,s=n+"",i;return function(){var a=Th(this,t);return a===s?null:a===r?i:i=e(r=a,n)}}function p3e(t,e,n){var r,s,i;return function(){var a=Th(this,t),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(t),Th(this,t))),a===c?null:a===r&&c===s?i:(s=c,i=e(r=a,l))}}function g3e(t,e){var n,r,s,i="style."+e,a="end."+i,l;return function(){var c=go(this,t),h=c.on,f=c.value[i]==null?l||(l=oH(e)):void 0;(h!==n||s!==f)&&(r=(n=h).copy()).on(a,s=f),c.on=r}}function x3e(t,e,n){var r=(t+="")=="transform"?hY:aH;return e==null?this.styleTween(t,f3e(t,r)).on("end.style."+t,oH(t)):typeof e=="function"?this.styleTween(t,p3e(t,r,uj(this,"style."+t,e))).each(g3e(this._id,t)):this.styleTween(t,m3e(t,r,e),n).on("end.style."+t,null)}function v3e(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function y3e(t,e,n){var r,s;function i(){var a=e.apply(this,arguments);return a!==s&&(r=(s=a)&&v3e(t,a,n)),r}return i._value=e,i}function b3e(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,y3e(t,e,n??""))}function w3e(t){return function(){this.textContent=t}}function S3e(t){return function(){var e=t(this);this.textContent=e??""}}function k3e(t){return this.tween("text",typeof t=="function"?S3e(uj(this,"text",t)):w3e(t==null?"":t+""))}function O3e(t){return function(e){this.textContent=t.call(this,e)}}function j3e(t){var e,n;function r(){var s=t.apply(this,arguments);return s!==n&&(e=(n=s)&&O3e(s)),e}return r._value=t,r}function N3e(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,j3e(t))}function C3e(){for(var t=this._name,e=this._id,n=lH(),r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,h=0;h<l;++h)if(c=a[h]){var f=Aa(c,e);Oy(c,t,n,h,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new xl(r,this._parents,t,n)}function T3e(){var t,e,n=this,r=n._id,s=n.size();return new Promise(function(i,a){var l={value:a},c={value:function(){--s===0&&i()}};n.each(function(){var h=go(this,r),f=h.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(c)),h.on=e}),s===0&&i()})}var E3e=0;function xl(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function lH(){return++E3e}var Qo=up.prototype;xl.prototype={constructor:xl,select:c3e,selectAll:u3e,selectChild:Qo.selectChild,selectChildren:Qo.selectChildren,filter:n3e,merge:r3e,selection:h3e,transition:C3e,call:Qo.call,nodes:Qo.nodes,node:Qo.node,size:Qo.size,empty:Qo.empty,each:Qo.each,on:a3e,attr:q5e,attrTween:V5e,style:x3e,styleTween:b3e,text:k3e,textTween:N3e,remove:l3e,tween:R5e,delay:G5e,duration:K5e,ease:J5e,easeVarying:t3e,end:T3e,[Symbol.iterator]:Qo[Symbol.iterator]};function _3e(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var M3e={time:null,delay:0,duration:250,ease:_3e};function A3e(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function R3e(t){var e,n;t instanceof xl?(e=t._id,t=t._name):(e=lH(),(n=M3e).time=lj(),t=t==null?null:t+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,h=0;h<l;++h)(c=a[h])&&Oy(c,t,e,h,a,n||A3e(c,e));return new xl(r,this._parents,t,e)}up.prototype.interrupt=_5e;up.prototype.transition=R3e;const Dx=t=>()=>t;function D3e(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 Zo(t,e,n){this.k=t,this.x=e,this.y=n}Zo.prototype={constructor:Zo,scale:function(t){return t===1?this:new Zo(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Zo(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 ol=new Zo(1,0,0);Zo.prototype;function T4(t){t.stopImmediatePropagation()}function lm(t){t.preventDefault(),t.stopImmediatePropagation()}function z3e(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function P3e(){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 LM(){return this.__zoom||ol}function L3e(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function I3e(){return navigator.maxTouchPoints||"ontouchstart"in this}function B3e(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 cH(){var t=z3e,e=P3e,n=B3e,r=L3e,s=I3e,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=fY,h=wy("start","zoom","end"),f,m,g,x=500,y=150,w=0,S=10;function k(z){z.property("__zoom",LM).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",$).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(z,H,P,W){var J=z.selection?z.selection():z;J.property("__zoom",LM),z!==J?_(z,H,P,W):J.interrupt().each(function(){E(this,arguments).event(W).start().zoom(null,typeof H=="function"?H.apply(this,arguments):H).end()})},k.scaleBy=function(z,H,P,W){k.scaleTo(z,function(){var J=this.__zoom.k,X=typeof H=="function"?H.apply(this,arguments):H;return J*X},P,W)},k.scaleTo=function(z,H,P,W){k.transform(z,function(){var J=e.apply(this,arguments),X=this.__zoom,R=P==null?T(J):typeof P=="function"?P.apply(this,arguments):P,se=X.invert(R),G=typeof H=="function"?H.apply(this,arguments):H;return n(C(N(X,G),R,se),J,a)},P,W)},k.translateBy=function(z,H,P,W){k.transform(z,function(){return n(this.__zoom.translate(typeof H=="function"?H.apply(this,arguments):H,typeof P=="function"?P.apply(this,arguments):P),e.apply(this,arguments),a)},null,W)},k.translateTo=function(z,H,P,W,J){k.transform(z,function(){var X=e.apply(this,arguments),R=this.__zoom,se=W==null?T(X):typeof W=="function"?W.apply(this,arguments):W;return n(ol.translate(se[0],se[1]).scale(R.k).translate(typeof H=="function"?-H.apply(this,arguments):-H,typeof P=="function"?-P.apply(this,arguments):-P),X,a)},W,J)};function N(z,H){return H=Math.max(i[0],Math.min(i[1],H)),H===z.k?z:new Zo(H,z.x,z.y)}function C(z,H,P){var W=H[0]-P[0]*z.k,J=H[1]-P[1]*z.k;return W===z.x&&J===z.y?z:new Zo(z.k,W,J)}function T(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function _(z,H,P,W){z.on("start.zoom",function(){E(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(W).end()}).tween("zoom",function(){var J=this,X=arguments,R=E(J,X).event(W),se=e.apply(J,X),G=P==null?T(se):typeof P=="function"?P.apply(J,X):P,F=Math.max(se[1][0]-se[0][0],se[1][1]-se[0][1]),U=J.__zoom,te=typeof H=="function"?H.apply(J,X):H,ne=c(U.invert(G).concat(F/U.k),te.invert(G).concat(F/te.k));return function(Y){if(Y===1)Y=te;else{var ae=ne(Y),re=F/ae[2];Y=new Zo(re,G[0]-ae[0]*re,G[1]-ae[1]*re)}R.zoom(null,Y)}})}function E(z,H,P){return!P&&z.__zooming||new M(z,H)}function M(z,H){this.that=z,this.args=H,this.active=0,this.sourceEvent=null,this.extent=e.apply(z,H),this.taps=0}M.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,H){return this.mouse&&z!=="mouse"&&(this.mouse[1]=H.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=H.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=H.invert(this.touch1[0])),this.that.__zoom=H,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var H=Gi(this.that).datum();h.call(z,this.that,new D3e(z,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:h}),H)}};function q(z,...H){if(!t.apply(this,arguments))return;var P=E(this,H).event(z),W=this.__zoom,J=Math.max(i[0],Math.min(i[1],W.k*Math.pow(2,r.apply(this,arguments)))),X=ya(z);if(P.wheel)(P.mouse[0][0]!==X[0]||P.mouse[0][1]!==X[1])&&(P.mouse[1]=W.invert(P.mouse[0]=X)),clearTimeout(P.wheel);else{if(W.k===J)return;P.mouse=[X,W.invert(X)],v1(this),P.start()}lm(z),P.wheel=setTimeout(R,y),P.zoom("mouse",n(C(N(W,J),P.mouse[0],P.mouse[1]),P.extent,a));function R(){P.wheel=null,P.end()}}function L(z,...H){if(g||!t.apply(this,arguments))return;var P=z.currentTarget,W=E(this,H,!0).event(z),J=Gi(z.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",F,!0),X=ya(z,P),R=z.clientX,se=z.clientY;eH(z.view),T4(z),W.mouse=[X,this.__zoom.invert(X)],v1(this),W.start();function G(U){if(lm(U),!W.moved){var te=U.clientX-R,ne=U.clientY-se;W.moved=te*te+ne*ne>w}W.event(U).zoom("mouse",n(C(W.that.__zoom,W.mouse[0]=ya(U,P),W.mouse[1]),W.extent,a))}function F(U){J.on("mousemove.zoom mouseup.zoom",null),tH(U.view,W.moved),lm(U),W.event(U).end()}}function I(z,...H){if(t.apply(this,arguments)){var P=this.__zoom,W=ya(z.changedTouches?z.changedTouches[0]:z,this),J=P.invert(W),X=P.k*(z.shiftKey?.5:2),R=n(C(N(P,X),W,J),e.apply(this,H),a);lm(z),l>0?Gi(this).transition().duration(l).call(_,R,W,z):Gi(this).call(k.transform,R,W,z)}}function $(z,...H){if(t.apply(this,arguments)){var P=z.touches,W=P.length,J=E(this,H,z.changedTouches.length===W).event(z),X,R,se,G;for(T4(z),R=0;R<W;++R)se=P[R],G=ya(se,this),G=[G,this.__zoom.invert(G),se.identifier],J.touch0?!J.touch1&&J.touch0[2]!==G[2]&&(J.touch1=G,J.taps=0):(J.touch0=G,X=!0,J.taps=1+!!f);f&&(f=clearTimeout(f)),X&&(J.taps<2&&(m=G[0],f=setTimeout(function(){f=null},x)),v1(this),J.start())}}function V(z,...H){if(this.__zooming){var P=E(this,H).event(z),W=z.changedTouches,J=W.length,X,R,se,G;for(lm(z),X=0;X<J;++X)R=W[X],se=ya(R,this),P.touch0&&P.touch0[2]===R.identifier?P.touch0[0]=se:P.touch1&&P.touch1[2]===R.identifier&&(P.touch1[0]=se);if(R=P.that.__zoom,P.touch1){var F=P.touch0[0],U=P.touch0[1],te=P.touch1[0],ne=P.touch1[1],Y=(Y=te[0]-F[0])*Y+(Y=te[1]-F[1])*Y,ae=(ae=ne[0]-U[0])*ae+(ae=ne[1]-U[1])*ae;R=N(R,Math.sqrt(Y/ae)),se=[(F[0]+te[0])/2,(F[1]+te[1])/2],G=[(U[0]+ne[0])/2,(U[1]+ne[1])/2]}else if(P.touch0)se=P.touch0[0],G=P.touch0[1];else return;P.zoom("touch",n(C(R,se,G),P.extent,a))}}function ee(z,...H){if(this.__zooming){var P=E(this,H).event(z),W=z.changedTouches,J=W.length,X,R;for(T4(z),g&&clearTimeout(g),g=setTimeout(function(){g=null},x),X=0;X<J;++X)R=W[X],P.touch0&&P.touch0[2]===R.identifier?delete P.touch0:P.touch1&&P.touch1[2]===R.identifier&&delete P.touch1;if(P.touch1&&!P.touch0&&(P.touch0=P.touch1,delete P.touch1),P.touch0)P.touch0[1]=this.__zoom.invert(P.touch0[0]);else if(P.end(),P.taps===2&&(R=ya(R,this),Math.hypot(m[0]-R[0],m[1]-R[1])<S)){var se=Gi(this).on("dblclick.zoom");se&&se.apply(this,arguments)}}}return k.wheelDelta=function(z){return arguments.length?(r=typeof z=="function"?z:Dx(+z),k):r},k.filter=function(z){return arguments.length?(t=typeof z=="function"?z:Dx(!!z),k):t},k.touchable=function(z){return arguments.length?(s=typeof z=="function"?z:Dx(!!z),k):s},k.extent=function(z){return arguments.length?(e=typeof z=="function"?z:Dx([[+z[0][0],+z[0][1]],[+z[1][0],+z[1][1]]]),k):e},k.scaleExtent=function(z){return arguments.length?(i[0]=+z[0],i[1]=+z[1],k):[i[0],i[1]]},k.translateExtent=function(z){return arguments.length?(a[0][0]=+z[0][0],a[1][0]=+z[1][0],a[0][1]=+z[0][1],a[1][1]=+z[1][1],k):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},k.constrain=function(z){return arguments.length?(n=z,k):n},k.duration=function(z){return arguments.length?(l=+z,k):l},k.interpolate=function(z){return arguments.length?(c=z,k):c},k.on=function(){var z=h.on.apply(h,arguments);return z===h?k:z},k.clickDistance=function(z){return arguments.length?(w=(z=+z)*z,k):Math.sqrt(w)},k.tapDistance=function(z){return arguments.length?(S=+z,k):S},k}const jy=b.createContext(null),q3e=jy.Provider,vl={error001:()=>"[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.`},uH=vl.error001();function Xn(t,e){const n=b.useContext(jy);if(n===null)throw new Error(uH);return FQ(n,t,e)}const Gr=()=>{const t=b.useContext(jy);if(t===null)throw new Error(uH);return b.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},F3e=t=>t.userSelectionActive?"none":"all";function Ny({position:t,children:e,className:n,style:r,...s}){const i=Xn(F3e),a=`${t}`.split("-");return he.createElement("div",{className:gs(["react-flow__panel",n,...a]),style:{...r,pointerEvents:i},...s},e)}function $3e({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:he.createElement(Ny,{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"},he.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const Q3e=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:h,...f})=>{const m=b.useRef(null),[g,x]=b.useState({x:0,y:0,width:0,height:0}),y=gs(["react-flow__edge-textwrapper",h]);return b.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:he.createElement("g",{transform:`translate(${t-g.width/2} ${e-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...f},s&&he.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:l,ry:l}),he.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:m,style:r},n),c)};var H3e=b.memo(Q3e);const dj=t=>({width:t.offsetWidth,height:t.offsetHeight}),_h=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),hj=(t={x:0,y:0},e)=>({x:_h(t.x,e[0][0],e[1][0]),y:_h(t.y,e[0][1],e[1][1])}),IM=(t,e,n)=>t<e?_h(Math.abs(t-e),1,50)/50:t>n?-_h(Math.abs(t-n),1,50)/50:0,dH=(t,e)=>{const n=IM(t.x,35,e.width-35)*20,r=IM(t.y,35,e.height-35)*20;return[n,r]},hH=t=>t.getRootNode?.()||window?.document,fH=(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)}),b0=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),mH=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),BM=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),V3e=(t,e)=>mH(fH(b0(t),b0(e))),gk=(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)},U3e=t=>Ji(t.width)&&Ji(t.height)&&Ji(t.x)&&Ji(t.y),Ji=t=>!isNaN(t)&&isFinite(t),pr=Symbol.for("internals"),pH=["Enter"," ","Escape"],W3e=(t,e)=>{},G3e=t=>"nativeEvent"in t;function xk(t){const n=(G3e(t)?t.nativeEvent:t).composedPath?.()?.[0]||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n?.nodeName)||n?.hasAttribute("contenteditable")||!!n?.closest(".nokey")}const gH=t=>"clientX"in t,fc=(t,e)=>{const n=gH(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)}},mv=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,dp=({id:t,path:e,labelX:n,labelY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x=20})=>he.createElement(he.Fragment,null,he.createElement("path",{id:t,style:f,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:g}),x&&he.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),s&&Ji(n)&&Ji(r)?he.createElement(H3e,{x:n,y:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:h}):null);dp.displayName="BaseEdge";function cm(t,e,n){return n===void 0?n:r=>{const s=e().edges.find(i=>i.id===t);s&&n(r,{...s})}}function xH({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,i=n<t?n+s:n-s,a=Math.abs(r-e)/2,l=r<e?r+a:r-a;return[i,l,s,a]}function vH({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:l}){const c=t*.125+s*.375+a*.375+n*.125,h=e*.125+i*.375+l*.375+r*.125,f=Math.abs(c-t),m=Math.abs(h-e);return[c,h,f,m]}var Pu;(function(t){t.Strict="strict",t.Loose="loose"})(Pu||(Pu={}));var gu;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(gu||(gu={}));var w0;(function(t){t.Partial="partial",t.Full="full"})(w0||(w0={}));var oc;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(oc||(oc={}));var pv;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(pv||(pv={}));var ht;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(ht||(ht={}));function qM({pos:t,x1:e,y1:n,x2:r,y2:s}){return t===ht.Left||t===ht.Right?[.5*(e+r),n]:[e,.5*(n+s)]}function yH({sourceX:t,sourceY:e,sourcePosition:n=ht.Bottom,targetX:r,targetY:s,targetPosition:i=ht.Top}){const[a,l]=qM({pos:n,x1:t,y1:e,x2:r,y2:s}),[c,h]=qM({pos:i,x1:r,y1:s,x2:t,y2:e}),[f,m,g,x]=vH({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:h});return[`M${t},${e} C${a},${l} ${c},${h} ${r},${s}`,f,m,g,x]}const fj=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=ht.Bottom,targetPosition:i=ht.Top,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:w})=>{const[S,k,N]=yH({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i});return he.createElement(dp,{path:S,labelX:k,labelY:N,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:w})});fj.displayName="SimpleBezierEdge";const FM={[ht.Left]:{x:-1,y:0},[ht.Right]:{x:1,y:0},[ht.Top]:{x:0,y:-1},[ht.Bottom]:{x:0,y:1}},X3e=({source:t,sourcePosition:e=ht.Bottom,target:n})=>e===ht.Left||e===ht.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},$M=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function Y3e({source:t,sourcePosition:e=ht.Bottom,target:n,targetPosition:r=ht.Top,center:s,offset:i}){const a=FM[e],l=FM[r],c={x:t.x+a.x*i,y:t.y+a.y*i},h={x:n.x+l.x*i,y:n.y+l.y*i},f=X3e({source:c,sourcePosition:e,target:h}),m=f.x!==0?"x":"y",g=f[m];let x=[],y,w;const S={x:0,y:0},k={x:0,y:0},[N,C,T,_]=xH({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[m]*l[m]===-1){y=s.x??N,w=s.y??C;const M=[{x:y,y:c.y},{x:y,y:h.y}],q=[{x:c.x,y:w},{x:h.x,y:w}];a[m]===g?x=m==="x"?M:q:x=m==="x"?q:M}else{const M=[{x:c.x,y:h.y}],q=[{x:h.x,y:c.y}];if(m==="x"?x=a.x===g?q:M:x=a.y===g?M:q,e===r){const ee=Math.abs(t[m]-n[m]);if(ee<=i){const z=Math.min(i-1,i-ee);a[m]===g?S[m]=(c[m]>t[m]?-1:1)*z:k[m]=(h[m]>n[m]?-1:1)*z}}if(e!==r){const ee=m==="x"?"y":"x",z=a[m]===l[ee],H=c[ee]>h[ee],P=c[ee]<h[ee];(a[m]===1&&(!z&&H||z&&P)||a[m]!==1&&(!z&&P||z&&H))&&(x=m==="x"?M:q)}const L={x:c.x+S.x,y:c.y+S.y},I={x:h.x+k.x,y:h.y+k.y},$=Math.max(Math.abs(L.x-x[0].x),Math.abs(I.x-x[0].x)),V=Math.max(Math.abs(L.y-x[0].y),Math.abs(I.y-x[0].y));$>=V?(y=(L.x+I.x)/2,w=x[0].y):(y=x[0].x,w=(L.y+I.y)/2)}return[[t,{x:c.x+S.x,y:c.y+S.y},...x,{x:h.x+k.x,y:h.y+k.y},n],y,w,T,_]}function K3e(t,e,n,r){const s=Math.min($M(t,e)/2,$M(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<n.x?-1:1,f=t.y<n.y?1:-1;return`L ${i+s*h},${a}Q ${i},${a} ${i},${a+s*f}`}const l=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${i},${a+s*c}Q ${i},${a} ${i+s*l},${a}`}function vk({sourceX:t,sourceY:e,sourcePosition:n=ht.Bottom,targetX:r,targetY:s,targetPosition:i=ht.Top,borderRadius:a=5,centerX:l,centerY:c,offset:h=20}){const[f,m,g,x,y]=Y3e({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:h});return[f.reduce((S,k,N)=>{let C="";return N>0&&N<f.length-1?C=K3e(f[N-1],k,f[N+1],a):C=`${N===0?"M":"L"}${k.x} ${k.y}`,S+=C,S},""),m,g,x,y]}const Cy=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:h,style:f,sourcePosition:m=ht.Bottom,targetPosition:g=ht.Top,markerEnd:x,markerStart:y,pathOptions:w,interactionWidth:S})=>{const[k,N,C]=vk({sourceX:t,sourceY:e,sourcePosition:m,targetX:n,targetY:r,targetPosition:g,borderRadius:w?.borderRadius,offset:w?.offset});return he.createElement(dp,{path:k,labelX:N,labelY:C,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:x,markerStart:y,interactionWidth:S})});Cy.displayName="SmoothStepEdge";const mj=b.memo(t=>he.createElement(Cy,{...t,pathOptions:b.useMemo(()=>({borderRadius:0,offset:t.pathOptions?.offset}),[t.pathOptions?.offset])}));mj.displayName="StepEdge";function Z3e({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,i,a,l]=xH({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,i,a,l]}const pj=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})=>{const[y,w,S]=Z3e({sourceX:t,sourceY:e,targetX:n,targetY:r});return he.createElement(dp,{path:y,labelX:w,labelY:S,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})});pj.displayName="StraightEdge";function zx(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function QM({pos:t,x1:e,y1:n,x2:r,y2:s,c:i}){switch(t){case ht.Left:return[e-zx(e-r,i),n];case ht.Right:return[e+zx(r-e,i),n];case ht.Top:return[e,n-zx(n-s,i)];case ht.Bottom:return[e,n+zx(s-n,i)]}}function bH({sourceX:t,sourceY:e,sourcePosition:n=ht.Bottom,targetX:r,targetY:s,targetPosition:i=ht.Top,curvature:a=.25}){const[l,c]=QM({pos:n,x1:t,y1:e,x2:r,y2:s,c:a}),[h,f]=QM({pos:i,x1:r,y1:s,x2:t,y2:e,c:a}),[m,g,x,y]=vH({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:h,targetControlY:f});return[`M${t},${e} C${l},${c} ${h},${f} ${r},${s}`,m,g,x,y]}const gv=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=ht.Bottom,targetPosition:i=ht.Top,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,pathOptions:w,interactionWidth:S})=>{const[k,N,C]=bH({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:w?.curvature});return he.createElement(dp,{path:k,labelX:N,labelY:C,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:S})});gv.displayName="BezierEdge";const gj=b.createContext(null),J3e=gj.Provider;gj.Consumer;const eSe=()=>b.useContext(gj),tSe=t=>"id"in t&&"source"in t&&"target"in t,nSe=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,yk=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,rSe=(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)),sSe=(t,e)=>{if(!t.source||!t.target)return e;let n;return tSe(t)?n={...t}:n={...t,id:nSe(t)},rSe(n,e)?e:e.concat(n)},bk=({x:t,y:e},[n,r,s],i,[a,l])=>{const c={x:(t-n)/s,y:(e-r)/s};return i?{x:a*Math.round(c.x/a),y:l*Math.round(c.y/l)}:c},wH=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r}),ku=(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}},Ty=(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}=ku(s,e).positionAbsolute;return fH(r,b0({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 mH(n)},SH=(t,e,[n,r,s]=[0,0,1],i=!1,a=!1,l=[0,0])=>{const c={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}=ku(f,l),S={x:w.x,y:w.y,width:m||0,height:g||0},k=gk(c,S),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},kH=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},OH=(t,e,n,r,s,i=.1)=>{const a=e/(t.width*(1+i)),l=n/(t.height*(1+i)),c=Math.min(a,l),h=_h(c,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}},ou=(t,e=0)=>t.transition().duration(e);function HM(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 iSe(t,e,n,r,s,i){const{x:a,y:l}=fc(t),h=e.elementsFromPoint(a,l).find(y=>y.classList.contains("react-flow__handle"));if(h){const y=h.getAttribute("data-nodeid");if(y){const w=xj(void 0,h),S=h.getAttribute("data-handleid"),k=i({nodeId:y,id:S,type:w});if(k){const N=s.find(C=>C.nodeId===y&&C.type===w&&C.id===S);return{handle:{id:S,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 S=i(y);w<=m&&(w<m?f=[{handle:y,validHandleResult:S}]:w===m&&f.push({handle:y,validHandleResult:S}),m=w)}}),!f.length)return{handle:null,validHandleResult:jH()};if(f.length===1)return f[0];const g=f.some(({validHandleResult:y})=>y.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 aSe={source:null,target:null,sourceHandle:null,targetHandle:null},jH=()=>({handleDomNode:null,isValid:!1,connection:aSe,endHandle:null});function NH(t,e,n,r,s,i,a){const l=s==="target",c=a.querySelector(`.react-flow__handle[data-id="${t?.nodeId}-${t?.id}-${t?.type}"]`),h={...jH(),handleDomNode:c};if(c){const f=xj(void 0,c),m=c.getAttribute("data-nodeid"),g=c.getAttribute("data-handleid"),x=c.classList.contains("connectable"),y=c.classList.contains("connectableend"),w={source:l?m:n,sourceHandle:l?g:r,target:l?n:m,targetHandle:l?r:g};h.connection=w,x&&y&&(e===Pu.Strict?l&&f==="source"||!l&&f==="target":m!==n||g!==r)&&(h.endHandle={nodeId:m,handleId:g,type:f},h.isValid=i(w))}return h}function oSe({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((s,i)=>{if(i[pr]){const{handleBounds:a}=i[pr];let l=[],c=[];a&&(l=HM(i,a,"source",`${e}-${n}-${r}`),c=HM(i,a,"target",`${e}-${n}-${r}`)),s.push(...l,...c)}return s},[])}function xj(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function E4(t){t?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function lSe(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function CH({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:s,getState:i,setState:a,isValidConnection:l,edgeUpdaterType:c,onReconnectEnd:h}){const f=hH(t.target),{connectionMode:m,domNode:g,autoPanOnConnect:x,connectionRadius:y,onConnectStart:w,panBy:S,getNodes:k,cancelConnection:N}=i();let C=0,T;const{x:_,y:E}=fc(t),M=f?.elementFromPoint(_,E),q=xj(c,M),L=g?.getBoundingClientRect();if(!L||!q)return;let I,$=fc(t,L),V=!1,ee=null,z=!1,H=null;const P=oSe({nodes:k(),nodeId:n,handleId:e,handleType:q}),W=()=>{if(!x)return;const[R,se]=dH($,L);S({x:R,y:se}),C=requestAnimationFrame(W)};a({connectionPosition:$,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:q,connectionStartHandle:{nodeId:n,handleId:e,type:q},connectionEndHandle:null}),w?.(t,{nodeId:n,handleId:e,handleType:q});function J(R){const{transform:se}=i();$=fc(R,L);const{handle:G,validHandleResult:F}=iSe(R,f,bk($,se,!1,[1,1]),y,P,U=>NH(U,m,n,e,s?"target":"source",l,f));if(T=G,V||(W(),V=!0),H=F.handleDomNode,ee=F.connection,z=F.isValid,a({connectionPosition:T&&z?wH({x:T.x,y:T.y},se):$,connectionStatus:lSe(!!T,z),connectionEndHandle:F.endHandle}),!T&&!z&&!H)return E4(I);ee.source!==ee.target&&H&&(E4(I),I=H,H.classList.add("connecting","react-flow__handle-connecting"),H.classList.toggle("valid",z),H.classList.toggle("react-flow__handle-valid",z))}function X(R){(T||H)&&ee&&z&&r?.(ee),i().onConnectEnd?.(R),c&&h?.(R),E4(I),N(),cancelAnimationFrame(C),V=!1,z=!1,ee=null,H=null,f.removeEventListener("mousemove",J),f.removeEventListener("mouseup",X),f.removeEventListener("touchmove",J),f.removeEventListener("touchend",X)}f.addEventListener("mousemove",J),f.addEventListener("mouseup",X),f.addEventListener("touchmove",J),f.addEventListener("touchend",X)}const VM=()=>!0,cSe=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),uSe=(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}},TH=b.forwardRef(({type:t="source",position:e=ht.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:h,onMouseDown:f,onTouchStart:m,...g},x)=>{const y=a||null,w=t==="target",S=Gr(),k=eSe(),{connectOnClick:N,noPanClassName:C}=Xn(cSe,ts),{connecting:T,clickConnecting:_}=Xn(uSe(k,y,t),ts);k||S.getState().onError?.("010",vl.error010());const E=L=>{const{defaultEdgeOptions:I,onConnect:$,hasDefaultEdges:V}=S.getState(),ee={...I,...L};if(V){const{edges:z,setEdges:H}=S.getState();H(sSe(ee,z))}$?.(ee),l?.(ee)},M=L=>{if(!k)return;const I=gH(L);s&&(I&&L.button===0||!I)&&CH({event:L,handleId:y,nodeId:k,onConnect:E,isTarget:w,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||VM}),I?f?.(L):m?.(L)},q=L=>{const{onClickConnectStart:I,onClickConnectEnd:$,connectionClickStartHandle:V,connectionMode:ee,isValidConnection:z}=S.getState();if(!k||!V&&!s)return;if(!V){I?.(L,{nodeId:k,handleId:y,handleType:t}),S.setState({connectionClickStartHandle:{nodeId:k,type:t,handleId:y}});return}const H=hH(L.target),P=n||z||VM,{connection:W,isValid:J}=NH({nodeId:k,id:y,type:t},ee,V.nodeId,V.handleId||null,V.type,P,H);J&&E(W),$?.(L),S.setState({connectionClickStartHandle:null})};return he.createElement("div",{"data-handleid":y,"data-nodeid":k,"data-handlepos":e,"data-id":`${k}-${y}-${t}`,className:gs(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",C,h,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:i,connecting:_,connectionindicator:r&&(s&&!T||i&&T)}]),onMouseDown:M,onTouchStart:M,onClick:N?q:void 0,ref:x,...g},c)});TH.displayName="Handle";var jc=b.memo(TH);const EH=({data:t,isConnectable:e,targetPosition:n=ht.Top,sourcePosition:r=ht.Bottom})=>he.createElement(he.Fragment,null,he.createElement(jc,{type:"target",position:n,isConnectable:e}),t?.label,he.createElement(jc,{type:"source",position:r,isConnectable:e}));EH.displayName="DefaultNode";var wk=b.memo(EH);const _H=({data:t,isConnectable:e,sourcePosition:n=ht.Bottom})=>he.createElement(he.Fragment,null,t?.label,he.createElement(jc,{type:"source",position:n,isConnectable:e}));_H.displayName="InputNode";var MH=b.memo(_H);const AH=({data:t,isConnectable:e,targetPosition:n=ht.Top})=>he.createElement(he.Fragment,null,he.createElement(jc,{type:"target",position:n,isConnectable:e}),t?.label);AH.displayName="OutputNode";var RH=b.memo(AH);const vj=()=>null;vj.displayName="GroupNode";const dSe=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Px=t=>t.id;function hSe(t,e){return ts(t.selectedNodes.map(Px),e.selectedNodes.map(Px))&&ts(t.selectedEdges.map(Px),e.selectedEdges.map(Px))}const DH=b.memo(({onSelectionChange:t})=>{const e=Gr(),{selectedNodes:n,selectedEdges:r}=Xn(dSe,hSe);return b.useEffect(()=>{const s={nodes:n,edges:r};t?.(s),e.getState().onSelectionChange.forEach(i=>i(s))},[n,r,t]),null});DH.displayName="SelectionListener";const fSe=t=>!!t.onSelectionChange;function mSe({onSelectionChange:t}){const e=Xn(fSe);return t||e?he.createElement(DH,{onSelectionChange:t}):null}const pSe=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 Td(t,e){b.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function Vt(t,e,n){b.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const gSe=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:i,onConnectEnd:a,onClickConnectStart:l,onClickConnectEnd:c,nodesDraggable:h,nodesConnectable:f,nodesFocusable:m,edgesFocusable:g,edgesUpdatable:x,elevateNodesOnSelect:y,minZoom:w,maxZoom:S,nodeExtent:k,onNodesChange:N,onEdgesChange:C,elementsSelectable:T,connectionMode:_,snapGrid:E,snapToGrid:M,translateExtent:q,connectOnClick:L,defaultEdgeOptions:I,fitView:$,fitViewOptions:V,onNodesDelete:ee,onEdgesDelete:z,onNodeDrag:H,onNodeDragStart:P,onNodeDragStop:W,onSelectionDrag:J,onSelectionDragStart:X,onSelectionDragStop:R,noPanClassName:se,nodeOrigin:G,rfId:F,autoPanOnConnect:U,autoPanOnNodeDrag:te,onError:ne,connectionRadius:Y,isValidConnection:ae,nodeDragThreshold:re})=>{const{setNodes:oe,setEdges:_e,setDefaultNodesAndEdges:Ge,setMinZoom:tt,setMaxZoom:Xe,setTranslateExtent:je,setNodeExtent:Qe,reset:He}=Xn(pSe,ts),$e=Gr();return b.useEffect(()=>{const bt=r?.map(ot=>({...ot,...I}));return Ge(n,bt),()=>{He()}},[]),Vt("defaultEdgeOptions",I,$e.setState),Vt("connectionMode",_,$e.setState),Vt("onConnect",s,$e.setState),Vt("onConnectStart",i,$e.setState),Vt("onConnectEnd",a,$e.setState),Vt("onClickConnectStart",l,$e.setState),Vt("onClickConnectEnd",c,$e.setState),Vt("nodesDraggable",h,$e.setState),Vt("nodesConnectable",f,$e.setState),Vt("nodesFocusable",m,$e.setState),Vt("edgesFocusable",g,$e.setState),Vt("edgesUpdatable",x,$e.setState),Vt("elementsSelectable",T,$e.setState),Vt("elevateNodesOnSelect",y,$e.setState),Vt("snapToGrid",M,$e.setState),Vt("snapGrid",E,$e.setState),Vt("onNodesChange",N,$e.setState),Vt("onEdgesChange",C,$e.setState),Vt("connectOnClick",L,$e.setState),Vt("fitViewOnInit",$,$e.setState),Vt("fitViewOnInitOptions",V,$e.setState),Vt("onNodesDelete",ee,$e.setState),Vt("onEdgesDelete",z,$e.setState),Vt("onNodeDrag",H,$e.setState),Vt("onNodeDragStart",P,$e.setState),Vt("onNodeDragStop",W,$e.setState),Vt("onSelectionDrag",J,$e.setState),Vt("onSelectionDragStart",X,$e.setState),Vt("onSelectionDragStop",R,$e.setState),Vt("noPanClassName",se,$e.setState),Vt("nodeOrigin",G,$e.setState),Vt("rfId",F,$e.setState),Vt("autoPanOnConnect",U,$e.setState),Vt("autoPanOnNodeDrag",te,$e.setState),Vt("onError",ne,$e.setState),Vt("connectionRadius",Y,$e.setState),Vt("isValidConnection",ae,$e.setState),Vt("nodeDragThreshold",re,$e.setState),Td(t,oe),Td(e,_e),Td(w,tt),Td(S,Xe),Td(q,je),Td(k,Qe),null},UM={display:"none"},xSe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},zH="react-flow__node-desc",PH="react-flow__edge-desc",vSe="react-flow__aria-live",ySe=t=>t.ariaLiveMessage;function bSe({rfId:t}){const e=Xn(ySe);return he.createElement("div",{id:`${vSe}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:xSe},e)}function wSe({rfId:t,disableKeyboardA11y:e}){return he.createElement(he.Fragment,null,he.createElement("div",{id:`${zH}-${t}`,style:UM},"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."," "),he.createElement("div",{id:`${PH}-${t}`,style:UM},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&he.createElement(bSe,{rfId:t}))}var S0=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=b.useState(!1),s=b.useRef(!1),i=b.useRef(new Set([])),[a,l]=b.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 b.useEffect(()=>{const c=typeof document<"u"?document:null,h=e?.target||c;if(t!==null){const f=x=>{if(s.current=x.ctrlKey||x.metaKey||x.shiftKey,(!s.current||s.current&&!e.actInsideInputWithModifier)&&xk(x))return!1;const w=GM(x.code,l);i.current.add(x[w]),WM(a,i.current,!1)&&(x.preventDefault(),r(!0))},m=x=>{if((!s.current||s.current&&!e.actInsideInputWithModifier)&&xk(x))return!1;const w=GM(x.code,l);WM(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 WM(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function GM(t,e){return e.includes(t)?"code":"key"}function LH(t,e,n,r){const s=t.parentNode||t.parentId;if(!s)return n;const i=e.get(s),a=ku(i,r);return LH(i,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(i[pr]?.z??0)>(n.z??0)?i[pr]?.z??0:n.z??0},r)}function IH(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:l}=LH(r,t,{...r.position,z:r[pr]?.z??0},e);r.positionAbsolute={x:i,y:a},r[pr].z=l,n?.[r.id]&&(r[pr].isParent=!0)}})}function _4(t,e,n,r){const s=new Map,i={},a=r?1e3:0;return t.forEach(l=>{const c=(Ji(l.zIndex)?l.zIndex:0)+(l.selected?a:0),h=e.get(l.id),f={...l,positionAbsolute:{x:l.position.x,y:l.position.y}},m=l.parentNode||l.parentId;m&&(i[m]=!0);const g=h?.type&&h?.type!==l.type;Object.defineProperty(f,pr,{enumerable:!1,value:{handleBounds:g?void 0:h?.[pr]?.handleBounds,z:c}}),s.set(l.id,f)}),IH(s,n,i),s}function BH(t,e={}){const{getNodes:n,width:r,height:s,minZoom:i,maxZoom:a,d3Zoom:l,d3Selection:c,fitViewOnInitDone:h,fitViewOnInit:f,nodeOrigin:m}=t(),g=e.initial&&!h&&f;if(l&&c&&(g||!e.initial)){const y=n().filter(S=>{const k=e.includeHiddenNodes?S.width&&S.height:!S.hidden;return e.nodes?.length?k&&e.nodes.some(N=>N.id===S.id):k}),w=y.every(S=>S.width&&S.height);if(y.length>0&&w){const S=Ty(y,m),{x:k,y:N,zoom:C}=OH(S,r,s,e.minZoom??i,e.maxZoom??a,e.padding??.1),T=ol.translate(k,N).scale(C);return typeof e.duration=="number"&&e.duration>0?l.transform(ou(c,e.duration),T):l.transform(c,T),!0}}return!1}function SSe(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[pr]:r[pr],selected:n.selected})}),new Map(e)}function kSe(t,e){return e.map(n=>{const r=t.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function Lx({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:s,edges:i,onNodesChange:a,onEdgesChange:l,hasDefaultNodes:c,hasDefaultEdges:h}=n();t?.length&&(c&&r({nodeInternals:SSe(t,s)}),a?.(t)),e?.length&&(h&&r({edges:kSe(e,i)}),l?.(e))}const Ed=()=>{},OSe={zoomIn:Ed,zoomOut:Ed,zoomTo:Ed,getZoom:()=>1,setViewport:Ed,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ed,fitBounds:Ed,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},jSe=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),NSe=()=>{const t=Gr(),{d3Zoom:e,d3Selection:n}=Xn(jSe,ts);return b.useMemo(()=>n&&e?{zoomIn:s=>e.scaleBy(ou(n,s?.duration),1.2),zoomOut:s=>e.scaleBy(ou(n,s?.duration),1/1.2),zoomTo:(s,i)=>e.scaleTo(ou(n,i?.duration),s),getZoom:()=>t.getState().transform[2],setViewport:(s,i)=>{const[a,l,c]=t.getState().transform,h=ol.translate(s.x??a,s.y??l).scale(s.zoom??c);e.transform(ou(n,i?.duration),h)},getViewport:()=>{const[s,i,a]=t.getState().transform;return{x:s,y:i,zoom:a}},fitView:s=>BH(t.getState,s),setCenter:(s,i,a)=>{const{width:l,height:c,maxZoom:h}=t.getState(),f=typeof a?.zoom<"u"?a.zoom:h,m=l/2-s*f,g=c/2-i*f,x=ol.translate(m,g).scale(f);e.transform(ou(n,a?.duration),x)},fitBounds:(s,i)=>{const{width:a,height:l,minZoom:c,maxZoom:h}=t.getState(),{x:f,y:m,zoom:g}=OH(s,a,l,c,h,i?.padding??.1),x=ol.translate(f,m).scale(g);e.transform(ou(n,i?.duration),x)},project:s=>{const{transform:i,snapToGrid:a,snapGrid:l}=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"),bk(s,i,a,l)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:a,snapGrid:l,domNode:c}=t.getState();if(!c)return s;const{x:h,y:f}=c.getBoundingClientRect(),m={x:s.x-h,y:s.y-f};return bk(m,i,a,l)},flowToScreenPosition:s=>{const{transform:i,domNode:a}=t.getState();if(!a)return s;const{x:l,y:c}=a.getBoundingClientRect(),h=wH(s,i);return{x:h.x+l,y:h.y+c}},viewportInitialized:!0}:OSe,[e,n])};function yj(){const t=NSe(),e=Gr(),n=b.useCallback(()=>e.getState().getNodes().map(w=>({...w})),[]),r=b.useCallback(w=>e.getState().nodeInternals.get(w),[]),s=b.useCallback(()=>{const{edges:w=[]}=e.getState();return w.map(S=>({...S}))},[]),i=b.useCallback(w=>{const{edges:S=[]}=e.getState();return S.find(k=>k.id===w)},[]),a=b.useCallback(w=>{const{getNodes:S,setNodes:k,hasDefaultNodes:N,onNodesChange:C}=e.getState(),T=S(),_=typeof w=="function"?w(T):w;if(N)k(_);else if(C){const E=_.length===0?T.map(M=>({type:"remove",id:M.id})):_.map(M=>({item:M,type:"reset"}));C(E)}},[]),l=b.useCallback(w=>{const{edges:S=[],setEdges:k,hasDefaultEdges:N,onEdgesChange:C}=e.getState(),T=typeof w=="function"?w(S):w;if(N)k(T);else if(C){const _=T.length===0?S.map(E=>({type:"remove",id:E.id})):T.map(E=>({item:E,type:"reset"}));C(_)}},[]),c=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{getNodes:k,setNodes:N,hasDefaultNodes:C,onNodesChange:T}=e.getState();if(C){const E=[...k(),...S];N(E)}else if(T){const _=S.map(E=>({item:E,type:"add"}));T(_)}},[]),h=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{edges:k=[],setEdges:N,hasDefaultEdges:C,onEdgesChange:T}=e.getState();if(C)N([...k,...S]);else if(T){const _=S.map(E=>({item:E,type:"add"}));T(_)}},[]),f=b.useCallback(()=>{const{getNodes:w,edges:S=[],transform:k}=e.getState(),[N,C,T]=k;return{nodes:w().map(_=>({..._})),edges:S.map(_=>({..._})),viewport:{x:N,y:C,zoom:T}}},[]),m=b.useCallback(({nodes:w,edges:S})=>{const{nodeInternals:k,getNodes:N,edges:C,hasDefaultNodes:T,hasDefaultEdges:_,onNodesDelete:E,onEdgesDelete:M,onNodesChange:q,onEdgesChange:L}=e.getState(),I=(w||[]).map(H=>H.id),$=(S||[]).map(H=>H.id),V=N().reduce((H,P)=>{const W=P.parentNode||P.parentId,J=!I.includes(P.id)&&W&&H.find(R=>R.id===W);return(typeof P.deletable=="boolean"?P.deletable:!0)&&(I.includes(P.id)||J)&&H.push(P),H},[]),ee=C.filter(H=>typeof H.deletable=="boolean"?H.deletable:!0),z=ee.filter(H=>$.includes(H.id));if(V||z){const H=kH(V,ee),P=[...z,...H],W=P.reduce((J,X)=>(J.includes(X.id)||J.push(X.id),J),[]);if((_||T)&&(_&&e.setState({edges:C.filter(J=>!W.includes(J.id))}),T&&(V.forEach(J=>{k.delete(J.id)}),e.setState({nodeInternals:new Map(k)}))),W.length>0&&(M?.(P),L&&L(W.map(J=>({id:J,type:"remove"})))),V.length>0&&(E?.(V),q)){const J=V.map(X=>({id:X.id,type:"remove"}));q(J)}}},[]),g=b.useCallback(w=>{const S=U3e(w),k=S?null:e.getState().nodeInternals.get(w.id);return!S&&!k?[null,null,S]:[S?w:BM(k),k,S]},[]),x=b.useCallback((w,S=!0,k)=>{const[N,C,T]=g(w);return N?(k||e.getState().getNodes()).filter(_=>{if(!T&&(_.id===C.id||!_.positionAbsolute))return!1;const E=BM(_),M=gk(E,N);return S&&M>0||M>=N.width*N.height}):[]},[]),y=b.useCallback((w,S,k=!0)=>{const[N]=g(w);if(!N)return!1;const C=gk(N,S);return k&&C>0||C>=N.width*N.height},[]);return b.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:s,getEdge:i,setNodes:a,setEdges:l,addNodes:c,addEdges:h,toObject:f,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:y}),[t,n,r,s,i,a,l,c,h,f,m,x,y])}const CSe={actInsideInputWithModifier:!1};var TSe=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=Gr(),{deleteElements:r}=yj(),s=S0(t,CSe),i=S0(e);b.useEffect(()=>{if(s){const{edges:a,getNodes:l}=n.getState(),c=l().filter(f=>f.selected),h=a.filter(f=>f.selected);r({nodes:c,edges:h}),n.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function ESe(t){const e=Gr();b.useEffect(()=>{let n;const r=()=>{if(!t.current)return;const s=dj(t.current);(s.height===0||s.width===0)&&e.getState().onError?.("004",vl.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 bj={position:"absolute",width:"100%",height:"100%",top:0,left:0},_Se=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,Ix=t=>({x:t.x,y:t.y,zoom:t.k}),_d=(t,e)=>t.target.closest(`.${e}`),XM=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),YM=t=>{const e=t.ctrlKey&&mv()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},MSe=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),ASe=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:a=!1,panOnScrollSpeed:l=.5,panOnScrollMode:c=gu.Free,zoomOnDoubleClick:h=!0,elementsSelectable:f,panOnDrag:m=!0,defaultViewport:g,translateExtent:x,minZoom:y,maxZoom:w,zoomActivationKeyCode:S,preventScrolling:k=!0,children:N,noWheelClassName:C,noPanClassName:T})=>{const _=b.useRef(),E=Gr(),M=b.useRef(!1),q=b.useRef(!1),L=b.useRef(null),I=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:$,d3Selection:V,d3ZoomHandler:ee,userSelectionActive:z}=Xn(MSe,ts),H=S0(S),P=b.useRef(0),W=b.useRef(!1),J=b.useRef();return ESe(L),b.useEffect(()=>{if(L.current){const X=L.current.getBoundingClientRect(),R=cH().scaleExtent([y,w]).translateExtent(x),se=Gi(L.current).call(R),G=ol.translate(g.x,g.y).scale(_h(g.zoom,y,w)),F=[[0,0],[X.width,X.height]],U=R.constrain()(G,F,x);R.transform(se,U),R.wheelDelta(YM),E.setState({d3Zoom:R,d3Selection:se,d3ZoomHandler:se.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:L.current.closest(".react-flow")})}},[]),b.useEffect(()=>{V&&$&&(a&&!H&&!z?V.on("wheel.zoom",X=>{if(_d(X,C))return!1;X.preventDefault(),X.stopImmediatePropagation();const R=V.property("__zoom").k||1;if(X.ctrlKey&&i){const ae=ya(X),re=YM(X),oe=R*Math.pow(2,re);$.scaleTo(V,oe,ae,X);return}const se=X.deltaMode===1?20:1;let G=c===gu.Vertical?0:X.deltaX*se,F=c===gu.Horizontal?0:X.deltaY*se;!mv()&&X.shiftKey&&c!==gu.Vertical&&(G=X.deltaY*se,F=0),$.translateBy(V,-(G/R)*l,-(F/R)*l,{internal:!0});const U=Ix(V.property("__zoom")),{onViewportChangeStart:te,onViewportChange:ne,onViewportChangeEnd:Y}=E.getState();clearTimeout(J.current),W.current||(W.current=!0,e?.(X,U),te?.(U)),W.current&&(t?.(X,U),ne?.(U),J.current=setTimeout(()=>{n?.(X,U),Y?.(U),W.current=!1},150))},{passive:!1}):typeof ee<"u"&&V.on("wheel.zoom",function(X,R){if(!k&&X.type==="wheel"&&!X.ctrlKey||_d(X,C))return null;X.preventDefault(),ee.call(this,X,R)},{passive:!1}))},[z,a,c,V,$,ee,H,i,k,C,e,t,n]),b.useEffect(()=>{$&&$.on("start",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;P.current=X.sourceEvent?.button;const{onViewportChangeStart:R}=E.getState(),se=Ix(X.transform);M.current=!0,I.current=se,X.sourceEvent?.type==="mousedown"&&E.setState({paneDragging:!0}),R?.(se),e?.(X.sourceEvent,se)})},[$,e]),b.useEffect(()=>{$&&(z&&!M.current?$.on("zoom",null):z||$.on("zoom",X=>{const{onViewportChange:R}=E.getState();if(E.setState({transform:[X.transform.x,X.transform.y,X.transform.k]}),q.current=!!(r&&XM(m,P.current??0)),(t||R)&&!X.sourceEvent?.internal){const se=Ix(X.transform);R?.(se),t?.(X.sourceEvent,se)}}))},[z,$,t,m,r]),b.useEffect(()=>{$&&$.on("end",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;const{onViewportChangeEnd:R}=E.getState();if(M.current=!1,E.setState({paneDragging:!1}),r&&XM(m,P.current??0)&&!q.current&&r(X.sourceEvent),q.current=!1,(n||R)&&_Se(I.current,X.transform)){const se=Ix(X.transform);I.current=se,clearTimeout(_.current),_.current=setTimeout(()=>{R?.(se),n?.(X.sourceEvent,se)},a?150:0)}})},[$,a,m,n,r]),b.useEffect(()=>{$&&$.filter(X=>{const R=H||s,se=i&&X.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&X.button===1&&X.type==="mousedown"&&(_d(X,"react-flow__node")||_d(X,"react-flow__edge")))return!0;if(!m&&!R&&!a&&!h&&!i||z||!h&&X.type==="dblclick"||_d(X,C)&&X.type==="wheel"||_d(X,T)&&(X.type!=="wheel"||a&&X.type==="wheel"&&!H)||!i&&X.ctrlKey&&X.type==="wheel"||!R&&!a&&!se&&X.type==="wheel"||!m&&(X.type==="mousedown"||X.type==="touchstart")||Array.isArray(m)&&!m.includes(X.button)&&X.type==="mousedown")return!1;const G=Array.isArray(m)&&m.includes(X.button)||!X.button||X.button<=1;return(!X.ctrlKey||X.type==="wheel")&&G})},[z,$,s,i,a,h,m,f,H]),he.createElement("div",{className:"react-flow__renderer",ref:L,style:bj},N)},RSe=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function DSe(){const{userSelectionActive:t,userSelectionRect:e}=Xn(RSe,ts);return t&&e?he.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 KM(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 qH(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(l=>l.id===s.id);if(i.length===0)return r.push(s),r;const a={...s};for(const l of i)if(l)switch(l.type){case"select":{a.selected=l.selected;break}case"position":{typeof l.position<"u"&&(a.position=l.position),typeof l.positionAbsolute<"u"&&(a.positionAbsolute=l.positionAbsolute),typeof l.dragging<"u"&&(a.dragging=l.dragging),a.expandParent&&KM(r,a);break}case"dimensions":{typeof l.dimensions<"u"&&(a.width=l.dimensions.width,a.height=l.dimensions.height),typeof l.updateStyle<"u"&&(a.style={...a.style||{},...l.dimensions}),typeof l.resizing=="boolean"&&(a.resizing=l.resizing),a.expandParent&&KM(r,a);break}case"remove":return r}return r.push(a),r},n)}function FH(t,e){return qH(t,e)}function zSe(t,e){return qH(t,e)}const ic=(t,e)=>({id:t,type:"select",selected:e});function Wd(t,e){return t.reduce((n,r)=>{const s=e.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(ic(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(ic(r.id,!1))),n},[])}const M4=(t,e)=>n=>{n.target===e.current&&t?.(n)},PSe=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),$H=b.memo(({isSelecting:t,selectionMode:e=w0.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:a,onPaneScroll:l,onPaneMouseEnter:c,onPaneMouseMove:h,onPaneMouseLeave:f,children:m})=>{const g=b.useRef(null),x=Gr(),y=b.useRef(0),w=b.useRef(0),S=b.useRef(),{userSelectionActive:k,elementsSelectable:N,dragging:C}=Xn(PSe,ts),T=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,w.current=0},_=ee=>{i?.(ee),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},E=ee=>{if(Array.isArray(n)&&n?.includes(2)){ee.preventDefault();return}a?.(ee)},M=l?ee=>l(ee):void 0,q=ee=>{const{resetSelectedElements:z,domNode:H}=x.getState();if(S.current=H?.getBoundingClientRect(),!N||!t||ee.button!==0||ee.target!==g.current||!S.current)return;const{x:P,y:W}=fc(ee,S.current);z(),x.setState({userSelectionRect:{width:0,height:0,startX:P,startY:W,x:P,y:W}}),r?.(ee)},L=ee=>{const{userSelectionRect:z,nodeInternals:H,edges:P,transform:W,onNodesChange:J,onEdgesChange:X,nodeOrigin:R,getNodes:se}=x.getState();if(!t||!S.current||!z)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=fc(ee,S.current),F=z.startX??0,U=z.startY??0,te={...z,x:G.x<F?G.x:F,y:G.y<U?G.y:U,width:Math.abs(G.x-F),height:Math.abs(G.y-U)},ne=se(),Y=SH(H,te,W,e===w0.Partial,!0,R),ae=kH(Y,P).map(oe=>oe.id),re=Y.map(oe=>oe.id);if(y.current!==re.length){y.current=re.length;const oe=Wd(ne,re);oe.length&&J?.(oe)}if(w.current!==ae.length){w.current=ae.length;const oe=Wd(P,ae);oe.length&&X?.(oe)}x.setState({userSelectionRect:te})},I=ee=>{if(ee.button!==0)return;const{userSelectionRect:z}=x.getState();!k&&z&&ee.target===g.current&&_?.(ee),x.setState({nodesSelectionActive:y.current>0}),T(),s?.(ee)},$=ee=>{k&&(x.setState({nodesSelectionActive:y.current>0}),s?.(ee)),T()},V=N&&(t||k);return he.createElement("div",{className:gs(["react-flow__pane",{dragging:C,selection:t}]),onClick:V?void 0:M4(_,g),onContextMenu:M4(E,g),onWheel:M4(M,g),onMouseEnter:V?void 0:c,onMouseDown:V?q:void 0,onMouseMove:V?L:h,onMouseUp:V?I:void 0,onMouseLeave:V?$:f,ref:g,style:bj},m,he.createElement(DSe,null))});$H.displayName="Pane";function QH(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const r=e.get(n);return r?r.selected?!0:QH(r,e):!1}function ZM(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 LSe(t,e,n,r){return Array.from(t.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!QH(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 ISe(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function HH(t,e,n,r,s=[0,0],i){const a=ISe(t,t.extent||r);let l=a;const c=t.parentNode||t.parentId;if(t.extent==="parent"&&!t.expandParent)if(c&&t.width&&t.height){const m=n.get(c),{x:g,y:x}=ku(m,s).positionAbsolute;l=m&&Ji(g)&&Ji(x)&&Ji(m.width)&&Ji(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]]]:l}else i?.("005",vl.error005()),l=a;else if(t.extent&&c&&t.extent!=="parent"){const m=n.get(c),{x:g,y:x}=ku(m,s).positionAbsolute;l=[[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(c){const m=n.get(c);h=ku(m,s).positionAbsolute}const f=l&&l!=="parent"?hj(e,l):e;return{position:{x:f.x-h.x,y:f.y-h.y},positionAbsolute:f}}function A4({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 JM=(t,e,n,r)=>{const s=e.querySelectorAll(t);if(!s||!s.length)return null;const i=Array.from(s),a=e.getBoundingClientRect(),l={x:a.width*r[0],y:a.height*r[1]};return i.map(c=>{const h=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(h.left-a.left-l.x)/n,y:(h.top-a.top-l.y)/n,...dj(c)}})};function um(t,e,n){return n===void 0?n:r=>{const s=e().nodeInternals.get(t);s&&n(r,{...s})}}function Sk({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeInternals:l,onError:c}=e.getState(),h=l.get(t);if(!h){c?.("012",vl.error012(t));return}e.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&a)&&(i({nodes:[h],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):s([t])}function BSe(){const t=Gr();return b.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:i}=t.getState(),a=n.touches?n.touches[0].clientX:n.clientX,l=n.touches?n.touches[0].clientY:n.clientY,c={x:(a-r[0])/r[2],y:(l-r[1])/r[2]};return{xSnapped:i?s[0]*Math.round(c.x/s[0]):c.x,ySnapped:i?s[1]*Math.round(c.y/s[1]):c.y,...c}},[])}function R4(t){return(e,n,r)=>t?.(e,r)}function VH({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,selectNodesOnDrag:a}){const l=Gr(),[c,h]=b.useState(!1),f=b.useRef([]),m=b.useRef({x:null,y:null}),g=b.useRef(0),x=b.useRef(null),y=b.useRef({x:0,y:0}),w=b.useRef(null),S=b.useRef(!1),k=b.useRef(!1),N=b.useRef(!1),C=BSe();return b.useEffect(()=>{if(t?.current){const T=Gi(t.current),_=({x:q,y:L})=>{const{nodeInternals:I,onNodeDrag:$,onSelectionDrag:V,updateNodePositions:ee,nodeExtent:z,snapGrid:H,snapToGrid:P,nodeOrigin:W,onError:J}=l.getState();m.current={x:q,y:L};let X=!1,R={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&z){const G=Ty(f.current,W);R=b0(G)}if(f.current=f.current.map(G=>{const F={x:q-G.distance.x,y:L-G.distance.y};P&&(F.x=H[0]*Math.round(F.x/H[0]),F.y=H[1]*Math.round(F.y/H[1]));const U=[[z[0][0],z[0][1]],[z[1][0],z[1][1]]];f.current.length>1&&z&&!G.extent&&(U[0][0]=G.positionAbsolute.x-R.x+z[0][0],U[1][0]=G.positionAbsolute.x+(G.width??0)-R.x2+z[1][0],U[0][1]=G.positionAbsolute.y-R.y+z[0][1],U[1][1]=G.positionAbsolute.y+(G.height??0)-R.y2+z[1][1]);const te=HH(G,F,I,U,W,J);return X=X||G.position.x!==te.position.x||G.position.y!==te.position.y,G.position=te.position,G.positionAbsolute=te.positionAbsolute,G}),!X)return;ee(f.current,!0,!0),h(!0);const se=s?$:R4(V);if(se&&w.current){const[G,F]=A4({nodeId:s,dragItems:f.current,nodeInternals:I});se(w.current,G,F)}},E=()=>{if(!x.current)return;const[q,L]=dH(y.current,x.current);if(q!==0||L!==0){const{transform:I,panBy:$}=l.getState();m.current.x=(m.current.x??0)-q/I[2],m.current.y=(m.current.y??0)-L/I[2],$({x:q,y:L})&&_(m.current)}g.current=requestAnimationFrame(E)},M=q=>{const{nodeInternals:L,multiSelectionActive:I,nodesDraggable:$,unselectNodesAndEdges:V,onNodeDragStart:ee,onSelectionDragStart:z}=l.getState();k.current=!0;const H=s?ee:R4(z);(!a||!i)&&!I&&s&&(L.get(s)?.selected||V()),s&&i&&a&&Sk({id:s,store:l,nodeRef:t});const P=C(q);if(m.current=P,f.current=LSe(L,$,P,s),H&&f.current){const[W,J]=A4({nodeId:s,dragItems:f.current,nodeInternals:L});H(q.sourceEvent,W,J)}};if(e)T.on(".drag",null);else{const q=S5e().on("start",L=>{const{domNode:I,nodeDragThreshold:$}=l.getState();$===0&&M(L),N.current=!1;const V=C(L);m.current=V,x.current=I?.getBoundingClientRect()||null,y.current=fc(L.sourceEvent,x.current)}).on("drag",L=>{const I=C(L),{autoPanOnNodeDrag:$,nodeDragThreshold:V}=l.getState();if(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!S.current&&k.current&&$&&(S.current=!0,E()),!k.current){const ee=I.xSnapped-(m?.current?.x??0),z=I.ySnapped-(m?.current?.y??0);Math.sqrt(ee*ee+z*z)>V&&M(L)}(m.current.x!==I.xSnapped||m.current.y!==I.ySnapped)&&f.current&&k.current&&(w.current=L.sourceEvent,y.current=fc(L.sourceEvent,x.current),_(I))}}).on("end",L=>{if(!(!k.current||N.current)&&(h(!1),S.current=!1,k.current=!1,cancelAnimationFrame(g.current),f.current)){const{updateNodePositions:I,nodeInternals:$,onNodeDragStop:V,onSelectionDragStop:ee}=l.getState(),z=s?V:R4(ee);if(I(f.current,!1,!1),z){const[H,P]=A4({nodeId:s,dragItems:f.current,nodeInternals:$});z(L.sourceEvent,H,P)}}}).filter(L=>{const I=L.target;return!L.button&&(!n||!ZM(I,`.${n}`,t))&&(!r||ZM(I,r,t))});return T.call(q),()=>{T.on(".drag",null)}}}},[t,e,n,r,i,l,s,a,C]),c}function UH(){const t=Gr();return b.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:i,getNodes:a,snapToGrid:l,snapGrid:c,onError:h,nodesDraggable:f}=t.getState(),m=a().filter(N=>N.selected&&(N.draggable||f&&typeof N.draggable>"u")),g=l?c[0]:5,x=l?c[1]:5,y=n.isShiftPressed?4:1,w=n.x*g*y,S=n.y*x*y,k=m.map(N=>{if(N.positionAbsolute){const C={x:N.positionAbsolute.x+w,y:N.positionAbsolute.y+S};l&&(C.x=c[0]*Math.round(C.x/c[0]),C.y=c[1]*Math.round(C.y/c[1]));const{positionAbsolute:T,position:_}=HH(N,C,r,s,void 0,h);N.position=_,N.positionAbsolute=T}return N});i(k,!0,!1)},[])}const ch={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var dm=t=>{const e=({id:n,type:r,data:s,xPos:i,yPos:a,xPosOrigin:l,yPosOrigin:c,selected:h,onClick:f,onMouseEnter:m,onMouseMove:g,onMouseLeave:x,onContextMenu:y,onDoubleClick:w,style:S,className:k,isDraggable:N,isSelectable:C,isConnectable:T,isFocusable:_,selectNodesOnDrag:E,sourcePosition:M,targetPosition:q,hidden:L,resizeObserver:I,dragHandle:$,zIndex:V,isParent:ee,noDragClassName:z,noPanClassName:H,initialized:P,disableKeyboardA11y:W,ariaLabel:J,rfId:X,hasHandleBounds:R})=>{const se=Gr(),G=b.useRef(null),F=b.useRef(null),U=b.useRef(M),te=b.useRef(q),ne=b.useRef(r),Y=C||N||f||m||g||x,ae=UH(),re=um(n,se.getState,m),oe=um(n,se.getState,g),_e=um(n,se.getState,x),Ge=um(n,se.getState,y),tt=um(n,se.getState,w),Xe=He=>{const{nodeDragThreshold:$e}=se.getState();if(C&&(!E||!N||$e>0)&&Sk({id:n,store:se,nodeRef:G}),f){const bt=se.getState().nodeInternals.get(n);bt&&f(He,{...bt})}},je=He=>{if(!xk(He)&&!W)if(pH.includes(He.key)&&C){const $e=He.key==="Escape";Sk({id:n,store:se,unselect:$e,nodeRef:G})}else N&&h&&Object.prototype.hasOwnProperty.call(ch,He.key)&&(se.setState({ariaLiveMessage:`Moved selected node ${He.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),ae({x:ch[He.key].x,y:ch[He.key].y,isShiftPressed:He.shiftKey}))};b.useEffect(()=>()=>{F.current&&(I?.unobserve(F.current),F.current=null)},[]),b.useEffect(()=>{if(G.current&&!L){const He=G.current;(!P||!R||F.current!==He)&&(F.current&&I?.unobserve(F.current),I?.observe(He),F.current=He)}},[L,P,R]),b.useEffect(()=>{const He=ne.current!==r,$e=U.current!==M,bt=te.current!==q;G.current&&(He||$e||bt)&&(He&&(ne.current=r),$e&&(U.current=M),bt&&(te.current=q),se.getState().updateNodeDimensions([{id:n,nodeElement:G.current,forceUpdate:!0}]))},[n,r,M,q]);const Qe=VH({nodeRef:G,disabled:L||!N,noDragClassName:z,handleSelector:$,nodeId:n,isSelectable:C,selectNodesOnDrag:E});return L?null:he.createElement("div",{className:gs(["react-flow__node",`react-flow__node-${r}`,{[H]:N},k,{selected:h,selectable:C,parent:ee,dragging:Qe}]),ref:G,style:{zIndex:V,transform:`translate(${l}px,${c}px)`,pointerEvents:Y?"all":"none",visibility:P?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:re,onMouseMove:oe,onMouseLeave:_e,onContextMenu:Ge,onClick:Xe,onDoubleClick:tt,onKeyDown:_?je:void 0,tabIndex:_?0:void 0,role:_?"button":void 0,"aria-describedby":W?void 0:`${zH}-${X}`,"aria-label":J},he.createElement(J3e,{value:n},he.createElement(t,{id:n,data:s,type:r,xPos:i,yPos:a,selected:h,isConnectable:T,sourcePosition:M,targetPosition:q,dragging:Qe,dragHandle:$,zIndex:V})))};return e.displayName="NodeWrapper",b.memo(e)};const qSe=t=>{const e=t.getNodes().filter(n=>n.selected);return{...Ty(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function FSe({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=Gr(),{width:s,height:i,x:a,y:l,transformString:c,userSelectionActive:h}=Xn(qSe,ts),f=UH(),m=b.useRef(null);if(b.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]),VH({nodeRef:m}),h||!s||!i)return null;const g=t?y=>{const w=r.getState().getNodes().filter(S=>S.selected);t(y,w)}:void 0,x=y=>{Object.prototype.hasOwnProperty.call(ch,y.key)&&f({x:ch[y.key].x,y:ch[y.key].y,isShiftPressed:y.shiftKey})};return he.createElement("div",{className:gs(["react-flow__nodesselection","react-flow__container",e]),style:{transform:c}},he.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:l,left:a}}))}var $Se=b.memo(FSe);const QSe=t=>t.nodesSelectionActive,WH=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,deleteKeyCode:l,onMove:c,onMoveStart:h,onMoveEnd:f,selectionKeyCode:m,selectionOnDrag:g,selectionMode:x,onSelectionStart:y,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:N,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:E,panOnScrollSpeed:M,panOnScrollMode:q,zoomOnDoubleClick:L,panOnDrag:I,defaultViewport:$,translateExtent:V,minZoom:ee,maxZoom:z,preventScrolling:H,onSelectionContextMenu:P,noWheelClassName:W,noPanClassName:J,disableKeyboardA11y:X})=>{const R=Xn(QSe),se=S0(m),G=S0(k),F=G||I,U=G||E,te=se||g&&F!==!0;return TSe({deleteKeyCode:l,multiSelectionKeyCode:S}),he.createElement(ASe,{onMove:c,onMoveStart:h,onMoveEnd:f,onPaneContextMenu:i,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:U,panOnScrollSpeed:M,panOnScrollMode:q,zoomOnDoubleClick:L,panOnDrag:!se&&F,defaultViewport:$,translateExtent:V,minZoom:ee,maxZoom:z,zoomActivationKeyCode:N,preventScrolling:H,noWheelClassName:W,noPanClassName:J},he.createElement($H,{onSelectionStart:y,onSelectionEnd:w,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:F,isSelecting:!!te,selectionMode:x},t,R&&he.createElement($Se,{onSelectionContextMenu:P,noPanClassName:J,disableKeyboardA11y:X})))};WH.displayName="FlowRenderer";var HSe=b.memo(WH);function VSe(t){return Xn(b.useCallback(n=>t?SH(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function USe(t){const e={input:dm(t.input||MH),default:dm(t.default||wk),output:dm(t.output||RH),group:dm(t.group||vj)},n={},r=Object.keys(t).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=dm(t[i]||wk),s),n);return{...e,...r}}const WSe=({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]},GSe=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),GH=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:i,onError:a}=Xn(GSe,ts),l=VSe(t.onlyRenderVisibleElements),c=b.useRef(),h=b.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 c.current=f,f},[]);return b.useEffect(()=>()=>{c?.current?.disconnect()},[]),he.createElement("div",{className:"react-flow__nodes",style:bj},l.map(f=>{let m=f.type||"default";t.nodeTypes[m]||(a?.("003",vl.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"),S=!!(f.focusable||r&&typeof f.focusable>"u"),k=t.nodeExtent?hj(f.positionAbsolute,t.nodeExtent):f.positionAbsolute,N=k?.x??0,C=k?.y??0,T=WSe({x:N,y:C,width:f.width??0,height:f.height??0,origin:t.nodeOrigin});return he.createElement(g,{key:f.id,id:f.id,className:f.className,style:f.style,type:m,data:f.data,sourcePosition:f.sourcePosition||ht.Bottom,targetPosition:f.targetPosition||ht.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:S,resizeObserver:h,dragHandle:f.dragHandle,zIndex:f[pr]?.z??0,isParent:!!f[pr]?.isParent,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!f.width&&!!f.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!f[pr]?.handleBounds})}))};GH.displayName="NodeRenderer";var XSe=b.memo(GH);const YSe=(t,e,n)=>n===ht.Left?t-e:n===ht.Right?t+e:t,KSe=(t,e,n)=>n===ht.Top?t-e:n===ht.Bottom?t+e:t,eA="react-flow__edgeupdater",tA=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:l})=>he.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:gs([eA,`${eA}-${l}`]),cx:YSe(e,r,t),cy:KSe(n,r,t),r,stroke:"transparent",fill:"transparent"}),ZSe=()=>!0;var Md=t=>{const e=({id:n,className:r,type:s,data:i,onClick:a,onEdgeDoubleClick:l,selected:c,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,style:S,source:k,target:N,sourceX:C,sourceY:T,targetX:_,targetY:E,sourcePosition:M,targetPosition:q,elementsSelectable:L,hidden:I,sourceHandleId:$,targetHandleId:V,onContextMenu:ee,onMouseEnter:z,onMouseMove:H,onMouseLeave:P,reconnectRadius:W,onReconnect:J,onReconnectStart:X,onReconnectEnd:R,markerEnd:se,markerStart:G,rfId:F,ariaLabel:U,isFocusable:te,isReconnectable:ne,pathOptions:Y,interactionWidth:ae,disableKeyboardA11y:re})=>{const oe=b.useRef(null),[_e,Ge]=b.useState(!1),[tt,Xe]=b.useState(!1),je=Gr(),Qe=b.useMemo(()=>`url('#${yk(G,F)}')`,[G,F]),He=b.useMemo(()=>`url('#${yk(se,F)}')`,[se,F]);if(I)return null;const $e=jt=>{const{edges:Ne,addSelectedEdges:ie,unselectNodesAndEdges:xe,multiSelectionActive:Je}=je.getState(),dt=Ne.find(er=>er.id===n);dt&&(L&&(je.setState({nodesSelectionActive:!1}),dt.selected&&Je?(xe({nodes:[],edges:[dt]}),oe.current?.blur()):ie([n])),a&&a(jt,dt))},bt=cm(n,je.getState,l),ot=cm(n,je.getState,ee),on=cm(n,je.getState,z),Tn=cm(n,je.getState,H),Nn=cm(n,je.getState,P),Rt=(jt,Ne)=>{if(jt.button!==0)return;const{edges:ie,isValidConnection:xe}=je.getState(),Je=Ne?N:k,dt=(Ne?V:$)||null,er=Ne?"target":"source",pt=xe||ZSe,vn=Ne,vt=ie.find(lt=>lt.id===n);Xe(!0),X?.(jt,vt,er);const Wt=lt=>{Xe(!1),R?.(lt,vt,er)};CH({event:jt,handleId:dt,nodeId:Je,onConnect:lt=>J?.(vt,lt),isTarget:vn,getState:je.getState,setState:je.setState,isValidConnection:pt,edgeUpdaterType:er,onReconnectEnd:Wt})},xt=jt=>Rt(jt,!0),Te=jt=>Rt(jt,!1),Re=()=>Ge(!0),qe=()=>Ge(!1),rt=!L&&!a,wt=jt=>{if(!re&&pH.includes(jt.key)&&L){const{unselectNodesAndEdges:Ne,addSelectedEdges:ie,edges:xe}=je.getState();jt.key==="Escape"?(oe.current?.blur(),Ne({edges:[xe.find(dt=>dt.id===n)]})):ie([n])}};return he.createElement("g",{className:gs(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:c,animated:h,inactive:rt,updating:_e}]),onClick:$e,onDoubleClick:bt,onContextMenu:ot,onMouseEnter:on,onMouseMove:Tn,onMouseLeave:Nn,onKeyDown:te?wt:void 0,tabIndex:te?0:void 0,role:te?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":U===null?void 0:U||`Edge from ${k} to ${N}`,"aria-describedby":te?`${PH}-${F}`:void 0,ref:oe},!tt&&he.createElement(t,{id:n,source:k,target:N,selected:c,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,data:i,style:S,sourceX:C,sourceY:T,targetX:_,targetY:E,sourcePosition:M,targetPosition:q,sourceHandleId:$,targetHandleId:V,markerStart:Qe,markerEnd:He,pathOptions:Y,interactionWidth:ae}),ne&&he.createElement(he.Fragment,null,(ne==="source"||ne===!0)&&he.createElement(tA,{position:M,centerX:C,centerY:T,radius:W,onMouseDown:xt,onMouseEnter:Re,onMouseOut:qe,type:"source"}),(ne==="target"||ne===!0)&&he.createElement(tA,{position:q,centerX:_,centerY:E,radius:W,onMouseDown:Te,onMouseEnter:Re,onMouseOut:qe,type:"target"})))};return e.displayName="EdgeWrapper",b.memo(e)};function JSe(t){const e={default:Md(t.default||gv),straight:Md(t.bezier||pj),step:Md(t.step||mj),smoothstep:Md(t.step||Cy),simplebezier:Md(t.simplebezier||fj)},n={},r=Object.keys(t).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=Md(t[i]||gv),s),n);return{...e,...r}}function nA(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 ht.Top:return{x:r+i/2,y:s};case ht.Right:return{x:r+i,y:s+a/2};case ht.Bottom:return{x:r+i/2,y:s+a};case ht.Left:return{x:r,y:s+a/2}}}function rA(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const eke=(t,e,n,r,s,i)=>{const a=nA(n,t,e),l=nA(i,r,s);return{sourceX:a.x,sourceY:a.y,targetX:l.x,targetY:l.y}};function tke({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:i,width:a,height:l,transform:c}){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=b0({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:a/c[2],height:l/c[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 sA(t){const e=t?.[pr]?.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 nke=[{level:0,isMaxLevel:!0,edges:[]}];function rke(t,e,n=!1){let r=-1;const s=t.reduce((a,l)=>{const c=Ji(l.zIndex);let h=c?l.zIndex:0;if(n){const f=e.get(l.target),m=e.get(l.source),g=l.selected||f?.selected||m?.selected,x=Math.max(m?.[pr]?.z||0,f?.[pr]?.z||0,1e3);h=(c?l.zIndex:0)+(g?x:0)}return a[h]?a[h].push(l):a[h]=[l],r=h>r?h:r,a},{}),i=Object.entries(s).map(([a,l])=>{const c=+a;return{edges:l,level:c,isMaxLevel:c===r}});return i.length===0?nke:i}function ske(t,e,n){const r=Xn(b.useCallback(s=>t?s.edges.filter(i=>{const a=e.get(i.source),l=e.get(i.target);return a?.width&&a?.height&&l?.width&&l?.height&&tke({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:l.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:l.width,targetHeight:l.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[t,e]));return rke(r,e,n)}const ike=({color:t="none",strokeWidth:e=1})=>he.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),ake=({color:t="none",strokeWidth:e=1})=>he.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),iA={[pv.Arrow]:ike,[pv.ArrowClosed]:ake};function oke(t){const e=Gr();return b.useMemo(()=>Object.prototype.hasOwnProperty.call(iA,t)?iA[t]:(e.getState().onError?.("009",vl.error009(t)),null),[t])}const lke=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=oke(e);return c?he.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0"},he.createElement(c,{color:n,strokeWidth:a})):null},cke=({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 l=yk(a,e);r.includes(l)||(s.push({id:l,color:a.color||t,...a}),r.push(l))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},XH=({defaultColor:t,rfId:e})=>{const n=Xn(b.useCallback(cke({defaultColor:t,rfId:e}),[t,e]),(r,s)=>!(r.length!==s.length||r.some((i,a)=>i.id!==s[a].id)));return he.createElement("defs",null,n.map(r=>he.createElement(lke,{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})))};XH.displayName="MarkerDefinitions";var uke=b.memo(XH);const dke=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}),YH=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:h,onEdgeClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,children:S,disableKeyboardA11y:k})=>{const{edgesFocusable:N,edgesUpdatable:C,elementsSelectable:T,width:_,height:E,connectionMode:M,nodeInternals:q,onError:L}=Xn(dke,ts),I=ske(e,q,n);return _?he.createElement(he.Fragment,null,I.map(({level:$,edges:V,isMaxLevel:ee})=>he.createElement("svg",{key:$,style:{zIndex:$},width:_,height:E,className:"react-flow__edges react-flow__container"},ee&&he.createElement(uke,{defaultColor:t,rfId:r}),he.createElement("g",null,V.map(z=>{const[H,P,W]=sA(q.get(z.source)),[J,X,R]=sA(q.get(z.target));if(!W||!R)return null;let se=z.type||"default";s[se]||(L?.("011",vl.error011(se)),se="default");const G=s[se]||s.default,F=M===Pu.Strict?X.target:(X.target??[]).concat(X.source??[]),U=rA(P.source,z.sourceHandle),te=rA(F,z.targetHandle),ne=U?.position||ht.Bottom,Y=te?.position||ht.Top,ae=!!(z.focusable||N&&typeof z.focusable>"u"),re=z.reconnectable||z.updatable,oe=typeof g<"u"&&(re||C&&typeof re>"u");if(!U||!te)return L?.("008",vl.error008(U,z)),null;const{sourceX:_e,sourceY:Ge,targetX:tt,targetY:Xe}=eke(H,U,ne,J,te,Y);return he.createElement(G,{key:z.id,id:z.id,className:gs([z.className,i]),type:se,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:_e,sourceY:Ge,targetX:tt,targetY:Xe,sourcePosition:ne,targetPosition:Y,elementsSelectable:T,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:h,onClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,rfId:r,ariaLabel:z.ariaLabel,isFocusable:ae,isReconnectable:oe,pathOptions:"pathOptions"in z?z.pathOptions:void 0,interactionWidth:z.interactionWidth,disableKeyboardA11y:k})})))),S):null};YH.displayName="EdgeRenderer";var hke=b.memo(YH);const fke=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function mke({children:t}){const e=Xn(fke);return he.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function pke(t){const e=yj(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const gke={[ht.Left]:ht.Right,[ht.Right]:ht.Left,[ht.Top]:ht.Bottom,[ht.Bottom]:ht.Top},KH=({nodeId:t,handleType:e,style:n,type:r=oc.Bezier,CustomComponent:s,connectionStatus:i})=>{const{fromNode:a,handleId:l,toX:c,toY:h,connectionMode:f}=Xn(b.useCallback(E=>({fromNode:E.nodeInternals.get(t),handleId:E.connectionHandleId,toX:(E.connectionPosition.x-E.transform[0])/E.transform[2],toY:(E.connectionPosition.y-E.transform[1])/E.transform[2],connectionMode:E.connectionMode}),[t]),ts),m=a?.[pr]?.handleBounds;let g=m?.[e];if(f===Pu.Loose&&(g=g||m?.[e==="source"?"target":"source"]),!a||!g)return null;const x=l?g.find(E=>E.id===l):g[0],y=x?x.x+x.width/2:(a.width??0)/2,w=x?x.y+x.height/2:a.height??0,S=(a.positionAbsolute?.x??0)+y,k=(a.positionAbsolute?.y??0)+w,N=x?.position,C=N?gke[N]:null;if(!N||!C)return null;if(s)return he.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:x,fromX:S,fromY:k,toX:c,toY:h,fromPosition:N,toPosition:C,connectionStatus:i});let T="";const _={sourceX:S,sourceY:k,sourcePosition:N,targetX:c,targetY:h,targetPosition:C};return r===oc.Bezier?[T]=bH(_):r===oc.Step?[T]=vk({..._,borderRadius:0}):r===oc.SmoothStep?[T]=vk(_):r===oc.SimpleBezier?[T]=yH(_):T=`M${S},${k} ${c},${h}`,he.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:n})};KH.displayName="ConnectionLine";const xke=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function vke({containerStyle:t,style:e,type:n,component:r}){const{nodeId:s,handleType:i,nodesConnectable:a,width:l,height:c,connectionStatus:h}=Xn(xke,ts);return!(s&&i&&l&&a)?null:he.createElement("svg",{style:t,width:l,height:c,className:"react-flow__edges react-flow__connectionline react-flow__container"},he.createElement("g",{className:gs(["react-flow__connection",h])},he.createElement(KH,{nodeId:s,handleType:i,style:e,type:n,CustomComponent:r,connectionStatus:h})))}function aA(t,e){return b.useRef(null),Gr(),b.useMemo(()=>e(t),[t])}const ZH=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:i,onNodeClick:a,onEdgeClick:l,onNodeDoubleClick:c,onEdgeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,onSelectionContextMenu:y,onSelectionStart:w,onSelectionEnd:S,connectionLineType:k,connectionLineStyle:N,connectionLineComponent:C,connectionLineContainerStyle:T,selectionKeyCode:_,selectionOnDrag:E,selectionMode:M,multiSelectionKeyCode:q,panActivationKeyCode:L,zoomActivationKeyCode:I,deleteKeyCode:$,onlyRenderVisibleElements:V,elementsSelectable:ee,selectNodesOnDrag:z,defaultViewport:H,translateExtent:P,minZoom:W,maxZoom:J,preventScrolling:X,defaultMarkerColor:R,zoomOnScroll:se,zoomOnPinch:G,panOnScroll:F,panOnScrollSpeed:U,panOnScrollMode:te,zoomOnDoubleClick:ne,panOnDrag:Y,onPaneClick:ae,onPaneMouseEnter:re,onPaneMouseMove:oe,onPaneMouseLeave:_e,onPaneScroll:Ge,onPaneContextMenu:tt,onEdgeContextMenu:Xe,onEdgeMouseEnter:je,onEdgeMouseMove:Qe,onEdgeMouseLeave:He,onReconnect:$e,onReconnectStart:bt,onReconnectEnd:ot,reconnectRadius:on,noDragClassName:Tn,noWheelClassName:Nn,noPanClassName:Rt,elevateEdgesOnSelect:xt,disableKeyboardA11y:Te,nodeOrigin:Re,nodeExtent:qe,rfId:rt})=>{const wt=aA(t,USe),jt=aA(e,JSe);return pke(i),he.createElement(HSe,{onPaneClick:ae,onPaneMouseEnter:re,onPaneMouseMove:oe,onPaneMouseLeave:_e,onPaneContextMenu:tt,onPaneScroll:Ge,deleteKeyCode:$,selectionKeyCode:_,selectionOnDrag:E,selectionMode:M,onSelectionStart:w,onSelectionEnd:S,multiSelectionKeyCode:q,panActivationKeyCode:L,zoomActivationKeyCode:I,elementsSelectable:ee,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:se,zoomOnPinch:G,zoomOnDoubleClick:ne,panOnScroll:F,panOnScrollSpeed:U,panOnScrollMode:te,panOnDrag:Y,defaultViewport:H,translateExtent:P,minZoom:W,maxZoom:J,onSelectionContextMenu:y,preventScrolling:X,noDragClassName:Tn,noWheelClassName:Nn,noPanClassName:Rt,disableKeyboardA11y:Te},he.createElement(mke,null,he.createElement(hke,{edgeTypes:jt,onEdgeClick:l,onEdgeDoubleClick:h,onlyRenderVisibleElements:V,onEdgeContextMenu:Xe,onEdgeMouseEnter:je,onEdgeMouseMove:Qe,onEdgeMouseLeave:He,onReconnect:$e,onReconnectStart:bt,onReconnectEnd:ot,reconnectRadius:on,defaultMarkerColor:R,noPanClassName:Rt,elevateEdgesOnSelect:!!xt,disableKeyboardA11y:Te,rfId:rt},he.createElement(vke,{style:N,type:k,component:C,containerStyle:T})),he.createElement("div",{className:"react-flow__edgelabel-renderer"}),he.createElement(XSe,{nodeTypes:wt,onNodeClick:a,onNodeDoubleClick:c,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,selectNodesOnDrag:z,onlyRenderVisibleElements:V,noPanClassName:Rt,noDragClassName:Tn,disableKeyboardA11y:Te,nodeOrigin:Re,nodeExtent:qe,rfId:rt})))};ZH.displayName="GraphView";var yke=b.memo(ZH);const kk=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Jl={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:kk,nodeExtent:kk,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Pu.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:W3e,isValidConnection:void 0},bke=()=>Dwe((t,e)=>({...Jl,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:i}=e();t({nodeInternals:_4(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?_4(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:l,domNode:c,nodeOrigin:h}=e(),f=c?.querySelector(".react-flow__viewport");if(!f)return;const m=window.getComputedStyle(f),{m22:g}=new window.DOMMatrixReadOnly(m.transform),x=n.reduce((w,S)=>{const k=s.get(S.id);if(k?.hidden)s.set(k.id,{...k,[pr]:{...k[pr],handleBounds:void 0}});else if(k){const N=dj(S.nodeElement);!!(N.width&&N.height&&(k.width!==N.width||k.height!==N.height||S.forceUpdate))&&(s.set(k.id,{...k,[pr]:{...k[pr],handleBounds:{source:JM(".source",S.nodeElement,g,h),target:JM(".target",S.nodeElement,g,h)}},...N}),w.push({id:k.id,type:"dimensions",dimensions:N}))}return w},[]);IH(s,h);const y=a||i&&!a&&BH(e,{initial:!0,...l});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(l=>{const c={id:l.id,type:"position",dragging:s};return r&&(c.positionAbsolute=l.positionAbsolute,c.position=l.position),c});i(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:a,getNodes:l,elevateNodesOnSelect:c}=e();if(n?.length){if(i){const h=FH(n,l()),f=_4(h,s,a,c);t({nodeInternals:f})}r?.(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,l=null;r?a=n.map(c=>ic(c,!0)):(a=Wd(i(),n),l=Wd(s,[])),Lx({changedNodes:a,changedEdges:l,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,l=null;r?a=n.map(c=>ic(c,!0)):(a=Wd(s,n),l=Wd(i(),[])),Lx({changedNodes:l,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:i}=e(),a=n||i(),l=r||s,c=a.map(f=>(f.selected=!1,ic(f.id,!1))),h=l.map(f=>ic(f.id,!1));Lx({changedNodes:c,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(l=>l.selected).map(l=>ic(l.id,!1)),a=n.filter(l=>l.selected).map(l=>ic(l.id,!1));Lx({changedNodes:i,changedEdges:a,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(s=>{s.positionAbsolute=hj(s.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:i,d3Zoom:a,d3Selection:l,translateExtent:c}=e();if(!a||!l||!n.x&&!n.y)return!1;const h=ol.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),f=[[0,0],[s,i]],m=a?.constrain()(h,f,c);return a.transform(l,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>t({connectionNodeId:Jl.connectionNodeId,connectionHandleId:Jl.connectionHandleId,connectionHandleType:Jl.connectionHandleType,connectionStatus:Jl.connectionStatus,connectionStartHandle:Jl.connectionStartHandle,connectionEndHandle:Jl.connectionEndHandle}),reset:()=>t({...Jl})}),Object.is),JH=({children:t})=>{const e=b.useRef(null);return e.current||(e.current=bke()),he.createElement(q3e,{value:e.current},t)};JH.displayName="ReactFlowProvider";const eV=({children:t})=>b.useContext(jy)?he.createElement(he.Fragment,null,t):he.createElement(JH,null,t);eV.displayName="ReactFlowWrapper";const wke={input:MH,default:wk,output:RH,group:vj},Ske={default:gv,straight:pj,step:mj,smoothstep:Cy,simplebezier:fj},kke=[0,0],Oke=[15,15],jke={x:0,y:0,zoom:1},Nke={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},tV=b.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i=wke,edgeTypes:a=Ske,onNodeClick:l,onEdgeClick:c,onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:_,onNodeDoubleClick:E,onNodeDragStart:M,onNodeDrag:q,onNodeDragStop:L,onNodesDelete:I,onEdgesDelete:$,onSelectionChange:V,onSelectionDragStart:ee,onSelectionDrag:z,onSelectionDragStop:H,onSelectionContextMenu:P,onSelectionStart:W,onSelectionEnd:J,connectionMode:X=Pu.Strict,connectionLineType:R=oc.Bezier,connectionLineStyle:se,connectionLineComponent:G,connectionLineContainerStyle:F,deleteKeyCode:U="Backspace",selectionKeyCode:te="Shift",selectionOnDrag:ne=!1,selectionMode:Y=w0.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:re=mv()?"Meta":"Control",zoomActivationKeyCode:oe=mv()?"Meta":"Control",snapToGrid:_e=!1,snapGrid:Ge=Oke,onlyRenderVisibleElements:tt=!1,selectNodesOnDrag:Xe=!0,nodesDraggable:je,nodesConnectable:Qe,nodesFocusable:He,nodeOrigin:$e=kke,edgesFocusable:bt,edgesUpdatable:ot,elementsSelectable:on,defaultViewport:Tn=jke,minZoom:Nn=.5,maxZoom:Rt=2,translateExtent:xt=kk,preventScrolling:Te=!0,nodeExtent:Re,defaultMarkerColor:qe="#b1b1b7",zoomOnScroll:rt=!0,zoomOnPinch:wt=!0,panOnScroll:jt=!1,panOnScrollSpeed:Ne=.5,panOnScrollMode:ie=gu.Free,zoomOnDoubleClick:xe=!0,panOnDrag:Je=!0,onPaneClick:dt,onPaneMouseEnter:er,onPaneMouseMove:pt,onPaneMouseLeave:vn,onPaneScroll:vt,onPaneContextMenu:Wt,children:Ht,onEdgeContextMenu:lt,onEdgeDoubleClick:ur,onEdgeMouseEnter:Xr,onEdgeMouseMove:Yr,onEdgeMouseLeave:dr,onEdgeUpdate:Nr,onEdgeUpdateStart:Is,onEdgeUpdateEnd:xr,onReconnect:di,onReconnectStart:Ns,onReconnectEnd:Bs,reconnectRadius:da=10,edgeUpdaterRadius:ha=10,onNodesChange:hi,onEdgesChange:Ra,noDragClassName:qs="nodrag",noWheelClassName:Ir="nowheel",noPanClassName:ss="nopan",fitView:kl=!1,fitViewOptions:ef,connectOnClick:Dy=!0,attributionPosition:zy,proOptions:Sp,defaultEdgeOptions:Lc,elevateNodesOnSelect:tf=!0,elevateEdgesOnSelect:Ol=!1,disableKeyboardA11y:vo=!1,autoPanOnConnect:Ic=!0,autoPanOnNodeDrag:jl=!0,connectionRadius:Cr=20,isValidConnection:kp,onError:Op,style:yo,id:bo,nodeDragThreshold:Py,...jp},Np)=>{const nf=bo||"1";return he.createElement("div",{...jp,style:{...yo,...Nke},ref:Np,className:gs(["react-flow",s]),"data-testid":"rf__wrapper",id:bo},he.createElement(eV,null,he.createElement(yke,{onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:_,onNodeDoubleClick:E,nodeTypes:i,edgeTypes:a,connectionLineType:R,connectionLineStyle:se,connectionLineComponent:G,connectionLineContainerStyle:F,selectionKeyCode:te,selectionOnDrag:ne,selectionMode:Y,deleteKeyCode:U,multiSelectionKeyCode:re,panActivationKeyCode:ae,zoomActivationKeyCode:oe,onlyRenderVisibleElements:tt,selectNodesOnDrag:Xe,defaultViewport:Tn,translateExtent:xt,minZoom:Nn,maxZoom:Rt,preventScrolling:Te,zoomOnScroll:rt,zoomOnPinch:wt,zoomOnDoubleClick:xe,panOnScroll:jt,panOnScrollSpeed:Ne,panOnScrollMode:ie,panOnDrag:Je,onPaneClick:dt,onPaneMouseEnter:er,onPaneMouseMove:pt,onPaneMouseLeave:vn,onPaneScroll:vt,onPaneContextMenu:Wt,onSelectionContextMenu:P,onSelectionStart:W,onSelectionEnd:J,onEdgeContextMenu:lt,onEdgeDoubleClick:ur,onEdgeMouseEnter:Xr,onEdgeMouseMove:Yr,onEdgeMouseLeave:dr,onReconnect:di??Nr,onReconnectStart:Ns??Is,onReconnectEnd:Bs??xr,reconnectRadius:da??ha,defaultMarkerColor:qe,noDragClassName:qs,noWheelClassName:Ir,noPanClassName:ss,elevateEdgesOnSelect:Ol,rfId:nf,disableKeyboardA11y:vo,nodeOrigin:$e,nodeExtent:Re}),he.createElement(gSe,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,nodesDraggable:je,nodesConnectable:Qe,nodesFocusable:He,edgesFocusable:bt,edgesUpdatable:ot,elementsSelectable:on,elevateNodesOnSelect:tf,minZoom:Nn,maxZoom:Rt,nodeExtent:Re,onNodesChange:hi,onEdgesChange:Ra,snapToGrid:_e,snapGrid:Ge,connectionMode:X,translateExtent:xt,connectOnClick:Dy,defaultEdgeOptions:Lc,fitView:kl,fitViewOptions:ef,onNodesDelete:I,onEdgesDelete:$,onNodeDragStart:M,onNodeDrag:q,onNodeDragStop:L,onSelectionDrag:z,onSelectionDragStart:ee,onSelectionDragStop:H,noPanClassName:ss,nodeOrigin:$e,rfId:nf,autoPanOnConnect:Ic,autoPanOnNodeDrag:jl,onError:Op,connectionRadius:Cr,isValidConnection:kp,nodeDragThreshold:Py}),he.createElement(mSe,{onSelectionChange:V}),Ht,he.createElement($3e,{proOptions:Sp,position:zy}),he.createElement(wSe,{rfId:nf,disableKeyboardA11y:vo})))});tV.displayName="ReactFlow";function nV(t){return e=>{const[n,r]=b.useState(e),s=b.useCallback(i=>r(a=>t(i,a)),[]);return[n,r,s]}}const Cke=nV(FH),Tke=nV(zSe),rV=({id:t,x:e,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:h,borderRadius:f,shapeRendering:m,onClick:g,selected:x})=>{const{background:y,backgroundColor:w}=i||{},S=a||y||w;return he.createElement("rect",{className:gs(["react-flow__minimap-node",{selected:x},h]),x:e,y:n,rx:f,ry:f,width:r,height:s,fill:S,stroke:l,strokeWidth:c,shapeRendering:m,onClick:g?k=>g(k,t):void 0})};rV.displayName="MiniMapNode";var Eke=b.memo(rV);const _ke=t=>t.nodeOrigin,Mke=t=>t.getNodes().filter(e=>!e.hidden&&e.width&&e.height),D4=t=>t instanceof Function?t:()=>t;function Ake({nodeStrokeColor:t="transparent",nodeColor:e="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:i=Eke,onClick:a}){const l=Xn(Mke,ts),c=Xn(_ke),h=D4(e),f=D4(t),m=D4(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return he.createElement(he.Fragment,null,l.map(x=>{const{x:y,y:w}=ku(x,c).positionAbsolute;return he.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 Rke=b.memo(Ake);const Dke=200,zke=150,Pke=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?V3e(Ty(e,t.nodeOrigin),n):n,rfId:t.rfId}},Lke="react-flow__minimap-desc";function sV({style:t,className:e,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a=2,nodeComponent:l,maskColor:c="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:S="React Flow mini map",inversePan:k=!1,zoomStep:N=10,offsetScale:C=5}){const T=Gr(),_=b.useRef(null),{boundingRect:E,viewBB:M,rfId:q}=Xn(Pke,ts),L=t?.width??Dke,I=t?.height??zke,$=E.width/L,V=E.height/I,ee=Math.max($,V),z=ee*L,H=ee*I,P=C*ee,W=E.x-(z-E.width)/2-P,J=E.y-(H-E.height)/2-P,X=z+P*2,R=H+P*2,se=`${Lke}-${q}`,G=b.useRef(0);G.current=ee,b.useEffect(()=>{if(_.current){const te=Gi(_.current),ne=re=>{const{transform:oe,d3Selection:_e,d3Zoom:Ge}=T.getState();if(re.sourceEvent.type!=="wheel"||!_e||!Ge)return;const tt=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*N,Xe=oe[2]*Math.pow(2,tt);Ge.scaleTo(_e,Xe)},Y=re=>{const{transform:oe,d3Selection:_e,d3Zoom:Ge,translateExtent:tt,width:Xe,height:je}=T.getState();if(re.sourceEvent.type!=="mousemove"||!_e||!Ge)return;const Qe=G.current*Math.max(1,oe[2])*(k?-1:1),He={x:oe[0]-re.sourceEvent.movementX*Qe,y:oe[1]-re.sourceEvent.movementY*Qe},$e=[[0,0],[Xe,je]],bt=ol.translate(He.x,He.y).scale(oe[2]),ot=Ge.constrain()(bt,$e,tt);Ge.transform(_e,ot)},ae=cH().on("zoom",y?Y:null).on("zoom.wheel",w?ne:null);return te.call(ae),()=>{te.on("zoom",null)}}},[y,w,k,N]);const F=g?te=>{const ne=ya(te);g(te,{x:ne[0],y:ne[1]})}:void 0,U=x?(te,ne)=>{const Y=T.getState().nodeInternals.get(ne);x(te,Y)}:void 0;return he.createElement(Ny,{position:m,style:t,className:gs(["react-flow__minimap",e]),"data-testid":"rf__minimap"},he.createElement("svg",{width:L,height:I,viewBox:`${W} ${J} ${X} ${R}`,role:"img","aria-labelledby":se,ref:_,onClick:F},S&&he.createElement("title",{id:se},S),he.createElement(Rke,{onClick:U,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),he.createElement("path",{className:"react-flow__minimap-mask",d:`M${W-P},${J-P}h${X+P*2}v${R+P*2}h${-X-P*2}z
M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fill:c,fillRule:"evenodd",stroke:h,strokeWidth:f,pointerEvents:"none"})))}sV.displayName="MiniMap";var Ike=b.memo(sV);function Bke(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},he.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function qke(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},he.createElement("path",{d:"M0 0h32v4.2H0z"}))}function Fke(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},he.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 $ke(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.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 Qke(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.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 ym=({children:t,className:e,...n})=>he.createElement("button",{type:"button",className:gs(["react-flow__controls-button",e]),...n},t);ym.displayName="ControlButton";const Hke=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),iV=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:h,children:f,position:m="bottom-left"})=>{const g=Gr(),[x,y]=b.useState(!1),{isInteractive:w,minZoomReached:S,maxZoomReached:k}=Xn(Hke,ts),{zoomIn:N,zoomOut:C,fitView:T}=yj();if(b.useEffect(()=>{y(!0)},[]),!x)return null;const _=()=>{N(),i?.()},E=()=>{C(),a?.()},M=()=>{T(s),l?.()},q=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),c?.(!w)};return he.createElement(Ny,{className:gs(["react-flow__controls",h]),position:m,style:t,"data-testid":"rf__controls"},e&&he.createElement(he.Fragment,null,he.createElement(ym,{onClick:_,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},he.createElement(Bke,null)),he.createElement(ym,{onClick:E,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},he.createElement(qke,null))),n&&he.createElement(ym,{className:"react-flow__controls-fitview",onClick:M,title:"fit view","aria-label":"fit view"},he.createElement(Fke,null)),r&&he.createElement(ym,{className:"react-flow__controls-interactive",onClick:q,title:"toggle interactivity","aria-label":"toggle interactivity"},w?he.createElement(Qke,null):he.createElement($ke,null)),f)};iV.displayName="Controls";var Vke=b.memo(iV),na;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(na||(na={}));function Uke({color:t,dimensions:e,lineWidth:n}){return he.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function Wke({color:t,radius:e}){return he.createElement("circle",{cx:e,cy:e,r:e,fill:t})}const Gke={[na.Dots]:"#91919a",[na.Lines]:"#eee",[na.Cross]:"#e2e2e2"},Xke={[na.Dots]:1,[na.Lines]:1,[na.Cross]:6},Yke=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function aV({id:t,variant:e=na.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=2,color:a,style:l,className:c}){const h=b.useRef(null),{transform:f,patternId:m}=Xn(Yke,ts),g=a||Gke[e],x=r||Xke[e],y=e===na.Dots,w=e===na.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*f[2]||1,S[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 he.createElement("svg",{className:gs(["react-flow__background",c]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:h,"data-testid":"rf__background"},he.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?he.createElement(Wke,{color:g,radius:N/i}):he.createElement(Uke,{dimensions:C,color:g,lineWidth:s})),he.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+t})`}))}aV.displayName="Background";var Kke=b.memo(aV);function wj(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 z4,oA;function Zke(){if(oA)return z4;oA=1;var t=fD(),e=4;function n(r){return t(r,e)}return z4=n,z4}var P4,lA;function oV(){if(lA)return P4;lA=1;var t=mY();function e(n){return typeof n=="function"?n:t}return P4=e,P4}var L4,cA;function lV(){if(cA)return L4;cA=1;var t=mD(),e=Ak(),n=oV(),r=Lu();function s(i,a){var l=r(i)?t:e;return l(i,n(a))}return L4=s,L4}var I4,uA;function cV(){return uA||(uA=1,I4=lV()),I4}var B4,dA;function Jke(){if(dA)return B4;dA=1;var t=Ak();function e(n,r){var s=[];return t(n,function(i,a,l){r(i,a,l)&&s.push(i)}),s}return B4=e,B4}var q4,hA;function uV(){if(hA)return q4;hA=1;var t=pY(),e=Jke(),n=Rk(),r=Lu();function s(i,a){var l=r(i)?t:e;return l(i,n(a,3))}return q4=s,q4}var F4,fA;function e6e(){if(fA)return F4;fA=1;var t=Object.prototype,e=t.hasOwnProperty;function n(r,s){return r!=null&&e.call(r,s)}return F4=n,F4}var $4,mA;function dV(){if(mA)return $4;mA=1;var t=e6e(),e=gY();function n(r,s){return r!=null&&e(r,s,t)}return $4=n,$4}var Q4,pA;function t6e(){if(pA)return Q4;pA=1;var t=pD(),e=gD(),n=xD(),r=Lu(),s=Dk(),i=zk(),a=xY(),l=Pk(),c="[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)||l(x)||n(x)))return!x.length;var y=e(x);if(y==c||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 Q4=g,Q4}var H4,gA;function hV(){if(gA)return H4;gA=1;function t(e){return e===void 0}return H4=t,H4}var V4,xA;function n6e(){if(xA)return V4;xA=1;function t(e,n,r,s){var i=-1,a=e==null?0:e.length;for(s&&a&&(r=e[++i]);++i<a;)r=n(r,e[i],i,e);return r}return V4=t,V4}var U4,vA;function r6e(){if(vA)return U4;vA=1;function t(e,n,r,s,i){return i(e,function(a,l,c){r=s?(s=!1,a):n(r,a,l,c)}),r}return U4=t,U4}var W4,yA;function fV(){if(yA)return W4;yA=1;var t=n6e(),e=Ak(),n=Rk(),r=r6e(),s=Lu();function i(a,l,c){var h=s(a)?t:r,f=arguments.length<3;return h(a,n(l,4),c,f,e)}return W4=i,W4}var G4,bA;function s6e(){if(bA)return G4;bA=1;var t=vY(),e=t("length");return G4=e,G4}var X4,wA;function i6e(){if(wA)return X4;wA=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=e+n+r,i="\\ufe0e\\ufe0f",a="["+t+"]",l="["+s+"]",c="\\ud83c[\\udffb-\\udfff]",h="(?:"+l+"|"+c+")",f="[^"+t+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",x="\\u200d",y=h+"?",w="["+i+"]?",S="(?:"+x+"(?:"+[f,m,g].join("|")+")"+w+y+")*",k=w+y+S,N="(?:"+[f+l+"?",l,m,g,a].join("|")+")",C=RegExp(c+"(?="+c+")|"+N+k,"g");function T(_){for(var E=C.lastIndex=0;C.test(_);)++E;return E}return X4=T,X4}var Y4,SA;function a6e(){if(SA)return Y4;SA=1;var t=s6e(),e=yY(),n=i6e();function r(s){return e(s)?n(s):t(s)}return Y4=r,Y4}var K4,kA;function o6e(){if(kA)return K4;kA=1;var t=pD(),e=gD(),n=Dk(),r=bY(),s=a6e(),i="[object Map]",a="[object Set]";function l(c){if(c==null)return 0;if(n(c))return r(c)?s(c):c.length;var h=e(c);return h==i||h==a?c.size:t(c).length}return K4=l,K4}var Z4,OA;function l6e(){if(OA)return Z4;OA=1;var t=mD(),e=wY(),n=SY(),r=Rk(),s=kY(),i=Lu(),a=zk(),l=Lk(),c=bv(),h=Pk();function f(m,g,x){var y=i(m),w=y||a(m)||h(m);if(g=r(g,4),x==null){var S=m&&m.constructor;w?x=y?new S:[]:c(m)?x=l(S)?e(s(m)):{}:x={}}return(w?t:n)(m,function(k,N,C){return g(x,k,N,C)}),x}return Z4=f,Z4}var J4,jA;function mV(){if(jA)return J4;jA=1;var t=Dk(),e=OY();function n(r){return e(r)&&t(r)}return J4=n,J4}var e5,NA;function c6e(){if(NA)return e5;NA=1;var t=jY(),e=Ik(),n=NY(),r=mV(),s=e(function(i){return n(t(i,1,r,!0))});return e5=s,e5}var t5,CA;function u6e(){if(CA)return t5;CA=1;var t=CY();function e(n,r){return t(r,function(s){return n[s]})}return t5=e,t5}var n5,TA;function pV(){if(TA)return n5;TA=1;var t=u6e(),e=vD();function n(r){return r==null?[]:t(r,e(r))}return n5=n,n5}var r5,EA;function ua(){if(EA)return r5;EA=1;var t;if(typeof wj=="function")try{t={clone:Zke(),constant:bD(),each:cV(),filter:uV(),has:dV(),isArray:Lu(),isEmpty:t6e(),isFunction:Lk(),isUndefined:hV(),keys:vD(),map:yD(),reduce:fV(),size:o6e(),transform:l6e(),union:c6e(),values:pV()}}catch{}return t||(t=window._),r5=t,r5}var s5,_A;function Sj(){if(_A)return s5;_A=1;var t=ua();s5=s;var e="\0",n="\0",r="";function s(f){this._isDirected=t.has(f,"directed")?f.directed:!0,this._isMultigraph=t.has(f,"multigraph")?f.multigraph:!1,this._isCompound=t.has(f,"compound")?f.compound:!1,this._label=void 0,this._defaultNodeLabelFn=t.constant(void 0),this._defaultEdgeLabelFn=t.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}s.prototype._nodeCount=0,s.prototype._edgeCount=0,s.prototype.isDirected=function(){return this._isDirected},s.prototype.isMultigraph=function(){return this._isMultigraph},s.prototype.isCompound=function(){return this._isCompound},s.prototype.setGraph=function(f){return this._label=f,this},s.prototype.graph=function(){return this._label},s.prototype.setDefaultNodeLabel=function(f){return t.isFunction(f)||(f=t.constant(f)),this._defaultNodeLabelFn=f,this},s.prototype.nodeCount=function(){return this._nodeCount},s.prototype.nodes=function(){return t.keys(this._nodes)},s.prototype.sources=function(){var f=this;return t.filter(this.nodes(),function(m){return t.isEmpty(f._in[m])})},s.prototype.sinks=function(){var f=this;return t.filter(this.nodes(),function(m){return t.isEmpty(f._out[m])})},s.prototype.setNodes=function(f,m){var g=arguments,x=this;return t.each(f,function(y){g.length>1?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,S){f(S)&&m.setNode(S,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 S=g.parent(w);return S===void 0||m.hasNode(S)?(x[w]=S,S):S in x?x[S]:y(S)}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 S=l(this._isDirected,f,m,g);if(t.has(this._edgeLabels,S))return y&&(this._edgeLabels[S]=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[S]=y?x:this._defaultEdgeLabelFn(f,m,g);var k=c(this._isDirected,f,m,g);return f=k.v,m=k.w,Object.freeze(k),this._edgeObjs[S]=k,i(this._preds[m],f),i(this._sucs[f],m),this._in[m][S]=k,this._out[f][S]=k,this._edgeCount++,this},s.prototype.edge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):l(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]):l(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]):l(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 l(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var S=y;y=w,w=S}return y+r+w+r+(t.isUndefined(x)?e:x)}function c(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var S=y;y=w,w=S}var k={v:y,w};return x&&(k.name=x),k}function h(f,m){return l(f,m.v,m.w,m.name)}return s5}var i5,MA;function d6e(){return MA||(MA=1,i5="2.1.8"),i5}var a5,AA;function h6e(){return AA||(AA=1,a5={Graph:Sj(),version:d6e()}),a5}var o5,RA;function f6e(){if(RA)return o5;RA=1;var t=ua(),e=Sj();o5={write:n,read:i};function n(a){var l={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:r(a),edges:s(a)};return t.isUndefined(a.graph())||(l.value=t.clone(a.graph())),l}function r(a){return t.map(a.nodes(),function(l){var c=a.node(l),h=a.parent(l),f={v:l};return t.isUndefined(c)||(f.value=c),t.isUndefined(h)||(f.parent=h),f})}function s(a){return t.map(a.edges(),function(l){var c=a.edge(l),h={v:l.v,w:l.w};return t.isUndefined(l.name)||(h.name=l.name),t.isUndefined(c)||(h.value=c),h})}function i(a){var l=new e(a.options).setGraph(a.value);return t.each(a.nodes,function(c){l.setNode(c.v,c.value),c.parent&&l.setParent(c.v,c.parent)}),t.each(a.edges,function(c){l.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),l}return o5}var l5,DA;function m6e(){if(DA)return l5;DA=1;var t=ua();l5=e;function e(n){var r={},s=[],i;function a(l){t.has(r,l)||(r[l]=!0,i.push(l),t.each(n.successors(l),a),t.each(n.predecessors(l),a))}return t.each(n.nodes(),function(l){i=[],a(l),i.length&&s.push(i)}),s}return l5}var c5,zA;function gV(){if(zA)return c5;zA=1;var t=ua();c5=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<r.length&&(a=r[s].priority<r[a].priority?s:a,i<r.length&&(a=r[i].priority<r[a].priority?i:a),a!==n&&(this._swap(n,a),this._heapify(a)))},e.prototype._decrease=function(n){for(var r=this._arr,s=r[n].priority,i;n!==0&&(i=n>>1,!(r[i].priority<s));)this._swap(n,i),n=i},e.prototype._swap=function(n,r){var s=this._arr,i=this._keyIndices,a=s[n],l=s[r];s[n]=l,s[r]=a,i[l.key]=n,i[a.key]=r},c5}var u5,PA;function xV(){if(PA)return u5;PA=1;var t=ua(),e=gV();u5=r;var n=t.constant(1);function r(i,a,l,c){return s(i,String(a),l||n,c||function(h){return i.outEdges(h)})}function s(i,a,l,c){var h={},f=new e,m,g,x=function(y){var w=y.v!==m?y.v:y.w,S=h[w],k=l(y),N=g.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+y+" Weight: "+k);N<S.distance&&(S.distance=N,S.predecessor=m,f.decrease(w,N))};for(i.nodes().forEach(function(y){var w=y===a?0:Number.POSITIVE_INFINITY;h[y]={distance:w},f.add(y,w)});f.size()>0&&(m=f.removeMin(),g=h[m],g.distance!==Number.POSITIVE_INFINITY);)c(m).forEach(x);return h}return u5}var d5,LA;function p6e(){if(LA)return d5;LA=1;var t=xV(),e=ua();d5=n;function n(r,s,i){return e.transform(r.nodes(),function(a,l){a[l]=t(r,l,s,i)},{})}return d5}var h5,IA;function vV(){if(IA)return h5;IA=1;var t=ua();h5=e;function e(n){var r=0,s=[],i={},a=[];function l(c){var h=i[c]={onStack:!0,lowlink:r,index:r++};if(s.push(c),n.successors(c).forEach(function(g){t.has(i,g)?i[g].onStack&&(h.lowlink=Math.min(h.lowlink,i[g].index)):(l(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(c!==m);a.push(f)}}return n.nodes().forEach(function(c){t.has(i,c)||l(c)}),a}return h5}var f5,BA;function g6e(){if(BA)return f5;BA=1;var t=ua(),e=vV();f5=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 f5}var m5,qA;function x6e(){if(qA)return m5;qA=1;var t=ua();m5=n;var e=t.constant(1);function n(s,i,a){return r(s,i||e,a||function(l){return s.outEdges(l)})}function r(s,i,a){var l={},c=s.nodes();return c.forEach(function(h){l[h]={},l[h][h]={distance:0},c.forEach(function(f){h!==f&&(l[h][f]={distance:Number.POSITIVE_INFINITY})}),a(h).forEach(function(f){var m=f.v===h?f.w:f.v,g=i(f);l[h][m]={distance:g,predecessor:h}})}),c.forEach(function(h){var f=l[h];c.forEach(function(m){var g=l[m];c.forEach(function(x){var y=g[h],w=f[x],S=g[x],k=y.distance+w.distance;k<S.distance&&(S.distance=k,S.predecessor=w.predecessor)})})}),l}return m5}var p5,FA;function yV(){if(FA)return p5;FA=1;var t=ua();p5=e,e.CycleException=n;function e(r){var s={},i={},a=[];function l(c){if(t.has(i,c))throw new n;t.has(s,c)||(i[c]=!0,s[c]=!0,t.each(r.predecessors(c),l),delete i[c],a.push(c))}if(t.each(r.sinks(),l),t.size(s)!==r.nodeCount())throw new n;return a}function n(){}return n.prototype=new Error,p5}var g5,$A;function v6e(){if($A)return g5;$A=1;var t=yV();g5=e;function e(n){try{t(n)}catch(r){if(r instanceof t.CycleException)return!1;throw r}return!0}return g5}var x5,QA;function bV(){if(QA)return x5;QA=1;var t=ua();x5=e;function e(r,s,i){t.isArray(s)||(s=[s]);var a=(r.isDirected()?r.successors:r.neighbors).bind(r),l=[],c={};return t.each(s,function(h){if(!r.hasNode(h))throw new Error("Graph does not have node: "+h);n(r,h,i==="post",c,a,l)}),l}function n(r,s,i,a,l,c){t.has(a,s)||(a[s]=!0,i||c.push(s),t.each(l(s),function(h){n(r,h,i,a,l,c)}),i&&c.push(s))}return x5}var v5,HA;function y6e(){if(HA)return v5;HA=1;var t=bV();v5=e;function e(n,r){return t(n,r,"post")}return v5}var y5,VA;function b6e(){if(VA)return y5;VA=1;var t=bV();y5=e;function e(n,r){return t(n,r,"pre")}return y5}var b5,UA;function w6e(){if(UA)return b5;UA=1;var t=ua(),e=Sj(),n=gV();b5=r;function r(s,i){var a=new e,l={},c=new n,h;function f(g){var x=g.v===h?g.w:g.v,y=c.priority(x);if(y!==void 0){var w=i(g);w<y&&(l[x]=h,c.decrease(x,w))}}if(s.nodeCount()===0)return a;t.each(s.nodes(),function(g){c.add(g,Number.POSITIVE_INFINITY),a.setNode(g)}),c.decrease(s.nodes()[0],0);for(var m=!1;c.size()>0;){if(h=c.removeMin(),t.has(l,h))a.setEdge(h,l[h]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(h).forEach(f)}return a}return b5}var w5,WA;function S6e(){return WA||(WA=1,w5={components:m6e(),dijkstra:xV(),dijkstraAll:p6e(),findCycles:g6e(),floydWarshall:x6e(),isAcyclic:v6e(),postorder:y6e(),preorder:b6e(),prim:w6e(),tarjan:vV(),topsort:yV()}),w5}var S5,GA;function k6e(){if(GA)return S5;GA=1;var t=h6e();return S5={Graph:t.Graph,json:f6e(),alg:S6e(),version:t.version},S5}var k5,XA;function Na(){if(XA)return k5;XA=1;var t;if(typeof wj=="function")try{t=k6e()}catch{}return t||(t=window.graphlib),k5=t,k5}var O5,YA;function O6e(){if(YA)return O5;YA=1;var t=fD(),e=1,n=4;function r(s){return t(s,e|n)}return O5=r,O5}var j5,KA;function j6e(){if(KA)return j5;KA=1;var t=Ik(),e=SD(),n=wD(),r=wv(),s=Object.prototype,i=s.hasOwnProperty,a=t(function(l,c){l=Object(l);var h=-1,f=c.length,m=f>2?c[2]:void 0;for(m&&n(c[0],c[1],m)&&(f=1);++h<f;)for(var g=c[h],x=r(g),y=-1,w=x.length;++y<w;){var S=x[y],k=l[S];(k===void 0||e(k,s[S])&&!i.call(l,S))&&(l[S]=g[S])}return l});return j5=a,j5}var N5,ZA;function N6e(){if(ZA)return N5;ZA=1;var t=kD(),e=oV(),n=wv();function r(s,i){return s==null?s:t(s,e(i),n)}return N5=r,N5}var C5,JA;function wV(){if(JA)return C5;JA=1;var t=TY(),e=SD();function n(r,s,i){(i!==void 0&&!e(r[s],i)||i===void 0&&!(s in r))&&t(r,s,i)}return C5=n,C5}var T5,eR;function SV(){if(eR)return T5;eR=1;function t(e,n){if(!(n==="constructor"&&typeof e[n]=="function")&&n!="__proto__")return e[n]}return T5=t,T5}var E5,tR;function C6e(){if(tR)return E5;tR=1;var t=EY(),e=wv();function n(r){return t(r,e(r))}return E5=n,E5}var _5,nR;function T6e(){if(nR)return _5;nR=1;var t=wV(),e=_Y(),n=MY(),r=DY(),s=AY(),i=xD(),a=Lu(),l=mV(),c=zk(),h=Lk(),f=bv(),m=RY(),g=Pk(),x=SV(),y=C6e();function w(S,k,N,C,T,_,E){var M=x(S,N),q=x(k,N),L=E.get(q);if(L){t(S,N,L);return}var I=_?_(M,q,N+"",S,k,E):void 0,$=I===void 0;if($){var V=a(q),ee=!V&&c(q),z=!V&&!ee&&g(q);I=q,V||ee||z?a(M)?I=M:l(M)?I=r(M):ee?($=!1,I=e(q,!0)):z?($=!1,I=n(q,!0)):I=[]:m(q)||i(q)?(I=M,i(M)?I=y(M):(!f(M)||h(M))&&(I=s(q))):$=!1}$&&(E.set(q,I),T(I,q,C,_,E),E.delete(q)),t(S,N,I)}return _5=w,_5}var M5,rR;function E6e(){if(rR)return M5;rR=1;var t=zY(),e=wV(),n=kD(),r=T6e(),s=bv(),i=wv(),a=SV();function l(c,h,f,m,g){c!==h&&n(h,function(x,y){if(g||(g=new t),s(x))r(c,h,y,f,l,m,g);else{var w=m?m(a(c,y),x,y+"",c,h,g):void 0;w===void 0&&(w=x),e(c,y,w)}},i)}return M5=l,M5}var A5,sR;function _6e(){if(sR)return A5;sR=1;var t=Ik(),e=wD();function n(r){return t(function(s,i){var a=-1,l=i.length,c=l>1?i[l-1]:void 0,h=l>2?i[2]:void 0;for(c=r.length>3&&typeof c=="function"?(l--,c):void 0,h&&e(i[0],i[1],h)&&(c=l<3?void 0:c,l=1),s=Object(s);++a<l;){var f=i[a];f&&r(s,f,a,c)}return s})}return A5=n,A5}var R5,iR;function M6e(){if(iR)return R5;iR=1;var t=E6e(),e=_6e(),n=e(function(r,s,i){t(r,s,i)});return R5=n,R5}var D5,aR;function A6e(){if(aR)return D5;aR=1;var t=OD(),e=jD(),n=PY(),r=bv(),s=LY();function i(a,l,c,h){if(!r(a))return a;l=e(l,a);for(var f=-1,m=l.length,g=m-1,x=a;x!=null&&++f<m;){var y=s(l[f]),w=c;if(y==="__proto__"||y==="constructor"||y==="prototype")return a;if(f!=g){var S=x[y];w=h?h(S,y,x):void 0,w===void 0&&(w=r(S)?S:n(l[f+1])?[]:{})}t(x,y,w),x=x[y]}return a}return D5=i,D5}var z5,oR;function R6e(){if(oR)return z5;oR=1;var t=IY(),e=A6e(),n=jD();function r(s,i,a){for(var l=-1,c=i.length,h={};++l<c;){var f=i[l],m=t(s,f);a(m,f)&&e(h,n(f,s),m)}return h}return z5=r,z5}var P5,lR;function D6e(){if(lR)return P5;lR=1;var t=R6e(),e=BY();function n(r,s){return t(r,s,function(i,a){return e(r,a)})}return P5=n,P5}var L5,cR;function z6e(){if(cR)return L5;cR=1;var t=D6e(),e=qY(),n=e(function(r,s){return r==null?{}:t(r,s)});return L5=n,L5}var I5,uR;function P6e(){if(uR)return I5;uR=1;var t=FY(),e=0;function n(r){var s=++e;return t(r)+s}return I5=n,I5}var B5,dR;function L6e(){if(dR)return B5;dR=1;function t(e,n,r){for(var s=-1,i=e.length,a=n.length,l={};++s<i;){var c=s<a?n[s]:void 0;r(l,e[s],c)}return l}return B5=t,B5}var q5,hR;function I6e(){if(hR)return q5;hR=1;var t=OD(),e=L6e();function n(r,s){return e(r||[],s||[],t)}return q5=n,q5}var F5,fR;function ir(){if(fR)return F5;fR=1;var t;if(typeof wj=="function")try{t={cloneDeep:O6e(),constant:bD(),defaults:j6e(),each:cV(),filter:uV(),find:KY(),flatten:YY(),forEach:lV(),forIn:N6e(),has:dV(),isUndefined:hV(),last:XY(),map:yD(),mapValues:GY(),max:WY(),merge:M6e(),min:UY(),minBy:VY(),now:HY(),pick:z6e(),range:QY(),reduce:fV(),sortBy:$Y(),uniqueId:P6e(),values:pV(),zipObject:I6e()}}catch{}return t||(t=window._),F5=t,F5}var $5,mR;function B6e(){if(mR)return $5;mR=1,$5=t;function t(){var r={};r._next=r._prev=r,this._sentinel=r}t.prototype.dequeue=function(){var r=this._sentinel,s=r._prev;if(s!==r)return e(s),s},t.prototype.enqueue=function(r){var s=this._sentinel;r._prev&&r._next&&e(r),r._next=s._next,s._next._prev=r,s._next=r,r._prev=s},t.prototype.toString=function(){for(var r=[],s=this._sentinel,i=s._prev;i!==s;)r.push(JSON.stringify(i,n)),i=i._prev;return"["+r.join(", ")+"]"};function e(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,s){if(r!=="_next"&&r!=="_prev")return s}return $5}var Q5,pR;function q6e(){if(pR)return Q5;pR=1;var t=ir(),e=Na().Graph,n=B6e();Q5=s;var r=t.constant(1);function s(h,f){if(h.nodeCount()<=1)return[];var m=l(h,f||r),g=i(m.graph,m.buckets,m.zeroIdx);return t.flatten(t.map(g,function(x){return h.outEdges(x.v,x.w)}),!0)}function i(h,f,m){for(var g=[],x=f[f.length-1],y=f[0],w;h.nodeCount();){for(;w=y.dequeue();)a(h,f,m,w);for(;w=x.dequeue();)a(h,f,m,w);if(h.nodeCount()){for(var S=f.length-2;S>0;--S)if(w=f[S].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 S=h.edge(w),k=h.node(w.v);x&&y.push({v:w.v,w:w.w}),k.out-=S,c(f,m,k)}),t.forEach(h.outEdges(g.v),function(w){var S=h.edge(w),k=w.w,N=h.node(k);N.in-=S,c(f,m,N)}),h.removeNode(g.v),y}function l(h,f){var m=new e,g=0,x=0;t.forEach(h.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),t.forEach(h.edges(),function(S){var k=m.edge(S.v,S.w)||0,N=f(S),C=k+N;m.setEdge(S.v,S.w,C),x=Math.max(x,m.node(S.v).out+=N),g=Math.max(g,m.node(S.w).in+=N)});var y=t.range(x+g+3).map(function(){return new n}),w=g+1;return t.forEach(m.nodes(),function(S){c(y,w,m.node(S))}),{graph:m,buckets:y,zeroIdx:w}}function c(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 Q5}var H5,gR;function F6e(){if(gR)return H5;gR=1;var t=ir(),e=q6e();H5={run:n,undo:s};function n(i){var a=i.graph().acyclicer==="greedy"?e(i,l(i)):r(i);t.forEach(a,function(c){var h=i.edge(c);i.removeEdge(c),h.forwardName=c.name,h.reversed=!0,i.setEdge(c.w,c.v,h,t.uniqueId("rev"))});function l(c){return function(h){return c.edge(h).weight}}}function r(i){var a=[],l={},c={};function h(f){t.has(c,f)||(c[f]=!0,l[f]=!0,t.forEach(i.outEdges(f),function(m){t.has(l,m.w)?a.push(m):h(m.w)}),delete l[f])}return t.forEach(i.nodes(),h),a}function s(i){t.forEach(i.edges(),function(a){var l=i.edge(a);if(l.reversed){i.removeEdge(a);var c=l.forwardName;delete l.reversed,delete l.forwardName,i.setEdge(a.w,a.v,l,c)}})}return H5}var V5,xR;function si(){if(xR)return V5;xR=1;var t=ir(),e=Na().Graph;V5={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:i,predecessorWeights:a,intersectRect:l,buildLayerMatrix:c,normalizeRanks:h,removeEmptyRanks:f,addBorderNode:m,maxRank:g,partition:x,time:y,notime:w};function n(S,k,N,C){var T;do T=t.uniqueId(C);while(S.hasNode(T));return N.dummy=k,S.setNode(T,N),T}function r(S){var k=new e().setGraph(S.graph());return t.forEach(S.nodes(),function(N){k.setNode(N,S.node(N))}),t.forEach(S.edges(),function(N){var C=k.edge(N.v,N.w)||{weight:0,minlen:1},T=S.edge(N);k.setEdge(N.v,N.w,{weight:C.weight+T.weight,minlen:Math.max(C.minlen,T.minlen)})}),k}function s(S){var k=new e({multigraph:S.isMultigraph()}).setGraph(S.graph());return t.forEach(S.nodes(),function(N){S.children(N).length||k.setNode(N,S.node(N))}),t.forEach(S.edges(),function(N){k.setEdge(N,S.edge(N))}),k}function i(S){var k=t.map(S.nodes(),function(N){var C={};return t.forEach(S.outEdges(N),function(T){C[T.w]=(C[T.w]||0)+S.edge(T).weight}),C});return t.zipObject(S.nodes(),k)}function a(S){var k=t.map(S.nodes(),function(N){var C={};return t.forEach(S.inEdges(N),function(T){C[T.v]=(C[T.v]||0)+S.edge(T).weight}),C});return t.zipObject(S.nodes(),k)}function l(S,k){var N=S.x,C=S.y,T=k.x-N,_=k.y-C,E=S.width/2,M=S.height/2;if(!T&&!_)throw new Error("Not possible to find intersection inside of the rectangle");var q,L;return Math.abs(_)*E>Math.abs(T)*M?(_<0&&(M=-M),q=M*T/_,L=M):(T<0&&(E=-E),q=E,L=E*_/T),{x:N+q,y:C+L}}function c(S){var k=t.map(t.range(g(S)+1),function(){return[]});return t.forEach(S.nodes(),function(N){var C=S.node(N),T=C.rank;t.isUndefined(T)||(k[T][C.order]=N)}),k}function h(S){var k=t.min(t.map(S.nodes(),function(N){return S.node(N).rank}));t.forEach(S.nodes(),function(N){var C=S.node(N);t.has(C,"rank")&&(C.rank-=k)})}function f(S){var k=t.min(t.map(S.nodes(),function(_){return S.node(_).rank})),N=[];t.forEach(S.nodes(),function(_){var E=S.node(_).rank-k;N[E]||(N[E]=[]),N[E].push(_)});var C=0,T=S.graph().nodeRankFactor;t.forEach(N,function(_,E){t.isUndefined(_)&&E%T!==0?--C:C&&t.forEach(_,function(M){S.node(M).rank+=C})})}function m(S,k,N,C){var T={width:0,height:0};return arguments.length>=4&&(T.rank=N,T.order=C),n(S,"border",T,k)}function g(S){return t.max(t.map(S.nodes(),function(k){var N=S.node(k).rank;if(!t.isUndefined(N))return N}))}function x(S,k){var N={lhs:[],rhs:[]};return t.forEach(S,function(C){k(C)?N.lhs.push(C):N.rhs.push(C)}),N}function y(S,k){var N=t.now();try{return k()}finally{console.log(S+" time: "+(t.now()-N)+"ms")}}function w(S,k){return k()}return V5}var U5,vR;function $6e(){if(vR)return U5;vR=1;var t=ir(),e=si();U5={run:n,undo:s};function n(i){i.graph().dummyChains=[],t.forEach(i.edges(),function(a){r(i,a)})}function r(i,a){var l=a.v,c=i.node(l).rank,h=a.w,f=i.node(h).rank,m=a.name,g=i.edge(a),x=g.labelRank;if(f!==c+1){i.removeEdge(a);var y,w,S;for(S=0,++c;c<f;++S,++c)g.points=[],w={width:0,height:0,edgeLabel:g,edgeObj:a,rank:c},y=e.addDummyNode(i,"edge",w,"_d"),c===x&&(w.width=g.width,w.height=g.height,w.dummy="edge-label",w.labelpos=g.labelpos),i.setEdge(l,y,{weight:g.weight},m),S===0&&i.graph().dummyChains.push(y),l=y;i.setEdge(l,h,{weight:g.weight},m)}}function s(i){t.forEach(i.graph().dummyChains,function(a){var l=i.node(a),c=l.edgeLabel,h;for(i.setEdge(l.edgeObj,c);l.dummy;)h=i.successors(a)[0],i.removeNode(a),c.points.push({x:l.x,y:l.y}),l.dummy==="edge-label"&&(c.x=l.x,c.y=l.y,c.width=l.width,c.height=l.height),a=h,l=i.node(a)})}return U5}var W5,yR;function xv(){if(yR)return W5;yR=1;var t=ir();W5={longestPath:e,slack:n};function e(r){var s={};function i(a){var l=r.node(a);if(t.has(s,a))return l.rank;s[a]=!0;var c=t.min(t.map(r.outEdges(a),function(h){return i(h.w)-r.edge(h).minlen}));return(c===Number.POSITIVE_INFINITY||c===void 0||c===null)&&(c=0),l.rank=c}t.forEach(r.sources(),i)}function n(r,s){return r.node(s.w).rank-r.node(s.v).rank-r.edge(s).minlen}return W5}var G5,bR;function kV(){if(bR)return G5;bR=1;var t=ir(),e=Na().Graph,n=xv().slack;G5=r;function r(l){var c=new e({directed:!1}),h=l.nodes()[0],f=l.nodeCount();c.setNode(h,{});for(var m,g;s(c,l)<f;)m=i(c,l),g=c.hasNode(m.v)?n(l,m):-n(l,m),a(c,l,g);return c}function s(l,c){function h(f){t.forEach(c.nodeEdges(f),function(m){var g=m.v,x=f===g?m.w:g;!l.hasNode(x)&&!n(c,m)&&(l.setNode(x,{}),l.setEdge(f,x,{}),h(x))})}return t.forEach(l.nodes(),h),l.nodeCount()}function i(l,c){return t.minBy(c.edges(),function(h){if(l.hasNode(h.v)!==l.hasNode(h.w))return n(c,h)})}function a(l,c,h){t.forEach(l.nodes(),function(f){c.node(f).rank+=h})}return G5}var X5,wR;function Q6e(){if(wR)return X5;wR=1;var t=ir(),e=kV(),n=xv().slack,r=xv().longestPath,s=Na().alg.preorder,i=Na().alg.postorder,a=si().simplify;X5=l,l.initLowLimValues=m,l.initCutValues=c,l.calcCutValue=f,l.leaveEdge=x,l.enterEdge=y,l.exchangeEdges=w;function l(C){C=a(C),r(C);var T=e(C);m(T),c(T,C);for(var _,E;_=x(T);)E=y(T,C,_),w(T,C,_,E)}function c(C,T){var _=i(C,C.nodes());_=_.slice(0,_.length-1),t.forEach(_,function(E){h(C,T,E)})}function h(C,T,_){var E=C.node(_),M=E.parent;C.edge(_,M).cutvalue=f(C,T,_)}function f(C,T,_){var E=C.node(_),M=E.parent,q=!0,L=T.edge(_,M),I=0;return L||(q=!1,L=T.edge(M,_)),I=L.weight,t.forEach(T.nodeEdges(_),function($){var V=$.v===_,ee=V?$.w:$.v;if(ee!==M){var z=V===q,H=T.edge($).weight;if(I+=z?H:-H,k(C,_,ee)){var P=C.edge(_,ee).cutvalue;I+=z?-P:P}}}),I}function m(C,T){arguments.length<2&&(T=C.nodes()[0]),g(C,{},1,T)}function g(C,T,_,E,M){var q=_,L=C.node(E);return T[E]=!0,t.forEach(C.neighbors(E),function(I){t.has(T,I)||(_=g(C,T,_,I,E))}),L.low=q,L.lim=_++,M?L.parent=M:delete L.parent,_}function x(C){return t.find(C.edges(),function(T){return C.edge(T).cutvalue<0})}function y(C,T,_){var E=_.v,M=_.w;T.hasEdge(E,M)||(E=_.w,M=_.v);var q=C.node(E),L=C.node(M),I=q,$=!1;q.lim>L.lim&&(I=L,$=!0);var V=t.filter(T.edges(),function(ee){return $===N(C,C.node(ee.v),I)&&$!==N(C,C.node(ee.w),I)});return t.minBy(V,function(ee){return n(T,ee)})}function w(C,T,_,E){var M=_.v,q=_.w;C.removeEdge(M,q),C.setEdge(E.v,E.w,{}),m(C),c(C,T),S(C,T)}function S(C,T){var _=t.find(C.nodes(),function(M){return!T.node(M).parent}),E=s(C,_);E=E.slice(1),t.forEach(E,function(M){var q=C.node(M).parent,L=T.edge(M,q),I=!1;L||(L=T.edge(q,M),I=!0),T.node(M).rank=T.node(q).rank+(I?L.minlen:-L.minlen)})}function k(C,T,_){return C.hasEdge(T,_)}function N(C,T,_){return _.low<=T.lim&&T.lim<=_.lim}return X5}var Y5,SR;function H6e(){if(SR)return Y5;SR=1;var t=xv(),e=t.longestPath,n=kV(),r=Q6e();Y5=s;function s(c){switch(c.graph().ranker){case"network-simplex":l(c);break;case"tight-tree":a(c);break;case"longest-path":i(c);break;default:l(c)}}var i=e;function a(c){e(c),n(c)}function l(c){r(c)}return Y5}var K5,kR;function V6e(){if(kR)return K5;kR=1;var t=ir();K5=e;function e(s){var i=r(s);t.forEach(s.graph().dummyChains,function(a){for(var l=s.node(a),c=l.edgeObj,h=n(s,i,c.v,c.w),f=h.path,m=h.lca,g=0,x=f[g],y=!0;a!==c.w;){if(l=s.node(a),y){for(;(x=f[g])!==m&&s.node(x).maxRank<l.rank;)g++;x===m&&(y=!1)}if(!y){for(;g<f.length-1&&s.node(x=f[g+1]).minRank<=l.rank;)g++;x=f[g]}s.setParent(a,x),a=s.successors(a)[0]}})}function n(s,i,a,l){var c=[],h=[],f=Math.min(i[a].low,i[l].low),m=Math.max(i[a].lim,i[l].lim),g,x;g=a;do g=s.parent(g),c.push(g);while(g&&(i[g].low>f||m>i[g].lim));for(x=g,g=l;(g=s.parent(g))!==x;)h.push(g);return{path:c.concat(h.reverse()),lca:x}}function r(s){var i={},a=0;function l(c){var h=a;t.forEach(s.children(c),l),i[c]={low:h,lim:a++}}return t.forEach(s.children(),l),i}return K5}var Z5,OR;function U6e(){if(OR)return Z5;OR=1;var t=ir(),e=si();Z5={run:n,cleanup:a};function n(l){var c=e.addDummyNode(l,"root",{},"_root"),h=s(l),f=t.max(t.values(h))-1,m=2*f+1;l.graph().nestingRoot=c,t.forEach(l.edges(),function(x){l.edge(x).minlen*=m});var g=i(l)+1;t.forEach(l.children(),function(x){r(l,c,m,g,f,h,x)}),l.graph().nodeRankFactor=m}function r(l,c,h,f,m,g,x){var y=l.children(x);if(!y.length){x!==c&&l.setEdge(c,x,{weight:0,minlen:h});return}var w=e.addBorderNode(l,"_bt"),S=e.addBorderNode(l,"_bb"),k=l.node(x);l.setParent(w,x),k.borderTop=w,l.setParent(S,x),k.borderBottom=S,t.forEach(y,function(N){r(l,c,h,f,m,g,N);var C=l.node(N),T=C.borderTop?C.borderTop:N,_=C.borderBottom?C.borderBottom:N,E=C.borderTop?f:2*f,M=T!==_?1:m-g[x]+1;l.setEdge(w,T,{weight:E,minlen:M,nestingEdge:!0}),l.setEdge(_,S,{weight:E,minlen:M,nestingEdge:!0})}),l.parent(x)||l.setEdge(c,w,{weight:0,minlen:m+g[x]})}function s(l){var c={};function h(f,m){var g=l.children(f);g&&g.length&&t.forEach(g,function(x){h(x,m+1)}),c[f]=m}return t.forEach(l.children(),function(f){h(f,1)}),c}function i(l){return t.reduce(l.edges(),function(c,h){return c+l.edge(h).weight},0)}function a(l){var c=l.graph();l.removeNode(c.nestingRoot),delete c.nestingRoot,t.forEach(l.edges(),function(h){var f=l.edge(h);f.nestingEdge&&l.removeEdge(h)})}return Z5}var J5,jR;function W6e(){if(jR)return J5;jR=1;var t=ir(),e=si();J5=n;function n(s){function i(a){var l=s.children(a),c=s.node(a);if(l.length&&t.forEach(l,i),t.has(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(var h=c.minRank,f=c.maxRank+1;h<f;++h)r(s,"borderLeft","_bl",a,c,h),r(s,"borderRight","_br",a,c,h)}}t.forEach(s.children(),i)}function r(s,i,a,l,c,h){var f={width:0,height:0,rank:h,borderType:i},m=c[i][h-1],g=e.addDummyNode(s,"border",f,a);c[i][h]=g,s.setParent(g,l),m&&s.setEdge(m,g,{weight:1})}return J5}var e3,NR;function G6e(){if(NR)return e3;NR=1;var t=ir();e3={adjust:e,undo:n};function e(h){var f=h.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&r(h)}function n(h){var f=h.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&i(h),(f==="lr"||f==="rl")&&(l(h),r(h))}function r(h){t.forEach(h.nodes(),function(f){s(h.node(f))}),t.forEach(h.edges(),function(f){s(h.edge(f))})}function s(h){var f=h.width;h.width=h.height,h.height=f}function i(h){t.forEach(h.nodes(),function(f){a(h.node(f))}),t.forEach(h.edges(),function(f){var m=h.edge(f);t.forEach(m.points,a),t.has(m,"y")&&a(m)})}function a(h){h.y=-h.y}function l(h){t.forEach(h.nodes(),function(f){c(h.node(f))}),t.forEach(h.edges(),function(f){var m=h.edge(f);t.forEach(m.points,c),t.has(m,"x")&&c(m)})}function c(h){var f=h.x;h.x=h.y,h.y=f}return e3}var t3,CR;function X6e(){if(CR)return t3;CR=1;var t=ir();t3=e;function e(n){var r={},s=t.filter(n.nodes(),function(h){return!n.children(h).length}),i=t.max(t.map(s,function(h){return n.node(h).rank})),a=t.map(t.range(i+1),function(){return[]});function l(h){if(!t.has(r,h)){r[h]=!0;var f=n.node(h);a[f.rank].push(h),t.forEach(n.successors(h),l)}}var c=t.sortBy(s,function(h){return n.node(h).rank});return t.forEach(c,l),a}return t3}var n3,TR;function Y6e(){if(TR)return n3;TR=1;var t=ir();n3=e;function e(r,s){for(var i=0,a=1;a<s.length;++a)i+=n(r,s[a-1],s[a]);return i}function n(r,s,i){for(var a=t.zipObject(i,t.map(i,function(g,x){return x})),l=t.flatten(t.map(s,function(g){return t.sortBy(t.map(r.outEdges(g),function(x){return{pos:a[x.w],weight:r.edge(x).weight}}),"pos")}),!0),c=1;c<i.length;)c<<=1;var h=2*c-1;c-=1;var f=t.map(new Array(h),function(){return 0}),m=0;return t.forEach(l.forEach(function(g){var x=g.pos+c;f[x]+=g.weight;for(var y=0;x>0;)x%2&&(y+=f[x+1]),x=x-1>>1,f[x]+=g.weight;m+=g.weight*y})),m}return n3}var r3,ER;function K6e(){if(ER)return r3;ER=1;var t=ir();r3=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(l,c){var h=n.edge(c),f=n.node(c.v);return{sum:l.sum+h.weight*f.order,weight:l.weight+h.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:s}})}return r3}var s3,_R;function Z6e(){if(_R)return s3;_R=1;var t=ir();s3=e;function e(s,i){var a={};t.forEach(s,function(c,h){var f=a[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:h};t.isUndefined(c.barycenter)||(f.barycenter=c.barycenter,f.weight=c.weight)}),t.forEach(i.edges(),function(c){var h=a[c.v],f=a[c.w];!t.isUndefined(h)&&!t.isUndefined(f)&&(f.indegree++,h.out.push(a[c.w]))});var l=t.filter(a,function(c){return!c.indegree});return n(l)}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 l(h){return function(f){f.in.push(h),--f.indegree===0&&s.push(f)}}for(;s.length;){var c=s.pop();i.push(c),t.forEach(c.in.reverse(),a(c)),t.forEach(c.out,l(c))}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,l=0;s.weight&&(a+=s.barycenter*s.weight,l+=s.weight),i.weight&&(a+=i.barycenter*i.weight,l+=i.weight),s.vs=i.vs.concat(s.vs),s.barycenter=a/l,s.weight=l,s.i=Math.min(i.i,s.i),i.merged=!0}return s3}var i3,MR;function J6e(){if(MR)return i3;MR=1;var t=ir(),e=si();i3=n;function n(i,a){var l=e.partition(i,function(w){return t.has(w,"barycenter")}),c=l.lhs,h=t.sortBy(l.rhs,function(w){return-w.i}),f=[],m=0,g=0,x=0;c.sort(s(!!a)),x=r(f,h,x),t.forEach(c,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,l){for(var c;a.length&&(c=t.last(a)).i<=l;)a.pop(),i.push(c.vs),l++;return l}function s(i){return function(a,l){return a.barycenter<l.barycenter?-1:a.barycenter>l.barycenter?1:i?l.i-a.i:a.i-l.i}}return i3}var a3,AR;function eOe(){if(AR)return a3;AR=1;var t=ir(),e=K6e(),n=Z6e(),r=J6e();a3=s;function s(l,c,h,f){var m=l.children(c),g=l.node(c),x=g?g.borderLeft:void 0,y=g?g.borderRight:void 0,w={};x&&(m=t.filter(m,function(_){return _!==x&&_!==y}));var S=e(l,m);t.forEach(S,function(_){if(l.children(_.v).length){var E=s(l,_.v,h,f);w[_.v]=E,t.has(E,"barycenter")&&a(_,E)}});var k=n(S,h);i(k,w);var N=r(k,f);if(x&&(N.vs=t.flatten([x,N.vs,y],!0),l.predecessors(x).length)){var C=l.node(l.predecessors(x)[0]),T=l.node(l.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(l,c){t.forEach(l,function(h){h.vs=t.flatten(h.vs.map(function(f){return c[f]?c[f].vs:f}),!0)})}function a(l,c){t.isUndefined(l.barycenter)?(l.barycenter=c.barycenter,l.weight=c.weight):(l.barycenter=(l.barycenter*l.weight+c.barycenter*c.weight)/(l.weight+c.weight),l.weight+=c.weight)}return a3}var o3,RR;function tOe(){if(RR)return o3;RR=1;var t=ir(),e=Na().Graph;o3=n;function n(s,i,a){var l=r(s),c=new e({compound:!0}).setGraph({root:l}).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)&&(c.setNode(h),c.setParent(h,m||l),t.forEach(s[a](h),function(g){var x=g.v===h?g.w:g.v,y=c.edge(x,h),w=t.isUndefined(y)?0:y.weight;c.setEdge(x,h,{weight:s.edge(g).weight+w})}),t.has(f,"minRank")&&c.setNode(h,{borderLeft:f.borderLeft[i],borderRight:f.borderRight[i]}))}),c}function r(s){for(var i;s.hasNode(i=t.uniqueId("_root")););return i}return o3}var l3,DR;function nOe(){if(DR)return l3;DR=1;var t=ir();l3=e;function e(n,r,s){var i={},a;t.forEach(s,function(l){for(var c=n.parent(l),h,f;c;){if(h=n.parent(c),h?(f=i[h],i[h]=c):(f=a,a=c),f&&f!==c){r.setEdge(f,c);return}c=h}})}return l3}var c3,zR;function rOe(){if(zR)return c3;zR=1;var t=ir(),e=X6e(),n=Y6e(),r=eOe(),s=tOe(),i=nOe(),a=Na().Graph,l=si();c3=c;function c(g){var x=l.maxRank(g),y=h(g,t.range(1,x+1),"inEdges"),w=h(g,t.range(x-1,-1,-1),"outEdges"),S=e(g);m(g,S);for(var k=Number.POSITIVE_INFINITY,N,C=0,T=0;T<4;++C,++T){f(C%2?y:w,C%4>=2),S=l.buildLayerMatrix(g);var _=n(g,S);_<k&&(T=0,N=t.cloneDeep(S),k=_)}m(g,N)}function h(g,x,y){return t.map(x,function(w){return s(g,w,y)})}function f(g,x){var y=new a;t.forEach(g,function(w){var S=w.graph().root,k=r(w,S,y,x);t.forEach(k.vs,function(N,C){w.node(N).order=C}),i(w,y,k.vs)})}function m(g,x){t.forEach(x,function(y){t.forEach(y,function(w,S){g.node(w).order=S})})}return c3}var u3,PR;function sOe(){if(PR)return u3;PR=1;var t=ir(),e=Na().Graph,n=si();u3={positionX:y,findType1Conflicts:r,findType2Conflicts:s,addConflict:a,hasConflict:l,verticalAlignment:c,horizontalCompaction:h,alignCoordinates:g,findSmallestWidthAlignment:m,balance:x};function r(k,N){var C={};function T(_,E){var M=0,q=0,L=_.length,I=t.last(E);return t.forEach(E,function($,V){var ee=i(k,$),z=ee?k.node(ee).order:L;(ee||$===I)&&(t.forEach(E.slice(q,V+1),function(H){t.forEach(k.predecessors(H),function(P){var W=k.node(P),J=W.order;(J<M||z<J)&&!(W.dummy&&k.node(H).dummy)&&a(C,P,H)})}),q=V+1,M=z)}),E}return t.reduce(N,T),C}function s(k,N){var C={};function T(E,M,q,L,I){var $;t.forEach(t.range(M,q),function(V){$=E[V],k.node($).dummy&&t.forEach(k.predecessors($),function(ee){var z=k.node(ee);z.dummy&&(z.order<L||z.order>I)&&a(C,ee,$)})})}function _(E,M){var q=-1,L,I=0;return t.forEach(M,function($,V){if(k.node($).dummy==="border"){var ee=k.predecessors($);ee.length&&(L=k.node(ee[0]).order,T(M,I,V,q,L),I=V,q=L)}T(M,I,M.length,L,E.length)}),M}return t.reduce(N,_),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 _=k[N];_||(k[N]=_={}),_[C]=!0}function l(k,N,C){if(N>C){var T=N;N=C,C=T}return t.has(k[N],C)}function c(k,N,C,T){var _={},E={},M={};return t.forEach(N,function(q){t.forEach(q,function(L,I){_[L]=L,E[L]=L,M[L]=I})}),t.forEach(N,function(q){var L=-1;t.forEach(q,function(I){var $=T(I);if($.length){$=t.sortBy($,function(P){return M[P]});for(var V=($.length-1)/2,ee=Math.floor(V),z=Math.ceil(V);ee<=z;++ee){var H=$[ee];E[I]===I&&L<M[H]&&!l(C,I,H)&&(E[H]=I,E[I]=_[I]=_[H],L=M[H])}}})}),{root:_,align:E}}function h(k,N,C,T,_){var E={},M=f(k,N,C,_),q=_?"borderLeft":"borderRight";function L(V,ee){for(var z=M.nodes(),H=z.pop(),P={};H;)P[H]?V(H):(P[H]=!0,z.push(H),z=z.concat(ee(H))),H=z.pop()}function I(V){E[V]=M.inEdges(V).reduce(function(ee,z){return Math.max(ee,E[z.v]+M.edge(z))},0)}function $(V){var ee=M.outEdges(V).reduce(function(H,P){return Math.min(H,E[P.w]-M.edge(P))},Number.POSITIVE_INFINITY),z=k.node(V);ee!==Number.POSITIVE_INFINITY&&z.borderType!==q&&(E[V]=Math.max(E[V],ee))}return L(I,M.predecessors.bind(M)),L($,M.successors.bind(M)),t.forEach(T,function(V){E[V]=E[C[V]]}),E}function f(k,N,C,T){var _=new e,E=k.graph(),M=w(E.nodesep,E.edgesep,T);return t.forEach(N,function(q){var L;t.forEach(q,function(I){var $=C[I];if(_.setNode($),L){var V=C[L],ee=_.edge(V,$);_.setEdge(V,$,Math.max(M(k,I,L),ee||0))}L=I})}),_}function m(k,N){return t.minBy(t.values(N),function(C){var T=Number.NEGATIVE_INFINITY,_=Number.POSITIVE_INFINITY;return t.forIn(C,function(E,M){var q=S(k,M)/2;T=Math.max(E+q,T),_=Math.min(E-q,_)}),T-_})}function g(k,N){var C=t.values(N),T=t.min(C),_=t.max(C);t.forEach(["u","d"],function(E){t.forEach(["l","r"],function(M){var q=E+M,L=k[q],I;if(L!==N){var $=t.values(L);I=M==="l"?T-t.min($):_-t.max($),I&&(k[q]=t.mapValues(L,function(V){return V+I}))}})})}function x(k,N){return t.mapValues(k.ul,function(C,T){if(N)return k[N.toLowerCase()][T];var _=t.sortBy(t.map(k,T));return(_[1]+_[2])/2})}function y(k){var N=n.buildLayerMatrix(k),C=t.merge(r(k,N),s(k,N)),T={},_;t.forEach(["u","d"],function(M){_=M==="u"?N:t.values(N).reverse(),t.forEach(["l","r"],function(q){q==="r"&&(_=t.map(_,function(V){return t.values(V).reverse()}));var L=(M==="u"?k.predecessors:k.successors).bind(k),I=c(k,_,C,L),$=h(k,_,I.root,I.align,q==="r");q==="r"&&($=t.mapValues($,function(V){return-V})),T[M+q]=$})});var E=m(k,T);return g(T,E),x(T,k.graph().align)}function w(k,N,C){return function(T,_,E){var M=T.node(_),q=T.node(E),L=0,I;if(L+=M.width/2,t.has(M,"labelpos"))switch(M.labelpos.toLowerCase()){case"l":I=-M.width/2;break;case"r":I=M.width/2;break}if(I&&(L+=C?I:-I),I=0,L+=(M.dummy?N:k)/2,L+=(q.dummy?N:k)/2,L+=q.width/2,t.has(q,"labelpos"))switch(q.labelpos.toLowerCase()){case"l":I=q.width/2;break;case"r":I=-q.width/2;break}return I&&(L+=C?I:-I),I=0,L}}function S(k,N){return k.node(N).width}return u3}var d3,LR;function iOe(){if(LR)return d3;LR=1;var t=ir(),e=si(),n=sOe().positionX;d3=r;function r(i){i=e.asNonCompoundGraph(i),s(i),t.forEach(n(i),function(a,l){i.node(l).x=a})}function s(i){var a=e.buildLayerMatrix(i),l=i.graph().ranksep,c=0;t.forEach(a,function(h){var f=t.max(t.map(h,function(m){return i.node(m).height}));t.forEach(h,function(m){i.node(m).y=c+f/2}),c+=f+l})}return d3}var h3,IR;function aOe(){if(IR)return h3;IR=1;var t=ir(),e=F6e(),n=$6e(),r=H6e(),s=si().normalizeRanks,i=V6e(),a=si().removeEmptyRanks,l=U6e(),c=W6e(),h=G6e(),f=rOe(),m=iOe(),g=si(),x=Na().Graph;h3=y;function y(U,te){var ne=te&&te.debugTiming?g.time:g.notime;ne("layout",function(){var Y=ne(" buildLayoutGraph",function(){return L(U)});ne(" runLayout",function(){w(Y,ne)}),ne(" updateInputGraph",function(){S(U,Y)})})}function w(U,te){te(" makeSpaceForEdgeLabels",function(){I(U)}),te(" removeSelfEdges",function(){X(U)}),te(" acyclic",function(){e.run(U)}),te(" nestingGraph.run",function(){l.run(U)}),te(" rank",function(){r(g.asNonCompoundGraph(U))}),te(" injectEdgeLabelProxies",function(){$(U)}),te(" removeEmptyRanks",function(){a(U)}),te(" nestingGraph.cleanup",function(){l.cleanup(U)}),te(" normalizeRanks",function(){s(U)}),te(" assignRankMinMax",function(){V(U)}),te(" removeEdgeLabelProxies",function(){ee(U)}),te(" normalize.run",function(){n.run(U)}),te(" parentDummyChains",function(){i(U)}),te(" addBorderSegments",function(){c(U)}),te(" order",function(){f(U)}),te(" insertSelfEdges",function(){R(U)}),te(" adjustCoordinateSystem",function(){h.adjust(U)}),te(" position",function(){m(U)}),te(" positionSelfEdges",function(){se(U)}),te(" removeBorderNodes",function(){J(U)}),te(" normalize.undo",function(){n.undo(U)}),te(" fixupEdgeLabelCoords",function(){P(U)}),te(" undoCoordinateSystem",function(){h.undo(U)}),te(" translateGraph",function(){z(U)}),te(" assignNodeIntersects",function(){H(U)}),te(" reversePoints",function(){W(U)}),te(" acyclic.undo",function(){e.undo(U)})}function S(U,te){t.forEach(U.nodes(),function(ne){var Y=U.node(ne),ae=te.node(ne);Y&&(Y.x=ae.x,Y.y=ae.y,te.children(ne).length&&(Y.width=ae.width,Y.height=ae.height))}),t.forEach(U.edges(),function(ne){var Y=U.edge(ne),ae=te.edge(ne);Y.points=ae.points,t.has(ae,"x")&&(Y.x=ae.x,Y.y=ae.y)}),U.graph().width=te.graph().width,U.graph().height=te.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},C=["acyclicer","ranker","rankdir","align"],T=["width","height"],_={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],M={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},q=["labelpos"];function L(U){var te=new x({multigraph:!0,compound:!0}),ne=F(U.graph());return te.setGraph(t.merge({},N,G(ne,k),t.pick(ne,C))),t.forEach(U.nodes(),function(Y){var ae=F(U.node(Y));te.setNode(Y,t.defaults(G(ae,T),_)),te.setParent(Y,U.parent(Y))}),t.forEach(U.edges(),function(Y){var ae=F(U.edge(Y));te.setEdge(Y,t.merge({},M,G(ae,E),t.pick(ae,q)))}),te}function I(U){var te=U.graph();te.ranksep/=2,t.forEach(U.edges(),function(ne){var Y=U.edge(ne);Y.minlen*=2,Y.labelpos.toLowerCase()!=="c"&&(te.rankdir==="TB"||te.rankdir==="BT"?Y.width+=Y.labeloffset:Y.height+=Y.labeloffset)})}function $(U){t.forEach(U.edges(),function(te){var ne=U.edge(te);if(ne.width&&ne.height){var Y=U.node(te.v),ae=U.node(te.w),re={rank:(ae.rank-Y.rank)/2+Y.rank,e:te};g.addDummyNode(U,"edge-proxy",re,"_ep")}})}function V(U){var te=0;t.forEach(U.nodes(),function(ne){var Y=U.node(ne);Y.borderTop&&(Y.minRank=U.node(Y.borderTop).rank,Y.maxRank=U.node(Y.borderBottom).rank,te=t.max(te,Y.maxRank))}),U.graph().maxRank=te}function ee(U){t.forEach(U.nodes(),function(te){var ne=U.node(te);ne.dummy==="edge-proxy"&&(U.edge(ne.e).labelRank=ne.rank,U.removeNode(te))})}function z(U){var te=Number.POSITIVE_INFINITY,ne=0,Y=Number.POSITIVE_INFINITY,ae=0,re=U.graph(),oe=re.marginx||0,_e=re.marginy||0;function Ge(tt){var Xe=tt.x,je=tt.y,Qe=tt.width,He=tt.height;te=Math.min(te,Xe-Qe/2),ne=Math.max(ne,Xe+Qe/2),Y=Math.min(Y,je-He/2),ae=Math.max(ae,je+He/2)}t.forEach(U.nodes(),function(tt){Ge(U.node(tt))}),t.forEach(U.edges(),function(tt){var Xe=U.edge(tt);t.has(Xe,"x")&&Ge(Xe)}),te-=oe,Y-=_e,t.forEach(U.nodes(),function(tt){var Xe=U.node(tt);Xe.x-=te,Xe.y-=Y}),t.forEach(U.edges(),function(tt){var Xe=U.edge(tt);t.forEach(Xe.points,function(je){je.x-=te,je.y-=Y}),t.has(Xe,"x")&&(Xe.x-=te),t.has(Xe,"y")&&(Xe.y-=Y)}),re.width=ne-te+oe,re.height=ae-Y+_e}function H(U){t.forEach(U.edges(),function(te){var ne=U.edge(te),Y=U.node(te.v),ae=U.node(te.w),re,oe;ne.points?(re=ne.points[0],oe=ne.points[ne.points.length-1]):(ne.points=[],re=ae,oe=Y),ne.points.unshift(g.intersectRect(Y,re)),ne.points.push(g.intersectRect(ae,oe))})}function P(U){t.forEach(U.edges(),function(te){var ne=U.edge(te);if(t.has(ne,"x"))switch((ne.labelpos==="l"||ne.labelpos==="r")&&(ne.width-=ne.labeloffset),ne.labelpos){case"l":ne.x-=ne.width/2+ne.labeloffset;break;case"r":ne.x+=ne.width/2+ne.labeloffset;break}})}function W(U){t.forEach(U.edges(),function(te){var ne=U.edge(te);ne.reversed&&ne.points.reverse()})}function J(U){t.forEach(U.nodes(),function(te){if(U.children(te).length){var ne=U.node(te),Y=U.node(ne.borderTop),ae=U.node(ne.borderBottom),re=U.node(t.last(ne.borderLeft)),oe=U.node(t.last(ne.borderRight));ne.width=Math.abs(oe.x-re.x),ne.height=Math.abs(ae.y-Y.y),ne.x=re.x+ne.width/2,ne.y=Y.y+ne.height/2}}),t.forEach(U.nodes(),function(te){U.node(te).dummy==="border"&&U.removeNode(te)})}function X(U){t.forEach(U.edges(),function(te){if(te.v===te.w){var ne=U.node(te.v);ne.selfEdges||(ne.selfEdges=[]),ne.selfEdges.push({e:te,label:U.edge(te)}),U.removeEdge(te)}})}function R(U){var te=g.buildLayerMatrix(U);t.forEach(te,function(ne){var Y=0;t.forEach(ne,function(ae,re){var oe=U.node(ae);oe.order=re+Y,t.forEach(oe.selfEdges,function(_e){g.addDummyNode(U,"selfedge",{width:_e.label.width,height:_e.label.height,rank:oe.rank,order:re+ ++Y,e:_e.e,label:_e.label},"_se")}),delete oe.selfEdges})})}function se(U){t.forEach(U.nodes(),function(te){var ne=U.node(te);if(ne.dummy==="selfedge"){var Y=U.node(ne.e.v),ae=Y.x+Y.width/2,re=Y.y,oe=ne.x-ae,_e=Y.height/2;U.setEdge(ne.e,ne.label),U.removeNode(te),ne.label.points=[{x:ae+2*oe/3,y:re-_e},{x:ae+5*oe/6,y:re-_e},{x:ae+oe,y:re},{x:ae+5*oe/6,y:re+_e},{x:ae+2*oe/3,y:re+_e}],ne.label.x=ne.x,ne.label.y=ne.y}})}function G(U,te){return t.mapValues(t.pick(U,te),Number)}function F(U){var te={};return t.forEach(U,function(ne,Y){te[Y.toLowerCase()]=ne}),te}return h3}var f3,BR;function oOe(){if(BR)return f3;BR=1;var t=ir(),e=si(),n=Na().Graph;f3={debugOrdering:r};function r(s){var i=e.buildLayerMatrix(s),a=new n({compound:!0,multigraph:!0}).setGraph({});return t.forEach(s.nodes(),function(l){a.setNode(l,{label:l}),a.setParent(l,"layer"+s.node(l).rank)}),t.forEach(s.edges(),function(l){a.setEdge(l.v,l.w,{},l.name)}),t.forEach(i,function(l,c){var h="layer"+c;a.setNode(h,{rank:"same"}),t.reduce(l,function(f,m){return a.setEdge(f,m,{style:"invis"}),m})}),a}return f3}var m3,qR;function lOe(){return qR||(qR=1,m3="0.8.5"),m3}var p3,FR;function cOe(){return FR||(FR=1,p3={graphlib:Na(),layout:aOe(),debug:oOe(),util:{time:si().time,notime:si().notime},version:lOe()}),p3}var uOe=cOe();const $R=Mk(uOe),kj="/api/webui";async function dOe(t=100,e="all"){const n=`${kj}/knowledge/graph?limit=${t}&node_type=${e}`,r=await fetch(n);if(!r.ok)throw new Error(`获取知识图谱失败: ${r.status}`);return r.json()}async function hOe(){const t=await fetch(`${kj}/knowledge/stats`);if(!t.ok)throw new Error("获取知识图谱统计信息失败");return t.json()}async function fOe(t){const e=await fetch(`${kj}/knowledge/search?query=${encodeURIComponent(t)}`);if(!e.ok)throw new Error("搜索知识节点失败");return e.json()}const OV=b.memo(({data:t})=>o.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:[o.jsx(jc,{type:"target",position:ht.Top}),o.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:t.content,children:t.label}),o.jsx(jc,{type:"source",position:ht.Bottom})]}));OV.displayName="EntityNode";const jV=b.memo(({data:t})=>o.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:[o.jsx(jc,{type:"target",position:ht.Top}),o.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:t.content,children:t.label}),o.jsx(jc,{type:"source",position:ht.Bottom})]}));jV.displayName="ParagraphNode";const mOe={entity:OV,paragraph:jV};function pOe(t,e){const n=new $R.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)}),$R.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 l={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&&(l.label=`${i.weight.toFixed(0)}`),s.push(l)}),{nodes:r,edges:s}}function gOe(){const t=Ca(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,a]=b.useState(""),[l,c]=b.useState("all"),[h,f]=b.useState(50),[m,g]=b.useState("50"),[x,y]=b.useState(!1),[w,S]=b.useState(!0),[k,N]=b.useState(!1),[C,T]=b.useState(!1),[_,E,M]=Cke([]),[q,L,I]=Tke([]),[$,V]=b.useState(0),[ee,z]=b.useState(null),[H,P]=b.useState(null),{toast:W}=Wr(),J=b.useCallback(ne=>ne.type==="entity"?"#6366f1":ne.type==="paragraph"?"#10b981":"#6b7280",[]),X=b.useCallback(async(ne=!1)=>{try{if(!ne&&h>200){T(!0);return}n(!0);const[Y,ae]=await Promise.all([dOe(h,l),hOe()]);if(s(ae),Y.nodes.length===0){W({title:"提示",description:"知识库为空,请先导入知识数据"}),E([]),L([]);return}const{nodes:re,edges:oe}=pOe(Y.nodes,Y.edges);E(re),L(oe),V(re.length),ae&&ae.total_nodes>h&&W({title:"提示",description:`知识图谱包含 ${ae.total_nodes} 个节点,当前显示 ${re.length} 个`}),W({title:"加载成功",description:`已加载 ${re.length} 个节点,${oe.length} 条边`})}catch(Y){console.error("加载知识图谱失败:",Y),W({title:"加载失败",description:Y instanceof Error?Y.message:"未知错误",variant:"destructive"})}finally{n(!1)}},[h,l,W]),R=b.useCallback(async()=>{if(!i.trim()){W({title:"提示",description:"请输入搜索关键词"});return}try{const ne=await fOe(i);if(ne.length===0){W({title:"未找到",description:"没有找到匹配的节点"});return}const Y=new Set(ne.map(ae=>ae.id));E(ae=>ae.map(re=>({...re,style:{...re.style,opacity:Y.has(re.id)?1:.3,filter:Y.has(re.id)?"brightness(1.2)":"brightness(0.8)"}}))),W({title:"搜索完成",description:`找到 ${ne.length} 个匹配节点`})}catch(ne){console.error("搜索失败:",ne),W({title:"搜索失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}},[i,W]),se=b.useCallback(()=>{E(ne=>ne.map(Y=>({...Y,style:{...Y.style,opacity:1,filter:"brightness(1)"}})))},[]),G=b.useCallback(()=>{S(!1),N(!0),X()},[X]),F=b.useCallback(()=>{T(!1),setTimeout(()=>{X(!0)},0)},[X]),U=b.useCallback((ne,Y)=>{_.find(re=>re.id===Y.id)&&z({id:Y.id,type:Y.type,content:Y.data.content})},[_]);b.useEffect(()=>{w||k&&X()},[h,l,w,k]);const te=b.useCallback((ne,Y)=>{const ae=_.find(_e=>_e.id===Y.source),re=_.find(_e=>_e.id===Y.target),oe=q.find(_e=>_e.id===Y.id);ae&&re&&oe&&P({source:{id:ae.id,type:ae.type,content:ae.data.content},target:{id:re.id,type:re.type,content:re.data.content},edge:{source:Y.source,target:Y.target,weight:parseFloat(Y.label||"0")}})},[_,q]);return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),o.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),r&&o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsxs(Ln,{variant:"outline",className:"gap-1",children:[o.jsx(b3,{className:"h-3 w-3"}),"节点: ",r.total_nodes]}),o.jsxs(Ln,{variant:"outline",className:"gap-1",children:[o.jsx(KD,{className:"h-3 w-3"}),"边: ",r.total_edges]}),o.jsxs(Ln,{variant:"outline",className:"gap-1",children:[o.jsx(wa,{className:"h-3 w-3"}),"实体: ",r.entity_nodes]}),o.jsxs(Ln,{variant:"outline",className:"gap-1",children:[o.jsx(tl,{className:"h-3 w-3"}),"段落: ",r.paragraph_nodes]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[o.jsxs("div",{className:"flex-1 flex gap-2",children:[o.jsx(Pe,{placeholder:"搜索节点内容...",value:i,onChange:ne=>a(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&R(),className:"flex-1"}),o.jsx(me,{onClick:R,size:"sm",children:o.jsx(ii,{className:"h-4 w-4"})}),o.jsx(me,{onClick:se,variant:"outline",size:"sm",children:"重置"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(Dt,{value:l,onValueChange:ne=>c(ne),children:[o.jsx(Mt,{className:"w-[120px]",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部节点"}),o.jsx(ze,{value:"entity",children:"仅实体"}),o.jsx(ze,{value:"paragraph",children:"仅段落"})]})]}),o.jsxs(Dt,{value:h===1e4?"all":x?"custom":h.toString(),onValueChange:ne=>{ne==="custom"?(y(!0),g(h.toString())):ne==="all"?(y(!1),f(1e4)):(y(!1),f(Number(ne)))},children:[o.jsx(Mt,{className:"w-[120px]",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"50",children:"50 节点"}),o.jsx(ze,{value:"100",children:"100 节点"}),o.jsx(ze,{value:"200",children:"200 节点"}),o.jsx(ze,{value:"500",children:"500 节点"}),o.jsx(ze,{value:"1000",children:"1000 节点"}),o.jsx(ze,{value:"all",children:"全部 (最多10000)"}),o.jsx(ze,{value:"custom",children:"自定义..."})]})]}),x&&o.jsx(Pe,{type:"number",min:"50",value:m,onChange:ne=>g(ne.target.value),onBlur:()=>{const ne=parseInt(m);!isNaN(ne)&&ne>=50?f(ne):(g("50"),f(50))},onKeyDown:ne=>{if(ne.key==="Enter"){const Y=parseInt(m);!isNaN(Y)&&Y>=50?f(Y):(g("50"),f(50))}},placeholder:"最少50个",className:"w-[120px]"}),o.jsx(me,{onClick:()=>X(),variant:"outline",size:"sm",disabled:e,children:o.jsx(Ti,{className:ye("h-4 w-4",e&&"animate-spin")})})]})]})]}),o.jsx("div",{className:"flex-1 relative",children:e?o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx(Ti,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),o.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):_.length===0?o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx(b3,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),o.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):o.jsxs(tV,{nodes:_,edges:q,onNodesChange:M,onEdgesChange:I,onNodeClick:U,onEdgeClick:te,nodeTypes:mOe,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:$<=500,nodesDraggable:$<=1e3,attributionPosition:"bottom-left",children:[o.jsx(Kke,{variant:na.Dots,gap:12,size:1}),o.jsx(Vke,{}),$<=500&&o.jsx(Ike,{nodeColor:J,nodeBorderRadius:8,pannable:!0,zoomable:!0}),o.jsxs(Ny,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[o.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),o.jsxs("div",{className:"space-y-2 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),o.jsx("span",{children:"实体节点"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),o.jsx("span",{children:"段落节点"})]}),$>200&&o.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[o.jsx("div",{className:"font-semibold",children:"性能模式"}),o.jsx("div",{children:"已禁用动画"}),$>500&&o.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),o.jsx(zr,{open:!!ee,onOpenChange:ne=>!ne&&z(null),children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsx(kr,{children:o.jsx(Or,{children:"节点详情"})}),ee&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"grid grid-cols-2 gap-4",children:o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),o.jsx("div",{className:"mt-1",children:o.jsx(Ln,{variant:ee.type==="entity"?"default":"secondary",children:ee.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),o.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:ee.id})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),o.jsx(kn,{className:"mt-1 h-40 p-3 bg-muted rounded",children:o.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ee.content})})]})]})]})}),o.jsx(zr,{open:!!H,onOpenChange:ne=>!ne&&P(null),children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[o.jsx(kr,{children:o.jsx(Or,{children:"边详情"})}),H&&o.jsx(kn,{className:"flex-1 pr-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.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:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),o.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:H.source.content}),o.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[H.source.id.slice(0,40),"..."]})]}),o.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),o.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:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),o.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:H.target.content}),o.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[H.target.id.slice(0,40),"..."]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),o.jsx("div",{className:"mt-1",children:o.jsx(Ln,{variant:"outline",className:"text-base font-mono",children:H.edge.weight.toFixed(4)})})]})]})})]})}),o.jsx(jn,{open:w,onOpenChange:S,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"加载知识图谱"}),o.jsxs(fn,{children:["知识图谱的动态展示会消耗较多系统资源。",o.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{onClick:()=>t({to:"/"}),children:"取消 (返回首页)"}),o.jsx(mn,{onClick:G,children:"确认加载"})]})]})}),o.jsx(jn,{open:C,onOpenChange:T,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"⚠️ 节点数量较多"}),o.jsx(fn,{asChild:!0,children:o.jsxs("div",{children:[o.jsxs("p",{children:["您正在尝试加载 ",o.jsx("strong",{className:"text-orange-600",children:h>=1e4?"全部 (最多10000个)":h})," 个节点。"]}),o.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),o.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[o.jsx("li",{children:"页面加载时间较长"}),o.jsx("li",{children:"浏览器卡顿或崩溃"}),o.jsx("li",{children:"系统资源占用过高"})]}),o.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),o.jsxs(dn,{children:[o.jsx(pn,{onClick:()=>{T(!1),h>200&&(f(50),y(!1))},children:"取消"}),o.jsx(mn,{onClick:F,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function Ad(t,e,n){let r=n.initialDeps??[],s;function i(){var a,l,c,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&&((l=n.debug)!=null&&l.call(n))&&(x=Date.now()),s=e(...m),n.key&&((c=n.debug)!=null&&c.call(n))){const y=Math.round((Date.now()-f)*100)/100,w=Math.round((Date.now()-x)*100)/100,S=w/16,k=(N,C)=>{for(N=String(N);N.length<C;)N=" "+N;return N};console.info(`%c⏱ ${k(w,5)} /${k(y,5)} ms`,`
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return(h=n?.onChange)==null||h.call(n,s),s}return i.updateDeps=a=>{r=a},i}function QR(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const xOe=(t,e)=>Math.abs(t-e)<1.01,vOe=(t,e,n)=>{let r;return function(...s){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,s),n)}},HR=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},yOe=t=>t,bOe=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},wOe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const s=a=>{const{width:l,height:c}=a;e({width:Math.round(l),height:Math.round(c)})};if(s(HR(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c?.borderBoxSize){const h=c.borderBoxSize[0];if(h){s({width:h.inlineSize,height:h.blockSize});return}}s(HR(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},VR={passive:!0},UR=typeof window>"u"?!0:"onscrollend"in window,SOe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let s=0;const i=t.options.useScrollendEvent&&UR?()=>{}:vOe(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)},l=a(!0),c=a(!1);c(),n.addEventListener("scroll",l,VR);const h=t.options.useScrollendEvent&&UR;return h&&n.addEventListener("scrollend",c,VR),()=>{n.removeEventListener("scroll",l),h&&n.removeEventListener("scrollend",c)}},kOe=(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"]},OOe=(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 jOe{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:yOe,rangeExtractor:bOe,onChange:()=>{},measureElement:kOe,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=Ad(()=>(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()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this.maybeNotify()}))}},this.getSize=()=>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 l=n[a];if(s.has(l.lane))continue;const c=i.get(l.lane);if(c==null||l.end>c.end?i.set(l.lane,l):l.end<c.end&&s.set(l.lane,!0),s.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((a,l)=>a.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=Ad(()=>[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=Ad(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a},l)=>{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 c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const h=this.measurementsCache.slice(0,c);for(let f=c;f<n;f++){const m=i(f),g=this.options.lanes===1?h[f-1]:this.getFurthestMeasurement(h,f),x=g?g.end+this.options.gap:r+s,y=l.get(m),w=typeof y=="number"?y:this.options.estimateSize(f),S=x+w,k=g?g.lane:f%this.options.lanes;h[f]={index:f,start:x,size:w,end:S,key:m,lane:k}}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ad(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?NOe({measurements:n,outerSize:r,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ad(()=>{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,l=this.elementsCache.get(a);l!==n&&(l&&this.observer.unobserve(l),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<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=n=>{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=Ad(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,a=n.length;i<a;i++){const l=n[i],c=r[l];s.push(c)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return QR(r[NV(0,r.length-1,s=>QR(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 l=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(l,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 l=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,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,l=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}xOe(y[0],x)||c(g)})},c=h=>{this.targetWindow&&(i++,i<a?this.targetWindow.requestAnimationFrame(()=>l(h)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};l(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(l=>l===null);){const l=r[a];i[l.lane]===null&&(i[l.lane]=l.end),a--}s=Math.max(...i.filter(l=>l!==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 NV=(t,e,n,r)=>{for(;t<=e;){const s=(t+e)/2|0,i=n(s);if(i<r)t=s+1;else if(i>r)e=s-1;else return s}return t>0?t-1:0};function NOe({measurements:t,outerSize:e,scrollOffset:n,lanes:r}){const s=t.length-1,i=c=>t[c].start;if(t.length<=r)return{startIndex:0,endIndex:s};let a=NV(0,s,i,n),l=a;if(r===1)for(;l<s&&t[l].end<n+e;)l++;else if(r>1){const c=Array(r).fill(0);for(;l<s&&c.some(f=>f<n+e);){const f=t[l];c[f.lane]=f.end,l++}const h=Array(r).fill(n+e);for(;a>=0&&h.some(f=>f>=n);){const f=t[a];h[f.lane]=f.start,a--}a=Math.max(0,a-a%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:a,endIndex:l}}const WR=typeof document<"u"?b.useLayoutEffect:b.useEffect;function COe(t){const e=b.useReducer(()=>({}),{})[1],n={...t,onChange:(s,i)=>{var a;i?du.flushSync(e):e(),(a=t.onChange)==null||a.call(t,s,i)}},[r]=b.useState(()=>new jOe(n));return r.setOptions(n),WR(()=>r._didMount(),[]),WR(()=>r._willUpdate()),r}function TOe(t){return COe({observeElementRect:wOe,observeElementOffset:SOe,scrollToFn:OOe,...t})}function EOe(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 _Oe={},bm={};function xu(t,e){try{const r=(_Oe[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in bm?bm[r]:GR(r,r.split(":"))}catch{if(t in bm)return bm[t];const n=t?.match(MOe);return n?GR(t,n.slice(1)):NaN}}const MOe=/([+-]\d\d):?(\d\d)?/;function GR(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return bm[t]=n*60+r>0?n*60+r+s:n*60-r-s}class to extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(xu(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)),CV(this),Ok(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new to(...n,e):new to(Date.now(),e)}withTimeZone(e){return new to(+this,e)}getTimezoneOffset(){const e=-xu(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Ok(this),+this}[Symbol.for("constructDateFrom")](e){return new to(+new Date(e),this.timeZone)}}const XR=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!XR.test(t))return;const e=t.replace(XR,"$1UTC");to.prototype[e]&&(t.startsWith("get")?to.prototype[t]=function(){return this.internal[e]()}:(to.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),AOe(this),+this},to.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Ok(this),+this}))});function Ok(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-xu(t.timeZone,t)*60))}function AOe(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()),CV(t)}function CV(t){const e=xu(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,l=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();a&&l&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+a);const c=s-n;c&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+c);const h=new Date(+t);h.setUTCSeconds(0);const f=s>0?h.getSeconds():(h.getSeconds()-60)%60,m=Math.round(-(xu(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=xu(t.timeZone,t),x=g>0?Math.floor(g):Math.ceil(g),w=-new Date(+t).getTimezoneOffset()-x,S=x!==n,k=w-c;if(S&&k){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+k);const N=xu(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 xs extends to{static tz(e,...n){return n.length?new xs(...n,e):new xs(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} (${EOe(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 xs(+this,e)}[Symbol.for("constructDateFrom")](e){return new xs(+new Date(e),this.timeZone)}}const TV=6048e5,ROe=864e5,YR=Symbol.for("constructDateFrom");function Pr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&YR in t?t[YR](e):t instanceof Date?new t.constructor(e):new Date(e)}function Bn(t,e){return Pr(e||t,t)}function EV(t,e,n){const r=Bn(t,n?.in);return isNaN(e)?Pr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function _V(t,e,n){const r=Bn(t,n?.in);if(isNaN(e))return Pr(t,NaN);if(!e)return r;const s=r.getDate(),i=Pr(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 DOe={};function hp(){return DOe}function Nc(t,e){const n=hp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Bn(t,e?.in),i=s.getDay(),a=(i<r?7:0)+i-r;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function k0(t,e){return Nc(t,{...e,weekStartsOn:1})}function MV(t,e){const n=Bn(t,e?.in),r=n.getFullYear(),s=Pr(n,0);s.setFullYear(r+1,0,4),s.setHours(0,0,0,0);const i=k0(s),a=Pr(n,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const l=k0(a);return n.getTime()>=i.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function KR(t){const e=Bn(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 Qu(t,...e){const n=Pr.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function O0(t,e){const n=Bn(t,e?.in);return n.setHours(0,0,0,0),n}function AV(t,e,n){const[r,s]=Qu(n?.in,t,e),i=O0(r),a=O0(s),l=+i-KR(i),c=+a-KR(a);return Math.round((l-c)/ROe)}function zOe(t,e){const n=MV(t,e),r=Pr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),k0(r)}function POe(t,e,n){return EV(t,e*7,n)}function LOe(t,e,n){return _V(t,e*12,n)}function IOe(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=Pr.bind(null,s));const i=Bn(s,r);(!n||n<i||isNaN(+i))&&(n=i)}),Pr(r,n||NaN)}function BOe(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=Pr.bind(null,s));const i=Bn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),Pr(r,n||NaN)}function qOe(t,e,n){const[r,s]=Qu(n?.in,t,e);return+O0(r)==+O0(s)}function RV(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function FOe(t){return!(!RV(t)&&typeof t!="number"||isNaN(+Bn(t)))}function $Oe(t,e,n){const[r,s]=Qu(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),a=r.getMonth()-s.getMonth();return i*12+a}function QOe(t,e){const n=Bn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function DV(t,e){const[n,r]=Qu(t,e.start,e.end);return{start:n,end:r}}function HOe(t,e){const{start:n,end:r}=DV(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 l=1;const c=[];for(;+a<=i;)c.push(Pr(n,a)),a.setMonth(a.getMonth()+l);return s?c.reverse():c}function VOe(t,e){const n=Bn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function UOe(t,e){const n=Bn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function zV(t,e){const n=Bn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function WOe(t,e){const{start:n,end:r}=DV(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 l=1;const c=[];for(;+a<=i;)c.push(Pr(n,a)),a.setFullYear(a.getFullYear()+l);return s?c.reverse():c}function PV(t,e){const n=hp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Bn(t,e?.in),i=s.getDay(),a=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+a),s.setHours(23,59,59,999),s}function GOe(t,e){return PV(t,{...e,weekStartsOn:1})}const XOe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},YOe=(t,e,n)=>{let r;const s=XOe[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 uh(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const KOe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ZOe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},JOe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},eje={date:uh({formats:KOe,defaultWidth:"full"}),time:uh({formats:ZOe,defaultWidth:"full"}),dateTime:uh({formats:JOe,defaultWidth:"full"})},tje={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},nje=(t,e,n,r)=>tje[t];function Ga(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,l=n?.width?String(n.width):a;s=t.formattingValues[l]||t.formattingValues[a]}else{const a=t.defaultWidth,l=n?.width?String(n.width):t.defaultWidth;s=t.values[l]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const rje={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},sje={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ije={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"]},aje={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"]},oje={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"}},lje={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"}},cje=(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"},uje={ordinalNumber:cje,era:Ga({values:rje,defaultWidth:"wide"}),quarter:Ga({values:sje,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ga({values:ije,defaultWidth:"wide"}),day:Ga({values:aje,defaultWidth:"wide"}),dayPeriod:Ga({values:oje,defaultWidth:"wide",formattingValues:lje,defaultFormattingWidth:"wide"})};function Xa(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],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?hje(l,m=>m.test(a)):dje(l,m=>m.test(a));let h;h=t.valueCallback?t.valueCallback(c):c,h=n.valueCallback?n.valueCallback(h):h;const f=e.slice(a.length);return{value:h,rest:f}}}function dje(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function hje(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function LV(t){return(e,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 l=e.slice(s.length);return{value:a,rest:l}}}const fje=/^(\d+)(th|st|nd|rd)?/i,mje=/\d+/i,pje={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},gje={any:[/^b/i,/^(a|c)/i]},xje={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},vje={any:[/1/i,/2/i,/3/i,/4/i]},yje={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},bje={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]},wje={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},Sje={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]},kje={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},Oje={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}},jje={ordinalNumber:LV({matchPattern:fje,parsePattern:mje,valueCallback:t=>parseInt(t,10)}),era:Xa({matchPatterns:pje,defaultMatchWidth:"wide",parsePatterns:gje,defaultParseWidth:"any"}),quarter:Xa({matchPatterns:xje,defaultMatchWidth:"wide",parsePatterns:vje,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Xa({matchPatterns:yje,defaultMatchWidth:"wide",parsePatterns:bje,defaultParseWidth:"any"}),day:Xa({matchPatterns:wje,defaultMatchWidth:"wide",parsePatterns:Sje,defaultParseWidth:"any"}),dayPeriod:Xa({matchPatterns:kje,defaultMatchWidth:"any",parsePatterns:Oje,defaultParseWidth:"any"})},Oj={code:"en-US",formatDistance:YOe,formatLong:eje,formatRelative:nje,localize:uje,match:jje,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Nje(t,e){const n=Bn(t,e?.in);return AV(n,zV(n))+1}function IV(t,e){const n=Bn(t,e?.in),r=+k0(n)-+zOe(n);return Math.round(r/TV)+1}function BV(t,e){const n=Bn(t,e?.in),r=n.getFullYear(),s=hp(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=Pr(e?.in||t,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const l=Nc(a,e),c=Pr(e?.in||t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const h=Nc(c,e);return+n>=+l?r+1:+n>=+h?r:r-1}function Cje(t,e){const n=hp(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=BV(t,e),i=Pr(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),Nc(i,e)}function qV(t,e){const n=Bn(t,e?.in),r=+Nc(n,e)-+Cje(n,e);return Math.round(r/TV)+1}function Mn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const ec={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Mn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Mn(n+1,2)},d(t,e){return Mn(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 Mn(t.getHours()%12||12,e.length)},H(t,e){return Mn(t.getHours(),e.length)},m(t,e){return Mn(t.getMinutes(),e.length)},s(t,e){return Mn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Mn(s,e.length)}},Rd={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ZR={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 ec.y(t,e)},Y:function(t,e,n,r){const s=BV(t,r),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return Mn(a,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Mn(i,e.length)},R:function(t,e){const n=MV(t);return Mn(n,e.length)},u:function(t,e){const n=t.getFullYear();return Mn(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 Mn(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 Mn(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 ec.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 Mn(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=qV(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):Mn(s,e.length)},I:function(t,e,n){const r=IV(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Mn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):ec.d(t,e)},D:function(t,e,n){const r=Nje(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Mn(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 Mn(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 Mn(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 Mn(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=Rd.noon:r===0?s=Rd.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=Rd.evening:r>=12?s=Rd.afternoon:r>=4?s=Rd.morning:s=Rd.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 ec.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):ec.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Mn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Mn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):ec.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):ec.s(t,e)},S:function(t,e){return ec.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return eD(r);case"XXXX":case"XX":return lu(r);case"XXXXX":case"XXX":default:return lu(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return eD(r);case"xxxx":case"xx":return lu(r);case"xxxxx":case"xxx":default:return lu(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+JR(r,":");case"OOOO":default:return"GMT"+lu(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+JR(r,":");case"zzzz":default:return"GMT"+lu(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Mn(r,e.length)},T:function(t,e,n){return Mn(+t,e.length)}};function JR(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+Mn(i,2)}function eD(t,e){return t%60===0?(t>0?"-":"+")+Mn(Math.abs(t)/60,2):lu(t,e)}function lu(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Mn(Math.trunc(r/60),2),i=Mn(r%60,2);return n+s+e+i}const tD=(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"})}},FV=(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"})}},Tje=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return tD(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}}",tD(r,e)).replace("{{time}}",FV(s,e))},Eje={p:FV,P:Tje},_je=/^D+$/,Mje=/^Y+$/,Aje=["D","DD","YY","YYYY"];function Rje(t){return _je.test(t)}function Dje(t){return Mje.test(t)}function zje(t,e,n){const r=Pje(t,e,n);if(console.warn(r),Aje.includes(t))throw new RangeError(r)}function Pje(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 Lje=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ije=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bje=/^'([^]*?)'?$/,qje=/''/g,Fje=/[a-zA-Z]/;function y1(t,e,n){const r=hp(),s=n?.locale??r.locale??Oj,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,l=Bn(t,n?.in);if(!FOe(l))throw new RangeError("Invalid time value");let c=e.match(Ije).map(f=>{const m=f[0];if(m==="p"||m==="P"){const g=Eje[m];return g(f,s.formatLong)}return f}).join("").match(Lje).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const m=f[0];if(m==="'")return{isToken:!1,value:$je(f)};if(ZR[m])return{isToken:!0,value:f};if(m.match(Fje))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:f}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const h={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return c.map(f=>{if(!f.isToken)return f.value;const m=f.value;(!n?.useAdditionalWeekYearTokens&&Dje(m)||!n?.useAdditionalDayOfYearTokens&&Rje(m))&&zje(m,e,String(t));const g=ZR[m[0]];return g(l,m,s.localize,h)}).join("")}function $je(t){const e=t.match(Bje);return e?e[1].replace(qje,"'"):t}function Qje(t,e){const n=Bn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=Pr(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Hje(t,e){return Bn(t,e?.in).getMonth()}function Vje(t,e){return Bn(t,e?.in).getFullYear()}function Uje(t,e){return+Bn(t)>+Bn(e)}function Wje(t,e){return+Bn(t)<+Bn(e)}function Gje(t,e,n){const[r,s]=Qu(n?.in,t,e);return+Nc(r,n)==+Nc(s,n)}function Xje(t,e,n){const[r,s]=Qu(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function Yje(t,e,n){const[r,s]=Qu(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function Kje(t,e,n){const r=Bn(t,n?.in),s=r.getFullYear(),i=r.getDate(),a=Pr(t,0);a.setFullYear(s,e,15),a.setHours(0,0,0,0);const l=Qje(a);return r.setMonth(e,Math.min(i,l)),r}function Zje(t,e,n){const r=Bn(t,n?.in);return isNaN(+r)?Pr(t,NaN):(r.setFullYear(e),r)}const nD=5,Jje=4;function e7e(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,nD*7-1);return e.getMonth(t)===e.getMonth(i)?nD:Jje}function $V(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 t7e(t,e){const n=$V(t,e),r=e7e(t,e);return e.addDays(n,r*7-1)}class Ai{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?xs.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 xs(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):EV(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):_V(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):POe(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):LOe(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):AV(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):$Oe(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):HOe(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):WOe(r),i=new Set(s.map(l=>this.getYear(l)));if(i.size===s.length)return s;const a=[];return i.forEach(l=>{a.push(new Date(l,0,1))}),a},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):t7e(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):GOe(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):QOe(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):PV(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):UOe(r),this.format=(r,s,i)=>{const a=this.overrides?.format?this.overrides.format(r,s,this.options):y1(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):IV(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Hje(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Vje(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):qV(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):Uje(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):Wje(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):RV(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):qOe(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):Xje(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):Yje(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):IOe(r),this.min=r=>this.overrides?.min?this.overrides.min(r):BOe(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):Kje(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):Zje(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):$V(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):O0(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):k0(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):VOe(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Nc(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):zV(r),this.options={locale:Oj,...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&&Ai.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&Ai.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)}}Ai.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 xo=new Ai;class QV{constructor(e,n,r=xo){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 n7e{constructor(e,n){this.date=e,this.weeks=n}}class r7e{constructor(e,n){this.days=n,this.weekNumber=e}}function s7e(t){return he.createElement("button",{...t})}function i7e(t){return he.createElement("span",{...t})}function a7e(t){const{size:e=24,orientation:n="left",className:r}=t;return he.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&he.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&he.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&he.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&he.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function o7e(t){const{day:e,modifiers:n,...r}=t;return he.createElement("td",{...r})}function l7e(t){const{day:e,modifiers:n,...r}=t,s=he.useRef(null);return he.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),he.createElement("button",{ref:s,...r})}var gt;(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"})(gt||(gt={}));var lr;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(lr||(lr={}));var ba;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(ba||(ba={}));var ji;(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"})(ji||(ji={}));function c7e(t){const{options:e,className:n,components:r,classNames:s,...i}=t,a=[s[gt.Dropdown],n].join(" "),l=e?.find(({value:c})=>c===i.value);return he.createElement("span",{"data-disabled":i.disabled,className:s[gt.DropdownRoot]},he.createElement(r.Select,{className:a,...i},e?.map(({value:c,label:h,disabled:f})=>he.createElement(r.Option,{key:c,value:c,disabled:f},h))),he.createElement("span",{className:s[gt.CaptionLabel],"aria-hidden":!0},l?.label,he.createElement(r.Chevron,{orientation:"down",size:18,className:s[gt.Chevron]})))}function u7e(t){return he.createElement("div",{...t})}function d7e(t){return he.createElement("div",{...t})}function h7e(t){const{calendarMonth:e,displayIndex:n,...r}=t;return he.createElement("div",{...r},t.children)}function f7e(t){const{calendarMonth:e,displayIndex:n,...r}=t;return he.createElement("div",{...r})}function m7e(t){return he.createElement("table",{...t})}function p7e(t){return he.createElement("div",{...t})}const HV=b.createContext(void 0);function fp(){const t=b.useContext(HV);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function g7e(t){const{components:e}=fp();return he.createElement(e.Dropdown,{...t})}function x7e(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:a,classNames:l,labels:{labelPrevious:c,labelNext:h}}=fp(),f=b.useCallback(g=>{s&&n?.(g)},[s,n]),m=b.useCallback(g=>{r&&e?.(g)},[r,e]);return he.createElement("nav",{...i},he.createElement(a.PreviousMonthButton,{type:"button",className:l[gt.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:m},he.createElement(a.Chevron,{disabled:r?void 0:!0,className:l[gt.Chevron],orientation:"left"})),he.createElement(a.NextMonthButton,{type:"button",className:l[gt.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:f},he.createElement(a.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[gt.Chevron]})))}function v7e(t){const{components:e}=fp();return he.createElement(e.Button,{...t})}function y7e(t){return he.createElement("option",{...t})}function b7e(t){const{components:e}=fp();return he.createElement(e.Button,{...t})}function w7e(t){const{rootRef:e,...n}=t;return he.createElement("div",{...n,ref:e})}function S7e(t){return he.createElement("select",{...t})}function k7e(t){const{week:e,...n}=t;return he.createElement("tr",{...n})}function O7e(t){return he.createElement("th",{...t})}function j7e(t){return he.createElement("thead",{"aria-hidden":!0},he.createElement("tr",{...t}))}function N7e(t){const{week:e,...n}=t;return he.createElement("th",{...n})}function C7e(t){return he.createElement("th",{...t})}function T7e(t){return he.createElement("tbody",{...t})}function E7e(t){const{components:e}=fp();return he.createElement(e.Dropdown,{...t})}const _7e=Object.freeze(Object.defineProperty({__proto__:null,Button:s7e,CaptionLabel:i7e,Chevron:a7e,Day:o7e,DayButton:l7e,Dropdown:c7e,DropdownNav:u7e,Footer:d7e,Month:h7e,MonthCaption:f7e,MonthGrid:m7e,Months:p7e,MonthsDropdown:g7e,Nav:x7e,NextMonthButton:v7e,Option:y7e,PreviousMonthButton:b7e,Root:w7e,Select:S7e,Week:k7e,WeekNumber:N7e,WeekNumberHeader:C7e,Weekday:O7e,Weekdays:j7e,Weeks:T7e,YearsDropdown:E7e},Symbol.toStringTag,{value:"Module"}));function Jo(t,e,n=!1,r=xo){let{from:s,to:i}=t;const{differenceInCalendarDays:a,isSameDay:l}=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?l(i,e):!n&&s?l(s,e):!1}function VV(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function jj(t){return!!(t&&typeof t=="object"&&"from"in t)}function UV(t){return!!(t&&typeof t=="object"&&"after"in t)}function WV(t){return!!(t&&typeof t=="object"&&"before"in t)}function GV(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function XV(t,e){return Array.isArray(t)&&t.every(e.isDate)}function el(t,e,n=xo){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:a}=n;return r.some(l=>{if(typeof l=="boolean")return l;if(n.isDate(l))return s(t,l);if(XV(l,n))return l.includes(t);if(jj(l))return Jo(l,t,!1,n);if(GV(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(t.getDay()):l.dayOfWeek===t.getDay();if(VV(l)){const c=i(l.before,t),h=i(l.after,t),f=c>0,m=h<0;return a(l.before,l.after)?m&&f:f||m}return UV(l)?i(t,l.after)>0:WV(l)?i(l.before,t)>0:typeof l=="function"?l(t):!1})}function M7e(t,e,n,r,s){const{disabled:i,hidden:a,modifiers:l,showOutsideDays:c,broadcastCalendar:h,today:f}=e,{isSameDay:m,isSameMonth:g,startOfMonth:x,isBefore:y,endOfMonth:w,isAfter:S}=s,k=n&&x(n),N=r&&w(r),C={[lr.focused]:[],[lr.outside]:[],[lr.disabled]:[],[lr.hidden]:[],[lr.today]:[]},T={};for(const _ of t){const{date:E,displayMonth:M}=_,q=!!(M&&!g(E,M)),L=!!(k&&y(E,k)),I=!!(N&&S(E,N)),$=!!(i&&el(E,i,s)),V=!!(a&&el(E,a,s))||L||I||!h&&!c&&q||h&&c===!1&&q,ee=m(E,f??s.today());q&&C.outside.push(_),$&&C.disabled.push(_),V&&C.hidden.push(_),ee&&C.today.push(_),l&&Object.keys(l).forEach(z=>{const H=l?.[z];H&&el(E,H,s)&&(T[z]?T[z].push(_):T[z]=[_])})}return _=>{const E={[lr.focused]:!1,[lr.disabled]:!1,[lr.hidden]:!1,[lr.outside]:!1,[lr.today]:!1},M={};for(const q in C){const L=C[q];E[q]=L.some(I=>I===_)}for(const q in T)M[q]=T[q].some(L=>L===_);return{...E,...M}}}function A7e(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[lr[i]]?s.push(e[lr[i]]):e[ba[i]]&&s.push(e[ba[i]]),s),[e[gt.Day]])}function R7e(t){return{..._7e,...t}}function D7e(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 Nj(){const t={};for(const e in gt)t[gt[e]]=`rdp-${gt[e]}`;for(const e in lr)t[lr[e]]=`rdp-${lr[e]}`;for(const e in ba)t[ba[e]]=`rdp-${ba[e]}`;for(const e in ji)t[ji[e]]=`rdp-${ji[e]}`;return t}function YV(t,e,n){return(n??new Ai(e)).formatMonthYear(t)}const z7e=YV;function P7e(t,e,n){return(n??new Ai(e)).format(t,"d")}function L7e(t,e=xo){return e.format(t,"LLLL")}function I7e(t,e,n){return(n??new Ai(e)).format(t,"cccccc")}function B7e(t,e=xo){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function q7e(){return""}function KV(t,e=xo){return e.format(t,"yyyy")}const F7e=KV,$7e=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:YV,formatDay:P7e,formatMonthCaption:z7e,formatMonthDropdown:L7e,formatWeekNumber:B7e,formatWeekNumberHeader:q7e,formatWeekdayName:I7e,formatYearCaption:F7e,formatYearDropdown:KV},Symbol.toStringTag,{value:"Module"}));function Q7e(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...$7e,...t}}function H7e(t,e,n,r,s){const{startOfMonth:i,startOfYear:a,endOfYear:l,eachMonthOfInterval:c,getMonth:h}=s;return c({start:a(t),end:l(t)}).map(g=>{const x=r.formatMonthDropdown(g,s),y=h(g),w=e&&g<i(e)||n&&g>i(n)||!1;return{value:y,label:x,disabled:w}})}function V7e(t,e={},n={}){let r={...e?.[gt.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function U7e(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let a=0;a<7;a++){const l=t.addDays(s,a);i.push(l)}return i}function W7e(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:a,eachYearOfInterval:l,getYear:c}=r,h=i(t),f=a(e),m=l({start:h,end:f});return s&&m.reverse(),m.map(g=>{const x=n.formatYearDropdown(g,r);return{value:c(g),label:x,disabled:!1}})}function ZV(t,e,n,r){let s=(r??new Ai(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const G7e=ZV;function JV(t,e,n){return(n??new Ai(e)).formatMonthYear(t)}const X7e=JV;function Y7e(t,e,n,r){let s=(r??new Ai(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function K7e(t){return"Choose the Month"}function Z7e(){return""}function J7e(t){return"Go to the Next Month"}function eNe(t){return"Go to the Previous Month"}function tNe(t,e,n){return(n??new Ai(e)).format(t,"cccc")}function nNe(t,e){return`Week ${t}`}function rNe(t){return"Week Number"}function sNe(t){return"Choose the Year"}const iNe=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:X7e,labelDay:G7e,labelDayButton:ZV,labelGrid:JV,labelGridcell:Y7e,labelMonthDropdown:K7e,labelNav:Z7e,labelNext:J7e,labelPrevious:eNe,labelWeekNumber:nNe,labelWeekNumberHeader:rNe,labelWeekday:tNe,labelYearDropdown:sNe},Symbol.toStringTag,{value:"Module"})),mp=t=>t instanceof HTMLElement?t:null,g3=t=>[...t.querySelectorAll("[data-animated-month]")??[]],aNe=t=>mp(t.querySelector("[data-animated-month]")),x3=t=>mp(t.querySelector("[data-animated-caption]")),v3=t=>mp(t.querySelector("[data-animated-weeks]")),oNe=t=>mp(t.querySelector("[data-animated-nav]")),lNe=t=>mp(t.querySelector("[data-animated-weekdays]"));function cNe(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const a=b.useRef(null),l=b.useRef(r),c=b.useRef(!1);b.useLayoutEffect(()=>{const h=l.current;if(l.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[ji.caption_after_enter]:n[ji.caption_before_enter],x=m?n[ji.weeks_after_enter]:n[ji.weeks_before_enter],y=a.current,w=t.current.cloneNode(!0);if(w instanceof HTMLElement?(g3(w).forEach(C=>{if(!(C instanceof HTMLElement))return;const T=aNe(C);T&&C.contains(T)&&C.removeChild(T);const _=x3(C);_&&_.classList.remove(g);const E=v3(C);E&&E.classList.remove(x)}),a.current=w):a.current=null,c.current||f||s)return;const S=y instanceof HTMLElement?g3(y):[],k=g3(t.current);if(k?.every(N=>N instanceof HTMLElement)&&S&&S.every(N=>N instanceof HTMLElement)){c.current=!0,t.current.style.isolation="isolate";const N=oNe(t.current);N&&(N.style.zIndex="1"),k.forEach((C,T)=>{const _=S[T];if(!_)return;C.style.position="relative",C.style.overflow="hidden";const E=x3(C);E&&E.classList.add(g);const M=v3(C);M&&M.classList.add(x);const q=()=>{c.current=!1,t.current&&(t.current.style.isolation=""),N&&(N.style.zIndex=""),E&&E.classList.remove(g),M&&M.classList.remove(x),C.style.position="",C.style.overflow="",C.contains(_)&&C.removeChild(_)};_.style.pointerEvents="none",_.style.position="absolute",_.style.overflow="hidden",_.setAttribute("aria-hidden","true");const L=lNe(_);L&&(L.style.opacity="0");const I=x3(_);I&&(I.classList.add(m?n[ji.caption_before_exit]:n[ji.caption_after_exit]),I.addEventListener("animationend",q));const $=v3(_);$&&$.classList.add(m?n[ji.weeks_before_exit]:n[ji.weeks_after_exit]),C.insertBefore(_,C.firstChild)})}})}function uNe(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:a,fixedWeeks:l,broadcastCalendar:c}=n??{},{addDays:h,differenceInCalendarDays:f,differenceInCalendarMonths:m,endOfBroadcastWeek:g,endOfISOWeek:x,endOfMonth:y,endOfWeek:w,isAfter:S,startOfBroadcastWeek:k,startOfISOWeek:N,startOfWeek:C}=r,T=c?k(s,r):a?N(s):C(s),_=c?g(i):a?x(y(i)):w(y(i)),E=f(_,T),M=m(i,s)+1,q=[];for(let $=0;$<=E;$++){const V=h(T,$);if(e&&S(V,e))break;q.push(V)}const I=(c?35:42)*M;if(l&&q.length<I){const $=I-q.length;for(let V=0;V<$;V++){const ee=h(q[q.length-1],1);q.push(ee)}}return q}function dNe(t){const e=[];return t.reduce((n,r)=>{const s=r.weeks.reduce((i,a)=>i.concat(a.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function hNe(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let a=0;a<s;a++){const l=r.addMonths(t,a);if(e&&l>e)break;i.push(l)}return i}function rD(t,e,n,r){const{month:s,defaultMonth:i,today:a=r.today(),numberOfMonths:l=1}=t;let c=s||i||a;const{differenceInCalendarMonths:h,addMonths:f,startOfMonth:m}=r;if(n&&h(n,c)<l-1){const g=-1*(l-1);c=f(n,g)}return e&&h(c,e)<0&&(c=e),m(c)}function fNe(t,e,n,r){const{addDays:s,endOfBroadcastWeek:i,endOfISOWeek:a,endOfMonth:l,endOfWeek:c,getISOWeek:h,getWeek:f,startOfBroadcastWeek:m,startOfISOWeek:g,startOfWeek:x}=r,y=t.reduce((w,S)=>{const k=n.broadcastCalendar?m(S,r):n.ISOWeek?g(S):x(S),N=n.broadcastCalendar?i(S):n.ISOWeek?a(l(S)):c(l(S)),C=e.filter(M=>M>=k&&M<=N),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&C.length<T){const M=e.filter(q=>{const L=T-C.length;return q>N&&q<=s(N,L)});C.push(...M)}const _=C.reduce((M,q)=>{const L=n.ISOWeek?h(q):f(q),I=M.find(V=>V.weekNumber===L),$=new QV(q,S,r);return I?I.days.push($):M.push(new r7e(L,[$])),M},[]),E=new n7e(S,_);return w.push(E),w},[]);return n.reverseMonths?y.reverse():y}function mNe(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:a,endOfMonth:l,addYears:c,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 S=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=a(n):g?n=f(g,0,1):!n&&S&&(n=s(c(t.today??m(),-100))),r?r=l(r):x?r=f(x,11,31):!r&&S&&(r=h(t.today??m())),[n&&i(n),r&&i(r)]}function pNe(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:a,addMonths:l,differenceInCalendarMonths:c}=r,h=s?i:1,f=a(t);if(!e)return l(f,h);if(!(c(e,t)<i))return l(f,h)}function gNe(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i}=n,{startOfMonth:a,addMonths:l,differenceInCalendarMonths:c}=r,h=s?i??1:1,f=a(t);if(!e)return l(f,-h);if(!(c(f,e)<=0))return l(f,-h)}function xNe(t){const e=[];return t.reduce((n,r)=>n.concat(r.weeks.slice()),e.slice())}function Ey(t,e){const[n,r]=b.useState(t);return[e===void 0?n:e,r]}function vNe(t,e){const[n,r]=mNe(t,e),{startOfMonth:s,endOfMonth:i}=e,a=rD(t,n,r,e),[l,c]=Ey(a,t.month?a:void 0);b.useEffect(()=>{const E=rD(t,n,r,e);c(E)},[t.timeZone]);const h=hNe(l,r,t,e),f=uNe(h,t.endMonth?i(t.endMonth):void 0,t,e),m=fNe(h,f,t,e),g=xNe(m),x=dNe(m),y=gNe(l,n,t,e),w=pNe(l,r,t,e),{disableNavigation:S,onMonthChange:k}=t,N=E=>g.some(M=>M.days.some(q=>q.isEqualTo(E))),C=E=>{if(S)return;let M=s(E);n&&M<s(n)&&(M=s(n)),r&&M>s(r)&&(M=s(r)),c(M),k?.(M)};return{months:m,weeks:g,days:x,navStart:n,navEnd:r,previousMonth:y,nextMonth:w,goToMonth:C,goToDay:E=>{N(E)||C(E.date)}}}var Ha;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(Ha||(Ha={}));function sD(t){return!t[lr.disabled]&&!t[lr.hidden]&&!t[lr.outside]}function yNe(t,e,n,r){let s,i=-1;for(const a of t){const l=e(a);sD(l)&&(l[lr.focused]&&i<Ha.FocusedModifier?(s=a,i=Ha.FocusedModifier):r?.isEqualTo(a)&&i<Ha.LastFocused?(s=a,i=Ha.LastFocused):n(a.date)&&i<Ha.Selected?(s=a,i=Ha.Selected):l[lr.today]&&i<Ha.Today&&(s=a,i=Ha.Today))}return s||(s=t.find(a=>sD(e(a)))),s}function bNe(t,e,n,r,s,i,a){const{ISOWeek:l,broadcastCalendar:c}=i,{addDays:h,addMonths:f,addWeeks:m,addYears:g,endOfBroadcastWeek:x,endOfISOWeek:y,endOfWeek:w,max:S,min:k,startOfBroadcastWeek:N,startOfISOWeek:C,startOfWeek:T}=a;let E={day:h,week:m,month:f,year:g,startOfWeek:M=>c?N(M,a):l?C(M):T(M),endOfWeek:M=>c?x(M):l?y(M):w(M)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=S([r,E]):e==="after"&&s&&(E=k([s,E])),E}function eU(t,e,n,r,s,i,a,l=0){if(l>365)return;const c=bNe(t,e,n.date,r,s,i,a),h=!!(i.disabled&&el(c,i.disabled,a)),f=!!(i.hidden&&el(c,i.hidden,a)),m=c,g=new QV(c,m,a);return!h&&!f?g:eU(t,e,g,r,s,i,a,l+1)}function wNe(t,e,n,r,s){const{autoFocus:i}=t,[a,l]=b.useState(),c=yNe(e.days,n,r||(()=>!1),a),[h,f]=b.useState(i?c:void 0);return{isFocusTarget:w=>!!c?.isEqualTo(w),setFocused:f,focused:h,blur:()=>{l(h),f(void 0)},moveFocus:(w,S)=>{if(!h)return;const k=eU(w,S,h,e.navStart,e.navEnd,t,s);k&&(t.disableNavigation&&!e.days.some(C=>C.isEqualTo(k))||(e.goToDay(k),f(k)))}}}function SNe(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=Ey(n,s?n:void 0),l=s?n:i,{isSameDay:c}=e,h=x=>l?.some(y=>c(y,x))??!1,{min:f,max:m}=t;return{selected:l,select:(x,y,w)=>{let S=[...l??[]];if(h(x)){if(l?.length===f||r&&l?.length===1)return;S=l?.filter(k=>!c(k,x))}else l?.length===m?S=[x]:S=[...S,x];return s||a(S),s?.(S,x,y,w),S},isSelected:h}}function kNe(t,e,n=0,r=0,s=!1,i=xo){const{from:a,to:l}=e||{},{isSameDay:c,isAfter:h,isBefore:f}=i;let m;if(!a&&!l)m={from:t,to:n>0?void 0:t};else if(a&&!l)c(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&&l)if(c(a,t)&&c(l,t))s?m={from:a,to:l}:m=void 0;else if(c(a,t))m={from:a,to:n>0?void 0:t};else if(c(l,t))m={from:t,to:n>0?void 0:t};else if(f(t,a))m={from:t,to:l};else if(h(t,a))m={from:a,to:t};else if(h(t,l))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&&g<n&&(m={from:t,to:void 0})}return m}function ONe(t,e,n=xo){const r=Array.isArray(e)?e:[e];let s=t.from;const i=n.differenceInCalendarDays(t.to,t.from),a=Math.min(i,6);for(let l=0;l<=a;l++){if(r.includes(s.getDay()))return!0;s=n.addDays(s,1)}return!1}function iD(t,e,n=xo){return Jo(t,e.from,!1,n)||Jo(t,e.to,!1,n)||Jo(e,t.from,!1,n)||Jo(e,t.to,!1,n)}function jNe(t,e,n=xo){const r=Array.isArray(e)?e:[e];if(r.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:n.isDate(l)?Jo(t,l,!1,n):XV(l,n)?l.some(c=>Jo(t,c,!1,n)):jj(l)?l.from&&l.to?iD(t,{from:l.from,to:l.to},n):!1:GV(l)?ONe(t,l.dayOfWeek,n):VV(l)?n.isAfter(l.before,l.after)?iD(t,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):el(t.from,l,n)||el(t.to,l,n):UV(l)||WV(l)?el(t.from,l,n)||el(t.to,l,n):!1))return!0;const a=r.filter(l=>typeof l=="function");if(a.length){let l=t.from;const c=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=c;h++){if(a.some(f=>f(l)))return!0;l=n.addDays(l,1)}}return!1}function NNe(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:a}=t,[l,c]=Ey(s,a?s:void 0),h=a?s:l;return{selected:h,select:(g,x,y)=>{const{min:w,max:S}=t,k=g?kNe(g,h,w,S,i,e):void 0;return r&&n&&k?.from&&k.to&&jNe({from:k.from,to:k.to},n,e)&&(k.from=g,k.to=void 0),a||c(k),a?.(k,g,x,y),k},isSelected:g=>h&&Jo(h,g,!1,e)}}function CNe(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=Ey(n,s?n:void 0),l=s?n:i,{isSameDay:c}=e;return{selected:l,select:(m,g,x)=>{let y=m;return!r&&l&&l&&c(m,l)&&(y=void 0),s||a(y),s?.(y,m,g,x),y},isSelected:m=>l?c(l,m):!1}}function TNe(t,e){const n=CNe(t,e),r=SNe(t,e),s=NNe(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function ENe(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new xs(e.today,e.timeZone)),e.month&&(e.month=new xs(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new xs(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new xs(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new xs(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new xs(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(pt=>new xs(pt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new xs(e.selected.from,e.timeZone):void 0,to:e.selected.to?new xs(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:a,classNames:l}=b.useMemo(()=>{const pt={...Oj,...e.locale};return{dateLib:new Ai({locale:pt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:R7e(e.components),formatters:Q7e(e.formatters),labels:{...iNe,...e.labels},locale:pt,classNames:{...Nj(),...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:c,mode:h,navLayout:f,numberOfMonths:m=1,onDayBlur:g,onDayClick:x,onDayFocus:y,onDayKeyDown:w,onDayMouseEnter:S,onDayMouseLeave:k,onNextClick:N,onPrevClick:C,showWeekNumber:T,styles:_}=e,{formatCaption:E,formatDay:M,formatMonthDropdown:q,formatWeekNumber:L,formatWeekNumberHeader:I,formatWeekdayName:$,formatYearDropdown:V}=r,ee=vNe(e,i),{days:z,months:H,navStart:P,navEnd:W,previousMonth:J,nextMonth:X,goToMonth:R}=ee,se=M7e(z,e,P,W,i),{isSelected:G,select:F,selected:U}=TNe(e,i)??{},{blur:te,focused:ne,isFocusTarget:Y,moveFocus:ae,setFocused:re}=wNe(e,ee,se,G??(()=>!1),i),{labelDayButton:oe,labelGridcell:_e,labelGrid:Ge,labelMonthDropdown:tt,labelNav:Xe,labelPrevious:je,labelNext:Qe,labelWeekday:He,labelWeekNumber:$e,labelWeekNumberHeader:bt,labelYearDropdown:ot}=s,on=b.useMemo(()=>U7e(i,e.ISOWeek),[i,e.ISOWeek]),Tn=h!==void 0||x!==void 0,Nn=b.useCallback(()=>{J&&(R(J),C?.(J))},[J,R,C]),Rt=b.useCallback(()=>{X&&(R(X),N?.(X))},[R,X,N]),xt=b.useCallback((pt,vn)=>vt=>{vt.preventDefault(),vt.stopPropagation(),re(pt),F?.(pt.date,vn,vt),x?.(pt.date,vn,vt)},[F,x,re]),Te=b.useCallback((pt,vn)=>vt=>{re(pt),y?.(pt.date,vn,vt)},[y,re]),Re=b.useCallback((pt,vn)=>vt=>{te(),g?.(pt.date,vn,vt)},[te,g]),qe=b.useCallback((pt,vn)=>vt=>{const Wt={ArrowLeft:[vt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[vt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[vt.shiftKey?"year":"week","after"],ArrowUp:[vt.shiftKey?"year":"week","before"],PageUp:[vt.shiftKey?"year":"month","before"],PageDown:[vt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Wt[vt.key]){vt.preventDefault(),vt.stopPropagation();const[Ht,lt]=Wt[vt.key];ae(Ht,lt)}w?.(pt.date,vn,vt)},[ae,w,e.dir]),rt=b.useCallback((pt,vn)=>vt=>{S?.(pt.date,vn,vt)},[S]),wt=b.useCallback((pt,vn)=>vt=>{k?.(pt.date,vn,vt)},[k]),jt=b.useCallback(pt=>vn=>{const vt=Number(vn.target.value),Wt=i.setMonth(i.startOfMonth(pt),vt);R(Wt)},[i,R]),Ne=b.useCallback(pt=>vn=>{const vt=Number(vn.target.value),Wt=i.setYear(i.startOfMonth(pt),vt);R(Wt)},[i,R]),{className:ie,style:xe}=b.useMemo(()=>({className:[l[gt.Root],e.className].filter(Boolean).join(" "),style:{..._?.[gt.Root],...e.style}}),[l,e.className,e.style,_]),Je=D7e(e),dt=b.useRef(null);cNe(dt,!!e.animate,{classNames:l,months:H,focused:ne,dateLib:i});const er={dayPickerProps:e,selected:U,select:F,isSelected:G,months:H,nextMonth:X,previousMonth:J,goToMonth:R,getModifiers:se,components:n,classNames:l,styles:_,labels:s,formatters:r};return he.createElement(HV.Provider,{value:er},he.createElement(n.Root,{rootRef:e.animate?dt:void 0,className:ie,style:xe,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"],...Je},he.createElement(n.Months,{className:l[gt.Months],style:_?.[gt.Months]},!e.hideNavigation&&!f&&he.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[gt.Nav],style:_?.[gt.Nav],"aria-label":Xe(),onPreviousClick:Nn,onNextClick:Rt,previousMonth:J,nextMonth:X}),H.map((pt,vn)=>he.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:l[gt.Month],style:_?.[gt.Month],key:vn,displayIndex:vn,calendarMonth:pt},f==="around"&&!e.hideNavigation&&vn===0&&he.createElement(n.PreviousMonthButton,{type:"button",className:l[gt.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":je(J),onClick:Nn,"data-animated-button":e.animate?"true":void 0},he.createElement(n.Chevron,{disabled:J?void 0:!0,className:l[gt.Chevron],orientation:e.dir==="rtl"?"right":"left"})),he.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:l[gt.MonthCaption],style:_?.[gt.MonthCaption],calendarMonth:pt,displayIndex:vn},c?.startsWith("dropdown")?he.createElement(n.DropdownNav,{className:l[gt.Dropdowns],style:_?.[gt.Dropdowns]},(()=>{const vt=c==="dropdown"||c==="dropdown-months"?he.createElement(n.MonthsDropdown,{key:"month",className:l[gt.MonthsDropdown],"aria-label":tt(),classNames:l,components:n,disabled:!!e.disableNavigation,onChange:jt(pt.date),options:H7e(pt.date,P,W,r,i),style:_?.[gt.Dropdown],value:i.getMonth(pt.date)}):he.createElement("span",{key:"month"},q(pt.date,i)),Wt=c==="dropdown"||c==="dropdown-years"?he.createElement(n.YearsDropdown,{key:"year",className:l[gt.YearsDropdown],"aria-label":ot(i.options),classNames:l,components:n,disabled:!!e.disableNavigation,onChange:Ne(pt.date),options:W7e(P,W,r,i,!!e.reverseYears),style:_?.[gt.Dropdown],value:i.getYear(pt.date)}):he.createElement("span",{key:"year"},V(pt.date,i));return i.getMonthYearOrder()==="year-first"?[Wt,vt]:[vt,Wt]})(),he.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"}},E(pt.date,i.options,i))):he.createElement(n.CaptionLabel,{className:l[gt.CaptionLabel],role:"status","aria-live":"polite"},E(pt.date,i.options,i))),f==="around"&&!e.hideNavigation&&vn===m-1&&he.createElement(n.NextMonthButton,{type:"button",className:l[gt.NextMonthButton],tabIndex:X?void 0:-1,"aria-disabled":X?void 0:!0,"aria-label":Qe(X),onClick:Rt,"data-animated-button":e.animate?"true":void 0},he.createElement(n.Chevron,{disabled:X?void 0:!0,className:l[gt.Chevron],orientation:e.dir==="rtl"?"left":"right"})),vn===m-1&&f==="after"&&!e.hideNavigation&&he.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[gt.Nav],style:_?.[gt.Nav],"aria-label":Xe(),onPreviousClick:Nn,onNextClick:Rt,previousMonth:J,nextMonth:X}),he.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Ge(pt.date,i.options,i)||void 0,className:l[gt.MonthGrid],style:_?.[gt.MonthGrid]},!e.hideWeekdays&&he.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:l[gt.Weekdays],style:_?.[gt.Weekdays]},T&&he.createElement(n.WeekNumberHeader,{"aria-label":bt(i.options),className:l[gt.WeekNumberHeader],style:_?.[gt.WeekNumberHeader],scope:"col"},I()),on.map(vt=>he.createElement(n.Weekday,{"aria-label":He(vt,i.options,i),className:l[gt.Weekday],key:String(vt),style:_?.[gt.Weekday],scope:"col"},$(vt,i.options,i)))),he.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:l[gt.Weeks],style:_?.[gt.Weeks]},pt.weeks.map(vt=>he.createElement(n.Week,{className:l[gt.Week],key:vt.weekNumber,style:_?.[gt.Week],week:vt},T&&he.createElement(n.WeekNumber,{week:vt,style:_?.[gt.WeekNumber],"aria-label":$e(vt.weekNumber,{locale:a}),className:l[gt.WeekNumber],scope:"row",role:"rowheader"},L(vt.weekNumber,i)),vt.days.map(Wt=>{const{date:Ht}=Wt,lt=se(Wt);if(lt[lr.focused]=!lt.hidden&&!!ne?.isEqualTo(Wt),lt[ba.selected]=G?.(Ht)||lt.selected,jj(U)){const{from:dr,to:Nr}=U;lt[ba.range_start]=!!(dr&&Nr&&i.isSameDay(Ht,dr)),lt[ba.range_end]=!!(dr&&Nr&&i.isSameDay(Ht,Nr)),lt[ba.range_middle]=Jo(U,Ht,!0,i)}const ur=V7e(lt,_,e.modifiersStyles),Xr=A7e(lt,l,e.modifiersClassNames),Yr=!Tn&&!lt.hidden?_e(Ht,lt,i.options,i):void 0;return he.createElement(n.Day,{key:`${i.format(Ht,"yyyy-MM-dd")}_${i.format(Wt.displayMonth,"yyyy-MM")}`,day:Wt,modifiers:lt,className:Xr.join(" "),style:ur,role:"gridcell","aria-selected":lt.selected||void 0,"aria-label":Yr,"data-day":i.format(Ht,"yyyy-MM-dd"),"data-month":Wt.outside?i.format(Ht,"yyyy-MM"):void 0,"data-selected":lt.selected||void 0,"data-disabled":lt.disabled||void 0,"data-hidden":lt.hidden||void 0,"data-outside":Wt.outside||void 0,"data-focused":lt.focused||void 0,"data-today":lt.today||void 0},!lt.hidden&&Tn?he.createElement(n.DayButton,{className:l[gt.DayButton],style:_?.[gt.DayButton],type:"button",day:Wt,modifiers:lt,disabled:lt.disabled||void 0,tabIndex:Y(Wt)?0:-1,"aria-label":oe(Ht,lt,i.options,i),onClick:xt(Wt,lt),onBlur:Re(Wt,lt),onFocus:Te(Wt,lt),onKeyDown:qe(Wt,lt),onMouseEnter:rt(Wt,lt),onMouseLeave:wt(Wt,lt)},M(Ht,i.options,i)):!lt.hidden&&M(Wt.date,i.options,i))})))))))),e.footer&&he.createElement(n.Footer,{className:l[gt.Footer],style:_?.[gt.Footer],role:"status","aria-live":"polite"},e.footer)))}function aD({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:a,...l}){const c=Nj();return o.jsx(ENe,{showOutsideDays:n,className:ye("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:ye("w-fit",c.root),months:ye("relative flex flex-col gap-4 md:flex-row",c.months),month:ye("flex w-full flex-col gap-4",c.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:ye(qm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_previous),button_next:ye(qm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",c.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:ye("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",c.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",c.dropdown),caption_label:ye("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",c.caption_label),table:"w-full border-collapse",weekdays:ye("flex",c.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",c.weekday),week:ye("mt-2 flex w-full",c.week),week_number_header:ye("w-[--cell-size] select-none",c.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",c.week_number),day:ye("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",c.day),range_start:ye("bg-accent rounded-l-md",c.range_start),range_middle:ye("rounded-none",c.range_middle),range_end:ye("bg-accent rounded-r-md",c.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",c.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:ye("text-muted-foreground opacity-50",c.disabled),hidden:ye("invisible",c.hidden),...e},components:{Root:({className:h,rootRef:f,...m})=>o.jsx("div",{"data-slot":"calendar",ref:f,className:ye(h),...m}),Chevron:({className:h,orientation:f,...m})=>f==="left"?o.jsx(Iu,{className:ye("size-4",h),...m}):f==="right"?o.jsx(Bu,{className:ye("size-4",h),...m}):o.jsx(Im,{className:ye("size-4",h),...m}),DayButton:_Ne,WeekNumber:({children:h,...f})=>o.jsx("td",{...f,children:o.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...a},...l})}function _Ne({className:t,day:e,modifiers:n,...r}){const s=Nj(),i=b.useRef(null);return b.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),o.jsx(me,{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:ye("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 MNe{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 $d=new MNe;typeof window<"u"&&$d.connect();const ANe={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}} 年"}},RNe=(t,e,n)=>{let r;const s=ANe[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},DNe={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},zNe={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},PNe={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},LNe={date:uh({formats:DNe,defaultWidth:"full"}),time:uh({formats:zNe,defaultWidth:"full"}),dateTime:uh({formats:PNe,defaultWidth:"full"})};function oD(t,e,n){const r="eeee p";return Gje(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const INe={lastWeek:oD,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:oD,other:"PP p"},BNe=(t,e,n,r)=>{const s=INe[t];return typeof s=="function"?s(e,n,r):s},qNe={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},FNe={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},$Ne={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},QNe={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},HNe={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:"夜间"}},VNe={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:"夜间"}},UNe=(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()}},WNe={ordinalNumber:UNe,era:Ga({values:qNe,defaultWidth:"wide"}),quarter:Ga({values:FNe,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ga({values:$Ne,defaultWidth:"wide"}),day:Ga({values:QNe,defaultWidth:"wide"}),dayPeriod:Ga({values:HNe,defaultWidth:"wide",formattingValues:VNe,defaultFormattingWidth:"wide"})},GNe=/^(第\s*)?\d+(日|时|分|秒)?/i,XNe=/\d+/i,YNe={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},KNe={any:[/^(前)/i,/^(公元)/i]},ZNe={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},JNe={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},e8e={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},t8e={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]},n8e={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},r8e={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},s8e={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},i8e={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},a8e={ordinalNumber:LV({matchPattern:GNe,parsePattern:XNe,valueCallback:t=>parseInt(t,10)}),era:Xa({matchPatterns:YNe,defaultMatchWidth:"wide",parsePatterns:KNe,defaultParseWidth:"any"}),quarter:Xa({matchPatterns:ZNe,defaultMatchWidth:"wide",parsePatterns:JNe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Xa({matchPatterns:e8e,defaultMatchWidth:"wide",parsePatterns:t8e,defaultParseWidth:"any"}),day:Xa({matchPatterns:n8e,defaultMatchWidth:"wide",parsePatterns:r8e,defaultParseWidth:"any"}),dayPeriod:Xa({matchPatterns:s8e,defaultMatchWidth:"any",parsePatterns:i8e,defaultParseWidth:"any"})},Bx={code:"zh-CN",formatDistance:RNe,formatLong:LNe,formatRelative:BNe,localize:WNe,match:a8e,options:{weekStartsOn:1,firstWeekContainsDate:4}},qx={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function o8e(){const[t,e]=b.useState([]),[n,r]=b.useState(""),[s,i]=b.useState("all"),[a,l]=b.useState("all"),[c,h]=b.useState(void 0),[f,m]=b.useState(void 0),[g,x]=b.useState(!0),[y,w]=b.useState(!1),[S,k]=b.useState("xs"),[N,C]=b.useState(4),T=b.useRef(null);b.useEffect(()=>{const P=$d.getAllLogs();e(P);const W=$d.onLog(()=>{e($d.getAllLogs())}),J=$d.onConnectionChange(X=>{w(X)});return()=>{W(),J()}},[]);const _=b.useMemo(()=>{const P=new Set(t.map(W=>W.module));return Array.from(P).sort()},[t]),E=P=>{switch(P){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"}},M=P=>{switch(P){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"}},q=()=>{window.location.reload()},L=()=>{$d.clearLogs(),e([])},I=()=>{const P=ee.map(R=>`${R.timestamp} [${R.level.padEnd(8)}] [${R.module}] ${R.message}`).join(`
`),W=new Blob([P],{type:"text/plain;charset=utf-8"}),J=URL.createObjectURL(W),X=document.createElement("a");X.href=J,X.download=`logs-${y1(new Date,"yyyy-MM-dd-HHmmss")}.txt`,X.click(),URL.revokeObjectURL(J)},$=()=>{x(!g)},V=()=>{h(void 0),m(void 0)},ee=b.useMemo(()=>t.filter(P=>{const W=n===""||P.message.toLowerCase().includes(n.toLowerCase())||P.module.toLowerCase().includes(n.toLowerCase()),J=s==="all"||P.level===s,X=a==="all"||P.module===a;let R=!0;if(c||f){const se=new Date(P.timestamp);if(c){const G=new Date(c);G.setHours(0,0,0,0),R=R&&se>=G}if(f){const G=new Date(f);G.setHours(23,59,59,999),R=R&&se<=G}}return W&&J&&X&&R}),[t,n,s,a,c,f]),z=qx[S].rowHeight+N,H=TOe({count:ee.length,getScrollElement:()=>T.current,estimateSize:()=>z,overscan:15});return b.useEffect(()=>{g&&ee.length>0&&H.scrollToIndex(ee.length-1,{align:"end",behavior:"auto"})},[ee.length,g,H]),o.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex-shrink-0 space-y-4 p-3 sm:p-4 lg:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",y?"bg-green-500 animate-pulse":"bg-red-500")}),o.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:y?"已连接":"未连接"})]})]}),o.jsx(_t,{className:"p-3 sm:p-4",children:o.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索日志...",value:n,onChange:P=>r(P.target.value),className:"pl-9 h-9 text-sm"})]}),o.jsxs(Dt,{value:s,onValueChange:i,children:[o.jsxs(Mt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[o.jsx(N3,{className:"h-4 w-4 mr-2"}),o.jsx(zt,{placeholder:"级别"})]}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部级别"}),o.jsx(ze,{value:"DEBUG",children:"DEBUG"}),o.jsx(ze,{value:"INFO",children:"INFO"}),o.jsx(ze,{value:"WARNING",children:"WARNING"}),o.jsx(ze,{value:"ERROR",children:"ERROR"}),o.jsx(ze,{value:"CRITICAL",children:"CRITICAL"})]})]}),o.jsxs(Dt,{value:a,onValueChange:l,children:[o.jsxs(Mt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[o.jsx(N3,{className:"h-4 w-4 mr-2"}),o.jsx(zt,{placeholder:"模块"})]}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部模块"}),_.map(P=>o.jsx(ze,{value:P,children:P},P))]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!c&&"text-muted-foreground"),children:[o.jsx(MC,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"text-xs sm:text-sm",children:c?y1(c,"PPP",{locale:Bx}):"开始日期"})]})}),o.jsx(so,{className:"w-auto p-0",align:"start",children:o.jsx(aD,{mode:"single",selected:c,onSelect:h,initialFocus:!0,locale:Bx})})]}),o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!f&&"text-muted-foreground"),children:[o.jsx(MC,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"text-xs sm:text-sm",children:f?y1(f,"PPP",{locale:Bx}):"结束日期"})]})}),o.jsx(so,{className:"w-auto p-0",align:"start",children:o.jsx(aD,{mode:"single",selected:f,onSelect:m,initialFocus:!0,locale:Bx})})]}),(c||f)&&o.jsxs(me,{variant:"outline",size:"sm",onClick:V,className:"w-full sm:w-auto h-9",children:[o.jsx(_0,{className:"h-4 w-4 sm:mr-2"}),o.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),o.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsxs(me,{variant:g?"default":"outline",size:"sm",onClick:$,className:"flex-1 sm:flex-none h-9",children:[g?o.jsx(_K,{className:"h-4 w-4"}):o.jsx(MK,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:g?"自动滚动":"已暂停"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:q,className:"flex-1 sm:flex-none h-9",children:[o.jsx(Ti,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:L,className:"flex-1 sm:flex-none h-9",children:[o.jsx(sn,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:I,className:"flex-1 sm:flex-none h-9",children:[o.jsx(yu,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),o.jsx("div",{className:"flex-1 hidden sm:block"}),o.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[o.jsxs("span",{className:"font-mono",children:[ee.length," / ",t.length]}),o.jsx("span",{className:"ml-1",children:"条日志"})]})]}),o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6 pt-2 border-t border-border/50",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(AK,{className:"h-4 w-4"}),o.jsx("span",{children:"字号"})]}),o.jsx("div",{className:"flex gap-1",children:Object.keys(qx).map(P=>o.jsx(me,{variant:S===P?"default":"outline",size:"sm",onClick:()=>k(P),className:"h-7 px-3 text-xs",children:qx[P].label},P))})]}),o.jsxs("div",{className:"flex items-center gap-3 flex-1 max-w-xs",children:[o.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"行距"}),o.jsx(B0,{value:[N],onValueChange:([P])=>C(P),min:0,max:12,step:2,className:"flex-1"}),o.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[N,"px"]})]})]})]})})]}),o.jsx("div",{className:"flex-1 min-h-0 px-3 sm:px-4 lg:px-6 pb-3 sm:pb-4 lg:pb-6",children:o.jsx(_t,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full",children:o.jsx(kn,{viewportRef:T,className:"h-full",children:o.jsx("div",{className:ye("p-2 sm:p-3 font-mono relative",qx[S].class),style:{height:`${H.getTotalSize()}px`},children:ee.length===0?o.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):H.getVirtualItems().map(P=>{const W=ee[P.index];return o.jsxs("div",{"data-index":P.index,ref:H.measureElement,className:ye("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",M(W.level)),style:{transform:`translateY(${P.start}px)`,paddingTop:`${N/2}px`,paddingBottom:`${N/2}px`},children:[o.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-600",children:W.timestamp}),o.jsxs("span",{className:ye("font-semibold",E(W.level)),children:["[",W.level,"]"]})]}),o.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate",children:W.module}),o.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words",children:W.message})]}),o.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:W.timestamp}),o.jsxs("span",{className:ye("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",E(W.level)),children:["[",W.level,"]"]}),o.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:W.module}),o.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:W.message})]})]},P.key)})})})})})]})}const l8e="Mai-with-u",c8e="plugin-repo",u8e="main",d8e="plugin_details.json";async function h8e(){try{const t=await mt("/api/webui/plugins/fetch-raw",{method:"POST",headers:Nt(),body:JSON.stringify({owner:l8e,repo:c8e,branch:u8e,file_path:d8e})});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 f8e(){try{const t=await mt("/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 m8e(){try{const t=await mt("/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 p8e(t,e,n){const r=t.split(".").map(l=>parseInt(l)||0),s=r[0]||0,i=r[1]||0,a=r[2]||0;if(n.version_major<s||n.version_major===s&&n.version_minor<i||n.version_major===s&&n.version_minor===i&&n.version_patch<a)return!1;if(e){const l=e.split(".").map(m=>parseInt(m)||0),c=l[0]||0,h=l[1]||0,f=l[2]||0;if(n.version_major>c||n.version_major===c&&n.version_minor>h||n.version_major===c&&n.version_minor===h&&n.version_patch>f)return!1}return!0}function g8e(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 Fx(){try{const t=await mt("/api/webui/plugins/installed",{headers:Nt()});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 $x(t,e){return e.some(n=>n.id===t)}function Qx(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function x8e(t,e,n="main"){const r=await mt("/api/webui/plugins/install",{method:"POST",headers:Nt(),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 v8e(t){const e=await mt("/api/webui/plugins/uninstall",{method:"POST",headers:Nt(),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 y8e(t,e,n="main"){const r=await mt("/api/webui/plugins/update",{method:"POST",headers:Nt(),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 pp="https://maibot-plugin-stats.maibot-webui.workers.dev";async function tU(t){try{const e=await fetch(`${pp}/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 b8e(t,e){try{const n=e||Cj(),r=await fetch(`${pp}/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 w8e(t,e){try{const n=e||Cj(),r=await fetch(`${pp}/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 S8e(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||Cj(),i=await fetch(`${pp}/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 k8e(t){try{const e=await fetch(`${pp}/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 O8e(){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<e.length;r++){const s=e.charCodeAt(r);n=(n<<5)-n+s,n=n&n}return`fp_${Math.abs(n).toString(36)}`}function Cj(){const t="maibot_user_id";let e=localStorage.getItem(t);if(!e){const n=O8e(),r=Date.now().toString(36),s=Math.random().toString(36).substring(2,15);e=`${n}_${r}_${s}`,localStorage.setItem(t,e)}return e}function j8e({pluginId:t,compact:e=!1}){const[n,r]=b.useState(null),[s,i]=b.useState(!0),[a,l]=b.useState(0),[c,h]=b.useState(""),[f,m]=b.useState(!1),{toast:g}=Wr(),x=async()=>{i(!0);const k=await tU(t);k&&r(k),i(!1)};b.useEffect(()=>{x()},[t]);const y=async()=>{const k=await b8e(t);k.success?(g({title:"已点赞",description:"感谢你的支持!"}),x()):g({title:"点赞失败",description:k.error||"未知错误",variant:"destructive"})},w=async()=>{const k=await w8e(t);k.success?(g({title:"已反馈",description:"感谢你的反馈!"}),x()):g({title:"操作失败",description:k.error||"未知错误",variant:"destructive"})},S=async()=>{if(a===0){g({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const k=await S8e(t,a,c||void 0);k.success?(g({title:"评分成功",description:"感谢你的评价!"}),m(!1),l(0),h(""),x()):g({title:"评分失败",description:k.error||"未知错误",variant:"destructive"})};return s?o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(yu,{className:"h-4 w-4"}),o.jsx("span",{children:"-"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(tc,{className:"h-4 w-4"}),o.jsx("span",{children:"-"})]})]}):n?e?o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[o.jsx(yu,{className:"h-4 w-4"}),o.jsx("span",{children:n.downloads.toLocaleString()})]}),o.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[o.jsx(tc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsx("span",{children:n.rating.toFixed(1)})]}),o.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[o.jsx(V2,{className:"h-4 w-4"}),o.jsx("span",{children:n.likes})]})]}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(yu,{className:"h-5 w-5 text-muted-foreground mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(tc,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),o.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(V2,{className:"h-5 w-5 text-green-500 mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.likes}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(AC,{className:"h-5 w-5 text-red-500 mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(me,{variant:"outline",size:"sm",onClick:y,children:[o.jsx(V2,{className:"h-4 w-4 mr-1"}),"点赞"]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:w,children:[o.jsx(AC,{className:"h-4 w-4 mr-1"}),"点踩"]}),o.jsxs(zr,{open:f,onOpenChange:m,children:[o.jsx(h6,{asChild:!0,children:o.jsxs(me,{variant:"default",size:"sm",children:[o.jsx(tc,{className:"h-4 w-4 mr-1"}),"评分"]})}),o.jsxs(Sr,{children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"为插件评分"}),o.jsx(ps,{children:"分享你的使用体验,帮助其他用户"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(k=>o.jsx("button",{onClick:()=>l(k),className:"focus:outline-none",children:o.jsx(tc,{className:`h-8 w-8 transition-colors ${k<=a?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},k))}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[a===0&&"点击星星进行评分",a===1&&"很差",a===2&&"一般",a===3&&"还行",a===4&&"不错",a===5&&"非常好"]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),o.jsx(nr,{value:c,onChange:k=>h(k.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),o.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[c.length," / 500"]})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>m(!1),children:"取消"}),o.jsx(me,{onClick:S,disabled:a===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),o.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((k,N)=>o.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(C=>o.jsx(tc,{className:`h-3 w-3 ${C<=k.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},C))}),o.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(k.created_at).toLocaleDateString()})]}),k.comment&&o.jsx("p",{className:"text-sm text-muted-foreground",children:k.comment})]},N))})]})]}):null}const lD={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function N8e(){const t=Ca(),[e,n]=b.useState(null),[r,s]=b.useState(""),[i,a]=b.useState("all"),[l,c]=b.useState("all"),[h,f]=b.useState(!0),[m,g]=b.useState([]),[x,y]=b.useState(!0),[w,S]=b.useState(null),[k,N]=b.useState(null),[C,T]=b.useState(null),[_,E]=b.useState(null),[,M]=b.useState([]),[q,L]=b.useState({}),{toast:I}=Wr(),$=async R=>{const se=R.map(async U=>{try{const te=await tU(U.id);return{id:U.id,stats:te}}catch(te){return console.warn(`Failed to load stats for ${U.id}:`,te),{id:U.id,stats:null}}}),G=await Promise.all(se),F={};G.forEach(({id:U,stats:te})=>{te&&(F[U]=te)}),L(F)};b.useEffect(()=>{let R=null,se=!1;return(async()=>{if(R=g8e(F=>{se||(T(F),F.stage==="success"?setTimeout(()=>{se||T(null)},2e3):F.stage==="error"&&(y(!1),S(F.error||"加载失败")))},F=>{console.error("WebSocket error:",F),se||I({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(F=>{if(!R){F();return}const U=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),F()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),F()):setTimeout(U,100)};U()}),!se){const F=await f8e();N(F),F.installed||I({title:"Git 未安装",description:F.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!se){const F=await m8e();E(F)}if(!se)try{y(!0),S(null);const F=await h8e();if(!se){const U=await Fx();M(U);const te=F.map(ne=>{const Y=$x(ne.id,U),ae=Qx(ne.id,U);return{...ne,installed:Y,installed_version:ae}});for(const ne of U)!te.some(ae=>ae.id===ne.id)&&ne.manifest&&te.push({id:ne.id,manifest:{manifest_version:ne.manifest.manifest_version||1,name:ne.manifest.name,version:ne.manifest.version,description:ne.manifest.description||"",author:ne.manifest.author,license:ne.manifest.license||"Unknown",host_application:ne.manifest.host_application,homepage_url:ne.manifest.homepage_url,repository_url:ne.manifest.repository_url,keywords:ne.manifest.keywords||[],categories:ne.manifest.categories||[],default_locale:ne.manifest.default_locale||"zh-CN",locales_path:ne.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ne.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});g(te),$(te)}}catch(F){if(!se){const U=F instanceof Error?F.message:"加载插件列表失败";S(U),I({title:"加载失败",description:U,variant:"destructive"})}}finally{se||y(!1)}})(),()=>{se=!0,R&&R.close()}},[I]);const V=R=>{if(!R.installed&&_&&!ee(R))return o.jsxs(Ln,{variant:"destructive",className:"gap-1",children:[o.jsx(Ou,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const se=R.installed_version?.trim(),G=R.manifest.version?.trim();if(se!==G){const F=se?.split(".").map(Number)||[0,0,0],U=G?.split(".").map(Number)||[0,0,0];for(let te=0;te<3;te++){if((U[te]||0)>(F[te]||0))return o.jsxs(Ln,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[o.jsx(Ou,{className:"h-3 w-3"}),"可更新"]});if((U[te]||0)<(F[te]||0))break}}return o.jsxs(Ln,{variant:"default",className:"gap-1",children:[o.jsx(pc,{className:"h-3 w-3"}),"已安装"]})}return null},ee=R=>!_||!R.manifest?.host_application?!0:p8e(R.manifest.host_application.min_version,R.manifest.host_application.max_version,_),z=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const se=R.installed_version.trim(),G=R.manifest.version.trim();if(se===G)return!1;const F=se.split(".").map(Number),U=G.split(".").map(Number);for(let te=0;te<3;te++){if((U[te]||0)>(F[te]||0))return!0;if((U[te]||0)<(F[te]||0))return!1}return!1},H=m.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(te=>te.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let F=!0;l==="installed"?F=R.installed===!0:l==="updates"&&(F=R.installed===!0&&z(R));const U=!h||!_||ee(R);return se&&G&&F&&U}),P=()=>{n(null)},W=async R=>{if(!k?.installed){I({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(_&&!ee(R)){I({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await x8e(R.id,R.manifest.repository_url||"","main"),k8e(R.id).catch(G=>{console.warn("Failed to record download:",G)}),I({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const se=await Fx();M(se),g(G=>G.map(F=>{if(F.id===R.id){const U=$x(F.id,se),te=Qx(F.id,se);return{...F,installed:U,installed_version:te}}return F}))}catch(se){I({title:"安装失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},J=async R=>{try{await v8e(R.id),I({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const se=await Fx();M(se),g(G=>G.map(F=>{if(F.id===R.id){const U=$x(F.id,se),te=Qx(F.id,se);return{...F,installed:U,installed_version:te}}return F}))}catch(se){I({title:"卸载失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},X=async R=>{if(!k?.installed){I({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const se=await y8e(R.id,R.manifest.repository_url||"","main");I({title:"更新成功",description:`${R.manifest.name} 已从 ${se.old_version} 更新到 ${se.new_version}`});const G=await Fx();M(G),g(F=>F.map(U=>{if(U.id===R.id){const te=$x(U.id,G),ne=Qx(U.id,G);return{...U,installed:te,installed_version:ne}}return U}))}catch(se){I({title:"更新失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}};return o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),o.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),o.jsxs(me,{onClick:()=>t({to:"/plugin-mirrors"}),children:[o.jsx(RK,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),k&&!k.installed&&o.jsxs(_t,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[o.jsx(wn,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Xd,{className:"h-5 w-5 text-orange-600"}),o.jsxs("div",{children:[o.jsx(Sn,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),o.jsx(Fr,{className:"text-orange-800 dark:text-orange-200",children:k.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),o.jsx(An,{children:o.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",o.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),o.jsx(_t,{className:"p-4",children:o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),o.jsxs(Dt,{value:i,onValueChange:a,children:[o.jsx(Mt,{className:"w-full sm:w-[200px]",children:o.jsx(zt,{placeholder:"选择分类"})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部分类"}),o.jsx(ze,{value:"Group Management",children:"群组管理"}),o.jsx(ze,{value:"Entertainment & Interaction",children:"娱乐互动"}),o.jsx(ze,{value:"Utility Tools",children:"实用工具"}),o.jsx(ze,{value:"Content Generation",children:"内容生成"}),o.jsx(ze,{value:"Multimedia",children:"多媒体"}),o.jsx(ze,{value:"External Integration",children:"外部集成"}),o.jsx(ze,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),o.jsx(ze,{value:"Other",children:"其他"})]})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ri,{id:"compatible-only",checked:h,onCheckedChange:R=>f(R===!0)}),o.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),o.jsx(ll,{value:l,onValueChange:c,className:"w-full",children:o.jsxs(ro,{className:"grid w-full grid-cols-3",children:[o.jsxs(Jt,{value:"all",children:["全部插件 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return se&&G&&F}).length,")"]}),o.jsxs(Jt,{value:"installed",children:["已安装 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return R.installed&&se&&G&&F}).length,")"]}),o.jsxs(Jt,{value:"updates",children:["可更新 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return R.installed&&z(R)&&se&&G&&F}).length,")"]})]})}),C&&C.stage==="loading"&&o.jsx(_t,{className:"p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(dh,{className:"h-4 w-4 animate-spin"}),o.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}`:""}`]})]}),o.jsxs("span",{className:"text-sm font-medium",children:[C.progress,"%"]})]}),o.jsx(I0,{value:C.progress,className:"h-2"}),o.jsx("div",{className:"text-xs text-muted-foreground",children:C.message}),C.operation==="fetch"&&C.total_plugins>0&&o.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",C.loaded_plugins," / ",C.total_plugins," 个插件"]})]})}),C&&C.stage==="error"&&C.error&&o.jsx(_t,{className:"border-destructive bg-destructive/10",children:o.jsx(wn,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Xd,{className:"h-5 w-5 text-destructive"}),o.jsxs("div",{children:[o.jsx(Sn,{className:"text-lg text-destructive",children:"加载失败"}),o.jsx(Fr,{className:"text-destructive/80",children:C.error})]})]})})}),x?o.jsxs("div",{className:"flex items-center justify-center py-12",children:[o.jsx(dh,{className:"h-8 w-8 animate-spin text-muted-foreground"}),o.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):w?o.jsx(_t,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Xd,{className:"h-12 w-12 text-destructive mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:w}),o.jsx(me,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):H.length===0?o.jsx(_t,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(ii,{className:"h-12 w-12 text-muted-foreground mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:H.map(R=>o.jsxs(_t,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[o.jsxs(wn,{children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx(Sn,{className:"text-xl",children:R.manifest?.name||R.id}),o.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&o.jsx(Ln,{variant:"secondary",className:"text-xs whitespace-nowrap",children:lD[R.manifest.categories[0]]||R.manifest.categories[0]}),V(R)]})]}),o.jsx(Fr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),o.jsx(An,{className:"flex-1",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(yu,{className:"h-4 w-4"}),o.jsx("span",{children:(q[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(tc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsx("span",{children:(q[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(se=>o.jsx(Ln,{variant:"outline",className:"text-xs",children:se},se)),R.manifest?.keywords&&R.manifest.keywords.length>3&&o.jsxs(Ln,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),o.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[o.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{children:"支持:"}),o.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),o.jsx(Lz,{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?z(R)?o.jsxs(me,{size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>X(R),children:[o.jsx(Ti,{className:"h-4 w-4 mr-1"}),"更新"]}):o.jsxs(me,{variant:"destructive",size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>J(R),children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"卸载"]}):o.jsxs(me,{size:"sm",disabled:!k?.installed||C?.operation==="install"||_!==null&&!ee(R),title:k?.installed?_!==null&&!ee(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${_?.version})`:void 0:"Git 未安装",onClick:()=>W(R),children:[o.jsx(yu,{className:"h-4 w-4 mr-1"}),C?.operation==="install"&&C?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),o.jsx(zr,{open:e!==null,onOpenChange:P,children:e&&e.manifest&&o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsx(kr,{children:o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"space-y-2 flex-1",children:[o.jsx(Or,{className:"text-2xl",children:e.manifest.name}),o.jsxs(ps,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&o.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:o.jsx(Yd,{className:"h-3 w-3 inline"})})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&o.jsx(Ln,{variant:"secondary",children:lD[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),o.jsxs("div",{className:"space-y-6",children:[o.jsx(j8e,{pluginId:e.id}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"版本"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"下载量"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:(q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"评分"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(tc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[(q[e.id]?.rating??e.rating??0).toFixed(1)," (",q[e.id]?.rating_count??e.review_count??0,")"]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"许可证"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),o.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}`:" - 最新版本"]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),o.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>o.jsx(Ln,{variant:"outline",children:R},R))})]}),e.detailed_description&&o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),o.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),o.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"font-medium",children:"主页: "}),o.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&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"font-medium",children:"仓库: "}),o.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),o.jsxs(Ds,{children:[e.manifest.homepage_url&&o.jsxs(me,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[o.jsx(Yd,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&o.jsxs(me,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[o.jsx(Yd,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function C8e(){return o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(Ti,{className:"h-4 w-4 mr-2"}),"刷新"]}),o.jsxs(me,{size:"sm",children:[o.jsx(vu,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"已安装插件"}),o.jsx(fh,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"已启用"}),o.jsx(pc,{className:"h-4 w-4 text-green-600"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"已禁用"}),o.jsx(Ou,{className:"h-4 w-4 text-orange-600"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"可更新"}),o.jsx(Ti,{className:"h-4 w-4 text-blue-600"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"已安装的插件"}),o.jsx(Fr,{children:"查看和管理已安装插件的配置"})]}),o.jsx(An,{children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[o.jsx(fh,{className:"h-16 w-16 text-muted-foreground/50"}),o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),o.jsx("div",{className:"flex gap-2",children:o.jsx(me,{variant:"outline",asChild:!0,children:o.jsxs("a",{href:"/plugins",children:[o.jsx(Yd,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),o.jsx(_t,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:o.jsx(An,{className:"pt-6",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Ou,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),o.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",o.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function T8e(){const t=Ca(),{toast:e}=Wr(),[n,r]=b.useState([]),[s,i]=b.useState(!0),[a,l]=b.useState(null),[c,h]=b.useState(null),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S=b.useCallback(async()=>{try{i(!0),l(null);const M=localStorage.getItem("access-token"),q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${M}`}});if(!q.ok)throw new Error("获取镜像源列表失败");const L=await q.json();r(L.mirrors||[])}catch(M){const q=M instanceof Error?M.message:"加载镜像源失败";l(q),e({title:"加载失败",description:q,variant:"destructive"})}finally{i(!1)}},[e]);b.useEffect(()=>{S()},[S]);const k=async()=>{try{const M=localStorage.getItem("access-token"),q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(y)});if(!q.ok){const L=await q.json();throw new Error(L.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),m(!1),w({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S()}catch(M){e({title:"添加失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},N=async()=>{if(c)try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${c.id}`,{method:"PUT",headers:{Authorization:`Bearer ${M}`,"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),S()}catch(M){e({title:"更新失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},C=async M=>{if(confirm("确定要删除这个镜像源吗?"))try{const q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M}`,{method:"DELETE",headers:{Authorization:`Bearer ${q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),S()}catch(q){e({title:"删除失败",description:q instanceof Error?q.message:"未知错误",variant:"destructive"})}},T=async M=>{try{const q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",headers:{Authorization:`Bearer ${q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!M.enabled})})).ok)throw new Error("更新状态失败");S()}catch(q){e({title:"更新失败",description:q instanceof Error?q.message:"未知错误",variant:"destructive"})}},_=M=>{h(M),w({id:M.id,name:M.name,raw_prefix:M.raw_prefix,clone_prefix:M.clone_prefix,enabled:M.enabled,priority:M.priority}),x(!0)},E=async(M,q)=>{const L=q==="up"?M.priority-1:M.priority+1;if(!(L<1))try{const I=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",headers:{Authorization:`Bearer ${I}`,"Content-Type":"application/json"},body:JSON.stringify({priority:L})})).ok)throw new Error("更新优先级失败");S()}catch(I){e({title:"更新失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}};return o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx(me,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:o.jsx(XD,{className:"h-5 w-5"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),o.jsxs(me,{onClick:()=>m(!0),children:[o.jsx(ms,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?o.jsx(_t,{className:"p-6",children:o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(dh,{className:"h-8 w-8 animate-spin text-primary"})})}):a?o.jsx(_t,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Xd,{className:"h-12 w-12 text-destructive mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:a}),o.jsx(me,{onClick:S,children:"重新加载"})]})}):o.jsxs(_t,{children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(Qh,{children:[o.jsx(Hh,{children:o.jsxs(fs,{children:[o.jsx(en,{children:"状态"}),o.jsx(en,{children:"名称"}),o.jsx(en,{children:"ID"}),o.jsx(en,{children:"优先级"}),o.jsx(en,{className:"text-right",children:"操作"})]})}),o.jsx(Vh,{children:n.map(M=>o.jsxs(fs,{children:[o.jsx(Lt,{children:o.jsx(Tt,{checked:M.enabled,onCheckedChange:()=>T(M)})}),o.jsx(Lt,{children:o.jsxs("div",{children:[o.jsx("div",{className:"font-medium",children:M.name}),o.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",M.raw_prefix]})]})}),o.jsx(Lt,{children:o.jsx(Ln,{variant:"outline",children:M.id})}),o.jsx(Lt,{children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-mono",children:M.priority}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx(me,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(M,"up"),disabled:M.priority===1,children:o.jsx(j3,{className:"h-3 w-3"})}),o.jsx(me,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(M,"down"),children:o.jsx(Im,{className:"h-3 w-3"})})]})]})}),o.jsx(Lt,{className:"text-right",children:o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[o.jsx(me,{variant:"ghost",size:"icon",onClick:()=>_(M),children:o.jsx(hh,{className:"h-4 w-4"})}),o.jsx(me,{variant:"ghost",size:"icon",onClick:()=>C(M.id),children:o.jsx(sn,{className:"h-4 w-4 text-destructive"})})]})})]},M.id))})]})}),o.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(M=>o.jsx(_t,{className:"p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h3",{className:"font-semibold",children:M.name}),M.enabled&&o.jsx(Ln,{variant:"default",className:"text-xs",children:"启用"})]}),o.jsx(Ln,{variant:"outline",className:"mt-1 text-xs",children:M.id})]}),o.jsx(Tt,{checked:M.enabled,onCheckedChange:()=>T(M)})]}),o.jsxs("div",{className:"text-sm space-y-1",children:[o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"Raw: "}),o.jsx("span",{className:"break-all",children:M.raw_prefix})]}),o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"优先级: "}),o.jsx("span",{className:"font-mono",children:M.priority})]})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[o.jsxs(me,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>_(M),children:[o.jsx(hh,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>E(M,"up"),disabled:M.priority===1,children:o.jsx(j3,{className:"h-4 w-4"})}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>E(M,"down"),children:o.jsx(Im,{className:"h-4 w-4"})}),o.jsx(me,{variant:"destructive",size:"sm",onClick:()=>C(M.id),children:o.jsx(sn,{className:"h-4 w-4"})})]})]})},M.id))})]}),o.jsx(zr,{open:f,onOpenChange:m,children:o.jsxs(Sr,{className:"max-w-lg",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"添加镜像源"}),o.jsx(ps,{children:"添加新的 Git 镜像源配置"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"add-id",children:"镜像源 ID *"}),o.jsx(Pe,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:M=>w({...y,id:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"add-name",children:"名称 *"}),o.jsx(Pe,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:M=>w({...y,name:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),o.jsx(Pe,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:M=>w({...y,raw_prefix:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"add-clone",children:"克隆前缀 *"}),o.jsx(Pe,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:M=>w({...y,clone_prefix:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"add-priority",children:"优先级"}),o.jsx(Pe,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:M=>w({...y,priority:parseInt(M.target.value)||1})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"add-enabled",checked:y.enabled,onCheckedChange:M=>w({...y,enabled:M})}),o.jsx(de,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>m(!1),children:"取消"}),o.jsx(me,{onClick:k,children:"添加"})]})]})}),o.jsx(zr,{open:g,onOpenChange:x,children:o.jsxs(Sr,{className:"max-w-lg",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑镜像源"}),o.jsx(ps,{children:"修改镜像源配置"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"镜像源 ID"}),o.jsx(Pe,{value:y.id,disabled:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit-name",children:"名称 *"}),o.jsx(Pe,{id:"edit-name",value:y.name,onChange:M=>w({...y,name:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),o.jsx(Pe,{id:"edit-raw",value:y.raw_prefix,onChange:M=>w({...y,raw_prefix:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit-clone",children:"克隆前缀 *"}),o.jsx(Pe,{id:"edit-clone",value:y.clone_prefix,onChange:M=>w({...y,clone_prefix:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit-priority",children:"优先级"}),o.jsx(Pe,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:M=>w({...y,priority:parseInt(M.target.value)||1})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"edit-enabled",checked:y.enabled,onCheckedChange:M=>w({...y,enabled:M})}),o.jsx(de,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>x(!1),children:"取消"}),o.jsx(me,{onClick:N,children:"保存"})]})]})})]})})}const E8e=Lh("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"}}),nU=b.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>o.jsx("kbd",{className:ye(E8e({size:e,className:t})),ref:i,...s,children:n?o.jsx("abbr",{title:n,children:r}):r}));nU.displayName="Kbd";const _8e=[{icon:w1,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:tl,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:ZD,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:JD,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Xk,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:E0,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:ez,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:DK,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:fh,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:S1,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:vu,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function M8e({open:t,onOpenChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState(0),a=Ca(),l=_8e.filter(f=>f.title.toLowerCase().includes(n.toLowerCase())||f.description.toLowerCase().includes(n.toLowerCase())||f.category.toLowerCase().includes(n.toLowerCase()));b.useEffect(()=>{t&&(r(""),i(0))},[t]);const c=b.useCallback(f=>{a({to:f}),e(!1)},[a,e]),h=b.useCallback(f=>{f.key==="ArrowDown"?(f.preventDefault(),i(m=>(m+1)%l.length)):f.key==="ArrowUp"?(f.preventDefault(),i(m=>(m-1+l.length)%l.length)):f.key==="Enter"&&l[s]&&(f.preventDefault(),c(l[s].path))},[l,s,c]);return o.jsx(zr,{open:t,onOpenChange:e,children:o.jsxs(Sr,{className:"max-w-2xl p-0 gap-0",children:[o.jsxs(kr,{className:"px-4 pt-4 pb-0",children:[o.jsx(Or,{className:"sr-only",children:"搜索"}),o.jsxs("div",{className:"relative",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),o.jsx(Pe,{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})]})]}),o.jsx("div",{className:"border-t",children:o.jsx(kn,{className:"h-[400px]",children:l.length>0?o.jsx("div",{className:"p-2",children:l.map((f,m)=>{const g=f.icon;return o.jsxs("button",{onClick:()=>c(f.path),onMouseEnter:()=>i(m),className:ye("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:[o.jsx(g,{className:"h-5 w-5 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium text-sm",children:f.title}),o.jsx("div",{className:"text-xs text-muted-foreground truncate",children:f.description})]}),o.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:f.category})]},f.path)})}):o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o.jsx(ii,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),o.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function A8e(t){const e=R8e(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,l=b.Children.toArray(i),c=l.find(z8e);if(c){const h=c.props.children,f=l.map(m=>m===c?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return o.jsx(e,{...a,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return o.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function R8e(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=L8e(s),l=P8e(i,s.props);return s.type!==b.Fragment&&(l.ref=r?mc(r,a):a),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var D8e=Symbol("radix.slottable");function z8e(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===D8e}function P8e(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]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function L8e(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 jk=["Enter"," "],I8e=["ArrowDown","PageUp","Home"],rU=["ArrowUp","PageDown","End"],B8e=[...I8e,...rU],q8e={ltr:[...jk,"ArrowRight"],rtl:[...jk,"ArrowLeft"]},F8e={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gp="Menu",[j0,$8e,Q8e]=Sv(gp),[Hu,sU]=Ta(gp,[Q8e,Ah,Dv]),xp=Ah(),iU=Dv(),[aU,Pc]=Hu(gp),[H8e,vp]=Hu(gp),oU=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:a=!0}=t,l=xp(e),[c,h]=b.useState(null),f=b.useRef(!1),m=ys(i),g=T0(s);return b.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})}},[]),o.jsx(Nv,{...l,children:o.jsx(aU,{scope:e,open:n,onOpenChange:m,content:c,onContentChange:h,children:o.jsx(H8e,{scope:e,onClose:b.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:g,modal:a,children:r})})})};oU.displayName=gp;var V8e="MenuAnchor",Tj=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=xp(n);return o.jsx(Cv,{...s,...r,ref:e})});Tj.displayName=V8e;var Ej="MenuPortal",[U8e,lU]=Hu(Ej,{forceMount:void 0}),cU=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Pc(Ej,e);return o.jsx(U8e,{scope:e,forceMount:n,children:o.jsx(ai,{present:n||i.open,children:o.jsx(jv,{asChild:!0,container:s,children:r})})})};cU.displayName=Ej;var ra="MenuContent",[W8e,_j]=Hu(ra),uU=b.forwardRef((t,e)=>{const n=lU(ra,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Pc(ra,t.__scopeMenu),a=vp(ra,t.__scopeMenu);return o.jsx(j0.Provider,{scope:t.__scopeMenu,children:o.jsx(ai,{present:r||i.open,children:o.jsx(j0.Slot,{scope:t.__scopeMenu,children:a.modal?o.jsx(G8e,{...s,ref:e}):o.jsx(X8e,{...s,ref:e})})})})}),G8e=b.forwardRef((t,e)=>{const n=Pc(ra,t.__scopeMenu),r=b.useRef(null),s=qn(e,r);return b.useEffect(()=>{const i=r.current;if(i)return BD(i)},[]),o.jsx(Mj,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ze(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),X8e=b.forwardRef((t,e)=>{const n=Pc(ra,t.__scopeMenu);return o.jsx(Mj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Y8e=A8e("MenuContent.ScrollLock"),Mj=b.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,disableOutsideScroll:y,...w}=t,S=Pc(ra,n),k=vp(ra,n),N=xp(n),C=iU(n),T=$8e(n),[_,E]=b.useState(null),M=b.useRef(null),q=qn(e,M,S.onContentChange),L=b.useRef(0),I=b.useRef(""),$=b.useRef(0),V=b.useRef(null),ee=b.useRef("right"),z=b.useRef(0),H=y?qD:b.Fragment,P=y?{as:Y8e,allowPinchZoom:!0}:void 0,W=X=>{const R=I.current+X,se=T().filter(Y=>!Y.disabled),G=document.activeElement,F=se.find(Y=>Y.ref.current===G)?.textValue,U=se.map(Y=>Y.textValue),te=lCe(U,R,F),ne=se.find(Y=>Y.textValue===te)?.ref.current;(function Y(ae){I.current=ae,window.clearTimeout(L.current),ae!==""&&(L.current=window.setTimeout(()=>Y(""),1e3))})(R),ne&&setTimeout(()=>ne.focus())};b.useEffect(()=>()=>window.clearTimeout(L.current),[]),FD();const J=b.useCallback(X=>ee.current===V.current?.side&&uCe(X,V.current?.area),[]);return o.jsx(W8e,{scope:n,searchRef:I,onItemEnter:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),onItemLeave:b.useCallback(X=>{J(X)||(M.current?.focus(),E(null))},[J]),onTriggerLeave:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),pointerGraceTimerRef:$,onPointerGraceIntentChange:b.useCallback(X=>{V.current=X},[]),children:o.jsx(H,{...P,children:o.jsx($D,{asChild:!0,trapped:s,onMountAutoFocus:Ze(i,X=>{X.preventDefault(),M.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:o.jsx(Uk,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,children:o.jsx(Qz,{asChild:!0,...C,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:E,onEntryFocus:Ze(c,X=>{k.isUsingKeyboardRef.current||X.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(Wk,{role:"menu","aria-orientation":"vertical","data-state":CU(S.open),"data-radix-menu-content":"",dir:k.dir,...N,...w,ref:q,style:{outline:"none",...w.style},onKeyDown:Ze(w.onKeyDown,X=>{const se=X.target.closest("[data-radix-menu-content]")===X.currentTarget,G=X.ctrlKey||X.altKey||X.metaKey,F=X.key.length===1;se&&(X.key==="Tab"&&X.preventDefault(),!G&&F&&W(X.key));const U=M.current;if(X.target!==U||!B8e.includes(X.key))return;X.preventDefault();const ne=T().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);rU.includes(X.key)&&ne.reverse(),aCe(ne)}),onBlur:Ze(t.onBlur,X=>{X.currentTarget.contains(X.target)||(window.clearTimeout(L.current),I.current="")}),onPointerMove:Ze(t.onPointerMove,N0(X=>{const R=X.target,se=z.current!==X.clientX;if(X.currentTarget.contains(R)&&se){const G=X.clientX>z.current?"right":"left";ee.current=G,z.current=X.clientX}}))})})})})})})});uU.displayName=ra;var K8e="MenuGroup",Aj=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{role:"group",...r,ref:e})});Aj.displayName=K8e;var Z8e="MenuLabel",dU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});dU.displayName=Z8e;var vv="MenuItem",cD="menu.itemSelect",_y=b.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=b.useRef(null),a=vp(vv,t.__scopeMenu),l=_j(vv,t.__scopeMenu),c=qn(e,i),h=b.useRef(!1),f=()=>{const m=i.current;if(!n&&m){const g=new CustomEvent(cD,{bubbles:!0,cancelable:!0});m.addEventListener(cD,x=>r?.(x),{once:!0}),HD(m,g),g.defaultPrevented?h.current=!1:a.onClose()}};return o.jsx(hU,{...s,ref:c,disabled:n,onClick:Ze(t.onClick,f),onPointerDown:m=>{t.onPointerDown?.(m),h.current=!0},onPointerUp:Ze(t.onPointerUp,m=>{h.current||m.currentTarget?.click()}),onKeyDown:Ze(t.onKeyDown,m=>{const g=l.searchRef.current!=="";n||g&&m.key===" "||jk.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});_y.displayName=vv;var hU=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,a=_j(vv,n),l=iU(n),c=b.useRef(null),h=qn(e,c),[f,m]=b.useState(!1),[g,x]=b.useState("");return b.useEffect(()=>{const y=c.current;y&&x((y.textContent??"").trim())},[i.children]),o.jsx(j0.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:o.jsx(Hz,{asChild:!0,...l,focusable:!r,children:o.jsx(xn.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:Ze(t.onPointerMove,N0(y=>{r?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ze(t.onPointerLeave,N0(y=>a.onItemLeave(y))),onFocus:Ze(t.onFocus,()=>m(!0)),onBlur:Ze(t.onBlur,()=>m(!1))})})})}),J8e="MenuCheckboxItem",fU=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return o.jsx(vU,{scope:t.__scopeMenu,checked:n,children:o.jsx(_y,{role:"menuitemcheckbox","aria-checked":yv(n)?"mixed":n,...s,ref:e,"data-state":zj(n),onSelect:Ze(s.onSelect,()=>r?.(yv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});fU.displayName=J8e;var mU="MenuRadioGroup",[eCe,tCe]=Hu(mU,{value:void 0,onValueChange:()=>{}}),pU=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=ys(r);return o.jsx(eCe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:o.jsx(Aj,{...s,ref:e})})});pU.displayName=mU;var gU="MenuRadioItem",xU=b.forwardRef((t,e)=>{const{value:n,...r}=t,s=tCe(gU,t.__scopeMenu),i=n===s.value;return o.jsx(vU,{scope:t.__scopeMenu,checked:i,children:o.jsx(_y,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":zj(i),onSelect:Ze(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});xU.displayName=gU;var Rj="MenuItemIndicator",[vU,nCe]=Hu(Rj,{checked:!1}),yU=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=nCe(Rj,n);return o.jsx(ai,{present:r||yv(i.checked)||i.checked===!0,children:o.jsx(xn.span,{...s,ref:e,"data-state":zj(i.checked)})})});yU.displayName=Rj;var rCe="MenuSeparator",bU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});bU.displayName=rCe;var sCe="MenuArrow",wU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=xp(n);return o.jsx(Gk,{...s,...r,ref:e})});wU.displayName=sCe;var Dj="MenuSub",[iCe,SU]=Hu(Dj),kU=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Pc(Dj,e),a=xp(e),[l,c]=b.useState(null),[h,f]=b.useState(null),m=ys(s);return b.useEffect(()=>(i.open===!1&&m(!1),()=>m(!1)),[i.open,m]),o.jsx(Nv,{...a,children:o.jsx(aU,{scope:e,open:r,onOpenChange:m,content:h,onContentChange:f,children:o.jsx(iCe,{scope:e,contentId:ea(),triggerId:ea(),trigger:l,onTriggerChange:c,children:n})})})};kU.displayName=Dj;var wm="MenuSubTrigger",OU=b.forwardRef((t,e)=>{const n=Pc(wm,t.__scopeMenu),r=vp(wm,t.__scopeMenu),s=SU(wm,t.__scopeMenu),i=_j(wm,t.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,h={__scopeMenu:t.__scopeMenu},f=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>f,[f]),b.useEffect(()=>{const m=l.current;return()=>{window.clearTimeout(m),c(null)}},[l,c]),o.jsx(Tj,{asChild:!0,...h,children:o.jsx(hU,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":CU(n.open),...t,ref:mc(e,s.onTriggerChange),onClick:m=>{t.onClick?.(m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ze(t.onPointerMove,N0(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:Ze(t.onPointerLeave,N0(m=>{f();const g=n.content?.getBoundingClientRect();if(g){const x=n.content?.dataset.side,y=x==="right",w=y?-5:5,S=g[y?"left":"right"],k=g[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+w,y:m.clientY},{x:S,y:g.top},{x:k,y:g.top},{x:k,y:g.bottom},{x:S,y:g.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Ze(t.onKeyDown,m=>{const g=i.searchRef.current!=="";t.disabled||g&&m.key===" "||q8e[r.dir].includes(m.key)&&(n.onOpenChange(!0),n.content?.focus(),m.preventDefault())})})})});OU.displayName=wm;var jU="MenuSubContent",NU=b.forwardRef((t,e)=>{const n=lU(ra,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Pc(ra,t.__scopeMenu),a=vp(ra,t.__scopeMenu),l=SU(jU,t.__scopeMenu),c=b.useRef(null),h=qn(e,c);return o.jsx(j0.Provider,{scope:t.__scopeMenu,children:o.jsx(ai,{present:r||i.open,children:o.jsx(j0.Slot,{scope:t.__scopeMenu,children:o.jsx(Mj,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:h,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{a.isUsingKeyboardRef.current&&c.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Ze(t.onFocusOutside,f=>{f.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Ze(t.onEscapeKeyDown,f=>{a.onClose(),f.preventDefault()}),onKeyDown:Ze(t.onKeyDown,f=>{const m=f.currentTarget.contains(f.target),g=F8e[a.dir].includes(f.key);m&&g&&(i.onOpenChange(!1),l.trigger?.focus(),f.preventDefault())})})})})})});NU.displayName=jU;function CU(t){return t?"open":"closed"}function yv(t){return t==="indeterminate"}function zj(t){return yv(t)?"indeterminate":t?"checked":"unchecked"}function aCe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function oCe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function lCe(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=oCe(t,Math.max(i,0));s.length===1&&(a=a.filter(h=>h!==n));const c=a.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function cCe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const l=e[i],c=e[a],h=l.x,f=l.y,m=c.x,g=c.y;f>r!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function uCe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return cCe(n,e)}function N0(t){return e=>e.pointerType==="mouse"?t(e):void 0}var dCe=oU,hCe=Tj,fCe=cU,mCe=uU,pCe=Aj,gCe=dU,xCe=_y,vCe=fU,yCe=pU,bCe=xU,wCe=yU,SCe=bU,kCe=wU,OCe=kU,jCe=OU,NCe=NU,Pj="ContextMenu",[CCe]=Ta(Pj,[sU]),js=sU(),[TCe,TU]=CCe(Pj),EU=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[a,l]=b.useState(!1),c=js(e),h=ys(r),f=b.useCallback(m=>{l(m),h(m)},[h]);return o.jsx(TCe,{scope:e,open:a,onOpenChange:f,modal:i,children:o.jsx(dCe,{...c,dir:s,open:a,onOpenChange:f,modal:i,children:n})})};EU.displayName=Pj;var _U="ContextMenuTrigger",MU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=TU(_U,n),a=js(n),l=b.useRef({x:0,y:0}),c=b.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),h=b.useRef(0),f=b.useCallback(()=>window.clearTimeout(h.current),[]),m=g=>{l.current={x:g.clientX,y:g.clientY},i.onOpenChange(!0)};return b.useEffect(()=>f,[f]),b.useEffect(()=>void(r&&f()),[r,f]),o.jsxs(o.Fragment,{children:[o.jsx(hCe,{...a,virtualRef:c}),o.jsx(xn.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:Ze(t.onContextMenu,g=>{f(),m(g),g.preventDefault()}),onPointerDown:r?t.onPointerDown:Ze(t.onPointerDown,Hx(g=>{f(),h.current=window.setTimeout(()=>m(g),700)})),onPointerMove:r?t.onPointerMove:Ze(t.onPointerMove,Hx(f)),onPointerCancel:r?t.onPointerCancel:Ze(t.onPointerCancel,Hx(f)),onPointerUp:r?t.onPointerUp:Ze(t.onPointerUp,Hx(f))})]})});MU.displayName=_U;var ECe="ContextMenuPortal",AU=t=>{const{__scopeContextMenu:e,...n}=t,r=js(e);return o.jsx(fCe,{...r,...n})};AU.displayName=ECe;var RU="ContextMenuContent",DU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=TU(RU,n),i=js(n),a=b.useRef(!1);return o.jsx(mCe,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{t.onCloseAutoFocus?.(l),!l.defaultPrevented&&a.current&&l.preventDefault(),a.current=!1},onInteractOutside:l=>{t.onInteractOutside?.(l),!l.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)"}})});DU.displayName=RU;var _Ce="ContextMenuGroup",MCe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(pCe,{...s,...r,ref:e})});MCe.displayName=_Ce;var ACe="ContextMenuLabel",zU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(gCe,{...s,...r,ref:e})});zU.displayName=ACe;var RCe="ContextMenuItem",PU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(xCe,{...s,...r,ref:e})});PU.displayName=RCe;var DCe="ContextMenuCheckboxItem",LU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(vCe,{...s,...r,ref:e})});LU.displayName=DCe;var zCe="ContextMenuRadioGroup",PCe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(yCe,{...s,...r,ref:e})});PCe.displayName=zCe;var LCe="ContextMenuRadioItem",IU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(bCe,{...s,...r,ref:e})});IU.displayName=LCe;var ICe="ContextMenuItemIndicator",BU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(wCe,{...s,...r,ref:e})});BU.displayName=ICe;var BCe="ContextMenuSeparator",qU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(SCe,{...s,...r,ref:e})});qU.displayName=BCe;var qCe="ContextMenuArrow",FCe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(kCe,{...s,...r,ref:e})});FCe.displayName=qCe;var FU="ContextMenuSub",$U=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,a=js(e),[l,c]=Cc({prop:s,defaultProp:i??!1,onChange:r,caller:FU});return o.jsx(OCe,{...a,open:l,onOpenChange:c,children:n})};$U.displayName=FU;var $Ce="ContextMenuSubTrigger",QU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(jCe,{...s,...r,ref:e})});QU.displayName=$Ce;var QCe="ContextMenuSubContent",HU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(NCe,{...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)"}})});HU.displayName=QCe;function Hx(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var HCe=EU,VCe=MU,UCe=AU,VU=DU,UU=zU,WU=PU,GU=LU,XU=IU,YU=BU,KU=qU,WCe=$U,ZU=QU,JU=HU;const GCe=HCe,XCe=VCe,YCe=WCe,eW=b.forwardRef(({className:t,inset:e,children:n,...r},s)=>o.jsxs(ZU,{ref:s,className:ye("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,o.jsx(Bu,{className:"ml-auto h-4 w-4"})]}));eW.displayName=ZU.displayName;const tW=b.forwardRef(({className:t,...e},n)=>o.jsx(JU,{ref:n,className:ye("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}));tW.displayName=JU.displayName;const nW=b.forwardRef(({className:t,...e},n)=>o.jsx(UCe,{children:o.jsx(VU,{ref:n,className:ye("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})}));nW.displayName=VU.displayName;const xa=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(WU,{ref:r,className:ye("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}));xa.displayName=WU.displayName;const KCe=b.forwardRef(({className:t,children:e,checked:n,...r},s)=>o.jsxs(GU,{ref:s,className:ye("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:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(YU,{children:o.jsx(dc,{className:"h-4 w-4"})})}),e]}));KCe.displayName=GU.displayName;const ZCe=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(XU,{ref:r,className:ye("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:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(YU,{children:o.jsx(zK,{className:"h-2 w-2 fill-current"})})}),e]}));ZCe.displayName=XU.displayName;const JCe=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(UU,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));JCe.displayName=UU.displayName;const Sm=b.forwardRef(({className:t,...e},n)=>o.jsx(KU,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Sm.displayName=KU.displayName;const Qd=({className:t,...e})=>o.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});Qd.displayName="ContextMenuShortcut";var e9e=Symbol("radix.slottable");function t9e(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=e9e,e}var[My]=Ta("Tooltip",[Ah]),Ay=Ah(),rW="TooltipProvider",n9e=700,Nk="tooltip.open",[r9e,Lj]=My(rW),sW=t=>{const{__scopeTooltip:e,delayDuration:n=n9e,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,a=b.useRef(!0),l=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{const h=c.current;return()=>window.clearTimeout(h)},[]),o.jsx(r9e,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:b.useCallback(h=>{l.current=h},[]),disableHoverableContent:s,children:i})};sW.displayName=rW;var C0="Tooltip",[s9e,yp]=My(C0),iW=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=t,c=Lj(C0,t.__scopeTooltip),h=Ay(e),[f,m]=b.useState(null),g=ea(),x=b.useRef(0),y=a??c.disableHoverableContent,w=l??c.delayDuration,S=b.useRef(!1),[k,N]=Cc({prop:r,defaultProp:s??!1,onChange:M=>{M?(c.onOpen(),document.dispatchEvent(new CustomEvent(Nk))):c.onClose(),i?.(M)},caller:C0}),C=b.useMemo(()=>k?S.current?"delayed-open":"instant-open":"closed",[k]),T=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,S.current=!1,N(!0)},[N]),_=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),E=b.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,N(!0),x.current=0},w)},[w,N]);return b.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),o.jsx(Nv,{...h,children:o.jsx(s9e,{scope:e,contentId:g,open:k,stateAttribute:C,trigger:f,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?E():T()},[c.isOpenDelayedRef,E,T]),onTriggerLeave:b.useCallback(()=>{y?_():(window.clearTimeout(x.current),x.current=0)},[_,y]),onOpen:T,onClose:_,disableHoverableContent:y,children:n})})};iW.displayName=C0;var Ck="TooltipTrigger",aW=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=yp(Ck,n),i=Lj(Ck,n),a=Ay(n),l=b.useRef(null),c=qn(e,l,s.onTriggerChange),h=b.useRef(!1),f=b.useRef(!1),m=b.useCallback(()=>h.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(Cv,{asChild:!0,...a,children:o.jsx(xn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:Ze(t.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ze(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:Ze(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Ze(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:Ze(t.onBlur,s.onClose),onClick:Ze(t.onClick,s.onClose)})})});aW.displayName=Ck;var Ij="TooltipPortal",[i9e,a9e]=My(Ij,{forceMount:void 0}),oW=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=yp(Ij,e);return o.jsx(i9e,{scope:e,forceMount:n,children:o.jsx(ai,{present:n||i.open,children:o.jsx(jv,{asChild:!0,container:s,children:r})})})};oW.displayName=Ij;var Mh="TooltipContent",lW=b.forwardRef((t,e)=>{const n=a9e(Mh,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=yp(Mh,t.__scopeTooltip);return o.jsx(ai,{present:r||a.open,children:a.disableHoverableContent?o.jsx(cW,{side:s,...i,ref:e}):o.jsx(o9e,{side:s,...i,ref:e})})}),o9e=b.forwardRef((t,e)=>{const n=yp(Mh,t.__scopeTooltip),r=Lj(Mh,t.__scopeTooltip),s=b.useRef(null),i=qn(e,s),[a,l]=b.useState(null),{trigger:c,onClose:h}=n,f=s.current,{onPointerInTransitChange:m}=r,g=b.useCallback(()=>{l(null),m(!1)},[m]),x=b.useCallback((y,w)=>{const S=y.currentTarget,k={x:y.clientX,y:y.clientY},N=h9e(k,S.getBoundingClientRect()),C=f9e(k,N),T=m9e(w.getBoundingClientRect()),_=g9e([...C,...T]);l(_),m(!0)},[m]);return b.useEffect(()=>()=>g(),[g]),b.useEffect(()=>{if(c&&f){const y=S=>x(S,f),w=S=>x(S,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",w)}}},[c,f,x,g]),b.useEffect(()=>{if(a){const y=w=>{const S=w.target,k={x:w.clientX,y:w.clientY},N=c?.contains(S)||f?.contains(S),C=!p9e(k,a);N?g():C&&(g(),h())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,a,h,g]),o.jsx(cW,{...t,ref:i})}),[l9e,c9e]=My(C0,{isInside:!1}),u9e=t9e("TooltipContent"),cW=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=t,c=yp(Mh,n),h=Ay(n),{onClose:f}=c;return b.useEffect(()=>(document.addEventListener(Nk,f),()=>document.removeEventListener(Nk,f)),[f]),b.useEffect(()=>{if(c.trigger){const m=g=>{g.target?.contains(c.trigger)&&f()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,f]),o.jsx(Uk,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:f,children:o.jsxs(Wk,{"data-state":c.stateAttribute,...h,...l,ref:e,style:{...l.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:[o.jsx(u9e,{children:r}),o.jsx(l9e,{scope:n,isInside:!0,children:o.jsx(lK,{id:c.contentId,role:"tooltip",children:s||r})})]})})});lW.displayName=Mh;var uW="TooltipArrow",d9e=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Ay(n);return c9e(uW,n).isInside?null:o.jsx(Gk,{...s,...r,ref:e})});d9e.displayName=uW;function h9e(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 f9e(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 m9e(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 p9e(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const l=e[i],c=e[a],h=l.x,f=l.y,m=c.x,g=c.y;f>r!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function g9e(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),x9e(e)}function x9e(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=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 v9e=sW,y9e=iW,b9e=aW,w9e=oW,dW=lW;const S9e=v9e,k9e=y9e,O9e=b9e,hW=b.forwardRef(({className:t,sideOffset:e=4,...n},r)=>o.jsx(w9e,{children:o.jsx(dW,{ref:r,sideOffset:e,className:ye("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})}));hW.displayName=dW.displayName;function j9e({children:t}){Rte();const[e,n]=b.useState(!0),[r,s]=b.useState(!1),[i,a]=b.useState(!1),{theme:l,setTheme:c}=c6(),h=VX(),f=Ca();b.useEffect(()=>{const w=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),a(!0))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[]);const m=[{title:"概览",items:[{icon:w1,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:tl,label:"麦麦主程序配置",path:"/config/bot"},{icon:ZD,label:"AI模型厂商配置",path:"/config/modelProvider"},{icon:JD,label:"模型管理与分配",path:"/config/model"},{icon:RC,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Xk,label:"表情包管理",path:"/resource/emoji"},{icon:E0,label:"表达方式管理",path:"/resource/expression"},{icon:ez,label:"人物信息管理",path:"/resource/person"},{icon:KD,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:fh,label:"插件市场",path:"/plugins"},{icon:RC,label:"插件配置",path:"/plugin-config"},{icon:S1,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:vu,label:"系统设置",path:"/settings"}]}],x=l==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":l,y=()=>{localStorage.removeItem("access-token"),f({to:"/auth"})};return o.jsx(S9e,{delayDuration:300,children:o.jsxs("div",{className:"flex h-screen overflow-hidden",children:[o.jsxs("aside",{className:ye("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:[o.jsx("div",{className:"flex h-16 items-center border-b px-4",children:o.jsxs("div",{className:ye("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[o.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[o.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),o.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:cte()})]}),!e&&o.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),o.jsx(kn,{className:ye("flex-1 overflow-x-hidden",!e&&"lg:w-16"),children:o.jsx("nav",{className:ye("p-4",!e&&"lg:p-2 lg:w-16"),children:o.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3 lg:w-full"),children:m.map((w,S)=>o.jsxs("li",{children:[o.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:o.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:w.title})}),!e&&S>0&&o.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),o.jsx("ul",{className:"space-y-1",children:w.items.map(k=>{const N=h({to:k.path}),C=k.icon,T=o.jsxs(o.Fragment,{children:[N&&o.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"}),o.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"gap-3 lg:gap-0"),children:[o.jsx(C,{className:ye("h-5 w-5 flex-shrink-0",N&&"text-primary"),strokeWidth:2,fill:"none"}),o.jsx("span",{className:ye("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 o.jsx("li",{className:"relative",children:o.jsxs(k9e,{children:[o.jsx(O9e,{asChild:!0,children:o.jsx(UX,{to:k.path,className:ye("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&&o.jsx(hW,{side:"right",className:"hidden lg:block",children:o.jsx("p",{children:k.label})})]})},k.path)})})]},w.title))})})})]}),r&&o.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),o.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[o.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:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:o.jsx(PK,{className:"h-5 w-5"})}),o.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:o.jsx(Iu,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.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:[o.jsx(ii,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),o.jsxs(nU,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[o.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),o.jsx(M8e,{open:i,onOpenChange:a}),o.jsxs(me,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[o.jsx(LK,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),o.jsx("button",{onClick:w=>{Gee(x==="dark"?"light":"dark",c,w)},className:"rounded-lg p-2 hover:bg-accent",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?o.jsx(k3,{className:"h-5 w-5"}):o.jsx(O3,{className:"h-5 w-5"})}),o.jsx("div",{className:"h-6 w-px bg-border"}),o.jsxs(me,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[o.jsx(DC,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),o.jsxs(GCe,{children:[o.jsx(XCe,{asChild:!0,children:o.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),o.jsxs(nW,{className:"w-64",children:[o.jsxs(xa,{onClick:()=>f({to:"/"}),children:[o.jsx(w1,{className:"mr-2 h-4 w-4"}),"首页"]}),o.jsxs(xa,{onClick:()=>f({to:"/settings"}),children:[o.jsx(vu,{className:"mr-2 h-4 w-4"}),"系统设置"]}),o.jsxs(xa,{onClick:()=>f({to:"/logs"}),children:[o.jsx(S1,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),o.jsx(Sm,{}),o.jsxs(YCe,{children:[o.jsxs(eW,{children:[o.jsx(UD,{className:"mr-2 h-4 w-4"}),"切换主题"]}),o.jsxs(tW,{className:"w-48",children:[o.jsxs(xa,{onClick:()=>c("light"),disabled:l==="light",children:[o.jsx(k3,{className:"mr-2 h-4 w-4"}),"浅色",l==="light"&&o.jsx(Qd,{children:"✓"})]}),o.jsxs(xa,{onClick:()=>c("dark"),disabled:l==="dark",children:[o.jsx(O3,{className:"mr-2 h-4 w-4"}),"深色",l==="dark"&&o.jsx(Qd,{children:"✓"})]}),o.jsxs(xa,{onClick:()=>c("system"),disabled:l==="system",children:[o.jsx(vu,{className:"mr-2 h-4 w-4"}),"跟随系统",l==="system"&&o.jsx(Qd,{children:"✓"})]})]})]}),o.jsx(Sm,{}),o.jsxs(xa,{onClick:()=>window.location.reload(),children:[o.jsx(IK,{className:"mr-2 h-4 w-4"}),"刷新页面",o.jsx(Qd,{children:"⌘R"})]}),o.jsxs(xa,{onClick:()=>a(!0),children:[o.jsx(ii,{className:"mr-2 h-4 w-4"}),"搜索",o.jsx(Qd,{children:"⌘K"})]}),o.jsx(Sm,{}),o.jsxs(xa,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[o.jsx(Yd,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),o.jsx(Sm,{}),o.jsxs(xa,{onClick:y,className:"text-destructive focus:text-destructive",children:[o.jsx(DC,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const bp=WX({component:()=>o.jsxs(o.Fragment,{children:[o.jsx(dD,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!nL())throw XX({to:"/auth"})}}),N9e=ns({getParentRoute:()=>bp,path:"/auth",component:Dte}),C9e=ns({getParentRoute:()=>bp,path:"/setup",component:rne}),Ls=ns({getParentRoute:()=>bp,id:"protected",component:()=>o.jsx(j9e,{children:o.jsx(dD,{})})}),T9e=ns({getParentRoute:()=>Ls,path:"/",component:Uee}),E9e=ns({getParentRoute:()=>Ls,path:"/config/bot",component:ehe}),_9e=ns({getParentRoute:()=>Ls,path:"/config/modelProvider",component:$he}),M9e=ns({getParentRoute:()=>Ls,path:"/config/model",component:Ame}),A9e=ns({getParentRoute:()=>Ls,path:"/config/adapter",component:Dme}),R9e=ns({getParentRoute:()=>Ls,path:"/resource/emoji",component:swe}),D9e=ns({getParentRoute:()=>Ls,path:"/resource/expression",component:pwe}),z9e=ns({getParentRoute:()=>Ls,path:"/resource/person",component:Nwe}),P9e=ns({getParentRoute:()=>Ls,path:"/resource/knowledge-graph",component:gOe}),L9e=ns({getParentRoute:()=>Ls,path:"/logs",component:o8e}),I9e=ns({getParentRoute:()=>Ls,path:"/plugins",component:N8e}),B9e=ns({getParentRoute:()=>Ls,path:"/plugin-config",component:C8e}),q9e=ns({getParentRoute:()=>Ls,path:"/plugin-mirrors",component:T8e}),F9e=ns({getParentRoute:()=>Ls,path:"/settings",component:Nte}),$9e=ns({getParentRoute:()=>bp,path:"*",component:iL}),Q9e=bp.addChildren([N9e,C9e,Ls.addChildren([T9e,E9e,_9e,M9e,A9e,R9e,D9e,z9e,P9e,I9e,B9e,q9e,L9e,F9e]),$9e]),H9e=GX({routeTree:Q9e,defaultNotFoundComponent:iL});function V9e({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=b.useState(()=>localStorage.getItem(n)||e);b.useEffect(()=>{const l=window.document.documentElement;if(l.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";l.classList.add(c);return}l.classList.add(s)},[s]),b.useEffect(()=>{const l=localStorage.getItem("accent-color");if(l){const c=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%)"}}[l];f&&(c.style.setProperty("--primary",f.hsl),f.gradient?(c.style.setProperty("--primary-gradient",f.gradient),c.classList.add("has-gradient")):(c.style.removeProperty("--primary-gradient"),c.classList.remove("has-gradient")))}},[]);const a={theme:s,setTheme:l=>{localStorage.setItem(n,l),i(l)}};return o.jsx(NP.Provider,{...r,value:a,children:t})}function U9e({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,a]=b.useState(()=>{const f=localStorage.getItem(r);return f!==null?f==="true":e}),[l,c]=b.useState(()=>{const f=localStorage.getItem(s);return f!==null?f==="true":n});b.useEffect(()=>{const f=document.documentElement;i?f.classList.remove("no-animations"):f.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),b.useEffect(()=>{localStorage.setItem(s,String(l))},[l,s]);const h={enableAnimations:i,setEnableAnimations:a,enableWavesBackground:l,setEnableWavesBackground:c};return o.jsx(CP.Provider,{value:h,children:t})}var Bj="ToastProvider",[qj,W9e,G9e]=Sv("Toast"),[fW]=Ta("Toast",[G9e]),[X9e,Ry]=fW(Bj),mW=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=t,[l,c]=b.useState(null),[h,f]=b.useState(0),m=b.useRef(!1),g=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Bj}\`. Expected non-empty \`string\`.`),o.jsx(qj.Provider,{scope:e,children:o.jsx(X9e,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:l,onViewportChange:c,onToastAdd:b.useCallback(()=>f(x=>x+1),[]),onToastRemove:b.useCallback(()=>f(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:a})})};mW.displayName=Bj;var pW="ToastViewport",Y9e=["F8"],Tk="toast.viewportPause",Ek="toast.viewportResume",gW=b.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=Y9e,label:s="Notifications ({hotkey})",...i}=t,a=Ry(pW,n),l=W9e(n),c=b.useRef(null),h=b.useRef(null),f=b.useRef(null),m=b.useRef(null),g=qn(e,m,a.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;b.useEffect(()=>{const S=k=>{r.length!==0&&r.every(C=>k[C]||k.code===C)&&m.current?.focus()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[r]),b.useEffect(()=>{const S=c.current,k=m.current;if(y&&S&&k){const N=()=>{if(!a.isClosePausedRef.current){const E=new CustomEvent(Tk);k.dispatchEvent(E),a.isClosePausedRef.current=!0}},C=()=>{if(a.isClosePausedRef.current){const E=new CustomEvent(Ek);k.dispatchEvent(E),a.isClosePausedRef.current=!1}},T=E=>{!S.contains(E.relatedTarget)&&C()},_=()=>{S.contains(document.activeElement)||C()};return S.addEventListener("focusin",N),S.addEventListener("focusout",T),S.addEventListener("pointermove",N),S.addEventListener("pointerleave",_),window.addEventListener("blur",N),window.addEventListener("focus",C),()=>{S.removeEventListener("focusin",N),S.removeEventListener("focusout",T),S.removeEventListener("pointermove",N),S.removeEventListener("pointerleave",_),window.removeEventListener("blur",N),window.removeEventListener("focus",C)}}},[y,a.isClosePausedRef]);const w=b.useCallback(({tabbingDirection:S})=>{const N=l().map(C=>{const T=C.ref.current,_=[T,...cTe(T)];return S==="forwards"?_:_.reverse()});return(S==="forwards"?N.reverse():N).flat()},[l]);return b.useEffect(()=>{const S=m.current;if(S){const k=N=>{const C=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!C){const _=document.activeElement,E=N.shiftKey;if(N.target===S&&E){h.current?.focus();return}const L=w({tabbingDirection:E?"backwards":"forwards"}),I=L.findIndex($=>$===_);y3(L.slice(I+1))?N.preventDefault():E?h.current?.focus():f.current?.focus()}};return S.addEventListener("keydown",k),()=>S.removeEventListener("keydown",k)}},[l,w]),o.jsxs(cK,{ref:c,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&o.jsx(_k,{ref:h,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"forwards"});y3(S)}}),o.jsx(qj.Slot,{scope:n,children:o.jsx(xn.ol,{tabIndex:-1,...i,ref:g})}),y&&o.jsx(_k,{ref:f,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"backwards"});y3(S)}})]})});gW.displayName=pW;var xW="ToastFocusProxy",_k=b.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=Ry(xW,n);return o.jsx(VD,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{const l=a.relatedTarget;!i.viewport?.contains(l)&&r()}})});_k.displayName=xW;var wp="Toast",K9e="toast.swipeStart",Z9e="toast.swipeMove",J9e="toast.swipeCancel",eTe="toast.swipeEnd",vW=b.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=t,[l,c]=Cc({prop:r,defaultProp:s??!0,onChange:i,caller:wp});return o.jsx(ai,{present:n||l,children:o.jsx(rTe,{open:l,...a,ref:e,onClose:()=>c(!1),onPause:ys(t.onPause),onResume:ys(t.onResume),onSwipeStart:Ze(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ze(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:Ze(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:Ze(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`),c(!1)})})})});vW.displayName=wp;var[tTe,nTe]=fW(wp,{onClose(){}}),rTe=b.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:l,onPause:c,onResume:h,onSwipeStart:f,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:x,...y}=t,w=Ry(wp,n),[S,k]=b.useState(null),N=qn(e,z=>k(z)),C=b.useRef(null),T=b.useRef(null),_=s||w.duration,E=b.useRef(0),M=b.useRef(_),q=b.useRef(0),{onToastAdd:L,onToastRemove:I}=w,$=ys(()=>{S?.contains(document.activeElement)&&w.viewport?.focus(),a()}),V=b.useCallback(z=>{!z||z===1/0||(window.clearTimeout(q.current),E.current=new Date().getTime(),q.current=window.setTimeout($,z))},[$]);b.useEffect(()=>{const z=w.viewport;if(z){const H=()=>{V(M.current),h?.()},P=()=>{const W=new Date().getTime()-E.current;M.current=M.current-W,window.clearTimeout(q.current),c?.()};return z.addEventListener(Tk,P),z.addEventListener(Ek,H),()=>{z.removeEventListener(Tk,P),z.removeEventListener(Ek,H)}}},[w.viewport,_,c,h,V]),b.useEffect(()=>{i&&!w.isClosePausedRef.current&&V(_)},[i,_,w.isClosePausedRef,V]),b.useEffect(()=>(L(),()=>I()),[L,I]);const ee=b.useMemo(()=>S?jW(S):null,[S]);return w.viewport?o.jsxs(o.Fragment,{children:[ee&&o.jsx(sTe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:ee}),o.jsx(tTe,{scope:n,onClose:$,children:du.createPortal(o.jsx(qj.ItemSlot,{scope:n,children:o.jsx(uK,{asChild:!0,onEscapeKeyDown:Ze(l,()=>{w.isFocusedToastEscapeKeyDownRef.current||$(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:o.jsx(xn.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":w.swipeDirection,...y,ref:N,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Ze(t.onKeyDown,z=>{z.key==="Escape"&&(l?.(z.nativeEvent),z.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:Ze(t.onPointerDown,z=>{z.button===0&&(C.current={x:z.clientX,y:z.clientY})}),onPointerMove:Ze(t.onPointerMove,z=>{if(!C.current)return;const H=z.clientX-C.current.x,P=z.clientY-C.current.y,W=!!T.current,J=["left","right"].includes(w.swipeDirection),X=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,R=J?X(0,H):0,se=J?0:X(0,P),G=z.pointerType==="touch"?10:2,F={x:R,y:se},U={originalEvent:z,delta:F};W?(T.current=F,Vx(Z9e,m,U,{discrete:!1})):uD(F,w.swipeDirection,G)?(T.current=F,Vx(K9e,f,U,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(H)>G||Math.abs(P)>G)&&(C.current=null)}),onPointerUp:Ze(t.onPointerUp,z=>{const H=T.current,P=z.target;if(P.hasPointerCapture(z.pointerId)&&P.releasePointerCapture(z.pointerId),T.current=null,C.current=null,H){const W=z.currentTarget,J={originalEvent:z,delta:H};uD(H,w.swipeDirection,w.swipeThreshold)?Vx(eTe,x,J,{discrete:!0}):Vx(J9e,g,J,{discrete:!0}),W.addEventListener("click",X=>X.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),sTe=t=>{const{__scopeToast:e,children:n,...r}=t,s=Ry(wp,e),[i,a]=b.useState(!1),[l,c]=b.useState(!1);return oTe(()=>a(!0)),b.useEffect(()=>{const h=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(h)},[]),l?null:o.jsx(jv,{asChild:!0,children:o.jsx(VD,{...r,children:i&&o.jsxs(o.Fragment,{children:[s.label," ",n]})})})},iTe="ToastTitle",yW=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});yW.displayName=iTe;var aTe="ToastDescription",bW=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});bW.displayName=aTe;var wW="ToastAction",SW=b.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?o.jsx(OW,{altText:n,asChild:!0,children:o.jsx(Fj,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${wW}\`. Expected non-empty \`string\`.`),null)});SW.displayName=wW;var kW="ToastClose",Fj=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=nTe(kW,n);return o.jsx(OW,{asChild:!0,children:o.jsx(xn.button,{type:"button",...r,ref:e,onClick:Ze(t.onClick,s.onClose)})})});Fj.displayName=kW;var OW=b.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return o.jsx(xn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function jW(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),lTe(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(...jW(r))}}),e}function Vx(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?HD(s,i):s.dispatchEvent(i)}var uD=(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 oTe(t=()=>{}){const e=ys(t);ND(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function lTe(t){return t.nodeType===t.ELEMENT_NODE}function cTe(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 y3(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var uTe=mW,NW=gW,CW=vW,TW=yW,EW=bW,_W=SW,MW=Fj;const dTe=uTe,AW=b.forwardRef(({className:t,...e},n)=>o.jsx(NW,{ref:n,className:ye("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}));AW.displayName=NW.displayName;const hTe=Lh("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"}}),RW=b.forwardRef(({className:t,variant:e,...n},r)=>o.jsx(CW,{ref:r,className:ye(hTe({variant:e}),t),...n}));RW.displayName=CW.displayName;const fTe=b.forwardRef(({className:t,...e},n)=>o.jsx(_W,{ref:n,className:ye("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}));fTe.displayName=_W.displayName;const DW=b.forwardRef(({className:t,...e},n)=>o.jsx(MW,{ref:n,className:ye("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:o.jsx(_0,{className:"h-4 w-4"})}));DW.displayName=MW.displayName;const zW=b.forwardRef(({className:t,...e},n)=>o.jsx(TW,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));zW.displayName=TW.displayName;const PW=b.forwardRef(({className:t,...e},n)=>o.jsx(EW,{ref:n,className:ye("text-sm opacity-90",t),...e}));PW.displayName=EW.displayName;function mTe(){const{toasts:t}=Wr();return o.jsxs(dTe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return o.jsxs(RW,{...i,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(zW,{children:n}),r&&o.jsx(PW,{children:r})]}),s,o.jsx(DW,{})]},e)}),o.jsx(AW,{})]})}QK.createRoot(document.getElementById("root")).render(o.jsx(b.StrictMode,{children:o.jsx(V9e,{defaultTheme:"system",children:o.jsxs(U9e,{children:[o.jsx(YX,{router:H9e}),o.jsx(mTe,{})]})})}));