From 5d9bf243d23ec68ce32ff770499349a379374a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Thu, 20 Nov 2025 18:28:56 +0800 Subject: [PATCH] upload WebUI 0.11.5 Beta.989d879 DashBoard after Build Files commit hash : 989d87984feacb7e793a0dfb8a234dfccbfb2eed --- .../{index-B-xgVyqE.js => index-DjSFnv4K.js} | 60 +++++++++---------- webui/dist/index.html | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) rename webui/dist/assets/{index-B-xgVyqE.js => index-DjSFnv4K.js} (89%) diff --git a/webui/dist/assets/index-B-xgVyqE.js b/webui/dist/assets/index-DjSFnv4K.js similarity index 89% rename from webui/dist/assets/index-B-xgVyqE.js rename to webui/dist/assets/index-DjSFnv4K.js index 43d286e9..f3ad35f9 100644 --- a/webui/dist/assets/index-B-xgVyqE.js +++ b/webui/dist/assets/index-DjSFnv4K.js @@ -1,17 +1,17 @@ -import{r as S,j as a,u as wa,R as Ue,d as AI,L as MI,e as EI,f as Xr,g as _I,h as DI,O as c9,b as RI,k as zI}from"./router-BWgTyY51.js";import{a as PI,b as BI,g as u9}from"./react-vendor-Dtc2IqVY.js";import{c as d9,R as LI,T as II,L as qI,a as FI,C as Vm,X as Wm,Y as Ch,b as QI,B as fy,d as Gm,P as $I,e as HI,f as UI,_ as VI,g as WI}from"./charts-B1JvyJzO.js";import{c as Vi,a as tx,u as ji,P as Zt,b as $e,d as Cn,e as Vf,f as ko,g as es,h as Ls,i as h9,j as F4,k as Q4,S as GI,l as f9,m as m9,R as p9,O as nx,n as $4,C as rx,o as H4,T as U4,D as V4,p as W4,q as g9,r as x9,W as XI,s as v9,I as YI,t as y9,v as b9,w as KI,x as w9,V as ZI,L as S9,y as k9,z as JI,A as eq,B as O9,E as tq,F as nq,G as oo,H as sx,J as wd,K as j9,M as N9,N as C9,Q as T9,U as G4,X as X4,Y as ix,Z as ax,_ as Y4,$ as A9,a0 as rq,a1 as M9,a2 as sq,a3 as iq,a4 as E9,a5 as aq}from"./ui-vendor-nTGLnMlb.js";import{R as Fi,A as lq,D as oq,a as cq,Z as uf,C as dc,M as Wf,T as uq,X as Gf,P as _9,S as dq,b as Ii,I as co,c as Hu,d as hc,e as Xb,E as Yb,f as $i,g as Es,h as Kb,i as hq,j as Zb,k as Jb,L as lO,K as fq,l as xc,m as mq,n as pq,F as ao,o as gq,B as xq,U as D9,p as K4,q as vq,r as yq,s as Bs,H as hg,t as R9,u as df,v as e2,w as hf,x as bq,y as wq,z as lx,G as Z4,J as Wr,N as Ht,O as fg,Q as nd,V as Xf,W as Tc,Y as Ac,_ as Yf,$ as Sq,a0 as oO,a1 as kq,a2 as fc,a3 as t2,a4 as rd,a5 as cO,a6 as mg,a7 as Oq,a8 as uO,a9 as jq,aa as Nq,ab as Jl,ac as my,ad as dO,ae as Cq,af as Yh,ag as pg,ah as z9,ai as P9,aj as B9,ak as Tq,al as Aq,am as hO,an as Mq,ao as Eq,ap as fO,aq as _q}from"./icons-D6w7t-x9.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 l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).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 py={exports:{}},Th={},gy={exports:{}},xy={};var mO;function Dq(){return mO||(mO=1,(function(t){function e($,ae){var ne=$.length;$.push(ae);e:for(;0>>1,z=$[ce];if(0>>1;ces(P,ne))Ks(H,P)?($[ce]=H,$[K]=ne,ce=K):($[ce]=P,$[Y]=ne,ce=Y);else if(Ks(H,ne))$[ce]=H,$[K]=ne,ce=K;else break e}}return ae}function s($,ae){var ne=$.sortIndex-ae.sortIndex;return ne!==0?ne:$.id-ae.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 l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var d=[],h=[],m=1,p=null,x=3,v=!1,b=!1,k=!1,O=!1,j=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function _($){for(var ae=n(h);ae!==null;){if(ae.callback===null)r(h);else if(ae.startTime<=$)r(h),ae.sortIndex=ae.expirationTime,e(d,ae);else break;ae=n(h)}}function D($){if(k=!1,_($),!b)if(n(d)!==null)b=!0,E||(E=!0,V());else{var ae=n(h);ae!==null&&J(D,ae.startTime-$)}}var E=!1,R=-1,Q=5,F=-1;function L(){return O?!0:!(t.unstable_now()-F$&&L());){var ce=p.callback;if(typeof ce=="function"){p.callback=null,x=p.priorityLevel;var z=ce(p.expirationTime<=$);if($=t.unstable_now(),typeof z=="function"){p.callback=z,_($),ae=!0;break t}p===n(d)&&r(d),_($)}else r(d);p=n(d)}if(p!==null)ae=!0;else{var xe=n(h);xe!==null&&J(D,xe.startTime-$),ae=!1}}break e}finally{p=null,x=ne,v=!1}ae=void 0}}finally{ae?V():E=!1}}}var V;if(typeof A=="function")V=function(){A(U)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,W=de.port2;de.port1.onmessage=U,V=function(){W.postMessage(null)}}else V=function(){j(U,0)};function J($,ae){R=j(function(){$(t.unstable_now())},ae)}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($){$.callback=null},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function($){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var ne=x;x=ae;try{return $()}finally{x=ne}},t.unstable_requestPaint=function(){O=!0},t.unstable_runWithPriority=function($,ae){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ne=x;x=$;try{return ae()}finally{x=ne}},t.unstable_scheduleCallback=function($,ae,ne){var ce=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0ce?($.sortIndex=ne,e(h,$),n(d)===null&&$===n(h)&&(k?(T(R),R=-1):k=!0,J(D,ne-ce))):($.sortIndex=z,e(d,$),b||v||(b=!0,E||(E=!0,V()))),$},t.unstable_shouldYield=L,t.unstable_wrapCallback=function($){var ae=x;return function(){var ne=x;x=ae;try{return $.apply(this,arguments)}finally{x=ne}}}})(xy)),xy}var pO;function Rq(){return pO||(pO=1,gy.exports=Dq()),gy.exports}var gO;function zq(){if(gO)return Th;gO=1;var t=Rq(),e=PI(),n=BI();function r(o){var u="https://react.dev/errors/"+o;if(1z||(o.current=ce[z],ce[z]=null,z--)}function P(o,u){z++,ce[z]=o.current,o.current=u}var K=xe(null),H=xe(null),fe=xe(null),ve=xe(null);function Re(o,u){switch(P(fe,u),P(H,o),P(K,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?Mk(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=Mk(u),o=Ek(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}Y(K),P(K,o)}function ue(){Y(K),Y(H),Y(fe)}function We(o){o.memoizedState!==null&&P(ve,o);var u=K.current,f=Ek(u,o.type);u!==f&&(P(H,o),P(K,f))}function ct(o){H.current===o&&(Y(K),Y(H)),ve.current===o&&(Y(ve),kh._currentValue=ne)}var Oe,nt;function ut(o){if(Oe===void 0)try{throw Error()}catch(f){var u=f.stack.trim().match(/\n( *(at )?)/);Oe=u&&u[1]||"",nt=-1{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).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 py={exports:{}},Th={},gy={exports:{}},xy={};var mO;function Dq(){return mO||(mO=1,(function(t){function e($,ae){var ne=$.length;$.push(ae);e:for(;0>>1,R=$[ue];if(0>>1;ues(P,ne))Ks(H,P)?($[ue]=H,$[K]=ne,ue=K):($[ue]=P,$[Y]=ne,ue=Y);else if(Ks(H,ne))$[ue]=H,$[K]=ne,ue=K;else break e}}return ae}function s($,ae){var ne=$.sortIndex-ae.sortIndex;return ne!==0?ne:$.id-ae.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 l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var d=[],h=[],m=1,p=null,x=3,v=!1,b=!1,k=!1,O=!1,j=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function _($){for(var ae=n(h);ae!==null;){if(ae.callback===null)r(h);else if(ae.startTime<=$)r(h),ae.sortIndex=ae.expirationTime,e(d,ae);else break;ae=n(h)}}function D($){if(k=!1,_($),!b)if(n(d)!==null)b=!0,E||(E=!0,V());else{var ae=n(h);ae!==null&&J(D,ae.startTime-$)}}var E=!1,z=-1,Q=5,F=-1;function L(){return O?!0:!(t.unstable_now()-F$&&L());){var ue=p.callback;if(typeof ue=="function"){p.callback=null,x=p.priorityLevel;var R=ue(p.expirationTime<=$);if($=t.unstable_now(),typeof R=="function"){p.callback=R,_($),ae=!0;break t}p===n(d)&&r(d),_($)}else r(d);p=n(d)}if(p!==null)ae=!0;else{var me=n(h);me!==null&&J(D,me.startTime-$),ae=!1}}break e}finally{p=null,x=ne,v=!1}ae=void 0}}finally{ae?V():E=!1}}}var V;if(typeof A=="function")V=function(){A(U)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,W=ce.port2;ce.port1.onmessage=U,V=function(){W.postMessage(null)}}else V=function(){j(U,0)};function J($,ae){z=j(function(){$(t.unstable_now())},ae)}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($){$.callback=null},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function($){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var ne=x;x=ae;try{return $()}finally{x=ne}},t.unstable_requestPaint=function(){O=!0},t.unstable_runWithPriority=function($,ae){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ne=x;x=$;try{return ae()}finally{x=ne}},t.unstable_scheduleCallback=function($,ae,ne){var ue=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0ue?($.sortIndex=ne,e(h,$),n(d)===null&&$===n(h)&&(k?(T(z),z=-1):k=!0,J(D,ne-ue))):($.sortIndex=R,e(d,$),b||v||(b=!0,E||(E=!0,V()))),$},t.unstable_shouldYield=L,t.unstable_wrapCallback=function($){var ae=x;return function(){var ne=x;x=ae;try{return $.apply(this,arguments)}finally{x=ne}}}})(xy)),xy}var pO;function Rq(){return pO||(pO=1,gy.exports=Dq()),gy.exports}var gO;function zq(){if(gO)return Th;gO=1;var t=Rq(),e=PI(),n=BI();function r(o){var u="https://react.dev/errors/"+o;if(1R||(o.current=ue[R],ue[R]=null,R--)}function P(o,u){R++,ue[R]=o.current,o.current=u}var K=me(null),H=me(null),fe=me(null),ve=me(null);function Re(o,u){switch(P(fe,u),P(H,o),P(K,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?Mk(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=Mk(u),o=Ek(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}Y(K),P(K,o)}function de(){Y(K),Y(H),Y(fe)}function We(o){o.memoizedState!==null&&P(ve,o);var u=K.current,f=Ek(u,o.type);u!==f&&(P(H,o),P(K,f))}function ct(o){H.current===o&&(Y(K),Y(H)),ve.current===o&&(Y(ve),kh._currentValue=ne)}var Oe,nt;function ut(o){if(Oe===void 0)try{throw Error()}catch(f){var u=f.stack.trim().match(/\n( *(at )?)/);Oe=u&&u[1]||"",nt=-1)":-1y||Z[g]!==ge[y]){var je=` +`),xe=I.split(` +`);for(y=g=0;gy||Z[g]!==xe[y]){var je=` `+Z[g].replace(" at new "," at ");return o.displayName&&je.includes("")&&(je=je.replace("",o.displayName)),je}while(1<=g&&0<=y);break}}}finally{Ct=!1,Error.prepareStackTrace=f}return(f=o?o.displayName||o.name:"")?ut(f):""}function Tn(o,u){switch(o.tag){case 26:case 27:case 5:return ut(o.type);case 16:return ut("Lazy");case 13:return o.child!==u&&u!==null?ut("Suspense Fallback"):ut("Suspense");case 19:return ut("SuspenseList");case 0:case 15:return In(o.type,!1);case 11:return In(o.type.render,!1);case 1:return In(o.type,!0);case 31:return ut("Activity");default:return""}}function Jn(o){try{var u="",f=null;do u+=Tn(o,f),f=o,o=o.return;while(o);return u}catch(g){return` Error generating stack: `+g.message+` -`+g.stack}}var nn=Object.prototype.hasOwnProperty,_t=t.unstable_scheduleCallback,Yr=t.unstable_cancelCallback,qn=t.unstable_shouldYield,or=t.unstable_requestPaint,yn=t.unstable_now,ft=t.unstable_getCurrentPriorityLevel,ee=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,rt=t.unstable_LowPriority,Tt=t.unstable_IdlePriority,cr=t.log,Kr=t.unstable_setDisableYieldValue,re=null,Ae=null;function pt(o){if(typeof cr=="function"&&Kr(o),Ae&&typeof Ae.setStrictMode=="function")try{Ae.setStrictMode(re,o)}catch{}}var yt=Math.clz32?Math.clz32:Pn,vs=Math.log,dt=Math.LN2;function Pn(o){return o>>>=0,o===0?32:31-(vs(o)/dt|0)|0}var mt=256,rn=262144,Mr=4194304;function At(o){var u=o&42;if(u!==0)return u;switch(o&-o){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 o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ic(o,u,f){var g=o.pendingLanes;if(g===0)return 0;var y=0,w=o.suspendedLanes,M=o.pingedLanes;o=o.warmLanes;var I=g&134217727;return I!==0?(g=I&~w,g!==0?y=At(g):(M&=I,M!==0?y=At(M):f||(f=I&~o,f!==0&&(y=At(f))))):(I=g&~w,I!==0?y=At(I):M!==0?y=At(M):f||(f=g&~o,f!==0&&(y=At(f)))),y===0?0:u!==0&&u!==y&&(u&w)===0&&(w=y&-y,f=u&-u,w>=f||w===32&&(f&4194048)!==0)?u:y}function _o(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function t1(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+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 u+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 qc(){var o=Mr;return Mr<<=1,(Mr&62914560)===0&&(Mr=4194304),o}function Do(o){for(var u=[],f=0;31>f;f++)u.push(o);return u}function Bd(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function xB(o,u,f,g,y,w){var M=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var I=o.entanglements,Z=o.expirationTimes,ge=o.hiddenUpdates;for(f=M&~f;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var kB=/[\n"\\]/g;function ci(o){return o.replace(kB,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function l1(o,u,f,g,y,w,M,I){o.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?o.type=M:o.removeAttribute("type"),u!=null?M==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+oi(u)):o.value!==""+oi(u)&&(o.value=""+oi(u)):M!=="submit"&&M!=="reset"||o.removeAttribute("value"),u!=null?o1(o,M,oi(u)):f!=null?o1(o,M,oi(f)):g!=null&&o.removeAttribute("value"),y==null&&w!=null&&(o.defaultChecked=!!w),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?o.name=""+oi(I):o.removeAttribute("name")}function O3(o,u,f,g,y,w,M,I){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.type=w),u!=null||f!=null){if(!(w!=="submit"&&w!=="reset"||u!=null)){a1(o);return}f=f!=null?""+oi(f):"",u=u!=null?""+oi(u):f,I||u===o.value||(o.value=u),o.defaultValue=u}g=g??y,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=I?o.checked:!!g,o.defaultChecked=!!g,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(o.name=M),a1(o)}function o1(o,u,f){u==="number"&&P0(o.ownerDocument)===o||o.defaultValue===""+f||(o.defaultValue=""+f)}function Vc(o,u,f,g){if(o=o.options,u){u={};for(var y=0;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f1=!1;if(Da)try{var Fd={};Object.defineProperty(Fd,"passive",{get:function(){f1=!0}}),window.addEventListener("test",Fd,Fd),window.removeEventListener("test",Fd,Fd)}catch{f1=!1}var jl=null,m1=null,L0=null;function E3(){if(L0)return L0;var o,u=m1,f=u.length,g,y="value"in jl?jl.value:jl.textContent,w=y.length;for(o=0;o=Hd),B3=" ",L3=!1;function I3(o,u){switch(o){case"keyup":return KB.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q3(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Yc=!1;function JB(o,u){switch(o){case"compositionend":return q3(u);case"keypress":return u.which!==32?null:(L3=!0,B3);case"textInput":return o=u.data,o===B3&&L3?null:o;default:return null}}function eL(o,u){if(Yc)return o==="compositionend"||!y1&&I3(o,u)?(o=E3(),L0=m1=jl=null,Yc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:f,offset:u-o};o=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=G3(f)}}function Y3(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?Y3(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function K3(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=P0(o.document);u instanceof o.HTMLIFrameElement;){try{var f=typeof u.contentWindow.location.href=="string"}catch{f=!1}if(f)o=u.contentWindow;else break;u=P0(o.document)}return u}function S1(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var oL=Da&&"documentMode"in document&&11>=document.documentMode,Kc=null,k1=null,Gd=null,O1=!1;function Z3(o,u,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;O1||Kc==null||Kc!==P0(g)||(g=Kc,"selectionStart"in g&&S1(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Gd&&Wd(Gd,g)||(Gd=g,g=Em(k1,"onSelect"),0>=M,y-=M,Yi=1<<32-yt(u)+y|f<kt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var en=be(oe,Ke,me[kt],Ne);if(en===null){Ke===null&&(Ke=Qt);break}o&&Ke&&en.alternate===null&&u(oe,Ke),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en,Ke=Qt}if(kt===me.length)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;ktkt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var Wl=be(oe,Ke,en.value,Ne);if(Wl===null){Ke===null&&(Ke=Qt);break}o&&Ke&&Wl.alternate===null&&u(oe,Ke),se=w(Wl,se,kt),Jt===null?tt=Wl:Jt.sibling=Wl,Jt=Wl,Ke=Qt}if(en.done)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;!en.done;kt++,en=me.next())en=Te(oe,en.value,Ne),en!==null&&(se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return Ut&&za(oe,kt),tt}for(Ke=g(Ke);!en.done;kt++,en=me.next())en=ke(Ke,oe,kt,en.value,Ne),en!==null&&(o&&en.alternate!==null&&Ke.delete(en.key===null?kt:en.key),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return o&&Ke.forEach(function(TI){return u(oe,TI)}),Ut&&za(oe,kt),tt}function Sn(oe,se,me,Ne){if(typeof me=="object"&&me!==null&&me.type===k&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case v:e:{for(var tt=me.key;se!==null;){if(se.key===tt){if(tt=me.type,tt===k){if(se.tag===7){f(oe,se.sibling),Ne=y(se,me.props.children),Ne.return=oe,oe=Ne;break e}}else if(se.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===Q&&Ho(tt)===se.type){f(oe,se.sibling),Ne=y(se,me.props),eh(Ne,me),Ne.return=oe,oe=Ne;break e}f(oe,se);break}else u(oe,se);se=se.sibling}me.type===k?(Ne=Io(me.props.children,oe.mode,Ne,me.key),Ne.return=oe,oe=Ne):(Ne=G0(me.type,me.key,me.props,null,oe.mode,Ne),eh(Ne,me),Ne.return=oe,oe=Ne)}return M(oe);case b:e:{for(tt=me.key;se!==null;){if(se.key===tt)if(se.tag===4&&se.stateNode.containerInfo===me.containerInfo&&se.stateNode.implementation===me.implementation){f(oe,se.sibling),Ne=y(se,me.children||[]),Ne.return=oe,oe=Ne;break e}else{f(oe,se);break}else u(oe,se);se=se.sibling}Ne=E1(me,oe.mode,Ne),Ne.return=oe,oe=Ne}return M(oe);case Q:return me=Ho(me),Sn(oe,se,me,Ne)}if(J(me))return Ge(oe,se,me,Ne);if(V(me)){if(tt=V(me),typeof tt!="function")throw Error(r(150));return me=tt.call(me),lt(oe,se,me,Ne)}if(typeof me.then=="function")return Sn(oe,se,tm(me),Ne);if(me.$$typeof===A)return Sn(oe,se,K0(oe,me),Ne);nm(oe,me)}return typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint"?(me=""+me,se!==null&&se.tag===6?(f(oe,se.sibling),Ne=y(se,me),Ne.return=oe,oe=Ne):(f(oe,se),Ne=M1(me,oe.mode,Ne),Ne.return=oe,oe=Ne),M(oe)):f(oe,se)}return function(oe,se,me,Ne){try{Jd=0;var tt=Sn(oe,se,me,Ne);return ou=null,tt}catch(Ke){if(Ke===lu||Ke===J0)throw Ke;var Jt=Hs(29,Ke,null,oe.mode);return Jt.lanes=Ne,Jt.return=oe,Jt}finally{}}}var Vo=w6(!0),S6=w6(!1),Ml=!1;function $1(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function H1(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function El(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function _l(o,u,f){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(sn&2)!==0){var y=g.pending;return y===null?u.next=u:(u.next=y.next,y.next=u),g.pending=u,u=W0(o),i6(o,null,f),u}return V0(o,g,u,f),W0(o)}function th(o,u,f){if(u=u.updateQueue,u!==null&&(u=u.shared,(f&4194048)!==0)){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}function U1(o,u){var f=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var y=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var M={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};w===null?y=w=M:w=w.next=M,f=f.next}while(f!==null);w===null?y=w=u:w=w.next=u}else y=w=u;f={baseState:g.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:g.shared,callbacks:g.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=u:o.next=u,f.lastBaseUpdate=u}var V1=!1;function nh(){if(V1){var o=au;if(o!==null)throw o}}function rh(o,u,f,g){V1=!1;var y=o.updateQueue;Ml=!1;var w=y.firstBaseUpdate,M=y.lastBaseUpdate,I=y.shared.pending;if(I!==null){y.shared.pending=null;var Z=I,ge=Z.next;Z.next=null,M===null?w=ge:M.next=ge,M=Z;var je=o.alternate;je!==null&&(je=je.updateQueue,I=je.lastBaseUpdate,I!==M&&(I===null?je.firstBaseUpdate=ge:I.next=ge,je.lastBaseUpdate=Z))}if(w!==null){var Te=y.baseState;M=0,je=ge=Z=null,I=w;do{var be=I.lane&-536870913,ke=be!==I.lane;if(ke?(Ft&be)===be:(g&be)===be){be!==0&&be===iu&&(V1=!0),je!==null&&(je=je.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Ge=o,lt=I;be=u;var Sn=f;switch(lt.tag){case 1:if(Ge=lt.payload,typeof Ge=="function"){Te=Ge.call(Sn,Te,be);break e}Te=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=lt.payload,be=typeof Ge=="function"?Ge.call(Sn,Te,be):Ge,be==null)break e;Te=p({},Te,be);break e;case 2:Ml=!0}}be=I.callback,be!==null&&(o.flags|=64,ke&&(o.flags|=8192),ke=y.callbacks,ke===null?y.callbacks=[be]:ke.push(be))}else ke={lane:be,tag:I.tag,payload:I.payload,callback:I.callback,next:null},je===null?(ge=je=ke,Z=Te):je=je.next=ke,M|=be;if(I=I.next,I===null){if(I=y.shared.pending,I===null)break;ke=I,I=ke.next,ke.next=null,y.lastBaseUpdate=ke,y.shared.pending=null}}while(!0);je===null&&(Z=Te),y.baseState=Z,y.firstBaseUpdate=ge,y.lastBaseUpdate=je,w===null&&(y.shared.lanes=0),Bl|=M,o.lanes=M,o.memoizedState=Te}}function k6(o,u){if(typeof o!="function")throw Error(r(191,o));o.call(u)}function O6(o,u){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;ow?w:8;var M=$.T,I={};$.T=I,dv(o,!1,u,f);try{var Z=y(),ge=$.S;if(ge!==null&&ge(I,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var je=xL(Z,g);ah(o,u,je,Xs(o))}else ah(o,u,g,Xs(o))}catch(Te){ah(o,u,{then:function(){},status:"rejected",reason:Te},Xs())}finally{ae.p=w,M!==null&&I.types!==null&&(M.types=I.types),$.T=M}}function kL(){}function cv(o,u,f,g){if(o.tag!==5)throw Error(r(476));var y=nS(o).queue;tS(o,y,u,ne,f===null?kL:function(){return rS(o),f(g)})}function nS(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:ne},next:null};var f={};return u.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:f},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function rS(o){var u=nS(o);u.next===null&&(u=o.alternate.memoizedState),ah(o,u.next.queue,{},Xs())}function uv(){return qr(kh)}function sS(){return sr().memoizedState}function iS(){return sr().memoizedState}function OL(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var f=Xs();o=El(f);var g=_l(u,o,f);g!==null&&(js(g,u,f),th(g,u,f)),u={cache:I1()},o.payload=u;return}u=u.return}}function jL(o,u,f){var g=Xs();f={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},hm(o)?lS(u,f):(f=T1(o,u,f,g),f!==null&&(js(f,o,g),oS(f,u,g)))}function aS(o,u,f){var g=Xs();ah(o,u,f,g)}function ah(o,u,f,g){var y={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(hm(o))lS(u,y);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=u.lastRenderedReducer,w!==null))try{var M=u.lastRenderedState,I=w(M,f);if(y.hasEagerState=!0,y.eagerState=I,$s(I,M))return V0(o,u,y,0),An===null&&U0(),!1}catch{}finally{}if(f=T1(o,u,y,g),f!==null)return js(f,o,g),oS(f,u,g),!0}return!1}function dv(o,u,f,g){if(g={lane:2,revertLane:$v(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},hm(o)){if(u)throw Error(r(479))}else u=T1(o,f,g,2),u!==null&&js(u,o,2)}function hm(o){var u=o.alternate;return o===wt||u!==null&&u===wt}function lS(o,u){uu=im=!0;var f=o.pending;f===null?u.next=u:(u.next=f.next,f.next=u),o.pending=u}function oS(o,u,f){if((f&4194048)!==0){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}var lh={readContext:qr,use:om,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useLayoutEffect:er,useInsertionEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useSyncExternalStore:er,useId:er,useHostTransitionStatus:er,useFormState:er,useActionState:er,useOptimistic:er,useMemoCache:er,useCacheRefresh:er};lh.useEffectEvent=er;var cS={readContext:qr,use:om,useCallback:function(o,u){return os().memoizedState=[o,u===void 0?null:u],o},useContext:qr,useEffect:V6,useImperativeHandle:function(o,u,f){f=f!=null?f.concat([o]):null,um(4194308,4,Y6.bind(null,u,o),f)},useLayoutEffect:function(o,u){return um(4194308,4,o,u)},useInsertionEffect:function(o,u){um(4,2,o,u)},useMemo:function(o,u){var f=os();u=u===void 0?null:u;var g=o();if(Wo){pt(!0);try{o()}finally{pt(!1)}}return f.memoizedState=[g,u],g},useReducer:function(o,u,f){var g=os();if(f!==void 0){var y=f(u);if(Wo){pt(!0);try{f(u)}finally{pt(!1)}}}else y=u;return g.memoizedState=g.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},g.queue=o,o=o.dispatch=jL.bind(null,wt,o),[g.memoizedState,o]},useRef:function(o){var u=os();return o={current:o},u.memoizedState=o},useState:function(o){o=sv(o);var u=o.queue,f=aS.bind(null,wt,u);return u.dispatch=f,[o.memoizedState,f]},useDebugValue:lv,useDeferredValue:function(o,u){var f=os();return ov(f,o,u)},useTransition:function(){var o=sv(!1);return o=tS.bind(null,wt,o.queue,!0,!1),os().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,f){var g=wt,y=os();if(Ut){if(f===void 0)throw Error(r(407));f=f()}else{if(f=u(),An===null)throw Error(r(349));(Ft&127)!==0||M6(g,u,f)}y.memoizedState=f;var w={value:f,getSnapshot:u};return y.queue=w,V6(_6.bind(null,g,w,o),[o]),g.flags|=2048,hu(9,{destroy:void 0},E6.bind(null,g,w,f,u),null),f},useId:function(){var o=os(),u=An.identifierPrefix;if(Ut){var f=Ki,g=Yi;f=(g&~(1<<32-yt(g)-1)).toString(32)+f,u="_"+u+"R_"+f,f=am++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof g.is=="string"?M.createElement("select",{is:g.is}):M.createElement("select"),g.multiple?w.multiple=!0:g.size&&(w.size=g.size);break;default:w=typeof g.is=="string"?M.createElement(y,{is:g.is}):M.createElement(y)}}w[Lr]=u,w[ys]=g;e:for(M=u.child;M!==null;){if(M.tag===5||M.tag===6)w.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===u)break e;for(;M.sibling===null;){if(M.return===null||M.return===u)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}u.stateNode=w;e:switch(Qr(w,y,g),y){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Fa(u)}}return Qn(u),jv(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,f),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==g&&Fa(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(r(166));if(o=fe.current,ru(u)){if(o=u.stateNode,f=u.memoizedProps,g=null,y=Ir,y!==null)switch(y.tag){case 27:case 5:g=y.memoizedProps}o[Lr]=u,o=!!(o.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||Tk(o.nodeValue,f)),o||Tl(u,!0)}else o=_m(o).createTextNode(g),o[Lr]=u,u.stateNode=o}return Qn(u),null;case 31:if(f=u.memoizedState,o===null||o.memoizedState!==null){if(g=ru(u),f!==null){if(o===null){if(!g)throw Error(r(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),o=!1}else f=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return u.flags&256?(Vs(u),u):(Vs(u),null);if((u.flags&128)!==0)throw Error(r(558))}return Qn(u),null;case 13:if(g=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=ru(u),g!==null&&g.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=u.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),y=!1}else y=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return u.flags&256?(Vs(u),u):(Vs(u),null)}return Vs(u),(u.flags&128)!==0?(u.lanes=f,u):(f=g!==null,o=o!==null&&o.memoizedState!==null,f&&(g=u.child,y=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(y=g.alternate.memoizedState.cachePool.pool),w=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(w=g.memoizedState.cachePool.pool),w!==y&&(g.flags|=2048)),f!==o&&f&&(u.child.flags|=8192),xm(u,u.updateQueue),Qn(u),null);case 4:return ue(),o===null&&Wv(u.stateNode.containerInfo),Qn(u),null;case 10:return Ba(u.type),Qn(u),null;case 19:if(Y(rr),g=u.memoizedState,g===null)return Qn(u),null;if(y=(u.flags&128)!==0,w=g.rendering,w===null)if(y)ch(g,!1);else{if(tr!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(w=sm(o),w!==null){for(u.flags|=128,ch(g,!1),o=w.updateQueue,u.updateQueue=o,xm(u,o),u.subtreeFlags=0,o=f,f=u.child;f!==null;)a6(f,o),f=f.sibling;return P(rr,rr.current&1|2),Ut&&za(u,g.treeForkCount),u.child}o=o.sibling}g.tail!==null&&yn()>Sm&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304)}else{if(!y)if(o=sm(w),o!==null){if(u.flags|=128,y=!0,o=o.updateQueue,u.updateQueue=o,xm(u,o),ch(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!Ut)return Qn(u),null}else 2*yn()-g.renderingStartTime>Sm&&f!==536870912&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304);g.isBackwards?(w.sibling=u.child,u.child=w):(o=g.last,o!==null?o.sibling=w:u.child=w,g.last=w)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=yn(),o.sibling=null,f=rr.current,P(rr,y?f&1|2:f&1),Ut&&za(u,g.treeForkCount),o):(Qn(u),null);case 22:case 23:return Vs(u),G1(),g=u.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(f&536870912)!==0&&(u.flags&128)===0&&(Qn(u),u.subtreeFlags&6&&(u.flags|=8192)):Qn(u),f=u.updateQueue,f!==null&&xm(u,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==f&&(u.flags|=2048),o!==null&&Y($o),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),u.memoizedState.cache!==f&&(u.flags|=2048),Ba(ur),Qn(u),null;case 25:return null;case 30:return null}throw Error(r(156,u.tag))}function ML(o,u){switch(D1(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return Ba(ur),ue(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return ct(u),null;case 31:if(u.memoizedState!==null){if(Vs(u),u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(Vs(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return Y(rr),null;case 4:return ue(),null;case 10:return Ba(u.type),null;case 22:case 23:return Vs(u),G1(),o!==null&&Y($o),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return Ba(ur),null;case 25:return null;default:return null}}function DS(o,u){switch(D1(u),u.tag){case 3:Ba(ur),ue();break;case 26:case 27:case 5:ct(u);break;case 4:ue();break;case 31:u.memoizedState!==null&&Vs(u);break;case 13:Vs(u);break;case 19:Y(rr);break;case 10:Ba(u.type);break;case 22:case 23:Vs(u),G1(),o!==null&&Y($o);break;case 24:Ba(ur)}}function uh(o,u){try{var f=u.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var y=g.next;f=y;do{if((f.tag&o)===o){g=void 0;var w=f.create,M=f.inst;g=w(),M.destroy=g}f=f.next}while(f!==y)}}catch(I){gn(u,u.return,I)}}function zl(o,u,f){try{var g=u.updateQueue,y=g!==null?g.lastEffect:null;if(y!==null){var w=y.next;g=w;do{if((g.tag&o)===o){var M=g.inst,I=M.destroy;if(I!==void 0){M.destroy=void 0,y=u;var Z=f,ge=I;try{ge()}catch(je){gn(y,Z,je)}}}g=g.next}while(g!==w)}}catch(je){gn(u,u.return,je)}}function RS(o){var u=o.updateQueue;if(u!==null){var f=o.stateNode;try{O6(u,f)}catch(g){gn(o,o.return,g)}}}function zS(o,u,f){f.props=Go(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(g){gn(o,u,g)}}function dh(o,u){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof f=="function"?o.refCleanup=f(g):f.current=g}}catch(y){gn(o,u,y)}}function Zi(o,u){var f=o.ref,g=o.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(y){gn(o,u,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(y){gn(o,u,y)}else f.current=null}function PS(o){var u=o.type,f=o.memoizedProps,g=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(y){gn(o,o.return,y)}}function Nv(o,u,f){try{var g=o.stateNode;ZL(g,o.type,f,u),g[ys]=u}catch(y){gn(o,o.return,y)}}function BS(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ql(o.type)||o.tag===4}function Cv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||BS(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Ql(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Tv(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(o,u):(u=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,u.appendChild(o),f=f._reactRootContainer,f!=null||u.onclick!==null||(u.onclick=_a));else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode,u=null),o=o.child,o!==null))for(Tv(o,u,f),o=o.sibling;o!==null;)Tv(o,u,f),o=o.sibling}function vm(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?f.insertBefore(o,u):f.appendChild(o);else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(vm(o,u,f),o=o.sibling;o!==null;)vm(o,u,f),o=o.sibling}function LS(o){var u=o.stateNode,f=o.memoizedProps;try{for(var g=o.type,y=u.attributes;y.length;)u.removeAttributeNode(y[0]);Qr(u,g,f),u[Lr]=o,u[ys]=f}catch(w){gn(o,o.return,w)}}var Qa=!1,fr=!1,Av=!1,IS=typeof WeakSet=="function"?WeakSet:Set,_r=null;function EL(o,u){if(o=o.containerInfo,Yv=Im,o=K3(o),S1(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var y=g.anchorOffset,w=g.focusNode;g=g.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var M=0,I=-1,Z=-1,ge=0,je=0,Te=o,be=null;t:for(;;){for(var ke;Te!==f||y!==0&&Te.nodeType!==3||(I=M+y),Te!==w||g!==0&&Te.nodeType!==3||(Z=M+g),Te.nodeType===3&&(M+=Te.nodeValue.length),(ke=Te.firstChild)!==null;)be=Te,Te=ke;for(;;){if(Te===o)break t;if(be===f&&++ge===y&&(I=M),be===w&&++je===g&&(Z=M),(ke=Te.nextSibling)!==null)break;Te=be,be=Te.parentNode}Te=ke}f=I===-1||Z===-1?null:{start:I,end:Z}}else f=null}f=f||{start:0,end:0}}else f=null;for(Kv={focusedElem:o,selectionRange:f},Im=!1,_r=u;_r!==null;)if(u=_r,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,_r=o;else for(;_r!==null;){switch(u=_r,w=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(f=0;f title"))),Qr(w,g,f),w[Lr]=o,Er(w),g=w;break e;case"link":var M=Uk("link","href",y).get(g+(f.href||""));if(M){for(var I=0;ISn&&(M=Sn,Sn=lt,lt=M);var oe=X3(I,lt),se=X3(I,Sn);if(oe&&se&&(ke.rangeCount!==1||ke.anchorNode!==oe.node||ke.anchorOffset!==oe.offset||ke.focusNode!==se.node||ke.focusOffset!==se.offset)){var me=Te.createRange();me.setStart(oe.node,oe.offset),ke.removeAllRanges(),lt>Sn?(ke.addRange(me),ke.extend(se.node,se.offset)):(me.setEnd(se.node,se.offset),ke.addRange(me))}}}}for(Te=[],ke=I;ke=ke.parentNode;)ke.nodeType===1&&Te.push({element:ke,left:ke.scrollLeft,top:ke.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;If?32:f,$.T=null,f=Pv,Pv=null;var w=Il,M=Wa;if(br=0,xu=Il=null,Wa=0,(sn&6)!==0)throw Error(r(331));var I=sn;if(sn|=4,YS(w.current),WS(w,w.current,M,f),sn=I,xh(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot=="function")try{Ae.onPostCommitFiberRoot(re,w)}catch{}return!0}finally{ae.p=y,$.T=g,mk(o,u)}}function gk(o,u,f){u=di(f,u),u=pv(o.stateNode,u,2),o=_l(o,u,2),o!==null&&(Bd(o,2),Ji(o))}function gn(o,u,f){if(o.tag===3)gk(o,o,f);else for(;u!==null;){if(u.tag===3){gk(u,o,f);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ll===null||!Ll.has(g))){o=di(f,o),f=xS(2),g=_l(u,f,2),g!==null&&(vS(f,g,u,o),Bd(g,2),Ji(g));break}}u=u.return}}function qv(o,u,f){var g=o.pingCache;if(g===null){g=o.pingCache=new RL;var y=new Set;g.set(u,y)}else y=g.get(u),y===void 0&&(y=new Set,g.set(u,y));y.has(f)||(_v=!0,y.add(f),o=IL.bind(null,o,u,f),u.then(o,o))}function IL(o,u,f){var g=o.pingCache;g!==null&&g.delete(u),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,An===o&&(Ft&f)===f&&(tr===4||tr===3&&(Ft&62914560)===Ft&&300>yn()-wm?(sn&2)===0&&vu(o,0):Dv|=f,gu===Ft&&(gu=0)),Ji(o)}function xk(o,u){u===0&&(u=qc()),o=Lo(o,u),o!==null&&(Bd(o,u),Ji(o))}function qL(o){var u=o.memoizedState,f=0;u!==null&&(f=u.retryLane),xk(o,f)}function FL(o,u){var f=0;switch(o.tag){case 31:case 13:var g=o.stateNode,y=o.memoizedState;y!==null&&(f=y.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(u),xk(o,f)}function QL(o,u){return _t(o,u)}var Tm=null,bu=null,Fv=!1,Am=!1,Qv=!1,Fl=0;function Ji(o){o!==bu&&o.next===null&&(bu===null?Tm=bu=o:bu=bu.next=o),Am=!0,Fv||(Fv=!0,HL())}function xh(o,u){if(!Qv&&Am){Qv=!0;do for(var f=!1,g=Tm;g!==null;){if(o!==0){var y=g.pendingLanes;if(y===0)var w=0;else{var M=g.suspendedLanes,I=g.pingedLanes;w=(1<<31-yt(42|o)+1)-1,w&=y&~(M&~I),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(f=!0,wk(g,w))}else w=Ft,w=Ic(g,g===An?w:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(w&3)===0||_o(g,w)||(f=!0,wk(g,w));g=g.next}while(f);Qv=!1}}function $L(){vk()}function vk(){Am=Fv=!1;var o=0;Fl!==0&&eI()&&(o=Fl);for(var u=yn(),f=null,g=Tm;g!==null;){var y=g.next,w=yk(g,u);w===0?(g.next=null,f===null?Tm=y:f.next=y,y===null&&(bu=f)):(f=g,(o!==0||(w&3)!==0)&&(Am=!0)),g=y}br!==0&&br!==5||xh(o),Fl!==0&&(Fl=0)}function yk(o,u){for(var f=o.suspendedLanes,g=o.pingedLanes,y=o.expirationTimes,w=o.pendingLanes&-62914561;0I)break;var je=Z.transferSize,Te=Z.initiatorType;je&&Ak(Te)&&(Z=Z.responseEnd,M+=je*(Z"u"?null:document;function Fk(o,u,f){var g=wu;if(g&&typeof u=="string"&&u){var y=ci(u);y='link[rel="'+o+'"][href="'+y+'"]',typeof f=="string"&&(y+='[crossorigin="'+f+'"]'),qk.has(y)||(qk.add(y),o={rel:o,crossOrigin:f,href:u},g.querySelector(y)===null&&(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function cI(o){Ga.D(o),Fk("dns-prefetch",o,null)}function uI(o,u){Ga.C(o,u),Fk("preconnect",o,u)}function dI(o,u,f){Ga.L(o,u,f);var g=wu;if(g&&o&&u){var y='link[rel="preload"][as="'+ci(u)+'"]';u==="image"&&f&&f.imageSrcSet?(y+='[imagesrcset="'+ci(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(y+='[imagesizes="'+ci(f.imageSizes)+'"]')):y+='[href="'+ci(o)+'"]';var w=y;switch(u){case"style":w=Su(o);break;case"script":w=ku(o)}xi.has(w)||(o=p({rel:"preload",href:u==="image"&&f&&f.imageSrcSet?void 0:o,as:u},f),xi.set(w,o),g.querySelector(y)!==null||u==="style"&&g.querySelector(wh(w))||u==="script"&&g.querySelector(Sh(w))||(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function hI(o,u){Ga.m(o,u);var f=wu;if(f&&o){var g=u&&typeof u.as=="string"?u.as:"script",y='link[rel="modulepreload"][as="'+ci(g)+'"][href="'+ci(o)+'"]',w=y;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=ku(o)}if(!xi.has(w)&&(o=p({rel:"modulepreload",href:o},u),xi.set(w,o),f.querySelector(y)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Sh(w)))return}g=f.createElement("link"),Qr(g,"link",o),Er(g),f.head.appendChild(g)}}}function fI(o,u,f){Ga.S(o,u,f);var g=wu;if(g&&o){var y=Hc(g).hoistableStyles,w=Su(o);u=u||"default";var M=y.get(w);if(!M){var I={loading:0,preload:null};if(M=g.querySelector(wh(w)))I.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":u},f),(f=xi.get(w))&&sy(o,f);var Z=M=g.createElement("link");Er(Z),Qr(Z,"link",o),Z._p=new Promise(function(ge,je){Z.onload=ge,Z.onerror=je}),Z.addEventListener("load",function(){I.loading|=1}),Z.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Rm(M,u,g)}M={type:"stylesheet",instance:M,count:1,state:I},y.set(w,M)}}}function mI(o,u){Ga.X(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function pI(o,u){Ga.M(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0,type:"module"},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function Qk(o,u,f,g){var y=(y=fe.current)?Dm(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(u=Su(f.href),f=Hc(y).hoistableStyles,g=f.get(u),g||(g={type:"style",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){o=Su(f.href);var w=Hc(y).hoistableStyles,M=w.get(o);if(M||(y=y.ownerDocument||y,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(o,M),(w=y.querySelector(wh(o)))&&!w._p&&(M.instance=w,M.state.loading=5),xi.has(o)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},xi.set(o,f),w||gI(y,o,f,M.state))),u&&g===null)throw Error(r(528,""));return M}if(u&&g!==null)throw Error(r(529,""));return null;case"script":return u=f.async,f=f.src,typeof f=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=ku(f),f=Hc(y).hoistableScripts,g=f.get(u),g||(g={type:"script",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Su(o){return'href="'+ci(o)+'"'}function wh(o){return'link[rel="stylesheet"]['+o+"]"}function $k(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function gI(o,u,f,g){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=o.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),Qr(u,"link",f),Er(u),o.head.appendChild(u))}function ku(o){return'[src="'+ci(o)+'"]'}function Sh(o){return"script[async]"+o}function Hk(o,u,f){if(u.count++,u.instance===null)switch(u.type){case"style":var g=o.querySelector('style[data-href~="'+ci(f.href)+'"]');if(g)return u.instance=g,Er(g),g;var y=p({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),Er(g),Qr(g,"style",y),Rm(g,f.precedence,o),u.instance=g;case"stylesheet":y=Su(f.href);var w=o.querySelector(wh(y));if(w)return u.state.loading|=4,u.instance=w,Er(w),w;g=$k(f),(y=xi.get(y))&&sy(g,y),w=(o.ownerDocument||o).createElement("link"),Er(w);var M=w;return M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),u.state.loading|=4,Rm(w,f.precedence,o),u.instance=w;case"script":return w=ku(f.src),(y=o.querySelector(Sh(w)))?(u.instance=y,Er(y),y):(g=f,(y=xi.get(w))&&(g=p({},f),iy(g,y)),o=o.ownerDocument||o,y=o.createElement("script"),Er(y),Qr(y,"link",g),o.head.appendChild(y),u.instance=y);case"void":return null;default:throw Error(r(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Rm(g,f.precedence,o));return u.instance}function Rm(o,u,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=g.length?g[g.length-1]:null,w=y,M=0;M title"):null)}function xI(o,u,f){if(f===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function Wk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function vI(o,u,f,g){if(f.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var y=Su(g.href),w=u.querySelector(wh(y));if(w){u=w._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=Pm.bind(o),u.then(o,o)),f.state.loading|=4,f.instance=w,Er(w);return}w=u.ownerDocument||u,g=$k(g),(y=xi.get(y))&&sy(g,y),w=w.createElement("link"),Er(w);var M=w;M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),f.instance=w}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(f,u),(u=f.state.preload)&&(f.state.loading&3)===0&&(o.count++,f=Pm.bind(o),u.addEventListener("load",f),u.addEventListener("error",f))}}var ay=0;function yI(o,u){return o.stylesheets&&o.count===0&&Lm(o,o.stylesheets),0ay?50:800)+u);return o.unsuspend=f,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(y)}}:null}function Pm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Bm=null;function Lm(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Bm=new Map,u.forEach(bI,o),Bm=null,Pm.call(o))}function bI(o,u){if(!(u.state.loading&4)){var f=Bm.get(o);if(f)var g=f.get(null);else{f=new Map,Bm.set(o,f);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),py.exports=zq(),py.exports}var Bq=Pq();function L9(t,e){return function(){return t.apply(e,arguments)}}const{toString:Lq}=Object.prototype,{getPrototypeOf:J4}=Object,{iterator:ox,toStringTag:I9}=Symbol,cx=(t=>e=>{const n=Lq.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Wi=t=>(t=t.toLowerCase(),e=>cx(e)===t),ux=t=>e=>typeof e===t,{isArray:Sd}=Array,sd=ux("undefined");function Kf(t){return t!==null&&!sd(t)&&t.constructor!==null&&!sd(t.constructor)&&Rs(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const q9=Wi("ArrayBuffer");function Iq(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&q9(t.buffer),e}const qq=ux("string"),Rs=ux("function"),F9=ux("number"),Zf=t=>t!==null&&typeof t=="object",Fq=t=>t===!0||t===!1,$p=t=>{if(cx(t)!=="object")return!1;const e=J4(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(I9 in t)&&!(ox in t)},Qq=t=>{if(!Zf(t)||Kf(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},$q=Wi("Date"),Hq=Wi("File"),Uq=Wi("Blob"),Vq=Wi("FileList"),Wq=t=>Zf(t)&&Rs(t.pipe),Gq=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Rs(t.append)&&((e=cx(t))==="formdata"||e==="object"&&Rs(t.toString)&&t.toString()==="[object FormData]"))},Xq=Wi("URLSearchParams"),[Yq,Kq,Zq,Jq]=["ReadableStream","Request","Response","Headers"].map(Wi),eF=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Jf(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Sd(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const ac=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$9=t=>!sd(t)&&t!==ac;function n2(){const{caseless:t,skipUndefined:e}=$9(this)&&this||{},n={},r=(s,i)=>{const l=t&&Q9(n,i)||i;$p(n[l])&&$p(s)?n[l]=n2(n[l],s):$p(s)?n[l]=n2({},s):Sd(s)?n[l]=s.slice():(!e||!sd(s))&&(n[l]=s)};for(let s=0,i=arguments.length;s(Jf(e,(s,i)=>{n&&Rs(s)?t[i]=L9(s,n):t[i]=s},{allOwnKeys:r}),t),nF=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rF=(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)},sF=(t,e,n,r)=>{let s,i,l;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)l=s[i],(!r||r(l,t,e))&&!c[l]&&(e[l]=t[l],c[l]=!0);t=n!==!1&&J4(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},iF=(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},aF=t=>{if(!t)return null;if(Sd(t))return t;let e=t.length;if(!F9(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},lF=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&J4(Uint8Array)),oF=(t,e)=>{const r=(t&&t[ox]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},cF=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},uF=Wi("HTMLFormElement"),dF=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),vO=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),hF=Wi("RegExp"),H9=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Jf(n,(s,i)=>{let l;(l=e(s,i,t))!==!1&&(r[i]=l||s)}),Object.defineProperties(t,r)},fF=t=>{H9(t,(e,n)=>{if(Rs(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Rs(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+"'")})}})},mF=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Sd(t)?r(t):r(String(t).split(e)),n},pF=()=>{},gF=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function xF(t){return!!(t&&Rs(t.append)&&t[I9]==="FormData"&&t[ox])}const vF=t=>{const e=new Array(10),n=(r,s)=>{if(Zf(r)){if(e.indexOf(r)>=0)return;if(Kf(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Sd(r)?[]:{};return Jf(r,(l,c)=>{const d=n(l,s+1);!sd(d)&&(i[c]=d)}),e[s]=void 0,i}}return r};return n(t,0)},yF=Wi("AsyncFunction"),bF=t=>t&&(Zf(t)||Rs(t))&&Rs(t.then)&&Rs(t.catch),U9=((t,e)=>t?setImmediate:e?((n,r)=>(ac.addEventListener("message",({source:s,data:i})=>{s===ac&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ac.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Rs(ac.postMessage)),wF=typeof queueMicrotask<"u"?queueMicrotask.bind(ac):typeof process<"u"&&process.nextTick||U9,SF=t=>t!=null&&Rs(t[ox]),we={isArray:Sd,isArrayBuffer:q9,isBuffer:Kf,isFormData:Gq,isArrayBufferView:Iq,isString:qq,isNumber:F9,isBoolean:Fq,isObject:Zf,isPlainObject:$p,isEmptyObject:Qq,isReadableStream:Yq,isRequest:Kq,isResponse:Zq,isHeaders:Jq,isUndefined:sd,isDate:$q,isFile:Hq,isBlob:Uq,isRegExp:hF,isFunction:Rs,isStream:Wq,isURLSearchParams:Xq,isTypedArray:lF,isFileList:Vq,forEach:Jf,merge:n2,extend:tF,trim:eF,stripBOM:nF,inherits:rF,toFlatObject:sF,kindOf:cx,kindOfTest:Wi,endsWith:iF,toArray:aF,forEachEntry:oF,matchAll:cF,isHTMLForm:uF,hasOwnProperty:vO,hasOwnProp:vO,reduceDescriptors:H9,freezeMethods:fF,toObjectSet:mF,toCamelCase:dF,noop:pF,toFiniteNumber:gF,findKey:Q9,global:ac,isContextDefined:$9,isSpecCompliantForm:xF,toJSONObject:vF,isAsyncFn:yF,isThenable:bF,setImmediate:U9,asap:wF,isIterable:SF};function St(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)}we.inherits(St,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:we.toJSONObject(this.config),code:this.code,status:this.status}}});const V9=St.prototype,W9={};["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=>{W9[t]={value:t}});Object.defineProperties(St,W9);Object.defineProperty(V9,"isAxiosError",{value:!0});St.from=(t,e,n,r,s,i)=>{const l=Object.create(V9);we.toFlatObject(t,l,function(m){return m!==Error.prototype},h=>h!=="isAxiosError");const c=t&&t.message?t.message:"Error",d=e==null&&t?t.code:e;return St.call(l,c,d,n,r,s),t&&l.cause==null&&Object.defineProperty(l,"cause",{value:t,configurable:!0}),l.name=t&&t.name||"Error",i&&Object.assign(l,i),l};const kF=null;function r2(t){return we.isPlainObject(t)||we.isArray(t)}function G9(t){return we.endsWith(t,"[]")?t.slice(0,-2):t}function yO(t,e,n){return t?t.concat(e).map(function(s,i){return s=G9(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function OF(t){return we.isArray(t)&&!t.some(r2)}const jF=we.toFlatObject(we,{},null,function(e){return/^is[A-Z]/.test(e)});function dx(t,e,n){if(!we.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=we.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,O){return!we.isUndefined(O[k])});const r=n.metaTokens,s=n.visitor||m,i=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&we.isSpecCompliantForm(e);if(!we.isFunction(s))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(we.isDate(b))return b.toISOString();if(we.isBoolean(b))return b.toString();if(!d&&we.isBlob(b))throw new St("Blob is not supported. Use a Buffer instead.");return we.isArrayBuffer(b)||we.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function m(b,k,O){let j=b;if(b&&!O&&typeof b=="object"){if(we.endsWith(k,"{}"))k=r?k:k.slice(0,-2),b=JSON.stringify(b);else if(we.isArray(b)&&OF(b)||(we.isFileList(b)||we.endsWith(k,"[]"))&&(j=we.toArray(b)))return k=G9(k),j.forEach(function(A,_){!(we.isUndefined(A)||A===null)&&e.append(l===!0?yO([k],_,i):l===null?k:k+"[]",h(A))}),!1}return r2(b)?!0:(e.append(yO(O,k,i),h(b)),!1)}const p=[],x=Object.assign(jF,{defaultVisitor:m,convertValue:h,isVisitable:r2});function v(b,k){if(!we.isUndefined(b)){if(p.indexOf(b)!==-1)throw Error("Circular reference detected in "+k.join("."));p.push(b),we.forEach(b,function(j,T){(!(we.isUndefined(j)||j===null)&&s.call(e,j,we.isString(T)?T.trim():T,k,x))===!0&&v(j,k?k.concat(T):[T])}),p.pop()}}if(!we.isObject(t))throw new TypeError("data must be an object");return v(t),e}function bO(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function ew(t,e){this._pairs=[],t&&dx(t,this,e)}const X9=ew.prototype;X9.append=function(e,n){this._pairs.push([e,n])};X9.toString=function(e){const n=e?function(r){return e.call(this,r,bO)}:bO;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function NF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Y9(t,e,n){if(!e)return t;const r=n&&n.encode||NF;we.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=we.isURLSearchParams(e)?e.toString():new ew(e,n).toString(r),i){const l=t.indexOf("#");l!==-1&&(t=t.slice(0,l)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class wO{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){we.forEach(this.handlers,function(r){r!==null&&e(r)})}}const K9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},CF=typeof URLSearchParams<"u"?URLSearchParams:ew,TF=typeof FormData<"u"?FormData:null,AF=typeof Blob<"u"?Blob:null,MF={isBrowser:!0,classes:{URLSearchParams:CF,FormData:TF,Blob:AF},protocols:["http","https","file","blob","url","data"]},tw=typeof window<"u"&&typeof document<"u",s2=typeof navigator=="object"&&navigator||void 0,EF=tw&&(!s2||["ReactNative","NativeScript","NS"].indexOf(s2.product)<0),_F=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",DF=tw&&window.location.href||"http://localhost",RF=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:tw,hasStandardBrowserEnv:EF,hasStandardBrowserWebWorkerEnv:_F,navigator:s2,origin:DF},Symbol.toStringTag,{value:"Module"})),ts={...RF,...MF};function zF(t,e){return dx(t,new ts.classes.URLSearchParams,{visitor:function(n,r,s,i){return ts.isNode&&we.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function PF(t){return we.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function BF(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return l=!l&&we.isArray(s)?s.length:l,d?(we.hasOwnProp(s,l)?s[l]=[s[l],r]:s[l]=r,!c):((!s[l]||!we.isObject(s[l]))&&(s[l]=[]),e(n,r,s[l],i)&&we.isArray(s[l])&&(s[l]=BF(s[l])),!c)}if(we.isFormData(t)&&we.isFunction(t.entries)){const n={};return we.forEachEntry(t,(r,s)=>{e(PF(r),s,n,0)}),n}return null}function LF(t,e,n){if(we.isString(t))try{return(e||JSON.parse)(t),we.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const e0={transitional:K9,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=we.isObject(e);if(i&&we.isHTMLForm(e)&&(e=new FormData(e)),we.isFormData(e))return s?JSON.stringify(Z9(e)):e;if(we.isArrayBuffer(e)||we.isBuffer(e)||we.isStream(e)||we.isFile(e)||we.isBlob(e)||we.isReadableStream(e))return e;if(we.isArrayBufferView(e))return e.buffer;if(we.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return zF(e,this.formSerializer).toString();if((c=we.isFileList(e))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return dx(c?{"files[]":e}:e,d&&new d,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),LF(e)):e}],transformResponse:[function(e){const n=this.transitional||e0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(we.isResponse(e)||we.isReadableStream(e))return e;if(e&&we.isString(e)&&(r&&!this.responseType||s)){const l=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(l)throw c.name==="SyntaxError"?St.from(c,St.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ts.classes.FormData,Blob:ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};we.forEach(["delete","get","head","post","put","patch"],t=>{e0.headers[t]={}});const IF=we.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"]),qF=t=>{const e={};let n,r,s;return t&&t.split(` +`+g.stack}}var nn=Object.prototype.hasOwnProperty,_t=t.unstable_scheduleCallback,Yr=t.unstable_cancelCallback,qn=t.unstable_shouldYield,or=t.unstable_requestPaint,yn=t.unstable_now,ft=t.unstable_getCurrentPriorityLevel,ee=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Be=t.unstable_NormalPriority,rt=t.unstable_LowPriority,Tt=t.unstable_IdlePriority,cr=t.log,Kr=t.unstable_setDisableYieldValue,re=null,Ae=null;function pt(o){if(typeof cr=="function"&&Kr(o),Ae&&typeof Ae.setStrictMode=="function")try{Ae.setStrictMode(re,o)}catch{}}var yt=Math.clz32?Math.clz32:Pn,vs=Math.log,dt=Math.LN2;function Pn(o){return o>>>=0,o===0?32:31-(vs(o)/dt|0)|0}var mt=256,rn=262144,Mr=4194304;function At(o){var u=o&42;if(u!==0)return u;switch(o&-o){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 o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ic(o,u,f){var g=o.pendingLanes;if(g===0)return 0;var y=0,w=o.suspendedLanes,M=o.pingedLanes;o=o.warmLanes;var I=g&134217727;return I!==0?(g=I&~w,g!==0?y=At(g):(M&=I,M!==0?y=At(M):f||(f=I&~o,f!==0&&(y=At(f))))):(I=g&~w,I!==0?y=At(I):M!==0?y=At(M):f||(f=g&~o,f!==0&&(y=At(f)))),y===0?0:u!==0&&u!==y&&(u&w)===0&&(w=y&-y,f=u&-u,w>=f||w===32&&(f&4194048)!==0)?u:y}function _o(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function t1(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+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 u+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 qc(){var o=Mr;return Mr<<=1,(Mr&62914560)===0&&(Mr=4194304),o}function Do(o){for(var u=[],f=0;31>f;f++)u.push(o);return u}function Bd(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function xB(o,u,f,g,y,w){var M=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var I=o.entanglements,Z=o.expirationTimes,xe=o.hiddenUpdates;for(f=M&~f;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var kB=/[\n"\\]/g;function ci(o){return o.replace(kB,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function l1(o,u,f,g,y,w,M,I){o.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?o.type=M:o.removeAttribute("type"),u!=null?M==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+oi(u)):o.value!==""+oi(u)&&(o.value=""+oi(u)):M!=="submit"&&M!=="reset"||o.removeAttribute("value"),u!=null?o1(o,M,oi(u)):f!=null?o1(o,M,oi(f)):g!=null&&o.removeAttribute("value"),y==null&&w!=null&&(o.defaultChecked=!!w),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?o.name=""+oi(I):o.removeAttribute("name")}function O3(o,u,f,g,y,w,M,I){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.type=w),u!=null||f!=null){if(!(w!=="submit"&&w!=="reset"||u!=null)){a1(o);return}f=f!=null?""+oi(f):"",u=u!=null?""+oi(u):f,I||u===o.value||(o.value=u),o.defaultValue=u}g=g??y,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=I?o.checked:!!g,o.defaultChecked=!!g,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(o.name=M),a1(o)}function o1(o,u,f){u==="number"&&P0(o.ownerDocument)===o||o.defaultValue===""+f||(o.defaultValue=""+f)}function Vc(o,u,f,g){if(o=o.options,u){u={};for(var y=0;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f1=!1;if(Da)try{var Fd={};Object.defineProperty(Fd,"passive",{get:function(){f1=!0}}),window.addEventListener("test",Fd,Fd),window.removeEventListener("test",Fd,Fd)}catch{f1=!1}var jl=null,m1=null,L0=null;function E3(){if(L0)return L0;var o,u=m1,f=u.length,g,y="value"in jl?jl.value:jl.textContent,w=y.length;for(o=0;o=Hd),B3=" ",L3=!1;function I3(o,u){switch(o){case"keyup":return KB.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q3(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Yc=!1;function JB(o,u){switch(o){case"compositionend":return q3(u);case"keypress":return u.which!==32?null:(L3=!0,B3);case"textInput":return o=u.data,o===B3&&L3?null:o;default:return null}}function eL(o,u){if(Yc)return o==="compositionend"||!y1&&I3(o,u)?(o=E3(),L0=m1=jl=null,Yc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:f,offset:u-o};o=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=G3(f)}}function Y3(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?Y3(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function K3(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=P0(o.document);u instanceof o.HTMLIFrameElement;){try{var f=typeof u.contentWindow.location.href=="string"}catch{f=!1}if(f)o=u.contentWindow;else break;u=P0(o.document)}return u}function S1(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var oL=Da&&"documentMode"in document&&11>=document.documentMode,Kc=null,k1=null,Gd=null,O1=!1;function Z3(o,u,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;O1||Kc==null||Kc!==P0(g)||(g=Kc,"selectionStart"in g&&S1(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Gd&&Wd(Gd,g)||(Gd=g,g=Em(k1,"onSelect"),0>=M,y-=M,Yi=1<<32-yt(u)+y|f<kt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var en=be(oe,Ke,pe[kt],Ne);if(en===null){Ke===null&&(Ke=Qt);break}o&&Ke&&en.alternate===null&&u(oe,Ke),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en,Ke=Qt}if(kt===pe.length)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;ktkt?(Qt=Ke,Ke=null):Qt=Ke.sibling;var Wl=be(oe,Ke,en.value,Ne);if(Wl===null){Ke===null&&(Ke=Qt);break}o&&Ke&&Wl.alternate===null&&u(oe,Ke),se=w(Wl,se,kt),Jt===null?tt=Wl:Jt.sibling=Wl,Jt=Wl,Ke=Qt}if(en.done)return f(oe,Ke),Ut&&za(oe,kt),tt;if(Ke===null){for(;!en.done;kt++,en=pe.next())en=Te(oe,en.value,Ne),en!==null&&(se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return Ut&&za(oe,kt),tt}for(Ke=g(Ke);!en.done;kt++,en=pe.next())en=ke(Ke,oe,kt,en.value,Ne),en!==null&&(o&&en.alternate!==null&&Ke.delete(en.key===null?kt:en.key),se=w(en,se,kt),Jt===null?tt=en:Jt.sibling=en,Jt=en);return o&&Ke.forEach(function(TI){return u(oe,TI)}),Ut&&za(oe,kt),tt}function Sn(oe,se,pe,Ne){if(typeof pe=="object"&&pe!==null&&pe.type===k&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case v:e:{for(var tt=pe.key;se!==null;){if(se.key===tt){if(tt=pe.type,tt===k){if(se.tag===7){f(oe,se.sibling),Ne=y(se,pe.props.children),Ne.return=oe,oe=Ne;break e}}else if(se.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===Q&&Ho(tt)===se.type){f(oe,se.sibling),Ne=y(se,pe.props),eh(Ne,pe),Ne.return=oe,oe=Ne;break e}f(oe,se);break}else u(oe,se);se=se.sibling}pe.type===k?(Ne=Io(pe.props.children,oe.mode,Ne,pe.key),Ne.return=oe,oe=Ne):(Ne=G0(pe.type,pe.key,pe.props,null,oe.mode,Ne),eh(Ne,pe),Ne.return=oe,oe=Ne)}return M(oe);case b:e:{for(tt=pe.key;se!==null;){if(se.key===tt)if(se.tag===4&&se.stateNode.containerInfo===pe.containerInfo&&se.stateNode.implementation===pe.implementation){f(oe,se.sibling),Ne=y(se,pe.children||[]),Ne.return=oe,oe=Ne;break e}else{f(oe,se);break}else u(oe,se);se=se.sibling}Ne=E1(pe,oe.mode,Ne),Ne.return=oe,oe=Ne}return M(oe);case Q:return pe=Ho(pe),Sn(oe,se,pe,Ne)}if(J(pe))return Ge(oe,se,pe,Ne);if(V(pe)){if(tt=V(pe),typeof tt!="function")throw Error(r(150));return pe=tt.call(pe),lt(oe,se,pe,Ne)}if(typeof pe.then=="function")return Sn(oe,se,tm(pe),Ne);if(pe.$$typeof===A)return Sn(oe,se,K0(oe,pe),Ne);nm(oe,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint"?(pe=""+pe,se!==null&&se.tag===6?(f(oe,se.sibling),Ne=y(se,pe),Ne.return=oe,oe=Ne):(f(oe,se),Ne=M1(pe,oe.mode,Ne),Ne.return=oe,oe=Ne),M(oe)):f(oe,se)}return function(oe,se,pe,Ne){try{Jd=0;var tt=Sn(oe,se,pe,Ne);return ou=null,tt}catch(Ke){if(Ke===lu||Ke===J0)throw Ke;var Jt=Hs(29,Ke,null,oe.mode);return Jt.lanes=Ne,Jt.return=oe,Jt}finally{}}}var Vo=w6(!0),S6=w6(!1),Ml=!1;function $1(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function H1(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function El(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function _l(o,u,f){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(sn&2)!==0){var y=g.pending;return y===null?u.next=u:(u.next=y.next,y.next=u),g.pending=u,u=W0(o),i6(o,null,f),u}return V0(o,g,u,f),W0(o)}function th(o,u,f){if(u=u.updateQueue,u!==null&&(u=u.shared,(f&4194048)!==0)){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}function U1(o,u){var f=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var y=null,w=null;if(f=f.firstBaseUpdate,f!==null){do{var M={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};w===null?y=w=M:w=w.next=M,f=f.next}while(f!==null);w===null?y=w=u:w=w.next=u}else y=w=u;f={baseState:g.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:g.shared,callbacks:g.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=u:o.next=u,f.lastBaseUpdate=u}var V1=!1;function nh(){if(V1){var o=au;if(o!==null)throw o}}function rh(o,u,f,g){V1=!1;var y=o.updateQueue;Ml=!1;var w=y.firstBaseUpdate,M=y.lastBaseUpdate,I=y.shared.pending;if(I!==null){y.shared.pending=null;var Z=I,xe=Z.next;Z.next=null,M===null?w=xe:M.next=xe,M=Z;var je=o.alternate;je!==null&&(je=je.updateQueue,I=je.lastBaseUpdate,I!==M&&(I===null?je.firstBaseUpdate=xe:I.next=xe,je.lastBaseUpdate=Z))}if(w!==null){var Te=y.baseState;M=0,je=xe=Z=null,I=w;do{var be=I.lane&-536870913,ke=be!==I.lane;if(ke?(Ft&be)===be:(g&be)===be){be!==0&&be===iu&&(V1=!0),je!==null&&(je=je.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Ge=o,lt=I;be=u;var Sn=f;switch(lt.tag){case 1:if(Ge=lt.payload,typeof Ge=="function"){Te=Ge.call(Sn,Te,be);break e}Te=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=lt.payload,be=typeof Ge=="function"?Ge.call(Sn,Te,be):Ge,be==null)break e;Te=p({},Te,be);break e;case 2:Ml=!0}}be=I.callback,be!==null&&(o.flags|=64,ke&&(o.flags|=8192),ke=y.callbacks,ke===null?y.callbacks=[be]:ke.push(be))}else ke={lane:be,tag:I.tag,payload:I.payload,callback:I.callback,next:null},je===null?(xe=je=ke,Z=Te):je=je.next=ke,M|=be;if(I=I.next,I===null){if(I=y.shared.pending,I===null)break;ke=I,I=ke.next,ke.next=null,y.lastBaseUpdate=ke,y.shared.pending=null}}while(!0);je===null&&(Z=Te),y.baseState=Z,y.firstBaseUpdate=xe,y.lastBaseUpdate=je,w===null&&(y.shared.lanes=0),Bl|=M,o.lanes=M,o.memoizedState=Te}}function k6(o,u){if(typeof o!="function")throw Error(r(191,o));o.call(u)}function O6(o,u){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;ow?w:8;var M=$.T,I={};$.T=I,dv(o,!1,u,f);try{var Z=y(),xe=$.S;if(xe!==null&&xe(I,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var je=xL(Z,g);ah(o,u,je,Xs(o))}else ah(o,u,g,Xs(o))}catch(Te){ah(o,u,{then:function(){},status:"rejected",reason:Te},Xs())}finally{ae.p=w,M!==null&&I.types!==null&&(M.types=I.types),$.T=M}}function kL(){}function cv(o,u,f,g){if(o.tag!==5)throw Error(r(476));var y=nS(o).queue;tS(o,y,u,ne,f===null?kL:function(){return rS(o),f(g)})}function nS(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:ne},next:null};var f={};return u.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ia,lastRenderedState:f},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function rS(o){var u=nS(o);u.next===null&&(u=o.alternate.memoizedState),ah(o,u.next.queue,{},Xs())}function uv(){return qr(kh)}function sS(){return sr().memoizedState}function iS(){return sr().memoizedState}function OL(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var f=Xs();o=El(f);var g=_l(u,o,f);g!==null&&(js(g,u,f),th(g,u,f)),u={cache:I1()},o.payload=u;return}u=u.return}}function jL(o,u,f){var g=Xs();f={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},hm(o)?lS(u,f):(f=T1(o,u,f,g),f!==null&&(js(f,o,g),oS(f,u,g)))}function aS(o,u,f){var g=Xs();ah(o,u,f,g)}function ah(o,u,f,g){var y={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(hm(o))lS(u,y);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=u.lastRenderedReducer,w!==null))try{var M=u.lastRenderedState,I=w(M,f);if(y.hasEagerState=!0,y.eagerState=I,$s(I,M))return V0(o,u,y,0),An===null&&U0(),!1}catch{}finally{}if(f=T1(o,u,y,g),f!==null)return js(f,o,g),oS(f,u,g),!0}return!1}function dv(o,u,f,g){if(g={lane:2,revertLane:$v(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},hm(o)){if(u)throw Error(r(479))}else u=T1(o,f,g,2),u!==null&&js(u,o,2)}function hm(o){var u=o.alternate;return o===wt||u!==null&&u===wt}function lS(o,u){uu=im=!0;var f=o.pending;f===null?u.next=u:(u.next=f.next,f.next=u),o.pending=u}function oS(o,u,f){if((f&4194048)!==0){var g=u.lanes;g&=o.pendingLanes,f|=g,u.lanes=f,f3(o,f)}}var lh={readContext:qr,use:om,useCallback:er,useContext:er,useEffect:er,useImperativeHandle:er,useLayoutEffect:er,useInsertionEffect:er,useMemo:er,useReducer:er,useRef:er,useState:er,useDebugValue:er,useDeferredValue:er,useTransition:er,useSyncExternalStore:er,useId:er,useHostTransitionStatus:er,useFormState:er,useActionState:er,useOptimistic:er,useMemoCache:er,useCacheRefresh:er};lh.useEffectEvent=er;var cS={readContext:qr,use:om,useCallback:function(o,u){return os().memoizedState=[o,u===void 0?null:u],o},useContext:qr,useEffect:V6,useImperativeHandle:function(o,u,f){f=f!=null?f.concat([o]):null,um(4194308,4,Y6.bind(null,u,o),f)},useLayoutEffect:function(o,u){return um(4194308,4,o,u)},useInsertionEffect:function(o,u){um(4,2,o,u)},useMemo:function(o,u){var f=os();u=u===void 0?null:u;var g=o();if(Wo){pt(!0);try{o()}finally{pt(!1)}}return f.memoizedState=[g,u],g},useReducer:function(o,u,f){var g=os();if(f!==void 0){var y=f(u);if(Wo){pt(!0);try{f(u)}finally{pt(!1)}}}else y=u;return g.memoizedState=g.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},g.queue=o,o=o.dispatch=jL.bind(null,wt,o),[g.memoizedState,o]},useRef:function(o){var u=os();return o={current:o},u.memoizedState=o},useState:function(o){o=sv(o);var u=o.queue,f=aS.bind(null,wt,u);return u.dispatch=f,[o.memoizedState,f]},useDebugValue:lv,useDeferredValue:function(o,u){var f=os();return ov(f,o,u)},useTransition:function(){var o=sv(!1);return o=tS.bind(null,wt,o.queue,!0,!1),os().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,f){var g=wt,y=os();if(Ut){if(f===void 0)throw Error(r(407));f=f()}else{if(f=u(),An===null)throw Error(r(349));(Ft&127)!==0||M6(g,u,f)}y.memoizedState=f;var w={value:f,getSnapshot:u};return y.queue=w,V6(_6.bind(null,g,w,o),[o]),g.flags|=2048,hu(9,{destroy:void 0},E6.bind(null,g,w,f,u),null),f},useId:function(){var o=os(),u=An.identifierPrefix;if(Ut){var f=Ki,g=Yi;f=(g&~(1<<32-yt(g)-1)).toString(32)+f,u="_"+u+"R_"+f,f=am++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof g.is=="string"?M.createElement("select",{is:g.is}):M.createElement("select"),g.multiple?w.multiple=!0:g.size&&(w.size=g.size);break;default:w=typeof g.is=="string"?M.createElement(y,{is:g.is}):M.createElement(y)}}w[Lr]=u,w[ys]=g;e:for(M=u.child;M!==null;){if(M.tag===5||M.tag===6)w.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===u)break e;for(;M.sibling===null;){if(M.return===null||M.return===u)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}u.stateNode=w;e:switch(Qr(w,y,g),y){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Fa(u)}}return Qn(u),jv(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,f),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==g&&Fa(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(r(166));if(o=fe.current,ru(u)){if(o=u.stateNode,f=u.memoizedProps,g=null,y=Ir,y!==null)switch(y.tag){case 27:case 5:g=y.memoizedProps}o[Lr]=u,o=!!(o.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||Tk(o.nodeValue,f)),o||Tl(u,!0)}else o=_m(o).createTextNode(g),o[Lr]=u,u.stateNode=o}return Qn(u),null;case 31:if(f=u.memoizedState,o===null||o.memoizedState!==null){if(g=ru(u),f!==null){if(o===null){if(!g)throw Error(r(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),o=!1}else f=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return u.flags&256?(Vs(u),u):(Vs(u),null);if((u.flags&128)!==0)throw Error(r(558))}return Qn(u),null;case 13:if(g=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=ru(u),g!==null&&g.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=u.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Lr]=u}else qo(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Qn(u),y=!1}else y=z1(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return u.flags&256?(Vs(u),u):(Vs(u),null)}return Vs(u),(u.flags&128)!==0?(u.lanes=f,u):(f=g!==null,o=o!==null&&o.memoizedState!==null,f&&(g=u.child,y=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(y=g.alternate.memoizedState.cachePool.pool),w=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(w=g.memoizedState.cachePool.pool),w!==y&&(g.flags|=2048)),f!==o&&f&&(u.child.flags|=8192),xm(u,u.updateQueue),Qn(u),null);case 4:return de(),o===null&&Wv(u.stateNode.containerInfo),Qn(u),null;case 10:return Ba(u.type),Qn(u),null;case 19:if(Y(rr),g=u.memoizedState,g===null)return Qn(u),null;if(y=(u.flags&128)!==0,w=g.rendering,w===null)if(y)ch(g,!1);else{if(tr!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(w=sm(o),w!==null){for(u.flags|=128,ch(g,!1),o=w.updateQueue,u.updateQueue=o,xm(u,o),u.subtreeFlags=0,o=f,f=u.child;f!==null;)a6(f,o),f=f.sibling;return P(rr,rr.current&1|2),Ut&&za(u,g.treeForkCount),u.child}o=o.sibling}g.tail!==null&&yn()>Sm&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304)}else{if(!y)if(o=sm(w),o!==null){if(u.flags|=128,y=!0,o=o.updateQueue,u.updateQueue=o,xm(u,o),ch(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!Ut)return Qn(u),null}else 2*yn()-g.renderingStartTime>Sm&&f!==536870912&&(u.flags|=128,y=!0,ch(g,!1),u.lanes=4194304);g.isBackwards?(w.sibling=u.child,u.child=w):(o=g.last,o!==null?o.sibling=w:u.child=w,g.last=w)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=yn(),o.sibling=null,f=rr.current,P(rr,y?f&1|2:f&1),Ut&&za(u,g.treeForkCount),o):(Qn(u),null);case 22:case 23:return Vs(u),G1(),g=u.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(f&536870912)!==0&&(u.flags&128)===0&&(Qn(u),u.subtreeFlags&6&&(u.flags|=8192)):Qn(u),f=u.updateQueue,f!==null&&xm(u,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==f&&(u.flags|=2048),o!==null&&Y($o),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),u.memoizedState.cache!==f&&(u.flags|=2048),Ba(ur),Qn(u),null;case 25:return null;case 30:return null}throw Error(r(156,u.tag))}function ML(o,u){switch(D1(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return Ba(ur),de(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return ct(u),null;case 31:if(u.memoizedState!==null){if(Vs(u),u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(Vs(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(r(340));qo()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return Y(rr),null;case 4:return de(),null;case 10:return Ba(u.type),null;case 22:case 23:return Vs(u),G1(),o!==null&&Y($o),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return Ba(ur),null;case 25:return null;default:return null}}function DS(o,u){switch(D1(u),u.tag){case 3:Ba(ur),de();break;case 26:case 27:case 5:ct(u);break;case 4:de();break;case 31:u.memoizedState!==null&&Vs(u);break;case 13:Vs(u);break;case 19:Y(rr);break;case 10:Ba(u.type);break;case 22:case 23:Vs(u),G1(),o!==null&&Y($o);break;case 24:Ba(ur)}}function uh(o,u){try{var f=u.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var y=g.next;f=y;do{if((f.tag&o)===o){g=void 0;var w=f.create,M=f.inst;g=w(),M.destroy=g}f=f.next}while(f!==y)}}catch(I){xn(u,u.return,I)}}function zl(o,u,f){try{var g=u.updateQueue,y=g!==null?g.lastEffect:null;if(y!==null){var w=y.next;g=w;do{if((g.tag&o)===o){var M=g.inst,I=M.destroy;if(I!==void 0){M.destroy=void 0,y=u;var Z=f,xe=I;try{xe()}catch(je){xn(y,Z,je)}}}g=g.next}while(g!==w)}}catch(je){xn(u,u.return,je)}}function RS(o){var u=o.updateQueue;if(u!==null){var f=o.stateNode;try{O6(u,f)}catch(g){xn(o,o.return,g)}}}function zS(o,u,f){f.props=Go(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(g){xn(o,u,g)}}function dh(o,u){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof f=="function"?o.refCleanup=f(g):f.current=g}}catch(y){xn(o,u,y)}}function Zi(o,u){var f=o.ref,g=o.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(y){xn(o,u,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(y){xn(o,u,y)}else f.current=null}function PS(o){var u=o.type,f=o.memoizedProps,g=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(y){xn(o,o.return,y)}}function Nv(o,u,f){try{var g=o.stateNode;ZL(g,o.type,f,u),g[ys]=u}catch(y){xn(o,o.return,y)}}function BS(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ql(o.type)||o.tag===4}function Cv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||BS(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Ql(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Tv(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(o,u):(u=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,u.appendChild(o),f=f._reactRootContainer,f!=null||u.onclick!==null||(u.onclick=_a));else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode,u=null),o=o.child,o!==null))for(Tv(o,u,f),o=o.sibling;o!==null;)Tv(o,u,f),o=o.sibling}function vm(o,u,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,u?f.insertBefore(o,u):f.appendChild(o);else if(g!==4&&(g===27&&Ql(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(vm(o,u,f),o=o.sibling;o!==null;)vm(o,u,f),o=o.sibling}function LS(o){var u=o.stateNode,f=o.memoizedProps;try{for(var g=o.type,y=u.attributes;y.length;)u.removeAttributeNode(y[0]);Qr(u,g,f),u[Lr]=o,u[ys]=f}catch(w){xn(o,o.return,w)}}var Qa=!1,fr=!1,Av=!1,IS=typeof WeakSet=="function"?WeakSet:Set,_r=null;function EL(o,u){if(o=o.containerInfo,Yv=Im,o=K3(o),S1(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var y=g.anchorOffset,w=g.focusNode;g=g.focusOffset;try{f.nodeType,w.nodeType}catch{f=null;break e}var M=0,I=-1,Z=-1,xe=0,je=0,Te=o,be=null;t:for(;;){for(var ke;Te!==f||y!==0&&Te.nodeType!==3||(I=M+y),Te!==w||g!==0&&Te.nodeType!==3||(Z=M+g),Te.nodeType===3&&(M+=Te.nodeValue.length),(ke=Te.firstChild)!==null;)be=Te,Te=ke;for(;;){if(Te===o)break t;if(be===f&&++xe===y&&(I=M),be===w&&++je===g&&(Z=M),(ke=Te.nextSibling)!==null)break;Te=be,be=Te.parentNode}Te=ke}f=I===-1||Z===-1?null:{start:I,end:Z}}else f=null}f=f||{start:0,end:0}}else f=null;for(Kv={focusedElem:o,selectionRange:f},Im=!1,_r=u;_r!==null;)if(u=_r,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,_r=o;else for(;_r!==null;){switch(u=_r,w=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(f=0;f title"))),Qr(w,g,f),w[Lr]=o,Er(w),g=w;break e;case"link":var M=Uk("link","href",y).get(g+(f.href||""));if(M){for(var I=0;ISn&&(M=Sn,Sn=lt,lt=M);var oe=X3(I,lt),se=X3(I,Sn);if(oe&&se&&(ke.rangeCount!==1||ke.anchorNode!==oe.node||ke.anchorOffset!==oe.offset||ke.focusNode!==se.node||ke.focusOffset!==se.offset)){var pe=Te.createRange();pe.setStart(oe.node,oe.offset),ke.removeAllRanges(),lt>Sn?(ke.addRange(pe),ke.extend(se.node,se.offset)):(pe.setEnd(se.node,se.offset),ke.addRange(pe))}}}}for(Te=[],ke=I;ke=ke.parentNode;)ke.nodeType===1&&Te.push({element:ke,left:ke.scrollLeft,top:ke.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;If?32:f,$.T=null,f=Pv,Pv=null;var w=Il,M=Wa;if(br=0,xu=Il=null,Wa=0,(sn&6)!==0)throw Error(r(331));var I=sn;if(sn|=4,YS(w.current),WS(w,w.current,M,f),sn=I,xh(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot=="function")try{Ae.onPostCommitFiberRoot(re,w)}catch{}return!0}finally{ae.p=y,$.T=g,mk(o,u)}}function gk(o,u,f){u=di(f,u),u=pv(o.stateNode,u,2),o=_l(o,u,2),o!==null&&(Bd(o,2),Ji(o))}function xn(o,u,f){if(o.tag===3)gk(o,o,f);else for(;u!==null;){if(u.tag===3){gk(u,o,f);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ll===null||!Ll.has(g))){o=di(f,o),f=xS(2),g=_l(u,f,2),g!==null&&(vS(f,g,u,o),Bd(g,2),Ji(g));break}}u=u.return}}function qv(o,u,f){var g=o.pingCache;if(g===null){g=o.pingCache=new RL;var y=new Set;g.set(u,y)}else y=g.get(u),y===void 0&&(y=new Set,g.set(u,y));y.has(f)||(_v=!0,y.add(f),o=IL.bind(null,o,u,f),u.then(o,o))}function IL(o,u,f){var g=o.pingCache;g!==null&&g.delete(u),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,An===o&&(Ft&f)===f&&(tr===4||tr===3&&(Ft&62914560)===Ft&&300>yn()-wm?(sn&2)===0&&vu(o,0):Dv|=f,gu===Ft&&(gu=0)),Ji(o)}function xk(o,u){u===0&&(u=qc()),o=Lo(o,u),o!==null&&(Bd(o,u),Ji(o))}function qL(o){var u=o.memoizedState,f=0;u!==null&&(f=u.retryLane),xk(o,f)}function FL(o,u){var f=0;switch(o.tag){case 31:case 13:var g=o.stateNode,y=o.memoizedState;y!==null&&(f=y.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(u),xk(o,f)}function QL(o,u){return _t(o,u)}var Tm=null,bu=null,Fv=!1,Am=!1,Qv=!1,Fl=0;function Ji(o){o!==bu&&o.next===null&&(bu===null?Tm=bu=o:bu=bu.next=o),Am=!0,Fv||(Fv=!0,HL())}function xh(o,u){if(!Qv&&Am){Qv=!0;do for(var f=!1,g=Tm;g!==null;){if(o!==0){var y=g.pendingLanes;if(y===0)var w=0;else{var M=g.suspendedLanes,I=g.pingedLanes;w=(1<<31-yt(42|o)+1)-1,w&=y&~(M&~I),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(f=!0,wk(g,w))}else w=Ft,w=Ic(g,g===An?w:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(w&3)===0||_o(g,w)||(f=!0,wk(g,w));g=g.next}while(f);Qv=!1}}function $L(){vk()}function vk(){Am=Fv=!1;var o=0;Fl!==0&&eI()&&(o=Fl);for(var u=yn(),f=null,g=Tm;g!==null;){var y=g.next,w=yk(g,u);w===0?(g.next=null,f===null?Tm=y:f.next=y,y===null&&(bu=f)):(f=g,(o!==0||(w&3)!==0)&&(Am=!0)),g=y}br!==0&&br!==5||xh(o),Fl!==0&&(Fl=0)}function yk(o,u){for(var f=o.suspendedLanes,g=o.pingedLanes,y=o.expirationTimes,w=o.pendingLanes&-62914561;0I)break;var je=Z.transferSize,Te=Z.initiatorType;je&&Ak(Te)&&(Z=Z.responseEnd,M+=je*(Z"u"?null:document;function Fk(o,u,f){var g=wu;if(g&&typeof u=="string"&&u){var y=ci(u);y='link[rel="'+o+'"][href="'+y+'"]',typeof f=="string"&&(y+='[crossorigin="'+f+'"]'),qk.has(y)||(qk.add(y),o={rel:o,crossOrigin:f,href:u},g.querySelector(y)===null&&(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function cI(o){Ga.D(o),Fk("dns-prefetch",o,null)}function uI(o,u){Ga.C(o,u),Fk("preconnect",o,u)}function dI(o,u,f){Ga.L(o,u,f);var g=wu;if(g&&o&&u){var y='link[rel="preload"][as="'+ci(u)+'"]';u==="image"&&f&&f.imageSrcSet?(y+='[imagesrcset="'+ci(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(y+='[imagesizes="'+ci(f.imageSizes)+'"]')):y+='[href="'+ci(o)+'"]';var w=y;switch(u){case"style":w=Su(o);break;case"script":w=ku(o)}xi.has(w)||(o=p({rel:"preload",href:u==="image"&&f&&f.imageSrcSet?void 0:o,as:u},f),xi.set(w,o),g.querySelector(y)!==null||u==="style"&&g.querySelector(wh(w))||u==="script"&&g.querySelector(Sh(w))||(u=g.createElement("link"),Qr(u,"link",o),Er(u),g.head.appendChild(u)))}}function hI(o,u){Ga.m(o,u);var f=wu;if(f&&o){var g=u&&typeof u.as=="string"?u.as:"script",y='link[rel="modulepreload"][as="'+ci(g)+'"][href="'+ci(o)+'"]',w=y;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=ku(o)}if(!xi.has(w)&&(o=p({rel:"modulepreload",href:o},u),xi.set(w,o),f.querySelector(y)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Sh(w)))return}g=f.createElement("link"),Qr(g,"link",o),Er(g),f.head.appendChild(g)}}}function fI(o,u,f){Ga.S(o,u,f);var g=wu;if(g&&o){var y=Hc(g).hoistableStyles,w=Su(o);u=u||"default";var M=y.get(w);if(!M){var I={loading:0,preload:null};if(M=g.querySelector(wh(w)))I.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":u},f),(f=xi.get(w))&&sy(o,f);var Z=M=g.createElement("link");Er(Z),Qr(Z,"link",o),Z._p=new Promise(function(xe,je){Z.onload=xe,Z.onerror=je}),Z.addEventListener("load",function(){I.loading|=1}),Z.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Rm(M,u,g)}M={type:"stylesheet",instance:M,count:1,state:I},y.set(w,M)}}}function mI(o,u){Ga.X(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function pI(o,u){Ga.M(o,u);var f=wu;if(f&&o){var g=Hc(f).hoistableScripts,y=ku(o),w=g.get(y);w||(w=f.querySelector(Sh(y)),w||(o=p({src:o,async:!0,type:"module"},u),(u=xi.get(y))&&iy(o,u),w=f.createElement("script"),Er(w),Qr(w,"link",o),f.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(y,w))}}function Qk(o,u,f,g){var y=(y=fe.current)?Dm(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(u=Su(f.href),f=Hc(y).hoistableStyles,g=f.get(u),g||(g={type:"style",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){o=Su(f.href);var w=Hc(y).hoistableStyles,M=w.get(o);if(M||(y=y.ownerDocument||y,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(o,M),(w=y.querySelector(wh(o)))&&!w._p&&(M.instance=w,M.state.loading=5),xi.has(o)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},xi.set(o,f),w||gI(y,o,f,M.state))),u&&g===null)throw Error(r(528,""));return M}if(u&&g!==null)throw Error(r(529,""));return null;case"script":return u=f.async,f=f.src,typeof f=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=ku(f),f=Hc(y).hoistableScripts,g=f.get(u),g||(g={type:"script",instance:null,count:0,state:null},f.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Su(o){return'href="'+ci(o)+'"'}function wh(o){return'link[rel="stylesheet"]['+o+"]"}function $k(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function gI(o,u,f,g){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=o.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),Qr(u,"link",f),Er(u),o.head.appendChild(u))}function ku(o){return'[src="'+ci(o)+'"]'}function Sh(o){return"script[async]"+o}function Hk(o,u,f){if(u.count++,u.instance===null)switch(u.type){case"style":var g=o.querySelector('style[data-href~="'+ci(f.href)+'"]');if(g)return u.instance=g,Er(g),g;var y=p({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),Er(g),Qr(g,"style",y),Rm(g,f.precedence,o),u.instance=g;case"stylesheet":y=Su(f.href);var w=o.querySelector(wh(y));if(w)return u.state.loading|=4,u.instance=w,Er(w),w;g=$k(f),(y=xi.get(y))&&sy(g,y),w=(o.ownerDocument||o).createElement("link"),Er(w);var M=w;return M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),u.state.loading|=4,Rm(w,f.precedence,o),u.instance=w;case"script":return w=ku(f.src),(y=o.querySelector(Sh(w)))?(u.instance=y,Er(y),y):(g=f,(y=xi.get(w))&&(g=p({},f),iy(g,y)),o=o.ownerDocument||o,y=o.createElement("script"),Er(y),Qr(y,"link",g),o.head.appendChild(y),u.instance=y);case"void":return null;default:throw Error(r(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Rm(g,f.precedence,o));return u.instance}function Rm(o,u,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=g.length?g[g.length-1]:null,w=y,M=0;M title"):null)}function xI(o,u,f){if(f===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function Wk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function vI(o,u,f,g){if(f.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var y=Su(g.href),w=u.querySelector(wh(y));if(w){u=w._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=Pm.bind(o),u.then(o,o)),f.state.loading|=4,f.instance=w,Er(w);return}w=u.ownerDocument||u,g=$k(g),(y=xi.get(y))&&sy(g,y),w=w.createElement("link"),Er(w);var M=w;M._p=new Promise(function(I,Z){M.onload=I,M.onerror=Z}),Qr(w,"link",g),f.instance=w}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(f,u),(u=f.state.preload)&&(f.state.loading&3)===0&&(o.count++,f=Pm.bind(o),u.addEventListener("load",f),u.addEventListener("error",f))}}var ay=0;function yI(o,u){return o.stylesheets&&o.count===0&&Lm(o,o.stylesheets),0ay?50:800)+u);return o.unsuspend=f,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(y)}}:null}function Pm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Bm=null;function Lm(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Bm=new Map,u.forEach(bI,o),Bm=null,Pm.call(o))}function bI(o,u){if(!(u.state.loading&4)){var f=Bm.get(o);if(f)var g=f.get(null);else{f=new Map,Bm.set(o,f);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),py.exports=zq(),py.exports}var Bq=Pq();function L9(t,e){return function(){return t.apply(e,arguments)}}const{toString:Lq}=Object.prototype,{getPrototypeOf:J4}=Object,{iterator:ox,toStringTag:I9}=Symbol,cx=(t=>e=>{const n=Lq.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Wi=t=>(t=t.toLowerCase(),e=>cx(e)===t),ux=t=>e=>typeof e===t,{isArray:Sd}=Array,sd=ux("undefined");function Kf(t){return t!==null&&!sd(t)&&t.constructor!==null&&!sd(t.constructor)&&Rs(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const q9=Wi("ArrayBuffer");function Iq(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&q9(t.buffer),e}const qq=ux("string"),Rs=ux("function"),F9=ux("number"),Zf=t=>t!==null&&typeof t=="object",Fq=t=>t===!0||t===!1,$p=t=>{if(cx(t)!=="object")return!1;const e=J4(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(I9 in t)&&!(ox in t)},Qq=t=>{if(!Zf(t)||Kf(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},$q=Wi("Date"),Hq=Wi("File"),Uq=Wi("Blob"),Vq=Wi("FileList"),Wq=t=>Zf(t)&&Rs(t.pipe),Gq=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Rs(t.append)&&((e=cx(t))==="formdata"||e==="object"&&Rs(t.toString)&&t.toString()==="[object FormData]"))},Xq=Wi("URLSearchParams"),[Yq,Kq,Zq,Jq]=["ReadableStream","Request","Response","Headers"].map(Wi),eF=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Jf(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Sd(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const ac=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$9=t=>!sd(t)&&t!==ac;function n2(){const{caseless:t,skipUndefined:e}=$9(this)&&this||{},n={},r=(s,i)=>{const l=t&&Q9(n,i)||i;$p(n[l])&&$p(s)?n[l]=n2(n[l],s):$p(s)?n[l]=n2({},s):Sd(s)?n[l]=s.slice():(!e||!sd(s))&&(n[l]=s)};for(let s=0,i=arguments.length;s(Jf(e,(s,i)=>{n&&Rs(s)?t[i]=L9(s,n):t[i]=s},{allOwnKeys:r}),t),nF=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rF=(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)},sF=(t,e,n,r)=>{let s,i,l;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)l=s[i],(!r||r(l,t,e))&&!c[l]&&(e[l]=t[l],c[l]=!0);t=n!==!1&&J4(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},iF=(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},aF=t=>{if(!t)return null;if(Sd(t))return t;let e=t.length;if(!F9(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},lF=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&J4(Uint8Array)),oF=(t,e)=>{const r=(t&&t[ox]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},cF=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},uF=Wi("HTMLFormElement"),dF=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),vO=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),hF=Wi("RegExp"),H9=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Jf(n,(s,i)=>{let l;(l=e(s,i,t))!==!1&&(r[i]=l||s)}),Object.defineProperties(t,r)},fF=t=>{H9(t,(e,n)=>{if(Rs(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Rs(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+"'")})}})},mF=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Sd(t)?r(t):r(String(t).split(e)),n},pF=()=>{},gF=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function xF(t){return!!(t&&Rs(t.append)&&t[I9]==="FormData"&&t[ox])}const vF=t=>{const e=new Array(10),n=(r,s)=>{if(Zf(r)){if(e.indexOf(r)>=0)return;if(Kf(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Sd(r)?[]:{};return Jf(r,(l,c)=>{const d=n(l,s+1);!sd(d)&&(i[c]=d)}),e[s]=void 0,i}}return r};return n(t,0)},yF=Wi("AsyncFunction"),bF=t=>t&&(Zf(t)||Rs(t))&&Rs(t.then)&&Rs(t.catch),U9=((t,e)=>t?setImmediate:e?((n,r)=>(ac.addEventListener("message",({source:s,data:i})=>{s===ac&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ac.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Rs(ac.postMessage)),wF=typeof queueMicrotask<"u"?queueMicrotask.bind(ac):typeof process<"u"&&process.nextTick||U9,SF=t=>t!=null&&Rs(t[ox]),we={isArray:Sd,isArrayBuffer:q9,isBuffer:Kf,isFormData:Gq,isArrayBufferView:Iq,isString:qq,isNumber:F9,isBoolean:Fq,isObject:Zf,isPlainObject:$p,isEmptyObject:Qq,isReadableStream:Yq,isRequest:Kq,isResponse:Zq,isHeaders:Jq,isUndefined:sd,isDate:$q,isFile:Hq,isBlob:Uq,isRegExp:hF,isFunction:Rs,isStream:Wq,isURLSearchParams:Xq,isTypedArray:lF,isFileList:Vq,forEach:Jf,merge:n2,extend:tF,trim:eF,stripBOM:nF,inherits:rF,toFlatObject:sF,kindOf:cx,kindOfTest:Wi,endsWith:iF,toArray:aF,forEachEntry:oF,matchAll:cF,isHTMLForm:uF,hasOwnProperty:vO,hasOwnProp:vO,reduceDescriptors:H9,freezeMethods:fF,toObjectSet:mF,toCamelCase:dF,noop:pF,toFiniteNumber:gF,findKey:Q9,global:ac,isContextDefined:$9,isSpecCompliantForm:xF,toJSONObject:vF,isAsyncFn:yF,isThenable:bF,setImmediate:U9,asap:wF,isIterable:SF};function St(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)}we.inherits(St,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:we.toJSONObject(this.config),code:this.code,status:this.status}}});const V9=St.prototype,W9={};["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=>{W9[t]={value:t}});Object.defineProperties(St,W9);Object.defineProperty(V9,"isAxiosError",{value:!0});St.from=(t,e,n,r,s,i)=>{const l=Object.create(V9);we.toFlatObject(t,l,function(m){return m!==Error.prototype},h=>h!=="isAxiosError");const c=t&&t.message?t.message:"Error",d=e==null&&t?t.code:e;return St.call(l,c,d,n,r,s),t&&l.cause==null&&Object.defineProperty(l,"cause",{value:t,configurable:!0}),l.name=t&&t.name||"Error",i&&Object.assign(l,i),l};const kF=null;function r2(t){return we.isPlainObject(t)||we.isArray(t)}function G9(t){return we.endsWith(t,"[]")?t.slice(0,-2):t}function yO(t,e,n){return t?t.concat(e).map(function(s,i){return s=G9(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function OF(t){return we.isArray(t)&&!t.some(r2)}const jF=we.toFlatObject(we,{},null,function(e){return/^is[A-Z]/.test(e)});function dx(t,e,n){if(!we.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=we.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,O){return!we.isUndefined(O[k])});const r=n.metaTokens,s=n.visitor||m,i=n.dots,l=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&we.isSpecCompliantForm(e);if(!we.isFunction(s))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(we.isDate(b))return b.toISOString();if(we.isBoolean(b))return b.toString();if(!d&&we.isBlob(b))throw new St("Blob is not supported. Use a Buffer instead.");return we.isArrayBuffer(b)||we.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function m(b,k,O){let j=b;if(b&&!O&&typeof b=="object"){if(we.endsWith(k,"{}"))k=r?k:k.slice(0,-2),b=JSON.stringify(b);else if(we.isArray(b)&&OF(b)||(we.isFileList(b)||we.endsWith(k,"[]"))&&(j=we.toArray(b)))return k=G9(k),j.forEach(function(A,_){!(we.isUndefined(A)||A===null)&&e.append(l===!0?yO([k],_,i):l===null?k:k+"[]",h(A))}),!1}return r2(b)?!0:(e.append(yO(O,k,i),h(b)),!1)}const p=[],x=Object.assign(jF,{defaultVisitor:m,convertValue:h,isVisitable:r2});function v(b,k){if(!we.isUndefined(b)){if(p.indexOf(b)!==-1)throw Error("Circular reference detected in "+k.join("."));p.push(b),we.forEach(b,function(j,T){(!(we.isUndefined(j)||j===null)&&s.call(e,j,we.isString(T)?T.trim():T,k,x))===!0&&v(j,k?k.concat(T):[T])}),p.pop()}}if(!we.isObject(t))throw new TypeError("data must be an object");return v(t),e}function bO(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function ew(t,e){this._pairs=[],t&&dx(t,this,e)}const X9=ew.prototype;X9.append=function(e,n){this._pairs.push([e,n])};X9.toString=function(e){const n=e?function(r){return e.call(this,r,bO)}:bO;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function NF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Y9(t,e,n){if(!e)return t;const r=n&&n.encode||NF;we.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=we.isURLSearchParams(e)?e.toString():new ew(e,n).toString(r),i){const l=t.indexOf("#");l!==-1&&(t=t.slice(0,l)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class wO{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){we.forEach(this.handlers,function(r){r!==null&&e(r)})}}const K9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},CF=typeof URLSearchParams<"u"?URLSearchParams:ew,TF=typeof FormData<"u"?FormData:null,AF=typeof Blob<"u"?Blob:null,MF={isBrowser:!0,classes:{URLSearchParams:CF,FormData:TF,Blob:AF},protocols:["http","https","file","blob","url","data"]},tw=typeof window<"u"&&typeof document<"u",s2=typeof navigator=="object"&&navigator||void 0,EF=tw&&(!s2||["ReactNative","NativeScript","NS"].indexOf(s2.product)<0),_F=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",DF=tw&&window.location.href||"http://localhost",RF=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:tw,hasStandardBrowserEnv:EF,hasStandardBrowserWebWorkerEnv:_F,navigator:s2,origin:DF},Symbol.toStringTag,{value:"Module"})),ts={...RF,...MF};function zF(t,e){return dx(t,new ts.classes.URLSearchParams,{visitor:function(n,r,s,i){return ts.isNode&&we.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function PF(t){return we.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function BF(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return l=!l&&we.isArray(s)?s.length:l,d?(we.hasOwnProp(s,l)?s[l]=[s[l],r]:s[l]=r,!c):((!s[l]||!we.isObject(s[l]))&&(s[l]=[]),e(n,r,s[l],i)&&we.isArray(s[l])&&(s[l]=BF(s[l])),!c)}if(we.isFormData(t)&&we.isFunction(t.entries)){const n={};return we.forEachEntry(t,(r,s)=>{e(PF(r),s,n,0)}),n}return null}function LF(t,e,n){if(we.isString(t))try{return(e||JSON.parse)(t),we.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const e0={transitional:K9,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=we.isObject(e);if(i&&we.isHTMLForm(e)&&(e=new FormData(e)),we.isFormData(e))return s?JSON.stringify(Z9(e)):e;if(we.isArrayBuffer(e)||we.isBuffer(e)||we.isStream(e)||we.isFile(e)||we.isBlob(e)||we.isReadableStream(e))return e;if(we.isArrayBufferView(e))return e.buffer;if(we.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return zF(e,this.formSerializer).toString();if((c=we.isFileList(e))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return dx(c?{"files[]":e}:e,d&&new d,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),LF(e)):e}],transformResponse:[function(e){const n=this.transitional||e0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(we.isResponse(e)||we.isReadableStream(e))return e;if(e&&we.isString(e)&&(r&&!this.responseType||s)){const l=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(l)throw c.name==="SyntaxError"?St.from(c,St.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ts.classes.FormData,Blob:ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};we.forEach(["delete","get","head","post","put","patch"],t=>{e0.headers[t]={}});const IF=we.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"]),qF=t=>{const e={};let n,r,s;return t&&t.split(` `).forEach(function(l){s=l.indexOf(":"),n=l.substring(0,s).trim().toLowerCase(),r=l.substring(s+1).trim(),!(!n||e[n]&&IF[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},SO=Symbol("internals");function Ah(t){return t&&String(t).trim().toLowerCase()}function Hp(t){return t===!1||t==null?t:we.isArray(t)?t.map(Hp):String(t)}function FF(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 QF=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function vy(t,e,n,r,s){if(we.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!we.isString(e)){if(we.isString(r))return e.indexOf(r)!==-1;if(we.isRegExp(r))return r.test(e)}}function $F(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function HF(t,e){const n=we.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,l){return this[r].call(this,e,s,i,l)},configurable:!0})})}let zs=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(c,d,h){const m=Ah(d);if(!m)throw new Error("header name must be a non-empty string");const p=we.findKey(s,m);(!p||s[p]===void 0||h===!0||h===void 0&&s[p]!==!1)&&(s[p||d]=Hp(c))}const l=(c,d)=>we.forEach(c,(h,m)=>i(h,m,d));if(we.isPlainObject(e)||e instanceof this.constructor)l(e,n);else if(we.isString(e)&&(e=e.trim())&&!QF(e))l(qF(e),n);else if(we.isObject(e)&&we.isIterable(e)){let c={},d,h;for(const m of e){if(!we.isArray(m))throw TypeError("Object iterator must return a key-value pair");c[h=m[0]]=(d=c[h])?we.isArray(d)?[...d,m[1]]:[d,m[1]]:m[1]}l(c,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Ah(e),e){const r=we.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return FF(s);if(we.isFunction(n))return n.call(this,s,r);if(we.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ah(e),e){const r=we.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||vy(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(l){if(l=Ah(l),l){const c=we.findKey(r,l);c&&(!n||vy(r,r[c],c,n))&&(delete r[c],s=!0)}}return we.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||vy(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return we.forEach(this,(s,i)=>{const l=we.findKey(r,i);if(l){n[l]=Hp(s),delete n[i];return}const c=e?$F(i):String(i).trim();c!==i&&delete n[i],n[c]=Hp(s),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return we.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&we.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[SO]=this[SO]={accessors:{}}).accessors,s=this.prototype;function i(l){const c=Ah(l);r[c]||(HF(s,l),r[c]=!0)}return we.isArray(e)?e.forEach(i):i(e),this}};zs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);we.reduceDescriptors(zs.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});we.freezeMethods(zs);function yy(t,e){const n=this||e0,r=e||n,s=zs.from(r.headers);let i=r.data;return we.forEach(t,function(c){i=c.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function J9(t){return!!(t&&t.__CANCEL__)}function kd(t,e,n){St.call(this,t??"canceled",St.ERR_CANCELED,e,n),this.name="CanceledError"}we.inherits(kd,St,{__CANCEL__:!0});function eC(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new St("Request failed with status code "+n.status,[St.ERR_BAD_REQUEST,St.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function UF(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function VF(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,l;return e=e!==void 0?e:1e3,function(d){const h=Date.now(),m=r[i];l||(l=h),n[s]=d,r[s]=h;let p=i,x=0;for(;p!==s;)x+=n[p++],p=p%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-l{n=m,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const m=Date.now(),p=m-n;p>=r?l(h,m):(s=h,i||(i=setTimeout(()=>{i=null,l(s)},r-p)))},()=>s&&l(s)]}const gg=(t,e,n=3)=>{let r=0;const s=VF(50,250);return WF(i=>{const l=i.loaded,c=i.lengthComputable?i.total:void 0,d=l-r,h=s(d),m=l<=c;r=l;const p={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:h||void 0,estimated:h&&c&&m?(c-l)/h:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(p)},n)},kO=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},OO=t=>(...e)=>we.asap(()=>t(...e)),GF=ts.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ts.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ts.origin),ts.navigator&&/(msie|trident)/i.test(ts.navigator.userAgent)):()=>!0,XF=ts.hasStandardBrowserEnv?{write(t,e,n,r,s,i,l){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];we.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),we.isString(r)&&c.push(`path=${r}`),we.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),we.isString(l)&&c.push(`SameSite=${l}`),document.cookie=c.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 YF(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function KF(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function tC(t,e,n){let r=!YF(e);return t&&(r||n==!1)?KF(t,e):e}const jO=t=>t instanceof zs?{...t}:t;function vc(t,e){e=e||{};const n={};function r(h,m,p,x){return we.isPlainObject(h)&&we.isPlainObject(m)?we.merge.call({caseless:x},h,m):we.isPlainObject(m)?we.merge({},m):we.isArray(m)?m.slice():m}function s(h,m,p,x){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h,p,x)}else return r(h,m,p,x)}function i(h,m){if(!we.isUndefined(m))return r(void 0,m)}function l(h,m){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h)}else return r(void 0,m)}function c(h,m,p){if(p in e)return r(h,m);if(p in t)return r(void 0,h)}const d={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:c,headers:(h,m,p)=>s(jO(h),jO(m),p,!0)};return we.forEach(Object.keys({...t,...e}),function(m){const p=d[m]||s,x=p(t[m],e[m],m);we.isUndefined(x)&&p!==c||(n[m]=x)}),n}const nC=t=>{const e=vc({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:l,auth:c}=e;if(e.headers=l=zs.from(l),e.url=Y9(tC(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&l.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),we.isFormData(n)){if(ts.hasStandardBrowserEnv||ts.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(we.isFunction(n.getHeaders)){const d=n.getHeaders(),h=["content-type","content-length"];Object.entries(d).forEach(([m,p])=>{h.includes(m.toLowerCase())&&l.set(m,p)})}}if(ts.hasStandardBrowserEnv&&(r&&we.isFunction(r)&&(r=r(e)),r||r!==!1&&GF(e.url))){const d=s&&i&&XF.read(i);d&&l.set(s,d)}return e},ZF=typeof XMLHttpRequest<"u",JF=ZF&&function(t){return new Promise(function(n,r){const s=nC(t);let i=s.data;const l=zs.from(s.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:h}=s,m,p,x,v,b;function k(){v&&v(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(m),s.signal&&s.signal.removeEventListener("abort",m)}let O=new XMLHttpRequest;O.open(s.method.toUpperCase(),s.url,!0),O.timeout=s.timeout;function j(){if(!O)return;const A=zs.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),D={data:!c||c==="text"||c==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:A,config:t,request:O};eC(function(R){n(R),k()},function(R){r(R),k()},D),O=null}"onloadend"in O?O.onloadend=j:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout(j)},O.onabort=function(){O&&(r(new St("Request aborted",St.ECONNABORTED,t,O)),O=null)},O.onerror=function(_){const D=_&&_.message?_.message:"Network Error",E=new St(D,St.ERR_NETWORK,t,O);E.event=_||null,r(E),O=null},O.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const D=s.transitional||K9;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new St(_,D.clarifyTimeoutError?St.ETIMEDOUT:St.ECONNABORTED,t,O)),O=null},i===void 0&&l.setContentType(null),"setRequestHeader"in O&&we.forEach(l.toJSON(),function(_,D){O.setRequestHeader(D,_)}),we.isUndefined(s.withCredentials)||(O.withCredentials=!!s.withCredentials),c&&c!=="json"&&(O.responseType=s.responseType),h&&([x,b]=gg(h,!0),O.addEventListener("progress",x)),d&&O.upload&&([p,v]=gg(d),O.upload.addEventListener("progress",p),O.upload.addEventListener("loadend",v)),(s.cancelToken||s.signal)&&(m=A=>{O&&(r(!A||A.type?new kd(null,t,O):A),O.abort(),O=null)},s.cancelToken&&s.cancelToken.subscribe(m),s.signal&&(s.signal.aborted?m():s.signal.addEventListener("abort",m)));const T=UF(s.url);if(T&&ts.protocols.indexOf(T)===-1){r(new St("Unsupported protocol "+T+":",St.ERR_BAD_REQUEST,t));return}O.send(i||null)})},eQ=(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,c();const m=h instanceof Error?h:this.reason;r.abort(m instanceof St?m:new kd(m instanceof Error?m.message:m))}};let l=e&&setTimeout(()=>{l=null,i(new St(`timeout ${e} of ms exceeded`,St.ETIMEDOUT))},e);const c=()=>{t&&(l&&clearTimeout(l),l=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:d}=r;return d.unsubscribe=()=>we.asap(c),d}},tQ=function*(t,e){let n=t.byteLength;if(n{const s=nQ(t,e);let i=0,l,c=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:h,value:m}=await s.next();if(h){c(),d.close();return}let p=m.byteLength;if(n){let x=i+=p;n(x)}d.enqueue(new Uint8Array(m))}catch(h){throw c(h),h}},cancel(d){return c(d),s.return()}},{highWaterMark:2})},CO=64*1024,{isFunction:Xm}=we,sQ=(({Request:t,Response:e})=>({Request:t,Response:e}))(we.global),{ReadableStream:TO,TextEncoder:AO}=we.global,MO=(t,...e)=>{try{return!!t(...e)}catch{return!1}},iQ=t=>{t=we.merge.call({skipUndefined:!0},sQ,t);const{fetch:e,Request:n,Response:r}=t,s=e?Xm(e):typeof fetch=="function",i=Xm(n),l=Xm(r);if(!s)return!1;const c=s&&Xm(TO),d=s&&(typeof AO=="function"?(b=>k=>b.encode(k))(new AO):async b=>new Uint8Array(await new n(b).arrayBuffer())),h=i&&c&&MO(()=>{let b=!1;const k=new n(ts.origin,{body:new TO,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!k}),m=l&&c&&MO(()=>we.isReadableStream(new r("").body)),p={stream:m&&(b=>b.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!p[b]&&(p[b]=(k,O)=>{let j=k&&k[b];if(j)return j.call(k);throw new St(`Response type '${b}' is not supported`,St.ERR_NOT_SUPPORT,O)})});const x=async b=>{if(b==null)return 0;if(we.isBlob(b))return b.size;if(we.isSpecCompliantForm(b))return(await new n(ts.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(we.isArrayBufferView(b)||we.isArrayBuffer(b))return b.byteLength;if(we.isURLSearchParams(b)&&(b=b+""),we.isString(b))return(await d(b)).byteLength},v=async(b,k)=>{const O=we.toFiniteNumber(b.getContentLength());return O??x(k)};return async b=>{let{url:k,method:O,data:j,signal:T,cancelToken:A,timeout:_,onDownloadProgress:D,onUploadProgress:E,responseType:R,headers:Q,withCredentials:F="same-origin",fetchOptions:L}=nC(b),U=e||fetch;R=R?(R+"").toLowerCase():"text";let V=eQ([T,A&&A.toAbortSignal()],_),de=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let J;try{if(E&&h&&O!=="get"&&O!=="head"&&(J=await v(Q,j))!==0){let xe=new n(k,{method:"POST",body:j,duplex:"half"}),Y;if(we.isFormData(j)&&(Y=xe.headers.get("content-type"))&&Q.setContentType(Y),xe.body){const[P,K]=kO(J,gg(OO(E)));j=NO(xe.body,CO,P,K)}}we.isString(F)||(F=F?"include":"omit");const $=i&&"credentials"in n.prototype,ae={...L,signal:V,method:O.toUpperCase(),headers:Q.normalize().toJSON(),body:j,duplex:"half",credentials:$?F:void 0};de=i&&new n(k,ae);let ne=await(i?U(de,L):U(k,ae));const ce=m&&(R==="stream"||R==="response");if(m&&(D||ce&&W)){const xe={};["status","statusText","headers"].forEach(H=>{xe[H]=ne[H]});const Y=we.toFiniteNumber(ne.headers.get("content-length")),[P,K]=D&&kO(Y,gg(OO(D),!0))||[];ne=new r(NO(ne.body,CO,P,()=>{K&&K(),W&&W()}),xe)}R=R||"text";let z=await p[we.findKey(p,R)||"text"](ne,b);return!ce&&W&&W(),await new Promise((xe,Y)=>{eC(xe,Y,{data:z,headers:zs.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:de})})}catch($){throw W&&W(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new St("Network Error",St.ERR_NETWORK,b,de),{cause:$.cause||$}):St.from($,$&&$.code,b,de)}}},aQ=new Map,rC=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let l=i.length,c=l,d,h,m=aQ;for(;c--;)d=i[c],h=m.get(d),h===void 0&&m.set(d,h=c?new Map:iQ(e)),m=h;return h};rC();const nw={http:kF,xhr:JF,fetch:{get:rC}};we.forEach(nw,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const EO=t=>`- ${t}`,lQ=t=>we.isFunction(t)||t===null||t===!1;function oQ(t,e){t=we.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let l=0;l`adapter ${d} `+(h===!1?"is not supported by the environment":"is not available in the build"));let c=n?l.length>1?`since : +`)}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[SO]=this[SO]={accessors:{}}).accessors,s=this.prototype;function i(l){const c=Ah(l);r[c]||(HF(s,l),r[c]=!0)}return we.isArray(e)?e.forEach(i):i(e),this}};zs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);we.reduceDescriptors(zs.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});we.freezeMethods(zs);function yy(t,e){const n=this||e0,r=e||n,s=zs.from(r.headers);let i=r.data;return we.forEach(t,function(c){i=c.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function J9(t){return!!(t&&t.__CANCEL__)}function kd(t,e,n){St.call(this,t??"canceled",St.ERR_CANCELED,e,n),this.name="CanceledError"}we.inherits(kd,St,{__CANCEL__:!0});function eC(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new St("Request failed with status code "+n.status,[St.ERR_BAD_REQUEST,St.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function UF(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function VF(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,l;return e=e!==void 0?e:1e3,function(d){const h=Date.now(),m=r[i];l||(l=h),n[s]=d,r[s]=h;let p=i,x=0;for(;p!==s;)x+=n[p++],p=p%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-l{n=m,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const m=Date.now(),p=m-n;p>=r?l(h,m):(s=h,i||(i=setTimeout(()=>{i=null,l(s)},r-p)))},()=>s&&l(s)]}const gg=(t,e,n=3)=>{let r=0;const s=VF(50,250);return WF(i=>{const l=i.loaded,c=i.lengthComputable?i.total:void 0,d=l-r,h=s(d),m=l<=c;r=l;const p={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:h||void 0,estimated:h&&c&&m?(c-l)/h:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(p)},n)},kO=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},OO=t=>(...e)=>we.asap(()=>t(...e)),GF=ts.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ts.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ts.origin),ts.navigator&&/(msie|trident)/i.test(ts.navigator.userAgent)):()=>!0,XF=ts.hasStandardBrowserEnv?{write(t,e,n,r,s,i,l){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];we.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),we.isString(r)&&c.push(`path=${r}`),we.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),we.isString(l)&&c.push(`SameSite=${l}`),document.cookie=c.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 YF(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function KF(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function tC(t,e,n){let r=!YF(e);return t&&(r||n==!1)?KF(t,e):e}const jO=t=>t instanceof zs?{...t}:t;function vc(t,e){e=e||{};const n={};function r(h,m,p,x){return we.isPlainObject(h)&&we.isPlainObject(m)?we.merge.call({caseless:x},h,m):we.isPlainObject(m)?we.merge({},m):we.isArray(m)?m.slice():m}function s(h,m,p,x){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h,p,x)}else return r(h,m,p,x)}function i(h,m){if(!we.isUndefined(m))return r(void 0,m)}function l(h,m){if(we.isUndefined(m)){if(!we.isUndefined(h))return r(void 0,h)}else return r(void 0,m)}function c(h,m,p){if(p in e)return r(h,m);if(p in t)return r(void 0,h)}const d={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:c,headers:(h,m,p)=>s(jO(h),jO(m),p,!0)};return we.forEach(Object.keys({...t,...e}),function(m){const p=d[m]||s,x=p(t[m],e[m],m);we.isUndefined(x)&&p!==c||(n[m]=x)}),n}const nC=t=>{const e=vc({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:l,auth:c}=e;if(e.headers=l=zs.from(l),e.url=Y9(tC(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&l.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),we.isFormData(n)){if(ts.hasStandardBrowserEnv||ts.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(we.isFunction(n.getHeaders)){const d=n.getHeaders(),h=["content-type","content-length"];Object.entries(d).forEach(([m,p])=>{h.includes(m.toLowerCase())&&l.set(m,p)})}}if(ts.hasStandardBrowserEnv&&(r&&we.isFunction(r)&&(r=r(e)),r||r!==!1&&GF(e.url))){const d=s&&i&&XF.read(i);d&&l.set(s,d)}return e},ZF=typeof XMLHttpRequest<"u",JF=ZF&&function(t){return new Promise(function(n,r){const s=nC(t);let i=s.data;const l=zs.from(s.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:h}=s,m,p,x,v,b;function k(){v&&v(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(m),s.signal&&s.signal.removeEventListener("abort",m)}let O=new XMLHttpRequest;O.open(s.method.toUpperCase(),s.url,!0),O.timeout=s.timeout;function j(){if(!O)return;const A=zs.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),D={data:!c||c==="text"||c==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:A,config:t,request:O};eC(function(z){n(z),k()},function(z){r(z),k()},D),O=null}"onloadend"in O?O.onloadend=j:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout(j)},O.onabort=function(){O&&(r(new St("Request aborted",St.ECONNABORTED,t,O)),O=null)},O.onerror=function(_){const D=_&&_.message?_.message:"Network Error",E=new St(D,St.ERR_NETWORK,t,O);E.event=_||null,r(E),O=null},O.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const D=s.transitional||K9;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new St(_,D.clarifyTimeoutError?St.ETIMEDOUT:St.ECONNABORTED,t,O)),O=null},i===void 0&&l.setContentType(null),"setRequestHeader"in O&&we.forEach(l.toJSON(),function(_,D){O.setRequestHeader(D,_)}),we.isUndefined(s.withCredentials)||(O.withCredentials=!!s.withCredentials),c&&c!=="json"&&(O.responseType=s.responseType),h&&([x,b]=gg(h,!0),O.addEventListener("progress",x)),d&&O.upload&&([p,v]=gg(d),O.upload.addEventListener("progress",p),O.upload.addEventListener("loadend",v)),(s.cancelToken||s.signal)&&(m=A=>{O&&(r(!A||A.type?new kd(null,t,O):A),O.abort(),O=null)},s.cancelToken&&s.cancelToken.subscribe(m),s.signal&&(s.signal.aborted?m():s.signal.addEventListener("abort",m)));const T=UF(s.url);if(T&&ts.protocols.indexOf(T)===-1){r(new St("Unsupported protocol "+T+":",St.ERR_BAD_REQUEST,t));return}O.send(i||null)})},eQ=(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,c();const m=h instanceof Error?h:this.reason;r.abort(m instanceof St?m:new kd(m instanceof Error?m.message:m))}};let l=e&&setTimeout(()=>{l=null,i(new St(`timeout ${e} of ms exceeded`,St.ETIMEDOUT))},e);const c=()=>{t&&(l&&clearTimeout(l),l=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:d}=r;return d.unsubscribe=()=>we.asap(c),d}},tQ=function*(t,e){let n=t.byteLength;if(n{const s=nQ(t,e);let i=0,l,c=d=>{l||(l=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:h,value:m}=await s.next();if(h){c(),d.close();return}let p=m.byteLength;if(n){let x=i+=p;n(x)}d.enqueue(new Uint8Array(m))}catch(h){throw c(h),h}},cancel(d){return c(d),s.return()}},{highWaterMark:2})},CO=64*1024,{isFunction:Xm}=we,sQ=(({Request:t,Response:e})=>({Request:t,Response:e}))(we.global),{ReadableStream:TO,TextEncoder:AO}=we.global,MO=(t,...e)=>{try{return!!t(...e)}catch{return!1}},iQ=t=>{t=we.merge.call({skipUndefined:!0},sQ,t);const{fetch:e,Request:n,Response:r}=t,s=e?Xm(e):typeof fetch=="function",i=Xm(n),l=Xm(r);if(!s)return!1;const c=s&&Xm(TO),d=s&&(typeof AO=="function"?(b=>k=>b.encode(k))(new AO):async b=>new Uint8Array(await new n(b).arrayBuffer())),h=i&&c&&MO(()=>{let b=!1;const k=new n(ts.origin,{body:new TO,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!k}),m=l&&c&&MO(()=>we.isReadableStream(new r("").body)),p={stream:m&&(b=>b.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!p[b]&&(p[b]=(k,O)=>{let j=k&&k[b];if(j)return j.call(k);throw new St(`Response type '${b}' is not supported`,St.ERR_NOT_SUPPORT,O)})});const x=async b=>{if(b==null)return 0;if(we.isBlob(b))return b.size;if(we.isSpecCompliantForm(b))return(await new n(ts.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(we.isArrayBufferView(b)||we.isArrayBuffer(b))return b.byteLength;if(we.isURLSearchParams(b)&&(b=b+""),we.isString(b))return(await d(b)).byteLength},v=async(b,k)=>{const O=we.toFiniteNumber(b.getContentLength());return O??x(k)};return async b=>{let{url:k,method:O,data:j,signal:T,cancelToken:A,timeout:_,onDownloadProgress:D,onUploadProgress:E,responseType:z,headers:Q,withCredentials:F="same-origin",fetchOptions:L}=nC(b),U=e||fetch;z=z?(z+"").toLowerCase():"text";let V=eQ([T,A&&A.toAbortSignal()],_),ce=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let J;try{if(E&&h&&O!=="get"&&O!=="head"&&(J=await v(Q,j))!==0){let me=new n(k,{method:"POST",body:j,duplex:"half"}),Y;if(we.isFormData(j)&&(Y=me.headers.get("content-type"))&&Q.setContentType(Y),me.body){const[P,K]=kO(J,gg(OO(E)));j=NO(me.body,CO,P,K)}}we.isString(F)||(F=F?"include":"omit");const $=i&&"credentials"in n.prototype,ae={...L,signal:V,method:O.toUpperCase(),headers:Q.normalize().toJSON(),body:j,duplex:"half",credentials:$?F:void 0};ce=i&&new n(k,ae);let ne=await(i?U(ce,L):U(k,ae));const ue=m&&(z==="stream"||z==="response");if(m&&(D||ue&&W)){const me={};["status","statusText","headers"].forEach(H=>{me[H]=ne[H]});const Y=we.toFiniteNumber(ne.headers.get("content-length")),[P,K]=D&&kO(Y,gg(OO(D),!0))||[];ne=new r(NO(ne.body,CO,P,()=>{K&&K(),W&&W()}),me)}z=z||"text";let R=await p[we.findKey(p,z)||"text"](ne,b);return!ue&&W&&W(),await new Promise((me,Y)=>{eC(me,Y,{data:R,headers:zs.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:ce})})}catch($){throw W&&W(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new St("Network Error",St.ERR_NETWORK,b,ce),{cause:$.cause||$}):St.from($,$&&$.code,b,ce)}}},aQ=new Map,rC=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let l=i.length,c=l,d,h,m=aQ;for(;c--;)d=i[c],h=m.get(d),h===void 0&&m.set(d,h=c?new Map:iQ(e)),m=h;return h};rC();const nw={http:kF,xhr:JF,fetch:{get:rC}};we.forEach(nw,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const EO=t=>`- ${t}`,lQ=t=>we.isFunction(t)||t===null||t===!1;function oQ(t,e){t=we.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let l=0;l`adapter ${d} `+(h===!1?"is not supported by the environment":"is not available in the build"));let c=n?l.length>1?`since : `+l.map(EO).join(` `):" "+EO(l[0]):"as no adapter specified";throw new St("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const sC={getAdapter:oQ,adapters:nw};function by(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new kd(null,t)}function _O(t){return by(t),t.headers=zs.from(t.headers),t.data=yy.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),sC.getAdapter(t.adapter||e0.adapter,t)(t).then(function(r){return by(t),r.data=yy.call(t,t.transformResponse,r),r.headers=zs.from(r.headers),r},function(r){return J9(r)||(by(t),r&&r.response&&(r.response.data=yy.call(t,t.transformResponse,r.response),r.response.headers=zs.from(r.response.headers))),Promise.reject(r)})}const iC="1.13.2",hx={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{hx[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const DO={};hx.transitional=function(e,n,r){function s(i,l){return"[Axios v"+iC+"] Transitional option '"+i+"'"+l+(r?". "+r:"")}return(i,l,c)=>{if(e===!1)throw new St(s(l," has been removed"+(n?" in "+n:"")),St.ERR_DEPRECATED);return n&&!DO[l]&&(DO[l]=!0,console.warn(s(l," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,l,c):!0}};hx.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function cQ(t,e,n){if(typeof t!="object")throw new St("options must be an object",St.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],l=e[i];if(l){const c=t[i],d=c===void 0||l(c,i,t);if(d!==!0)throw new St("option "+i+" must be "+d,St.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new St("Unknown option "+i,St.ERR_BAD_OPTION)}}const Up={assertOptions:cQ,validators:hx},ea=Up.validators;let mc=class{constructor(e){this.defaults=e||{},this.interceptors={request:new wO,response:new wO}}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=vc(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Up.assertOptions(r,{silentJSONParsing:ea.transitional(ea.boolean),forcedJSONParsing:ea.transitional(ea.boolean),clarifyTimeoutError:ea.transitional(ea.boolean)},!1),s!=null&&(we.isFunction(s)?n.paramsSerializer={serialize:s}:Up.assertOptions(s,{encode:ea.function,serialize:ea.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Up.assertOptions(n,{baseUrl:ea.spelling("baseURL"),withXsrfToken:ea.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&we.merge(i.common,i[n.method]);i&&we.forEach(["delete","get","head","post","put","patch","common"],b=>{delete i[b]}),n.headers=zs.concat(l,i);const c=[];let d=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(d=d&&k.synchronous,c.unshift(k.fulfilled,k.rejected))});const h=[];this.interceptors.response.forEach(function(k){h.push(k.fulfilled,k.rejected)});let m,p=0,x;if(!d){const b=[_O.bind(this),void 0];for(b.unshift(...c),b.push(...h),x=b.length,m=Promise.resolve(n);p{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 l=new Promise(c=>{r.subscribe(c),i=c}).then(s);return l.cancel=function(){r.unsubscribe(i)},l},e(function(i,l,c){r.reason||(r.reason=new kd(i,l,c),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 aC(function(s){e=s}),cancel:e}}};function dQ(t){return function(n){return t.apply(null,n)}}function hQ(t){return we.isObject(t)&&t.isAxiosError===!0}const i2={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(i2).forEach(([t,e])=>{i2[e]=t});function lC(t){const e=new mc(t),n=L9(mc.prototype.request,e);return we.extend(n,mc.prototype,e,{allOwnKeys:!0}),we.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return lC(vc(t,s))},n}const Zn=lC(e0);Zn.Axios=mc;Zn.CanceledError=kd;Zn.CancelToken=uQ;Zn.isCancel=J9;Zn.VERSION=iC;Zn.toFormData=dx;Zn.AxiosError=St;Zn.Cancel=Zn.CanceledError;Zn.all=function(e){return Promise.all(e)};Zn.spread=dQ;Zn.isAxiosError=hQ;Zn.mergeConfig=vc;Zn.AxiosHeaders=zs;Zn.formToJSON=t=>Z9(we.isHTMLForm(t)?new FormData(t):t);Zn.getAdapter=sC.getAdapter;Zn.HttpStatusCode=i2;Zn.default=Zn;const{Axios:Nxe,AxiosError:Cxe,CanceledError:Txe,isCancel:Axe,CancelToken:Mxe,VERSION:Exe,all:_xe,Cancel:Dxe,isAxiosError:Rxe,spread:zxe,toFormData:Pxe,AxiosHeaders:Bxe,HttpStatusCode:Lxe,formToJSON:Ixe,getAdapter:qxe,mergeConfig:Fxe}=Zn,fQ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),oC=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xg="-",RO=[],pQ="arbitrary..",gQ=t=>{const e=vQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return xQ(l);const c=l.split(xg),d=c[0]===""&&c.length>1?1:0;return cC(c,d,e)},getConflictingClassGroupIds:(l,c)=>{if(c){const d=r[l],h=n[l];return d?h?fQ(h,d):d:h||RO}return n[l]||RO}}},cC=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=cC(t,e+1,i);if(h)return h}const l=n.validators;if(l===null)return;const c=e===0?t.join(xg):t.slice(e).join(xg),d=l.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?pQ+r:void 0})(),vQ=t=>{const{theme:e,classGroups:n}=t;return yQ(n,e)},yQ=(t,e)=>{const n=oC();for(const r in t){const s=t[r];rw(s,n,r,e)}return n},rw=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){wQ(t,e,n);return}if(typeof t=="function"){SQ(t,e,n,r);return}kQ(t,e,n,r)},wQ=(t,e,n)=>{const r=t===""?e:uC(e,t);r.classGroupId=n},SQ=(t,e,n,r)=>{if(OQ(t)){rw(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(mQ(n,t))},kQ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let l=0;l{let n=t;const r=e.split(xg),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,jQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,l)=>{n[i]=l,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let l=n[i];if(l!==void 0)return l;if((l=r[i])!==void 0)return s(i,l),l},set(i,l){i in n?n[i]=l:s(i,l)}}},a2="!",zO=":",NQ=[],PO=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),CQ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let l=0,c=0,d=0,h;const m=s.length;for(let k=0;kd?h-d:void 0;return PO(i,v,x,b)};if(e){const s=e+zO,i=r;r=l=>l.startsWith(s)?i(l.slice(s.length)):PO(NQ,!1,l,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},TQ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},AQ=t=>({cache:jQ(t.cacheSize),parseClassName:CQ(t),sortModifiers:TQ(t),...gQ(t)}),MQ=/\s+/,EQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,l=[],c=t.trim().split(MQ);let d="";for(let h=c.length-1;h>=0;h-=1){const m=c[h],{isExternal:p,modifiers:x,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:k}=n(m);if(p){d=m+(d.length>0?" "+d:d);continue}let O=!!k,j=r(O?b.substring(0,k):b);if(!j){if(!O){d=m+(d.length>0?" "+d:d);continue}if(j=r(b),!j){d=m+(d.length>0?" "+d:d);continue}O=!1}const T=x.length===0?"":x.length===1?x[0]:i(x).join(":"),A=v?T+a2:T,_=A+j;if(l.indexOf(_)>-1)continue;l.push(_);const D=s(j,O);for(let E=0;E0?" "+d:d)}return d},_Q=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const l=d=>{const h=e.reduce((m,p)=>p(m),t());return n=AQ(h),r=n.cache.get,s=n.cache.set,i=c,c(d)},c=d=>{const h=r(d);if(h)return h;const m=EQ(d,n);return s(d,m),m};return i=l,(...d)=>i(_Q(...d))},RQ=[],wr=t=>{const e=n=>n[t]||RQ;return e.isThemeGetter=!0,e},hC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zQ=/^\d+\/\d+$/,PQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,BQ=/\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$/,LQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ju=t=>zQ.test(t),Mt=t=>!!t&&!Number.isNaN(Number(t)),Gl=t=>!!t&&Number.isInteger(Number(t)),wy=t=>t.endsWith("%")&&Mt(t.slice(0,-1)),Xa=t=>PQ.test(t),FQ=()=>!0,QQ=t=>BQ.test(t)&&!LQ.test(t),mC=()=>!1,$Q=t=>IQ.test(t),HQ=t=>qQ.test(t),UQ=t=>!Xe(t)&&!Ye(t),VQ=t=>Od(t,xC,mC),Xe=t=>hC.test(t),Ko=t=>Od(t,vC,QQ),Sy=t=>Od(t,KQ,Mt),BO=t=>Od(t,pC,mC),WQ=t=>Od(t,gC,HQ),Ym=t=>Od(t,yC,$Q),Ye=t=>fC.test(t),Mh=t=>jd(t,vC),GQ=t=>jd(t,ZQ),LO=t=>jd(t,pC),XQ=t=>jd(t,xC),YQ=t=>jd(t,gC),Km=t=>jd(t,yC,!0),Od=(t,e,n)=>{const r=hC.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},jd=(t,e,n=!1)=>{const r=fC.exec(t);return r?r[1]?e(r[1]):n:!1},pC=t=>t==="position"||t==="percentage",gC=t=>t==="image"||t==="url",xC=t=>t==="length"||t==="size"||t==="bg-size",vC=t=>t==="length",KQ=t=>t==="number",ZQ=t=>t==="family-name",yC=t=>t==="shadow",JQ=()=>{const t=wr("color"),e=wr("font"),n=wr("text"),r=wr("font-weight"),s=wr("tracking"),i=wr("leading"),l=wr("breakpoint"),c=wr("container"),d=wr("spacing"),h=wr("radius"),m=wr("shadow"),p=wr("inset-shadow"),x=wr("text-shadow"),v=wr("drop-shadow"),b=wr("blur"),k=wr("perspective"),O=wr("aspect"),j=wr("ease"),T=wr("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[..._(),Ye,Xe],E=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],Q=()=>[Ye,Xe,d],F=()=>[ju,"full","auto",...Q()],L=()=>[Gl,"none","subgrid",Ye,Xe],U=()=>["auto",{span:["full",Gl,Ye,Xe]},Gl,Ye,Xe],V=()=>[Gl,"auto",Ye,Xe],de=()=>["auto","min","max","fr",Ye,Xe],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...Q()],ae=()=>[ju,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],ne=()=>[t,Ye,Xe],ce=()=>[..._(),LO,BO,{position:[Ye,Xe]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],xe=()=>["auto","cover","contain",XQ,VQ,{size:[Ye,Xe]}],Y=()=>[wy,Mh,Ko],P=()=>["","none","full",h,Ye,Xe],K=()=>["",Mt,Mh,Ko],H=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>[Mt,wy,LO,BO],Re=()=>["","none",b,Ye,Xe],ue=()=>["none",Mt,Ye,Xe],We=()=>["none",Mt,Ye,Xe],ct=()=>[Mt,Ye,Xe],Oe=()=>[ju,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xa],breakpoint:[Xa],color:[FQ],container:[Xa],"drop-shadow":[Xa],ease:["in","out","in-out"],font:[UQ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xa],shadow:[Xa],spacing:["px",Mt],text:[Xa],"text-shadow":[Xa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ju,Xe,Ye,O]}],container:["container"],columns:[{columns:[Mt,Xe,Ye,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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:D()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{start:F()}],end:[{end:F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[Gl,"auto",Ye,Xe]}],basis:[{basis:[ju,"full","auto",c,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Mt,ju,"auto","initial","none",Xe]}],grow:[{grow:["",Mt,Ye,Xe]}],shrink:[{shrink:["",Mt,Ye,Xe]}],order:[{order:[Gl,"first","last","none",Ye,Xe]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:U()}],"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":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],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:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],w:[{w:[c,"screen",...ae()]}],"min-w":[{"min-w":[c,"screen","none",...ae()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Mh,Ko]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,Sy]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",wy,Xe]}],"font-family":[{font:[GQ,Xe,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,Ye,Xe]}],"line-clamp":[{"line-clamp":[Mt,"none",Ye,Sy]}],leading:[{leading:[i,...Q()]}],"list-image":[{"list-image":["none",Ye,Xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ne()}],"text-color":[{text:ne()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:[Mt,"from-font","auto",Ye,Ko]}],"text-decoration-color":[{decoration:ne()}],"underline-offset":[{"underline-offset":[Mt,"auto",Ye,Xe]}],"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",Ye,Xe]}],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",Ye,Xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ce()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:xe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gl,Ye,Xe],radial:["",Ye,Xe],conic:[Gl,Ye,Xe]},YQ,WQ]}],"bg-color":[{bg:ne()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:ne()}],"gradient-via":[{via:ne()}],"gradient-to":[{to:ne()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...H(),"hidden","none"]}],"divide-style":[{divide:[...H(),"hidden","none"]}],"border-color":[{border:ne()}],"border-color-x":[{"border-x":ne()}],"border-color-y":[{"border-y":ne()}],"border-color-s":[{"border-s":ne()}],"border-color-e":[{"border-e":ne()}],"border-color-t":[{"border-t":ne()}],"border-color-r":[{"border-r":ne()}],"border-color-b":[{"border-b":ne()}],"border-color-l":[{"border-l":ne()}],"divide-color":[{divide:ne()}],"outline-style":[{outline:[...H(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Mt,Ye,Xe]}],"outline-w":[{outline:["",Mt,Mh,Ko]}],"outline-color":[{outline:ne()}],shadow:[{shadow:["","none",m,Km,Ym]}],"shadow-color":[{shadow:ne()}],"inset-shadow":[{"inset-shadow":["none",p,Km,Ym]}],"inset-shadow-color":[{"inset-shadow":ne()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ne()}],"ring-offset-w":[{"ring-offset":[Mt,Ko]}],"ring-offset-color":[{"ring-offset":ne()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":ne()}],"text-shadow":[{"text-shadow":["none",x,Km,Ym]}],"text-shadow-color":[{"text-shadow":ne()}],opacity:[{opacity:[Mt,Ye,Xe]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"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":[Mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":ne()}],"mask-image-linear-to-color":[{"mask-linear-to":ne()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":ne()}],"mask-image-t-to-color":[{"mask-t-to":ne()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":ne()}],"mask-image-r-to-color":[{"mask-r-to":ne()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":ne()}],"mask-image-b-to-color":[{"mask-b-to":ne()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":ne()}],"mask-image-l-to-color":[{"mask-l-to":ne()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":ne()}],"mask-image-x-to-color":[{"mask-x-to":ne()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":ne()}],"mask-image-y-to-color":[{"mask-y-to":ne()}],"mask-image-radial":[{"mask-radial":[Ye,Xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":ne()}],"mask-image-radial-to-color":[{"mask-radial-to":ne()}],"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":_()}],"mask-image-conic-pos":[{"mask-conic":[Mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":ne()}],"mask-image-conic-to-color":[{"mask-conic-to":ne()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:xe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ye,Xe]}],filter:[{filter:["","none",Ye,Xe]}],blur:[{blur:Re()}],brightness:[{brightness:[Mt,Ye,Xe]}],contrast:[{contrast:[Mt,Ye,Xe]}],"drop-shadow":[{"drop-shadow":["","none",v,Km,Ym]}],"drop-shadow-color":[{"drop-shadow":ne()}],grayscale:[{grayscale:["",Mt,Ye,Xe]}],"hue-rotate":[{"hue-rotate":[Mt,Ye,Xe]}],invert:[{invert:["",Mt,Ye,Xe]}],saturate:[{saturate:[Mt,Ye,Xe]}],sepia:[{sepia:["",Mt,Ye,Xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Xe]}],"backdrop-blur":[{"backdrop-blur":Re()}],"backdrop-brightness":[{"backdrop-brightness":[Mt,Ye,Xe]}],"backdrop-contrast":[{"backdrop-contrast":[Mt,Ye,Xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Mt,Ye,Xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Mt,Ye,Xe]}],"backdrop-invert":[{"backdrop-invert":["",Mt,Ye,Xe]}],"backdrop-opacity":[{"backdrop-opacity":[Mt,Ye,Xe]}],"backdrop-saturate":[{"backdrop-saturate":[Mt,Ye,Xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Mt,Ye,Xe]}],"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",Ye,Xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Mt,"initial",Ye,Xe]}],ease:[{ease:["linear","initial",j,Ye,Xe]}],delay:[{delay:[Mt,Ye,Xe]}],animate:[{animate:["none",T,Ye,Xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ye,Xe]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:We()}],"scale-x":[{"scale-x":We()}],"scale-y":[{"scale-y":We()}],"scale-z":[{"scale-z":We()}],"scale-3d":["scale-3d"],skew:[{skew:ct()}],"skew-x":[{"skew-x":ct()}],"skew-y":[{"skew-y":ct()}],transform:[{transform:[Ye,Xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:ne()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ne()}],"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",Ye,Xe]}],"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",Ye,Xe]}],fill:[{fill:["none",...ne()]}],"stroke-w":[{stroke:[Mt,Mh,Ko,Sy]}],stroke:[{stroke:["none",...ne()]}],"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"]}},e$=DQ(JQ);function ye(...t){return e$(d9(t))}const gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));gt.displayName="Card";const Wt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));Wt.displayName="CardHeader";const Gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));Gt.displayName="CardTitle";const Sr=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Sr.displayName="CardDescription";const an=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));an.displayName="CardContent";const bC=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));bC.displayName="CardFooter";var ky="rovingFocusGroup.onEntryFocus",t$={bubbles:!1,cancelable:!0},t0="RovingFocusGroup",[l2,wC,n$]=tx(t0),[r$,fx]=Vi(t0,[n$]),[s$,i$]=r$(t0),SC=S.forwardRef((t,e)=>a.jsx(l2.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(l2.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(a$,{...t,ref:e})})}));SC.displayName=t0;var a$=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:h,preventScrollOnEntryFocus:m=!1,...p}=t,x=S.useRef(null),v=Cn(e,x),b=Vf(i),[k,O]=ko({prop:l,defaultProp:c??null,onChange:d,caller:t0}),[j,T]=S.useState(!1),A=es(h),_=wC(n),D=S.useRef(!1),[E,R]=S.useState(0);return S.useEffect(()=>{const Q=x.current;if(Q)return Q.addEventListener(ky,A),()=>Q.removeEventListener(ky,A)},[A]),a.jsx(s$,{scope:n,orientation:r,dir:b,loop:s,currentTabStopId:k,onItemFocus:S.useCallback(Q=>O(Q),[O]),onItemShiftTab:S.useCallback(()=>T(!0),[]),onFocusableItemAdd:S.useCallback(()=>R(Q=>Q+1),[]),onFocusableItemRemove:S.useCallback(()=>R(Q=>Q-1),[]),children:a.jsx(Zt.div,{tabIndex:j||E===0?-1:0,"data-orientation":r,...p,ref:v,style:{outline:"none",...t.style},onMouseDown:$e(t.onMouseDown,()=>{D.current=!0}),onFocus:$e(t.onFocus,Q=>{const F=!D.current;if(Q.target===Q.currentTarget&&F&&!j){const L=new CustomEvent(ky,t$);if(Q.currentTarget.dispatchEvent(L),!L.defaultPrevented){const U=_().filter($=>$.focusable),V=U.find($=>$.active),de=U.find($=>$.id===k),J=[V,de,...U].filter(Boolean).map($=>$.ref.current);jC(J,m)}}D.current=!1}),onBlur:$e(t.onBlur,()=>T(!1))})})}),kC="RovingFocusGroupItem",OC=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:l,...c}=t,d=ji(),h=i||d,m=i$(kC,n),p=m.currentTabStopId===h,x=wC(n),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:k}=m;return S.useEffect(()=>{if(r)return v(),()=>b()},[r,v,b]),a.jsx(l2.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:a.jsx(Zt.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...c,ref:e,onMouseDown:$e(t.onMouseDown,O=>{r?m.onItemFocus(h):O.preventDefault()}),onFocus:$e(t.onFocus,()=>m.onItemFocus(h)),onKeyDown:$e(t.onKeyDown,O=>{if(O.key==="Tab"&&O.shiftKey){m.onItemShiftTab();return}if(O.target!==O.currentTarget)return;const j=c$(O,m.orientation,m.dir);if(j!==void 0){if(O.metaKey||O.ctrlKey||O.altKey||O.shiftKey)return;O.preventDefault();let A=x().filter(_=>_.focusable).map(_=>_.ref.current);if(j==="last")A.reverse();else if(j==="prev"||j==="next"){j==="prev"&&A.reverse();const _=A.indexOf(O.currentTarget);A=m.loop?u$(A,_+1):A.slice(_+1)}setTimeout(()=>jC(A))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:k!=null}):l})})});OC.displayName=kC;var l$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function o$(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function c$(t,e,n){const r=o$(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return l$[r]}function jC(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function u$(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var NC=SC,CC=OC,mx="Tabs",[d$]=Vi(mx,[fx]),TC=fx(),[h$,sw]=d$(mx),AC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:l="horizontal",dir:c,activationMode:d="automatic",...h}=t,m=Vf(c),[p,x]=ko({prop:r,onChange:s,defaultProp:i??"",caller:mx});return a.jsx(h$,{scope:n,baseId:ji(),value:p,onValueChange:x,orientation:l,dir:m,activationMode:d,children:a.jsx(Zt.div,{dir:m,"data-orientation":l,...h,ref:e})})});AC.displayName=mx;var MC="TabsList",EC=S.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=sw(MC,n),l=TC(n);return a.jsx(NC,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(Zt.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});EC.displayName=MC;var _C="TabsTrigger",DC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,l=sw(_C,n),c=TC(n),d=PC(l.baseId,r),h=BC(l.baseId,r),m=r===l.value;return a.jsx(CC,{asChild:!0,...c,focusable:!s,active:m,children:a.jsx(Zt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":h,"data-state":m?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...i,ref:e,onMouseDown:$e(t.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?l.onValueChange(r):p.preventDefault()}),onKeyDown:$e(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&l.onValueChange(r)}),onFocus:$e(t.onFocus,()=>{const p=l.activationMode!=="manual";!m&&!s&&p&&l.onValueChange(r)})})})});DC.displayName=_C;var RC="TabsContent",zC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...l}=t,c=sw(RC,n),d=PC(c.baseId,r),h=BC(c.baseId,r),m=r===c.value,p=S.useRef(m);return S.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),a.jsx(Ls,{present:s||m,children:({present:x})=>a.jsx(Zt.div,{"data-state":m?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!x,id:h,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:p.current?"0s":void 0},children:x&&i})})});zC.displayName=RC;function PC(t,e){return`${t}-trigger-${e}`}function BC(t,e){return`${t}-content-${e}`}var f$=AC,LC=EC,IC=DC,qC=zC;const hl=f$,ya=S.forwardRef(({className:t,...e},n)=>a.jsx(LC,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ya.displayName=LC.displayName;const $t=S.forwardRef(({className:t,...e},n)=>a.jsx(IC,{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}));$t.displayName=IC.displayName;const kn=S.forwardRef(({className:t,...e},n)=>a.jsx(qC,{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}));kn.displayName=qC.displayName;function m$(t,e){return S.useReducer((n,r)=>e[n][r]??n,t)}var iw="ScrollArea",[FC]=Vi(iw),[p$,Ei]=FC(iw),QC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...l}=t,[c,d]=S.useState(null),[h,m]=S.useState(null),[p,x]=S.useState(null),[v,b]=S.useState(null),[k,O]=S.useState(null),[j,T]=S.useState(0),[A,_]=S.useState(0),[D,E]=S.useState(!1),[R,Q]=S.useState(!1),F=Cn(e,U=>d(U)),L=Vf(s);return a.jsx(p$,{scope:n,type:r,dir:L,scrollHideDelay:i,scrollArea:c,viewport:h,onViewportChange:m,content:p,onContentChange:x,scrollbarX:v,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:E,scrollbarY:k,onScrollbarYChange:O,scrollbarYEnabled:R,onScrollbarYEnabledChange:Q,onCornerWidthChange:T,onCornerHeightChange:_,children:a.jsx(Zt.div,{dir:L,...l,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});QC.displayName=iw;var $C="ScrollAreaViewport",HC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,l=Ei($C,n),c=S.useRef(null),d=Cn(e,c,l.onViewportChange);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(Zt.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});HC.displayName=$C;var Sa="ScrollAreaScrollbar",aw=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=s,c=t.orientation==="horizontal";return S.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),s.type==="hover"?a.jsx(g$,{...r,ref:e,forceMount:n}):s.type==="scroll"?a.jsx(x$,{...r,ref:e,forceMount:n}):s.type==="auto"?a.jsx(UC,{...r,ref:e,forceMount:n}):s.type==="always"?a.jsx(lw,{...r,ref:e}):null});aw.displayName=Sa;var g$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),[i,l]=S.useState(!1);return S.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const h=()=>{window.clearTimeout(d),l(!0)},m=()=>{d=window.setTimeout(()=>l(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",h),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",h),c.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(Ls,{present:n||i,children:a.jsx(UC,{"data-state":i?"visible":"hidden",...r,ref:e})})}),x$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=t.orientation==="horizontal",l=gx(()=>d("SCROLL_END"),100),[c,d]=m$("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 S.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,s.scrollHideDelay,d]),S.useEffect(()=>{const h=s.viewport,m=i?"scrollLeft":"scrollTop";if(h){let p=h[m];const x=()=>{const v=h[m];p!==v&&(d("SCROLL"),l()),p=v};return h.addEventListener("scroll",x),()=>h.removeEventListener("scroll",x)}},[s.viewport,i,d,l]),a.jsx(Ls,{present:n||c!=="hidden",children:a.jsx(lw,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:$e(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:$e(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),UC=S.forwardRef((t,e)=>{const n=Ei(Sa,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,l]=S.useState(!1),c=t.orientation==="horizontal",d=gx(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=S.useRef(null),l=S.useRef(0),[c,d]=S.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=YC(c.viewport,c.content),m={...r,sizes:c,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:x=>i.current=x,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:x=>l.current=x};function p(x,v){return k$(x,l.current,c,v)}return n==="horizontal"?a.jsx(v$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollLeft,v=IO(x,c,s.dir);i.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollLeft=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollLeft=p(x,s.dir))}}):n==="vertical"?a.jsx(y$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollTop,v=IO(x,c);i.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollTop=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollTop=p(x))}}):null}),v$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarXChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"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":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollLeft+m.deltaX;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:yg(l.paddingLeft),paddingEnd:yg(l.paddingRight)}})}})}),y$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarYChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"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":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollTop+m.deltaY;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:yg(l.paddingTop),paddingEnd:yg(l.paddingBottom)}})}})}),[b$,VC]=FC(Sa),WC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:m,onResize:p,...x}=t,v=Ei(Sa,n),[b,k]=S.useState(null),O=Cn(e,F=>k(F)),j=S.useRef(null),T=S.useRef(""),A=v.viewport,_=r.content-r.viewport,D=es(m),E=es(d),R=gx(p,10);function Q(F){if(j.current){const L=F.clientX-j.current.left,U=F.clientY-j.current.top;h({x:L,y:U})}}return S.useEffect(()=>{const F=L=>{const U=L.target;b?.contains(U)&&D(L,_)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[A,b,_,D]),S.useEffect(E,[r,E]),id(b,R),id(v.content,R),a.jsx(b$,{scope:n,scrollbar:b,hasThumb:s,onThumbChange:es(i),onThumbPointerUp:es(l),onThumbPositionChange:E,onThumbPointerDown:es(c),children:a.jsx(Zt.div,{...x,ref:O,style:{position:"absolute",...x.style},onPointerDown:$e(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),j.current=b.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),Q(F))}),onPointerMove:$e(t.onPointerMove,Q),onPointerUp:$e(t.onPointerUp,F=>{const L=F.target;L.hasPointerCapture(F.pointerId)&&L.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=T.current,v.viewport&&(v.viewport.style.scrollBehavior=""),j.current=null})})})}),vg="ScrollAreaThumb",GC=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=VC(vg,t.__scopeScrollArea);return a.jsx(Ls,{present:n||s.hasThumb,children:a.jsx(w$,{ref:e,...r})})}),w$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Ei(vg,n),l=VC(vg,n),{onThumbPositionChange:c}=l,d=Cn(e,p=>l.onThumbChange(p)),h=S.useRef(void 0),m=gx(()=>{h.current&&(h.current(),h.current=void 0)},100);return S.useEffect(()=>{const p=i.viewport;if(p){const x=()=>{if(m(),!h.current){const v=O$(p,c);h.current=v,c()}};return c(),p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[i.viewport,m,c]),a.jsx(Zt.div,{"data-state":l.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$e(t.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),b=p.clientX-v.left,k=p.clientY-v.top;l.onThumbPointerDown({x:b,y:k})}),onPointerUp:$e(t.onPointerUp,l.onThumbPointerUp)})});GC.displayName=vg;var ow="ScrollAreaCorner",XC=S.forwardRef((t,e)=>{const n=Ei(ow,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(S$,{...t,ref:e}):null});XC.displayName=ow;var S$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Ei(ow,n),[i,l]=S.useState(0),[c,d]=S.useState(0),h=!!(i&&c);return id(s.scrollbarX,()=>{const m=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(m),d(m)}),id(s.scrollbarY,()=>{const m=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(m),l(m)}),h?a.jsx(Zt.div,{...r,ref:e,style:{width:i,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function yg(t){return t?parseInt(t,10):0}function YC(t,e){const n=t/e;return isNaN(n)?0:n}function px(t){const e=YC(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function k$(t,e,n,r="ltr"){const s=px(n),i=s/2,l=e||i,c=s-l,d=n.scrollbar.paddingStart+l,h=n.scrollbar.size-n.scrollbar.paddingEnd-c,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return KC([d,h],p)(t)}function IO(t,e,n="ltr"){const r=px(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,l=e.content-e.viewport,c=i-r,d=n==="ltr"?[0,l]:[l*-1,0],h=F4(t,d);return KC([0,l],[0,c])(h)}function KC(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 ZC(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},l=n.left!==i.left,c=n.top!==i.top;(l||c)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function gx(t,e){const n=es(t),r=S.useRef(0);return S.useEffect(()=>()=>window.clearTimeout(r.current),[]),S.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function id(t,e){const n=es(e);h9(()=>{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 JC=QC,j$=HC,N$=XC;const vn=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(JC,{ref:r,className:ye("relative overflow-hidden",t),...n,children:[a.jsx(j$,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(eT,{}),a.jsx(N$,{})]}));vn.displayName=JC.displayName;const eT=S.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(aw,{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:a.jsx(GC,{className:"relative flex-1 rounded-full bg-border"})}));eT.displayName=aw.displayName;function qO({className:t,...e}){return a.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function C$(t,e=[]){let n=[];function r(i,l){const c=S.createContext(l);c.displayName=i+"Context";const d=n.length;n=[...n,l];const h=p=>{const{scope:x,children:v,...b}=p,k=x?.[t]?.[d]||c,O=S.useMemo(()=>b,Object.values(b));return a.jsx(k.Provider,{value:O,children:v})};h.displayName=i+"Provider";function m(p,x){const v=x?.[t]?.[d]||c,b=S.useContext(v);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[h,m]}const s=()=>{const i=n.map(l=>S.createContext(l));return function(c){const d=c?.[t]||i;return S.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return s.scopeName=t,[r,T$(s,...e)]}function T$(...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 l=r.reduce((c,{useScope:d,scopeName:h})=>{const p=d(i)[`__scope${h}`];return{...c,...p}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}var A$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tT=A$.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),cw="Progress",uw=100,[M$]=C$(cw),[E$,_$]=M$(cw),nT=S.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=D$,...l}=t;(s||s===0)&&!FO(s)&&console.error(R$(`${s}`,"Progress"));const c=FO(s)?s:uw;r!==null&&!QO(r,c)&&console.error(z$(`${r}`,"Progress"));const d=QO(r,c)?r:null,h=bg(d)?i(d,c):void 0;return a.jsx(E$,{scope:n,value:d,max:c,children:a.jsx(tT.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":bg(d)?d:void 0,"aria-valuetext":h,role:"progressbar","data-state":iT(d,c),"data-value":d??void 0,"data-max":c,...l,ref:e})})});nT.displayName=cw;var rT="ProgressIndicator",sT=S.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=_$(rT,n);return a.jsx(tT.div,{"data-state":iT(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});sT.displayName=rT;function D$(t,e){return`${Math.round(t/e*100)}%`}function iT(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function bg(t){return typeof t=="number"}function FO(t){return bg(t)&&!isNaN(t)&&t>0}function QO(t,e){return bg(t)&&!isNaN(t)&&t<=e&&t>=0}function R$(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${uw}\`.`}function z$(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: +`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=vc(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Up.assertOptions(r,{silentJSONParsing:ea.transitional(ea.boolean),forcedJSONParsing:ea.transitional(ea.boolean),clarifyTimeoutError:ea.transitional(ea.boolean)},!1),s!=null&&(we.isFunction(s)?n.paramsSerializer={serialize:s}:Up.assertOptions(s,{encode:ea.function,serialize:ea.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Up.assertOptions(n,{baseUrl:ea.spelling("baseURL"),withXsrfToken:ea.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&we.merge(i.common,i[n.method]);i&&we.forEach(["delete","get","head","post","put","patch","common"],b=>{delete i[b]}),n.headers=zs.concat(l,i);const c=[];let d=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(n)===!1||(d=d&&k.synchronous,c.unshift(k.fulfilled,k.rejected))});const h=[];this.interceptors.response.forEach(function(k){h.push(k.fulfilled,k.rejected)});let m,p=0,x;if(!d){const b=[_O.bind(this),void 0];for(b.unshift(...c),b.push(...h),x=b.length,m=Promise.resolve(n);p{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 l=new Promise(c=>{r.subscribe(c),i=c}).then(s);return l.cancel=function(){r.unsubscribe(i)},l},e(function(i,l,c){r.reason||(r.reason=new kd(i,l,c),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 aC(function(s){e=s}),cancel:e}}};function dQ(t){return function(n){return t.apply(null,n)}}function hQ(t){return we.isObject(t)&&t.isAxiosError===!0}const i2={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(i2).forEach(([t,e])=>{i2[e]=t});function lC(t){const e=new mc(t),n=L9(mc.prototype.request,e);return we.extend(n,mc.prototype,e,{allOwnKeys:!0}),we.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return lC(vc(t,s))},n}const Zn=lC(e0);Zn.Axios=mc;Zn.CanceledError=kd;Zn.CancelToken=uQ;Zn.isCancel=J9;Zn.VERSION=iC;Zn.toFormData=dx;Zn.AxiosError=St;Zn.Cancel=Zn.CanceledError;Zn.all=function(e){return Promise.all(e)};Zn.spread=dQ;Zn.isAxiosError=hQ;Zn.mergeConfig=vc;Zn.AxiosHeaders=zs;Zn.formToJSON=t=>Z9(we.isHTMLForm(t)?new FormData(t):t);Zn.getAdapter=sC.getAdapter;Zn.HttpStatusCode=i2;Zn.default=Zn;const{Axios:Nxe,AxiosError:Cxe,CanceledError:Txe,isCancel:Axe,CancelToken:Mxe,VERSION:Exe,all:_xe,Cancel:Dxe,isAxiosError:Rxe,spread:zxe,toFormData:Pxe,AxiosHeaders:Bxe,HttpStatusCode:Lxe,formToJSON:Ixe,getAdapter:qxe,mergeConfig:Fxe}=Zn,fQ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),oC=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xg="-",RO=[],pQ="arbitrary..",gQ=t=>{const e=vQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return xQ(l);const c=l.split(xg),d=c[0]===""&&c.length>1?1:0;return cC(c,d,e)},getConflictingClassGroupIds:(l,c)=>{if(c){const d=r[l],h=n[l];return d?h?fQ(h,d):d:h||RO}return n[l]||RO}}},cC=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=cC(t,e+1,i);if(h)return h}const l=n.validators;if(l===null)return;const c=e===0?t.join(xg):t.slice(e).join(xg),d=l.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?pQ+r:void 0})(),vQ=t=>{const{theme:e,classGroups:n}=t;return yQ(n,e)},yQ=(t,e)=>{const n=oC();for(const r in t){const s=t[r];rw(s,n,r,e)}return n},rw=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){wQ(t,e,n);return}if(typeof t=="function"){SQ(t,e,n,r);return}kQ(t,e,n,r)},wQ=(t,e,n)=>{const r=t===""?e:uC(e,t);r.classGroupId=n},SQ=(t,e,n,r)=>{if(OQ(t)){rw(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(mQ(n,t))},kQ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let l=0;l{let n=t;const r=e.split(xg),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,jQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,l)=>{n[i]=l,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let l=n[i];if(l!==void 0)return l;if((l=r[i])!==void 0)return s(i,l),l},set(i,l){i in n?n[i]=l:s(i,l)}}},a2="!",zO=":",NQ=[],PO=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),CQ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let l=0,c=0,d=0,h;const m=s.length;for(let k=0;kd?h-d:void 0;return PO(i,v,x,b)};if(e){const s=e+zO,i=r;r=l=>l.startsWith(s)?i(l.slice(s.length)):PO(NQ,!1,l,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},TQ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},AQ=t=>({cache:jQ(t.cacheSize),parseClassName:CQ(t),sortModifiers:TQ(t),...gQ(t)}),MQ=/\s+/,EQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,l=[],c=t.trim().split(MQ);let d="";for(let h=c.length-1;h>=0;h-=1){const m=c[h],{isExternal:p,modifiers:x,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:k}=n(m);if(p){d=m+(d.length>0?" "+d:d);continue}let O=!!k,j=r(O?b.substring(0,k):b);if(!j){if(!O){d=m+(d.length>0?" "+d:d);continue}if(j=r(b),!j){d=m+(d.length>0?" "+d:d);continue}O=!1}const T=x.length===0?"":x.length===1?x[0]:i(x).join(":"),A=v?T+a2:T,_=A+j;if(l.indexOf(_)>-1)continue;l.push(_);const D=s(j,O);for(let E=0;E0?" "+d:d)}return d},_Q=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const l=d=>{const h=e.reduce((m,p)=>p(m),t());return n=AQ(h),r=n.cache.get,s=n.cache.set,i=c,c(d)},c=d=>{const h=r(d);if(h)return h;const m=EQ(d,n);return s(d,m),m};return i=l,(...d)=>i(_Q(...d))},RQ=[],wr=t=>{const e=n=>n[t]||RQ;return e.isThemeGetter=!0,e},hC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zQ=/^\d+\/\d+$/,PQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,BQ=/\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$/,LQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ju=t=>zQ.test(t),Mt=t=>!!t&&!Number.isNaN(Number(t)),Gl=t=>!!t&&Number.isInteger(Number(t)),wy=t=>t.endsWith("%")&&Mt(t.slice(0,-1)),Xa=t=>PQ.test(t),FQ=()=>!0,QQ=t=>BQ.test(t)&&!LQ.test(t),mC=()=>!1,$Q=t=>IQ.test(t),HQ=t=>qQ.test(t),UQ=t=>!Xe(t)&&!Ye(t),VQ=t=>Od(t,xC,mC),Xe=t=>hC.test(t),Ko=t=>Od(t,vC,QQ),Sy=t=>Od(t,KQ,Mt),BO=t=>Od(t,pC,mC),WQ=t=>Od(t,gC,HQ),Ym=t=>Od(t,yC,$Q),Ye=t=>fC.test(t),Mh=t=>jd(t,vC),GQ=t=>jd(t,ZQ),LO=t=>jd(t,pC),XQ=t=>jd(t,xC),YQ=t=>jd(t,gC),Km=t=>jd(t,yC,!0),Od=(t,e,n)=>{const r=hC.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},jd=(t,e,n=!1)=>{const r=fC.exec(t);return r?r[1]?e(r[1]):n:!1},pC=t=>t==="position"||t==="percentage",gC=t=>t==="image"||t==="url",xC=t=>t==="length"||t==="size"||t==="bg-size",vC=t=>t==="length",KQ=t=>t==="number",ZQ=t=>t==="family-name",yC=t=>t==="shadow",JQ=()=>{const t=wr("color"),e=wr("font"),n=wr("text"),r=wr("font-weight"),s=wr("tracking"),i=wr("leading"),l=wr("breakpoint"),c=wr("container"),d=wr("spacing"),h=wr("radius"),m=wr("shadow"),p=wr("inset-shadow"),x=wr("text-shadow"),v=wr("drop-shadow"),b=wr("blur"),k=wr("perspective"),O=wr("aspect"),j=wr("ease"),T=wr("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[..._(),Ye,Xe],E=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],Q=()=>[Ye,Xe,d],F=()=>[ju,"full","auto",...Q()],L=()=>[Gl,"none","subgrid",Ye,Xe],U=()=>["auto",{span:["full",Gl,Ye,Xe]},Gl,Ye,Xe],V=()=>[Gl,"auto",Ye,Xe],ce=()=>["auto","min","max","fr",Ye,Xe],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...Q()],ae=()=>[ju,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],ne=()=>[t,Ye,Xe],ue=()=>[..._(),LO,BO,{position:[Ye,Xe]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],me=()=>["auto","cover","contain",XQ,VQ,{size:[Ye,Xe]}],Y=()=>[wy,Mh,Ko],P=()=>["","none","full",h,Ye,Xe],K=()=>["",Mt,Mh,Ko],H=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>[Mt,wy,LO,BO],Re=()=>["","none",b,Ye,Xe],de=()=>["none",Mt,Ye,Xe],We=()=>["none",Mt,Ye,Xe],ct=()=>[Mt,Ye,Xe],Oe=()=>[ju,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xa],breakpoint:[Xa],color:[FQ],container:[Xa],"drop-shadow":[Xa],ease:["in","out","in-out"],font:[UQ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xa],shadow:[Xa],spacing:["px",Mt],text:[Xa],"text-shadow":[Xa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ju,Xe,Ye,O]}],container:["container"],columns:[{columns:[Mt,Xe,Ye,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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:D()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{start:F()}],end:[{end:F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[Gl,"auto",Ye,Xe]}],basis:[{basis:[ju,"full","auto",c,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Mt,ju,"auto","initial","none",Xe]}],grow:[{grow:["",Mt,Ye,Xe]}],shrink:[{shrink:["",Mt,Ye,Xe]}],order:[{order:[Gl,"first","last","none",Ye,Xe]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:U()}],"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":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],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:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],w:[{w:[c,"screen",...ae()]}],"min-w":[{"min-w":[c,"screen","none",...ae()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Mh,Ko]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,Sy]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",wy,Xe]}],"font-family":[{font:[GQ,Xe,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,Ye,Xe]}],"line-clamp":[{"line-clamp":[Mt,"none",Ye,Sy]}],leading:[{leading:[i,...Q()]}],"list-image":[{"list-image":["none",Ye,Xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ne()}],"text-color":[{text:ne()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:[Mt,"from-font","auto",Ye,Ko]}],"text-decoration-color":[{decoration:ne()}],"underline-offset":[{"underline-offset":[Mt,"auto",Ye,Xe]}],"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",Ye,Xe]}],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",Ye,Xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ue()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:me()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gl,Ye,Xe],radial:["",Ye,Xe],conic:[Gl,Ye,Xe]},YQ,WQ]}],"bg-color":[{bg:ne()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:ne()}],"gradient-via":[{via:ne()}],"gradient-to":[{to:ne()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...H(),"hidden","none"]}],"divide-style":[{divide:[...H(),"hidden","none"]}],"border-color":[{border:ne()}],"border-color-x":[{"border-x":ne()}],"border-color-y":[{"border-y":ne()}],"border-color-s":[{"border-s":ne()}],"border-color-e":[{"border-e":ne()}],"border-color-t":[{"border-t":ne()}],"border-color-r":[{"border-r":ne()}],"border-color-b":[{"border-b":ne()}],"border-color-l":[{"border-l":ne()}],"divide-color":[{divide:ne()}],"outline-style":[{outline:[...H(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Mt,Ye,Xe]}],"outline-w":[{outline:["",Mt,Mh,Ko]}],"outline-color":[{outline:ne()}],shadow:[{shadow:["","none",m,Km,Ym]}],"shadow-color":[{shadow:ne()}],"inset-shadow":[{"inset-shadow":["none",p,Km,Ym]}],"inset-shadow-color":[{"inset-shadow":ne()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ne()}],"ring-offset-w":[{"ring-offset":[Mt,Ko]}],"ring-offset-color":[{"ring-offset":ne()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":ne()}],"text-shadow":[{"text-shadow":["none",x,Km,Ym]}],"text-shadow-color":[{"text-shadow":ne()}],opacity:[{opacity:[Mt,Ye,Xe]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"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":[Mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":ne()}],"mask-image-linear-to-color":[{"mask-linear-to":ne()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":ne()}],"mask-image-t-to-color":[{"mask-t-to":ne()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":ne()}],"mask-image-r-to-color":[{"mask-r-to":ne()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":ne()}],"mask-image-b-to-color":[{"mask-b-to":ne()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":ne()}],"mask-image-l-to-color":[{"mask-l-to":ne()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":ne()}],"mask-image-x-to-color":[{"mask-x-to":ne()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":ne()}],"mask-image-y-to-color":[{"mask-y-to":ne()}],"mask-image-radial":[{"mask-radial":[Ye,Xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":ne()}],"mask-image-radial-to-color":[{"mask-radial-to":ne()}],"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":_()}],"mask-image-conic-pos":[{"mask-conic":[Mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":ne()}],"mask-image-conic-to-color":[{"mask-conic-to":ne()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ue()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:me()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ye,Xe]}],filter:[{filter:["","none",Ye,Xe]}],blur:[{blur:Re()}],brightness:[{brightness:[Mt,Ye,Xe]}],contrast:[{contrast:[Mt,Ye,Xe]}],"drop-shadow":[{"drop-shadow":["","none",v,Km,Ym]}],"drop-shadow-color":[{"drop-shadow":ne()}],grayscale:[{grayscale:["",Mt,Ye,Xe]}],"hue-rotate":[{"hue-rotate":[Mt,Ye,Xe]}],invert:[{invert:["",Mt,Ye,Xe]}],saturate:[{saturate:[Mt,Ye,Xe]}],sepia:[{sepia:["",Mt,Ye,Xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Xe]}],"backdrop-blur":[{"backdrop-blur":Re()}],"backdrop-brightness":[{"backdrop-brightness":[Mt,Ye,Xe]}],"backdrop-contrast":[{"backdrop-contrast":[Mt,Ye,Xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Mt,Ye,Xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Mt,Ye,Xe]}],"backdrop-invert":[{"backdrop-invert":["",Mt,Ye,Xe]}],"backdrop-opacity":[{"backdrop-opacity":[Mt,Ye,Xe]}],"backdrop-saturate":[{"backdrop-saturate":[Mt,Ye,Xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Mt,Ye,Xe]}],"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",Ye,Xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Mt,"initial",Ye,Xe]}],ease:[{ease:["linear","initial",j,Ye,Xe]}],delay:[{delay:[Mt,Ye,Xe]}],animate:[{animate:["none",T,Ye,Xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ye,Xe]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:We()}],"scale-x":[{"scale-x":We()}],"scale-y":[{"scale-y":We()}],"scale-z":[{"scale-z":We()}],"scale-3d":["scale-3d"],skew:[{skew:ct()}],"skew-x":[{"skew-x":ct()}],"skew-y":[{"skew-y":ct()}],transform:[{transform:[Ye,Xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:ne()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ne()}],"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",Ye,Xe]}],"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",Ye,Xe]}],fill:[{fill:["none",...ne()]}],"stroke-w":[{stroke:[Mt,Mh,Ko,Sy]}],stroke:[{stroke:["none",...ne()]}],"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"]}},e$=DQ(JQ);function ye(...t){return e$(d9(t))}const gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));gt.displayName="Card";const Wt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));Wt.displayName="CardHeader";const Gt=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));Gt.displayName="CardTitle";const Sr=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Sr.displayName="CardDescription";const an=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));an.displayName="CardContent";const bC=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));bC.displayName="CardFooter";var ky="rovingFocusGroup.onEntryFocus",t$={bubbles:!1,cancelable:!0},t0="RovingFocusGroup",[l2,wC,n$]=tx(t0),[r$,fx]=Vi(t0,[n$]),[s$,i$]=r$(t0),SC=S.forwardRef((t,e)=>a.jsx(l2.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(l2.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(a$,{...t,ref:e})})}));SC.displayName=t0;var a$=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:h,preventScrollOnEntryFocus:m=!1,...p}=t,x=S.useRef(null),v=Cn(e,x),b=Vf(i),[k,O]=ko({prop:l,defaultProp:c??null,onChange:d,caller:t0}),[j,T]=S.useState(!1),A=es(h),_=wC(n),D=S.useRef(!1),[E,z]=S.useState(0);return S.useEffect(()=>{const Q=x.current;if(Q)return Q.addEventListener(ky,A),()=>Q.removeEventListener(ky,A)},[A]),a.jsx(s$,{scope:n,orientation:r,dir:b,loop:s,currentTabStopId:k,onItemFocus:S.useCallback(Q=>O(Q),[O]),onItemShiftTab:S.useCallback(()=>T(!0),[]),onFocusableItemAdd:S.useCallback(()=>z(Q=>Q+1),[]),onFocusableItemRemove:S.useCallback(()=>z(Q=>Q-1),[]),children:a.jsx(Zt.div,{tabIndex:j||E===0?-1:0,"data-orientation":r,...p,ref:v,style:{outline:"none",...t.style},onMouseDown:$e(t.onMouseDown,()=>{D.current=!0}),onFocus:$e(t.onFocus,Q=>{const F=!D.current;if(Q.target===Q.currentTarget&&F&&!j){const L=new CustomEvent(ky,t$);if(Q.currentTarget.dispatchEvent(L),!L.defaultPrevented){const U=_().filter($=>$.focusable),V=U.find($=>$.active),ce=U.find($=>$.id===k),J=[V,ce,...U].filter(Boolean).map($=>$.ref.current);jC(J,m)}}D.current=!1}),onBlur:$e(t.onBlur,()=>T(!1))})})}),kC="RovingFocusGroupItem",OC=S.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:l,...c}=t,d=ji(),h=i||d,m=i$(kC,n),p=m.currentTabStopId===h,x=wC(n),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:k}=m;return S.useEffect(()=>{if(r)return v(),()=>b()},[r,v,b]),a.jsx(l2.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:a.jsx(Zt.span,{tabIndex:p?0:-1,"data-orientation":m.orientation,...c,ref:e,onMouseDown:$e(t.onMouseDown,O=>{r?m.onItemFocus(h):O.preventDefault()}),onFocus:$e(t.onFocus,()=>m.onItemFocus(h)),onKeyDown:$e(t.onKeyDown,O=>{if(O.key==="Tab"&&O.shiftKey){m.onItemShiftTab();return}if(O.target!==O.currentTarget)return;const j=c$(O,m.orientation,m.dir);if(j!==void 0){if(O.metaKey||O.ctrlKey||O.altKey||O.shiftKey)return;O.preventDefault();let A=x().filter(_=>_.focusable).map(_=>_.ref.current);if(j==="last")A.reverse();else if(j==="prev"||j==="next"){j==="prev"&&A.reverse();const _=A.indexOf(O.currentTarget);A=m.loop?u$(A,_+1):A.slice(_+1)}setTimeout(()=>jC(A))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:k!=null}):l})})});OC.displayName=kC;var l$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function o$(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function c$(t,e,n){const r=o$(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return l$[r]}function jC(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function u$(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var NC=SC,CC=OC,mx="Tabs",[d$]=Vi(mx,[fx]),TC=fx(),[h$,sw]=d$(mx),AC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:l="horizontal",dir:c,activationMode:d="automatic",...h}=t,m=Vf(c),[p,x]=ko({prop:r,onChange:s,defaultProp:i??"",caller:mx});return a.jsx(h$,{scope:n,baseId:ji(),value:p,onValueChange:x,orientation:l,dir:m,activationMode:d,children:a.jsx(Zt.div,{dir:m,"data-orientation":l,...h,ref:e})})});AC.displayName=mx;var MC="TabsList",EC=S.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=sw(MC,n),l=TC(n);return a.jsx(NC,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(Zt.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});EC.displayName=MC;var _C="TabsTrigger",DC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,l=sw(_C,n),c=TC(n),d=PC(l.baseId,r),h=BC(l.baseId,r),m=r===l.value;return a.jsx(CC,{asChild:!0,...c,focusable:!s,active:m,children:a.jsx(Zt.button,{type:"button",role:"tab","aria-selected":m,"aria-controls":h,"data-state":m?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...i,ref:e,onMouseDown:$e(t.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?l.onValueChange(r):p.preventDefault()}),onKeyDown:$e(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&l.onValueChange(r)}),onFocus:$e(t.onFocus,()=>{const p=l.activationMode!=="manual";!m&&!s&&p&&l.onValueChange(r)})})})});DC.displayName=_C;var RC="TabsContent",zC=S.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...l}=t,c=sw(RC,n),d=PC(c.baseId,r),h=BC(c.baseId,r),m=r===c.value,p=S.useRef(m);return S.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),a.jsx(Ls,{present:s||m,children:({present:x})=>a.jsx(Zt.div,{"data-state":m?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!x,id:h,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:p.current?"0s":void 0},children:x&&i})})});zC.displayName=RC;function PC(t,e){return`${t}-trigger-${e}`}function BC(t,e){return`${t}-content-${e}`}var f$=AC,LC=EC,IC=DC,qC=zC;const hl=f$,ya=S.forwardRef(({className:t,...e},n)=>a.jsx(LC,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ya.displayName=LC.displayName;const $t=S.forwardRef(({className:t,...e},n)=>a.jsx(IC,{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}));$t.displayName=IC.displayName;const kn=S.forwardRef(({className:t,...e},n)=>a.jsx(qC,{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}));kn.displayName=qC.displayName;function m$(t,e){return S.useReducer((n,r)=>e[n][r]??n,t)}var iw="ScrollArea",[FC]=Vi(iw),[p$,Ei]=FC(iw),QC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...l}=t,[c,d]=S.useState(null),[h,m]=S.useState(null),[p,x]=S.useState(null),[v,b]=S.useState(null),[k,O]=S.useState(null),[j,T]=S.useState(0),[A,_]=S.useState(0),[D,E]=S.useState(!1),[z,Q]=S.useState(!1),F=Cn(e,U=>d(U)),L=Vf(s);return a.jsx(p$,{scope:n,type:r,dir:L,scrollHideDelay:i,scrollArea:c,viewport:h,onViewportChange:m,content:p,onContentChange:x,scrollbarX:v,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:E,scrollbarY:k,onScrollbarYChange:O,scrollbarYEnabled:z,onScrollbarYEnabledChange:Q,onCornerWidthChange:T,onCornerHeightChange:_,children:a.jsx(Zt.div,{dir:L,...l,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});QC.displayName=iw;var $C="ScrollAreaViewport",HC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,l=Ei($C,n),c=S.useRef(null),d=Cn(e,c,l.onViewportChange);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(Zt.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});HC.displayName=$C;var Sa="ScrollAreaScrollbar",aw=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=s,c=t.orientation==="horizontal";return S.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),s.type==="hover"?a.jsx(g$,{...r,ref:e,forceMount:n}):s.type==="scroll"?a.jsx(x$,{...r,ref:e,forceMount:n}):s.type==="auto"?a.jsx(UC,{...r,ref:e,forceMount:n}):s.type==="always"?a.jsx(lw,{...r,ref:e}):null});aw.displayName=Sa;var g$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),[i,l]=S.useState(!1);return S.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const h=()=>{window.clearTimeout(d),l(!0)},m=()=>{d=window.setTimeout(()=>l(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",h),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",h),c.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(Ls,{present:n||i,children:a.jsx(UC,{"data-state":i?"visible":"hidden",...r,ref:e})})}),x$=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=t.orientation==="horizontal",l=gx(()=>d("SCROLL_END"),100),[c,d]=m$("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 S.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,s.scrollHideDelay,d]),S.useEffect(()=>{const h=s.viewport,m=i?"scrollLeft":"scrollTop";if(h){let p=h[m];const x=()=>{const v=h[m];p!==v&&(d("SCROLL"),l()),p=v};return h.addEventListener("scroll",x),()=>h.removeEventListener("scroll",x)}},[s.viewport,i,d,l]),a.jsx(Ls,{present:n||c!=="hidden",children:a.jsx(lw,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:$e(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:$e(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),UC=S.forwardRef((t,e)=>{const n=Ei(Sa,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,l]=S.useState(!1),c=t.orientation==="horizontal",d=gx(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=Ei(Sa,t.__scopeScrollArea),i=S.useRef(null),l=S.useRef(0),[c,d]=S.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=YC(c.viewport,c.content),m={...r,sizes:c,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:x=>i.current=x,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:x=>l.current=x};function p(x,v){return k$(x,l.current,c,v)}return n==="horizontal"?a.jsx(v$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollLeft,v=IO(x,c,s.dir);i.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollLeft=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollLeft=p(x,s.dir))}}):n==="vertical"?a.jsx(y$,{...m,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const x=s.viewport.scrollTop,v=IO(x,c);i.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollTop=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollTop=p(x))}}):null}),v$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarXChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"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":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollLeft+m.deltaX;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:yg(l.paddingLeft),paddingEnd:yg(l.paddingRight)}})}})}),y$=S.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Ei(Sa,t.__scopeScrollArea),[l,c]=S.useState(),d=S.useRef(null),h=Cn(e,d,i.onScrollbarYChange);return S.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),a.jsx(WC,{"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":px(n)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(i.viewport){const x=i.viewport.scrollTop+m.deltaY;t.onWheelScroll(x),ZC(x,p)&&m.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:yg(l.paddingTop),paddingEnd:yg(l.paddingBottom)}})}})}),[b$,VC]=FC(Sa),WC=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:m,onResize:p,...x}=t,v=Ei(Sa,n),[b,k]=S.useState(null),O=Cn(e,F=>k(F)),j=S.useRef(null),T=S.useRef(""),A=v.viewport,_=r.content-r.viewport,D=es(m),E=es(d),z=gx(p,10);function Q(F){if(j.current){const L=F.clientX-j.current.left,U=F.clientY-j.current.top;h({x:L,y:U})}}return S.useEffect(()=>{const F=L=>{const U=L.target;b?.contains(U)&&D(L,_)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[A,b,_,D]),S.useEffect(E,[r,E]),id(b,z),id(v.content,z),a.jsx(b$,{scope:n,scrollbar:b,hasThumb:s,onThumbChange:es(i),onThumbPointerUp:es(l),onThumbPositionChange:E,onThumbPointerDown:es(c),children:a.jsx(Zt.div,{...x,ref:O,style:{position:"absolute",...x.style},onPointerDown:$e(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),j.current=b.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),Q(F))}),onPointerMove:$e(t.onPointerMove,Q),onPointerUp:$e(t.onPointerUp,F=>{const L=F.target;L.hasPointerCapture(F.pointerId)&&L.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=T.current,v.viewport&&(v.viewport.style.scrollBehavior=""),j.current=null})})})}),vg="ScrollAreaThumb",GC=S.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=VC(vg,t.__scopeScrollArea);return a.jsx(Ls,{present:n||s.hasThumb,children:a.jsx(w$,{ref:e,...r})})}),w$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Ei(vg,n),l=VC(vg,n),{onThumbPositionChange:c}=l,d=Cn(e,p=>l.onThumbChange(p)),h=S.useRef(void 0),m=gx(()=>{h.current&&(h.current(),h.current=void 0)},100);return S.useEffect(()=>{const p=i.viewport;if(p){const x=()=>{if(m(),!h.current){const v=O$(p,c);h.current=v,c()}};return c(),p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[i.viewport,m,c]),a.jsx(Zt.div,{"data-state":l.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$e(t.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),b=p.clientX-v.left,k=p.clientY-v.top;l.onThumbPointerDown({x:b,y:k})}),onPointerUp:$e(t.onPointerUp,l.onThumbPointerUp)})});GC.displayName=vg;var ow="ScrollAreaCorner",XC=S.forwardRef((t,e)=>{const n=Ei(ow,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(S$,{...t,ref:e}):null});XC.displayName=ow;var S$=S.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Ei(ow,n),[i,l]=S.useState(0),[c,d]=S.useState(0),h=!!(i&&c);return id(s.scrollbarX,()=>{const m=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(m),d(m)}),id(s.scrollbarY,()=>{const m=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(m),l(m)}),h?a.jsx(Zt.div,{...r,ref:e,style:{width:i,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function yg(t){return t?parseInt(t,10):0}function YC(t,e){const n=t/e;return isNaN(n)?0:n}function px(t){const e=YC(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function k$(t,e,n,r="ltr"){const s=px(n),i=s/2,l=e||i,c=s-l,d=n.scrollbar.paddingStart+l,h=n.scrollbar.size-n.scrollbar.paddingEnd-c,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return KC([d,h],p)(t)}function IO(t,e,n="ltr"){const r=px(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,l=e.content-e.viewport,c=i-r,d=n==="ltr"?[0,l]:[l*-1,0],h=F4(t,d);return KC([0,l],[0,c])(h)}function KC(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 ZC(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},l=n.left!==i.left,c=n.top!==i.top;(l||c)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function gx(t,e){const n=es(t),r=S.useRef(0);return S.useEffect(()=>()=>window.clearTimeout(r.current),[]),S.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function id(t,e){const n=es(e);h9(()=>{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 JC=QC,j$=HC,N$=XC;const mn=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(JC,{ref:r,className:ye("relative overflow-hidden",t),...n,children:[a.jsx(j$,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(eT,{}),a.jsx(N$,{})]}));mn.displayName=JC.displayName;const eT=S.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(aw,{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:a.jsx(GC,{className:"relative flex-1 rounded-full bg-border"})}));eT.displayName=aw.displayName;function qO({className:t,...e}){return a.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function C$(t,e=[]){let n=[];function r(i,l){const c=S.createContext(l);c.displayName=i+"Context";const d=n.length;n=[...n,l];const h=p=>{const{scope:x,children:v,...b}=p,k=x?.[t]?.[d]||c,O=S.useMemo(()=>b,Object.values(b));return a.jsx(k.Provider,{value:O,children:v})};h.displayName=i+"Provider";function m(p,x){const v=x?.[t]?.[d]||c,b=S.useContext(v);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[h,m]}const s=()=>{const i=n.map(l=>S.createContext(l));return function(c){const d=c?.[t]||i;return S.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return s.scopeName=t,[r,T$(s,...e)]}function T$(...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 l=r.reduce((c,{useScope:d,scopeName:h})=>{const p=d(i)[`__scope${h}`];return{...c,...p}},{});return S.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}var A$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tT=A$.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),cw="Progress",uw=100,[M$]=C$(cw),[E$,_$]=M$(cw),nT=S.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=D$,...l}=t;(s||s===0)&&!FO(s)&&console.error(R$(`${s}`,"Progress"));const c=FO(s)?s:uw;r!==null&&!QO(r,c)&&console.error(z$(`${r}`,"Progress"));const d=QO(r,c)?r:null,h=bg(d)?i(d,c):void 0;return a.jsx(E$,{scope:n,value:d,max:c,children:a.jsx(tT.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":bg(d)?d:void 0,"aria-valuetext":h,role:"progressbar","data-state":iT(d,c),"data-value":d??void 0,"data-max":c,...l,ref:e})})});nT.displayName=cw;var rT="ProgressIndicator",sT=S.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=_$(rT,n);return a.jsx(tT.div,{"data-state":iT(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});sT.displayName=rT;function D$(t,e){return`${Math.round(t/e*100)}%`}function iT(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function bg(t){return typeof t=="number"}function FO(t){return bg(t)&&!isNaN(t)&&t>0}function QO(t,e){return bg(t)&&!isNaN(t)&&t<=e&&t>=0}function R$(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${uw}\`.`}function z$(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 ${uw} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. @@ -22,25 +22,25 @@ ${n.map(([i,l])=>{const c=l.theme?.[r]||l.color;return c?` --color-${i}: ${c};` `)} } `).join(` -`)}}):null},Eh=II,_u=S.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:l,labelFormatter:c,labelClassName:d,formatter:h,color:m,nameKey:p,labelKey:x},v)=>{const{config:b}=oT(),k=S.useMemo(()=>{if(s||!e?.length)return null;const[j]=e,T=`${x||j?.dataKey||j?.name||"value"}`,A=o2(b,j,T),_=!x&&typeof l=="string"?b[l]?.label||l:A?.label;return c?a.jsx("div",{className:ye("font-medium",d),children:c(_,e)}):_?a.jsx("div",{className:ye("font-medium",d),children:_}):null},[l,c,e,s,d,b,x]);if(!t||!e?.length)return null;const O=e.length===1&&r!=="dot";return a.jsxs("div",{ref:v,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:[O?null:k,a.jsx("div",{className:"grid gap-1.5",children:e.filter(j=>j.type!=="none").map((j,T)=>{const A=`${p||j.name||j.dataKey||"value"}`,_=o2(b,j,A),D=m||j.payload.fill||j.color;return a.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&&j?.value!==void 0&&j.name?h(j.value,j.name,j,T,j.payload):a.jsxs(a.Fragment,{children:[_?.icon?a.jsx(_.icon,{}):!i&&a.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":O&&r==="dashed"}),style:{"--color-bg":D,"--color-border":D}}),a.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",O?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[O?k:null,a.jsx("span",{className:"text-muted-foreground",children:_?.label||j.name})]}),j.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:j.value.toLocaleString()})]})]})},j.dataKey)})})]})});_u.displayName="ChartTooltip";const I$=qI,cT=S.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:l}=oT();return n?.length?a.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(c=>c.type!=="none").map(c=>{const d=`${s||c.dataKey||"value"}`,h=o2(l,c,d);return a.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?a.jsx(h.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:c.color}}),h?.label]},c.value)})}):null});cT.displayName="ChartLegend";function o2(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 $O=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,HO=d9,Nd=(t,e)=>n=>{var r;if(e?.variants==null)return HO(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,l=Object.keys(s).map(h=>{const m=n?.[h],p=i?.[h];if(m===null)return null;const x=$O(m)||$O(p);return s[h][x]}),c=n&&Object.entries(n).reduce((h,m)=>{let[p,x]=m;return x===void 0||(h[p]=x),h},{}),d=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,m)=>{let{class:p,className:x,...v}=m;return Object.entries(v).every(b=>{let[k,O]=b;return Array.isArray(O)?O.includes({...i,...c}[k]):{...i,...c}[k]===O})?[...h,p,x]:h},[]);return HO(t,l,d,n?.class,n?.className)},ff=Nd("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"}}),ie=S.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const l=r?GI:"button";return a.jsx(l,{className:ye(ff({variant:e,size:n,className:t})),ref:i,...s})});ie.displayName="Button";function q$(){const[t,e]=S.useState(null),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(24),[d,h]=S.useState(!0),[m,p]=S.useState(null),[x,v]=S.useState(!0),b=S.useCallback(async()=>{try{v(!0);const F=await Zn.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");p({hitokoto:F.data.hitokoto,from:F.data.from||F.data.from_who||"未知"})}catch(F){console.error("获取一言失败:",F),p({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{v(!1)}},[]),k=S.useCallback(async()=>{try{const F=localStorage.getItem("access-token"),L=await Zn.get(`/api/webui/statistics/dashboard?hours=${l}`,{headers:{Authorization:`Bearer ${F}`}});e(L.data),r(!1),i(100)}catch(F){console.error("Failed to fetch dashboard data:",F),r(!1),i(100)}},[l]);if(S.useEffect(()=>{if(!n)return;i(0);const F=setTimeout(()=>i(15),200),L=setTimeout(()=>i(30),800),U=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),de=setTimeout(()=>i(75),6500),W=setTimeout(()=>i(85),9e3),J=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(F),clearTimeout(L),clearTimeout(U),clearTimeout(V),clearTimeout(de),clearTimeout(W),clearTimeout(J)}},[n]),S.useEffect(()=>{k(),b()},[k,b]),S.useEffect(()=>{if(!d)return;const F=setInterval(()=>{k()},3e4);return()=>clearInterval(F)},[d,k]),n||!t)return a.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:a.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[a.jsx(Fi,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:s,className:"h-2"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:O,model_stats:j,hourly_data:T,daily_data:A,recent_activity:_}=t,D=F=>{const L=Math.floor(F/3600),U=Math.floor(F%3600/60);return`${L}小时${U}分钟`},E=F=>new Date(F).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),R=j.slice(0,6).map(F=>({name:F.model_name,value:F.request_count,fill:`hsl(var(--chart-${j.indexOf(F)%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 a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(hl,{value:l.toString(),onValueChange:F=>c(Number(F)),children:a.jsxs(ya,{className:"grid grid-cols-3 w-full sm:w-auto",children:[a.jsx($t,{value:"24",children:"24小时"}),a.jsx($t,{value:"168",children:"7天"}),a.jsx($t,{value:"720",children:"30天"})]})}),a.jsxs(ie,{variant:d?"default":"outline",size:"sm",onClick:()=>h(!d),className:"gap-2",children:[a.jsx(Fi,{className:`h-4 w-4 ${d?"animate-spin":""}`}),a.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:k,children:a.jsx(Fi,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总请求数"}),a.jsx(lq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:O.total_requests.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",l<48?l+"小时":Math.floor(l/24)+"天"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总花费"}),a.jsx(oq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:["¥",O.total_cost.toFixed(2)]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.cost_per_hour>0?`¥${O.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"Token消耗"}),a.jsx(cq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[(O.total_tokens/1e3).toFixed(1),"K"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.tokens_per_hour>0?`${(O.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"平均响应"}),a.jsx(uf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[O.avg_response_time.toFixed(2),"s"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"在线时长"}),a.jsx(dc,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsx(an,{children:a.jsx("div",{className:"text-xl font-bold",children:D(O.online_time)})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"消息处理"}),a.jsx(Wf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",O.total_replies.toLocaleString()," 条"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"成本效率"}),a.jsx(uq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages>0?`¥${(O.total_cost/O.total_messages*100).toFixed(2)}`:"¥0.00"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),a.jsxs(hl,{defaultValue:"trends",className:"space-y-4",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[a.jsx($t,{value:"trends",children:"趋势"}),a.jsx($t,{value:"models",children:"模型"}),a.jsx($t,{value:"activity",children:"活动"}),a.jsx($t,{value:"daily",children:"日统计"})]}),a.jsxs(kn,{value:"trends",className:"space-y-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"请求趋势"}),a.jsxs(Sr,{children:["最近",l,"小时的请求量变化"]})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs(FI,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(QI,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"花费趋势"}),a.jsx(Sr,{children:"API调用成本变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"Token消耗"}),a.jsx(Sr,{children:"Token使用量变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),a.jsx(kn,{value:"models",className:"space-y-4",children:a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型请求分布"}),a.jsx(Sr,{children:"各模型使用占比"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Object.fromEntries(j.slice(0,6).map((F,L)=>[F.model_name,{label:F.model_name,color:`hsl(var(--chart-${L%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs($I,{children:[a.jsx(Eh,{content:a.jsx(_u,{})}),a.jsx(HI,{data:R,cx:"50%",cy:"50%",labelLine:!1,label:({name:F,percent:L})=>`${F} ${L?(L*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:R.map((F,L)=>a.jsx(UI,{fill:F.fill},`cell-${L}`))})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型详细统计"}),a.jsx(Sr,{children:"请求数、花费和性能"})]}),a.jsx(an,{children:a.jsx(vn,{className:"h-[300px] sm:h-[400px]",children:a.jsx("div",{className:"space-y-3",children:j.map((F,L)=>a.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:F.model_name}),a.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${L%5+1}))`}})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),a.jsx("span",{className:"ml-1 font-medium",children:F.request_count.toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1 font-medium",children:["¥",F.total_cost.toFixed(2)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[(F.total_tokens/1e3).toFixed(1),"K"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[F.avg_response_time.toFixed(2),"s"]})]})]})]},L))})})})]})]})}),a.jsx(kn,{value:"activity",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"最近活动"}),a.jsx(Sr,{children:"最新的API调用记录"})]}),a.jsx(an,{children:a.jsx(vn,{className:"h-[400px] sm:h-[500px]",children:a.jsx("div",{className:"space-y-2",children:_.map((F,L)=>a.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm truncate",children:F.model}),a.jsx("div",{className:"text-xs text-muted-foreground",children:F.request_type})]}),a.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(F.timestamp)})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsx("span",{className:"ml-1",children:F.tokens})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1",children:["¥",F.cost.toFixed(4)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),a.jsxs("span",{className:"ml-1",children:[F.time_cost.toFixed(2),"s"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"状态:"}),a.jsx("span",{className:`ml-1 ${F.status==="success"?"text-green-600":"text-red-600"}`,children:F.status})]})]})]},L))})})})]})}),a.jsx(kn,{value:"daily",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"每日统计"}),a.jsx(Sr,{children:"最近7天的数据汇总"})]}),a.jsx(an,{children:a.jsx(Eu,{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:a.jsxs(fy,{data:A,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>{const L=new Date(F);return`${L.getMonth()+1}/${L.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>new Date(F).toLocaleDateString("zh-CN")})}),a.jsx(I$,{content:a.jsx(cT,{})}),a.jsx(Gm,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),a.jsx(Gm,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),a.jsxs(gt,{className:"border-2 border-primary/20",children:[a.jsx(Wt,{className:"pb-3",children:a.jsx(Gt,{className:"text-lg",children:"每日一言"})}),a.jsx(an,{children:x?a.jsxs("div",{className:"space-y-2",children:[a.jsx(qO,{className:"h-6 w-3/4"}),a.jsx(qO,{className:"h-4 w-1/4"})]}):m?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',m.hitokoto,'"']}),a.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",m.from]})]}):null})]})]})})}const F$={theme:"system",setTheme:()=>null},uT=S.createContext(F$),dw=()=>{const t=S.useContext(uT);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},Q$=(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,l=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(${l}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},dT=S.createContext(void 0),hT=()=>{const t=S.useContext(dT);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var xx="Switch",[$$]=Vi(xx),[H$,U$]=$$(xx),fT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:h,form:m,...p}=t,[x,v]=S.useState(null),b=Cn(e,A=>v(A)),k=S.useRef(!1),O=x?m||!!x.closest("form"):!0,[j,T]=ko({prop:s,defaultProp:i??!1,onChange:h,caller:xx});return a.jsxs(H$,{scope:n,checked:j,disabled:c,children:[a.jsx(Zt.button,{type:"button",role:"switch","aria-checked":j,"aria-required":l,"data-state":xT(j),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:b,onClick:$e(t.onClick,A=>{T(_=>!_),O&&(k.current=A.isPropagationStopped(),k.current||A.stopPropagation())})}),O&&a.jsx(gT,{control:x,bubbles:!k.current,name:r,value:d,checked:j,required:l,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});fT.displayName=xx;var mT="SwitchThumb",pT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=U$(mT,n);return a.jsx(Zt.span,{"data-state":xT(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});pT.displayName=mT;var V$="SwitchBubbleInput",gT=S.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const l=S.useRef(null),c=Cn(l,i),d=f9(n),h=m9(e);return S.useEffect(()=>{const m=l.current;if(!m)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&v){const b=new Event("click",{bubbles:r});v.call(m,n),m.dispatchEvent(b)}},[d,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gT.displayName=V$;function xT(t){return t?"checked":"unchecked"}var vT=fT,W$=pT;const jt=S.forwardRef(({className:t,...e},n)=>a.jsx(vT,{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:a.jsx(W$,{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")})}));jt.displayName=vT.displayName;const G$=Nd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),te=S.forwardRef(({className:t,...e},n)=>a.jsx(p9,{ref:n,className:ye(G$(),t),...e}));te.displayName=p9.displayName;const Me=S.forwardRef(({className:t,type:e,...n},r)=>a.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}));Me.displayName="Input";const X$=1,Y$=1e6;let Oy=0;function K$(){return Oy=(Oy+1)%Number.MAX_SAFE_INTEGER,Oy.toString()}const jy=new Map,UO=t=>{if(jy.has(t))return;const e=setTimeout(()=>{jy.delete(t),Kh({type:"REMOVE_TOAST",toastId:t})},Y$);jy.set(t,e)},Z$=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,X$)};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?UO(n):t.toasts.forEach(r=>{UO(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)}}},Vp=[];let Wp={toasts:[]};function Kh(t){Wp=Z$(Wp,t),Vp.forEach(e=>{e(Wp)})}function J$({...t}){const e=K$(),n=s=>Kh({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>Kh({type:"DISMISS_TOAST",toastId:e});return Kh({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Pr(){const[t,e]=S.useState(Wp);return S.useEffect(()=>(Vp.push(e),()=>{const n=Vp.indexOf(e);n>-1&&Vp.splice(n,1)}),[t]),{...t,toast:J$,dismiss:n=>Kh({type:"DISMISS_TOAST",toastId:n})}}const eH=[{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 tH(t){const e=eH.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 hw="0.11.5 Beta",fw="MaiBot Dashboard",nH=`${fw} v${hw}`,rH=(t="v")=>`${t}${hw}`,Rr=W4,mw=g9,sH=$4,yT=S.forwardRef(({className:t,...e},n)=>a.jsx(nx,{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}));yT.displayName=nx.displayName;const Nr=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(sH,{children:[a.jsx(yT,{}),a.jsxs(rx,{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,a.jsxs(H4,{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:[a.jsx(Gf,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nr.displayName=rx.displayName;const Cr=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Cr.displayName="DialogHeader";const ps=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ps.displayName="DialogFooter";const Tr=S.forwardRef(({className:t,...e},n)=>a.jsx(U4,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));Tr.displayName=U4.displayName;const Gr=S.forwardRef(({className:t,...e},n)=>a.jsx(V4,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Gr.displayName=V4.displayName;var iH=Symbol("radix.slottable");function aH(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=iH,e}var bT="AlertDialog",[lH]=Vi(bT,[x9]),bl=x9(),wT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx(W4,{...r,...n,modal:!0})};wT.displayName=bT;var oH="AlertDialogTrigger",ST=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(g9,{...s,...r,ref:e})});ST.displayName=oH;var cH="AlertDialogPortal",kT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx($4,{...r,...n})};kT.displayName=cH;var uH="AlertDialogOverlay",OT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(nx,{...s,...r,ref:e})});OT.displayName=uH;var Uu="AlertDialogContent",[dH,hH]=lH(Uu),fH=aH("AlertDialogContent"),jT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=bl(n),l=S.useRef(null),c=Cn(e,l),d=S.useRef(null);return a.jsx(XI,{contentName:Uu,titleName:NT,docsSlug:"alert-dialog",children:a.jsx(dH,{scope:n,cancelRef:d,children:a.jsxs(rx,{role:"alertdialog",...i,...s,ref:c,onOpenAutoFocus:$e(s.onOpenAutoFocus,h=>{h.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[a.jsx(fH,{children:r}),a.jsx(pH,{contentRef:l})]})})})});jT.displayName=Uu;var NT="AlertDialogTitle",CT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(U4,{...s,...r,ref:e})});CT.displayName=NT;var TT="AlertDialogDescription",AT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(V4,{...s,...r,ref:e})});AT.displayName=TT;var mH="AlertDialogAction",MT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(H4,{...s,...r,ref:e})});MT.displayName=mH;var ET="AlertDialogCancel",_T=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=hH(ET,n),i=bl(n),l=Cn(e,s);return a.jsx(H4,{...i,...r,ref:l})});_T.displayName=ET;var pH=({contentRef:t})=>{const e=`\`${Uu}\` requires a description for the component to be accessible for screen reader users. +`)}}):null},Eh=II,_u=S.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:l,labelFormatter:c,labelClassName:d,formatter:h,color:m,nameKey:p,labelKey:x},v)=>{const{config:b}=oT(),k=S.useMemo(()=>{if(s||!e?.length)return null;const[j]=e,T=`${x||j?.dataKey||j?.name||"value"}`,A=o2(b,j,T),_=!x&&typeof l=="string"?b[l]?.label||l:A?.label;return c?a.jsx("div",{className:ye("font-medium",d),children:c(_,e)}):_?a.jsx("div",{className:ye("font-medium",d),children:_}):null},[l,c,e,s,d,b,x]);if(!t||!e?.length)return null;const O=e.length===1&&r!=="dot";return a.jsxs("div",{ref:v,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:[O?null:k,a.jsx("div",{className:"grid gap-1.5",children:e.filter(j=>j.type!=="none").map((j,T)=>{const A=`${p||j.name||j.dataKey||"value"}`,_=o2(b,j,A),D=m||j.payload.fill||j.color;return a.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&&j?.value!==void 0&&j.name?h(j.value,j.name,j,T,j.payload):a.jsxs(a.Fragment,{children:[_?.icon?a.jsx(_.icon,{}):!i&&a.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":O&&r==="dashed"}),style:{"--color-bg":D,"--color-border":D}}),a.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",O?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[O?k:null,a.jsx("span",{className:"text-muted-foreground",children:_?.label||j.name})]}),j.value&&a.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:j.value.toLocaleString()})]})]})},j.dataKey)})})]})});_u.displayName="ChartTooltip";const I$=qI,cT=S.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:l}=oT();return n?.length?a.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(c=>c.type!=="none").map(c=>{const d=`${s||c.dataKey||"value"}`,h=o2(l,c,d);return a.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?a.jsx(h.icon,{}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:c.color}}),h?.label]},c.value)})}):null});cT.displayName="ChartLegend";function o2(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 $O=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,HO=d9,Nd=(t,e)=>n=>{var r;if(e?.variants==null)return HO(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,l=Object.keys(s).map(h=>{const m=n?.[h],p=i?.[h];if(m===null)return null;const x=$O(m)||$O(p);return s[h][x]}),c=n&&Object.entries(n).reduce((h,m)=>{let[p,x]=m;return x===void 0||(h[p]=x),h},{}),d=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,m)=>{let{class:p,className:x,...v}=m;return Object.entries(v).every(b=>{let[k,O]=b;return Array.isArray(O)?O.includes({...i,...c}[k]):{...i,...c}[k]===O})?[...h,p,x]:h},[]);return HO(t,l,d,n?.class,n?.className)},ff=Nd("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"}}),ie=S.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const l=r?GI:"button";return a.jsx(l,{className:ye(ff({variant:e,size:n,className:t})),ref:i,...s})});ie.displayName="Button";function q$(){const[t,e]=S.useState(null),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(24),[d,h]=S.useState(!0),[m,p]=S.useState(null),[x,v]=S.useState(!0),b=S.useCallback(async()=>{try{v(!0);const F=await Zn.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");p({hitokoto:F.data.hitokoto,from:F.data.from||F.data.from_who||"未知"})}catch(F){console.error("获取一言失败:",F),p({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{v(!1)}},[]),k=S.useCallback(async()=>{try{const F=localStorage.getItem("access-token"),L=await Zn.get(`/api/webui/statistics/dashboard?hours=${l}`,{headers:{Authorization:`Bearer ${F}`}});e(L.data),r(!1),i(100)}catch(F){console.error("Failed to fetch dashboard data:",F),r(!1),i(100)}},[l]);if(S.useEffect(()=>{if(!n)return;i(0);const F=setTimeout(()=>i(15),200),L=setTimeout(()=>i(30),800),U=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),ce=setTimeout(()=>i(75),6500),W=setTimeout(()=>i(85),9e3),J=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(F),clearTimeout(L),clearTimeout(U),clearTimeout(V),clearTimeout(ce),clearTimeout(W),clearTimeout(J)}},[n]),S.useEffect(()=>{k(),b()},[k,b]),S.useEffect(()=>{if(!d)return;const F=setInterval(()=>{k()},3e4);return()=>clearInterval(F)},[d,k]),n||!t)return a.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:a.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[a.jsx(Fi,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:s,className:"h-2"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:O,model_stats:j,hourly_data:T,daily_data:A,recent_activity:_}=t,D=F=>{const L=Math.floor(F/3600),U=Math.floor(F%3600/60);return`${L}小时${U}分钟`},E=F=>new Date(F).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),z=j.slice(0,6).map(F=>({name:F.model_name,value:F.request_count,fill:`hsl(var(--chart-${j.indexOf(F)%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 a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(hl,{value:l.toString(),onValueChange:F=>c(Number(F)),children:a.jsxs(ya,{className:"grid grid-cols-3 w-full sm:w-auto",children:[a.jsx($t,{value:"24",children:"24小时"}),a.jsx($t,{value:"168",children:"7天"}),a.jsx($t,{value:"720",children:"30天"})]})}),a.jsxs(ie,{variant:d?"default":"outline",size:"sm",onClick:()=>h(!d),className:"gap-2",children:[a.jsx(Fi,{className:`h-4 w-4 ${d?"animate-spin":""}`}),a.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:k,children:a.jsx(Fi,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总请求数"}),a.jsx(lq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:O.total_requests.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",l<48?l+"小时":Math.floor(l/24)+"天"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"总花费"}),a.jsx(oq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:["¥",O.total_cost.toFixed(2)]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.cost_per_hour>0?`¥${O.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"Token消耗"}),a.jsx(cq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[(O.total_tokens/1e3).toFixed(1),"K"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:O.tokens_per_hour>0?`${(O.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"平均响应"}),a.jsx(uf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsxs("div",{className:"text-2xl font-bold",children:[O.avg_response_time.toFixed(2),"s"]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"在线时长"}),a.jsx(dc,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsx(an,{children:a.jsx("div",{className:"text-xl font-bold",children:D(O.online_time)})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"消息处理"}),a.jsx(Wf,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages.toLocaleString()}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",O.total_replies.toLocaleString()," 条"]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"成本效率"}),a.jsx(uq,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-xl font-bold",children:O.total_messages>0?`¥${(O.total_cost/O.total_messages*100).toFixed(2)}`:"¥0.00"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),a.jsxs(hl,{defaultValue:"trends",className:"space-y-4",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[a.jsx($t,{value:"trends",children:"趋势"}),a.jsx($t,{value:"models",children:"模型"}),a.jsx($t,{value:"activity",children:"活动"}),a.jsx($t,{value:"daily",children:"日统计"})]}),a.jsxs(kn,{value:"trends",className:"space-y-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"请求趋势"}),a.jsxs(Sr,{children:["最近",l,"小时的请求量变化"]})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs(FI,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(QI,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"花费趋势"}),a.jsx(Sr,{children:"API调用成本变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"Token消耗"}),a.jsx(Sr,{children:"Token使用量变化"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:a.jsxs(fy,{data:T,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>E(F),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>E(F)})}),a.jsx(Gm,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),a.jsx(kn,{value:"models",className:"space-y-4",children:a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型请求分布"}),a.jsx(Sr,{children:"各模型使用占比"})]}),a.jsx(an,{children:a.jsx(Eu,{config:Object.fromEntries(j.slice(0,6).map((F,L)=>[F.model_name,{label:F.model_name,color:`hsl(var(--chart-${L%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:a.jsxs($I,{children:[a.jsx(Eh,{content:a.jsx(_u,{})}),a.jsx(HI,{data:z,cx:"50%",cy:"50%",labelLine:!1,label:({name:F,percent:L})=>`${F} ${L?(L*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:z.map((F,L)=>a.jsx(UI,{fill:F.fill},`cell-${L}`))})]})})})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"模型详细统计"}),a.jsx(Sr,{children:"请求数、花费和性能"})]}),a.jsx(an,{children:a.jsx(mn,{className:"h-[300px] sm:h-[400px]",children:a.jsx("div",{className:"space-y-3",children:j.map((F,L)=>a.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:F.model_name}),a.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${L%5+1}))`}})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),a.jsx("span",{className:"ml-1 font-medium",children:F.request_count.toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1 font-medium",children:["¥",F.total_cost.toFixed(2)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[(F.total_tokens/1e3).toFixed(1),"K"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),a.jsxs("span",{className:"ml-1 font-medium",children:[F.avg_response_time.toFixed(2),"s"]})]})]})]},L))})})})]})]})}),a.jsx(kn,{value:"activity",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"最近活动"}),a.jsx(Sr,{children:"最新的API调用记录"})]}),a.jsx(an,{children:a.jsx(mn,{className:"h-[400px] sm:h-[500px]",children:a.jsx("div",{className:"space-y-2",children:_.map((F,L)=>a.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm truncate",children:F.model}),a.jsx("div",{className:"text-xs text-muted-foreground",children:F.request_type})]}),a.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(F.timestamp)})]}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),a.jsx("span",{className:"ml-1",children:F.tokens})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"花费:"}),a.jsxs("span",{className:"ml-1",children:["¥",F.cost.toFixed(4)]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),a.jsxs("span",{className:"ml-1",children:[F.time_cost.toFixed(2),"s"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"状态:"}),a.jsx("span",{className:`ml-1 ${F.status==="success"?"text-green-600":"text-red-600"}`,children:F.status})]})]})]},L))})})})]})}),a.jsx(kn,{value:"daily",children:a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"每日统计"}),a.jsx(Sr,{children:"最近7天的数据汇总"})]}),a.jsx(an,{children:a.jsx(Eu,{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:a.jsxs(fy,{data:A,children:[a.jsx(Vm,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),a.jsx(Wm,{dataKey:"timestamp",tickFormatter:F=>{const L=new Date(F);return`${L.getMonth()+1}/${L.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ch,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),a.jsx(Eh,{content:a.jsx(_u,{labelFormatter:F=>new Date(F).toLocaleDateString("zh-CN")})}),a.jsx(I$,{content:a.jsx(cT,{})}),a.jsx(Gm,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),a.jsx(Gm,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),a.jsxs(gt,{className:"border-2 border-primary/20",children:[a.jsx(Wt,{className:"pb-3",children:a.jsx(Gt,{className:"text-lg",children:"每日一言"})}),a.jsx(an,{children:x?a.jsxs("div",{className:"space-y-2",children:[a.jsx(qO,{className:"h-6 w-3/4"}),a.jsx(qO,{className:"h-4 w-1/4"})]}):m?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',m.hitokoto,'"']}),a.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",m.from]})]}):null})]})]})})}const F$={theme:"system",setTheme:()=>null},uT=S.createContext(F$),dw=()=>{const t=S.useContext(uT);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},Q$=(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,l=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(${l}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},dT=S.createContext(void 0),hT=()=>{const t=S.useContext(dT);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var xx="Switch",[$$]=Vi(xx),[H$,U$]=$$(xx),fT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:h,form:m,...p}=t,[x,v]=S.useState(null),b=Cn(e,A=>v(A)),k=S.useRef(!1),O=x?m||!!x.closest("form"):!0,[j,T]=ko({prop:s,defaultProp:i??!1,onChange:h,caller:xx});return a.jsxs(H$,{scope:n,checked:j,disabled:c,children:[a.jsx(Zt.button,{type:"button",role:"switch","aria-checked":j,"aria-required":l,"data-state":xT(j),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:b,onClick:$e(t.onClick,A=>{T(_=>!_),O&&(k.current=A.isPropagationStopped(),k.current||A.stopPropagation())})}),O&&a.jsx(gT,{control:x,bubbles:!k.current,name:r,value:d,checked:j,required:l,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});fT.displayName=xx;var mT="SwitchThumb",pT=S.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=U$(mT,n);return a.jsx(Zt.span,{"data-state":xT(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});pT.displayName=mT;var V$="SwitchBubbleInput",gT=S.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const l=S.useRef(null),c=Cn(l,i),d=f9(n),h=m9(e);return S.useEffect(()=>{const m=l.current;if(!m)return;const p=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==n&&v){const b=new Event("click",{bubbles:r});v.call(m,n),m.dispatchEvent(b)}},[d,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gT.displayName=V$;function xT(t){return t?"checked":"unchecked"}var vT=fT,W$=pT;const jt=S.forwardRef(({className:t,...e},n)=>a.jsx(vT,{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:a.jsx(W$,{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")})}));jt.displayName=vT.displayName;const G$=Nd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),te=S.forwardRef(({className:t,...e},n)=>a.jsx(p9,{ref:n,className:ye(G$(),t),...e}));te.displayName=p9.displayName;const Me=S.forwardRef(({className:t,type:e,...n},r)=>a.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}));Me.displayName="Input";const X$=1,Y$=1e6;let Oy=0;function K$(){return Oy=(Oy+1)%Number.MAX_SAFE_INTEGER,Oy.toString()}const jy=new Map,UO=t=>{if(jy.has(t))return;const e=setTimeout(()=>{jy.delete(t),Kh({type:"REMOVE_TOAST",toastId:t})},Y$);jy.set(t,e)},Z$=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,X$)};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?UO(n):t.toasts.forEach(r=>{UO(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)}}},Vp=[];let Wp={toasts:[]};function Kh(t){Wp=Z$(Wp,t),Vp.forEach(e=>{e(Wp)})}function J$({...t}){const e=K$(),n=s=>Kh({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>Kh({type:"DISMISS_TOAST",toastId:e});return Kh({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Pr(){const[t,e]=S.useState(Wp);return S.useEffect(()=>(Vp.push(e),()=>{const n=Vp.indexOf(e);n>-1&&Vp.splice(n,1)}),[t]),{...t,toast:J$,dismiss:n=>Kh({type:"DISMISS_TOAST",toastId:n})}}const eH=[{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 tH(t){const e=eH.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 hw="0.11.5 Beta",fw="MaiBot Dashboard",nH=`${fw} v${hw}`,rH=(t="v")=>`${t}${hw}`,Rr=W4,mw=g9,sH=$4,yT=S.forwardRef(({className:t,...e},n)=>a.jsx(nx,{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}));yT.displayName=nx.displayName;const Nr=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(sH,{children:[a.jsx(yT,{}),a.jsxs(rx,{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,a.jsxs(H4,{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:[a.jsx(Gf,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nr.displayName=rx.displayName;const Cr=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Cr.displayName="DialogHeader";const ps=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ps.displayName="DialogFooter";const Tr=S.forwardRef(({className:t,...e},n)=>a.jsx(U4,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));Tr.displayName=U4.displayName;const Gr=S.forwardRef(({className:t,...e},n)=>a.jsx(V4,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Gr.displayName=V4.displayName;var iH=Symbol("radix.slottable");function aH(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=iH,e}var bT="AlertDialog",[lH]=Vi(bT,[x9]),bl=x9(),wT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx(W4,{...r,...n,modal:!0})};wT.displayName=bT;var oH="AlertDialogTrigger",ST=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(g9,{...s,...r,ref:e})});ST.displayName=oH;var cH="AlertDialogPortal",kT=t=>{const{__scopeAlertDialog:e,...n}=t,r=bl(e);return a.jsx($4,{...r,...n})};kT.displayName=cH;var uH="AlertDialogOverlay",OT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(nx,{...s,...r,ref:e})});OT.displayName=uH;var Uu="AlertDialogContent",[dH,hH]=lH(Uu),fH=aH("AlertDialogContent"),jT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=bl(n),l=S.useRef(null),c=Cn(e,l),d=S.useRef(null);return a.jsx(XI,{contentName:Uu,titleName:NT,docsSlug:"alert-dialog",children:a.jsx(dH,{scope:n,cancelRef:d,children:a.jsxs(rx,{role:"alertdialog",...i,...s,ref:c,onOpenAutoFocus:$e(s.onOpenAutoFocus,h=>{h.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[a.jsx(fH,{children:r}),a.jsx(pH,{contentRef:l})]})})})});jT.displayName=Uu;var NT="AlertDialogTitle",CT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(U4,{...s,...r,ref:e})});CT.displayName=NT;var TT="AlertDialogDescription",AT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(V4,{...s,...r,ref:e})});AT.displayName=TT;var mH="AlertDialogAction",MT=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=bl(n);return a.jsx(H4,{...s,...r,ref:e})});MT.displayName=mH;var ET="AlertDialogCancel",_T=S.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=hH(ET,n),i=bl(n),l=Cn(e,s);return a.jsx(H4,{...i,...r,ref:l})});_T.displayName=ET;var pH=({contentRef:t})=>{const e=`\`${Uu}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${Uu}\` by passing a \`${TT}\` 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 \`${Uu}\`. 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 S.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},gH=wT,xH=ST,vH=kT,DT=OT,RT=jT,zT=MT,PT=_T,BT=CT,LT=AT;const mn=gH,jr=xH,yH=vH,IT=S.forwardRef(({className:t,...e},n)=>a.jsx(DT,{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}));IT.displayName=DT.displayName;const ln=S.forwardRef(({className:t,...e},n)=>a.jsxs(yH,{children:[a.jsx(IT,{}),a.jsx(RT,{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})]}));ln.displayName=RT.displayName;const on=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});on.displayName="AlertDialogHeader";const cn=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});cn.displayName="AlertDialogFooter";const un=S.forwardRef(({className:t,...e},n)=>a.jsx(BT,{ref:n,className:ye("text-lg font-semibold",t),...e}));un.displayName=BT.displayName;const dn=S.forwardRef(({className:t,...e},n)=>a.jsx(LT,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));dn.displayName=LT.displayName;const hn=S.forwardRef(({className:t,...e},n)=>a.jsx(zT,{ref:n,className:ye(ff(),t),...e}));hn.displayName=zT.displayName;const fn=S.forwardRef(({className:t,...e},n)=>a.jsx(PT,{ref:n,className:ye(ff({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));fn.displayName=PT.displayName;function bH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),a.jsxs(hl,{defaultValue:"appearance",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[a.jsxs($t,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(_9,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"外观"})]}),a.jsxs($t,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(dq,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"安全"})]}),a.jsxs($t,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(Ii,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"其他"})]}),a.jsxs($t,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(co,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"关于"})]})]}),a.jsxs(vn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[a.jsx(kn,{value:"appearance",className:"mt-0",children:a.jsx(wH,{})}),a.jsx(kn,{value:"security",className:"mt-0",children:a.jsx(SH,{})}),a.jsx(kn,{value:"other",className:"mt-0",children:a.jsx(kH,{})}),a.jsx(kn,{value:"about",className:"mt-0",children:a.jsx(OH,{})})]})]})]})}function VO(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 l=parseInt(i.substring(0,2),16)/255,c=parseInt(i.substring(2,4),16)/255,d=parseInt(i.substring(4,6),16)/255,h=Math.max(l,c,d),m=Math.min(l,c,d);let p=0,x=0;const v=(h+m)/2;if(h!==m){const b=h-m;switch(x=v>.5?b/(2-h-m):b/(h+m),h){case l:p=((c-d)/b+(clocalStorage.getItem("accent-color")||"blue");S.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";VO(h)},[]);const d=h=>{c(h),localStorage.setItem("accent-color",h),VO(h)};return a.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[a.jsx(Ny,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),a.jsx(Ny,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),a.jsx(Ny,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"blue",current:l,onChange:d,label:"蓝色",colorClass:"bg-blue-500"}),a.jsx(vi,{value:"purple",current:l,onChange:d,label:"紫色",colorClass:"bg-purple-500"}),a.jsx(vi,{value:"green",current:l,onChange:d,label:"绿色",colorClass:"bg-green-500"}),a.jsx(vi,{value:"orange",current:l,onChange:d,label:"橙色",colorClass:"bg-orange-500"}),a.jsx(vi,{value:"pink",current:l,onChange:d,label:"粉色",colorClass:"bg-pink-500"}),a.jsx(vi,{value:"red",current:l,onChange:d,label:"红色",colorClass:"bg-red-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"gradient-sunset",current:l,onChange:d,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),a.jsx(vi,{value:"gradient-ocean",current:l,onChange:d,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),a.jsx(vi,{value:"gradient-forest",current:l,onChange:d,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),a.jsx(vi,{value:"gradient-aurora",current:l,onChange:d,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),a.jsx(vi,{value:"gradient-fire",current:l,onChange:d,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),a.jsx(vi,{value:"gradient-twilight",current:l,onChange:d,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"color",value:l.startsWith("#")?l:"#3b82f6",onChange:h=>d(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),a.jsx("div",{className:"flex-1",children:a.jsx(Me,{type:"text",value:l,onChange:h=>d(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),a.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[a.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),a.jsx(jt,{id:"animations",checked:n,onCheckedChange:r})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),a.jsx(jt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function SH(){const t=wa(),[e,n]=S.useState(""),[r,s]=S.useState(""),[i,l]=S.useState(!1),[c,d]=S.useState(!1),[h,m]=S.useState(!1),[p,x]=S.useState(!1),[v,b]=S.useState(!1),[k,O]=S.useState(!1),[j,T]=S.useState(""),[A,_]=S.useState(!1),{toast:D}=Pr(),E=S.useMemo(()=>tH(r),[r]),R=()=>localStorage.getItem("access-token")||"",Q=async W=>{try{await navigator.clipboard.writeText(W),b(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>b(!1),2e3)}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},F=async()=>{if(!r.trim()){D({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const W=E.rules.filter(J=>!J.passed).map(J=>J.label).join(", ");D({title:"格式错误",description:`Token 不符合要求: ${W}`,variant:"destructive"});return}m(!0);try{const W=R(),J=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`},body:JSON.stringify({new_token:r.trim()})}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),D({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):D({title:"更新失败",description:$.message||"无法更新 Token",variant:"destructive"})}catch(W){console.error("更新 Token 错误:",W),D({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{m(!1)}},L=async()=>{x(!0);try{const W=R(),J=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`}}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",$.token),n($.token),T($.token),O(!0),_(!1),D({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):D({title:"生成失败",description:$.message||"无法生成新 Token",variant:"destructive"})}catch(W){console.error("生成 Token 错误:",W),D({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{x(!1)}},U=async()=>{try{await navigator.clipboard.writeText(j),_(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{O(!1),setTimeout(()=>{T(""),_(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},de=W=>{W||V()};return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsx(Rr,{open:k,onOpenChange:de,children:a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(Hu,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),a.jsx(Gr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[a.jsx(te,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),a.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:j})]}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Hu,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"重要提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),a.jsx("li",{children:"请立即复制并保存到安全的位置"}),a.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),a.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),a.jsxs(ps,{className:"gap-2 sm:gap-0",children:[a.jsx(ie,{variant:"outline",onClick:U,className:"gap-2",children:A?a.jsxs(a.Fragment,{children:[a.jsx(hc,{className:"h-4 w-4 text-green-500"}),"已复制"]}):a.jsxs(a.Fragment,{children:[a.jsx(Xb,{className:"h-4 w-4"}),"复制 Token"]})}),a.jsx(ie,{onClick:V,children:"我已保存,关闭"})]})]})}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),a.jsx("div",{className:"space-y-3 sm:space-y-4",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Me,{id:"current-token",type:i?"text":"password",value:e||R(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),a.jsx("button",{onClick:()=>{e||n(R()),l(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsx(ie,{variant:"outline",size:"icon",onClick:()=>Q(R()),title:"复制到剪贴板",className:"flex-shrink-0",children:v?a.jsx(hc,{className:"h-4 w-4 text-green-500"}):a.jsx(Xb,{className:"h-4 w-4"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:p,className:"gap-2 flex-1 sm:flex-none",children:[a.jsx(Fi,{className:ye("h-4 w-4",p&&"animate-spin")}),a.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),a.jsx("span",{className:"sm:hidden",children:"生成"})]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新生成 Token"}),a.jsx(dn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:L,children:"确认生成"})]})]})]})]})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),a.jsxs("div",{className:"relative",children:[a.jsx(Me,{id:"new-token",type:c?"text":"password",value:r,onChange:W=>s(W.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),a.jsx("button",{onClick:()=>d(!c),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:c?"隐藏":"显示",children:c?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&a.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),a.jsx("div",{className:"space-y-1.5",children:E.rules.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[W.passed?a.jsx(Es,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):a.jsx(Kb,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),a.jsx("span",{className:ye(W.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:W.label})]},W.id))}),E.isValid&&a.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[a.jsx(hc,{className:"h-4 w-4"}),a.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),a.jsx(ie,{onClick:F,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),a.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:[a.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),a.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),a.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),a.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),a.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),a.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),a.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function kH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(!1),s=async()=>{r(!0);try{const i=localStorage.getItem("access-token"),l=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${i}`}}),c=await l.json();l.ok&&c.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:c.message||"无法重置配置状态",variant:"destructive"})}catch(i){console.error("重置配置状态错误:",i),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return a.jsx("div",{className:"space-y-4 sm:space-y-6",children:a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsx("div",{className:"space-y-2",children:a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:n,className:"gap-2",children:[a.jsx(hq,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新配置"}),a.jsx(dn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:s,children:"确认重置"})]})]})]})]})]})})}function OH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",fw]}),a.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("p",{children:["版本: ",hw]}),a.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),a.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",a.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"React 19.2.0"}),a.jsx("li",{children:"TypeScript 5.7.2"}),a.jsx("li",{children:"Vite 6.0.7"}),a.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"shadcn/ui"}),a.jsx("li",{children:"Radix UI"}),a.jsx("li",{children:"Tailwind CSS 3.4.17"}),a.jsx("li",{children:"Lucide Icons"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"后端"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Python 3.12+"}),a.jsx("li",{children:"FastAPI"}),a.jsx("li",{children:"Uvicorn"}),a.jsx("li",{children:"WebSocket"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Bun / npm"}),a.jsx("li",{children:"ESLint 9.17.0"}),a.jsx("li",{children:"PostCSS"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),a.jsx(vn,{className:"h-[300px] sm:h-[400px]",children:a.jsxs("div",{className:"space-y-4 pr-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React",description:"用户界面构建库",license:"MIT"}),a.jsx(Gn,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),a.jsx(Gn,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),a.jsx(Gn,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),a.jsx(Gn,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),a.jsx(Gn,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),a.jsx(Gn,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),a.jsx(Gn,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),a.jsx(Gn,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),a.jsx(Gn,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),a.jsx(Gn,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),a.jsx(Gn,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),a.jsx(Gn,{name:"Pydantic",description:"数据验证库",license:"MIT"}),a.jsx(Gn,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),a.jsx(Gn,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),a.jsx(Gn,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),a.jsx(Gn,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:a.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Gn({name:t,description:e,license:n}){return a.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-foreground truncate",children:t}),a.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),a.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 Ny({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return a.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&&a.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),a.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),a.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function vi({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return a.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&&a.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"}),a.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[a.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),a.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class jH{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),l=this.fade(n),c=this.perm[r]+s,d=this.perm[c],h=this.perm[c+1],m=this.perm[r+1]+s,p=this.perm[m],x=this.perm[m+1];return this.mix(this.mix(this.dot(this.grad3[d%12],e,n),this.dot(this.grad3[p%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[x%12],e-1,n-1),i),l)}}function NH(){const t=S.useRef(null),e=S.useRef(null),n=S.useRef(void 0),r=S.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 jH(Math.random()),bounding:null});return S.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const l=r.current,c=()=>{const k=s.getBoundingClientRect();l.bounding=k,i.style.width=`${k.width}px`,i.style.height=`${k.height}px`},d=()=>{if(!l.bounding)return;const{width:k,height:O}=l.bounding;l.lines=[],l.paths.forEach(F=>F.remove()),l.paths=[];const j=10,T=32,A=k+200,_=O+30,D=Math.ceil(A/j),E=Math.ceil(_/T),R=(k-j*D)/2,Q=(O-T*E)/2;for(let F=0;F<=D;F++){const L=[];for(let V=0;V<=E;V++){const de={x:R+j*F,y:Q+T*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};L.push(de)}const U=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(U),l.paths.push(U),l.lines.push(L)}},h=k=>{const{lines:O,mouse:j,noise:T}=l;O.forEach(A=>{A.forEach(_=>{const D=T.perlin2((_.x+k*.0125)*.002,(_.y+k*.005)*.0015)*12;_.wave.x=Math.cos(D)*32,_.wave.y=Math.sin(D)*16;const E=_.x-j.sx,R=_.y-j.sy,Q=Math.hypot(E,R),F=Math.max(175,j.vs);if(Q{const j={x:k.x+k.wave.x+(O?k.cursor.x:0),y:k.y+k.wave.y+(O?k.cursor.y:0)};return j.x=Math.round(j.x*10)/10,j.y=Math.round(j.y*10)/10,j},p=()=>{const{lines:k,paths:O}=l;k.forEach((j,T)=>{let A=m(j[0],!1),_=`M ${A.x} ${A.y}`;j.forEach((D,E)=>{const R=E===j.length-1;A=m(D,!R),_+=`L ${A.x} ${A.y}`}),O[T].setAttribute("d",_)})},x=k=>{const{mouse:O}=l;O.sx+=(O.x-O.sx)*.1,O.sy+=(O.y-O.sy)*.1;const j=O.x-O.lx,T=O.y-O.ly,A=Math.hypot(j,T);O.v=A,O.vs+=(A-O.vs)*.1,O.vs=Math.min(100,O.vs),O.lx=O.x,O.ly=O.y,O.a=Math.atan2(T,j),s&&(s.style.setProperty("--x",`${O.sx}px`),s.style.setProperty("--y",`${O.sy}px`)),h(k),p(),n.current=requestAnimationFrame(x)},v=k=>{if(!l.bounding)return;const{mouse:O}=l;O.x=k.pageX-l.bounding.left,O.y=k.pageY-l.bounding.top+window.scrollY,O.set||(O.sx=O.x,O.sy=O.y,O.lx=O.x,O.ly=O.y,O.set=!0)},b=()=>{c(),d()};return c(),d(),window.addEventListener("resize",b),window.addEventListener("mousemove",v),n.current=requestAnimationFrame(x),()=>{window.removeEventListener("resize",b),window.removeEventListener("mousemove",v),n.current&&cancelAnimationFrame(n.current)}},[]),a.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[a.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"}}),a.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:a.jsx("style",{children:` +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return S.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},gH=wT,xH=ST,vH=kT,DT=OT,RT=jT,zT=MT,PT=_T,BT=CT,LT=AT;const pn=gH,jr=xH,yH=vH,IT=S.forwardRef(({className:t,...e},n)=>a.jsx(DT,{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}));IT.displayName=DT.displayName;const ln=S.forwardRef(({className:t,...e},n)=>a.jsxs(yH,{children:[a.jsx(IT,{}),a.jsx(RT,{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})]}));ln.displayName=RT.displayName;const on=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});on.displayName="AlertDialogHeader";const cn=({className:t,...e})=>a.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});cn.displayName="AlertDialogFooter";const un=S.forwardRef(({className:t,...e},n)=>a.jsx(BT,{ref:n,className:ye("text-lg font-semibold",t),...e}));un.displayName=BT.displayName;const dn=S.forwardRef(({className:t,...e},n)=>a.jsx(LT,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));dn.displayName=LT.displayName;const hn=S.forwardRef(({className:t,...e},n)=>a.jsx(zT,{ref:n,className:ye(ff(),t),...e}));hn.displayName=zT.displayName;const fn=S.forwardRef(({className:t,...e},n)=>a.jsx(PT,{ref:n,className:ye(ff({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));fn.displayName=PT.displayName;function bH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),a.jsxs(hl,{defaultValue:"appearance",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[a.jsxs($t,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(_9,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"外观"})]}),a.jsxs($t,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(dq,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"安全"})]}),a.jsxs($t,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(Ii,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"其他"})]}),a.jsxs($t,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[a.jsx(co,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),a.jsx("span",{children:"关于"})]})]}),a.jsxs(mn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[a.jsx(kn,{value:"appearance",className:"mt-0",children:a.jsx(wH,{})}),a.jsx(kn,{value:"security",className:"mt-0",children:a.jsx(SH,{})}),a.jsx(kn,{value:"other",className:"mt-0",children:a.jsx(kH,{})}),a.jsx(kn,{value:"about",className:"mt-0",children:a.jsx(OH,{})})]})]})]})}function VO(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 l=parseInt(i.substring(0,2),16)/255,c=parseInt(i.substring(2,4),16)/255,d=parseInt(i.substring(4,6),16)/255,h=Math.max(l,c,d),m=Math.min(l,c,d);let p=0,x=0;const v=(h+m)/2;if(h!==m){const b=h-m;switch(x=v>.5?b/(2-h-m):b/(h+m),h){case l:p=((c-d)/b+(clocalStorage.getItem("accent-color")||"blue");S.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";VO(h)},[]);const d=h=>{c(h),localStorage.setItem("accent-color",h),VO(h)};return a.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[a.jsx(Ny,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),a.jsx(Ny,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),a.jsx(Ny,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"blue",current:l,onChange:d,label:"蓝色",colorClass:"bg-blue-500"}),a.jsx(vi,{value:"purple",current:l,onChange:d,label:"紫色",colorClass:"bg-purple-500"}),a.jsx(vi,{value:"green",current:l,onChange:d,label:"绿色",colorClass:"bg-green-500"}),a.jsx(vi,{value:"orange",current:l,onChange:d,label:"橙色",colorClass:"bg-orange-500"}),a.jsx(vi,{value:"pink",current:l,onChange:d,label:"粉色",colorClass:"bg-pink-500"}),a.jsx(vi,{value:"red",current:l,onChange:d,label:"红色",colorClass:"bg-red-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[a.jsx(vi,{value:"gradient-sunset",current:l,onChange:d,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),a.jsx(vi,{value:"gradient-ocean",current:l,onChange:d,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),a.jsx(vi,{value:"gradient-forest",current:l,onChange:d,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),a.jsx(vi,{value:"gradient-aurora",current:l,onChange:d,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),a.jsx(vi,{value:"gradient-fire",current:l,onChange:d,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),a.jsx(vi,{value:"gradient-twilight",current:l,onChange:d,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"color",value:l.startsWith("#")?l:"#3b82f6",onChange:h=>d(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),a.jsx("div",{className:"flex-1",children:a.jsx(Me,{type:"text",value:l,onChange:h=>d(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),a.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[a.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),a.jsx(jt,{id:"animations",checked:n,onCheckedChange:r})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5 flex-1",children:[a.jsx(te,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),a.jsx(jt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function SH(){const t=wa(),[e,n]=S.useState(""),[r,s]=S.useState(""),[i,l]=S.useState(!1),[c,d]=S.useState(!1),[h,m]=S.useState(!1),[p,x]=S.useState(!1),[v,b]=S.useState(!1),[k,O]=S.useState(!1),[j,T]=S.useState(""),[A,_]=S.useState(!1),{toast:D}=Pr(),E=S.useMemo(()=>tH(r),[r]),z=()=>localStorage.getItem("access-token")||"",Q=async W=>{try{await navigator.clipboard.writeText(W),b(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>b(!1),2e3)}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},F=async()=>{if(!r.trim()){D({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const W=E.rules.filter(J=>!J.passed).map(J=>J.label).join(", ");D({title:"格式错误",description:`Token 不符合要求: ${W}`,variant:"destructive"});return}m(!0);try{const W=z(),J=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`},body:JSON.stringify({new_token:r.trim()})}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),D({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):D({title:"更新失败",description:$.message||"无法更新 Token",variant:"destructive"})}catch(W){console.error("更新 Token 错误:",W),D({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{m(!1)}},L=async()=>{x(!0);try{const W=z(),J=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`}}),$=await J.json();J.ok&&$.success?(localStorage.setItem("access-token",$.token),n($.token),T($.token),O(!0),_(!1),D({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):D({title:"生成失败",description:$.message||"无法生成新 Token",variant:"destructive"})}catch(W){console.error("生成 Token 错误:",W),D({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{x(!1)}},U=async()=>{try{await navigator.clipboard.writeText(j),_(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{O(!1),setTimeout(()=>{T(""),_(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},ce=W=>{W||V()};return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsx(Rr,{open:k,onOpenChange:ce,children:a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(Hu,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),a.jsx(Gr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[a.jsx(te,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),a.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:j})]}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Hu,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"重要提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),a.jsx("li",{children:"请立即复制并保存到安全的位置"}),a.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),a.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),a.jsxs(ps,{className:"gap-2 sm:gap-0",children:[a.jsx(ie,{variant:"outline",onClick:U,className:"gap-2",children:A?a.jsxs(a.Fragment,{children:[a.jsx(hc,{className:"h-4 w-4 text-green-500"}),"已复制"]}):a.jsxs(a.Fragment,{children:[a.jsx(Xb,{className:"h-4 w-4"}),"复制 Token"]})}),a.jsx(ie,{onClick:V,children:"我已保存,关闭"})]})]})}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),a.jsx("div",{className:"space-y-3 sm:space-y-4",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Me,{id:"current-token",type:i?"text":"password",value:e||z(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),a.jsx("button",{onClick:()=>{e||n(z()),l(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsx(ie,{variant:"outline",size:"icon",onClick:()=>Q(z()),title:"复制到剪贴板",className:"flex-shrink-0",children:v?a.jsx(hc,{className:"h-4 w-4 text-green-500"}):a.jsx(Xb,{className:"h-4 w-4"})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:p,className:"gap-2 flex-1 sm:flex-none",children:[a.jsx(Fi,{className:ye("h-4 w-4",p&&"animate-spin")}),a.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),a.jsx("span",{className:"sm:hidden",children:"生成"})]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新生成 Token"}),a.jsx(dn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:L,children:"确认生成"})]})]})]})]})]}),a.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),a.jsxs("div",{className:"relative",children:[a.jsx(Me,{id:"new-token",type:c?"text":"password",value:r,onChange:W=>s(W.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),a.jsx("button",{onClick:()=>d(!c),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:c?"隐藏":"显示",children:c?a.jsx(Yb,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($i,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&a.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),a.jsx("div",{className:"space-y-1.5",children:E.rules.map(W=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[W.passed?a.jsx(Es,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):a.jsx(Kb,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),a.jsx("span",{className:ye(W.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:W.label})]},W.id))}),E.isValid&&a.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[a.jsx(hc,{className:"h-4 w-4"}),a.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),a.jsx(ie,{onClick:F,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),a.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:[a.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),a.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),a.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),a.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),a.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),a.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),a.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function kH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(!1),s=async()=>{r(!0);try{const i=localStorage.getItem("access-token"),l=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${i}`}}),c=await l.json();l.ok&&c.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:c.message||"无法重置配置状态",variant:"destructive"})}catch(i){console.error("重置配置状态错误:",i),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return a.jsx("div",{className:"space-y-4 sm:space-y-6",children:a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),a.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[a.jsx("div",{className:"space-y-2",children:a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{variant:"outline",disabled:n,className:"gap-2",children:[a.jsx(hq,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重新配置"}),a.jsx(dn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:s,children:"确认重置"})]})]})]})]})]})})}function OH(){return a.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",fw]}),a.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("p",{children:["版本: ",hw]}),a.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),a.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",a.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"React 19.2.0"}),a.jsx("li",{children:"TypeScript 5.7.2"}),a.jsx("li",{children:"Vite 6.0.7"}),a.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"shadcn/ui"}),a.jsx("li",{children:"Radix UI"}),a.jsx("li",{children:"Tailwind CSS 3.4.17"}),a.jsx("li",{children:"Lucide Icons"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"后端"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Python 3.12+"}),a.jsx("li",{children:"FastAPI"}),a.jsx("li",{children:"Uvicorn"}),a.jsx("li",{children:"WebSocket"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),a.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[a.jsx("li",{children:"Bun / npm"}),a.jsx("li",{children:"ESLint 9.17.0"}),a.jsx("li",{children:"PostCSS"})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),a.jsx(mn,{className:"h-[300px] sm:h-[400px]",children:a.jsxs("div",{className:"space-y-4 pr-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React",description:"用户界面构建库",license:"MIT"}),a.jsx(Gn,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),a.jsx(Gn,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),a.jsx(Gn,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),a.jsx(Gn,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),a.jsx(Gn,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),a.jsx(Gn,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),a.jsx(Gn,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),a.jsx(Gn,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),a.jsx(Gn,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),a.jsx(Gn,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),a.jsx(Gn,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),a.jsx(Gn,{name:"Pydantic",description:"数据验证库",license:"MIT"}),a.jsx(Gn,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),a.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[a.jsx(Gn,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),a.jsx(Gn,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),a.jsx(Gn,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),a.jsx(Gn,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[a.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:a.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Gn({name:t,description:e,license:n}){return a.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-foreground truncate",children:t}),a.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),a.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 Ny({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return a.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&&a.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),a.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),a.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),a.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function vi({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return a.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&&a.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"}),a.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[a.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),a.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class jH{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),l=this.fade(n),c=this.perm[r]+s,d=this.perm[c],h=this.perm[c+1],m=this.perm[r+1]+s,p=this.perm[m],x=this.perm[m+1];return this.mix(this.mix(this.dot(this.grad3[d%12],e,n),this.dot(this.grad3[p%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[x%12],e-1,n-1),i),l)}}function NH(){const t=S.useRef(null),e=S.useRef(null),n=S.useRef(void 0),r=S.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 jH(Math.random()),bounding:null});return S.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const l=r.current,c=()=>{const k=s.getBoundingClientRect();l.bounding=k,i.style.width=`${k.width}px`,i.style.height=`${k.height}px`},d=()=>{if(!l.bounding)return;const{width:k,height:O}=l.bounding;l.lines=[],l.paths.forEach(F=>F.remove()),l.paths=[];const j=10,T=32,A=k+200,_=O+30,D=Math.ceil(A/j),E=Math.ceil(_/T),z=(k-j*D)/2,Q=(O-T*E)/2;for(let F=0;F<=D;F++){const L=[];for(let V=0;V<=E;V++){const ce={x:z+j*F,y:Q+T*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};L.push(ce)}const U=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(U),l.paths.push(U),l.lines.push(L)}},h=k=>{const{lines:O,mouse:j,noise:T}=l;O.forEach(A=>{A.forEach(_=>{const D=T.perlin2((_.x+k*.0125)*.002,(_.y+k*.005)*.0015)*12;_.wave.x=Math.cos(D)*32,_.wave.y=Math.sin(D)*16;const E=_.x-j.sx,z=_.y-j.sy,Q=Math.hypot(E,z),F=Math.max(175,j.vs);if(Q{const j={x:k.x+k.wave.x+(O?k.cursor.x:0),y:k.y+k.wave.y+(O?k.cursor.y:0)};return j.x=Math.round(j.x*10)/10,j.y=Math.round(j.y*10)/10,j},p=()=>{const{lines:k,paths:O}=l;k.forEach((j,T)=>{let A=m(j[0],!1),_=`M ${A.x} ${A.y}`;j.forEach((D,E)=>{const z=E===j.length-1;A=m(D,!z),_+=`L ${A.x} ${A.y}`}),O[T].setAttribute("d",_)})},x=k=>{const{mouse:O}=l;O.sx+=(O.x-O.sx)*.1,O.sy+=(O.y-O.sy)*.1;const j=O.x-O.lx,T=O.y-O.ly,A=Math.hypot(j,T);O.v=A,O.vs+=(A-O.vs)*.1,O.vs=Math.min(100,O.vs),O.lx=O.x,O.ly=O.y,O.a=Math.atan2(T,j),s&&(s.style.setProperty("--x",`${O.sx}px`),s.style.setProperty("--y",`${O.sy}px`)),h(k),p(),n.current=requestAnimationFrame(x)},v=k=>{if(!l.bounding)return;const{mouse:O}=l;O.x=k.pageX-l.bounding.left,O.y=k.pageY-l.bounding.top+window.scrollY,O.set||(O.sx=O.x,O.sy=O.y,O.lx=O.x,O.ly=O.y,O.set=!0)},b=()=>{c(),d()};return c(),d(),window.addEventListener("resize",b),window.addEventListener("mousemove",v),n.current=requestAnimationFrame(x),()=>{window.removeEventListener("resize",b),window.removeEventListener("mousemove",v),n.current&&cancelAnimationFrame(n.current)}},[]),a.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[a.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"}}),a.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:a.jsx("style",{children:` path { fill: none; stroke: hsl(var(--primary) / 0.20); stroke-width: 1px; } - `})})]})}function CH(){const t=wa();S.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function qT(){return!!localStorage.getItem("access-token")}function TH(){const[t,e]=S.useState(""),[n,r]=S.useState(!1),[s,i]=S.useState(""),l=wa(),{enableWavesBackground:c,setEnableWavesBackground:d}=hT(),{theme:h,setTheme:m}=dw();S.useEffect(()=>{qT()&&l({to:"/"})},[l]);const x=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,v=()=>{m(x==="dark"?"light":"dark")},b=async k=>{if(k.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const O=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),j=await O.json();if(O.ok&&j.valid){localStorage.setItem("access-token",t.trim());const T=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),A=await T.json();T.ok&&A.is_first_setup?l({to:"/setup"}):l({to:"/"})}else i(j.message||"Token 验证失败,请检查后重试")}catch(O){console.error("Token 验证错误:",O),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return a.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[c&&a.jsx(NH,{}),a.jsxs(gt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[a.jsx("button",{onClick:v,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?a.jsx(Zb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):a.jsx(Jb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),a.jsxs(Wt,{className:"space-y-4 text-center",children:[a.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(lO,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Gt,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),a.jsx(Sr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),a.jsx(an,{children:a.jsxs("form",{onSubmit:b,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),a.jsxs("div",{className:"relative",children:[a.jsx(fq,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),a.jsx(Me,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:k=>e(k.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&a.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:[a.jsx(xc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),a.jsx("span",{children:s})]}),a.jsx(ie,{type:"submit",className:"w-full",disabled:n,children:n?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),a.jsxs(Rr,{children:[a.jsx(mw,{asChild:!0,children:a.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:[a.jsx(mq,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(lO,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),a.jsx(Gr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(pq,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),a.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[a.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),a.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ao,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),a.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:a.jsx("code",{className:"text-primary",children:"data/webui.json"})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",a.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(xc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"安全提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),a.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.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:[a.jsx(uf,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsxs(un,{className:"flex items-center gap-2",children:[a.jsx(uf,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),a.jsx(dn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(!1),children:"关闭动画"})]})]})]})]})})]}),a.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:a.jsx("p",{children:nH})})]})}const _n=S.forwardRef(({className:t,...e},n)=>a.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}));_n.displayName="Textarea";var AH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],MH=AH.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),EH="Separator",WO="horizontal",_H=["horizontal","vertical"],FT=S.forwardRef((t,e)=>{const{decorative:n,orientation:r=WO,...s}=t,i=DH(r)?r:WO,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(MH.div,{"data-orientation":i,...c,...s,ref:e})});FT.displayName=EH;function DH(t){return _H.includes(t)}var QT=FT;const mf=S.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>a.jsx(QT,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));mf.displayName=QT.displayName;const RH=Nd("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 On({className:t,variant:e,...n}){return a.jsx("div",{className:ye(RH({variant:e}),t),...n})}function zH({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,l)=>l!==s)})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号 *"}),a.jsx(Me,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称 *"}),a.jsx(Me,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{children:"别名"}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>a.jsxs(On,{variant:"secondary",className:"gap-1",children:[s,a.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:a.jsx(Gf,{className:"h-3 w-3"})})]},i))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),a.jsx(ie,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function PH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"personality",children:"人格特征 *"}),a.jsx(_n,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格 *"}),a.jsx(_n,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣 *"}),a.jsx(_n,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"plan_style",children:"群聊说话规则 *"}),a.jsx(_n,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),a.jsx(_n,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function BH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),a.jsx(Me,{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)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大表情包数量"}),a.jsx(Me,{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)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"do_replace",children:"达到最大数量时替换"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"steal_emoji",children:"偷取表情包"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"content_filtration",children:"启用表情包过滤"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function LH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_tool",children:"启用工具系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),a.jsx(jt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_mood",children:"启用情绪系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),a.jsx(jt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&a.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),a.jsx(Me,{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)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"emotion_style",children:"情感特征"}),a.jsx(_n,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"all_global",children:"启用全局黑话模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),a.jsx(jt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}async function ot(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 bt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function IH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});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 qH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});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 FH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});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 QH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});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 $H(t){const e=await ot("/api/webui/config/bot/section/bot",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function HH(t){const e=await ot("/api/webui/config/bot/section/personality",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function UH(t){const e=await ot("/api/webui/config/bot/section/emoji",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function VH(t){const e=[];e.push(ot("/api/webui/config/bot/section/tool",{method:"POST",headers:bt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(ot("/api/webui/config/bot/section/jargon",{method:"POST",headers:bt(),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(ot("/api/webui/config/bot/section/mood",{method:"POST",headers:bt(),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 GO(){const t=localStorage.getItem("access-token"),e=await ot("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}function WH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!0),[m,p]=S.useState({qq_account:0,nickname:"",alias_names:[]}),[x,v]=S.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 + `})})]})}function CH(){const t=wa();S.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function qT(){return!!localStorage.getItem("access-token")}function TH(){const[t,e]=S.useState(""),[n,r]=S.useState(!1),[s,i]=S.useState(""),l=wa(),{enableWavesBackground:c,setEnableWavesBackground:d}=hT(),{theme:h,setTheme:m}=dw();S.useEffect(()=>{qT()&&l({to:"/"})},[l]);const x=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,v=()=>{m(x==="dark"?"light":"dark")},b=async k=>{if(k.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const O=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),j=await O.json();if(O.ok&&j.valid){localStorage.setItem("access-token",t.trim());const T=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),A=await T.json();T.ok&&A.is_first_setup?l({to:"/setup"}):l({to:"/"})}else i(j.message||"Token 验证失败,请检查后重试")}catch(O){console.error("Token 验证错误:",O),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return a.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[c&&a.jsx(NH,{}),a.jsxs(gt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[a.jsx("button",{onClick:v,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?a.jsx(Zb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):a.jsx(Jb,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),a.jsxs(Wt,{className:"space-y-4 text-center",children:[a.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(lO,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Gt,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),a.jsx(Sr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),a.jsx(an,{children:a.jsxs("form",{onSubmit:b,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),a.jsxs("div",{className:"relative",children:[a.jsx(fq,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),a.jsx(Me,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:k=>e(k.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&a.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:[a.jsx(xc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),a.jsx("span",{children:s})]}),a.jsx(ie,{type:"submit",className:"w-full",disabled:n,children:n?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),a.jsxs(Rr,{children:[a.jsx(mw,{asChild:!0,children:a.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:[a.jsx(mq,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),a.jsxs(Nr,{className:"sm:max-w-md",children:[a.jsxs(Cr,{children:[a.jsxs(Tr,{className:"flex items-center gap-2",children:[a.jsx(lO,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),a.jsx(Gr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(pq,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),a.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[a.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),a.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ao,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),a.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:a.jsx("code",{className:"text-primary",children:"data/webui.json"})}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",a.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),a.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(xc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),a.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:"安全提示"}),a.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[a.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),a.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.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:[a.jsx(uf,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsxs(un,{className:"flex items-center gap-2",children:[a.jsx(uf,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),a.jsx(dn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),a.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(!1),children:"关闭动画"})]})]})]})]})})]}),a.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:a.jsx("p",{children:nH})})]})}const _n=S.forwardRef(({className:t,...e},n)=>a.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}));_n.displayName="Textarea";var AH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],MH=AH.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),EH="Separator",WO="horizontal",_H=["horizontal","vertical"],FT=S.forwardRef((t,e)=>{const{decorative:n,orientation:r=WO,...s}=t,i=DH(r)?r:WO,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(MH.div,{"data-orientation":i,...c,...s,ref:e})});FT.displayName=EH;function DH(t){return _H.includes(t)}var QT=FT;const mf=S.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>a.jsx(QT,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));mf.displayName=QT.displayName;const RH=Nd("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 On({className:t,variant:e,...n}){return a.jsx("div",{className:ye(RH({variant:e}),t),...n})}function zH({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,l)=>l!==s)})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号 *"}),a.jsx(Me,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称 *"}),a.jsx(Me,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{children:"别名"}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>a.jsxs(On,{variant:"secondary",className:"gap-1",children:[s,a.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:a.jsx(Gf,{className:"h-3 w-3"})})]},i))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),a.jsx(ie,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function PH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"personality",children:"人格特征 *"}),a.jsx(_n,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格 *"}),a.jsx(_n,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣 *"}),a.jsx(_n,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"plan_style",children:"群聊说话规则 *"}),a.jsx(_n,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),a.jsx(_n,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function BH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),a.jsx(Me,{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)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大表情包数量"}),a.jsx(Me,{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)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"do_replace",children:"达到最大数量时替换"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"steal_emoji",children:"偷取表情包"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"content_filtration",children:"启用表情包过滤"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function LH({config:t,onChange:e}){return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_tool",children:"启用工具系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),a.jsx(jt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"enable_mood",children:"启用情绪系统"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),a.jsx(jt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&a.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),a.jsx(Me,{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)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(te,{htmlFor:"emotion_style",children:"情感特征"}),a.jsx(_n,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),a.jsx(mf,{}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(te,{htmlFor:"all_global",children:"启用全局黑话模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),a.jsx(jt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}async function ot(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 bt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function IH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});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 qH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});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 FH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});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 QH(){const t=await ot("/api/webui/config/bot",{method:"GET",headers:bt()});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 $H(t){const e=await ot("/api/webui/config/bot/section/bot",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function HH(t){const e=await ot("/api/webui/config/bot/section/personality",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function UH(t){const e=await ot("/api/webui/config/bot/section/emoji",{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function VH(t){const e=[];e.push(ot("/api/webui/config/bot/section/tool",{method:"POST",headers:bt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(ot("/api/webui/config/bot/section/jargon",{method:"POST",headers:bt(),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(ot("/api/webui/config/bot/section/mood",{method:"POST",headers:bt(),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 GO(){const t=localStorage.getItem("access-token"),e=await ot("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}function WH(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState(0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!0),[m,p]=S.useState({qq_account:0,nickname:"",alias_names:[]}),[x,v]=S.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.请控制你的发言频率,不要太过频繁的发言 4.如果有人对你感到厌烦,请减少回复 5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[b,k]=S.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[O,j]=S.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),T=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:xq},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:D9},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:K4},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Ii},{id:"complete",title:"完成设置",description:"后续配置提示",icon:uf}],A=(n+1)/T.length*100;S.useEffect(()=>{(async()=>{try{h(!0);const[U,V,de,W]=await Promise.all([IH(),qH(),FH(),QH()]);p(U),v(V),k(de),j(W)}catch(U){e({title:"加载配置失败",description:U instanceof Error?U.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const _=async()=>{c(!0);try{switch(n){case 0:await $H(m);break;case 1:await HH(x);break;case 2:await UH(b);break;case 3:await VH(O);break}return e({title:"保存成功",description:`${T[n].title}配置已保存`}),!0}catch(L){return e({title:"保存失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"}),!1}finally{c(!1)}},D=async()=>{await _()&&n{n>0&&r(n-1)},R=async()=>{i(!0);try{if(!await _()){i(!1);return}await GO(),e({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{t({to:"/"})},500)}catch(L){e({title:"完成失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}finally{i(!1)}},Q=async()=>{try{await GO(),t({to:"/"})}catch(L){e({title:"跳过失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},F=()=>{switch(n){case 0:return a.jsx(zH,{config:m,onChange:p});case 1:return a.jsx(PH,{config:x,onChange:v});case 2:return a.jsx(BH,{config:b,onChange:k});case 3:return a.jsx(LH,{config:O,onChange:j});case 4:return a.jsxs("div",{className:"space-y-6 text-center py-8",children:[a.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:a.jsx(uf,{className:"h-8 w-8 text-primary",strokeWidth:2})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"添加模型"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置模型任务"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return a.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:[a.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[a.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"}),a.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"})]}),d?a.jsxs("div",{className:"relative z-10 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:a.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),a.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),a.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[a.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[a.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:a.jsx(gq,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),a.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",fw," 的初始配置"]})]}),a.jsxs("div",{className:"mb-6 md:mb-8",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[a.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",T.length]}),a.jsxs("span",{className:"font-medium text-primary",children:[Math.round(A),"%"]})]}),a.jsx(n0,{value:A,className:"h-2"})]}),a.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:T.map((L,U)=>{const V=L.icon;return a.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",Ut({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[a.jsx(hg,{className:"h-4 w-4"}),"返回首页"]}),a.jsxs(ie,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[a.jsx(R9,{className:"h-4 w-4"}),"返回上一页"]})]}),a.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var HT=["PageUp","PageDown"],UT=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],VT={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Cd="Slider",[c2,GH,XH]=tx(Cd),[WT]=Vi(Cd,[XH]),[YH,vx]=WT(Cd),GT=S.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:l="horizontal",disabled:c=!1,minStepsBetweenThumbs:d=0,defaultValue:h=[r],value:m,onValueChange:p=()=>{},onValueCommit:x=()=>{},inverted:v=!1,form:b,...k}=t,O=S.useRef(new Set),j=S.useRef(0),A=l==="horizontal"?KH:ZH,[_=[],D]=ko({prop:m,defaultProp:h,onChange:U=>{[...O.current][j.current]?.focus(),p(U)}}),E=S.useRef(_);function R(U){const V=rU(_,U);L(U,V)}function Q(U){L(U,j.current)}function F(){const U=E.current[j.current];_[j.current]!==U&&x(_)}function L(U,V,{commit:de}={commit:!1}){const W=lU(i),J=oU(Math.round((U-r)/i)*i+r,W),$=F4(J,[r,s]);D((ae=[])=>{const ne=tU(ae,$,V);if(aU(ne,d*i)){j.current=ne.indexOf($);const ce=String(ne)!==String(ae);return ce&&de&&x(ne),ce?ne:ae}else return ae})}return a.jsx(YH,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:j,thumbs:O.current,values:_,orientation:l,form:b,children:a.jsx(c2.Provider,{scope:t.__scopeSlider,children:a.jsx(c2.Slot,{scope:t.__scopeSlider,children:a.jsx(A,{"aria-disabled":c,"data-disabled":c?"":void 0,...k,ref:e,onPointerDown:$e(k.onPointerDown,()=>{c||(E.current=_)}),min:r,max:s,inverted:v,onSlideStart:c?void 0:R,onSlideMove:c?void 0:Q,onSlideEnd:c?void 0:F,onHomeKeyDown:()=>!c&&L(r,0,{commit:!0}),onEndKeyDown:()=>!c&&L(s,_.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:V})=>{if(!c){const J=HT.includes(U.key)||U.shiftKey&&UT.includes(U.key)?10:1,$=j.current,ae=_[$],ne=i*J*V;L(ae+ne,$,{commit:!0})}}})})})})});GT.displayName=Cd;var[XT,YT]=WT(Cd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),KH=S.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:l,onSlideMove:c,onSlideEnd:d,onStepKeyDown:h,...m}=t,[p,x]=S.useState(null),v=Cn(e,A=>x(A)),b=S.useRef(void 0),k=Vf(s),O=k==="ltr",j=O&&!i||!O&&i;function T(A){const _=b.current||p.getBoundingClientRect(),D=[0,_.width],R=pw(D,j?[n,r]:[r,n]);return b.current=_,R(A-_.left)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:j?"left":"right",endEdge:j?"right":"left",direction:j?1:-1,size:"width",children:a.jsx(KT,{dir:k,"data-orientation":"horizontal",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:A=>{const _=T(A.clientX);l?.(_)},onSlideMove:A=>{const _=T(A.clientX);c?.(_)},onSlideEnd:()=>{b.current=void 0,d?.()},onStepKeyDown:A=>{const D=VT[j?"from-left":"from-right"].includes(A.key);h?.({event:A,direction:D?-1:1})}})})}),ZH=S.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...h}=t,m=S.useRef(null),p=Cn(e,m),x=S.useRef(void 0),v=!s;function b(k){const O=x.current||m.current.getBoundingClientRect(),j=[0,O.height],A=pw(j,v?[r,n]:[n,r]);return x.current=O,A(k-O.top)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:a.jsx(KT,{"data-orientation":"vertical",...h,ref:p,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const O=b(k.clientY);i?.(O)},onSlideMove:k=>{const O=b(k.clientY);l?.(O)},onSlideEnd:()=>{x.current=void 0,c?.()},onStepKeyDown:k=>{const j=VT[v?"from-bottom":"from-top"].includes(k.key);d?.({event:k,direction:j?-1:1})}})})}),KT=S.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:l,onEndKeyDown:c,onStepKeyDown:d,...h}=t,m=vx(Cd,n);return a.jsx(Zt.span,{...h,ref:e,onKeyDown:$e(t.onKeyDown,p=>{p.key==="Home"?(l(p),p.preventDefault()):p.key==="End"?(c(p),p.preventDefault()):HT.concat(UT).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:$e(t.onPointerDown,p=>{const x=p.target;x.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(x)?x.focus():r(p)}),onPointerMove:$e(t.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:$e(t.onPointerUp,p=>{const x=p.target;x.hasPointerCapture(p.pointerId)&&(x.releasePointerCapture(p.pointerId),i(p))})})}),ZT="SliderTrack",JT=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(ZT,n);return a.jsx(Zt.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});JT.displayName=ZT;var u2="SliderRange",eA=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(u2,n),i=YT(u2,n),l=S.useRef(null),c=Cn(e,l),d=s.values.length,h=s.values.map(x=>rA(x,s.min,s.max)),m=d>1?Math.min(...h):0,p=100-Math.max(...h);return a.jsx(Zt.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:m+"%",[i.endEdge]:p+"%"}})});eA.displayName=u2;var d2="SliderThumb",tA=S.forwardRef((t,e)=>{const n=GH(t.__scopeSlider),[r,s]=S.useState(null),i=Cn(e,c=>s(c)),l=S.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(JH,{...t,ref:i,index:l})}),JH=S.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,l=vx(d2,n),c=YT(d2,n),[d,h]=S.useState(null),m=Cn(e,T=>h(T)),p=d?l.form||!!d.closest("form"):!0,x=m9(d),v=l.values[r],b=v===void 0?0:rA(v,l.min,l.max),k=nU(r,l.values.length),O=x?.[c.size],j=O?sU(O,b,c.direction):0;return S.useEffect(()=>{if(d)return l.thumbs.add(d),()=>{l.thumbs.delete(d)}},[d,l.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${b}% + ${j}px)`},children:[a.jsx(c2.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(Zt.span,{role:"slider","aria-label":t["aria-label"]||k,"aria-valuemin":l.min,"aria-valuenow":v,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...i,ref:m,style:v===void 0?{display:"none"}:t.style,onFocus:$e(t.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),p&&a.jsx(nA,{name:s??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:v},r)]})});tA.displayName=d2;var eU="RadioBubbleInput",nA=S.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=S.useRef(null),i=Cn(s,r),l=f9(e);return S.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==e&&m){const p=new Event("input",{bubbles:!0});m.call(c,e),c.dispatchEvent(p)}},[l,e]),a.jsx(Zt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});nA.displayName=eU;function tU(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function rA(t,e,n){const i=100/(n-e)*(t-e);return F4(i,[0,100])}function nU(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function rU(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 sU(t,e,n){const r=t/2,i=pw([0,50],[0,r]);return(r-i(e)*n)*n}function iU(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function aU(t,e){if(e>0){const n=iU(t);return Math.min(...n)>=e}return!0}function pw(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 lU(t){return(String(t).split(".")[1]||"").length}function oU(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var sA=GT,cU=JT,uU=eA,dU=tA;const yx=S.forwardRef(({className:t,...e},n)=>a.jsxs(sA,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(cU,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:a.jsx(uU,{className:"absolute h-full bg-primary"})}),a.jsx(dU,{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"})]}));yx.displayName=sA.displayName;const Lt=tq,It=nq,Dt=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v9,{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,a.jsx(YI,{asChild:!0,children:a.jsx(df,{className:"h-4 w-4 opacity-50"})})]}));Dt.displayName=v9.displayName;const iA=S.forwardRef(({className:t,...e},n)=>a.jsx(y9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(e2,{className:"h-4 w-4"})}));iA.displayName=y9.displayName;const aA=S.forwardRef(({className:t,...e},n)=>a.jsx(b9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(df,{className:"h-4 w-4"})}));aA.displayName=b9.displayName;const Rt=S.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>a.jsx(KI,{children:a.jsxs(w9,{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:[a.jsx(iA,{}),a.jsx(ZI,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(aA,{})]})}));Rt.displayName=w9.displayName;const hU=S.forwardRef(({className:t,...e},n)=>a.jsx(S9,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));hU.displayName=S9.displayName;const Pe=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(k9,{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:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(JI,{children:a.jsx(hc,{className:"h-4 w-4"})})}),a.jsx(eq,{children:e})]}));Pe.displayName=k9.displayName;const fU=S.forwardRef(({className:t,...e},n)=>a.jsx(O9,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));fU.displayName=O9.displayName;function mU(t){const e=pU(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(xU);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function pU(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=yU(s),c=vU(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var gU=Symbol("radix.slottable");function xU(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gU}function vU(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]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function yU(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 bx="Popover",[lA]=Vi(bx,[wd]),r0=wd(),[bU,Oo]=lA(bx),oA=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:l=!1}=t,c=r0(e),d=S.useRef(null),[h,m]=S.useState(!1),[p,x]=ko({prop:r,defaultProp:s??!1,onChange:i,caller:bx});return a.jsx(ix,{...c,children:a.jsx(bU,{scope:e,contentId:ji(),triggerRef:d,open:p,onOpenChange:x,onOpenToggle:S.useCallback(()=>x(v=>!v),[x]),hasCustomAnchor:h,onCustomAnchorAdd:S.useCallback(()=>m(!0),[]),onCustomAnchorRemove:S.useCallback(()=>m(!1),[]),modal:l,children:n})})};oA.displayName=bx;var cA="PopoverAnchor",wU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(cA,n),i=r0(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return S.useEffect(()=>(l(),()=>c()),[l,c]),a.jsx(ax,{...i,...r,ref:e})});wU.displayName=cA;var uA="PopoverTrigger",dA=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(uA,n),i=r0(n),l=Cn(e,s.triggerRef),c=a.jsx(Zt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":gA(s.open),...r,ref:l,onClick:$e(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(ax,{asChild:!0,...i,children:c})});dA.displayName=uA;var gw="PopoverPortal",[SU,kU]=lA(gw,{forceMount:void 0}),hA=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Oo(gw,e);return a.jsx(SU,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};hA.displayName=gw;var ad="PopoverContent",fA=S.forwardRef((t,e)=>{const n=kU(ad,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Oo(ad,t.__scopePopover);return a.jsx(Ls,{present:r||i.open,children:i.modal?a.jsx(jU,{...s,ref:e}):a.jsx(NU,{...s,ref:e})})});fA.displayName=ad;var OU=mU("PopoverContent.RemoveScroll"),jU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(null),s=Cn(e,r),i=S.useRef(!1);return S.useEffect(()=>{const l=r.current;if(l)return j9(l)},[]),a.jsx(N9,{as:OU,allowPinchZoom:!0,children:a.jsx(mA,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(t.onCloseAutoFocus,l=>{l.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:$e(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,h=c.button===2||d;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:$e(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),NU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(!1),s=S.useRef(!1);return a.jsx(mA,{...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 l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),mA=S.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,...p}=t,x=Oo(ad,n),v=r0(n);return C9(),a.jsx(T9,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:a.jsx(X4,{"data-state":gA(x.open),role:"dialog",id:x.contentId,...v,...p,ref:e,style:{...p.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)"}})})})}),pA="PopoverClose",CU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(pA,n);return a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,()=>s.onOpenChange(!1))})});CU.displayName=pA;var TU="PopoverArrow",AU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=r0(n);return a.jsx(Y4,{...s,...r,ref:e})});AU.displayName=TU;function gA(t){return t?"open":"closed"}var MU=oA,EU=dA,_U=hA,xA=fA;const uo=MU,ho=EU,fl=S.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>a.jsx(_U,{children:a.jsx(xA,{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})}));fl.displayName=xA.displayName;const jo="/api/webui/config";async function DU(){const e=await(await ot(`${jo}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Vu(){const e=await(await ot(`${jo}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function XO(t){const n=await(await ot(`${jo}/bot`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function RU(){const e=await(await ot(`${jo}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function zU(t){const n=await(await ot(`${jo}/bot/raw`,{method:"POST",headers:bt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function wg(t){const n=await(await ot(`${jo}/model`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function PU(t,e){const r=await(await ot(`${jo}/bot/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function h2(t,e){const r=await(await ot(`${jo}/model/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const BU=Zn.create({baseURL:"",timeout:1e4});async function xw(){try{return(await BU.post("/api/webui/system/restart")).data}catch(t){throw console.error("重启麦麦失败:",t),t}}const LU=Nd("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"}}),ld=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:ye(LU({variant:e}),t),...n}));ld.displayName="Alert";const IU=S.forwardRef(({className:t,...e},n)=>a.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));IU.displayName="AlertTitle";const od=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));od.displayName="AlertDescription";function vw({onRestartComplete:t,onRestartFailed:e}){const[n,r]=S.useState(0),[s,i]=S.useState("restarting"),[l,c]=S.useState(0),[d,h]=S.useState(0);S.useEffect(()=>{const x=setInterval(()=>{r(k=>k>=90?k:k+1)},200),v=setInterval(()=>{c(k=>k+1)},1e3),b=setTimeout(()=>{i("checking"),m()},3e3);return()=>{clearInterval(x),clearInterval(v),clearTimeout(b)}},[]);const m=()=>{const v=async()=>{try{if(h(k=>k+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{d<60?setTimeout(v,2e3):(i("failed"),e?.())}};v()},p=x=>{const v=Math.floor(x/60),b=x%60;return`${v}:${b.toString().padStart(2,"0")}`};return a.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:a.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),a.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",d,"/60)"]})]}),s==="success"&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{className:"h-16 w-16 text-green-500"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&a.jsxs(a.Fragment,{children:[a.jsx(xc,{className:"h-16 w-16 text-destructive"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:n,className:"h-2"}),a.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[a.jsxs("span",{children:[n,"%"]}),a.jsxs("span",{children:["已用时: ",p(l)]})]})]}),a.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),s==="failed"&&a.jsxs("div",{className:"flex gap-2",children:[a.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:"刷新页面"}),a.jsx("button",{onClick:()=>{i("checking"),h(0),m()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let f2=[],vA=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=vA[r])e=r+1;else return!0;if(e==n)return!1}}function YO(t){return t>=127462&&t<=127487}const KO=8205;function FU(t,e,n=!0,r=!0){return(n?yA:QU)(t,e,r)}function yA(t,e,n){if(e==t.length)return e;e&&bA(t.charCodeAt(e))&&wA(t.charCodeAt(e-1))&&e--;let r=Cy(t,e);for(e+=ZO(r);e=0&&YO(Cy(t,l));)i++,l-=2;if(i%2==0)break;e+=2}else break}return e}function QU(t,e,n){for(;e>0;){let r=yA(t,e-2,n);if(r=56320&&t<57344}function wA(t){return t>=55296&&t<56320}function ZO(t){return t<65536?1:2}class Xt{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]=cd(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),Gp.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]=cd(this,e,n);let r=[];return this.decompose(e,n,r,0),Gp.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 Zh(this),i=new Zh(e);for(let l=n,c=n;;){if(s.next(l),i.next(l),l=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(c+=s.value.length,s.done||c>=r)return!0}}iter(e=1){return new Zh(this,e)}iterRange(e,n=this.length){return new SA(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 kA(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]?Xt.empty:e.length<=32?new ir(e):Gp.from(ir.split(e,[]))}}class ir extends Xt{constructor(e,n=$U(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 l=this.text[i],c=s+l.length;if((n?r:c)>=e)return new HU(s,c,r,l);s=c+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new ir(JO(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let l=r.pop(),c=Xp(i.text,l.text.slice(),0,i.length);if(c.length<=32)r.push(new ir(c,l.length+i.length));else{let d=c.length>>1;r.push(new ir(c.slice(0,d)),new ir(c.slice(d)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof ir))return super.replace(e,n,r);[e,n]=cd(this,e,n);let s=Xp(this.text,Xp(r.text,JO(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new ir(s,i):Gp.from(ir.split(s,[]),i)}sliceString(e,n=this.length,r=` +3.某句话如果已经被回复过,不要重复回复`}),[b,k]=S.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[O,j]=S.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遭遇特定事件的时候起伏较大",all_global:!0}),T=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:xq},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:D9},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:K4},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Ii},{id:"complete",title:"完成设置",description:"后续配置提示",icon:uf}],A=(n+1)/T.length*100;S.useEffect(()=>{(async()=>{try{h(!0);const[U,V,ce,W]=await Promise.all([IH(),qH(),FH(),QH()]);p(U),v(V),k(ce),j(W)}catch(U){e({title:"加载配置失败",description:U instanceof Error?U.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const _=async()=>{c(!0);try{switch(n){case 0:await $H(m);break;case 1:await HH(x);break;case 2:await UH(b);break;case 3:await VH(O);break}return e({title:"保存成功",description:`${T[n].title}配置已保存`}),!0}catch(L){return e({title:"保存失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"}),!1}finally{c(!1)}},D=async()=>{await _()&&n{n>0&&r(n-1)},z=async()=>{i(!0);try{if(!await _()){i(!1);return}await GO(),e({title:"配置完成",description:"所有配置已保存,正在跳转..."}),setTimeout(()=>{t({to:"/"})},500)}catch(L){e({title:"完成失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}finally{i(!1)}},Q=async()=>{try{await GO(),t({to:"/"})}catch(L){e({title:"跳过失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},F=()=>{switch(n){case 0:return a.jsx(zH,{config:m,onChange:p});case 1:return a.jsx(PH,{config:x,onChange:v});case 2:return a.jsx(BH,{config:b,onChange:k});case 3:return a.jsx(LH,{config:O,onChange:j});case 4:return a.jsxs("div",{className:"space-y-6 text-center py-8",children:[a.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:a.jsx(uf,{className:"h-8 w-8 text-primary",strokeWidth:2})}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-xl font-semibold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:"为了让机器人正常工作,您需要配置 AI 模型提供商和模型。"})]}),a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-6 max-w-md mx-auto text-left space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"1"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置 API 提供商"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → API 提供商"中添加您的 API 提供商信息'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"2"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"添加模型"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型列表"中添加需要使用的模型'})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5",children:a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/20 flex items-center justify-center text-primary text-sm font-semibold",children:"3"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:"配置模型任务"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:'在"系统设置 → 模型配置 → 模型任务配置"中为不同任务分配模型'})]})]})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"💡 提示:完成向导后,您可以在系统设置中进行详细的模型配置"})]});default:return null}};return a.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:[a.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[a.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"}),a.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"})]}),d?a.jsxs("div",{className:"relative z-10 text-center",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:a.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),a.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),a.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[a.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[a.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:a.jsx(gq,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),a.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),a.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",fw," 的初始配置"]})]}),a.jsxs("div",{className:"mb-6 md:mb-8",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[a.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",T.length]}),a.jsxs("span",{className:"font-medium text-primary",children:[Math.round(A),"%"]})]}),a.jsx(n0,{value:A,className:"h-2"})]}),a.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:T.map((L,U)=>{const V=L.icon;return a.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",Ut({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[a.jsx(hg,{className:"h-4 w-4"}),"返回首页"]}),a.jsxs(ie,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[a.jsx(R9,{className:"h-4 w-4"}),"返回上一页"]})]}),a.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var HT=["PageUp","PageDown"],UT=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],VT={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Cd="Slider",[c2,GH,XH]=tx(Cd),[WT]=Vi(Cd,[XH]),[YH,vx]=WT(Cd),GT=S.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:l="horizontal",disabled:c=!1,minStepsBetweenThumbs:d=0,defaultValue:h=[r],value:m,onValueChange:p=()=>{},onValueCommit:x=()=>{},inverted:v=!1,form:b,...k}=t,O=S.useRef(new Set),j=S.useRef(0),A=l==="horizontal"?KH:ZH,[_=[],D]=ko({prop:m,defaultProp:h,onChange:U=>{[...O.current][j.current]?.focus(),p(U)}}),E=S.useRef(_);function z(U){const V=rU(_,U);L(U,V)}function Q(U){L(U,j.current)}function F(){const U=E.current[j.current];_[j.current]!==U&&x(_)}function L(U,V,{commit:ce}={commit:!1}){const W=lU(i),J=oU(Math.round((U-r)/i)*i+r,W),$=F4(J,[r,s]);D((ae=[])=>{const ne=tU(ae,$,V);if(aU(ne,d*i)){j.current=ne.indexOf($);const ue=String(ne)!==String(ae);return ue&&ce&&x(ne),ue?ne:ae}else return ae})}return a.jsx(YH,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:j,thumbs:O.current,values:_,orientation:l,form:b,children:a.jsx(c2.Provider,{scope:t.__scopeSlider,children:a.jsx(c2.Slot,{scope:t.__scopeSlider,children:a.jsx(A,{"aria-disabled":c,"data-disabled":c?"":void 0,...k,ref:e,onPointerDown:$e(k.onPointerDown,()=>{c||(E.current=_)}),min:r,max:s,inverted:v,onSlideStart:c?void 0:z,onSlideMove:c?void 0:Q,onSlideEnd:c?void 0:F,onHomeKeyDown:()=>!c&&L(r,0,{commit:!0}),onEndKeyDown:()=>!c&&L(s,_.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:V})=>{if(!c){const J=HT.includes(U.key)||U.shiftKey&&UT.includes(U.key)?10:1,$=j.current,ae=_[$],ne=i*J*V;L(ae+ne,$,{commit:!0})}}})})})})});GT.displayName=Cd;var[XT,YT]=WT(Cd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),KH=S.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:l,onSlideMove:c,onSlideEnd:d,onStepKeyDown:h,...m}=t,[p,x]=S.useState(null),v=Cn(e,A=>x(A)),b=S.useRef(void 0),k=Vf(s),O=k==="ltr",j=O&&!i||!O&&i;function T(A){const _=b.current||p.getBoundingClientRect(),D=[0,_.width],z=pw(D,j?[n,r]:[r,n]);return b.current=_,z(A-_.left)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:j?"left":"right",endEdge:j?"right":"left",direction:j?1:-1,size:"width",children:a.jsx(KT,{dir:k,"data-orientation":"horizontal",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:A=>{const _=T(A.clientX);l?.(_)},onSlideMove:A=>{const _=T(A.clientX);c?.(_)},onSlideEnd:()=>{b.current=void 0,d?.()},onStepKeyDown:A=>{const D=VT[j?"from-left":"from-right"].includes(A.key);h?.({event:A,direction:D?-1:1})}})})}),ZH=S.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...h}=t,m=S.useRef(null),p=Cn(e,m),x=S.useRef(void 0),v=!s;function b(k){const O=x.current||m.current.getBoundingClientRect(),j=[0,O.height],A=pw(j,v?[r,n]:[n,r]);return x.current=O,A(k-O.top)}return a.jsx(XT,{scope:t.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:a.jsx(KT,{"data-orientation":"vertical",...h,ref:p,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const O=b(k.clientY);i?.(O)},onSlideMove:k=>{const O=b(k.clientY);l?.(O)},onSlideEnd:()=>{x.current=void 0,c?.()},onStepKeyDown:k=>{const j=VT[v?"from-bottom":"from-top"].includes(k.key);d?.({event:k,direction:j?-1:1})}})})}),KT=S.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:l,onEndKeyDown:c,onStepKeyDown:d,...h}=t,m=vx(Cd,n);return a.jsx(Zt.span,{...h,ref:e,onKeyDown:$e(t.onKeyDown,p=>{p.key==="Home"?(l(p),p.preventDefault()):p.key==="End"?(c(p),p.preventDefault()):HT.concat(UT).includes(p.key)&&(d(p),p.preventDefault())}),onPointerDown:$e(t.onPointerDown,p=>{const x=p.target;x.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(x)?x.focus():r(p)}),onPointerMove:$e(t.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:$e(t.onPointerUp,p=>{const x=p.target;x.hasPointerCapture(p.pointerId)&&(x.releasePointerCapture(p.pointerId),i(p))})})}),ZT="SliderTrack",JT=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(ZT,n);return a.jsx(Zt.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});JT.displayName=ZT;var u2="SliderRange",eA=S.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=vx(u2,n),i=YT(u2,n),l=S.useRef(null),c=Cn(e,l),d=s.values.length,h=s.values.map(x=>rA(x,s.min,s.max)),m=d>1?Math.min(...h):0,p=100-Math.max(...h);return a.jsx(Zt.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:m+"%",[i.endEdge]:p+"%"}})});eA.displayName=u2;var d2="SliderThumb",tA=S.forwardRef((t,e)=>{const n=GH(t.__scopeSlider),[r,s]=S.useState(null),i=Cn(e,c=>s(c)),l=S.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(JH,{...t,ref:i,index:l})}),JH=S.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,l=vx(d2,n),c=YT(d2,n),[d,h]=S.useState(null),m=Cn(e,T=>h(T)),p=d?l.form||!!d.closest("form"):!0,x=m9(d),v=l.values[r],b=v===void 0?0:rA(v,l.min,l.max),k=nU(r,l.values.length),O=x?.[c.size],j=O?sU(O,b,c.direction):0;return S.useEffect(()=>{if(d)return l.thumbs.add(d),()=>{l.thumbs.delete(d)}},[d,l.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${b}% + ${j}px)`},children:[a.jsx(c2.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(Zt.span,{role:"slider","aria-label":t["aria-label"]||k,"aria-valuemin":l.min,"aria-valuenow":v,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...i,ref:m,style:v===void 0?{display:"none"}:t.style,onFocus:$e(t.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),p&&a.jsx(nA,{name:s??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:v},r)]})});tA.displayName=d2;var eU="RadioBubbleInput",nA=S.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=S.useRef(null),i=Cn(s,r),l=f9(e);return S.useEffect(()=>{const c=s.current;if(!c)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==e&&m){const p=new Event("input",{bubbles:!0});m.call(c,e),c.dispatchEvent(p)}},[l,e]),a.jsx(Zt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});nA.displayName=eU;function tU(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function rA(t,e,n){const i=100/(n-e)*(t-e);return F4(i,[0,100])}function nU(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function rU(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 sU(t,e,n){const r=t/2,i=pw([0,50],[0,r]);return(r-i(e)*n)*n}function iU(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function aU(t,e){if(e>0){const n=iU(t);return Math.min(...n)>=e}return!0}function pw(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 lU(t){return(String(t).split(".")[1]||"").length}function oU(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var sA=GT,cU=JT,uU=eA,dU=tA;const yx=S.forwardRef(({className:t,...e},n)=>a.jsxs(sA,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(cU,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:a.jsx(uU,{className:"absolute h-full bg-primary"})}),a.jsx(dU,{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"})]}));yx.displayName=sA.displayName;const Lt=tq,It=nq,Dt=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v9,{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,a.jsx(YI,{asChild:!0,children:a.jsx(df,{className:"h-4 w-4 opacity-50"})})]}));Dt.displayName=v9.displayName;const iA=S.forwardRef(({className:t,...e},n)=>a.jsx(y9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(e2,{className:"h-4 w-4"})}));iA.displayName=y9.displayName;const aA=S.forwardRef(({className:t,...e},n)=>a.jsx(b9,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(df,{className:"h-4 w-4"})}));aA.displayName=b9.displayName;const Rt=S.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>a.jsx(KI,{children:a.jsxs(w9,{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:[a.jsx(iA,{}),a.jsx(ZI,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(aA,{})]})}));Rt.displayName=w9.displayName;const hU=S.forwardRef(({className:t,...e},n)=>a.jsx(S9,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));hU.displayName=S9.displayName;const Pe=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(k9,{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:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(JI,{children:a.jsx(hc,{className:"h-4 w-4"})})}),a.jsx(eq,{children:e})]}));Pe.displayName=k9.displayName;const fU=S.forwardRef(({className:t,...e},n)=>a.jsx(O9,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));fU.displayName=O9.displayName;function mU(t){const e=pU(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(xU);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function pU(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=yU(s),c=vU(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var gU=Symbol("radix.slottable");function xU(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gU}function vU(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]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function yU(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 bx="Popover",[lA]=Vi(bx,[wd]),r0=wd(),[bU,Oo]=lA(bx),oA=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:l=!1}=t,c=r0(e),d=S.useRef(null),[h,m]=S.useState(!1),[p,x]=ko({prop:r,defaultProp:s??!1,onChange:i,caller:bx});return a.jsx(ix,{...c,children:a.jsx(bU,{scope:e,contentId:ji(),triggerRef:d,open:p,onOpenChange:x,onOpenToggle:S.useCallback(()=>x(v=>!v),[x]),hasCustomAnchor:h,onCustomAnchorAdd:S.useCallback(()=>m(!0),[]),onCustomAnchorRemove:S.useCallback(()=>m(!1),[]),modal:l,children:n})})};oA.displayName=bx;var cA="PopoverAnchor",wU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(cA,n),i=r0(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=s;return S.useEffect(()=>(l(),()=>c()),[l,c]),a.jsx(ax,{...i,...r,ref:e})});wU.displayName=cA;var uA="PopoverTrigger",dA=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(uA,n),i=r0(n),l=Cn(e,s.triggerRef),c=a.jsx(Zt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":gA(s.open),...r,ref:l,onClick:$e(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:a.jsx(ax,{asChild:!0,...i,children:c})});dA.displayName=uA;var gw="PopoverPortal",[SU,kU]=lA(gw,{forceMount:void 0}),hA=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Oo(gw,e);return a.jsx(SU,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};hA.displayName=gw;var ad="PopoverContent",fA=S.forwardRef((t,e)=>{const n=kU(ad,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Oo(ad,t.__scopePopover);return a.jsx(Ls,{present:r||i.open,children:i.modal?a.jsx(jU,{...s,ref:e}):a.jsx(NU,{...s,ref:e})})});fA.displayName=ad;var OU=mU("PopoverContent.RemoveScroll"),jU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(null),s=Cn(e,r),i=S.useRef(!1);return S.useEffect(()=>{const l=r.current;if(l)return j9(l)},[]),a.jsx(N9,{as:OU,allowPinchZoom:!0,children:a.jsx(mA,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(t.onCloseAutoFocus,l=>{l.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:$e(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,h=c.button===2||d;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:$e(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),NU=S.forwardRef((t,e)=>{const n=Oo(ad,t.__scopePopover),r=S.useRef(!1),s=S.useRef(!1);return a.jsx(mA,{...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 l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),mA=S.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,...p}=t,x=Oo(ad,n),v=r0(n);return C9(),a.jsx(T9,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>x.onOpenChange(!1),children:a.jsx(X4,{"data-state":gA(x.open),role:"dialog",id:x.contentId,...v,...p,ref:e,style:{...p.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)"}})})})}),pA="PopoverClose",CU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Oo(pA,n);return a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,()=>s.onOpenChange(!1))})});CU.displayName=pA;var TU="PopoverArrow",AU=S.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=r0(n);return a.jsx(Y4,{...s,...r,ref:e})});AU.displayName=TU;function gA(t){return t?"open":"closed"}var MU=oA,EU=dA,_U=hA,xA=fA;const uo=MU,ho=EU,fl=S.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>a.jsx(_U,{children:a.jsx(xA,{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})}));fl.displayName=xA.displayName;const jo="/api/webui/config";async function DU(){const e=await(await ot(`${jo}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Vu(){const e=await(await ot(`${jo}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function XO(t){const n=await(await ot(`${jo}/bot`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function RU(){const e=await(await ot(`${jo}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function zU(t){const n=await(await ot(`${jo}/bot/raw`,{method:"POST",headers:bt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function wg(t){const n=await(await ot(`${jo}/model`,{method:"POST",headers:bt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function PU(t,e){const r=await(await ot(`${jo}/bot/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function h2(t,e){const r=await(await ot(`${jo}/model/section/${t}`,{method:"POST",headers:bt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const BU=Zn.create({baseURL:"",timeout:1e4});async function xw(){try{return(await BU.post("/api/webui/system/restart")).data}catch(t){throw console.error("重启麦麦失败:",t),t}}const LU=Nd("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"}}),ld=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:ye(LU({variant:e}),t),...n}));ld.displayName="Alert";const IU=S.forwardRef(({className:t,...e},n)=>a.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));IU.displayName="AlertTitle";const od=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));od.displayName="AlertDescription";function vw({onRestartComplete:t,onRestartFailed:e}){const[n,r]=S.useState(0),[s,i]=S.useState("restarting"),[l,c]=S.useState(0),[d,h]=S.useState(0);S.useEffect(()=>{const x=setInterval(()=>{r(k=>k>=90?k:k+1)},200),v=setInterval(()=>{c(k=>k+1)},1e3),b=setTimeout(()=>{i("checking"),m()},3e3);return()=>{clearInterval(x),clearInterval(v),clearTimeout(b)}},[]);const m=()=>{const v=async()=>{try{if(h(k=>k+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{d<60?setTimeout(v,2e3):(i("failed"),e?.())}};v()},p=x=>{const v=Math.floor(x/60),b=x%60;return`${v}:${b.toString().padStart(2,"0")}`};return a.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:a.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[a.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&a.jsxs(a.Fragment,{children:[a.jsx(hf,{className:"h-16 w-16 text-primary animate-spin"}),a.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),a.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",d,"/60)"]})]}),s==="success"&&a.jsxs(a.Fragment,{children:[a.jsx(Es,{className:"h-16 w-16 text-green-500"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&a.jsxs(a.Fragment,{children:[a.jsx(xc,{className:"h-16 w-16 text-destructive"}),a.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(n0,{value:n,className:"h-2"}),a.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[a.jsxs("span",{children:[n,"%"]}),a.jsxs("span",{children:["已用时: ",p(l)]})]})]}),a.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),s==="failed"&&a.jsxs("div",{className:"flex gap-2",children:[a.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:"刷新页面"}),a.jsx("button",{onClick:()=>{i("checking"),h(0),m()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let f2=[],vA=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=vA[r])e=r+1;else return!0;if(e==n)return!1}}function YO(t){return t>=127462&&t<=127487}const KO=8205;function FU(t,e,n=!0,r=!0){return(n?yA:QU)(t,e,r)}function yA(t,e,n){if(e==t.length)return e;e&&bA(t.charCodeAt(e))&&wA(t.charCodeAt(e-1))&&e--;let r=Cy(t,e);for(e+=ZO(r);e=0&&YO(Cy(t,l));)i++,l-=2;if(i%2==0)break;e+=2}else break}return e}function QU(t,e,n){for(;e>0;){let r=yA(t,e-2,n);if(r=56320&&t<57344}function wA(t){return t>=55296&&t<56320}function ZO(t){return t<65536?1:2}class Xt{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]=cd(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),Gp.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]=cd(this,e,n);let r=[];return this.decompose(e,n,r,0),Gp.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 Zh(this),i=new Zh(e);for(let l=n,c=n;;){if(s.next(l),i.next(l),l=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(c+=s.value.length,s.done||c>=r)return!0}}iter(e=1){return new Zh(this,e)}iterRange(e,n=this.length){return new SA(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 kA(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]?Xt.empty:e.length<=32?new ir(e):Gp.from(ir.split(e,[]))}}class ir extends Xt{constructor(e,n=$U(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 l=this.text[i],c=s+l.length;if((n?r:c)>=e)return new HU(s,c,r,l);s=c+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new ir(JO(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let l=r.pop(),c=Xp(i.text,l.text.slice(),0,i.length);if(c.length<=32)r.push(new ir(c,l.length+i.length));else{let d=c.length>>1;r.push(new ir(c.slice(0,d)),new ir(c.slice(d)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof ir))return super.replace(e,n,r);[e,n]=cd(this,e,n);let s=Xp(this.text,Xp(r.text,JO(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new ir(s,i):Gp.from(ir.split(s,[]),i)}sliceString(e,n=this.length,r=` `){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;i<=n&&le&&l&&(s+=r),ei&&(s+=c.slice(Math.max(0,e-i),n-i)),i=d+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 ir(r,s)),r=[],s=-1);return s>-1&&n.push(new ir(r,s)),n}}let Gp=class Du extends Xt{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 l=this.children[i],c=s+l.length,d=r+l.lines-1;if((n?d:c)>=e)return l.lineInner(e,n,r,s);s=c+1,r=d+1}}decompose(e,n,r,s){for(let i=0,l=0;l<=n&&i=l){let h=s&((l<=e?1:0)|(d>=n?2:0));l>=e&&d<=n&&!h?r.push(c):c.decompose(e-l,n-l,r,h)}l=d+1}}replace(e,n,r){if([e,n]=cd(this,e,n),r.lines=i&&n<=c){let d=l.replace(e-i,n-i,r),h=this.lines-l.lines+d.lines;if(d.lines>4&&d.lines>h>>6){let m=this.children.slice();return m[s]=d,new Du(m,this.length-(n-e)+r.length)}return super.replace(i,c,d)}i=c+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` `){[e,n]=cd(this,e,n);let s="";for(let i=0,l=0;ie&&i&&(s+=r),el&&(s+=c.sliceString(e-l,n-l,r)),l=d+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Du))return 0;let r=0,[s,i,l,c]=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==l||i==c)return r;let d=this.children[s],h=e.children[i];if(d!=h)return r+d.scanIdentical(h,n);r+=d.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let v of e)r+=v.lines;if(r<32){let v=[];for(let b of e)b.flatten(v);return new ir(v,n)}let s=Math.max(32,r>>5),i=s<<1,l=s>>1,c=[],d=0,h=-1,m=[];function p(v){let b;if(v.lines>i&&v instanceof Du)for(let k of v.children)p(k);else v.lines>l&&(d>l||!d)?(x(),c.push(v)):v instanceof ir&&d&&(b=m[m.length-1])instanceof ir&&v.lines+b.lines<=32?(d+=v.lines,h+=v.length+1,m[m.length-1]=new ir(b.text.concat(v.text),b.length+1+v.length)):(d+v.lines>s&&x(),d+=v.lines,h+=v.length+1,m.push(v))}function x(){d!=0&&(c.push(m.length==1?m[0]:Du.from(m,h)),h=-1,d=m.length=0)}for(let v of e)p(v);return x(),c.length==1?c[0]:new Du(c,n)}};Xt.empty=new ir([""],0);function $U(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Xp(t,e,n=0,r=1e9){for(let s=0,i=0,l=!0;i=n&&(d>r&&(c=c.slice(0,r-s)),s0?1:(e instanceof ir?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],l=i>>1,c=s instanceof ir?s.text.length:s.children.length;if(l==(n>0?c: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 ir){let d=s.text[l+(n<0?-1:0)];if(this.offsets[r]+=n,d.length>Math.max(0,e))return this.value=e==0?d:n>0?d.slice(e):d.slice(0,d.length-e),this;e-=d.length}else{let d=s.children[l+(n<0?-1:0)];e>d.length?(e-=d.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(d),this.offsets.push(n>0?1:(d instanceof ir?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class SA{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Zh(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 kA{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"&&(Xt.prototype[Symbol.iterator]=function(){return this.iter()},Zh.prototype[Symbol.iterator]=SA.prototype[Symbol.iterator]=kA.prototype[Symbol.iterator]=function(){return this});class HU{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 cd(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Vr(t,e,n=!0,r=!0){return FU(t,e,n,r)}function UU(t){return t>=56320&&t<57344}function VU(t){return t>=55296&&t<56320}function As(t,e){let n=t.charCodeAt(e);if(!VU(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return UU(r)?(n-55296<<10)+(r-56320)+65536:n}function yw(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function oa(t){return t<65536?1:2}const m2=/\r\n?|\n/;var Ur=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Ur||(Ur={}));class va{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=c}else{if(r!=Ur.Simple&&h>=e&&(r==Ur.TrackDel&&se||r==Ur.TrackBefore&&se))return null;if(h>e||h==e&&n<0&&!c)return e==s||n<0?i:i+d;i+=d}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r=0&&s<=n&&c>=e)return sn?"cover":!0;s=c}return!1}toString(){let e="";for(let n=0;n=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new va(e)}static create(e){return new va(e)}}class kr extends va{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 p2(this,(n,r,s,i,l)=>e=e.replace(s,s+(r-n),l),!1),e}mapDesc(e,n=!1){return g2(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=c,n[s+1]=l;let d=s>>1;for(;r.length0&&ro(r,n,i.text),i.forward(m),c+=m}let h=e[l++];for(;c>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],l=0,c=null;function d(m=!1){if(!m&&!s.length)return;lx||p<0||x>n)throw new RangeError(`Invalid change range ${p} to ${x} (in doc of length ${n})`);let b=v?typeof v=="string"?Xt.of(v.split(r||m2)):v:Xt.empty,k=b.length;if(p==x&&k==0)return;pl&&Jr(s,p-l,-1),Jr(s,x-p,k),ro(i,s,b),l=x}}return h(e),d(!c),c}static empty(e){return new kr(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;sc&&typeof l!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function ro(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||l==t.sections.length||t.sections[l+1]<0);)c=t.sections[l++],d=t.sections[l++];e(s,h,i,m,p),s=h,i=m}}}function g2(t,e,n,r=!1){let s=[],i=r?[]:null,l=new pf(t),c=new pf(e);for(let d=-1;;){if(l.done&&c.len||c.done&&l.len)throw new Error("Mismatched change set lengths");if(l.ins==-1&&c.ins==-1){let h=Math.min(l.len,c.len);Jr(s,h,-1),l.forward(h),c.forward(h)}else if(c.ins>=0&&(l.ins<0||d==l.i||l.off==0&&(c.len=0&&d=0){let h=0,m=l.len;for(;m;)if(c.ins==-1){let p=Math.min(m,c.len);h+=p,m-=p,c.forward(p)}else if(c.ins==0&&c.lend||l.ins>=0&&l.len>d)&&(c||r.length>h),i.forward2(d),l.forward(d)}}}}class pf{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?Xt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Xt.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 lc{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 lc(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Ce.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ce.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 Ce.range(e.anchor,e.head)}static create(e,n,r){return new lc(e,n,r)}}class Ce{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ce.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ce(e.ranges.map(n=>lc.fromJSON(n)),e.main)}static single(e,n=e){return new Ce([Ce.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Ce.range(d,c):Ce.range(c,d))}}return new Ce(e,n)}}function jA(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let bw=0;class He{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=bw++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new He(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:ww),!!e.static,e.enables)}of(e){return new Yp([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yp(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function ww(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Yp{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=bw++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,l=e[i]>>1,c=this.type==2,d=!1,h=!1,m=[];for(let p of this.dependencies)p=="doc"?d=!0:p=="selection"?h=!0:(((n=e[p.id])!==null&&n!==void 0?n:1)&1)==0&&m.push(e[p.id]);return{create(p){return p.values[l]=r(p),1},update(p,x){if(d&&x.docChanged||h&&(x.docChanged||x.selection)||x2(p,m)){let v=r(p);if(c?!ej(v,p.values[l],s):!s(v,p.values[l]))return p.values[l]=v,1}return 0},reconfigure:(p,x)=>{let v,b=x.config.address[i];if(b!=null){let k=kg(x,b);if(this.dependencies.every(O=>O instanceof He?x.facet(O)===p.facet(O):O instanceof Br?x.field(O,!1)==p.field(O,!1):!0)||(c?ej(v=r(p),k,s):s(v=r(p),k)))return p.values[l]=k,0}else v=r(p);return p.values[l]=v,1}}}}function ej(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[d.id]),s=n.map(d=>d.type),i=r.filter(d=>!(d&1)),l=t[e.id]>>1;function c(d){let h=[];for(let m=0;mr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Zm).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],l=this.updateF(i,s);return this.compareF(i,l)?0:(r.values[n]=l,1)},reconfigure:(r,s)=>{let i=r.facet(Zm),l=s.facet(Zm),c;return(c=i.find(d=>d.field==this))&&c!=l.find(d=>d.field==this)?(r.values[n]=c.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,Zm.of({field:this,create:e})]}get extension(){return this}}const sc={lowest:4,low:3,default:2,high:1,highest:0};function _h(t){return e=>new NA(e,t)}const No={highest:_h(sc.highest),high:_h(sc.high),default:_h(sc.default),low:_h(sc.low),lowest:_h(sc.lowest)};class NA{constructor(e,n){this.inner=e,this.prec=n}}class wx{of(e){return new v2(this,e)}reconfigure(e){return wx.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class v2{constructor(e,n){this.compartment=e,this.inner=n}}class Sg{constructor(e,n,r,s,i,l){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=l,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),l=new Map;for(let x of GU(e,n,l))x instanceof Br?s.push(x):(i[x.facet.id]||(i[x.facet.id]=[])).push(x);let c=Object.create(null),d=[],h=[];for(let x of s)c[x.id]=h.length<<1,h.push(v=>x.slot(v));let m=r?.config.facets;for(let x in i){let v=i[x],b=v[0].facet,k=m&&m[x]||[];if(v.every(O=>O.type==0))if(c[b.id]=d.length<<1|1,ww(k,v))d.push(r.facet(b));else{let O=b.combine(v.map(j=>j.value));d.push(r&&b.compare(O,r.facet(b))?r.facet(b):O)}else{for(let O of v)O.type==0?(c[O.id]=d.length<<1|1,d.push(O.value)):(c[O.id]=h.length<<1,h.push(j=>O.dynamicSlot(j)));c[b.id]=h.length<<1,h.push(O=>WU(O,b,v))}}let p=h.map(x=>x(c));return new Sg(e,l,p,c,d,i)}}function GU(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(l,c){let d=s.get(l);if(d!=null){if(d<=c)return;let h=r[d].indexOf(l);h>-1&&r[d].splice(h,1),l instanceof v2&&n.delete(l.compartment)}if(s.set(l,c),Array.isArray(l))for(let h of l)i(h,c);else if(l instanceof v2){if(n.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(l.compartment)||l.inner;n.set(l.compartment,h),i(h,c)}else if(l instanceof NA)i(l.inner,l.prec);else if(l instanceof Br)r[c].push(l),l.provides&&i(l.provides,c);else if(l instanceof Yp)r[c].push(l),l.facet.extensions&&i(l.facet.extensions,sc.default);else{let h=l.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(h,c)}}return i(t,sc.default),r.reduce((l,c)=>l.concat(c))}function Jh(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 kg(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const CA=He.define(),y2=He.define({combine:t=>t.some(e=>e),static:!0}),TA=He.define({combine:t=>t.length?t[0]:void 0,static:!0}),AA=He.define(),MA=He.define(),EA=He.define(),_A=He.define({combine:t=>t.length?t[0]:!1});class ka{constructor(e,n){this.type=e,this.value=n}static define(){return new XU}}class XU{of(e){return new ka(this,e)}}class YU{constructor(e){this.map=e}of(e){return new vt(this,e)}}class vt{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 vt(this.type,n)}is(e){return this.type==e}static define(e={}){return new YU(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}}vt.reconfigure=vt.define();vt.appendConfig=vt.define();class gr{constructor(e,n,r,s,i,l){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=l,this._doc=null,this._state=null,r&&jA(r,n.newLength),i.some(c=>c.type==gr.time)||(this.annotations=i.concat(gr.time.of(Date.now())))}static create(e,n,r,s,i,l){return new gr(e,n,r,s,i,l)}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(gr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}gr.time=ka.define();gr.userEvent=ka.define();gr.addToHistory=ka.define();gr.remote=ka.define();function KU(t,e){let n=[];for(let r=0,s=0;;){let i,l;if(r=t[r]))i=t[r++],l=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof gr?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof gr?t=i[0]:t=RA(e,Wu(i),!1)}return t}function JU(t){let e=t.startState,n=e.facet(EA),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=DA(r,b2(e,i,t.changes.newLength),!0))}return r==t?t:gr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const eV=[];function Wu(t){return t==null?eV:Array.isArray(t)?t:[t]}var Vn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Vn||(Vn={}));const tV=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let w2;try{w2=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function nV(t){if(w2)return w2.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||tV.test(n)))return!0}return!1}function rV(t){return e=>{if(!/\S/.test(e))return Vn.Space;if(nV(e))return Vn.Word;for(let n=0;n-1)return Vn.Word;return Vn.Other}}class Vt{constructor(e,n,r,s,i,l){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,l&&(l._state=this);for(let c=0;cs.set(h,d)),n=null),s.set(c.value.compartment,c.value.extension)):c.is(vt.reconfigure)?(n=null,r=c.value):c.is(vt.appendConfig)&&(n=null,r=Wu(r).concat(c.value));let i;n?i=e.startState.values.slice():(n=Sg.resolve(r,s,this),i=new Vt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(d,h)=>h.reconfigure(d,this),null).values);let l=e.startState.facet(y2)?e.newSelection:e.newSelection.asSingle();new Vt(n,e.newDoc,l,i,(c,d)=>d.update(c,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:Ce.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],l=Wu(r.effects);for(let c=1;cl.spec.fromJSON(c,d)))}}return Vt.create({doc:e.doc,selection:Ce.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=Sg.resolve(e.extensions||[],new Map),r=e.doc instanceof Xt?e.doc:Xt.of((e.doc||"").split(n.staticFacet(Vt.lineSeparator)||m2)),s=e.selection?e.selection instanceof Ce?e.selection:Ce.single(e.selection.anchor,e.selection.head):Ce.single(0);return jA(s,r.length),n.staticFacet(y2)||(s=s.asSingle()),new Vt(n,r,s,n.dynamicSlots.map(()=>null),(i,l)=>l.create(i),null)}get tabSize(){return this.facet(Vt.tabSize)}get lineBreak(){return this.facet(Vt.lineSeparator)||` @@ -48,23 +48,23 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert- `)}static newName(){let e=ij[sj]||1;return ij[sj]=e+1,N2+e.toString(36)}static mount(e,n,r){let s=e[C2],i=r&&r.nonce;s?i&&s.setNonce(i):s=new iV(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let aj=new Map;class iV{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=aj.get(r);if(i)return e[C2]=i;this.sheet=new s.CSSStyleSheet,aj.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[C2]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let l=0;l-1&&(this.modules.splice(d,1),i--,d=-1),d==-1){if(this.modules.splice(i++,0,c),r)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},aV=typeof navigator<"u"&&/Mac/.test(navigator.platform),lV=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Hr=0;Hr<10;Hr++)mo[48+Hr]=mo[96+Hr]=String(Hr);for(var Hr=1;Hr<=24;Hr++)mo[Hr+111]="F"+Hr;for(var Hr=65;Hr<=90;Hr++)mo[Hr]=String.fromCharCode(Hr+32),xf[Hr]=String.fromCharCode(Hr);for(var Ay in mo)xf.hasOwnProperty(Ay)||(xf[Ay]=mo[Ay]);function oV(t){var e=aV&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||lV&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?xf:mo)[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 Mn(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e2);var Fe={mac:oj||/Mac/.test(us.platform),windows:/Win/.test(us.platform),linux:/Linux|X11/.test(us.platform),ie:Sx,ie_version:LA?T2.documentMode||6:M2?+M2[1]:A2?+A2[1]:0,gecko:lj,gecko_version:lj?+(/Firefox\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,chrome:!!My,chrome_version:My?+My[1]:0,ios:oj,android:/Android\b/.test(us.userAgent),webkit_version:cV?+(/\bAppleWebKit\/(\d+)/.exec(us.userAgent)||[0,0])[1]:0,safari:E2,safari_version:E2?+(/\bVersion\/(\d+(\.\d+)?)/.exec(us.userAgent)||[0,0])[1]:0,tabSize:T2.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function vf(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function _2(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Kp(t,e){if(!e.anchorNode)return!1;try{return _2(t,e.anchorNode)}catch{return!1}}function ud(t){return t.nodeType==3?wc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ef(t,e,n,r){return n?cj(t,e,n,r,-1)||cj(t,e,n,r,1):!1}function bc(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Og(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function cj(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:ba(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=bc(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?ba(t):0}else return!1}}function ba(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function s0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function uV(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 IA(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 dV(t,e,n,r,s,i,l,c){let d=t.ownerDocument,h=d.defaultView||window;for(let m=t,p=!1;m&&!p;)if(m.nodeType==1){let x,v=m==d.body,b=1,k=1;if(v)x=uV(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(m).position)&&(p=!0),m.scrollHeight<=m.clientHeight&&m.scrollWidth<=m.clientWidth){m=m.assignedSlot||m.parentNode;continue}let T=m.getBoundingClientRect();({scaleX:b,scaleY:k}=IA(m,T)),x={left:T.left,right:T.left+m.clientWidth*b,top:T.top,bottom:T.top+m.clientHeight*k}}let O=0,j=0;if(s=="nearest")e.top0&&e.bottom>x.bottom+j&&(j=e.bottom-x.bottom+l)):e.bottom>x.bottom&&(j=e.bottom-x.bottom+l,n<0&&e.top-j0&&e.right>x.right+O&&(O=e.right-x.right+i)):e.right>x.right&&(O=e.right-x.right+i,n<0&&e.leftx.bottom||e.leftx.right)&&(e={left:Math.max(e.left,x.left),right:Math.min(e.right,x.right),top:Math.max(e.top,x.top),bottom:Math.min(e.bottom,x.bottom)}),m=m.assignedSlot||m.parentNode}else if(m.nodeType==11)m=m.host;else break}function hV(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 fV{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?ba(n):0),r,Math.min(e.focusOffset,r?ba(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let nc=null;Fe.safari&&Fe.safari_version>=26&&(nc=!1);function qA(t){if(t.setActive)return t.setActive();if(nc)return t.focus(nc);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(nc==null?{get preventScroll(){return nc={preventScroll:!0},!0}}:void 0),!nc){nc=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function $A(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=ba(n)}else if(n.parentNode&&!Og(n))r=bc(n),n=n.parentNode;else return null}}function HA(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return p.domBoundsAround(e,n,h);if(x>=e&&s==-1&&(s=d,i=h),h>n&&p.dom.parentNode==this.dom){l=d,c=m;break}m=x,h=x+p.breakAfter}return{from:i,to:c<0?r+this.length:c,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:l=0?this.children[l].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=kw){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function VA(t,e,n,r,s,i,l,c,d){let{children:h}=t,m=h.length?h[e]:null,p=i.length?i[i.length-1]:null,x=p?p.breakAfter:l;if(!(e==r&&m&&!l&&!x&&i.length<2&&m.merge(n,s,i.length?p:null,n==0,c,d))){if(r0&&(!l&&i.length&&m.merge(n,m.length,i[0],!1,c,0)?m.breakAfter=i.shift().breakAfter:(ngV||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 Hi(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 ns(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 xV(this.dom,e,n)}}class pl extends jn{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(FA(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,l){return r&&(!(r instanceof pl&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=d,i++}let l=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new pl(this.mark,n,l)}domAtPos(e){return GA(this,e)}coordsAt(e,n){return YA(this,e,n)}}function xV(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,l=0;e==0&&n<0||e==r&&n>=0?Fe.chrome||Fe.gecko||(e?(s--,l=1):i=0)?0:c.length-1];return Fe.safari&&!l&&d.width==0&&(d=Array.prototype.find.call(c,h=>h.width)||d),l?s0(d,l<0):d||null}class al extends jn{static create(e,n,r){return new al(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=al.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,l){return r&&(!(r instanceof al)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?ns.before(this.dom):ns.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 l=this.side?this.side<0:e>0;for(let c=l?s.length-1:0;i=s[c],!(e>0?c==0:c==s.length-1||i.top0?ns.before(this.dom):ns.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Xt.empty}get isHidden(){return!0}}Hi.prototype.children=al.prototype.children=dd.prototype.children=kw;function GA(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let l=r[i-1];if(l.dom.parentNode==n)return l.domAtPos(l.length)}for(let i=s;i0&&e instanceof pl&&s.length&&(r=s[s.length-1])instanceof pl&&r.mark.eq(e.mark)?XA(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function YA(t,e,n){let r=null,s=-1,i=null,l=-1;function c(h,m){for(let p=0,x=0;p=m&&(v.children.length?c(v,m-x):(!i||i.isHidden&&(n>0||yV(i,v)))&&(b>m||x==b&&v.getSide()>0)?(i=v,l=m-x):(x-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 R2(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 bV(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new po(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:l}=KA(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(l?n?2e8:1:-6e8)+1}return new po(e,r,s,n,e.widget||null,!0)}static line(e){return new a0(e)}static set(e,n=!1){return Yt.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Je.none=Yt.empty;class i0 extends Je{constructor(e){let{start:n,end:r}=KA(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 i0&&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))&&jg(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)}}i0.prototype.point=!1;class a0 extends Je{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof a0&&this.spec.class==e.spec.class&&jg(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)}}a0.prototype.mapMode=Ur.TrackBefore;a0.prototype.point=!0;class po extends Je{constructor(e,n,r,s,i,l){super(n,r,i,e),this.block=s,this.isReplace=l,this.mapMode=s?n<=0?Ur.TrackBefore:Ur.TrackAfter:Ur.TrackDel}get type(){return this.startSide!=this.endSide?fs.WidgetRange:this.startSide<=0?fs.WidgetBefore:fs.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof po&&wV(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)}}po.prototype.point=!0;function KA(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 wV(t,e){return t==e||!!(t&&e&&t.compare(e))}function Zp(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 pr extends jn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,l){if(r){if(!(r instanceof pr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),WA(this,e,n,r?r.children.slice():[],i,l),!0}split(e){let n=new pr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:s}=this.childPos(e);s&&(n.append(this.children[r].split(s),0),this.children[r].merge(s,this.children[r].length,null,!1,0,0),r++);for(let i=r;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){jg(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){XA(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=D2(n,this.attrs||{})),r&&(this.attrs=D2({class:r},this.attrs||{}))}domAtPos(e){return GA(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(FA(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&&(R2(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&&jn.get(s)instanceof pl;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=jn.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!Fe.ios||!this.children.some(i=>i instanceof Hi))){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 Hi)||/[^ -~]/.test(r.text))return null;let s=ud(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=YA(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:s}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-s.lineHeight)<2&&s.textHeight=n){if(i instanceof pr)return i;if(l>n)break}s=l+i.breakAfter}return null}}class cl extends jn{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,l){return r&&(!(r instanceof cl)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class z2 extends ja{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 tf{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 cl&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new pr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(tp(new dd(-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 cl)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:l,lineBreak:c,done:d}=this.cursor.next(this.skip);if(this.skip=0,d)throw new Error("Ran out of text content when drawing inline views");if(c){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=l,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(tp(new Hi(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,l){if(this.disallowBlockEffectsFor[l]&&r instanceof po){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 c=n-e;if(r instanceof po)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new cl(r.widget||hd.block,c,r));else{let d=al.create(r.widget||hd.inline,c,c?0:r.startSide),h=this.atCursorPos&&!d.isEditable&&i<=s.length&&(e0),m=!d.isEditable&&(es.length||r.startSide<=0),p=this.getLine();this.pendingBuffer==2&&!h&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(p.append(tp(new dd(1),s),i),i=s.length+Math.max(0,i-s.length)),p.append(tp(d,s),i),this.atCursorPos=m,this.pendingBuffer=m?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);c&&(this.textOff+c<=this.text.length?this.textOff+=c:(this.skip+=c-(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 l=new tf(e,n,r,i);return l.openEnd=Yt.spans(s,n,r,l),l.openStart<0&&(l.openStart=l.openEnd),l.finish(l.openEnd),l}}function tp(t,e){for(let n of e)t=new pl(n,[t],t.length);return t}class hd extends ja{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}}hd.inline=new hd("span");hd.block=new hd("div");var Hn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Hn||(Hn={}));const Sc=Hn.LTR,Ow=Hn.RTL;function ZA(t){let e=[];for(let n=0;n=n){if(c.level==r)return l;(i<0||(s!=0?s<0?c.fromn:e[i].level>c.level))&&(i=l)}}if(i<0)throw new RangeError("Index out of range");return i}}function eM(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;k-=3)if(ta[k+1]==-v){let O=ta[k+2],j=O&2?s:O&4?O&1?i:s:0;j&&(En[p]=En[ta[k]]=j),c=k;break}}else{if(ta.length==189)break;ta[c++]=p,ta[c++]=x,ta[c++]=d}else if((b=En[p])==2||b==1){let k=b==s;d=k?0:1;for(let O=c-3;O>=0;O-=3){let j=ta[O+2];if(j&2)break;if(k)ta[O+2]|=2;else{if(j&4)break;ta[O+2]|=4}}}}}function CV(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let l=s?n[s-1].to:t,c=sd;)b==O&&(b=n[--k].from,O=k?n[k-1].to:t),En[--b]=v;d=m}else i=h,d++}}}function B2(t,e,n,r,s,i,l){let c=r%2?2:1;if(r%2==s%2)for(let d=e,h=0;dd&&l.push(new so(d,k.from,v));let O=k.direction==Sc!=!(v%2);L2(t,O?r+1:r,s,k.inner,k.from,k.to,l),d=k.to}b=k.to}else{if(b==n||(m?En[b]!=c:En[b]==c))break;b++}x?B2(t,d,b,r+1,s,x,l):de;){let m=!0,p=!1;if(!h||d>i[h-1].to){let k=En[d-1];k!=c&&(m=!1,p=k==16)}let x=!m&&c==1?[]:null,v=m?r:r+1,b=d;e:for(;;)if(h&&b==i[h-1].to){if(p)break e;let k=i[--h];if(!m)for(let O=k.from,j=h;;){if(O==e)break e;if(j&&i[j-1].to==O)O=i[--j].from;else{if(En[O-1]==c)break e;break}}if(x)x.push(k);else{k.toEn.length;)En[En.length]=256;let r=[],s=e==Sc?0:1;return L2(t,s,s,n,0,t.length,r),r}function tM(t){return[new so(0,t,0)]}let nM="";function AV(t,e,n,r,s){var i;let l=r.head-t.from,c=so.find(e,l,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),d=e[c],h=d.side(s,n);if(l==h){let x=c+=s?1:-1;if(x<0||x>=e.length)return null;d=e[c=x],l=d.side(!s,n),h=d.side(s,n)}let m=Vr(t.text,l,d.forward(s,n));(md.to)&&(m=h),nM=t.text.slice(Math.min(l,m),Math.max(l,m));let p=c==(s?e.length-1:0)?null:e[c+(s?1:-1)];return p&&m==h&&p.level+(s?0:1)t.some(e=>e)}),uM=He.define({combine:t=>t.some(e=>e)}),dM=He.define();class Xu{constructor(e,n="nearest",r="nearest",s=5,i=5,l=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=l}map(e){return e.empty?this:new Xu(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 Xu(Ce.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const np=vt.define({map:(t,e)=>t.map(e)}),hM=vt.define();function _s(t,e,n){let r=t.facet(aM);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 il=He.define({combine:t=>t.length?t[0]:!0});let EV=0;const Fu=He.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let d=[];return l&&d.push(yf.of(h=>{let m=h.plugin(c);return m?l(m):Je.none})),i&&d.push(i(c)),d})}static fromClass(e,n){return lr.define((r,s)=>new e(r,s),n)}}class Ey{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(_s(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){_s(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){_s(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const fM=He.define(),Cw=He.define(),yf=He.define(),mM=He.define(),l0=He.define(),pM=He.define();function fj(t,e){let n=t.state.facet(pM);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return Yt.spans(r,e.from,e.to,{point(){},span(i,l,c,d){let h=i-e.from,m=l-e.from,p=s;for(let x=c.length-1;x>=0;x--,d--){let v=c[x].spec.bidiIsolate,b;if(v==null&&(v=MV(e.text,h,m)),d>0&&p.length&&(b=p[p.length-1]).to==h&&b.direction==v)b.to=m,p=b.inner;else{let k={from:h,to:m,direction:v,inner:[]};p.push(k),p=k.inner}}}}),s}const gM=He.define();function Tw(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(gM)){let l=i(t);l&&(l.left!=null&&(e=Math.max(e,l.left)),l.right!=null&&(n=Math.max(n,l.right)),l.top!=null&&(r=Math.max(r,l.top)),l.bottom!=null&&(s=Math.max(s,l.bottom)))}return{left:e,right:n,top:r,bottom:s}}const Qh=He.define();class Ni{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new Ni(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.toAm)break;i+=2}if(!d)return r;new Ni(d.fromA,d.toA,d.fromB,d.toB).addToSet(r),l=d.toA,c=d.toB}}}class Ng{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=kr.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,l,c,d)=>s.push(new Ni(i,l,c,d))),this.changedRanges=s}static create(e,n,r){return new Ng(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 mj extends jn{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=Je.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 pr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ni(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:m})=>mthis.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:!LV(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?DV(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:m}=this.hasComposition;r=new Ni(h,m,e.changes.mapPos(h,-1),e.changes.mapPos(m,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Fe.ie||Fe.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let l=this.decorations,c=this.updateDeco(),d=PV(l,c,e.changes);return r=Ni.extendWithRanges(r,d),!(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 l=Fe.chrome||Fe.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,l),this.flags&=-8,l&&(l.written||s.selectionRange.focusNode!=l.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(l=>l.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[l]:null;if(!c)break;let{fromA:d,toA:h,fromB:m,toB:p}=c,x,v,b,k;if(r&&r.range.fromBm){let _=tf.build(this.view.state.doc,m,r.range.fromB,this.decorations,this.dynamicDecorationMap),D=tf.build(this.view.state.doc,r.range.toB,p,this.decorations,this.dynamicDecorationMap);v=_.breakAtStart,b=_.openStart,k=D.openEnd;let E=this.compositionView(r);D.breakAtStart?E.breakAfter=1:D.content.length&&E.merge(E.length,E.length,D.content[0],!1,D.openStart,0)&&(E.breakAfter=D.content[0].breakAfter,D.content.shift()),_.content.length&&E.merge(0,0,_.content[_.content.length-1],!0,0,_.openEnd)&&_.content.pop(),x=_.content.concat(E).concat(D.content)}else({content:x,breakAtStart:v,openStart:b,openEnd:k}=tf.build(this.view.state.doc,m,p,this.decorations,this.dynamicDecorationMap));let{i:O,off:j}=i.findPos(h,1),{i:T,off:A}=i.findPos(d,-1);VA(this,T,A,O,j,x,v,b,k)}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(hM)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new Hi(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new pl(s,[n],n.length);let r=new pr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,l)=>{l.flags|=8|(l.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(l);let c=jn.get(i);c&&c!=l&&(c.dom=null),l.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(il)||this.dom.tabIndex>-1)&&Kp(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(c.anchor)),h=c.empty?d:this.moveToLine(this.domAtPos(c.head));if(Fe.gecko&&c.empty&&!this.hasComposition&&_V(d)){let p=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(p,d.node.childNodes[d.offset]||null)),d=h=new ns(p,0),l=!0}let m=this.view.observer.selectionRange;(l||!m.focusNode||(!ef(d.node,d.offset,m.anchorNode,m.anchorOffset)||!ef(h.node,h.offset,m.focusNode,m.focusOffset))&&!this.suppressWidgetCursorChange(m,c))&&(this.view.observer.ignore(()=>{Fe.android&&Fe.chrome&&this.dom.contains(m.focusNode)&&BV(m.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let p=vf(this.view.root);if(p)if(c.empty){if(Fe.gecko){let x=RV(d.node,d.offset);if(x&&x!=3){let v=(x==1?$A:HA)(d.node,d.offset);v&&(d=new ns(v.node,v.offset))}}p.collapse(d.node,d.offset),c.bidiLevel!=null&&p.caretBidiLevel!==void 0&&(p.caretBidiLevel=c.bidiLevel)}else if(p.extend){p.collapse(d.node,d.offset);try{p.extend(h.node,h.offset)}catch{}}else{let x=document.createRange();c.anchor>c.head&&([d,h]=[h,d]),x.setEnd(h.node,h.offset),x.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(x)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,h)),this.impreciseAnchor=d.precise?null:new ns(m.anchorNode,m.anchorOffset),this.impreciseHead=h.precise?null:new ns(m.focusNode,m.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&ef(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=vf(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let l=pr.find(this,n.head);if(!l)return;let c=l.posAtStart;if(n.head==c||n.head==c+l.length)return;let d=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!d||!h||d.bottom>h.top)return;let m=this.domAtPos(n.head+n.assoc);r.collapse(m.node,m.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let p=e.observer.selectionRange;e.docView.posFromDOM(p.anchorNode,p.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=jn.get(n.childNodes[s]);i instanceof pr&&(r=i.domAtPos(i.length))}return r?new ns(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=jn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;l--){let c=this.children[l],d=i-c.breakAfter,h=d-c.length;if(de||c.covers(1))&&(!r||c instanceof pr&&!(r instanceof pr&&n>=0)))r=c,s=h;else if(r&&h==e&&d==e&&c instanceof cl&&Math.abs(n)<2){if(c.deco.startSide<0)break;l&&(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 pr))return null;for(;s.children.length;){let{i:c,off:d}=s.childPos(r,1);for(;;c++){if(c==s.children.length)return null;if((s=s.children[c]).length)break}r=d}if(!(s instanceof Hi))return null;let i=Vr(s.text,r);if(i==r)return null;let l=wc(s.dom,r,i).getClientRects();for(let c=0;cMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,d=this.view.textDirection==Hn.LTR;for(let h=0,m=0;ms)break;if(h>=r){let v=p.dom.getBoundingClientRect();if(n.push(v.height),l){let b=p.dom.lastChild,k=b?ud(b):[];if(k.length){let O=k[k.length-1],j=d?O.right-v.left:v.right-O.left;j>c&&(c=j,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=x)}}}h=x+p.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Hn.RTL:Hn.LTR}measureTextSize(){for(let i of this.children)if(i instanceof pr){let l=i.measureTextSize();if(l)return l}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=ud(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 UA(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],l=i?i.from-1:this.length;if(l>r){let c=(n.lineBlockAt(l).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(Je.replace({widget:new z2(c),block:!0,inclusive:!0,isBlockGap:!0}).range(r,l))}if(!i)break;r=i.to+1}return Je.set(e)}updateDeco(){let e=1,n=this.view.state.facet(yf).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(mM).map((i,l)=>{let c=typeof i=="function";return c&&(r=!0),c?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(Yt.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=Tw(this.view),l={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:c,offsetHeight:d}=this.view.scrollDOM;dV(this.view.scrollDOM,l,n.heads instanceof al||s.children.some(r);return r(this.children[n])}}function _V(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 xM(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=$A(n.focusNode,n.focusOffset),s=HA(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let c=jn.get(s.node);if(!c||c instanceof Hi&&c.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let d=jn.get(r.node);!d||d instanceof Hi&&d.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let l=e-i.offset;return{from:l,to:l+i.node.nodeValue.length,node:i.node}}function DV(t,e,n){let r=xM(t,n);if(!r)return null;let{node:s,from:i,to:l}=r,c=s.nodeValue;if(/[\n\r]/.test(c)||t.state.doc.sliceString(r.from,r.to)!=c)return null;let d=e.invertedDesc,h=new Ni(d.mapPos(i),d.mapPos(l),i,l),m=[];for(let p=s.parentNode;;p=p.parentNode){let x=jn.get(p);if(x instanceof pl)m.push({node:p,deco:x.mark});else{if(x instanceof pr||p.nodeName=="DIV"&&p.parentNode==t.contentDOM)return{range:h,text:s,marks:m,line:p};if(p!=t.contentDOM)m.push({node:p,deco:new i0({inclusive:!0,attributes:bV(p),tagName:p.tagName.toLowerCase()})});else return null}}}function RV(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function IV(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Ce.cursor(e);i==0?n=1:i==s.length&&(n=-1);let l=i,c=i;n<0?l=Vr(s.text,i,!1):c=Vr(s.text,i);let d=r(s.text.slice(l,c));for(;l>0;){let h=Vr(s.text,l,!1);if(r(s.text.slice(h,l))!=d)break;l=h}for(;ct?e.left-t:Math.max(0,t-e.right)}function FV(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function _y(t,e){return t.tope.top+1}function pj(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function q2(t,e,n){let r,s,i,l,c=!1,d,h,m,p;for(let b=t.firstChild;b;b=b.nextSibling){let k=ud(b);for(let O=0;OA||l==A&&i>T)&&(r=b,s=j,i=T,l=A,c=T?e0:Oj.bottom&&(!m||m.bottomj.top)&&(h=b,p=j):m&&_y(m,j)?m=gj(m,j.bottom):p&&_y(p,j)&&(p=pj(p,j.top))}}if(m&&m.bottom>=n?(r=d,s=m):p&&p.top<=n&&(r=h,s=p),!r)return{node:t,offset:0};let x=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return xj(r,x,n);if(c&&r.contentEditable!="false")return q2(r,x,n);let v=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:v}}function xj(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,l=0;for(let c=0;cn?m.top-n:n-m.bottom)-1;if(m.left-1<=e&&m.right+1>=e&&p=(m.left+m.right)/2,v=x;if(Fe.chrome||Fe.gecko){let b=wc(t,c).getBoundingClientRect();Math.abs(b.left-m.right)<.1&&(v=!x)}if(p<=0)return{node:t,offset:c+(v?1:0)};s=c+(v?1:0),i=p}}}return{node:t,offset:s>-1?s:l>0?t.nodeValue.length:0}}function vM(t,e,n,r=-1){var s,i;let l=t.contentDOM.getBoundingClientRect(),c=l.top+t.viewState.paddingTop,d,{docHeight:h}=t.viewState,{x:m,y:p}=e,x=p-c;if(x<0)return 0;if(x>h)return t.state.doc.length;for(let _=t.viewState.heightOracle.textHeight/2,D=!1;d=t.elementAtHeight(x),d.type!=fs.Text;)for(;x=r>0?d.bottom+_:d.top-_,!(x>=0&&x<=h);){if(D)return n?null:0;D=!0,r=-r}p=c+x;let v=d.from;if(vt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:vj(t,l,d,m,p);let b=t.dom.ownerDocument,k=t.root.elementFromPoint?t.root:b,O=k.elementFromPoint(m,p);O&&!t.contentDOM.contains(O)&&(O=null),O||(m=Math.max(l.left+1,Math.min(l.right-1,m)),O=k.elementFromPoint(m,p),O&&!t.contentDOM.contains(O)&&(O=null));let j,T=-1;if(O&&((s=t.docView.nearest(O))===null||s===void 0?void 0:s.isEditable)!=!1){if(b.caretPositionFromPoint){let _=b.caretPositionFromPoint(m,p);_&&({offsetNode:j,offset:T}=_)}else if(b.caretRangeFromPoint){let _=b.caretRangeFromPoint(m,p);_&&({startContainer:j,startOffset:T}=_)}j&&(!t.contentDOM.contains(j)||Fe.safari&&QV(j,T,m)||Fe.chrome&&$V(j,T,m))&&(j=void 0),j&&(T=Math.min(ba(j),T))}if(!j||!t.docView.dom.contains(j)){let _=pr.find(t.docView,v);if(!_)return x>d.top+d.height/2?d.to:d.from;({node:j,offset:T}=q2(_.dom,m,p))}let A=t.docView.nearest(j);if(!A)return null;if(A.isWidget&&((i=A.dom)===null||i===void 0?void 0:i.nodeType)==1){let _=A.dom.getBoundingClientRect();return e.y<_.top||e.y<=_.bottom&&e.x<=(_.left+_.right)/2?A.posAtStart:A.posAtEnd}else return A.localPosFromDOM(j,T)+A.posAtStart}function vj(t,e,n,r,s){let i=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let c=t.viewState.heightOracle.textHeight,d=Math.floor((s-n.top-(t.defaultLineHeight-c)*.5)/c);i+=d*t.viewState.heightOracle.lineLength}let l=t.state.sliceDoc(n.from,n.to);return n.from+j2(l,i,t.state.tabSize)}function yM(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 l=s.parentNode;if(!l||l.nodeName=="DIV")break;s=l}}return wc(t,r-1,r).getBoundingClientRect().right>n}function QV(t,e,n){return yM(t,e,n)}function $V(t,e,n){if(e!=0)return yM(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():wc(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function F2(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.toe)return i;(!s||i.type==fs.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function HV(t,e,n,r){let s=F2(t,e.head,e.assoc||-1),i=!r||s.type!=fs.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let l=t.dom.getBoundingClientRect(),c=t.textDirectionAt(s.from),d=t.posAtCoords({x:n==(c==Hn.LTR)?l.right-1:l.left+1,y:(i.top+i.bottom)/2});if(d!=null)return Ce.cursor(d,n?-1:1)}return Ce.cursor(n?s.to:s.from,n?-1:1)}function yj(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),l=t.textDirectionAt(s.from);for(let c=e,d=null;;){let h=AV(s,i,l,c,n),m=nM;if(!h){if(s.number==(n?t.state.doc.lines:1))return c;m=` `,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(d){if(!d(m))return c}else{if(!r)return h;d=r(m)}c=h}}function UV(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let l=r(i);return s==Vn.Space&&(s=l),s==l}}function VV(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Ce.cursor(s,e.assoc);let l=e.goalColumn,c,d=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),m=t.documentTop;if(h)l==null&&(l=h.left-d.left),c=i<0?h.top:h.bottom;else{let v=t.viewState.lineBlockAt(s);l==null&&(l=Math.min(d.right-d.left,t.defaultCharacterWidth*(s-v.from))),c=(i<0?v.top:v.bottom)+m}let p=d.left+l,x=r??t.viewState.heightOracle.textHeight>>1;for(let v=0;;v+=10){let b=c+(x+v)*i,k=vM(t,{x:p,y:b},!1,i);if(bd.bottom||(i<0?ks)){let O=t.docView.coordsForChar(k),j=!O||b{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ce.cursor(r,ri)&&!XV(l,n)&&this.lineBreak(),s=l}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,l=1,c;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),l=this.lineSeparator.length):(c=s.exec(n))&&(i=c.index,l=c[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),l>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=l-1);r=i+l}}readNode(e){if(e.cmIgnore)return;let n=jn.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+(GV(e,r.node,r.offset)?n:0))}}function GV(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:l}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let c=i||l?[]:ZV(e),d=new WV(c,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=JV(c,this.bounds.from)}else{let c=e.observer.selectionRange,d=i&&i.node==c.focusNode&&i.offset==c.focusOffset||!_2(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),h=l&&l.node==c.anchorNode&&l.offset==c.anchorOffset||!_2(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),m=e.viewport;if((Fe.ios||Fe.chrome)&&e.state.selection.main.empty&&d!=h&&(m.from>0||m.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ce.range(h,d)):this.newSel=Ce.single(h,d)}}}function wM(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:l,to:c}=e.bounds,d=s.from,h=null;(i===8||Fe.android&&e.text.length=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Fe.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` - `&&t.lineWrapping&&(r&&(r=Ce.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Xt.of([" "])}),n)return Aw(t,n,r,i);if(r&&!r.main.eq(s)){let l=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=bM(t.state.facet(l0).map(d=>d(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function Aw(t,e,n,r=-1){if(Fe.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Fe.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&&Gu(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&Gu(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Gu(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l,c=()=>l||(l=KV(t,e,n));return t.state.facet(lM).some(d=>d(t,e.from,e.to,i,c))||t.dispatch(c()),!0}function KV(t,e,n){let r,s=t.state,i=s.selection.main,l=-1;if(e.from==e.to&&e.fromi.to){let d=e.fromp(t)),h,d);e.from==m&&(l=m)}if(l>-1)r={changes:e,selection:Ce.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 d=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(d+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let d=s.changes(e),h=n&&n.main.to<=d.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 m=t.state.sliceDoc(e.from,e.to),p,x=n&&xM(t,n.main.head);if(x){let b=e.insert.length-(e.to-e.from);p={from:x.from,to:x.to-b}}else p=t.state.doc.lineAt(i.head);let v=i.to-e.to;r=s.changeByRange(b=>{if(b.from==i.from&&b.to==i.to)return{changes:d,range:h||b.map(d)};let k=b.to-v,O=k-m.length;if(t.state.sliceDoc(O,k)!=m||k>=p.from&&O<=p.to)return{range:b};let j=s.changes({from:O,to:k,insert:e.insert}),T=b.to-i.to;return{changes:j,range:h?Ce.range(Math.max(0,h.anchor+T),Math.max(0,h.head+T)):b.map(j)}})}else r={changes:d,selection:h&&s.selection.replaceRange(h)}}let c="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,c+=".compose",t.inputState.compositionFirstChange&&(c+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:c,scrollIntoView:!0})}function SM(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&c>0&&t.charCodeAt(l-1)==e.charCodeAt(c-1);)l--,c--;if(r=="end"){let d=Math.max(0,i-Math.min(l,c));n-=l+d-i}if(l=l?i-n:0;i-=d,c=i+(c-l),l=i}else if(c=c?i-n:0;i-=d,l=i+(l-c),c=i}return{from:i,toA:l,toB:c}}function ZV(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 bj(n,r)),(s!=n||i!=r)&&e.push(new bj(s,i))),e}function JV(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?Ce.single(n+e,r+e):null}class eW{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,Fe.safari&&e.contentDOM.addEventListener("input",()=>null),Fe.gecko&&gW(e.contentDOM.ownerDocument)}handleEvent(e){!oW(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=tW(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let l=!n[i].handlers.length,c=r[i];c&&l!=!c.handlers.length&&(s.removeEventListener(i,this.handleEvent),c=null),c||s.addEventListener(i,this.handleEvent,{passive:l})}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&&OM.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Fe.android&&Fe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Fe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=kM.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||nW.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Fe.safari&&!Fe.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 wj(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){_s(n.state,s)}}}function tW(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,l=s&&s.plugin.domEventObservers;if(i)for(let c in i){let d=i[c];d&&n(c).handlers.push(wj(r.value,d))}if(l)for(let c in l){let d=l[c];d&&n(c).observers.push(wj(r.value,d))}}for(let r in Ui)n(r).handlers.push(Ui[r]);for(let r in Ti)n(r).observers.push(Ti[r]);return e}const kM=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nW="dthko",OM=[16,17,18,20,91,92,224,225],rp=6;function sp(t){return Math.max(0,t)*.7+8}function rW(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class sW{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=hV(e.contentDOM),this.atoms=e.state.facet(l0).map(l=>l(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(Vt.allowMultipleSelections)&&iW(e,n),this.dragging=lW(e,n)&&CM(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&&rW(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,l=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:c}=this.scrollParents.y.getBoundingClientRect());let d=Tw(this.view);e.clientX-d.left<=s+rp?n=-sp(s-e.clientX):e.clientX+d.right>=l-rp&&(n=sp(e.clientX-l)),e.clientY-d.top<=i+rp?r=-sp(i-e.clientY):e.clientY+d.bottom>=c-rp&&(r=sp(e.clientY-c)),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=bM(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 iW(t,e){let n=t.state.facet(rM);return n.length?n[0](e):Fe.mac?e.metaKey:e.ctrlKey}function aW(t,e){let n=t.state.facet(sM);return n.length?n[0](e):Fe.mac?!e.altKey:!e.ctrlKey}function lW(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=vf(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&l.top<=e.clientY&&l.bottom>=e.clientY)return!0}return!1}function oW(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=jn.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ui=Object.create(null),Ti=Object.create(null),jM=Fe.ie&&Fe.ie_version<15||Fe.ios&&Fe.webkit_version<604;function cW(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(),NM(t,n.value)},50)}function kx(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function NM(t,e){e=kx(t.state,jw,e);let{state:n}=t,r,s=1,i=n.toText(e),l=i.lines==n.selection.ranges.length;if(Q2!=null&&n.selection.ranges.every(d=>d.empty)&&Q2==i.toString()){let d=-1;r=n.changeByRange(h=>{let m=n.doc.lineAt(h.from);if(m.from==d)return{range:h};d=m.from;let p=n.toText((l?i.line(s++).text:e)+n.lineBreak);return{changes:{from:m.from,insert:p},range:Ce.cursor(h.from+p.length)}})}else l?r=n.changeByRange(d=>{let h=i.line(s++);return{changes:{from:d.from,to:d.to,insert:h.text},range:Ce.cursor(d.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Ti.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ui.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ti.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ti.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ui.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(iM))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=hW(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new sW(t,e,n,r)),r&&t.observer.ignore(()=>{qA(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 Sj(t,e,n,r){if(r==1)return Ce.cursor(e,n);if(r==2)return IV(t.state,e,n);{let s=pr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),l=s?s.posAtStart:i.from,c=s?s.posAtEnd:i.to;return ce>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function uW(t,e,n,r){let s=pr.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 l=s.coordsAt(i,-1);if(l&&kj(n,r,l))return-1;let c=s.coordsAt(i,1);return c&&kj(n,r,c)?1:l&&l.bottom>=r?-1:1}function Oj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:uW(t,n,e.clientX,e.clientY)}}const dW=Fe.ie&&Fe.ie_version<=11;let jj=null,Nj=0,Cj=0;function CM(t){if(!dW)return t.detail;let e=jj,n=Cj;return jj=t,Cj=Date.now(),Nj=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Nj+1)%3:1}function hW(t,e){let n=Oj(t,e),r=CM(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,l,c){let d=Oj(t,i),h,m=Sj(t,d.pos,d.bias,r);if(n.pos!=d.pos&&!l){let p=Sj(t,n.pos,n.bias,r),x=Math.min(p.from,m.from),v=Math.max(p.to,m.to);m=x1&&(h=fW(s,d.pos))?h:c?s.addRange(m):Ce.create([m])}}}function fW(t,e){for(let n=0;n=e)return Ce.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}Ui.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,l=i+s.length;(i>=n.to||l<=n.from)&&(n=Ce.range(i,l))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",kx(t.state,Nw,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ui.dragend=t=>(t.inputState.draggedContent=null,!1);function Tj(t,e,n,r){if(n=kx(t.state,jw,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,l=r&&i&&aW(t,e)?{from:i.from,to:i.to}:null,c={from:s,insert:n},d=t.state.changes(l?[l,c]:c);t.focus(),t.dispatch({changes:d,selection:{anchor:d.mapPos(s,-1),head:d.mapPos(s,1)},userEvent:l?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ui.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&&Tj(t,e,r.filter(l=>l!=null).join(t.state.lineBreak),!1)};for(let l=0;l{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(r[l]=c.result),i()},c.readAsText(n[l])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Tj(t,e,r,!0),!0}return!1};Ui.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=jM?null:e.clipboardData;return n?(NM(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(cW(t),!1)};function mW(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 pW(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 l=t.doc.lineAt(i);l.number>s&&(e.push(l.text),n.push({from:l.from,to:Math.min(t.doc.length,l.to+1)})),s=l.number}r=!0}return{text:kx(t,Nw,e.join(t.lineBreak)),ranges:n,linewise:r}}let Q2=null;Ui.copy=Ui.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=pW(t.state);if(!n&&!s)return!1;Q2=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=jM?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(mW(t,n),!1)};const TM=ka.define();function AM(t,e){let n=[];for(let r of t.facet(oM)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:TM.of(!0)}):null}function MM(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=AM(t.state,e);n?t.dispatch(n):t.update([])}},10)}Ti.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),MM(t)};Ti.blur=t=>{t.observer.clearSelectionRange(),MM(t)};Ti.compositionstart=Ti.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ti.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,Fe.chrome&&Fe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ti.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ui.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"),l=e.getTargetRanges();if(i&&l.length){let c=l[0],d=t.posAtDOM(c.startContainer,c.startOffset),h=t.posAtDOM(c.endContainer,c.endOffset);return Aw(t,{from:d,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Fe.chrome&&Fe.android&&(s=kM.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 l;(((l=window.visualViewport)===null||l===void 0?void 0:l.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Fe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Fe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ti.compositionend(t,e),20),!1};const Aj=new Set;function gW(t){Aj.has(t)||(Aj.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Mj=["pre-wrap","normal","pre-line","break-spaces"];let fd=!1;function Ej(){fd=!1}class xW{constructor(e){this.lineWrapping=e,this.doc=Xt.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 Mj.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,d=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,d){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Jp&&(fd=!0),this.height=e)}replace(e,n,r){return ms.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,l=r.doc;for(let c=s.length-1;c>=0;c--){let{fromA:d,toA:h,fromB:m,toB:p}=s[c],x=i.lineAt(d,$n.ByPosNoHeight,r.setDoc(n),0,0),v=x.to>=h?x:i.lineAt(h,$n.ByPosNoHeight,r,0,0);for(p+=v.to-h,h=v.to;c>0&&x.from<=s[c-1].toA;)d=s[c-1].fromA,m=s[c-1].fromB,c--,di*2){let c=e[n-1];c.break?e.splice(--n,1,c.left,null,c.right):e.splice(--n,1,c.left,c.right),r+=1+c.break,s-=c.size}else if(i>s*2){let c=e[r];c.break?e.splice(r,1,c.left,null,c.right):e.splice(r,1,c.left,c.right),r+=2+c.break,i-=c.size}else break;else if(s=i&&l(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 ei extends EM{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new ca(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof ei||s instanceof $r&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof $r?s=new ei(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ms.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 $r extends ms{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,l,c=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*i);l=d/i,this.length>i+1&&(c=(this.height-d)/(this.length-i-1))}else l=this.height/i;return{firstLine:r,lastLine:s,perLine:l,perChar:c}}blockAt(e,n,r,s){let{firstLine:i,lastLine:l,perLine:c,perChar:d}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof $r?r[r.length-1]=new $r(i.length+s):r.push(null,new $r(s-1))}if(e>0){let i=r[0];i instanceof $r?r[0]=new $r(e+i.length):r.unshift(new $r(e-1),null)}return ms.of(r)}decomposeLeft(e,n){n.push(new $r(e-1),null)}decomposeRight(e,n){n.push(null,new $r(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 l=[],c=Math.max(n,s.from),d=-1;for(s.from>n&&l.push(new $r(s.from-n-1).updateHeight(e,n));c<=i&&s.more;){let m=e.doc.lineAt(c).length;l.length&&l.push(null);let p=s.heights[s.index++];d==-1?d=p:Math.abs(p-d)>=Jp&&(d=-2);let x=new ei(m,p);x.outdated=!1,l.push(x),c+=m+1}c<=i&&l.push(null,new $r(i-c).updateHeight(e,c));let h=ms.of(l);return(d<0||Math.abs(h.height-this.height)>=Jp||Math.abs(d-this.heightMetrics(e,n).perLine)>=Jp)&&(fd=!0),Cg(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 yW extends ms{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 ec))return h;let m=n==$n.ByPosNoHeight?$n.ByPosNoHeight:$n.ByPos;return d?h.join(this.right.lineAt(c,m,r,l,c)):this.left.lineAt(c,m,r,s,i).join(h)}forEachLine(e,n,r,s,i,l){let c=s+this.left.height,d=i+this.left.length+this.break;if(this.break)e=d&&this.right.forEachLine(e,n,r,c,d,l);else{let h=this.lineAt(d,$n.ByPos,r,s,i);e=e&&h.from<=n&&l(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,c,d,l)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let l=i.length;for(let c of r)i.push(c);if(e>0&&_j(i,l-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?ms.of(this.break?[e,null,n]:[e,n]):(this.left=Cg(this.left,e),this.right=Cg(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:l}=this,c=n+i.length+this.break,d=null;return s&&s.from<=n+i.length&&s.more?d=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=c+l.length&&s.more?d=l=l.updateHeight(e,c,r,s):l.updateHeight(e,c,r),d?this.balanced(i,l):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function _j(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof $r&&(r=t[e+1])instanceof $r&&t.splice(e-1,3,new $r(n.length+1+r.length))}const bW=5;class Mw{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 ei?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new ei(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=bW)&&this.addLineDeco(s,i,l)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new ei(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new $r(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 ei)return e;let n=new ei(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 ei)&&!this.isCovered?this.nodes.push(new ei(0,-1)):(this.writtenTom.clientHeight||m.scrollWidth>m.clientWidth)&&p.overflow!="visible"){let x=m.getBoundingClientRect();i=Math.max(i,x.left),l=Math.min(l,x.right),c=Math.max(c,x.top),d=Math.min(h==t.parentNode?s.innerHeight:d,x.bottom)}h=p.position=="absolute"||p.position=="fixed"?m.offsetParent:m.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,l)-n.left,top:c-(n.top+e),bottom:Math.max(c,d)-(n.top+e)}}function OW(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function jW(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ry{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new xW(n),this.stateDeco=e.facet(yf).filter(r=>typeof r!="function"),this.heightMap=ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle.setDoc(e.doc),[new Ni(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=Je.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:l})=>s>=i&&s<=l)){let{from:i,to:l}=this.lineBlockAt(s);e.push(new ip(i,l))}}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?Rj:new Ew(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(Hh(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(yf).filter(m=>typeof m!="function");let s=e.changedRanges,i=Ni.extendWithRanges(s,wW(r,this.stateDeco,e?e.changes:kr.empty(this.state.doc.length))),l=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ej(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=l||fd)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=l);let d=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headd.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,n));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,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(uM)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Hn.RTL:Hn.LTR;let l=this.heightOracle.mustRefreshForWrapping(i),c=n.getBoundingClientRect(),d=l||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let h=0,m=0;if(c.width&&c.height){let{scaleX:_,scaleY:D}=IA(n,c);(_>.005&&Math.abs(this.scaleX-_)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=_,this.scaleY=D,h|=16,l=d=!0)}let p=(parseInt(r.paddingTop)||0)*this.scaleY,x=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=x)&&(this.paddingTop=p,this.paddingBottom=x,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=QA(e.scrollDOM);let b=(this.printing?jW:kW)(n,this.paddingTop),k=b.top-this.pixelViewport.top,O=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(d=!0)),!this.inView&&!this.scrollTarget&&!OW(e.dom))return 0;let T=c.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),d){let _=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(_)&&(l=!0),l||s.lineWrapping&&Math.abs(T-this.contentDOMWidth)>s.charWidth){let{lineHeight:D,charWidth:E,textHeight:R}=e.docView.measureTextSize();l=D>0&&s.refresh(i,D,E,R,Math.max(5,T/E),_),l&&(e.docView.minWidth=0,h|=16)}k>0&&O>0?m=Math.max(k,O):k<0&&O<0&&(m=Math.min(k,O)),Ej();for(let D of this.viewports){let E=D.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(D);this.heightMap=(l?ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle,[new Ni(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,l,new vW(D.from,E))}fd&&(h|=2)}let A=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return A&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),h|=this.updateForViewport()),(h&2||A)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]: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:l,visibleBottom:c}=this,d=new ip(s.lineAt(l-r*1e3,$n.ByHeight,i,0,0).from,s.lineAt(c+(1-r)*1e3,$n.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hd.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=s.lineAt(h,$n.ByPos,i,0,0),x;n.y=="center"?x=(p.top+p.bottom)/2-m/2:n.y=="start"||n.y=="nearest"&&h=c+Math.max(10,Math.min(r,250)))&&s>l-2*1e3&&i>1,l=s<<1;if(this.defaultTextDirection!=Hn.LTR&&!r)return[];let c=[],d=(m,p,x,v)=>{if(p-mm&&jj.from>=x.from&&j.to<=x.to&&Math.abs(j.from-m)j.fromT));if(!O){if(pA.from<=p&&A.to>=p)){let A=n.moveToLineBoundary(Ce.cursor(p),!1,!0).head;A>m&&(p=A)}let j=this.gapSize(x,m,p,v),T=r||j<2e6?j:2e6;O=new Ry(m,p,j,T)}c.push(O)},h=m=>{if(m.length2e6)for(let E of e)E.from>=m.from&&E.fromm.from&&d(m.from,v,m,p),bn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Yt.spans(n,this.viewport.from,this.viewport.to,{span(i,l){r.push({from:i,to:l})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Hh(this.heightMap.lineAt(e,$n.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)||Hh(this.heightMap.lineAt(this.scaler.fromDOM(e),$n.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 Hh(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 ip=class{constructor(e,n){this.from=e,this.to=n}};function CW(t,e,n){let r=[],s=t,i=0;return Yt.spans(n,t,e,{span(){},point(l,c){l>s&&(r.push({from:s,to:l}),i+=l-s),s=c}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:l}=e[s],c=l-i;if(r<=c)return i+r;r-=c}}function lp(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 TW(t,e){for(let n of t)if(e(n))return n}const Rj={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class Ew{constructor(e,n,r){let s=0,i=0,l=0;this.viewports=r.map(({from:c,to:d})=>{let h=n.lineAt(c,$n.ByPos,e,0,0).top,m=n.lineAt(d,$n.ByPos,e,0,0).bottom;return s+=m-h,{from:c,to:d,top:h,bottom:m,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let c of this.viewports)c.domTop=l+(c.top-i)*this.scale,l=c.domBottom=c.domTop+(c.bottom-c.top),i=c.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Hh(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new ca(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>Hh(s,e)):t._content)}const op=He.define({combine:t=>t.join(" ")}),$2=He.define({combine:t=>t.indexOf(!0)>-1}),H2=fo.newName(),_M=fo.newName(),DM=fo.newName(),RM={"&light":"."+_M,"&dark":"."+DM};function U2(t,e,n){return new fo(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 AW=U2("."+H2,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},RM),MW={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zy=Fe.ie&&Fe.ie_version<=11;class EW{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fV,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);(Fe.ie&&Fe.ie_version<=11||Fe.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&&Fe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Fe.chrome&&Fe.chrome_version<126)&&(this.editContext=new DW(e),e.state.facet(il)&&(e.contentDOM.editContext=this.editContext.editContext)),zy&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(il)?r.root.activeElement!=this.dom:!Kp(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Fe.ie&&Fe.ie_version<=11||Fe.android&&Fe.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ef(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=vf(e.root);if(!n)return!1;let r=Fe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&_W(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Kp(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Gu(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let l=this.readMutation(i);l&&(l.typeOver&&(s=!0),n==-1?{from:n,to:r}=l:(n=Math.min(l.from,n),r=Math.max(l.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Kp(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 YV(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=wM(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=zj(n,e.previousSibling||e.target.previousSibling,-1),s=zj(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(il)!=e.state.facet(il)&&(e.view.contentDOM.editContext=e.state.facet(il)?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 zj(t,e,n){for(;e;){let r=jn.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 Pj(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return ef(l.node,l.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function _W(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Pj(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?Pj(t,n):null}class DW{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:l}=s,c=this.toEditorPos(r.updateRangeStart),d=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:c,drifted:!1});let h=d-c>r.text.length;c==this.from&&ithis.to&&(d=i);let m=SM(e.state.sliceDoc(c,d),r.text,(h?s.from:s.to)-c,h?"end":null);if(!m){let x=Ce.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));x.main.eq(s)||e.dispatch({selection:x,userEvent:"select"});return}let p={from:m.from+c,to:m.toA+c,insert:Xt.of(r.text.slice(m.from,m.toB).split(` -`))};if((Fe.mac||Fe.android)&&p.from==l-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:c,to:d,insert:Xt.of([r.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let x=this.to-this.from+(p.to-p.from+p.insert.length);Aw(e,p,Ce.single(this.toEditorPos(r.selectionStart,x),this.toEditorPos(r.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let l=this.toEditorPos(r.rangeStart),c=this.toEditorPos(r.rangeEnd);l{let s=[];for(let i of r.getTextFormats()){let l=i.underlineStyle,c=i.underlineThickness;if(!/none/i.test(l)&&!/none/i.test(c)){let d=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(d{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=vf(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,l,c,d,h)=>{if(r)return;let m=h.length-(l-i);if(s&&l>=s.to)if(s.from==i&&s.to==l&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=m,this.to+=m;return}else s=null,this.revertPending(e.state);if(i+=n,l+=n,l<=this.from)this.from+=m,this.to+=m;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(l),h.toString()),this.to+=m}n+=m}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class qe{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||mV(e.parent)||document,this.viewState=new Dj(e.state||Vt.create(e)),e.scrollTo&&e.scrollTo.is(np)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Fu).map(s=>new Ey(s));for(let s of this.plugins)s.update(this);this.observer=new EW(this),this.inputState=new eW(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mj(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 gr?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 x of e){if(x.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=x.state}if(this.destroyed){this.viewState.state=i;return}let l=this.hasFocus,c=0,d=null;e.some(x=>x.annotation(TM))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,d=AM(i,l),d||(c=1));let h=this.observer.delayedAndroidKey,m=null;if(h?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange(),(m&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(m=null)):this.observer.clear(),i.facet(Vt.phrases)!=this.state.facet(Vt.phrases))return this.setState(i);s=Ng.create(this,i,e),s.flags|=c;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(p&&(p=p.map(x.changes)),x.scrollIntoView){let{main:v}=x.state.selection;p=new Xu(v.empty?v:Ce.cursor(v.head,v.head>v.anchor?-1:1))}for(let v of x.effects)v.is(np)&&(p=v.value.clip(this.state))}this.viewState.update(s,p),this.bidiCache=Tg.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Qh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(x=>x.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(op)!=s.state.facet(op)&&(this.viewState.mustMeasureContent=!0),(n||r||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let x of this.state.facet(I2))try{x(s)}catch(v){_s(this.state,v,"update listener")}(d||m)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),m&&!wM(this,m)&&h.force&&Gu(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 Dj(e),this.plugins=e.facet(Fu).map(r=>new Ey(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new mj(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(Fu),r=e.state.facet(Fu);if(n!=r){let s=[];for(let i of r){let l=n.indexOf(i);if(l<0)s.push(new Ey(i));else{let c=this.plugins[l];c.mustUpdate=e,s.push(c)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:l}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(l=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(l<0)if(QA(r))i=-1,l=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(s);i=v.from,l=v.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let m=h.map(v=>{try{return v.read(this)}catch(b){return _s(this.state,b),Bj}}),p=Ng.create(this,this.state,[]),x=!1;p.flags|=d,n?n.flags|=d:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),x=this.docView.update(p),x&&this.docViewUpdate());for(let v=0;v1||b<-1){s=s+b,r.scrollTop=s/this.scaleY,l=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let c of this.state.facet(I2))c(n)}get themeClasses(){return H2+" "+(this.state.facet($2)?DM:_M)+" "+this.state.facet(op)}updateAttrs(){let e=Lj(this,fM,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(il)?"true":"false",class:"cm-content",style:`${Fe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Lj(this,Cw,n);let r=this.observer.ignore(()=>{let s=R2(this.contentDOM,this.contentAttrs,n),i=R2(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(qe.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(Qh);let e=this.state.facet(qe.cspNonce);fo.mount(this.root,this.styleModules.concat(AW).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Dy(this,e,yj(this,e,n,r))}moveByGroup(e,n){return Dy(this,e,yj(this,e,n,r=>UV(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 Ce.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return HV(this,e,n,r)}moveVertically(e,n,r){return Dy(this,e,VV(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(),vM(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),l=i[so.find(i,e-s.from,-1,n)];return s0(r,l.dir==Hn.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(cM)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>RW)return tM(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||eM(i.isolates,r=fj(this,e))))return i.order;r||(r=fj(this,e));let s=TV(e.text,n,r);return this.bidiCache.push(new Tg(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Fe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qA(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 np.of(new Xu(typeof e=="number"?Ce.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 np.of(new Xu(Ce.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 lr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return lr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=fo.newName(),s=[op.of(r),Qh.of(U2(`.${r}`,e))];return n&&n.dark&&s.push($2.of(!0)),s}static baseTheme(e){return No.lowest(Qh.of(U2("."+H2,e,RM)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&jn.get(r)||jn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}qe.styleModule=Qh;qe.inputHandler=lM;qe.clipboardInputFilter=jw;qe.clipboardOutputFilter=Nw;qe.scrollHandler=dM;qe.focusChangeEffect=oM;qe.perLineTextDirection=cM;qe.exceptionSink=aM;qe.updateListener=I2;qe.editable=il;qe.mouseSelectionStyle=iM;qe.dragMovesSelection=sM;qe.clickAddsSelectionRange=rM;qe.decorations=yf;qe.outerDecorations=mM;qe.atomicRanges=l0;qe.bidiIsolatedRanges=pM;qe.scrollMargins=gM;qe.darkTheme=$2;qe.cspNonce=He.define({combine:t=>t.length?t[0]:""});qe.contentAttributes=Cw;qe.editorAttributes=fM;qe.lineWrapping=qe.contentAttributes.of({class:"cm-lineWrapping"});qe.announce=vt.define();const RW=4096,Bj={};class Tg{constructor(e,n,r,s,i,l){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=l}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Hn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],l=typeof i=="function"?i(t):i;l&&D2(l,n)}return n}const zW=Fe.mac?"mac":Fe.windows?"win":Fe.linux?"linux":"key";function PW(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,l,c;for(let d=0;dr.concat(s),[]))),n}function LW(t,e,n){return PM(zM(t.state),e,t,n)}let no=null;const IW=4e3;function qW(t,e=zW){let n=Object.create(null),r=Object.create(null),s=(l,c)=>{let d=r[l];if(d==null)r[l]=c;else if(d!=c)throw new Error("Key binding "+l+" is used both as a regular binding and as a multi-stroke prefix")},i=(l,c,d,h,m)=>{var p,x;let v=n[l]||(n[l]=Object.create(null)),b=c.split(/ (?!$)/).map(j=>PW(j,e));for(let j=1;j{let _=no={view:A,prefix:T,scope:l};return setTimeout(()=>{no==_&&(no=null)},IW),!0}]})}let k=b.join(" ");s(k,!1);let O=v[k]||(v[k]={preventDefault:!1,stopPropagation:!1,run:((x=(p=v._any)===null||p===void 0?void 0:p.run)===null||x===void 0?void 0:x.slice())||[]});d&&O.run.push(d),h&&(O.preventDefault=!0),m&&(O.stopPropagation=!0)};for(let l of t){let c=l.scope?l.scope.split(" "):["editor"];if(l.any)for(let h of c){let m=n[h]||(n[h]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=l;for(let x in m)m[x].run.push(v=>p(v,V2))}let d=l[e]||l.key;if(d)for(let h of c)i(h,d,l.run,l.preventDefault,l.stopPropagation),l.shift&&i(h,"Shift-"+d,l.shift,l.preventDefault,l.stopPropagation)}return n}let V2=null;function PM(t,e,n,r){V2=e;let s=oV(e),i=As(s,0),l=oa(i)==s.length&&s!=" ",c="",d=!1,h=!1,m=!1;no&&no.view==n&&no.scope==r&&(c=no.prefix+" ",OM.indexOf(e.keyCode)<0&&(h=!0,no=null));let p=new Set,x=O=>{if(O){for(let j of O.run)if(!p.has(j)&&(p.add(j),j(n)))return O.stopPropagation&&(m=!0),!0;O.preventDefault&&(O.stopPropagation&&(m=!0),h=!0)}return!1},v=t[r],b,k;return v&&(x(v[c+cp(s,e,!l)])?d=!0:l&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Fe.windows&&e.ctrlKey&&e.altKey)&&!(Fe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(b=mo[e.keyCode])&&b!=s?(x(v[c+cp(b,e,!0)])||e.shiftKey&&(k=xf[e.keyCode])!=s&&k!=b&&x(v[c+cp(k,e,!1)]))&&(d=!0):l&&e.shiftKey&&x(v[c+cp(s,e,!0)])&&(d=!0),!d&&x(v._any)&&(d=!0)),h&&(d=!0),d&&m&&e.stopPropagation(),V2=null,d}class c0{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=BM(e);return[new c0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return FW(e,n,r)}}function BM(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Hn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function qj(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),l=(s.top+s.bottom)/2,c=t.posAtCoords({x:i.left+1,y:l}),d=t.posAtCoords({x:i.right-1,y:l});return c==null||d==null?r:{from:Math.max(r.from,Math.min(c,d)),to:Math.min(r.to,Math.max(c,d))}}function FW(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==Hn.LTR,l=t.contentDOM,c=l.getBoundingClientRect(),d=BM(t),h=l.querySelector(".cm-line"),m=h&&window.getComputedStyle(h),p=c.left+(m?parseInt(m.paddingLeft)+Math.min(0,parseInt(m.textIndent)):0),x=c.right-(m?parseInt(m.paddingRight):0),v=F2(t,r,1),b=F2(t,s,-1),k=v.type==fs.Text?v:null,O=b.type==fs.Text?b:null;if(k&&(t.lineWrapping||v.widgetLineBreaks)&&(k=qj(t,r,1,k)),O&&(t.lineWrapping||b.widgetLineBreaks)&&(O=qj(t,s,-1,O)),k&&O&&k.from==O.from&&k.to==O.to)return T(A(n.from,n.to,k));{let D=k?A(n.from,null,k):_(v,!1),E=O?A(null,n.to,O):_(b,!0),R=[];return(k||v).to<(O||b).from-(k&&O?1:0)||v.widgetLineBreaks>1&&D.bottom+t.defaultLineHeight/2V&&W.from=$)break;z>J&&U(Math.max(ce,J),D==null&&ce<=V,Math.min(z,$),E==null&&z>=de,ne.dir)}if(J=ae.to+1,J>=$)break}return L.length==0&&U(V,D==null,de,E==null,t.textDirection),{top:Q,bottom:F,horizontal:L}}function _(D,E){let R=c.top+(E?D.top:D.bottom);return{top:R,bottom:R,horizontal:[]}}}function QW(t,e){return t.constructor==e.constructor&&t.eq(e)}class $W{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(eg)!=e.state.facet(eg)&&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(eg);for(;n!QW(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,Fe.safari&&Fe.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 eg=He.define();function LM(t){return[lr.define(e=>new $W(e,t)),eg.of(t)]}const bf=He.define({combine(t){return Oa(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function HW(t={}){return[bf.of(t),UW,VW,WW,uM.of(!0)]}function IM(t){return t.startState.facet(bf)!=t.state.facet(bf)}const UW=LM({above:!0,markers(t){let{state:e}=t,n=e.facet(bf),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let l=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=s.empty?s:Ce.cursor(s.head,s.head>s.anchor?-1:1);for(let d of c0.forRange(t,l,c))r.push(d)}}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=IM(t);return n&&Fj(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Fj(e.state,t)},class:"cm-cursorLayer"});function Fj(t,e){e.style.animationDuration=t.facet(bf).cursorBlinkRate+"ms"}const VW=LM({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:c0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||IM(t)},class:"cm-selectionLayer"}),WW=No.highest(qe.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"}}}})),qM=vt.define({map(t,e){return t==null?null:e.mapPos(t)}}),Uh=Br.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(qM)?r.value:n,t)}}),GW=lr.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(Uh);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(Uh)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Uh),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(Uh)!=t&&this.view.dispatch({effects:qM.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 XW(){return[Uh,GW]}function Qj(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),l=n,c;!i.next().done;l+=i.value.length)if(!i.lineBreak)for(;c=e.exec(i.value);)s(l+c.index,c)}function YW(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 KW{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:l=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=(c,d,h,m)=>s(m,h,h+c[0].length,c,d);else if(typeof r=="function")this.addMatch=(c,d,h,m)=>{let p=r(c,d,h);p&&m(h,h+c[0].length,p)};else if(r)this.addMatch=(c,d,h,m)=>m(h,h+c[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=l}createDeco(e){let n=new ml,r=n.add.bind(n);for(let{from:s,to:i}of YW(e,this.maxLength))Qj(e.state.doc,this.regexp,s,i,(l,c)=>this.addMatch(c,e,l,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,l,c,d)=>{d>=e.view.viewport.from&&c<=e.view.viewport.to&&(r=Math.min(c,r),s=Math.max(d,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 l=Math.max(i.from,r),c=Math.min(i.to,s);if(c>=l){let d=e.state.doc.lineAt(l),h=d.tod.from;l--)if(this.boundary.test(d.text[l-1-d.from])){m=l;break}for(;cx.push(j.range(k,O));if(d==h)for(this.regexp.lastIndex=m-d.from;(v=this.regexp.exec(d.text))&&v.indexthis.addMatch(O,e,k,b));n=n.update({filterFrom:m,filterTo:p,filter:(k,O)=>kp,add:x})}}return n}}const W2=/x/.unicode!=null?"gu":"g",ZW=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,W2),JW={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 Py=null;function eG(){var t;if(Py==null&&typeof document<"u"&&document.body){let e=document.body.style;Py=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Py||!1}const tg=He.define({combine(t){let e=Oa(t,{render:null,specialChars:ZW,addSpecialChars:null});return(e.replaceTabs=!eG())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,W2)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,W2)),e}});function tG(t={}){return[tg.of(t),nG()]}let $j=null;function nG(){return $j||($j=lr.fromClass(class{constructor(t){this.view=t,this.decorations=Je.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(tg)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new KW({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=As(e[0],0);if(i==9){let l=s.lineAt(r),c=n.state.tabSize,d=Td(l.text,c,r-l.from);return Je.replace({widget:new aG((c-d%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Je.replace({widget:new iG(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(tg);t.startState.facet(tg)!=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 rG="•";function sG(t){return t>=32?rG:t==10?"␤":String.fromCharCode(9216+t)}class iG extends ja{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=sG(this.code),r=e.state.phrase("Control character")+" "+(JW[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 aG extends ja{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 lG(){return cG}const oG=Je.line({class:"cm-activeLine"}),cG=lr.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(oG.range(s.from)),e=s.from)}return Je.set(n)}},{decorations:t=>t.decorations});class uG extends ja{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?ud(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=s0(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 dG(t){let e=lr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Je.set([Je.widget({widget:new uG(t),side:1}).range(0)]):Je.none}get decorations(){return this.view.state.doc.length?Je.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,qe.contentAttributes.of({"aria-placeholder":t})]:e}const G2=2e3;function hG(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>G2||n.off>G2||e.col<0||n.col<0){let l=Math.min(e.off,n.off),c=Math.max(e.off,n.off);for(let d=r;d<=s;d++){let h=t.doc.line(d);h.length<=c&&i.push(Ce.range(h.from+l,h.to+c))}}else{let l=Math.min(e.col,n.col),c=Math.max(e.col,n.col);for(let d=r;d<=s;d++){let h=t.doc.line(d),m=j2(h.text,l,t.tabSize,!0);if(m<0)i.push(Ce.cursor(h.to));else{let p=j2(h.text,c,t.tabSize);i.push(Ce.range(h.from+m,h.from+p))}}}return i}function fG(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Hj(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>G2?-1:s==r.length?fG(t,e.clientX):Td(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function mG(t,e){let n=Hj(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),l=s.state.doc.lineAt(i);n={line:l.number,col:n.col,off:Math.min(n.off,l.length)},r=r.map(s.changes)}},get(s,i,l){let c=Hj(t,s);if(!c)return r;let d=hG(t.state,n,c);return d.length?l?Ce.create(d.concat(r.ranges)):Ce.create(d):r}}:null}function pG(t){let e=(n=>n.altKey&&n.button==0);return qe.mouseSelectionStyle.of((n,r)=>e(r)?mG(n,r):null)}const gG={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},xG={style:"cursor: crosshair"};function vG(t={}){let[e,n]=gG[t.key||"Alt"],r=lr.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,qe.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?xG:null})]}const up="-10000px";class FM{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(l=>l);let i=null;this.tooltipViews=this.tooltips.map(l=>i=r(l,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(d=>d);if(s===this.input){for(let d of this.tooltipViews)d.update&&d.update(e);return!1}let l=[],c=n?[]:null;for(let d=0;dn[h]=d),n.length=c.length),this.input=s,this.tooltips=i,this.tooltipViews=l,!0}}function yG(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const By=He.define({combine:t=>{var e,n,r;return{position:Fe.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)||yG}}}),Uj=new WeakMap,_w=lr.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(By);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 FM(t,Dw,(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(By);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=up,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(Fe.safari){let l=i.getBoundingClientRect();n=Math.abs(l.top+1e4)>1||Math.abs(l.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=Tw(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,l)=>{let c=this.manager.tooltipViews[l];return c.getCoords?c.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(By).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,l=[];for(let c=0;c=Math.min(n.bottom,r.bottom)||p.rightMath.min(n.right,r.right)+.1)){m.style.top=up;continue}let v=d.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,b=v?7:0,k=x.right-x.left,O=(e=Uj.get(h))!==null&&e!==void 0?e:x.bottom-x.top,j=h.offset||wG,T=this.view.textDirection==Hn.LTR,A=x.width>r.right-r.left?T?r.left:r.right-x.width:T?Math.max(r.left,Math.min(p.left-(v?14:0)+j.x,r.right-k)):Math.min(Math.max(r.left,p.left-k+(v?14:0)-j.x),r.right-k),_=this.above[c];!d.strictSide&&(_?p.top-O-b-j.yr.bottom)&&_==r.bottom-p.bottom>p.top-r.top&&(_=this.above[c]=!_);let D=(_?p.top-r.top:r.bottom-p.bottom)-b;if(DA&&Q.topE&&(E=_?Q.top-O-2-b:Q.bottom+b+2);if(this.position=="absolute"?(m.style.top=(E-t.parent.top)/i+"px",Vj(m,(A-t.parent.left)/s)):(m.style.top=E/i+"px",Vj(m,A/s)),v){let Q=p.left+(T?j.x:-j.x)-(A+14-7);v.style.left=Q/s+"px"}h.overlap!==!0&&l.push({left:A,top:E,right:R,bottom:E+O}),m.classList.toggle("cm-tooltip-above",_),m.classList.toggle("cm-tooltip-below",!_),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=up}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Vj(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const bG=qe.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"}}}),wG={x:0,y:0},Dw=He.define({enables:[_w,bG]}),Ag=He.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ox{static create(e){return new Ox(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new FM(e,Ag,(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 SG=Dw.compute([Ag],t=>{let e=t.facet(Ag);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:Ox.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class kG{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;ec.bottom||n.xc.right+e.defaultCharacterWidth)return;let d=e.bidiSpans(e.state.doc.lineAt(s)).find(m=>m.from<=s&&m.to>=s),h=d&&d.dir==Hn.RTL?-1:1;i=n.x{this.pending==c&&(this.pending=null,d&&!(Array.isArray(d)&&!d.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(d)?d:[d])}))},d=>_s(e.state,d,"hover tooltip"))}else l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])})}get tooltip(){let e=this.view.plugin(_w),n=e?e.manager.tooltips.findIndex(r=>r.create==Ox.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&&!OG(i.dom,e)||this.pending){let{pos:l}=s[0]||this.pending,c=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:l;(l==c?this.view.posAtCoords(this.lastMove)!=l:!jG(this.view,l,c,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 dp=4;function OG(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),l;if(l=t.querySelector(".cm-tooltip-arrow")){let c=l.getBoundingClientRect();s=Math.min(c.top,s),i=Math.max(c.bottom,i)}return e.clientX>=n-dp&&e.clientX<=r+dp&&e.clientY>=s-dp&&e.clientY<=i+dp}function jG(t,e,n,r,s,i){let l=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(l.left>r||l.rights||Math.min(l.bottom,c)=e&&d<=n}function NG(t,e={}){let n=vt.define(),r=Br.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(l=>!e.hideOn(i,l))),i.docChanged)){let l=[];for(let c of s){let d=i.changes.mapPos(c.pos,-1,Ur.TrackDel);if(d!=null){let h=Object.assign(Object.create(null),c);h.pos=d,h.end!=null&&(h.end=i.changes.mapPos(h.end)),l.push(h)}}s=l}for(let l of i.effects)l.is(n)&&(s=l.value),l.is(CG)&&(s=[]);return s},provide:s=>Ag.from(s)});return{active:r,extension:[r,lr.define(s=>new kG(s,t,r,n,e.hoverTime||300)),SG]}}function QM(t,e){let n=t.plugin(_w);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const CG=vt.define(),Wj=He.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 wf(t,e){let n=t.plugin($M),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const $M=lr.fromClass(class{constructor(t){this.input=t.state.facet(Sf),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Wj);this.top=new hp(t,!0,e.topContainer),this.bottom=new hp(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(Wj);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new hp(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new hp(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Sf);if(n!=this.input){let r=n.filter(d=>d),s=[],i=[],l=[],c=[];for(let d of r){let h=this.specs.indexOf(d),m;h<0?(m=d(t.view),c.push(m)):(m=this.panels[h],m.update&&m.update(t)),s.push(m),(m.top?i:l).push(m)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(l);for(let d of c)d.dom.classList.add("cm-panel"),d.mount&&d.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class hp{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=Gj(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Gj(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 Gj(t){let e=t.nextSibling;return t.remove(),e}const Sf=He.define({enables:$M});class gl extends yc{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}gl.prototype.elementClass="";gl.prototype.toDOM=void 0;gl.prototype.mapMode=Ur.TrackBefore;gl.prototype.startSide=gl.prototype.endSide=-1;gl.prototype.point=!0;const ng=He.define(),TG=He.define(),AG={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Yt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},rf=He.define();function MG(t){return[HM(),rf.of({...AG,...t})]}const Xj=He.define({combine:t=>t.some(e=>e)});function HM(t){return[EG]}const EG=lr.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(rf).map(e=>new Kj(t,e)),this.fixed=!t.state.facet(Xj);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(Xj)!=!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=Yt.iter(this.view.state.facet(ng),this.view.viewport.from),r=[],s=this.gutters.map(i=>new _G(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let l=!0;for(let c of i.type)if(c.type==fs.Text&&l){X2(n,r,c.from);for(let d of s)d.line(this.view,c,r);l=!1}else if(c.widget)for(let d of s)d.widget(this.view,c)}else if(i.type==fs.Text){X2(n,r,i.from);for(let l of s)l.line(this.view,i,r)}else if(i.widget)for(let l of s)l.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(rf),n=t.state.facet(rf),r=t.docChanged||t.heightChanged||t.viewportChanged||!Yt.eq(t.startState.facet(ng),t.state.facet(ng),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 l=e.indexOf(i);l<0?s.push(new Kj(this.view,i)):(this.gutters[l].update(t),s.push(this.gutters[l]))}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=>qe.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==Hn.LTR?{left:r,right:s}:{right:r,left:s}})});function Yj(t){return Array.isArray(t)?t:[t]}function X2(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class _G{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Yt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,l=n.height/e.scaleY;if(this.i==s.elements.length){let c=new UM(e,l,i,r);s.elements.push(c),s.dom.appendChild(c.dom)}else s.elements[this.i].update(e,l,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];X2(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 l=this.gutter;s.length==0&&!l.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(TG)){let l=i(e,n.widget,n);l&&(s||(s=[])).push(l)}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 Kj{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,l;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let d=i.getBoundingClientRect();l=(d.top+d.bottom)/2}else l=s.clientY;let c=e.lineBlockAtHeight(l-e.documentTop);n.domEventHandlers[r](e,c,s)&&s.preventDefault()});this.markers=Yj(n.markers(e)),n.initialSpacer&&(this.spacer=new UM(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=Yj(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!Yt.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 UM{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":""),DG(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,l=0;;){let c=l,d=ii(c,d,h)||l(c,d,h):l}return r}})}});class Ly extends gl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Iy(t,e){return t.state.facet(Qu).formatNumber(e,t.state)}const PG=rf.compute([Qu],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(RG)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new Ly(Iy(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(zG)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Qu)!=e.state.facet(Qu),initialSpacer(e){return new Ly(Iy(e,Zj(e.state.doc.lines)))},updateSpacer(e,n){let r=Iy(n.view,Zj(n.view.state.doc.lines));return r==e.number?e:new Ly(r)},domEventHandlers:t.facet(Qu).domEventHandlers,side:"before"}));function BG(t={}){return[Qu.of(t),HM(),PG]}function Zj(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(LG.range(s)))}return Yt.of(e)});function qG(){return IG}const VM=1024;let FG=0;class qy{constructor(e,n){this.from=e,this.to=n}}class Et{constructor(e={}){this.id=FG++,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=gs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Et.closedBy=new Et({deserialize:t=>t.split(" ")});Et.openedBy=new Et({deserialize:t=>t.split(" ")});Et.group=new Et({deserialize:t=>t.split(" ")});Et.isolate=new Et({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Et.contextHash=new Et({perNode:!0});Et.lookAhead=new Et({perNode:!0});Et.mounted=new Et({perNode:!0});class Mg{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Et.mounted.id]}}const QG=Object.create(null);class gs{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):QG,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new gs(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(Et.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(Et.group),i=-1;i<(s?s.length:0);i++){let l=n[i<0?r.name:s[i]];if(l)return l}}}}gs.none=new gs("",Object.create(null),0,8);class jx{constructor(e){this.types=e;for(let n=0;n0;for(let d=this.cursor(l|Or.IncludeAnonymous);;){let h=!1;if(d.from<=i&&d.to>=s&&(!c&&d.type.isAnonymous||n(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&r&&(c||!d.type.isAnonymous)&&r(d),!d.nextSibling();){if(!d.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:Pw(gs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Dn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Dn(gs.none,n,r,s)))}static build(e){return VG(e)}}Dn.empty=new Dn(gs.none,[],[],0);class Rw{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 Rw(this.buffer,this.index)}}class go{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return gs.none}toString(){let e=[];for(let n=0;n0));d=l[d+3]);return c}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),l=0;for(let c=e,d=0;c=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function kf(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?c.length:-1;e!=h;e+=n){let m=c[e],p=d[e]+l.from;if(WM(s,r,p,p+m.length)){if(m instanceof go){if(i&Or.ExcludeBuffers)continue;let x=m.findChild(0,m.buffer.length,n,r-p,s);if(x>-1)return new ha(new $G(l,m,e,p),null,x)}else if(i&Or.IncludeAnonymous||!m.type.isAnonymous||zw(m)){let x;if(!(i&Or.IgnoreMounts)&&(x=Mg.get(m))&&!x.overlay)return new Ps(x.tree,p,e,l);let v=new Ps(m,p,e,l);return i&Or.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(n<0?m.children.length-1:0,n,r,s)}}}if(i&Or.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+n:e=n<0?-1:l._parent._tree.children.length,l=l._parent,!l))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&Or.IgnoreOverlays)&&(s=Mg.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:l,to:c}of s.overlay)if((n>0?l<=i:l=i:c>i))return new Ps(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 e7(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let l=!1;!l;)if(l=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 Y2(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 $G{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class ha extends GM{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 ha(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&Or.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 ha(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 ha(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 ha(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 l=r.buffer[this.index+1];e.push(r.slice(s,i,l)),n.push(0)}return new Dn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function XM(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||l.to=e){let c=new Ps(l.tree,l.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(kf(c,e,n,!1))}}return s?XM(s):r}class K2{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 Ps)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 Ps?(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&Or.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Or.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Or.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,l=e<0?-1:r._tree.children.length;i!=l;i+=e){let c=r._tree.children[i];if(this.mode&Or.IncludeAnonymous||c instanceof go||!c.type.isAnonymous||zw(c))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let l=e;l;l=l._parent)if(l.index==s){if(s==this.index)return l;n=l,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return Y2(this._tree,e,s);let l=r[n.buffer[this.stack[i]]];if(!l.isAnonymous){if(e[s]&&e[s]!=l.name)return!1;s--}}return!0}}function zw(t){return t.children.some(e=>e instanceof go||!e.type.isAnonymous||zw(e))}function VG(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=VM,reused:i=[],minRepeatType:l=r.types.length}=t,c=Array.isArray(n)?new Rw(n,n.length):n,d=r.types,h=0,m=0;function p(D,E,R,Q,F,L){let{id:U,start:V,end:de,size:W}=c,J=m,$=h;if(W<0)if(c.next(),W==-1){let xe=i[U];R.push(xe),Q.push(V-D);return}else if(W==-3){h=U;return}else if(W==-4){m=U;return}else throw new RangeError(`Unrecognized record size: ${W}`);let ae=d[U],ne,ce,z=V-D;if(de-V<=s&&(ce=O(c.pos-E,F))){let xe=new Uint16Array(ce.size-ce.skip),Y=c.pos-ce.size,P=xe.length;for(;c.pos>Y;)P=j(ce.start,xe,P);ne=new go(xe,de-ce.start,r),z=ce.start-D}else{let xe=c.pos-W;c.next();let Y=[],P=[],K=U>=l?U:-1,H=0,fe=de;for(;c.pos>xe;)K>=0&&c.id==K&&c.size>=0?(c.end<=fe-s&&(b(Y,P,V,H,c.end,fe,K,J,$),H=Y.length,fe=c.end),c.next()):L>2500?x(V,xe,Y,P):p(V,xe,Y,P,K,L+1);if(K>=0&&H>0&&H-1&&H>0){let ve=v(ae,$);ne=Pw(ae,Y,P,0,Y.length,0,de-V,ve,ve)}else ne=k(ae,Y,P,de-V,J-de,$)}R.push(ne),Q.push(z)}function x(D,E,R,Q){let F=[],L=0,U=-1;for(;c.pos>E;){let{id:V,start:de,end:W,size:J}=c;if(J>4)c.next();else{if(U>-1&&de=0;W-=3)V[J++]=F[W],V[J++]=F[W+1]-de,V[J++]=F[W+2]-de,V[J++]=J;R.push(new go(V,F[2]-de,r)),Q.push(de-D)}}function v(D,E){return(R,Q,F)=>{let L=0,U=R.length-1,V,de;if(U>=0&&(V=R[U])instanceof Dn){if(!U&&V.type==D&&V.length==F)return V;(de=V.prop(Et.lookAhead))&&(L=Q[U]+V.length+de)}return k(D,R,Q,F,L,E)}}function b(D,E,R,Q,F,L,U,V,de){let W=[],J=[];for(;D.length>Q;)W.push(D.pop()),J.push(E.pop()+R-F);D.push(k(r.types[U],W,J,L-F,V-L,de)),E.push(F-R)}function k(D,E,R,Q,F,L,U){if(L){let V=[Et.contextHash,L];U=U?[V].concat(U):[V]}if(F>25){let V=[Et.lookAhead,F];U=U?[V].concat(U):[V]}return new Dn(D,E,R,Q,U)}function O(D,E){let R=c.fork(),Q=0,F=0,L=0,U=R.end-s,V={size:0,start:0,skip:0};e:for(let de=R.pos-D;R.pos>de;){let W=R.size;if(R.id==E&&W>=0){V.size=Q,V.start=F,V.skip=L,L+=4,Q+=4,R.next();continue}let J=R.pos-W;if(W<0||J=l?4:0,ae=R.start;for(R.next();R.pos>J;){if(R.size<0)if(R.size==-3)$+=4;else break e;else R.id>=l&&($+=4);R.next()}F=ae,Q+=W,L+=$}return(E<0||Q==D)&&(V.size=Q,V.start=F,V.skip=L),V.size>4?V:void 0}function j(D,E,R){let{id:Q,start:F,end:L,size:U}=c;if(c.next(),U>=0&&Q4){let de=c.pos-(U-4);for(;c.pos>de;)R=j(D,E,R)}E[--R]=V,E[--R]=L-D,E[--R]=F-D,E[--R]=Q}else U==-3?h=Q:U==-4&&(m=Q);return R}let T=[],A=[];for(;c.pos>0;)p(t.start||0,t.bufferStart||0,T,A,-1,0);let _=(e=t.length)!==null&&e!==void 0?e:T.length?A[0]+T[0].length:0;return new Dn(d[t.topID],T.reverse(),A.reverse(),_)}const t7=new WeakMap;function rg(t,e){if(!t.isAnonymous||e instanceof go||e.type!=t)return 1;let n=t7.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Dn)){n=1;break}n+=rg(t,r)}t7.set(e,n)}return n}function Pw(t,e,n,r,s,i,l,c,d){let h=0;for(let b=r;b=m)break;E+=R}if(A==_+1){if(E>m){let R=b[_];v(R.children,R.positions,0,R.children.length,k[_]+T);continue}p.push(b[_])}else{let R=k[A-1]+b[A-1].length-D;p.push(Pw(t,b,k,_,A,D,R,null,d))}x.push(D+T-i)}}return v(e,n,r,s,0),(c||d)(p,x,l)}class WG{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 ha?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ps&&this.map.set(e.tree,n)}get(e){return e instanceof ha?this.getBuffer(e.context.buffer,e.index):e instanceof Ps?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 pc{constructor(e,n,r,s,i=!1,l=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(l?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 pc(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,l=e.length?e[0]:null;for(let c=0,d=0,h=0;;c++){let m=c=r)for(;l&&l.from=x.from||p<=x.to||h){let v=Math.max(x.from,d)-h,b=Math.min(x.to,p)-h;x=v>=b?null:new pc(v,b,x.tree,x.offset+h,c>0,!!m)}if(x&&s.push(x),l.to>p)break;l=inew qy(s.from,s.to)):[new qy(0,0)]:[new qy(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 GG{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 Et({perNode:!0});let XG=0;class yi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=XG++}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 yi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new yi(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 Eg(e);return r=>r.modified.indexOf(n)>-1?r:Eg.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let YG=0;class Eg{constructor(e){this.name=e,this.instances=[],this.id=YG++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(c=>c.base==e&&KG(n,c.modified));if(r)return r;let s=[],i=new yi(e.name,s,e,n);for(let c of n)c.instances.push(i);let l=ZG(n);for(let c of e.set)if(!c.modified.length)for(let d of l)s.push(Eg.get(c,d));return i}}function KG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function ZG(t){let e=[[]];for(let n=0;nr.length-n.length)}function Lw(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=[],l=2,c=s;for(let p=0;;){if(c=="..."&&p>0&&p+3==s.length){l=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!x)throw new RangeError("Invalid path: "+s);if(i.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),p+=x[0].length,p==s.length)break;let v=s[p++];if(p==s.length&&v=="!"){l=0;break}if(v!="/")throw new RangeError("Invalid path: "+s);c=s.slice(p)}let d=i.length-1,h=i[d];if(!h)throw new RangeError("Invalid path: "+s);let m=new Of(r,l,d>0?i.slice(0,d):null);e[h]=m.sort(e[h])}}return YM.add(e)}const YM=new Et({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 Of(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Of{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let l=s;for(let c of i)for(let d of c.set){let h=n[d.id];if(h){l=l?l+" "+h:h;break}}return l},scope:r}}function JG(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function eX(t,e,n,r=0,s=t.length){let i=new tX(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class tX{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:l,from:c,to:d}=e;if(c>=r||d<=n)return;l.isTop&&(i=this.highlighters.filter(v=>!v.scope||v.scope(l)));let h=s,m=nX(e)||Of.empty,p=JG(i,m.tags);if(p&&(h&&(h+=" "),h+=p,m.mode==1&&(s+=(s?" ":"")+p)),this.startSpan(Math.max(n,c),h),m.opaque)return;let x=e.tree&&e.tree.prop(Et.mounted);if(x&&x.overlay){let v=e.node.enter(x.overlay[0].from+c,1),b=this.highlighters.filter(O=>!O.scope||O.scope(x.tree.type)),k=e.firstChild();for(let O=0,j=c;;O++){let T=O=A||!e.nextSibling())););if(!T||A>r)break;j=T.to+c,j>n&&(this.highlightRange(v.cursor(),Math.max(n,T.from+c),Math.min(r,j),"",b),this.startSpan(Math.min(r,j),h))}k&&e.parent()}else if(e.firstChild()){x&&(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 nX(t){let e=t.type.prop(YM);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ie=yi.define,mp=Ie(),eo=Ie(),n7=Ie(eo),r7=Ie(eo),to=Ie(),pp=Ie(to),Fy=Ie(to),sa=Ie(),Zo=Ie(sa),na=Ie(),ra=Ie(),Z2=Ie(),Rh=Ie(Z2),gp=Ie(),he={comment:mp,lineComment:Ie(mp),blockComment:Ie(mp),docComment:Ie(mp),name:eo,variableName:Ie(eo),typeName:n7,tagName:Ie(n7),propertyName:r7,attributeName:Ie(r7),className:Ie(eo),labelName:Ie(eo),namespace:Ie(eo),macroName:Ie(eo),literal:to,string:pp,docString:Ie(pp),character:Ie(pp),attributeValue:Ie(pp),number:Fy,integer:Ie(Fy),float:Ie(Fy),bool:Ie(to),regexp:Ie(to),escape:Ie(to),color:Ie(to),url:Ie(to),keyword:na,self:Ie(na),null:Ie(na),atom:Ie(na),unit:Ie(na),modifier:Ie(na),operatorKeyword:Ie(na),controlKeyword:Ie(na),definitionKeyword:Ie(na),moduleKeyword:Ie(na),operator:ra,derefOperator:Ie(ra),arithmeticOperator:Ie(ra),logicOperator:Ie(ra),bitwiseOperator:Ie(ra),compareOperator:Ie(ra),updateOperator:Ie(ra),definitionOperator:Ie(ra),typeOperator:Ie(ra),controlOperator:Ie(ra),punctuation:Z2,separator:Ie(Z2),bracket:Rh,angleBracket:Ie(Rh),squareBracket:Ie(Rh),paren:Ie(Rh),brace:Ie(Rh),content:sa,heading:Zo,heading1:Ie(Zo),heading2:Ie(Zo),heading3:Ie(Zo),heading4:Ie(Zo),heading5:Ie(Zo),heading6:Ie(Zo),contentSeparator:Ie(sa),list:Ie(sa),quote:Ie(sa),emphasis:Ie(sa),strong:Ie(sa),link:Ie(sa),monospace:Ie(sa),strikethrough:Ie(sa),inserted:Ie(),deleted:Ie(),changed:Ie(),invalid:Ie(),meta:gp,documentMeta:Ie(gp),annotation:Ie(gp),processingInstruction:Ie(gp),definition:yi.defineModifier("definition"),constant:yi.defineModifier("constant"),function:yi.defineModifier("function"),standard:yi.defineModifier("standard"),local:yi.defineModifier("local"),special:yi.defineModifier("special")};for(let t in he){let e=he[t];e instanceof yi&&(e.name=t)}KM([{tag:he.link,class:"tok-link"},{tag:he.heading,class:"tok-heading"},{tag:he.emphasis,class:"tok-emphasis"},{tag:he.strong,class:"tok-strong"},{tag:he.keyword,class:"tok-keyword"},{tag:he.atom,class:"tok-atom"},{tag:he.bool,class:"tok-bool"},{tag:he.url,class:"tok-url"},{tag:he.labelName,class:"tok-labelName"},{tag:he.inserted,class:"tok-inserted"},{tag:he.deleted,class:"tok-deleted"},{tag:he.literal,class:"tok-literal"},{tag:he.string,class:"tok-string"},{tag:he.number,class:"tok-number"},{tag:[he.regexp,he.escape,he.special(he.string)],class:"tok-string2"},{tag:he.variableName,class:"tok-variableName"},{tag:he.local(he.variableName),class:"tok-variableName tok-local"},{tag:he.definition(he.variableName),class:"tok-variableName tok-definition"},{tag:he.special(he.variableName),class:"tok-variableName2"},{tag:he.definition(he.propertyName),class:"tok-propertyName tok-definition"},{tag:he.typeName,class:"tok-typeName"},{tag:he.namespace,class:"tok-namespace"},{tag:he.className,class:"tok-className"},{tag:he.macroName,class:"tok-macroName"},{tag:he.propertyName,class:"tok-propertyName"},{tag:he.operator,class:"tok-operator"},{tag:he.comment,class:"tok-comment"},{tag:he.meta,class:"tok-meta"},{tag:he.invalid,class:"tok-invalid"},{tag:he.punctuation,class:"tok-punctuation"}]);var Qy;const oc=new Et;function ZM(t){return He.define({combine:t?e=>e.concat(t):void 0})}const rX=new Et;class wi{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Vt.prototype.hasOwnProperty("tree")||Object.defineProperty(Vt.prototype,"tree",{get(){return zr(this)}}),this.parser=n,this.extension=[xo.of(this),Vt.languageData.of((i,l,c)=>{let d=s7(i,l,c),h=d.type.prop(oc);if(!h)return[];let m=i.facet(h),p=d.type.prop(rX);if(p){let x=d.resolve(l-d.from,c);for(let v of p)if(v.test(x,i)){let b=i.facet(v.facet);return v.type=="replace"?b:b.concat(m)}}return m})].concat(r)}isActiveAt(e,n,r=-1){return s7(e,n,r).type.prop(oc)==this.data}findRegions(e){let n=e.facet(xo);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,l)=>{if(i.prop(oc)==this.data){r.push({from:l,to:l+i.length});return}let c=i.prop(Et.mounted);if(c){if(c.tree.prop(oc)==this.data){if(c.overlay)for(let d of c.overlay)r.push({from:d.from+l,to:d.to+l});else r.push({from:l,to:l+i.length});return}else if(c.overlay){let d=r.length;if(s(c.tree,c.overlay[0].from+l),r.length>d)return}}for(let d=0;dr.isTop?n:void 0)]}),e.name)}configure(e,n){return new jf(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function zr(t){let e=t.field(wi.state,!1);return e?e.tree:Dn.empty}class sX{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let zh=null;class md{constructor(e,n,r=[],s,i,l,c,d){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=l,this.skipped=c,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new md(e,n,[],Dn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new sX(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Dn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(pc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=zh;zh=this;try{return e()}finally{zh=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=i7(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:l,skipped:c}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,m,p,x)=>d.push({fromA:h,toA:m,fromB:p,toB:x})),r=pc.applyChanges(r,d),s=Dn.empty,i=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){c=[];for(let h of this.skipped){let m=e.mapPos(h.from,1),p=e.mapPos(h.to,-1);me.from&&(this.fragments=i7(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 Bw{createParse(n,r,s){let i=s[0].from,l=s[s.length-1].to;return{parsedPos:i,advance(){let d=zh;if(d){for(let h of s)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=l,new Dn(gs.none,[],[],l-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 zh}}function i7(t,e,n){return pc.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class pd{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 pd(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=md.create(e.facet(xo).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new pd(r)}}wi.state=Br.define({create:pd.init,update(t,e){for(let n of e.effects)if(n.is(wi.setState))return n.value;return e.startState.facet(xo)!=e.state.facet(xo)?pd.init(e.state):t.apply(e)}});let JM=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(JM=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const $y=typeof navigator<"u"&&(!((Qy=navigator.scheduling)===null||Qy===void 0)&&Qy.isInputPending)?()=>navigator.scheduling.isInputPending():null,iX=lr.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(wi.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(wi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=JM(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,d=i.context.work(()=>$y&&$y()||Date.now()>l,s+(c?0:1e5));this.chunkBudget-=Date.now()-n,(d||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:wi.setState.of(new pd(i.context))})),this.chunkBudget>0&&!(d&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>_s(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()}}}),xo=He.define({combine(t){return t.length?t[0]:null},enables:t=>[wi.state,iX,qe.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class eE{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const aX=He.define(),u0=He.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 kc(t){let e=t.facet(u0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Nf(t,e){let n="",r=t.tabSize,s=t.facet(u0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?lX(t,n,e):null}class Nx{constructor(e,n={}){this.state=e,this.options=n,this.unit=kc(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=l-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Td(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 l=i(s);if(l>-1)return l}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Cx=new Et;function lX(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 l=s;l&&!(l.fromr.node.to||l.from==r.node.from&&l.type==r.node.type);l=l.parent)i.push(l);for(let l=i.length-1;l>=0;l--)r={node:i[l],next:r}}return tE(r,t,n)}function tE(t,e,n){for(let r=t;r;r=r.next){let s=cX(r.node);if(s)return s(qw.create(e,n,r))}return 0}function oX(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function cX(t){let e=t.type.prop(Cx);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Et.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return l=>nE(l,!0,1,void 0,i&&!oX(l)?s.from:void 0)}return t.parent==null?uX:null}function uX(){return 0}class qw extends Nx{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 qw(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(dX(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return tE(this.context.next,this.base,this.pos)}}function dX(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function hX(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),l=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let c=n.to;;){let d=e.childAfter(c);if(!d||d==r)return null;if(!d.type.isSkipped){if(d.from>=l)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}c=d.to}}function Hy({closing:t,align:e=!0,units:n=1}){return r=>nE(r,e,n,t)}function nE(t,e,n,r,s){let i=t.textAfter,l=i.match(/^\s*/)[0].length,c=r&&i.slice(l,l+r.length)==r||s==t.pos+l,d=e?hX(t):null;return d?c?t.column(d.from):t.column(d.to):t.baseIndent+(c?0:t.unit*n)}function a7({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const fX=200;function mX(){return Vt.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+fX)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:l}=t,c=-1,d=[];for(let{head:h}of l.selection.ranges){let m=l.doc.lineAt(h);if(m.from==c)continue;c=m.from;let p=Iw(l,m.from);if(p==null)continue;let x=/^\s*/.exec(m.text)[0],v=Nf(l,p);x!=v&&d.push({from:m.from,to:m.from+x.length,insert:v})}return d.length?[t,{changes:d,sequential:!0}]:t})}const pX=He.define(),Fw=new Et;function rE(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&c.from=e&&h.to>n&&(i=h)}}return i}function xX(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function _g(t,e,n){for(let r of t.facet(pX)){let s=r(t,e,n);if(s)return s}return gX(t,e,n)}function sE(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 Tx=vt.define({map:sE}),d0=vt.define({map:sE});function iE(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 Oc=Br.define({create(){return Je.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=l7(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Tx)&&!vX(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(oE),s=r?Je.replace({widget:new jX(r(e.state,n.value))}):o7;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(d0)&&(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=l7(t,e.selection.main.head)),t},provide:t=>qe.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function Dg(t,e,n){var r;let s=null;return(r=t.field(Oc,!1))===null||r===void 0||r.between(e,n,(i,l)=>{(!s||s.from>i)&&(s={from:i,to:l})}),s}function vX(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function aE(t,e){return t.field(Oc,!1)?e:e.concat(vt.appendConfig.of(cE()))}const yX=t=>{for(let e of iE(t)){let n=_g(t.state,e.from,e.to);if(n)return t.dispatch({effects:aE(t.state,[Tx.of(n),lE(t,n)])}),!0}return!1},bX=t=>{if(!t.state.field(Oc,!1))return!1;let e=[];for(let n of iE(t)){let r=Dg(t.state,n.from,n.to);r&&e.push(d0.of(r),lE(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function lE(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return qe.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const wX=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(Oc,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(d0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},kX=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:yX},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:bX},{key:"Ctrl-Alt-[",run:wX},{key:"Ctrl-Alt-]",run:SX}],OX={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},oE=He.define({combine(t){return Oa(t,OX)}});function cE(t){return[Oc,TX]}function uE(t,e){let{state:n}=t,r=n.facet(oE),s=l=>{let c=t.lineBlockAt(t.posAtDOM(l.target)),d=Dg(t.state,c.from,c.to);d&&t.dispatch({effects:d0.of(d)}),l.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 o7=Je.replace({widget:new class extends ja{toDOM(t){return uE(t,null)}}});class jX extends ja{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return uE(e,this.value)}}const NX={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Uy extends gl{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 CX(t={}){let e={...NX,...t},n=new Uy(e,!0),r=new Uy(e,!1),s=lr.fromClass(class{constructor(l){this.from=l.viewport.from,this.markers=this.buildMarkers(l)}update(l){(l.docChanged||l.viewportChanged||l.startState.facet(xo)!=l.state.facet(xo)||l.startState.field(Oc,!1)!=l.state.field(Oc,!1)||zr(l.startState)!=zr(l.state)||e.foldingChanged(l))&&(this.markers=this.buildMarkers(l.view))}buildMarkers(l){let c=new ml;for(let d of l.viewportLineBlocks){let h=Dg(l.state,d.from,d.to)?r:_g(l.state,d.from,d.to)?n:null;h&&c.add(d.from,d.from,h)}return c.finish()}}),{domEventHandlers:i}=e;return[s,MG({class:"cm-foldGutter",markers(l){var c;return((c=l.plugin(s))===null||c===void 0?void 0:c.markers)||Yt.empty},initialSpacer(){return new Uy(e,!1)},domEventHandlers:{...i,click:(l,c,d)=>{if(i.click&&i.click(l,c,d))return!0;let h=Dg(l.state,c.from,c.to);if(h)return l.dispatch({effects:d0.of(h)}),!0;let m=_g(l.state,c.from,c.to);return m?(l.dispatch({effects:Tx.of(m)}),!0):!1}}}),cE()]}const TX=qe.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 h0{constructor(e,n){this.specs=e;let r;function s(c){let d=fo.newName();return(r||(r=Object.create(null)))["."+d]=c,d}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,l=n.scope;this.scope=l instanceof wi?c=>c.prop(oc)==l.data:l?c=>c==l:void 0,this.style=KM(e.map(c=>({tag:c.tag,class:c.class||s(Object.assign({},c,{tag:null}))})),{all:i}).style,this.module=r?new fo(r):null,this.themeType=n.themeType}static define(e,n){return new h0(e,n||{})}}const J2=He.define(),dE=He.define({combine(t){return t.length?[t[0]]:null}});function Vy(t){let e=t.facet(J2);return e.length?e:t.facet(dE)}function hE(t,e){let n=[MX],r;return t instanceof h0&&(t.module&&n.push(qe.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(dE.of(t)):r?n.push(J2.computeN([qe.darkTheme],s=>s.facet(qe.darkTheme)==(r=="dark")?[t]:[])):n.push(J2.of(t)),n}class AX{constructor(e){this.markCache=Object.create(null),this.tree=zr(e.state),this.decorations=this.buildDeco(e,Vy(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=zr(e.state),r=Vy(e.state),s=r!=Vy(e.startState),{viewport:i}=e.view,l=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=l):(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 Je.none;let r=new ml;for(let{from:s,to:i}of e.visibleRanges)eX(this.tree,n,(l,c,d)=>{r.add(l,c,this.markCache[d]||(this.markCache[d]=Je.mark({class:d})))},s,i);return r.finish()}}const MX=No.high(lr.fromClass(AX,{decorations:t=>t.decorations})),EX=h0.define([{tag:he.meta,color:"#404740"},{tag:he.link,textDecoration:"underline"},{tag:he.heading,textDecoration:"underline",fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strong,fontWeight:"bold"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.keyword,color:"#708"},{tag:[he.atom,he.bool,he.url,he.contentSeparator,he.labelName],color:"#219"},{tag:[he.literal,he.inserted],color:"#164"},{tag:[he.string,he.deleted],color:"#a11"},{tag:[he.regexp,he.escape,he.special(he.string)],color:"#e40"},{tag:he.definition(he.variableName),color:"#00f"},{tag:he.local(he.variableName),color:"#30a"},{tag:[he.typeName,he.namespace],color:"#085"},{tag:he.className,color:"#167"},{tag:[he.special(he.variableName),he.macroName],color:"#256"},{tag:he.definition(he.propertyName),color:"#00c"},{tag:he.comment,color:"#940"},{tag:he.invalid,color:"#f00"}]),_X=qe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),fE=1e4,mE="()[]{}",pE=He.define({combine(t){return Oa(t,{afterCursor:!0,brackets:mE,maxScanDistance:fE,renderMatch:zX})}}),DX=Je.mark({class:"cm-matchingBracket"}),RX=Je.mark({class:"cm-nonmatchingBracket"});function zX(t){let e=[],n=t.matched?DX:RX;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 PX=Br.define({create(){return Je.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(pE);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=fa(e.state,s.head,-1,r)||s.head>0&&fa(e.state,s.head-1,1,r)||r.afterCursor&&(fa(e.state,s.head,1,r)||s.headqe.decorations.from(t)}),BX=[PX,_X];function LX(t={}){return[pE.of(t),BX]}const IX=new Et;function e4(t,e,n){let r=t.prop(e<0?Et.openedBy:Et.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 t4(t){let e=t.type.prop(IX);return e?e(t.node):t}function fa(t,e,n,r={}){let s=r.maxScanDistance||fE,i=r.brackets||mE,l=zr(t),c=l.resolveInner(e,n);for(let d=c;d;d=d.parent){let h=e4(d.type,n,i);if(h&&d.from0?e>=m.from&&em.from&&e<=m.to))return qX(t,e,n,d,m,h,i)}}return FX(t,e,n,l,c.type,s,i)}function qX(t,e,n,r,s,i,l){let c=r.parent,d={from:s.from,to:s.to},h=0,m=c?.cursor();if(m&&(n<0?m.childBefore(r.from):m.childAfter(r.to)))do if(n<0?m.to<=r.from:m.from>=r.to){if(h==0&&i.indexOf(m.type.name)>-1&&m.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},m=t.doc.iterRange(e,n>0?t.doc.length:0),p=0;for(let x=0;!m.next().done&&x<=i;){let v=m.value;n<0&&(x+=v.length);let b=e+x*n;for(let k=n>0?0:v.length-1,O=n>0?v.length:-1;k!=O;k+=n){let j=l.indexOf(v[k]);if(!(j<0||r.resolveInner(b+k,1).type!=s))if(j%2==0==n>0)p++;else{if(p==1)return{start:h,end:{from:b+k,to:b+k+1},matched:j>>1==d>>1};p--}}n>0&&(x+=v.length)}return m.done?{start:h,matched:!1}:null}function c7(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let l=r;l=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?l.toLowerCase():l,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 QX(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||$X,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||Hw,mergeTokens:t.mergeTokens!==!1}}function $X(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 u7=new WeakMap;class Qw extends wi{constructor(e){let n=ZM(e.languageData),r=QX(e),s,i=new class extends Bw{createParse(l,c,d){return new UX(s,l,c,d)}};super(n,i,[],e.name),this.topNode=GX(n,this),s=this,this.streamParser=r,this.stateAfter=new Et({perNode:!0}),this.tokenTable=e.tokenTable?new bE(r.tokenTable):WX}static define(e){return new Qw(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=u7.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let l=e.children.length-1;l>=0;l--){let c=e.children[l],d=n+e.positions[l],h=c instanceof Dn&&d=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let l=e.positions[i],c=e.children[i],d;if(ln&&$w(t,i.tree,0-i.offset,n,c),h;if(d&&d.pos<=r&&(h=xE(t,i.tree,n+i.offset,d.pos+i.offset,!1)))return{state:d.state,tree:h}}return{state:t.streamParser.startState(s?kc(s):4),tree:Dn.empty}}let UX=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=md.get(),l=s[0].from,{state:c,tree:d}=HX(e,r,l,this.to,i?.state);this.state=c,this.parsedPos=this.chunkStart=l+d.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(kc(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=md.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` + `&&t.lineWrapping&&(r&&(r=Ce.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Xt.of([" "])}),n)return Aw(t,n,r,i);if(r&&!r.main.eq(s)){let l=!1,c="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),c=t.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=bM(t.state.facet(l0).map(d=>d(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function Aw(t,e,n,r=-1){if(Fe.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Fe.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&&Gu(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&Gu(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Gu(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let l,c=()=>l||(l=KV(t,e,n));return t.state.facet(lM).some(d=>d(t,e.from,e.to,i,c))||t.dispatch(c()),!0}function KV(t,e,n){let r,s=t.state,i=s.selection.main,l=-1;if(e.from==e.to&&e.fromi.to){let d=e.fromp(t)),h,d);e.from==m&&(l=m)}if(l>-1)r={changes:e,selection:Ce.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 d=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(d+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let d=s.changes(e),h=n&&n.main.to<=d.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 m=t.state.sliceDoc(e.from,e.to),p,x=n&&xM(t,n.main.head);if(x){let b=e.insert.length-(e.to-e.from);p={from:x.from,to:x.to-b}}else p=t.state.doc.lineAt(i.head);let v=i.to-e.to;r=s.changeByRange(b=>{if(b.from==i.from&&b.to==i.to)return{changes:d,range:h||b.map(d)};let k=b.to-v,O=k-m.length;if(t.state.sliceDoc(O,k)!=m||k>=p.from&&O<=p.to)return{range:b};let j=s.changes({from:O,to:k,insert:e.insert}),T=b.to-i.to;return{changes:j,range:h?Ce.range(Math.max(0,h.anchor+T),Math.max(0,h.head+T)):b.map(j)}})}else r={changes:d,selection:h&&s.selection.replaceRange(h)}}let c="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,c+=".compose",t.inputState.compositionFirstChange&&(c+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:c,scrollIntoView:!0})}function SM(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&c>0&&t.charCodeAt(l-1)==e.charCodeAt(c-1);)l--,c--;if(r=="end"){let d=Math.max(0,i-Math.min(l,c));n-=l+d-i}if(l=l?i-n:0;i-=d,c=i+(c-l),l=i}else if(c=c?i-n:0;i-=d,l=i+(l-c),c=i}return{from:i,toA:l,toB:c}}function ZV(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 bj(n,r)),(s!=n||i!=r)&&e.push(new bj(s,i))),e}function JV(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?Ce.single(n+e,r+e):null}class eW{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,Fe.safari&&e.contentDOM.addEventListener("input",()=>null),Fe.gecko&&gW(e.contentDOM.ownerDocument)}handleEvent(e){!oW(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=tW(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let l=!n[i].handlers.length,c=r[i];c&&l!=!c.handlers.length&&(s.removeEventListener(i,this.handleEvent),c=null),c||s.addEventListener(i,this.handleEvent,{passive:l})}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&&OM.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Fe.android&&Fe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Fe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=kM.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||nW.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Fe.safari&&!Fe.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 wj(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){_s(n.state,s)}}}function tW(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,l=s&&s.plugin.domEventObservers;if(i)for(let c in i){let d=i[c];d&&n(c).handlers.push(wj(r.value,d))}if(l)for(let c in l){let d=l[c];d&&n(c).observers.push(wj(r.value,d))}}for(let r in Ui)n(r).handlers.push(Ui[r]);for(let r in Ti)n(r).observers.push(Ti[r]);return e}const kM=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nW="dthko",OM=[16,17,18,20,91,92,224,225],rp=6;function sp(t){return Math.max(0,t)*.7+8}function rW(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class sW{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=hV(e.contentDOM),this.atoms=e.state.facet(l0).map(l=>l(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(Vt.allowMultipleSelections)&&iW(e,n),this.dragging=lW(e,n)&&CM(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&&rW(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,l=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:c}=this.scrollParents.y.getBoundingClientRect());let d=Tw(this.view);e.clientX-d.left<=s+rp?n=-sp(s-e.clientX):e.clientX+d.right>=l-rp&&(n=sp(e.clientX-l)),e.clientY-d.top<=i+rp?r=-sp(i-e.clientY):e.clientY+d.bottom>=c-rp&&(r=sp(e.clientY-c)),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=bM(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 iW(t,e){let n=t.state.facet(rM);return n.length?n[0](e):Fe.mac?e.metaKey:e.ctrlKey}function aW(t,e){let n=t.state.facet(sM);return n.length?n[0](e):Fe.mac?!e.altKey:!e.ctrlKey}function lW(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=vf(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&l.top<=e.clientY&&l.bottom>=e.clientY)return!0}return!1}function oW(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=jn.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ui=Object.create(null),Ti=Object.create(null),jM=Fe.ie&&Fe.ie_version<15||Fe.ios&&Fe.webkit_version<604;function cW(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(),NM(t,n.value)},50)}function kx(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function NM(t,e){e=kx(t.state,jw,e);let{state:n}=t,r,s=1,i=n.toText(e),l=i.lines==n.selection.ranges.length;if(Q2!=null&&n.selection.ranges.every(d=>d.empty)&&Q2==i.toString()){let d=-1;r=n.changeByRange(h=>{let m=n.doc.lineAt(h.from);if(m.from==d)return{range:h};d=m.from;let p=n.toText((l?i.line(s++).text:e)+n.lineBreak);return{changes:{from:m.from,insert:p},range:Ce.cursor(h.from+p.length)}})}else l?r=n.changeByRange(d=>{let h=i.line(s++);return{changes:{from:d.from,to:d.to,insert:h.text},range:Ce.cursor(d.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Ti.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ui.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ti.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ti.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ui.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(iM))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=hW(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new sW(t,e,n,r)),r&&t.observer.ignore(()=>{qA(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 Sj(t,e,n,r){if(r==1)return Ce.cursor(e,n);if(r==2)return IV(t.state,e,n);{let s=pr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),l=s?s.posAtStart:i.from,c=s?s.posAtEnd:i.to;return ce>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function uW(t,e,n,r){let s=pr.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 l=s.coordsAt(i,-1);if(l&&kj(n,r,l))return-1;let c=s.coordsAt(i,1);return c&&kj(n,r,c)?1:l&&l.bottom>=r?-1:1}function Oj(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:uW(t,n,e.clientX,e.clientY)}}const dW=Fe.ie&&Fe.ie_version<=11;let jj=null,Nj=0,Cj=0;function CM(t){if(!dW)return t.detail;let e=jj,n=Cj;return jj=t,Cj=Date.now(),Nj=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Nj+1)%3:1}function hW(t,e){let n=Oj(t,e),r=CM(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,l,c){let d=Oj(t,i),h,m=Sj(t,d.pos,d.bias,r);if(n.pos!=d.pos&&!l){let p=Sj(t,n.pos,n.bias,r),x=Math.min(p.from,m.from),v=Math.max(p.to,m.to);m=x1&&(h=fW(s,d.pos))?h:c?s.addRange(m):Ce.create([m])}}}function fW(t,e){for(let n=0;n=e)return Ce.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}Ui.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,l=i+s.length;(i>=n.to||l<=n.from)&&(n=Ce.range(i,l))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",kx(t.state,Nw,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ui.dragend=t=>(t.inputState.draggedContent=null,!1);function Tj(t,e,n,r){if(n=kx(t.state,jw,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,l=r&&i&&aW(t,e)?{from:i.from,to:i.to}:null,c={from:s,insert:n},d=t.state.changes(l?[l,c]:c);t.focus(),t.dispatch({changes:d,selection:{anchor:d.mapPos(s,-1),head:d.mapPos(s,1)},userEvent:l?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ui.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&&Tj(t,e,r.filter(l=>l!=null).join(t.state.lineBreak),!1)};for(let l=0;l{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(r[l]=c.result),i()},c.readAsText(n[l])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Tj(t,e,r,!0),!0}return!1};Ui.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=jM?null:e.clipboardData;return n?(NM(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(cW(t),!1)};function mW(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 pW(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 l=t.doc.lineAt(i);l.number>s&&(e.push(l.text),n.push({from:l.from,to:Math.min(t.doc.length,l.to+1)})),s=l.number}r=!0}return{text:kx(t,Nw,e.join(t.lineBreak)),ranges:n,linewise:r}}let Q2=null;Ui.copy=Ui.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=pW(t.state);if(!n&&!s)return!1;Q2=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=jM?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(mW(t,n),!1)};const TM=ka.define();function AM(t,e){let n=[];for(let r of t.facet(oM)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:TM.of(!0)}):null}function MM(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=AM(t.state,e);n?t.dispatch(n):t.update([])}},10)}Ti.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),MM(t)};Ti.blur=t=>{t.observer.clearSelectionRange(),MM(t)};Ti.compositionstart=Ti.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ti.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,Fe.chrome&&Fe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ti.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ui.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"),l=e.getTargetRanges();if(i&&l.length){let c=l[0],d=t.posAtDOM(c.startContainer,c.startOffset),h=t.posAtDOM(c.endContainer,c.endOffset);return Aw(t,{from:d,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Fe.chrome&&Fe.android&&(s=kM.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 l;(((l=window.visualViewport)===null||l===void 0?void 0:l.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Fe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Fe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ti.compositionend(t,e),20),!1};const Aj=new Set;function gW(t){Aj.has(t)||(Aj.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Mj=["pre-wrap","normal","pre-line","break-spaces"];let fd=!1;function Ej(){fd=!1}class xW{constructor(e){this.lineWrapping=e,this.doc=Xt.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 Mj.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,d=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,d){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Jp&&(fd=!0),this.height=e)}replace(e,n,r){return ms.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,l=r.doc;for(let c=s.length-1;c>=0;c--){let{fromA:d,toA:h,fromB:m,toB:p}=s[c],x=i.lineAt(d,$n.ByPosNoHeight,r.setDoc(n),0,0),v=x.to>=h?x:i.lineAt(h,$n.ByPosNoHeight,r,0,0);for(p+=v.to-h,h=v.to;c>0&&x.from<=s[c-1].toA;)d=s[c-1].fromA,m=s[c-1].fromB,c--,di*2){let c=e[n-1];c.break?e.splice(--n,1,c.left,null,c.right):e.splice(--n,1,c.left,c.right),r+=1+c.break,s-=c.size}else if(i>s*2){let c=e[r];c.break?e.splice(r,1,c.left,null,c.right):e.splice(r,1,c.left,c.right),r+=2+c.break,i-=c.size}else break;else if(s=i&&l(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 ei extends EM{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new ca(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof ei||s instanceof $r&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof $r?s=new ei(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ms.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 $r extends ms{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,l,c=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*i);l=d/i,this.length>i+1&&(c=(this.height-d)/(this.length-i-1))}else l=this.height/i;return{firstLine:r,lastLine:s,perLine:l,perChar:c}}blockAt(e,n,r,s){let{firstLine:i,lastLine:l,perLine:c,perChar:d}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof $r?r[r.length-1]=new $r(i.length+s):r.push(null,new $r(s-1))}if(e>0){let i=r[0];i instanceof $r?r[0]=new $r(e+i.length):r.unshift(new $r(e-1),null)}return ms.of(r)}decomposeLeft(e,n){n.push(new $r(e-1),null)}decomposeRight(e,n){n.push(null,new $r(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 l=[],c=Math.max(n,s.from),d=-1;for(s.from>n&&l.push(new $r(s.from-n-1).updateHeight(e,n));c<=i&&s.more;){let m=e.doc.lineAt(c).length;l.length&&l.push(null);let p=s.heights[s.index++];d==-1?d=p:Math.abs(p-d)>=Jp&&(d=-2);let x=new ei(m,p);x.outdated=!1,l.push(x),c+=m+1}c<=i&&l.push(null,new $r(i-c).updateHeight(e,c));let h=ms.of(l);return(d<0||Math.abs(h.height-this.height)>=Jp||Math.abs(d-this.heightMetrics(e,n).perLine)>=Jp)&&(fd=!0),Cg(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 yW extends ms{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 ec))return h;let m=n==$n.ByPosNoHeight?$n.ByPosNoHeight:$n.ByPos;return d?h.join(this.right.lineAt(c,m,r,l,c)):this.left.lineAt(c,m,r,s,i).join(h)}forEachLine(e,n,r,s,i,l){let c=s+this.left.height,d=i+this.left.length+this.break;if(this.break)e=d&&this.right.forEachLine(e,n,r,c,d,l);else{let h=this.lineAt(d,$n.ByPos,r,s,i);e=e&&h.from<=n&&l(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,c,d,l)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let l=i.length;for(let c of r)i.push(c);if(e>0&&_j(i,l-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?ms.of(this.break?[e,null,n]:[e,n]):(this.left=Cg(this.left,e),this.right=Cg(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:l}=this,c=n+i.length+this.break,d=null;return s&&s.from<=n+i.length&&s.more?d=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=c+l.length&&s.more?d=l=l.updateHeight(e,c,r,s):l.updateHeight(e,c,r),d?this.balanced(i,l):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function _j(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof $r&&(r=t[e+1])instanceof $r&&t.splice(e-1,3,new $r(n.length+1+r.length))}const bW=5;class Mw{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 ei?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new ei(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=bW)&&this.addLineDeco(s,i,l)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new ei(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new $r(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 ei)return e;let n=new ei(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 ei)&&!this.isCovered?this.nodes.push(new ei(0,-1)):(this.writtenTom.clientHeight||m.scrollWidth>m.clientWidth)&&p.overflow!="visible"){let x=m.getBoundingClientRect();i=Math.max(i,x.left),l=Math.min(l,x.right),c=Math.max(c,x.top),d=Math.min(h==t.parentNode?s.innerHeight:d,x.bottom)}h=p.position=="absolute"||p.position=="fixed"?m.offsetParent:m.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,l)-n.left,top:c-(n.top+e),bottom:Math.max(c,d)-(n.top+e)}}function OW(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function jW(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ry{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new xW(n),this.stateDeco=e.facet(yf).filter(r=>typeof r!="function"),this.heightMap=ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle.setDoc(e.doc),[new Ni(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=Je.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:l})=>s>=i&&s<=l)){let{from:i,to:l}=this.lineBlockAt(s);e.push(new ip(i,l))}}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?Rj:new Ew(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(Hh(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(yf).filter(m=>typeof m!="function");let s=e.changedRanges,i=Ni.extendWithRanges(s,wW(r,this.stateDeco,e?e.changes:kr.empty(this.state.doc.length))),l=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ej(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=l||fd)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=l);let d=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headd.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,n));let h=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,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(uM)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Hn.RTL:Hn.LTR;let l=this.heightOracle.mustRefreshForWrapping(i),c=n.getBoundingClientRect(),d=l||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let h=0,m=0;if(c.width&&c.height){let{scaleX:_,scaleY:D}=IA(n,c);(_>.005&&Math.abs(this.scaleX-_)>.005||D>.005&&Math.abs(this.scaleY-D)>.005)&&(this.scaleX=_,this.scaleY=D,h|=16,l=d=!0)}let p=(parseInt(r.paddingTop)||0)*this.scaleY,x=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=x)&&(this.paddingTop=p,this.paddingBottom=x,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=QA(e.scrollDOM);let b=(this.printing?jW:kW)(n,this.paddingTop),k=b.top-this.pixelViewport.top,O=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(d=!0)),!this.inView&&!this.scrollTarget&&!OW(e.dom))return 0;let T=c.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),d){let _=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(_)&&(l=!0),l||s.lineWrapping&&Math.abs(T-this.contentDOMWidth)>s.charWidth){let{lineHeight:D,charWidth:E,textHeight:z}=e.docView.measureTextSize();l=D>0&&s.refresh(i,D,E,z,Math.max(5,T/E),_),l&&(e.docView.minWidth=0,h|=16)}k>0&&O>0?m=Math.max(k,O):k<0&&O<0&&(m=Math.min(k,O)),Ej();for(let D of this.viewports){let E=D.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(D);this.heightMap=(l?ms.empty().applyChanges(this.stateDeco,Xt.empty,this.heightOracle,[new Ni(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,l,new vW(D.from,E))}fd&&(h|=2)}let A=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return A&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),h|=this.updateForViewport()),(h&2||A)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]: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:l,visibleBottom:c}=this,d=new ip(s.lineAt(l-r*1e3,$n.ByHeight,i,0,0).from,s.lineAt(c+(1-r)*1e3,$n.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hd.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=s.lineAt(h,$n.ByPos,i,0,0),x;n.y=="center"?x=(p.top+p.bottom)/2-m/2:n.y=="start"||n.y=="nearest"&&h=c+Math.max(10,Math.min(r,250)))&&s>l-2*1e3&&i>1,l=s<<1;if(this.defaultTextDirection!=Hn.LTR&&!r)return[];let c=[],d=(m,p,x,v)=>{if(p-mm&&jj.from>=x.from&&j.to<=x.to&&Math.abs(j.from-m)j.fromT));if(!O){if(pA.from<=p&&A.to>=p)){let A=n.moveToLineBoundary(Ce.cursor(p),!1,!0).head;A>m&&(p=A)}let j=this.gapSize(x,m,p,v),T=r||j<2e6?j:2e6;O=new Ry(m,p,j,T)}c.push(O)},h=m=>{if(m.length2e6)for(let E of e)E.from>=m.from&&E.fromm.from&&d(m.from,v,m,p),bn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Yt.spans(n,this.viewport.from,this.viewport.to,{span(i,l){r.push({from:i,to:l})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Hh(this.heightMap.lineAt(e,$n.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)||Hh(this.heightMap.lineAt(this.scaler.fromDOM(e),$n.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 Hh(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 ip=class{constructor(e,n){this.from=e,this.to=n}};function CW(t,e,n){let r=[],s=t,i=0;return Yt.spans(n,t,e,{span(){},point(l,c){l>s&&(r.push({from:s,to:l}),i+=l-s),s=c}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:l}=e[s],c=l-i;if(r<=c)return i+r;r-=c}}function lp(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 TW(t,e){for(let n of t)if(e(n))return n}const Rj={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class Ew{constructor(e,n,r){let s=0,i=0,l=0;this.viewports=r.map(({from:c,to:d})=>{let h=n.lineAt(c,$n.ByPos,e,0,0).top,m=n.lineAt(d,$n.ByPos,e,0,0).bottom;return s+=m-h,{from:c,to:d,top:h,bottom:m,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let c of this.viewports)c.domTop=l+(c.top-i)*this.scale,l=c.domBottom=c.domTop+(c.bottom-c.top),i=c.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Hh(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new ca(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>Hh(s,e)):t._content)}const op=He.define({combine:t=>t.join(" ")}),$2=He.define({combine:t=>t.indexOf(!0)>-1}),H2=fo.newName(),_M=fo.newName(),DM=fo.newName(),RM={"&light":"."+_M,"&dark":"."+DM};function U2(t,e,n){return new fo(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 AW=U2("."+H2,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},RM),MW={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zy=Fe.ie&&Fe.ie_version<=11;class EW{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fV,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);(Fe.ie&&Fe.ie_version<=11||Fe.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&&Fe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Fe.chrome&&Fe.chrome_version<126)&&(this.editContext=new DW(e),e.state.facet(il)&&(e.contentDOM.editContext=this.editContext.editContext)),zy&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(il)?r.root.activeElement!=this.dom:!Kp(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Fe.ie&&Fe.ie_version<=11||Fe.android&&Fe.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ef(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=vf(e.root);if(!n)return!1;let r=Fe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&_W(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Kp(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Gu(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let l=this.readMutation(i);l&&(l.typeOver&&(s=!0),n==-1?{from:n,to:r}=l:(n=Math.min(l.from,n),r=Math.max(l.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Kp(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 YV(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=wM(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=zj(n,e.previousSibling||e.target.previousSibling,-1),s=zj(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(il)!=e.state.facet(il)&&(e.view.contentDOM.editContext=e.state.facet(il)?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 zj(t,e,n){for(;e;){let r=jn.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 Pj(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return ef(l.node,l.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function _W(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Pj(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?Pj(t,n):null}class DW{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:l}=s,c=this.toEditorPos(r.updateRangeStart),d=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:c,drifted:!1});let h=d-c>r.text.length;c==this.from&&ithis.to&&(d=i);let m=SM(e.state.sliceDoc(c,d),r.text,(h?s.from:s.to)-c,h?"end":null);if(!m){let x=Ce.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));x.main.eq(s)||e.dispatch({selection:x,userEvent:"select"});return}let p={from:m.from+c,to:m.toA+c,insert:Xt.of(r.text.slice(m.from,m.toB).split(` +`))};if((Fe.mac||Fe.android)&&p.from==l-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:c,to:d,insert:Xt.of([r.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let x=this.to-this.from+(p.to-p.from+p.insert.length);Aw(e,p,Ce.single(this.toEditorPos(r.selectionStart,x),this.toEditorPos(r.selectionEnd,x)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let l=this.toEditorPos(r.rangeStart),c=this.toEditorPos(r.rangeEnd);l{let s=[];for(let i of r.getTextFormats()){let l=i.underlineStyle,c=i.underlineThickness;if(!/none/i.test(l)&&!/none/i.test(c)){let d=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(d{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=vf(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,l,c,d,h)=>{if(r)return;let m=h.length-(l-i);if(s&&l>=s.to)if(s.from==i&&s.to==l&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=m,this.to+=m;return}else s=null,this.revertPending(e.state);if(i+=n,l+=n,l<=this.from)this.from+=m,this.to+=m;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(l),h.toString()),this.to+=m}n+=m}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class qe{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||mV(e.parent)||document,this.viewState=new Dj(e.state||Vt.create(e)),e.scrollTo&&e.scrollTo.is(np)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Fu).map(s=>new Ey(s));for(let s of this.plugins)s.update(this);this.observer=new EW(this),this.inputState=new eW(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mj(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 gr?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 x of e){if(x.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=x.state}if(this.destroyed){this.viewState.state=i;return}let l=this.hasFocus,c=0,d=null;e.some(x=>x.annotation(TM))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,d=AM(i,l),d||(c=1));let h=this.observer.delayedAndroidKey,m=null;if(h?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange(),(m&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(m=null)):this.observer.clear(),i.facet(Vt.phrases)!=this.state.facet(Vt.phrases))return this.setState(i);s=Ng.create(this,i,e),s.flags|=c;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let x of e){if(p&&(p=p.map(x.changes)),x.scrollIntoView){let{main:v}=x.state.selection;p=new Xu(v.empty?v:Ce.cursor(v.head,v.head>v.anchor?-1:1))}for(let v of x.effects)v.is(np)&&(p=v.value.clip(this.state))}this.viewState.update(s,p),this.bidiCache=Tg.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Qh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(x=>x.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(op)!=s.state.facet(op)&&(this.viewState.mustMeasureContent=!0),(n||r||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let x of this.state.facet(I2))try{x(s)}catch(v){_s(this.state,v,"update listener")}(d||m)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),m&&!wM(this,m)&&h.force&&Gu(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 Dj(e),this.plugins=e.facet(Fu).map(r=>new Ey(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new mj(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(Fu),r=e.state.facet(Fu);if(n!=r){let s=[];for(let i of r){let l=n.indexOf(i);if(l<0)s.push(new Ey(i));else{let c=this.plugins[l];c.mustUpdate=e,s.push(c)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:l}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(l=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(l<0)if(QA(r))i=-1,l=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(s);i=v.from,l=v.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];d&4||([this.measureRequests,h]=[h,this.measureRequests]);let m=h.map(v=>{try{return v.read(this)}catch(b){return _s(this.state,b),Bj}}),p=Ng.create(this,this.state,[]),x=!1;p.flags|=d,n?n.flags|=d:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),x=this.docView.update(p),x&&this.docViewUpdate());for(let v=0;v1||b<-1){s=s+b,r.scrollTop=s/this.scaleY,l=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let c of this.state.facet(I2))c(n)}get themeClasses(){return H2+" "+(this.state.facet($2)?DM:_M)+" "+this.state.facet(op)}updateAttrs(){let e=Lj(this,fM,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(il)?"true":"false",class:"cm-content",style:`${Fe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Lj(this,Cw,n);let r=this.observer.ignore(()=>{let s=R2(this.contentDOM,this.contentAttrs,n),i=R2(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(qe.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(Qh);let e=this.state.facet(qe.cspNonce);fo.mount(this.root,this.styleModules.concat(AW).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Dy(this,e,yj(this,e,n,r))}moveByGroup(e,n){return Dy(this,e,yj(this,e,n,r=>UV(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 Ce.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return HV(this,e,n,r)}moveVertically(e,n,r){return Dy(this,e,VV(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(),vM(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),l=i[so.find(i,e-s.from,-1,n)];return s0(r,l.dir==Hn.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(cM)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>RW)return tM(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||eM(i.isolates,r=fj(this,e))))return i.order;r||(r=fj(this,e));let s=TV(e.text,n,r);return this.bidiCache.push(new Tg(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Fe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{qA(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 np.of(new Xu(typeof e=="number"?Ce.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 np.of(new Xu(Ce.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 lr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return lr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=fo.newName(),s=[op.of(r),Qh.of(U2(`.${r}`,e))];return n&&n.dark&&s.push($2.of(!0)),s}static baseTheme(e){return No.lowest(Qh.of(U2("."+H2,e,RM)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&jn.get(r)||jn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}qe.styleModule=Qh;qe.inputHandler=lM;qe.clipboardInputFilter=jw;qe.clipboardOutputFilter=Nw;qe.scrollHandler=dM;qe.focusChangeEffect=oM;qe.perLineTextDirection=cM;qe.exceptionSink=aM;qe.updateListener=I2;qe.editable=il;qe.mouseSelectionStyle=iM;qe.dragMovesSelection=sM;qe.clickAddsSelectionRange=rM;qe.decorations=yf;qe.outerDecorations=mM;qe.atomicRanges=l0;qe.bidiIsolatedRanges=pM;qe.scrollMargins=gM;qe.darkTheme=$2;qe.cspNonce=He.define({combine:t=>t.length?t[0]:""});qe.contentAttributes=Cw;qe.editorAttributes=fM;qe.lineWrapping=qe.contentAttributes.of({class:"cm-lineWrapping"});qe.announce=vt.define();const RW=4096,Bj={};class Tg{constructor(e,n,r,s,i,l){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=l}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Hn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],l=typeof i=="function"?i(t):i;l&&D2(l,n)}return n}const zW=Fe.mac?"mac":Fe.windows?"win":Fe.linux?"linux":"key";function PW(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,l,c;for(let d=0;dr.concat(s),[]))),n}function LW(t,e,n){return PM(zM(t.state),e,t,n)}let no=null;const IW=4e3;function qW(t,e=zW){let n=Object.create(null),r=Object.create(null),s=(l,c)=>{let d=r[l];if(d==null)r[l]=c;else if(d!=c)throw new Error("Key binding "+l+" is used both as a regular binding and as a multi-stroke prefix")},i=(l,c,d,h,m)=>{var p,x;let v=n[l]||(n[l]=Object.create(null)),b=c.split(/ (?!$)/).map(j=>PW(j,e));for(let j=1;j{let _=no={view:A,prefix:T,scope:l};return setTimeout(()=>{no==_&&(no=null)},IW),!0}]})}let k=b.join(" ");s(k,!1);let O=v[k]||(v[k]={preventDefault:!1,stopPropagation:!1,run:((x=(p=v._any)===null||p===void 0?void 0:p.run)===null||x===void 0?void 0:x.slice())||[]});d&&O.run.push(d),h&&(O.preventDefault=!0),m&&(O.stopPropagation=!0)};for(let l of t){let c=l.scope?l.scope.split(" "):["editor"];if(l.any)for(let h of c){let m=n[h]||(n[h]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=l;for(let x in m)m[x].run.push(v=>p(v,V2))}let d=l[e]||l.key;if(d)for(let h of c)i(h,d,l.run,l.preventDefault,l.stopPropagation),l.shift&&i(h,"Shift-"+d,l.shift,l.preventDefault,l.stopPropagation)}return n}let V2=null;function PM(t,e,n,r){V2=e;let s=oV(e),i=As(s,0),l=oa(i)==s.length&&s!=" ",c="",d=!1,h=!1,m=!1;no&&no.view==n&&no.scope==r&&(c=no.prefix+" ",OM.indexOf(e.keyCode)<0&&(h=!0,no=null));let p=new Set,x=O=>{if(O){for(let j of O.run)if(!p.has(j)&&(p.add(j),j(n)))return O.stopPropagation&&(m=!0),!0;O.preventDefault&&(O.stopPropagation&&(m=!0),h=!0)}return!1},v=t[r],b,k;return v&&(x(v[c+cp(s,e,!l)])?d=!0:l&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Fe.windows&&e.ctrlKey&&e.altKey)&&!(Fe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(b=mo[e.keyCode])&&b!=s?(x(v[c+cp(b,e,!0)])||e.shiftKey&&(k=xf[e.keyCode])!=s&&k!=b&&x(v[c+cp(k,e,!1)]))&&(d=!0):l&&e.shiftKey&&x(v[c+cp(s,e,!0)])&&(d=!0),!d&&x(v._any)&&(d=!0)),h&&(d=!0),d&&m&&e.stopPropagation(),V2=null,d}class c0{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=BM(e);return[new c0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return FW(e,n,r)}}function BM(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Hn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function qj(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),l=(s.top+s.bottom)/2,c=t.posAtCoords({x:i.left+1,y:l}),d=t.posAtCoords({x:i.right-1,y:l});return c==null||d==null?r:{from:Math.max(r.from,Math.min(c,d)),to:Math.min(r.to,Math.max(c,d))}}function FW(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==Hn.LTR,l=t.contentDOM,c=l.getBoundingClientRect(),d=BM(t),h=l.querySelector(".cm-line"),m=h&&window.getComputedStyle(h),p=c.left+(m?parseInt(m.paddingLeft)+Math.min(0,parseInt(m.textIndent)):0),x=c.right-(m?parseInt(m.paddingRight):0),v=F2(t,r,1),b=F2(t,s,-1),k=v.type==fs.Text?v:null,O=b.type==fs.Text?b:null;if(k&&(t.lineWrapping||v.widgetLineBreaks)&&(k=qj(t,r,1,k)),O&&(t.lineWrapping||b.widgetLineBreaks)&&(O=qj(t,s,-1,O)),k&&O&&k.from==O.from&&k.to==O.to)return T(A(n.from,n.to,k));{let D=k?A(n.from,null,k):_(v,!1),E=O?A(null,n.to,O):_(b,!0),z=[];return(k||v).to<(O||b).from-(k&&O?1:0)||v.widgetLineBreaks>1&&D.bottom+t.defaultLineHeight/2V&&W.from=$)break;R>J&&U(Math.max(ue,J),D==null&&ue<=V,Math.min(R,$),E==null&&R>=ce,ne.dir)}if(J=ae.to+1,J>=$)break}return L.length==0&&U(V,D==null,ce,E==null,t.textDirection),{top:Q,bottom:F,horizontal:L}}function _(D,E){let z=c.top+(E?D.top:D.bottom);return{top:z,bottom:z,horizontal:[]}}}function QW(t,e){return t.constructor==e.constructor&&t.eq(e)}class $W{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(eg)!=e.state.facet(eg)&&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(eg);for(;n!QW(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,Fe.safari&&Fe.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 eg=He.define();function LM(t){return[lr.define(e=>new $W(e,t)),eg.of(t)]}const bf=He.define({combine(t){return Oa(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function HW(t={}){return[bf.of(t),UW,VW,WW,uM.of(!0)]}function IM(t){return t.startState.facet(bf)!=t.state.facet(bf)}const UW=LM({above:!0,markers(t){let{state:e}=t,n=e.facet(bf),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let l=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=s.empty?s:Ce.cursor(s.head,s.head>s.anchor?-1:1);for(let d of c0.forRange(t,l,c))r.push(d)}}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=IM(t);return n&&Fj(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Fj(e.state,t)},class:"cm-cursorLayer"});function Fj(t,e){e.style.animationDuration=t.facet(bf).cursorBlinkRate+"ms"}const VW=LM({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:c0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||IM(t)},class:"cm-selectionLayer"}),WW=No.highest(qe.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"}}}})),qM=vt.define({map(t,e){return t==null?null:e.mapPos(t)}}),Uh=Br.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(qM)?r.value:n,t)}}),GW=lr.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(Uh);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(Uh)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Uh),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(Uh)!=t&&this.view.dispatch({effects:qM.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 XW(){return[Uh,GW]}function Qj(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),l=n,c;!i.next().done;l+=i.value.length)if(!i.lineBreak)for(;c=e.exec(i.value);)s(l+c.index,c)}function YW(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 KW{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:l=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=(c,d,h,m)=>s(m,h,h+c[0].length,c,d);else if(typeof r=="function")this.addMatch=(c,d,h,m)=>{let p=r(c,d,h);p&&m(h,h+c[0].length,p)};else if(r)this.addMatch=(c,d,h,m)=>m(h,h+c[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=l}createDeco(e){let n=new ml,r=n.add.bind(n);for(let{from:s,to:i}of YW(e,this.maxLength))Qj(e.state.doc,this.regexp,s,i,(l,c)=>this.addMatch(c,e,l,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,l,c,d)=>{d>=e.view.viewport.from&&c<=e.view.viewport.to&&(r=Math.min(c,r),s=Math.max(d,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 l=Math.max(i.from,r),c=Math.min(i.to,s);if(c>=l){let d=e.state.doc.lineAt(l),h=d.tod.from;l--)if(this.boundary.test(d.text[l-1-d.from])){m=l;break}for(;cx.push(j.range(k,O));if(d==h)for(this.regexp.lastIndex=m-d.from;(v=this.regexp.exec(d.text))&&v.indexthis.addMatch(O,e,k,b));n=n.update({filterFrom:m,filterTo:p,filter:(k,O)=>kp,add:x})}}return n}}const W2=/x/.unicode!=null?"gu":"g",ZW=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,W2),JW={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 Py=null;function eG(){var t;if(Py==null&&typeof document<"u"&&document.body){let e=document.body.style;Py=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Py||!1}const tg=He.define({combine(t){let e=Oa(t,{render:null,specialChars:ZW,addSpecialChars:null});return(e.replaceTabs=!eG())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,W2)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,W2)),e}});function tG(t={}){return[tg.of(t),nG()]}let $j=null;function nG(){return $j||($j=lr.fromClass(class{constructor(t){this.view=t,this.decorations=Je.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(tg)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new KW({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=As(e[0],0);if(i==9){let l=s.lineAt(r),c=n.state.tabSize,d=Td(l.text,c,r-l.from);return Je.replace({widget:new aG((c-d%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Je.replace({widget:new iG(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(tg);t.startState.facet(tg)!=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 rG="•";function sG(t){return t>=32?rG:t==10?"␤":String.fromCharCode(9216+t)}class iG extends ja{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=sG(this.code),r=e.state.phrase("Control character")+" "+(JW[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 aG extends ja{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 lG(){return cG}const oG=Je.line({class:"cm-activeLine"}),cG=lr.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(oG.range(s.from)),e=s.from)}return Je.set(n)}},{decorations:t=>t.decorations});class uG extends ja{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?ud(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=s0(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 dG(t){let e=lr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Je.set([Je.widget({widget:new uG(t),side:1}).range(0)]):Je.none}get decorations(){return this.view.state.doc.length?Je.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,qe.contentAttributes.of({"aria-placeholder":t})]:e}const G2=2e3;function hG(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>G2||n.off>G2||e.col<0||n.col<0){let l=Math.min(e.off,n.off),c=Math.max(e.off,n.off);for(let d=r;d<=s;d++){let h=t.doc.line(d);h.length<=c&&i.push(Ce.range(h.from+l,h.to+c))}}else{let l=Math.min(e.col,n.col),c=Math.max(e.col,n.col);for(let d=r;d<=s;d++){let h=t.doc.line(d),m=j2(h.text,l,t.tabSize,!0);if(m<0)i.push(Ce.cursor(h.to));else{let p=j2(h.text,c,t.tabSize);i.push(Ce.range(h.from+m,h.from+p))}}}return i}function fG(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Hj(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>G2?-1:s==r.length?fG(t,e.clientX):Td(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function mG(t,e){let n=Hj(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),l=s.state.doc.lineAt(i);n={line:l.number,col:n.col,off:Math.min(n.off,l.length)},r=r.map(s.changes)}},get(s,i,l){let c=Hj(t,s);if(!c)return r;let d=hG(t.state,n,c);return d.length?l?Ce.create(d.concat(r.ranges)):Ce.create(d):r}}:null}function pG(t){let e=(n=>n.altKey&&n.button==0);return qe.mouseSelectionStyle.of((n,r)=>e(r)?mG(n,r):null)}const gG={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},xG={style:"cursor: crosshair"};function vG(t={}){let[e,n]=gG[t.key||"Alt"],r=lr.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,qe.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?xG:null})]}const up="-10000px";class FM{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(l=>l);let i=null;this.tooltipViews=this.tooltips.map(l=>i=r(l,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(d=>d);if(s===this.input){for(let d of this.tooltipViews)d.update&&d.update(e);return!1}let l=[],c=n?[]:null;for(let d=0;dn[h]=d),n.length=c.length),this.input=s,this.tooltips=i,this.tooltipViews=l,!0}}function yG(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const By=He.define({combine:t=>{var e,n,r;return{position:Fe.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)||yG}}}),Uj=new WeakMap,_w=lr.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(By);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 FM(t,Dw,(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(By);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=up,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(Fe.safari){let l=i.getBoundingClientRect();n=Math.abs(l.top+1e4)>1||Math.abs(l.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=Tw(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,l)=>{let c=this.manager.tooltipViews[l];return c.getCoords?c.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(By).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,l=[];for(let c=0;c=Math.min(n.bottom,r.bottom)||p.rightMath.min(n.right,r.right)+.1)){m.style.top=up;continue}let v=d.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,b=v?7:0,k=x.right-x.left,O=(e=Uj.get(h))!==null&&e!==void 0?e:x.bottom-x.top,j=h.offset||wG,T=this.view.textDirection==Hn.LTR,A=x.width>r.right-r.left?T?r.left:r.right-x.width:T?Math.max(r.left,Math.min(p.left-(v?14:0)+j.x,r.right-k)):Math.min(Math.max(r.left,p.left-k+(v?14:0)-j.x),r.right-k),_=this.above[c];!d.strictSide&&(_?p.top-O-b-j.yr.bottom)&&_==r.bottom-p.bottom>p.top-r.top&&(_=this.above[c]=!_);let D=(_?p.top-r.top:r.bottom-p.bottom)-b;if(DA&&Q.topE&&(E=_?Q.top-O-2-b:Q.bottom+b+2);if(this.position=="absolute"?(m.style.top=(E-t.parent.top)/i+"px",Vj(m,(A-t.parent.left)/s)):(m.style.top=E/i+"px",Vj(m,A/s)),v){let Q=p.left+(T?j.x:-j.x)-(A+14-7);v.style.left=Q/s+"px"}h.overlap!==!0&&l.push({left:A,top:E,right:z,bottom:E+O}),m.classList.toggle("cm-tooltip-above",_),m.classList.toggle("cm-tooltip-below",!_),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=up}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Vj(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const bG=qe.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"}}}),wG={x:0,y:0},Dw=He.define({enables:[_w,bG]}),Ag=He.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ox{static create(e){return new Ox(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new FM(e,Ag,(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 SG=Dw.compute([Ag],t=>{let e=t.facet(Ag);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:Ox.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class kG{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;ec.bottom||n.xc.right+e.defaultCharacterWidth)return;let d=e.bidiSpans(e.state.doc.lineAt(s)).find(m=>m.from<=s&&m.to>=s),h=d&&d.dir==Hn.RTL?-1:1;i=n.x{this.pending==c&&(this.pending=null,d&&!(Array.isArray(d)&&!d.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(d)?d:[d])}))},d=>_s(e.state,d,"hover tooltip"))}else l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])})}get tooltip(){let e=this.view.plugin(_w),n=e?e.manager.tooltips.findIndex(r=>r.create==Ox.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&&!OG(i.dom,e)||this.pending){let{pos:l}=s[0]||this.pending,c=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:l;(l==c?this.view.posAtCoords(this.lastMove)!=l:!jG(this.view,l,c,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 dp=4;function OG(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),l;if(l=t.querySelector(".cm-tooltip-arrow")){let c=l.getBoundingClientRect();s=Math.min(c.top,s),i=Math.max(c.bottom,i)}return e.clientX>=n-dp&&e.clientX<=r+dp&&e.clientY>=s-dp&&e.clientY<=i+dp}function jG(t,e,n,r,s,i){let l=t.scrollDOM.getBoundingClientRect(),c=t.documentTop+t.documentPadding.top+t.contentHeight;if(l.left>r||l.rights||Math.min(l.bottom,c)=e&&d<=n}function NG(t,e={}){let n=vt.define(),r=Br.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(l=>!e.hideOn(i,l))),i.docChanged)){let l=[];for(let c of s){let d=i.changes.mapPos(c.pos,-1,Ur.TrackDel);if(d!=null){let h=Object.assign(Object.create(null),c);h.pos=d,h.end!=null&&(h.end=i.changes.mapPos(h.end)),l.push(h)}}s=l}for(let l of i.effects)l.is(n)&&(s=l.value),l.is(CG)&&(s=[]);return s},provide:s=>Ag.from(s)});return{active:r,extension:[r,lr.define(s=>new kG(s,t,r,n,e.hoverTime||300)),SG]}}function QM(t,e){let n=t.plugin(_w);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const CG=vt.define(),Wj=He.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 wf(t,e){let n=t.plugin($M),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const $M=lr.fromClass(class{constructor(t){this.input=t.state.facet(Sf),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Wj);this.top=new hp(t,!0,e.topContainer),this.bottom=new hp(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(Wj);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new hp(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new hp(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Sf);if(n!=this.input){let r=n.filter(d=>d),s=[],i=[],l=[],c=[];for(let d of r){let h=this.specs.indexOf(d),m;h<0?(m=d(t.view),c.push(m)):(m=this.panels[h],m.update&&m.update(t)),s.push(m),(m.top?i:l).push(m)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(l);for(let d of c)d.dom.classList.add("cm-panel"),d.mount&&d.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class hp{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=Gj(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Gj(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 Gj(t){let e=t.nextSibling;return t.remove(),e}const Sf=He.define({enables:$M});class gl extends yc{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}gl.prototype.elementClass="";gl.prototype.toDOM=void 0;gl.prototype.mapMode=Ur.TrackBefore;gl.prototype.startSide=gl.prototype.endSide=-1;gl.prototype.point=!0;const ng=He.define(),TG=He.define(),AG={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Yt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},rf=He.define();function MG(t){return[HM(),rf.of({...AG,...t})]}const Xj=He.define({combine:t=>t.some(e=>e)});function HM(t){return[EG]}const EG=lr.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(rf).map(e=>new Kj(t,e)),this.fixed=!t.state.facet(Xj);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(Xj)!=!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=Yt.iter(this.view.state.facet(ng),this.view.viewport.from),r=[],s=this.gutters.map(i=>new _G(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let l=!0;for(let c of i.type)if(c.type==fs.Text&&l){X2(n,r,c.from);for(let d of s)d.line(this.view,c,r);l=!1}else if(c.widget)for(let d of s)d.widget(this.view,c)}else if(i.type==fs.Text){X2(n,r,i.from);for(let l of s)l.line(this.view,i,r)}else if(i.widget)for(let l of s)l.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(rf),n=t.state.facet(rf),r=t.docChanged||t.heightChanged||t.viewportChanged||!Yt.eq(t.startState.facet(ng),t.state.facet(ng),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 l=e.indexOf(i);l<0?s.push(new Kj(this.view,i)):(this.gutters[l].update(t),s.push(this.gutters[l]))}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=>qe.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==Hn.LTR?{left:r,right:s}:{right:r,left:s}})});function Yj(t){return Array.isArray(t)?t:[t]}function X2(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class _G{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Yt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,l=n.height/e.scaleY;if(this.i==s.elements.length){let c=new UM(e,l,i,r);s.elements.push(c),s.dom.appendChild(c.dom)}else s.elements[this.i].update(e,l,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];X2(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 l=this.gutter;s.length==0&&!l.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(TG)){let l=i(e,n.widget,n);l&&(s||(s=[])).push(l)}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 Kj{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,l;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let d=i.getBoundingClientRect();l=(d.top+d.bottom)/2}else l=s.clientY;let c=e.lineBlockAtHeight(l-e.documentTop);n.domEventHandlers[r](e,c,s)&&s.preventDefault()});this.markers=Yj(n.markers(e)),n.initialSpacer&&(this.spacer=new UM(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=Yj(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!Yt.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 UM{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":""),DG(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,l=0;;){let c=l,d=ii(c,d,h)||l(c,d,h):l}return r}})}});class Ly extends gl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Iy(t,e){return t.state.facet(Qu).formatNumber(e,t.state)}const PG=rf.compute([Qu],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(RG)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new Ly(Iy(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(zG)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Qu)!=e.state.facet(Qu),initialSpacer(e){return new Ly(Iy(e,Zj(e.state.doc.lines)))},updateSpacer(e,n){let r=Iy(n.view,Zj(n.view.state.doc.lines));return r==e.number?e:new Ly(r)},domEventHandlers:t.facet(Qu).domEventHandlers,side:"before"}));function BG(t={}){return[Qu.of(t),HM(),PG]}function Zj(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(LG.range(s)))}return Yt.of(e)});function qG(){return IG}const VM=1024;let FG=0;class qy{constructor(e,n){this.from=e,this.to=n}}class Et{constructor(e={}){this.id=FG++,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=gs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Et.closedBy=new Et({deserialize:t=>t.split(" ")});Et.openedBy=new Et({deserialize:t=>t.split(" ")});Et.group=new Et({deserialize:t=>t.split(" ")});Et.isolate=new Et({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Et.contextHash=new Et({perNode:!0});Et.lookAhead=new Et({perNode:!0});Et.mounted=new Et({perNode:!0});class Mg{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Et.mounted.id]}}const QG=Object.create(null);class gs{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):QG,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new gs(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(Et.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(Et.group),i=-1;i<(s?s.length:0);i++){let l=n[i<0?r.name:s[i]];if(l)return l}}}}gs.none=new gs("",Object.create(null),0,8);class jx{constructor(e){this.types=e;for(let n=0;n0;for(let d=this.cursor(l|Or.IncludeAnonymous);;){let h=!1;if(d.from<=i&&d.to>=s&&(!c&&d.type.isAnonymous||n(d)!==!1)){if(d.firstChild())continue;h=!0}for(;h&&r&&(c||!d.type.isAnonymous)&&r(d),!d.nextSibling();){if(!d.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:Pw(gs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Dn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Dn(gs.none,n,r,s)))}static build(e){return VG(e)}}Dn.empty=new Dn(gs.none,[],[],0);class Rw{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 Rw(this.buffer,this.index)}}class go{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return gs.none}toString(){let e=[];for(let n=0;n0));d=l[d+3]);return c}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),l=0;for(let c=e,d=0;c=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function kf(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?c.length:-1;e!=h;e+=n){let m=c[e],p=d[e]+l.from;if(WM(s,r,p,p+m.length)){if(m instanceof go){if(i&Or.ExcludeBuffers)continue;let x=m.findChild(0,m.buffer.length,n,r-p,s);if(x>-1)return new ha(new $G(l,m,e,p),null,x)}else if(i&Or.IncludeAnonymous||!m.type.isAnonymous||zw(m)){let x;if(!(i&Or.IgnoreMounts)&&(x=Mg.get(m))&&!x.overlay)return new Ps(x.tree,p,e,l);let v=new Ps(m,p,e,l);return i&Or.IncludeAnonymous||!v.type.isAnonymous?v:v.nextChild(n<0?m.children.length-1:0,n,r,s)}}}if(i&Or.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+n:e=n<0?-1:l._parent._tree.children.length,l=l._parent,!l))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&Or.IgnoreOverlays)&&(s=Mg.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:l,to:c}of s.overlay)if((n>0?l<=i:l=i:c>i))return new Ps(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 e7(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let l=!1;!l;)if(l=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 Y2(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 $G{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class ha extends GM{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 ha(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&Or.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 ha(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 ha(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 ha(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 l=r.buffer[this.index+1];e.push(r.slice(s,i,l)),n.push(0)}return new Dn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function XM(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||l.to=e){let c=new Ps(l.tree,l.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(kf(c,e,n,!1))}}return s?XM(s):r}class K2{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 Ps)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 Ps?(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&Or.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Or.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Or.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,l=e<0?-1:r._tree.children.length;i!=l;i+=e){let c=r._tree.children[i];if(this.mode&Or.IncludeAnonymous||c instanceof go||!c.type.isAnonymous||zw(c))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let l=e;l;l=l._parent)if(l.index==s){if(s==this.index)return l;n=l,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return Y2(this._tree,e,s);let l=r[n.buffer[this.stack[i]]];if(!l.isAnonymous){if(e[s]&&e[s]!=l.name)return!1;s--}}return!0}}function zw(t){return t.children.some(e=>e instanceof go||!e.type.isAnonymous||zw(e))}function VG(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=VM,reused:i=[],minRepeatType:l=r.types.length}=t,c=Array.isArray(n)?new Rw(n,n.length):n,d=r.types,h=0,m=0;function p(D,E,z,Q,F,L){let{id:U,start:V,end:ce,size:W}=c,J=m,$=h;if(W<0)if(c.next(),W==-1){let me=i[U];z.push(me),Q.push(V-D);return}else if(W==-3){h=U;return}else if(W==-4){m=U;return}else throw new RangeError(`Unrecognized record size: ${W}`);let ae=d[U],ne,ue,R=V-D;if(ce-V<=s&&(ue=O(c.pos-E,F))){let me=new Uint16Array(ue.size-ue.skip),Y=c.pos-ue.size,P=me.length;for(;c.pos>Y;)P=j(ue.start,me,P);ne=new go(me,ce-ue.start,r),R=ue.start-D}else{let me=c.pos-W;c.next();let Y=[],P=[],K=U>=l?U:-1,H=0,fe=ce;for(;c.pos>me;)K>=0&&c.id==K&&c.size>=0?(c.end<=fe-s&&(b(Y,P,V,H,c.end,fe,K,J,$),H=Y.length,fe=c.end),c.next()):L>2500?x(V,me,Y,P):p(V,me,Y,P,K,L+1);if(K>=0&&H>0&&H-1&&H>0){let ve=v(ae,$);ne=Pw(ae,Y,P,0,Y.length,0,ce-V,ve,ve)}else ne=k(ae,Y,P,ce-V,J-ce,$)}z.push(ne),Q.push(R)}function x(D,E,z,Q){let F=[],L=0,U=-1;for(;c.pos>E;){let{id:V,start:ce,end:W,size:J}=c;if(J>4)c.next();else{if(U>-1&&ce=0;W-=3)V[J++]=F[W],V[J++]=F[W+1]-ce,V[J++]=F[W+2]-ce,V[J++]=J;z.push(new go(V,F[2]-ce,r)),Q.push(ce-D)}}function v(D,E){return(z,Q,F)=>{let L=0,U=z.length-1,V,ce;if(U>=0&&(V=z[U])instanceof Dn){if(!U&&V.type==D&&V.length==F)return V;(ce=V.prop(Et.lookAhead))&&(L=Q[U]+V.length+ce)}return k(D,z,Q,F,L,E)}}function b(D,E,z,Q,F,L,U,V,ce){let W=[],J=[];for(;D.length>Q;)W.push(D.pop()),J.push(E.pop()+z-F);D.push(k(r.types[U],W,J,L-F,V-L,ce)),E.push(F-z)}function k(D,E,z,Q,F,L,U){if(L){let V=[Et.contextHash,L];U=U?[V].concat(U):[V]}if(F>25){let V=[Et.lookAhead,F];U=U?[V].concat(U):[V]}return new Dn(D,E,z,Q,U)}function O(D,E){let z=c.fork(),Q=0,F=0,L=0,U=z.end-s,V={size:0,start:0,skip:0};e:for(let ce=z.pos-D;z.pos>ce;){let W=z.size;if(z.id==E&&W>=0){V.size=Q,V.start=F,V.skip=L,L+=4,Q+=4,z.next();continue}let J=z.pos-W;if(W<0||J=l?4:0,ae=z.start;for(z.next();z.pos>J;){if(z.size<0)if(z.size==-3)$+=4;else break e;else z.id>=l&&($+=4);z.next()}F=ae,Q+=W,L+=$}return(E<0||Q==D)&&(V.size=Q,V.start=F,V.skip=L),V.size>4?V:void 0}function j(D,E,z){let{id:Q,start:F,end:L,size:U}=c;if(c.next(),U>=0&&Q4){let ce=c.pos-(U-4);for(;c.pos>ce;)z=j(D,E,z)}E[--z]=V,E[--z]=L-D,E[--z]=F-D,E[--z]=Q}else U==-3?h=Q:U==-4&&(m=Q);return z}let T=[],A=[];for(;c.pos>0;)p(t.start||0,t.bufferStart||0,T,A,-1,0);let _=(e=t.length)!==null&&e!==void 0?e:T.length?A[0]+T[0].length:0;return new Dn(d[t.topID],T.reverse(),A.reverse(),_)}const t7=new WeakMap;function rg(t,e){if(!t.isAnonymous||e instanceof go||e.type!=t)return 1;let n=t7.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Dn)){n=1;break}n+=rg(t,r)}t7.set(e,n)}return n}function Pw(t,e,n,r,s,i,l,c,d){let h=0;for(let b=r;b=m)break;E+=z}if(A==_+1){if(E>m){let z=b[_];v(z.children,z.positions,0,z.children.length,k[_]+T);continue}p.push(b[_])}else{let z=k[A-1]+b[A-1].length-D;p.push(Pw(t,b,k,_,A,D,z,null,d))}x.push(D+T-i)}}return v(e,n,r,s,0),(c||d)(p,x,l)}class WG{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 ha?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ps&&this.map.set(e.tree,n)}get(e){return e instanceof ha?this.getBuffer(e.context.buffer,e.index):e instanceof Ps?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 pc{constructor(e,n,r,s,i=!1,l=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(l?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 pc(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,l=e.length?e[0]:null;for(let c=0,d=0,h=0;;c++){let m=c=r)for(;l&&l.from=x.from||p<=x.to||h){let v=Math.max(x.from,d)-h,b=Math.min(x.to,p)-h;x=v>=b?null:new pc(v,b,x.tree,x.offset+h,c>0,!!m)}if(x&&s.push(x),l.to>p)break;l=inew qy(s.from,s.to)):[new qy(0,0)]:[new qy(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 GG{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 Et({perNode:!0});let XG=0;class yi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=XG++}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 yi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new yi(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 Eg(e);return r=>r.modified.indexOf(n)>-1?r:Eg.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let YG=0;class Eg{constructor(e){this.name=e,this.instances=[],this.id=YG++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(c=>c.base==e&&KG(n,c.modified));if(r)return r;let s=[],i=new yi(e.name,s,e,n);for(let c of n)c.instances.push(i);let l=ZG(n);for(let c of e.set)if(!c.modified.length)for(let d of l)s.push(Eg.get(c,d));return i}}function KG(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function ZG(t){let e=[[]];for(let n=0;nr.length-n.length)}function Lw(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=[],l=2,c=s;for(let p=0;;){if(c=="..."&&p>0&&p+3==s.length){l=1;break}let x=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!x)throw new RangeError("Invalid path: "+s);if(i.push(x[0]=="*"?"":x[0][0]=='"'?JSON.parse(x[0]):x[0]),p+=x[0].length,p==s.length)break;let v=s[p++];if(p==s.length&&v=="!"){l=0;break}if(v!="/")throw new RangeError("Invalid path: "+s);c=s.slice(p)}let d=i.length-1,h=i[d];if(!h)throw new RangeError("Invalid path: "+s);let m=new Of(r,l,d>0?i.slice(0,d):null);e[h]=m.sort(e[h])}}return YM.add(e)}const YM=new Et({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 Of(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Of{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let l=s;for(let c of i)for(let d of c.set){let h=n[d.id];if(h){l=l?l+" "+h:h;break}}return l},scope:r}}function JG(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function eX(t,e,n,r=0,s=t.length){let i=new tX(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class tX{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:l,from:c,to:d}=e;if(c>=r||d<=n)return;l.isTop&&(i=this.highlighters.filter(v=>!v.scope||v.scope(l)));let h=s,m=nX(e)||Of.empty,p=JG(i,m.tags);if(p&&(h&&(h+=" "),h+=p,m.mode==1&&(s+=(s?" ":"")+p)),this.startSpan(Math.max(n,c),h),m.opaque)return;let x=e.tree&&e.tree.prop(Et.mounted);if(x&&x.overlay){let v=e.node.enter(x.overlay[0].from+c,1),b=this.highlighters.filter(O=>!O.scope||O.scope(x.tree.type)),k=e.firstChild();for(let O=0,j=c;;O++){let T=O=A||!e.nextSibling())););if(!T||A>r)break;j=T.to+c,j>n&&(this.highlightRange(v.cursor(),Math.max(n,T.from+c),Math.min(r,j),"",b),this.startSpan(Math.min(r,j),h))}k&&e.parent()}else if(e.firstChild()){x&&(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 nX(t){let e=t.type.prop(YM);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ie=yi.define,mp=Ie(),eo=Ie(),n7=Ie(eo),r7=Ie(eo),to=Ie(),pp=Ie(to),Fy=Ie(to),sa=Ie(),Zo=Ie(sa),na=Ie(),ra=Ie(),Z2=Ie(),Rh=Ie(Z2),gp=Ie(),he={comment:mp,lineComment:Ie(mp),blockComment:Ie(mp),docComment:Ie(mp),name:eo,variableName:Ie(eo),typeName:n7,tagName:Ie(n7),propertyName:r7,attributeName:Ie(r7),className:Ie(eo),labelName:Ie(eo),namespace:Ie(eo),macroName:Ie(eo),literal:to,string:pp,docString:Ie(pp),character:Ie(pp),attributeValue:Ie(pp),number:Fy,integer:Ie(Fy),float:Ie(Fy),bool:Ie(to),regexp:Ie(to),escape:Ie(to),color:Ie(to),url:Ie(to),keyword:na,self:Ie(na),null:Ie(na),atom:Ie(na),unit:Ie(na),modifier:Ie(na),operatorKeyword:Ie(na),controlKeyword:Ie(na),definitionKeyword:Ie(na),moduleKeyword:Ie(na),operator:ra,derefOperator:Ie(ra),arithmeticOperator:Ie(ra),logicOperator:Ie(ra),bitwiseOperator:Ie(ra),compareOperator:Ie(ra),updateOperator:Ie(ra),definitionOperator:Ie(ra),typeOperator:Ie(ra),controlOperator:Ie(ra),punctuation:Z2,separator:Ie(Z2),bracket:Rh,angleBracket:Ie(Rh),squareBracket:Ie(Rh),paren:Ie(Rh),brace:Ie(Rh),content:sa,heading:Zo,heading1:Ie(Zo),heading2:Ie(Zo),heading3:Ie(Zo),heading4:Ie(Zo),heading5:Ie(Zo),heading6:Ie(Zo),contentSeparator:Ie(sa),list:Ie(sa),quote:Ie(sa),emphasis:Ie(sa),strong:Ie(sa),link:Ie(sa),monospace:Ie(sa),strikethrough:Ie(sa),inserted:Ie(),deleted:Ie(),changed:Ie(),invalid:Ie(),meta:gp,documentMeta:Ie(gp),annotation:Ie(gp),processingInstruction:Ie(gp),definition:yi.defineModifier("definition"),constant:yi.defineModifier("constant"),function:yi.defineModifier("function"),standard:yi.defineModifier("standard"),local:yi.defineModifier("local"),special:yi.defineModifier("special")};for(let t in he){let e=he[t];e instanceof yi&&(e.name=t)}KM([{tag:he.link,class:"tok-link"},{tag:he.heading,class:"tok-heading"},{tag:he.emphasis,class:"tok-emphasis"},{tag:he.strong,class:"tok-strong"},{tag:he.keyword,class:"tok-keyword"},{tag:he.atom,class:"tok-atom"},{tag:he.bool,class:"tok-bool"},{tag:he.url,class:"tok-url"},{tag:he.labelName,class:"tok-labelName"},{tag:he.inserted,class:"tok-inserted"},{tag:he.deleted,class:"tok-deleted"},{tag:he.literal,class:"tok-literal"},{tag:he.string,class:"tok-string"},{tag:he.number,class:"tok-number"},{tag:[he.regexp,he.escape,he.special(he.string)],class:"tok-string2"},{tag:he.variableName,class:"tok-variableName"},{tag:he.local(he.variableName),class:"tok-variableName tok-local"},{tag:he.definition(he.variableName),class:"tok-variableName tok-definition"},{tag:he.special(he.variableName),class:"tok-variableName2"},{tag:he.definition(he.propertyName),class:"tok-propertyName tok-definition"},{tag:he.typeName,class:"tok-typeName"},{tag:he.namespace,class:"tok-namespace"},{tag:he.className,class:"tok-className"},{tag:he.macroName,class:"tok-macroName"},{tag:he.propertyName,class:"tok-propertyName"},{tag:he.operator,class:"tok-operator"},{tag:he.comment,class:"tok-comment"},{tag:he.meta,class:"tok-meta"},{tag:he.invalid,class:"tok-invalid"},{tag:he.punctuation,class:"tok-punctuation"}]);var Qy;const oc=new Et;function ZM(t){return He.define({combine:t?e=>e.concat(t):void 0})}const rX=new Et;class wi{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Vt.prototype.hasOwnProperty("tree")||Object.defineProperty(Vt.prototype,"tree",{get(){return zr(this)}}),this.parser=n,this.extension=[xo.of(this),Vt.languageData.of((i,l,c)=>{let d=s7(i,l,c),h=d.type.prop(oc);if(!h)return[];let m=i.facet(h),p=d.type.prop(rX);if(p){let x=d.resolve(l-d.from,c);for(let v of p)if(v.test(x,i)){let b=i.facet(v.facet);return v.type=="replace"?b:b.concat(m)}}return m})].concat(r)}isActiveAt(e,n,r=-1){return s7(e,n,r).type.prop(oc)==this.data}findRegions(e){let n=e.facet(xo);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,l)=>{if(i.prop(oc)==this.data){r.push({from:l,to:l+i.length});return}let c=i.prop(Et.mounted);if(c){if(c.tree.prop(oc)==this.data){if(c.overlay)for(let d of c.overlay)r.push({from:d.from+l,to:d.to+l});else r.push({from:l,to:l+i.length});return}else if(c.overlay){let d=r.length;if(s(c.tree,c.overlay[0].from+l),r.length>d)return}}for(let d=0;dr.isTop?n:void 0)]}),e.name)}configure(e,n){return new jf(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function zr(t){let e=t.field(wi.state,!1);return e?e.tree:Dn.empty}class sX{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let zh=null;class md{constructor(e,n,r=[],s,i,l,c,d){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=l,this.skipped=c,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new md(e,n,[],Dn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new sX(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Dn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(pc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=zh;zh=this;try{return e()}finally{zh=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=i7(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:l,skipped:c}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((h,m,p,x)=>d.push({fromA:h,toA:m,fromB:p,toB:x})),r=pc.applyChanges(r,d),s=Dn.empty,i=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){c=[];for(let h of this.skipped){let m=e.mapPos(h.from,1),p=e.mapPos(h.to,-1);me.from&&(this.fragments=i7(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 Bw{createParse(n,r,s){let i=s[0].from,l=s[s.length-1].to;return{parsedPos:i,advance(){let d=zh;if(d){for(let h of s)d.tempSkipped.push(h);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=l,new Dn(gs.none,[],[],l-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 zh}}function i7(t,e,n){return pc.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class pd{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 pd(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=md.create(e.facet(xo).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new pd(r)}}wi.state=Br.define({create:pd.init,update(t,e){for(let n of e.effects)if(n.is(wi.setState))return n.value;return e.startState.facet(xo)!=e.state.facet(xo)?pd.init(e.state):t.apply(e)}});let JM=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(JM=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const $y=typeof navigator<"u"&&(!((Qy=navigator.scheduling)===null||Qy===void 0)&&Qy.isInputPending)?()=>navigator.scheduling.isInputPending():null,iX=lr.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(wi.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(wi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=JM(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,d=i.context.work(()=>$y&&$y()||Date.now()>l,s+(c?0:1e5));this.chunkBudget-=Date.now()-n,(d||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:wi.setState.of(new pd(i.context))})),this.chunkBudget>0&&!(d&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>_s(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()}}}),xo=He.define({combine(t){return t.length?t[0]:null},enables:t=>[wi.state,iX,qe.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class eE{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const aX=He.define(),u0=He.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 kc(t){let e=t.facet(u0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Nf(t,e){let n="",r=t.tabSize,s=t.facet(u0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?lX(t,n,e):null}class Nx{constructor(e,n={}){this.state=e,this.options=n,this.unit=kc(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=l-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Td(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 l=i(s);if(l>-1)return l}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Cx=new Et;function lX(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 l=s;l&&!(l.fromr.node.to||l.from==r.node.from&&l.type==r.node.type);l=l.parent)i.push(l);for(let l=i.length-1;l>=0;l--)r={node:i[l],next:r}}return tE(r,t,n)}function tE(t,e,n){for(let r=t;r;r=r.next){let s=cX(r.node);if(s)return s(qw.create(e,n,r))}return 0}function oX(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function cX(t){let e=t.type.prop(Cx);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Et.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return l=>nE(l,!0,1,void 0,i&&!oX(l)?s.from:void 0)}return t.parent==null?uX:null}function uX(){return 0}class qw extends Nx{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 qw(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(dX(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return tE(this.context.next,this.base,this.pos)}}function dX(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function hX(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),l=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let c=n.to;;){let d=e.childAfter(c);if(!d||d==r)return null;if(!d.type.isSkipped){if(d.from>=l)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}c=d.to}}function Hy({closing:t,align:e=!0,units:n=1}){return r=>nE(r,e,n,t)}function nE(t,e,n,r,s){let i=t.textAfter,l=i.match(/^\s*/)[0].length,c=r&&i.slice(l,l+r.length)==r||s==t.pos+l,d=e?hX(t):null;return d?c?t.column(d.from):t.column(d.to):t.baseIndent+(c?0:t.unit*n)}function a7({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const fX=200;function mX(){return Vt.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+fX)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:l}=t,c=-1,d=[];for(let{head:h}of l.selection.ranges){let m=l.doc.lineAt(h);if(m.from==c)continue;c=m.from;let p=Iw(l,m.from);if(p==null)continue;let x=/^\s*/.exec(m.text)[0],v=Nf(l,p);x!=v&&d.push({from:m.from,to:m.from+x.length,insert:v})}return d.length?[t,{changes:d,sequential:!0}]:t})}const pX=He.define(),Fw=new Et;function rE(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&c.from=e&&h.to>n&&(i=h)}}return i}function xX(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function _g(t,e,n){for(let r of t.facet(pX)){let s=r(t,e,n);if(s)return s}return gX(t,e,n)}function sE(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 Tx=vt.define({map:sE}),d0=vt.define({map:sE});function iE(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 Oc=Br.define({create(){return Je.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=l7(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Tx)&&!vX(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(oE),s=r?Je.replace({widget:new jX(r(e.state,n.value))}):o7;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(d0)&&(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=l7(t,e.selection.main.head)),t},provide:t=>qe.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function Dg(t,e,n){var r;let s=null;return(r=t.field(Oc,!1))===null||r===void 0||r.between(e,n,(i,l)=>{(!s||s.from>i)&&(s={from:i,to:l})}),s}function vX(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function aE(t,e){return t.field(Oc,!1)?e:e.concat(vt.appendConfig.of(cE()))}const yX=t=>{for(let e of iE(t)){let n=_g(t.state,e.from,e.to);if(n)return t.dispatch({effects:aE(t.state,[Tx.of(n),lE(t,n)])}),!0}return!1},bX=t=>{if(!t.state.field(Oc,!1))return!1;let e=[];for(let n of iE(t)){let r=Dg(t.state,n.from,n.to);r&&e.push(d0.of(r),lE(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function lE(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return qe.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const wX=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(Oc,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(d0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},kX=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:yX},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:bX},{key:"Ctrl-Alt-[",run:wX},{key:"Ctrl-Alt-]",run:SX}],OX={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},oE=He.define({combine(t){return Oa(t,OX)}});function cE(t){return[Oc,TX]}function uE(t,e){let{state:n}=t,r=n.facet(oE),s=l=>{let c=t.lineBlockAt(t.posAtDOM(l.target)),d=Dg(t.state,c.from,c.to);d&&t.dispatch({effects:d0.of(d)}),l.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 o7=Je.replace({widget:new class extends ja{toDOM(t){return uE(t,null)}}});class jX extends ja{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return uE(e,this.value)}}const NX={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Uy extends gl{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 CX(t={}){let e={...NX,...t},n=new Uy(e,!0),r=new Uy(e,!1),s=lr.fromClass(class{constructor(l){this.from=l.viewport.from,this.markers=this.buildMarkers(l)}update(l){(l.docChanged||l.viewportChanged||l.startState.facet(xo)!=l.state.facet(xo)||l.startState.field(Oc,!1)!=l.state.field(Oc,!1)||zr(l.startState)!=zr(l.state)||e.foldingChanged(l))&&(this.markers=this.buildMarkers(l.view))}buildMarkers(l){let c=new ml;for(let d of l.viewportLineBlocks){let h=Dg(l.state,d.from,d.to)?r:_g(l.state,d.from,d.to)?n:null;h&&c.add(d.from,d.from,h)}return c.finish()}}),{domEventHandlers:i}=e;return[s,MG({class:"cm-foldGutter",markers(l){var c;return((c=l.plugin(s))===null||c===void 0?void 0:c.markers)||Yt.empty},initialSpacer(){return new Uy(e,!1)},domEventHandlers:{...i,click:(l,c,d)=>{if(i.click&&i.click(l,c,d))return!0;let h=Dg(l.state,c.from,c.to);if(h)return l.dispatch({effects:d0.of(h)}),!0;let m=_g(l.state,c.from,c.to);return m?(l.dispatch({effects:Tx.of(m)}),!0):!1}}}),cE()]}const TX=qe.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 h0{constructor(e,n){this.specs=e;let r;function s(c){let d=fo.newName();return(r||(r=Object.create(null)))["."+d]=c,d}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,l=n.scope;this.scope=l instanceof wi?c=>c.prop(oc)==l.data:l?c=>c==l:void 0,this.style=KM(e.map(c=>({tag:c.tag,class:c.class||s(Object.assign({},c,{tag:null}))})),{all:i}).style,this.module=r?new fo(r):null,this.themeType=n.themeType}static define(e,n){return new h0(e,n||{})}}const J2=He.define(),dE=He.define({combine(t){return t.length?[t[0]]:null}});function Vy(t){let e=t.facet(J2);return e.length?e:t.facet(dE)}function hE(t,e){let n=[MX],r;return t instanceof h0&&(t.module&&n.push(qe.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(dE.of(t)):r?n.push(J2.computeN([qe.darkTheme],s=>s.facet(qe.darkTheme)==(r=="dark")?[t]:[])):n.push(J2.of(t)),n}class AX{constructor(e){this.markCache=Object.create(null),this.tree=zr(e.state),this.decorations=this.buildDeco(e,Vy(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=zr(e.state),r=Vy(e.state),s=r!=Vy(e.startState),{viewport:i}=e.view,l=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=l):(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 Je.none;let r=new ml;for(let{from:s,to:i}of e.visibleRanges)eX(this.tree,n,(l,c,d)=>{r.add(l,c,this.markCache[d]||(this.markCache[d]=Je.mark({class:d})))},s,i);return r.finish()}}const MX=No.high(lr.fromClass(AX,{decorations:t=>t.decorations})),EX=h0.define([{tag:he.meta,color:"#404740"},{tag:he.link,textDecoration:"underline"},{tag:he.heading,textDecoration:"underline",fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strong,fontWeight:"bold"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.keyword,color:"#708"},{tag:[he.atom,he.bool,he.url,he.contentSeparator,he.labelName],color:"#219"},{tag:[he.literal,he.inserted],color:"#164"},{tag:[he.string,he.deleted],color:"#a11"},{tag:[he.regexp,he.escape,he.special(he.string)],color:"#e40"},{tag:he.definition(he.variableName),color:"#00f"},{tag:he.local(he.variableName),color:"#30a"},{tag:[he.typeName,he.namespace],color:"#085"},{tag:he.className,color:"#167"},{tag:[he.special(he.variableName),he.macroName],color:"#256"},{tag:he.definition(he.propertyName),color:"#00c"},{tag:he.comment,color:"#940"},{tag:he.invalid,color:"#f00"}]),_X=qe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),fE=1e4,mE="()[]{}",pE=He.define({combine(t){return Oa(t,{afterCursor:!0,brackets:mE,maxScanDistance:fE,renderMatch:zX})}}),DX=Je.mark({class:"cm-matchingBracket"}),RX=Je.mark({class:"cm-nonmatchingBracket"});function zX(t){let e=[],n=t.matched?DX:RX;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 PX=Br.define({create(){return Je.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(pE);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=fa(e.state,s.head,-1,r)||s.head>0&&fa(e.state,s.head-1,1,r)||r.afterCursor&&(fa(e.state,s.head,1,r)||s.headqe.decorations.from(t)}),BX=[PX,_X];function LX(t={}){return[pE.of(t),BX]}const IX=new Et;function e4(t,e,n){let r=t.prop(e<0?Et.openedBy:Et.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 t4(t){let e=t.type.prop(IX);return e?e(t.node):t}function fa(t,e,n,r={}){let s=r.maxScanDistance||fE,i=r.brackets||mE,l=zr(t),c=l.resolveInner(e,n);for(let d=c;d;d=d.parent){let h=e4(d.type,n,i);if(h&&d.from0?e>=m.from&&em.from&&e<=m.to))return qX(t,e,n,d,m,h,i)}}return FX(t,e,n,l,c.type,s,i)}function qX(t,e,n,r,s,i,l){let c=r.parent,d={from:s.from,to:s.to},h=0,m=c?.cursor();if(m&&(n<0?m.childBefore(r.from):m.childAfter(r.to)))do if(n<0?m.to<=r.from:m.from>=r.to){if(h==0&&i.indexOf(m.type.name)>-1&&m.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},m=t.doc.iterRange(e,n>0?t.doc.length:0),p=0;for(let x=0;!m.next().done&&x<=i;){let v=m.value;n<0&&(x+=v.length);let b=e+x*n;for(let k=n>0?0:v.length-1,O=n>0?v.length:-1;k!=O;k+=n){let j=l.indexOf(v[k]);if(!(j<0||r.resolveInner(b+k,1).type!=s))if(j%2==0==n>0)p++;else{if(p==1)return{start:h,end:{from:b+k,to:b+k+1},matched:j>>1==d>>1};p--}}n>0&&(x+=v.length)}return m.done?{start:h,matched:!1}:null}function c7(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let l=r;l=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?l.toLowerCase():l,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 QX(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||$X,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||Hw,mergeTokens:t.mergeTokens!==!1}}function $X(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 u7=new WeakMap;class Qw extends wi{constructor(e){let n=ZM(e.languageData),r=QX(e),s,i=new class extends Bw{createParse(l,c,d){return new UX(s,l,c,d)}};super(n,i,[],e.name),this.topNode=GX(n,this),s=this,this.streamParser=r,this.stateAfter=new Et({perNode:!0}),this.tokenTable=e.tokenTable?new bE(r.tokenTable):WX}static define(e){return new Qw(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=u7.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let l=e.children.length-1;l>=0;l--){let c=e.children[l],d=n+e.positions[l],h=c instanceof Dn&&d=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let l=e.positions[i],c=e.children[i],d;if(ln&&$w(t,i.tree,0-i.offset,n,c),h;if(d&&d.pos<=r&&(h=xE(t,i.tree,n+i.offset,d.pos+i.offset,!1)))return{state:d.state,tree:h}}return{state:t.streamParser.startState(s?kc(s):4),tree:Dn.empty}}let UX=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=md.get(),l=s[0].from,{state:c,tree:d}=HX(e,r,l,this.to,i?.state);this.state=c,this.parsedPos=this.chunkStart=l+d.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(kc(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=md.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` `&&(n="");else{let r=n.indexOf(` `);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let l=this.ranges[s].from,c=this.lineAfter(l);n+=c,r=l+c.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 l=this.ranges[++this.rangeIndex].from;n+=l-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let c=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-c}let l=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&l>=0&&this.chunk[l]==e&&this.chunk[l+2]==n?this.chunk[l+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,l=new gE(n,e?e.state.tabSize:4,e?kc(e.state):2);if(l.eol())i.blankLine(this.state,l.indentUnit);else for(;!l.eol();){let c=vE(i.token,l,this.state);if(c&&(s=this.emitToken(this.lang.tokenTable.resolve(c),this.parsedPos+l.start,this.parsedPos+l.pos,s)),l.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Hw=Object.create(null),Cf=[gs.none],VX=new jx(Cf),d7=[],h7=Object.create(null),yE=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"]])yE[t]=wE(Hw,e);class bE{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),yE)}resolve(e){return e?this.table[e]||(this.table[e]=wE(this.extra,e)):0}}const WX=new bE(Hw);function Wy(t,e){d7.indexOf(t)>-1||(d7.push(t),console.warn(e))}function wE(t,e){let n=[];for(let c of e.split(" ")){let d=[];for(let h of c.split(".")){let m=t[h]||he[h];m?typeof m=="function"?d.length?d=d.map(m):Wy(h,`Modifier ${h} used at start of tag`):d.length?Wy(h,`Tag ${h} used as modifier`):d=Array.isArray(m)?m:[m]:Wy(h,`Unknown highlighting tag ${h}`)}for(let h of d)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(c=>c.id),i=h7[s];if(i)return i.id;let l=h7[s]=gs.define({id:Cf.length,name:r,props:[Lw({[r]:n})]});return Cf.push(l),l.id}function GX(t,e){let n=gs.define({id:Cf.length,name:"Document",props:[oc.add(()=>t),Cx.add(()=>r=>e.getIndent(r))],top:!0});return Cf.push(n),n}Hn.RTL,Hn.LTR;const XX=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Vw(t.state,n.from);return r.line?YX(t):r.block?ZX(t):!1};function Uw(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 YX=Uw(tY,0),KX=Uw(SE,0),ZX=Uw((t,e)=>SE(t,e,eY(e)),0);function Vw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Ph=50;function JX(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-Ph,r),l=t.sliceDoc(s,s+Ph),c=/\s*$/.exec(i)[0].length,d=/^\s*/.exec(l)[0].length,h=i.length-c;if(i.slice(h-e.length,h)==e&&l.slice(d,d+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:s+d,margin:d&&1}};let m,p;s-r<=2*Ph?m=p=t.sliceDoc(r,s):(m=t.sliceDoc(r,r+Ph),p=t.sliceDoc(s-Ph,s));let x=/^\s*/.exec(m)[0].length,v=/\s*$/.exec(p)[0].length,b=p.length-v-n.length;return m.slice(x,x+e.length)==e&&p.slice(b,b+n.length)==n?{open:{pos:r+x+e.length,margin:/\s/.test(m.charAt(x+e.length))?1:0},close:{pos:s-v-n.length,margin:/\s/.test(p.charAt(b-1))?1:0}}:null}function eY(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 SE(t,e,n=e.selection.ranges){let r=n.map(i=>Vw(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,l)=>JX(e,r[l],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,l)=>s[l]?[]:[{from:i.from,insert:r[l].open+" "},{from:i.to,insert:" "+r[l].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let l=0,c;ls&&(i==l||l>p.from)){s=p.from;let x=/^\s*/.exec(p.text)[0].length,v=x==p.length,b=p.text.slice(x,x+h.length)==h?x:-1;xi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:c,token:d,indent:h,empty:m,single:p}of r)(p||!m)&&i.push({from:c.from+h,insert:d+" "});let l=e.changes(i);return{changes:l,selection:e.selection.map(l,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:l,comment:c,token:d}of r)if(c>=0){let h=l.from+c,m=h+d.length;l.text[m-l.from]==" "&&m++,i.push({from:h,to:m})}return{changes:i}}return null}const n4=ka.define(),nY=ka.define(),rY=He.define(),kE=He.define({combine(t){return Oa(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)})}}),OE=Br.define({create(){return ma.empty},update(t,e){let n=e.state.facet(kE),r=e.annotation(n4);if(r){let d=Ds.fromTransaction(e,r.selection),h=r.side,m=h==0?t.undone:t.done;return d?m=Rg(m,m.length,n.minDepth,d):m=CE(m,e.startState.selection),new ma(h==0?r.rest:m,h==0?m:r.rest)}let s=e.annotation(nY);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(gr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=Ds.fromTransaction(e),l=e.annotation(gr.time),c=e.annotation(gr.userEvent);return i?t=t.addChanges(i,l,c,n,e):e.selection&&(t=t.addSelection(e.startState.selection,l,c,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 ma(t.done.map(Ds.fromJSON),t.undone.map(Ds.fromJSON))}});function sY(t={}){return[OE,kE.of(t),qe.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?jE:e.inputType=="historyRedo"?r4:null;return r?(e.preventDefault(),r(n)):!1}})]}function Ax(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(OE,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const jE=Ax(0,!1),r4=Ax(1,!1),iY=Ax(0,!0),aY=Ax(1,!0);class Ds{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 Ds(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 Ds(e.changes&&kr.fromJSON(e.changes),[],e.mapped&&va.fromJSON(e.mapped),e.startSelection&&Ce.fromJSON(e.startSelection),e.selectionsAfter.map(Ce.fromJSON))}static fromTransaction(e,n){let r=Si;for(let s of e.startState.facet(rY)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new Ds(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Si)}static selection(e){return new Ds(void 0,Si,void 0,void 0,e)}}function Rg(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 lY(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,l,c)=>{for(let d=0;d=h&&l<=m&&(r=!0)}}),r}function oY(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function NE(t,e){return t.length?e.length?t.concat(e):t:e}const Si=[],cY=200;function CE(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-cY));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Rg(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Ds.selection([e])]}function uY(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 Gy(t,e){if(!t.length)return t;let n=t.length,r=Si;for(;n;){let s=dY(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?[Ds.selection(r)]:Si}function dY(t,e,n){let r=NE(t.selectionsAfter.length?t.selectionsAfter.map(c=>c.map(e)):Si,n);if(!t.changes)return Ds.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(i):i;return new Ds(s,vt.mapEffects(t.effects,e),l,t.startSelection.map(i),r)}const hY=/^(input\.type|delete)($|\.)/;class ma{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 ma(this.done,this.undone):this}addChanges(e,n,r,s,i){let l=this.done,c=l[l.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!r||hY.test(r))&&(!c.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Mx(n,e))}function is(t){return t.textDirectionAt(t.state.selection.main.head)==Hn.LTR}const AE=t=>TE(t,!is(t)),ME=t=>TE(t,is(t));function EE(t,e){return Xi(t,n=>n.empty?t.moveByGroup(n,e):Mx(n,e))}const mY=t=>EE(t,!is(t)),pY=t=>EE(t,is(t));function gY(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 Ex(t,e,n){let r=zr(t).resolveInner(e.head),s=n?Et.closedBy:Et.openedBy;for(let d=e.head;;){let h=n?r.childAfter(d):r.childBefore(d);if(!h)break;gY(t,h,s)?r=h:d=n?h.to:h.from}let i=r.type.prop(s),l,c;return i&&(l=n?fa(t,r.from,1):fa(t,r.to,-1))&&l.matched?c=n?l.end.to:l.end.from:c=n?r.to:r.from,Ce.cursor(c,n?-1:1)}const xY=t=>Xi(t,e=>Ex(t.state,e,!is(t))),vY=t=>Xi(t,e=>Ex(t.state,e,is(t)));function _E(t,e){return Xi(t,n=>{if(!n.empty)return Mx(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const DE=t=>_E(t,!1),RE=t=>_E(t,!0);function zE(t){let e=t.scrollDOM.clientHeightl.empty?t.moveVertically(l,e,n.height):Mx(l,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let l=t.coordsAtPos(r.selection.main.head),c=t.scrollDOM.getBoundingClientRect(),d=c.top+n.marginTop,h=c.bottom-n.marginBottom;l&&l.top>d&&l.bottomPE(t,!1),s4=t=>PE(t,!0);function Co(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=Ce.cursor(r.from+i))}return s}const yY=t=>Xi(t,e=>Co(t,e,!0)),bY=t=>Xi(t,e=>Co(t,e,!1)),wY=t=>Xi(t,e=>Co(t,e,!is(t))),SY=t=>Xi(t,e=>Co(t,e,is(t))),kY=t=>Xi(t,e=>Ce.cursor(t.lineBlockAt(e.head).from,1)),OY=t=>Xi(t,e=>Ce.cursor(t.lineBlockAt(e.head).to,-1));function jY(t,e,n){let r=!1,s=Ad(t.selection,i=>{let l=fa(t,i.head,-1)||fa(t,i.head,1)||i.head>0&&fa(t,i.head-1,1)||i.headjY(t,e);function _i(t,e){let n=Ad(t.state.selection,r=>{let s=e(r);return Ce.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Gi(t.state,n)),!0)}function BE(t,e){return _i(t,n=>t.moveByChar(n,e))}const LE=t=>BE(t,!is(t)),IE=t=>BE(t,is(t));function qE(t,e){return _i(t,n=>t.moveByGroup(n,e))}const CY=t=>qE(t,!is(t)),TY=t=>qE(t,is(t)),AY=t=>_i(t,e=>Ex(t.state,e,!is(t))),MY=t=>_i(t,e=>Ex(t.state,e,is(t)));function FE(t,e){return _i(t,n=>t.moveVertically(n,e))}const QE=t=>FE(t,!1),$E=t=>FE(t,!0);function HE(t,e){return _i(t,n=>t.moveVertically(n,e,zE(t).height))}const m7=t=>HE(t,!1),p7=t=>HE(t,!0),EY=t=>_i(t,e=>Co(t,e,!0)),_Y=t=>_i(t,e=>Co(t,e,!1)),DY=t=>_i(t,e=>Co(t,e,!is(t))),RY=t=>_i(t,e=>Co(t,e,is(t))),zY=t=>_i(t,e=>Ce.cursor(t.lineBlockAt(e.head).from)),PY=t=>_i(t,e=>Ce.cursor(t.lineBlockAt(e.head).to)),g7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:0})),!0),x7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.doc.length})),!0),v7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.selection.main.anchor,head:0})),!0),y7=({state:t,dispatch:e})=>(e(Gi(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),BY=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),LY=({state:t,dispatch:e})=>{let n=_x(t).map(({from:r,to:s})=>Ce.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ce.create(n),userEvent:"select"})),!0},IY=({state:t,dispatch:e})=>{let n=Ad(t.selection,r=>{let s=zr(t),i=s.resolveStack(r.from,1);if(r.empty){let l=s.resolveStack(r.from,-1);l.node.from>=i.node.from&&l.node.to<=i.node.to&&(i=l)}for(let l=i;l;l=l.next){let{node:c}=l;if((c.from=r.to||c.to>r.to&&c.from<=r.from)&&l.next)return Ce.range(c.to,c.from)}return r});return n.eq(t.selection)?!1:(e(Gi(t,n)),!0)};function UE(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head);if(e?l.to0)for(let c=i;;){let d=t.moveVertically(c,e);if(d.headl.to){s.some(h=>h.head==d.head)||s.push(d);break}else{if(d.head==c.head)break;c=d}}}return s.length==r.ranges.length?!1:(t.dispatch(Gi(n,Ce.create(s,s.length-1))),!0)}const qY=t=>UE(t,!1),FY=t=>UE(t,!0),QY=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ce.create([n.main]):n.main.empty||(r=Ce.create([Ce.cursor(n.main.head)])),r?(e(Gi(t,r)),!0):!1};function f0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:l,to:c}=i;if(l==c){let d=e(i);dl&&(n="delete.forward",d=xp(t,d,!0)),l=Math.min(l,d),c=Math.max(c,d)}else l=xp(t,l,!1),c=xp(t,c,!0);return l==c?{range:i}:{changes:{from:l,to:c},range:Ce.cursor(l,ls(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const VE=(t,e,n)=>f0(t,r=>{let s=r.from,{state:i}=t,l=i.doc.lineAt(s),c,d;if(n&&!e&&s>l.from&&sVE(t,!1,!0),WE=t=>VE(t,!0,!1),GE=(t,e)=>f0(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),l=s.charCategorizer(r);for(let c=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let d=Vr(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,d)-i.from,Math.max(r,d)-i.from),m=l(h);if(c!=null&&m!=c)break;(h!=" "||r!=n.head)&&(c=m),r=d}return r}),XE=t=>GE(t,!1),$Y=t=>GE(t,!0),HY=t=>f0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headf0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),VY=t=>f0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Xt.of(["",""])},range:Ce.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},GY=({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),l=s==i.from?s-1:Vr(i.text,s-i.from,!1)+i.from,c=s==i.to?s+1:Vr(i.text,s-i.from,!0)+i.from;return{changes:{from:l,to:c,insert:t.doc.slice(s,c).append(t.doc.slice(l,s))},range:Ce.cursor(c)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _x(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 l=e[e.length-1];l.to=i.to,l.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function YE(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of _x(t)){if(n?i.to==t.doc.length:i.from==0)continue;let l=t.doc.lineAt(n?i.to+1:i.from-1),c=l.length+1;if(n){r.push({from:i.to,to:l.to},{from:i.from,insert:l.text+t.lineBreak});for(let d of i.ranges)s.push(Ce.range(Math.min(t.doc.length,d.anchor+c),Math.min(t.doc.length,d.head+c)))}else{r.push({from:l.from,to:i.from},{from:i.to,insert:t.lineBreak+l.text});for(let d of i.ranges)s.push(Ce.range(d.anchor-c,d.head-c))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ce.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const XY=({state:t,dispatch:e})=>YE(t,e,!1),YY=({state:t,dispatch:e})=>YE(t,e,!0);function KE(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of _x(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 KY=({state:t,dispatch:e})=>KE(t,e,!1),ZY=({state:t,dispatch:e})=>KE(t,e,!0),JY=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(_x(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let l=t.lineBlockAt(s.head),c=t.coordsAtPos(s.head,s.assoc||1);c&&(i=l.bottom+t.documentTop-c.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 eK(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=zr(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(Et.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 b7=ZE(!1),tK=ZE(!0);function ZE(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:l}=s,c=e.doc.lineAt(i),d=!t&&i==l&&eK(e,i);t&&(i=l=(l<=c.to?c:e.doc.lineAt(l)).to);let h=new Nx(e,{simulateBreak:i,simulateDoubleBreak:!!d}),m=Iw(h,i);for(m==null&&(m=Td(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));lc.from&&i{let s=[];for(let l=r.from;l<=r.to;){let c=t.doc.lineAt(l);c.number>n&&(r.empty||r.to>c.from)&&(e(c,s,r),n=c.number),l=c.to+1}let i=t.changes(s);return{changes:s,range:Ce.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const nK=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Nx(t,{overrideIndentation:i=>{let l=n[i];return l??-1}}),s=Ww(t,(i,l,c)=>{let d=Iw(r,i.from);if(d==null)return;/\S/.test(i.text)||(d=0);let h=/^\s*/.exec(i.text)[0],m=Nf(t,d);(h!=m||c.fromt.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{r.push({from:n.from,insert:t.facet(u0)})}),{userEvent:"input.indent"})),!0),e_=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Ww(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Td(s,t.tabSize),l=0,c=Nf(t,Math.max(0,i-kc(t)));for(;l(t.setTabFocusMode(),!0),sK=[{key:"Ctrl-b",run:AE,shift:LE,preventDefault:!0},{key:"Ctrl-f",run:ME,shift:IE},{key:"Ctrl-p",run:DE,shift:QE},{key:"Ctrl-n",run:RE,shift:$E},{key:"Ctrl-a",run:kY,shift:zY},{key:"Ctrl-e",run:OY,shift:PY},{key:"Ctrl-d",run:WE},{key:"Ctrl-h",run:i4},{key:"Ctrl-k",run:HY},{key:"Ctrl-Alt-h",run:XE},{key:"Ctrl-o",run:WY},{key:"Ctrl-t",run:GY},{key:"Ctrl-v",run:s4}],iK=[{key:"ArrowLeft",run:AE,shift:LE,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:mY,shift:CY,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:wY,shift:DY,preventDefault:!0},{key:"ArrowRight",run:ME,shift:IE,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:pY,shift:TY,preventDefault:!0},{mac:"Cmd-ArrowRight",run:SY,shift:RY,preventDefault:!0},{key:"ArrowUp",run:DE,shift:QE,preventDefault:!0},{mac:"Cmd-ArrowUp",run:g7,shift:v7},{mac:"Ctrl-ArrowUp",run:f7,shift:m7},{key:"ArrowDown",run:RE,shift:$E,preventDefault:!0},{mac:"Cmd-ArrowDown",run:x7,shift:y7},{mac:"Ctrl-ArrowDown",run:s4,shift:p7},{key:"PageUp",run:f7,shift:m7},{key:"PageDown",run:s4,shift:p7},{key:"Home",run:bY,shift:_Y,preventDefault:!0},{key:"Mod-Home",run:g7,shift:v7},{key:"End",run:yY,shift:EY,preventDefault:!0},{key:"Mod-End",run:x7,shift:y7},{key:"Enter",run:b7,shift:b7},{key:"Mod-a",run:BY},{key:"Backspace",run:i4,shift:i4,preventDefault:!0},{key:"Delete",run:WE,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:XE,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:$Y,preventDefault:!0},{mac:"Mod-Backspace",run:UY,preventDefault:!0},{mac:"Mod-Delete",run:VY,preventDefault:!0}].concat(sK.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),aK=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:xY,shift:AY},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:vY,shift:MY},{key:"Alt-ArrowUp",run:XY},{key:"Shift-Alt-ArrowUp",run:KY},{key:"Alt-ArrowDown",run:YY},{key:"Shift-Alt-ArrowDown",run:ZY},{key:"Mod-Alt-ArrowUp",run:qY},{key:"Mod-Alt-ArrowDown",run:FY},{key:"Escape",run:QY},{key:"Mod-Enter",run:tK},{key:"Alt-l",mac:"Ctrl-l",run:LY},{key:"Mod-i",run:IY,preventDefault:!0},{key:"Mod-[",run:e_},{key:"Mod-]",run:JE},{key:"Mod-Alt-\\",run:nK},{key:"Shift-Mod-k",run:JY},{key:"Shift-Mod-\\",run:NY},{key:"Mod-/",run:XX},{key:"Alt-A",run:KX},{key:"Ctrl-m",mac:"Shift-Alt-m",run:rK}].concat(iK),lK={key:"Tab",run:JE,shift:e_},w7=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class gd{constructor(e,n,r=0,s=e.length,i,l){this.test=l,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?c=>i(w7(c)):w7,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 As(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=yw(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=oa(e);let s=this.normalize(n);if(s.length)for(let i=0,l=r;;i++){let c=s.charCodeAt(i),d=this.match(c,l,this.bufferPos+this.bufferStart);if(i==s.length-1){if(d)return this.value=d,this;break}l==r&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=zg(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let c=new Yu(n,e.sliceString(n,r));return Xy.set(e,c),c}if(s.from==n&&s.to==r)return s;let{text:i,from:l}=s;return l>n&&(i=e.sliceString(n,l)+i,l=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=zg(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Yu.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(n_.prototype[Symbol.iterator]=r_.prototype[Symbol.iterator]=function(){return this});function oK(t){try{return new RegExp(t,Gw),!0}catch{return!1}}function zg(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function a4(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Mn("input",{class:"cm-textfield",name:"line",value:e}),r=Mn("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:sf.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},Mn("label",t.state.phrase("Go to line"),": ",n)," ",Mn("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),Mn("button",{name:"close",onclick:()=>{t.dispatch({effects:sf.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:l}=t,c=l.doc.lineAt(l.selection.main.head),[,d,h,m,p]=i,x=m?+m.slice(1):0,v=h?+h:c.number;if(h&&p){let O=v/100;d&&(O=O*(d=="-"?-1:1)+c.number/l.doc.lines),v=Math.round(l.doc.lines*O)}else h&&d&&(v=v*(d=="-"?-1:1)+c.number);let b=l.doc.line(Math.max(1,Math.min(l.doc.lines,v))),k=Ce.cursor(b.from+Math.max(0,Math.min(x,b.length)));t.dispatch({effects:[sf.of(!1),qe.scrollIntoView(k.from,{y:"center"})],selection:k}),t.focus()}return{dom:r}}const sf=vt.define(),S7=Br.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(sf)&&(t=n.value);return t},provide:t=>Sf.from(t,e=>e?a4:null)}),cK=t=>{let e=wf(t,a4);if(!e){let n=[sf.of(!0)];t.state.field(S7,!1)==null&&n.push(vt.appendConfig.of([S7,uK])),t.dispatch({effects:n}),e=wf(t,a4)}return e&&e.dom.querySelector("input").select(),!0},uK=qe.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"}}}),dK={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},hK=He.define({combine(t){return Oa(t,dK,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function fK(t){return[vK,xK]}const mK=Je.mark({class:"cm-selectionMatch"}),pK=Je.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function k7(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Vn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Vn.Word)}function gK(t,e,n,r){return t(e.sliceDoc(n,n+1))==Vn.Word&&t(e.sliceDoc(r-1,r))==Vn.Word}const xK=lr.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(hK),{state:n}=t,r=n.selection;if(r.ranges.length>1)return Je.none;let s=r.main,i,l=null;if(s.empty){if(!e.highlightWordAroundCursor)return Je.none;let d=n.wordAt(s.head);if(!d)return Je.none;l=n.charCategorizer(s.head),i=n.sliceDoc(d.from,d.to)}else{let d=s.to-s.from;if(d200)return Je.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),l=n.charCategorizer(s.head),!(k7(l,n,s.from,s.to)&&gK(l,n,s.from,s.to)))return Je.none}else if(i=n.sliceDoc(s.from,s.to),!i)return Je.none}let c=[];for(let d of t.visibleRanges){let h=new gd(n.doc,i,d.from,d.to);for(;!h.next().done;){let{from:m,to:p}=h.value;if((!l||k7(l,n,m,p))&&(s.empty&&m<=s.from&&p>=s.to?c.push(pK.range(m,p)):(m>=s.to||p<=s.from)&&c.push(mK.range(m,p)),c.length>e.maxMatches))return Je.none}}return Je.set(c)}},{decorations:t=>t.decorations}),vK=qe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),yK=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ce.create(n.ranges.map(s=>t.wordAt(s.head)||Ce.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function bK(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 l=!1,c=new gd(t.doc,e,r[r.length-1].to);;)if(c.next(),c.done){if(l)return null;c=new gd(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),l=!0}else{if(l&&r.some(d=>d.from==c.value.from))continue;if(i){let d=t.wordAt(c.value.from);if(!d||d.from!=c.value.from||d.to!=c.value.to)continue}return c.value}}const wK=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return yK({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=bK(t,r);return s?(e(t.update({selection:t.selection.addRange(Ce.range(s.from,s.to),!1),effects:qe.scrollIntoView(s.to)})),!0):!1},Md=He.define({combine(t){return Oa(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new DK(e),scrollToMatch:e=>qe.scrollIntoView(e)})}});class s_{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||oK(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 jK(this):new kK(this)}getCursor(e,n=0,r){let s=e.doc?e:Vt.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?zu(this,s,n,r):Ru(this,s,n,r)}}class i_{constructor(e){this.spec=e}}function Ru(t,e,n,r){return new gd(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?SK(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function SK(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Ru(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 zu(t,e,n,r){return new n_(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?OK(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Pg(t,e){return t.slice(Vr(t,e,!1),e)}function Bg(t,e){return t.slice(e,Vr(t,e))}function OK(t){return(e,n,r)=>!r[0].length||(t(Pg(r.input,r.index))!=Vn.Word||t(Bg(r.input,r.index))!=Vn.Word)&&(t(Bg(r.input,r.index+r[0].length))!=Vn.Word||t(Pg(r.input,r.index+r[0].length))!=Vn.Word)}class jK extends i_{nextMatch(e,n,r){let s=zu(this.spec,e,r,e.doc.length).next();return s.done&&(s=zu(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),l=zu(this.spec,e,i,r),c=null;for(;!l.next().done;)c=l.value;if(c&&(i==n||c.from>i+10))return c;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=zu(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 Tf=vt.define(),Xw=vt.define(),lo=Br.define({create(t){return new Yy(l4(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Tf)?t=new Yy(n.value.create(),t.panel):n.is(Xw)&&(t=new Yy(t.query,n.value?Yw:null));return t},provide:t=>Sf.from(t,e=>e.panel)});class Yy{constructor(e,n){this.query=e,this.panel=n}}const NK=Je.mark({class:"cm-searchMatch"}),CK=Je.mark({class:"cm-searchMatch cm-searchMatch-selected"}),TK=lr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(lo))}update(t){let e=t.state.field(lo);(e!=t.startState.field(lo)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Je.none;let{view:n}=this,r=new ml;for(let s=0,i=n.visibleRanges,l=i.length;si[s+1].from-500;)d=i[++s].to;t.highlight(n.state,c,d,(h,m)=>{let p=n.state.selection.ranges.some(x=>x.from==h&&x.to==m);r.add(h,m,p?CK:NK)})}return r.finish()}},{decorations:t=>t.decorations});function m0(t){return e=>{let n=e.state.field(lo,!1);return n&&n.query.spec.valid?t(e,n):o_(e)}}const Lg=m0((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ce.single(r.from,r.to),i=t.state.facet(Md);return t.dispatch({selection:s,effects:[Kw(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),l_(t),!0}),Ig=m0((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ce.single(s.from,s.to),l=t.state.facet(Md);return t.dispatch({selection:i,effects:[Kw(t,s),l.scrollToMatch(i.main,t)],userEvent:"select.search"}),l_(t),!0}),AK=m0((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ce.create(n.map(r=>Ce.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),MK=({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=[],l=0;for(let c=new gd(t.doc,t.sliceDoc(r,s));!c.next().done;){if(i.length>1e3)return!1;c.value.from==r&&(l=i.length),i.push(Ce.range(c.value.from,c.value.to))}return e(t.update({selection:Ce.create(i,l),userEvent:"select.search.matches"})),!0},O7=m0((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 l=i,c=[],d,h,m=[];l.from==r&&l.to==s&&(h=n.toText(e.getReplacement(l)),c.push({from:l.from,to:l.to,insert:h}),l=e.nextMatch(n,l.from,l.to),m.push(qe.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let p=t.state.changes(c);return l&&(d=Ce.single(l.from,l.to).map(p),m.push(Kw(t,l)),m.push(n.facet(Md).scrollToMatch(d.main,t))),t.dispatch({changes:p,selection:d,effects:m,userEvent:"input.replace"}),!0}),EK=m0((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:l}=s;return{from:i,to:l,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:qe.announce.of(r),userEvent:"input.replace.all"}),!0});function Yw(t){return t.state.facet(Md).createPanel(t)}function l4(t,e){var n,r,s,i,l;let c=t.selection.main,d=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!d)return e;let h=t.facet(Md);return new s_({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?d:d.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:(l=e?.wholeWord)!==null&&l!==void 0?l:h.wholeWord})}function a_(t){let e=wf(t,Yw);return e&&e.dom.querySelector("[main-field]")}function l_(t){let e=a_(t);e&&e==t.root.activeElement&&e.select()}const o_=t=>{let e=t.state.field(lo,!1);if(e&&e.panel){let n=a_(t);if(n&&n!=t.root.activeElement){let r=l4(t.state,e.query.spec);r.valid&&t.dispatch({effects:Tf.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Xw.of(!0),e?Tf.of(l4(t.state,e.query.spec)):vt.appendConfig.of(zK)]});return!0},c_=t=>{let e=t.state.field(lo,!1);if(!e||!e.panel)return!1;let n=wf(t,Yw);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Xw.of(!1)}),!0},_K=[{key:"Mod-f",run:o_,scope:"editor search-panel"},{key:"F3",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:c_,scope:"editor search-panel"},{key:"Mod-Shift-l",run:MK},{key:"Mod-Alt-g",run:cK},{key:"Mod-d",run:wK,preventDefault:!0}];class DK{constructor(e){this.view=e;let n=this.query=e.state.field(lo).query.spec;this.commit=this.commit.bind(this),this.searchField=Mn("input",{value:n.search,placeholder:Ys(e,"Find"),"aria-label":Ys(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mn("input",{value:n.replace,placeholder:Ys(e,"Replace"),"aria-label":Ys(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mn("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Mn("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Mn("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,l){return Mn("button",{class:"cm-button",name:s,onclick:i,type:"button"},l)}this.dom=Mn("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Lg(e),[Ys(e,"next")]),r("prev",()=>Ig(e),[Ys(e,"previous")]),r("select",()=>AK(e),[Ys(e,"all")]),Mn("label",null,[this.caseField,Ys(e,"match case")]),Mn("label",null,[this.reField,Ys(e,"regexp")]),Mn("label",null,[this.wordField,Ys(e,"by word")]),...e.state.readOnly?[]:[Mn("br"),this.replaceField,r("replace",()=>O7(e),[Ys(e,"replace")]),r("replaceAll",()=>EK(e),[Ys(e,"replace all")])],Mn("button",{name:"close",onclick:()=>c_(e),"aria-label":Ys(e,"close"),type:"button"},["×"])])}commit(){let e=new s_({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:Tf.of(e)}))}keydown(e){LW(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ig:Lg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),O7(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Tf)&&!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(Md).top}}function Ys(t,e){return t.state.phrase(e)}const vp=30,yp=/[\s\.,:;?!]/;function Kw(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-vp),l=Math.min(s,n+vp),c=t.state.sliceDoc(i,l);if(i!=r.from){for(let d=0;dc.length-vp;d--)if(!yp.test(c[d-1])&&yp.test(c[d])){c=c.slice(0,d);break}}return qe.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${r.number}.`)}const RK=qe.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"}}),zK=[lo,No.low(TK),RK];class u_{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=zr(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(h_(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 j7(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 PK(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:PK(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function BK(t,e){return n=>{for(let r=zr(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 N7=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function gc(t){return t.selection.main.from}function h_(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 Zw=ka.define();function LK(t,e,n,r){let{main:s}=t.selection,i=n-s.from,l=r-s.from;return{...t.changeByRange(c=>{if(c!=s&&n!=r&&t.sliceDoc(c.from+i,c.from+l)!=t.sliceDoc(n,r))return{range:c};let d=t.toText(e);return{changes:{from:c.from+i,to:r==s.from?c.to:c.from+l,insert:d},range:Ce.cursor(c.from+i+d.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const C7=new WeakMap;function IK(t){if(!Array.isArray(t))return t;let e=C7.get(t);return e||C7.set(t,e=d_(t)),e}const qg=vt.define(),Af=vt.define();class qK{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(E=yw(D))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!T||R==1&&O||_==0&&R!=0)&&(n[p]==D||r[p]==D&&(x=!0)?l[p++]=T:l.length&&(j=!1)),_=R,T+=oa(D)}return p==d&&l[0]==0&&j?this.result(-100+(x?-200:0),l,e):v==d&&b==0?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==d?this.ret(-900-e.length,[b,k]):p==d?this.result(-100+(x?-200:0)+-700+(j?0:-1100),l,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 l of n){let c=l+(this.astral?oa(As(r,l)):1);i&&s[i-1]==l?s[i-1]=c:(s[i++]=l,s[i++]=c)}return this.ret(e-r.length,s)}}class FK{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:QK,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=>T7(e(r),n(r)),optionClass:(e,n)=>r=>T7(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function T7(t,e){return t?e?t+" "+e:t:e}function QK(t,e,n,r,s,i){let l=t.textDirection==Hn.RTL,c=l,d=!1,h="top",m,p,x=e.left-s.left,v=s.right-e.right,b=r.right-r.left,k=r.bottom-r.top;if(c&&x=k||T>e.top?m=n.bottom-e.top:(h="bottom",m=e.bottom-n.top)}let O=(e.bottom-e.top)/i.offsetHeight,j=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${m/O}px; max-width: ${p/j}px`,class:"cm-completionInfo-"+(d?l?"left-narrow":"right-narrow":c?"left":"right")}}function $K(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 l=document.createElement("span");l.className="cm-completionLabel";let c=n.displayLabel||n.label,d=0;for(let h=0;hd&&l.appendChild(document.createTextNode(c.slice(d,m)));let x=l.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(c.slice(m,p))),x.className="cm-completionMatchedText",d=p}return dn.position-r.position).map(n=>n.render)}function Ky(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 HK{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:d=>this.placeInfo(d),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:l}=s.open,c=e.state.facet(Dr);this.optionContent=$K(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=Ky(i.length,l,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",d=>{let{options:h}=e.state.field(n).open;for(let m=d.target,p;m&&m!=this.dom;m=m.parentNode)if(m.nodeName=="LI"&&(p=/-(\d+)$/.exec(m.id))&&+p[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Dr).closeOnBlur&&d.relatedTarget!=e.contentDOM&&e.dispatch({effects:Af.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:l,disabled:c}=r.open;(!s.open||s.open.options!=i)&&(this.range=Ky(i.length,l,e.state.facet(Dr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),c!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Ky(n.options.length,n.selected,this.view.state.facet(Dr).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 l=typeof i=="string"?document.createTextNode(i):i(s);if(!l)return;"then"in l?l.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,s)}).catch(c=>_s(this.view.state,c,"completion info")):(this.addInfoPane(l,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&&VK(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 l=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{l.target==s&&l.preventDefault()});let i=null;for(let l=r.from;lr.from||r.from==0))if(i=x,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let v=s.appendChild(document.createElement("completion-section"));v.textContent=x}}const m=s.appendChild(document.createElement("li"));m.id=n+"-"+l,m.setAttribute("role","option");let p=this.optionClass(c);p&&(m.className=p);for(let x of this.optionContent){let v=x(c,this.view.state,this.view,d);v&&m.appendChild(v)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew HK(n,t,e)}function VK(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function A7(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function WK(t,e){let n=[],r=null,s=null,i=m=>{n.push(m);let{section:p}=m.completion;if(p){r||(r=[]);let x=typeof p=="string"?p:p.name;r.some(v=>v.name==x)||r.push(typeof p=="string"?{name:x}:p)}},l=e.facet(Dr);for(let m of t)if(m.hasResult()){let p=m.result.getMatch;if(m.result.filter===!1)for(let x of m.result.options)i(new N7(x,m.source,p?p(x):[],1e9-n.length));else{let x=e.sliceDoc(m.from,m.to),v,b=l.filterStrict?new FK(x):new qK(x);for(let k of m.result.options)if(v=b.match(k.label)){let O=k.displayLabel?p?p(k,v.matched):[]:v.matched,j=v.score+(k.boost||0);if(i(new N7(k,m.source,O,j)),typeof k.section=="object"&&k.section.rank==="dynamic"){let{name:T}=k.section;s||(s=Object.create(null)),s[T]=Math.max(j,s[T]||-1e9)}}}}if(r){let m=Object.create(null),p=0,x=(v,b)=>(v.rank==="dynamic"&&b.rank==="dynamic"?s[b.name]-s[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof b.rank=="number"?b.rank:1e9)||(v.namex.score-p.score||h(p.completion,x.completion))){let p=m.completion;!d||d.label!=p.label||d.detail!=p.detail||d.type!=null&&p.type!=null&&d.type!=p.type||d.apply!=p.apply||d.boost!=p.boost?c.push(m):A7(m.completion)>A7(d)&&(c[c.length-1]=m),d=m.completion}return c}class $u{constructor(e,n,r,s,i,l){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=l}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new $u(this.options,M7(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,l){if(s&&!l&&e.some(h=>h.isPending))return s.setDisabled();let c=WK(e,n);if(!c.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let d=n.facet(Dr).selectOnOpen?0:-1;if(s&&s.selected!=d&&s.selected!=-1){let h=s.options[s.selected].completion;for(let m=0;mm.hasResult()?Math.min(h,m.from):h,1e8),create:JK,above:i.aboveCursor},s?s.timestamp:Date.now(),d,!1)}map(e){return new $u(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new $u(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Fg{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Fg(KK,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Dr),i=(r.override||n.languageDataAt("autocomplete",gc(n)).map(IK)).map(d=>(this.active.find(m=>m.source==d)||new ki(d,this.active.some(m=>m.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((d,h)=>d==this.active[h])&&(i=this.active);let l=this.open,c=e.effects.some(d=>d.is(Jw));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||i.some(d=>d.hasResult()&&e.changes.touchesRange(d.from,d.to))||!GK(i,this.active)||c?l=$u.build(i,n,this.id,l,r,c):l&&l.disabled&&!i.some(d=>d.isPending)&&(l=null),!l&&i.every(d=>!d.isPending)&&i.some(d=>d.hasResult())&&(i=i.map(d=>d.hasResult()?new ki(d.source,0):d));for(let d of e.effects)d.is(m_)&&(l=l&&l.setSelected(d.value,this.id));return i==this.active&&l==this.open?this:new Fg(i,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?XK:YK}}function GK(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const KK=[];function f_(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Zw);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=f_(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(qg))s=new ki(s.source,1,i.value);else if(i.is(Af))s=new ki(s.source,0);else if(i.is(Jw))for(let l of i.value)l.source==s.source&&(s=l);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(gc(e.state))}}class Ku extends ki{constructor(e,n,r,s,i,l){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=l}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),l=e.changes.mapPos(this.to,1),c=gc(e.state);if(c>l||!s||n&2&&(gc(e.startState)==this.from||cn.map(e))}}),m_=vt.define(),Ms=Br.define({create(){return Fg.start()},update(t,e){return t.update(e)},provide:t=>[Dw.from(t,e=>e.tooltip),qe.contentAttributes.from(t,e=>e.attrs)]});function e5(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Ms).active.find(s=>s.source==e.source);return r instanceof Ku?(typeof n=="string"?t.dispatch({...LK(t.state,n,r.from,r.to),annotations:Zw.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const JK=UK(Ms,e5);function bp(t,e="option"){return n=>{let r=n.state.field(Ms,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:l-1;return c<0?c=e=="page"?0:l-1:c>=l&&(c=e=="page"?l-1:0),n.dispatch({effects:m_.of(c)}),!0}}const eZ=t=>{let e=t.state.field(Ms,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(Ms,!1)?(t.dispatch({effects:qg.of(!0)}),!0):!1,tZ=t=>{let e=t.state.field(Ms,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Af.of(null)}),!0)};class nZ{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const rZ=50,sZ=1e3,iZ=lr.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(Ms).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Ms),n=t.state.facet(Dr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Ms)==e)return;let r=t.transactions.some(i=>{let l=f_(i,n);return l&8||(i.selection||i.docChanged)&&!(l&3)});for(let i=0;irZ&&Date.now()-l.time>sZ){for(let c of l.context.abortListeners)try{c()}catch(d){_s(this.view.state,d)}l.context.abortListeners=null,this.running.splice(i--,1)}else l.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(l=>l.is(qg)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(l=>l.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(Ms);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(Dr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=gc(e),r=new u_(e,n,t.explicit,this.view),s=new nZ(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:Af.of(null)}),_s(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(Dr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Dr),r=this.view.state.field(Ms);for(let s=0;sc.source==i.active.source);if(l&&l.isPending)if(i.done==null){let c=new ki(i.active.source,0);for(let d of i.updates)c=c.update(d,n);c.isPending||e.push(c)}else this.startQuery(l)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Jw.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Ms,!1);if(e&&e.tooltip&&this.view.state.facet(Dr).closeOnBlur){let n=e.open&&QM(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Af.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:qg.of(!1)}),20),this.composing=0}}}),aZ=typeof navigator=="object"&&/Win/.test(navigator.platform),lZ=No.highest(qe.domEventHandlers({keydown(t,e){let n=e.state.field(Ms,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(aZ&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(l=>l.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&e5(e,r),!1}})),p_=qe.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 oZ{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class t5{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ur.TrackDel),r=e.mapPos(this.to,1,Ur.TrackDel);return n==null||r==null?null:new t5(this.field,n,r)}}class n5{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),l=/^\s*/.exec(i.text)[0];for(let d of this.lines){if(r.length){let h=l,m=/^\t*/.exec(d)[0].length;for(let p=0;pnew t5(d.field,s[d.line]+d.from,s[d.line]+d.to));return{text:r,ranges:c}}static parse(e){let n=[],r=[],s=[],i;for(let l of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let c=i[1]?+i[1]:null,d=i[2]||i[3]||"",h=-1,m=d.replace(/\\[{}]/g,p=>p[1]);for(let p=0;p=h&&x.field++}for(let p of s)if(p.line==r.length&&p.from>i.index){let x=i[2]?3+(i[1]||"").length:2;p.from-=x,p.to-=x}s.push(new oZ(h,r.length,i.index,i.index+m.length)),l=l.slice(0,i.index)+d+l.slice(i.index+i[0].length)}l=l.replace(/\\([{}])/g,(c,d,h)=>{for(let m of s)m.line==r.length&&m.from>h&&(m.from--,m.to--);return d}),r.push(l)}return new n5(r,s)}}let cZ=Je.widget({widget:new class extends ja{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),uZ=Je.mark({class:"cm-snippetField"});class Ed{constructor(e,n){this.ranges=e,this.active=n,this.deco=Je.set(e.map(r=>(r.from==r.to?cZ:uZ).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 Ed(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 p0=vt.define({map(t,e){return t&&t.map(e)}}),dZ=vt.define(),Mf=Br.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(p0))return n.value;if(n.is(dZ)&&t)return new Ed(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=>qe.decorations.from(t,e=>e?e.deco:Je.none)});function r5(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function hZ(t){let e=n5.parse(t);return(n,r,s,i)=>{let{text:l,ranges:c}=e.instantiate(n.state,s),{main:d}=n.state.selection,h={changes:{from:s,to:i==d.from?d.to:i,insert:Xt.of(l)},scrollIntoView:!0,annotations:r?[Zw.of(r),gr.userEvent.of("input.complete")]:void 0};if(c.length&&(h.selection=r5(c,0)),c.some(m=>m.field>0)){let m=new Ed(c,0),p=h.effects=[p0.of(m)];n.state.field(Mf,!1)===void 0&&p.push(vt.appendConfig.of([Mf,xZ,vZ,p_]))}n.dispatch(n.state.update(h))}}function g_(t){return({state:e,dispatch:n})=>{let r=e.field(Mf,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(l=>l.field==s+t);return n(e.update({selection:r5(r.ranges,s),effects:p0.of(i?null:new Ed(r.ranges,s)),scrollIntoView:!0})),!0}}const fZ=({state:t,dispatch:e})=>t.field(Mf,!1)?(e(t.update({effects:p0.of(null)})),!0):!1,mZ=g_(1),pZ=g_(-1),gZ=[{key:"Tab",run:mZ,shift:pZ},{key:"Escape",run:fZ}],E7=He.define({combine(t){return t.length?t[0]:gZ}}),xZ=No.highest(o0.compute([E7],t=>t.facet(E7)));function Ya(t,e){return{...e,apply:hZ(t)}}const vZ=qe.domEventHandlers({mousedown(t,e){let n=e.state.field(Mf,!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:r5(n.ranges,s.field),effects:p0.of(n.ranges.some(i=>i.field>s.field)?new Ed(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Ef={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},cc=vt.define({map(t,e){let n=e.mapPos(t,-1,Ur.TrackAfter);return n??void 0}}),s5=new class extends yc{};s5.startSide=1;s5.endSide=-1;const x_=Br.define({create(){return Yt.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(cc)&&(t=t.update({add:[s5.range(n.value,n.value+1)]}));return t}});function yZ(){return[wZ,x_]}const Jy="()[]{}<>«»»«[]{}";function v_(t){for(let e=0;e{if((bZ?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&oa(As(r,0))==1||e!=s.from||n!=s.to)return!1;let i=OZ(t.state,r);return i?(t.dispatch(i),!0):!1}),SZ=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=y_(t,t.selection.main.head).brackets||Ef.brackets,s=null,i=t.changeByRange(l=>{if(l.empty){let c=jZ(t.doc,l.head);for(let d of r)if(d==c&&Dx(t.doc,l.head)==v_(As(d,0)))return{changes:{from:l.head-d.length,to:l.head+d.length},range:Ce.cursor(l.head-d.length)}}return{range:s=l}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},kZ=[{key:"Backspace",run:SZ}];function OZ(t,e){let n=y_(t,t.selection.main.head),r=n.brackets||Ef.brackets;for(let s of r){let i=v_(As(s,0));if(e==s)return i==s?TZ(t,s,r.indexOf(s+s+s)>-1,n):NZ(t,s,i,n.before||Ef.before);if(e==i&&b_(t,t.selection.main.from))return CZ(t,s,i)}return null}function b_(t,e){let n=!1;return t.field(x_).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Dx(t,e){let n=t.sliceString(e,e+2);return n.slice(0,oa(As(n,0)))}function jZ(t,e){let n=t.sliceString(e-2,e);return oa(As(n,0))==n.length?n:n.slice(1)}function NZ(t,e,n,r){let s=null,i=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:n,from:l.to}],effects:cc.of(l.to+e.length),range:Ce.range(l.anchor+e.length,l.head+e.length)};let c=Dx(t.doc,l.head);return!c||/\s/.test(c)||r.indexOf(c)>-1?{changes:{insert:e+n,from:l.head},effects:cc.of(l.head+e.length),range:Ce.cursor(l.head+e.length)}:{range:s=l}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function CZ(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&Dx(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function TZ(t,e,n,r){let s=r.stringPrefixes||Ef.stringPrefixes,i=null,l=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:cc.of(c.to+e.length),range:Ce.range(c.anchor+e.length,c.head+e.length)};let d=c.head,h=Dx(t.doc,d),m;if(h==e){if(_7(t,d))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(b_(t,d)){let x=n&&t.sliceDoc(d,d+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:d,to:d+x.length,insert:x},range:Ce.cursor(d+x.length)}}}else{if(n&&t.sliceDoc(d-2*e.length,d)==e+e&&(m=D7(t,d-2*e.length,s))>-1&&_7(t,m))return{changes:{insert:e+e+e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(t.charCategorizer(d)(h)!=Vn.Word&&D7(t,d,s)>-1&&!AZ(t,d,e,s))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)}}return{range:i=c}});return i?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function _7(t,e){let n=zr(t).resolveInner(e+1);return n.parent&&n.from==e}function AZ(t,e,n,r){let s=zr(t).resolveInner(e,-1),i=r.reduce((l,c)=>Math.max(l,c.length),0);for(let l=0;l<5;l++){let c=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),d=c.indexOf(n);if(!d||d>-1&&r.indexOf(c.slice(0,d))>-1){let m=s.firstChild;for(;m&&m.from==s.from&&m.to-m.from>n.length+d;){if(t.sliceDoc(m.to-n.length,m.to)==n)return!1;m=m.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function D7(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Vn.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))!=Vn.Word)return i}return-1}function MZ(t={}){return[lZ,Ms,Dr.of(t),iZ,EZ,p_]}const w_=[{key:"Ctrl-Space",run:Zy},{mac:"Alt-`",run:Zy},{mac:"Alt-i",run:Zy},{key:"Escape",run:tZ},{key:"ArrowDown",run:bp(!0)},{key:"ArrowUp",run:bp(!1)},{key:"PageDown",run:bp(!0,"page")},{key:"PageUp",run:bp(!1,"page")},{key:"Enter",run:eZ}],EZ=No.highest(o0.computeN([Dr],t=>t.facet(Dr).defaultKeymap?[w_]:[]));class R7{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class ic{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(_f).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((v,b)=>v.from-b.from||v.to-b.to),l=new ml,c=[],d=0,h=r.doc.iter(),m=0,p=r.doc.length;for(let v=0;;){let b=v==i.length?null:i[v];if(!b&&!c.length)break;let k,O;if(c.length)k=d,O=c.reduce((A,_)=>Math.min(A,_.to),b&&b.from>k?b.from:1e8);else{if(k=b.from,k>p)break;O=b.to,c.push(b),v++}for(;vA.from||A.to==k))c.push(A),v++,O=Math.min(A.to,O);else{O=Math.min(A.from,O);break}}O=Math.min(O,p);let j=!1;if(c.some(A=>A.from==k&&(A.to==O||O==p))&&(j=k==O,!j&&O-k<10)){let A=k-(m+h.value.length);A>0&&(h.next(A),m=k);for(let _=k;;){if(_>=O){j=!0;break}if(!h.lineBreak&&m+h.value.length>_)break;_=m+h.value.length,m+=h.value.length,h.next()}}let T=HZ(c);if(j)l.add(k,k,Je.widget({widget:new qZ(T),diagnostics:c.slice()}));else{let A=c.reduce((_,D)=>D.markClass?_+" "+D.markClass:_,"");l.add(k,O,Je.mark({class:"cm-lintRange cm-lintRange-"+T+A,diagnostics:c.slice(),inclusiveEnd:c.some(_=>_.to>O)}))}if(d=O,d==p)break;for(let A=0;A{if(!(e&&l.diagnostics.indexOf(e)<0))if(!r)r=new R7(s,i,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new R7(r.from,i,r.diagnostic)}}),r}function _Z(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(_f).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(l=>l.is(S_))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function DZ(t,e){return t.field(ri,!1)?e:e.concat(vt.appendConfig.of(UZ))}const S_=vt.define(),i5=vt.define(),k_=vt.define(),ri=Br.define({create(){return new ic(Je.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=xd(n,t.selected.diagnostic,i)||xd(n,null,i)}!n.size&&s&&e.state.facet(_f).autoPanel&&(s=null),t=new ic(n,s,r)}for(let n of e.effects)if(n.is(S_)){let r=e.state.facet(_f).autoPanel?n.value.length?Df.open:null:t.panel;t=ic.init(n.value,r,e.state)}else n.is(i5)?t=new ic(t.diagnostics,n.value?Df.open:null,t.selected):n.is(k_)&&(t=new ic(t.diagnostics,t.panel,n.value));return t},provide:t=>[Sf.from(t,e=>e.panel),qe.decorations.from(t,e=>e.diagnostics)]}),RZ=Je.mark({class:"cm-lintRange cm-lintRange-active"});function zZ(t,e,n){let{diagnostics:r}=t.state.field(ri),s,i=-1,l=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(d,h,{spec:m})=>{if(e>=d&&e<=h&&(d==h||(e>d||n>0)&&(ej_(t,n,!1)))}const BZ=t=>{let e=t.state.field(ri,!1);(!e||!e.panel)&&t.dispatch({effects:DZ(t.state,[i5.of(!0)])});let n=wf(t,Df.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},z7=t=>{let e=t.state.field(ri,!1);return!e||!e.panel?!1:(t.dispatch({effects:i5.of(!1)}),!0)},LZ=t=>{let e=t.state.field(ri,!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)},IZ=[{key:"Mod-Shift-m",run:BZ,preventDefault:!0},{key:"F8",run:LZ}],_f=He.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Oa(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:P7,tooltipFilter:P7,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 P7(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function O_(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function j_(t,e,n){var r;let s=n?O_(e.actions):[];return Mn("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Mn("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,l)=>{let c=!1,d=v=>{if(v.preventDefault(),c)return;c=!0;let b=xd(t.state.field(ri).diagnostics,e);b&&i.apply(t,b.from,b.to)},{name:h}=i,m=s[l]?h.indexOf(s[l]):-1,p=m<0?h:[h.slice(0,m),Mn("u",h.slice(m,m+1)),h.slice(m+1)],x=i.markClass?" "+i.markClass:"";return Mn("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:d,onmousedown:d,"aria-label":` Action: ${h}${m<0?"":` (access key "${s[l]})"`}.`},p)}),e.source&&Mn("div",{class:"cm-diagnosticSource"},e.source))}class qZ extends ja{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Mn("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class B7{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=j_(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Df{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)z7(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],l=O_(i.actions);for(let c=0;c{for(let i=0;iz7(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ri).selected;if(!e)return-1;for(let n=0;n{for(let m of h.diagnostics){if(l.has(m))continue;l.add(m);let p=-1,x;for(let v=r;vr&&(this.items.splice(r,p-r),s=!0)),n&&x.diagnostic==n.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),i=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:d})=>{let h=d.height/this.list.offsetHeight;c.topd.bottom&&(this.list.scrollTop+=(c.bottom-d.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(ri),r=xd(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:k_.of(r)})}static open(e){return new Df(e)}}function FZ(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function wp(t){return FZ(``,'width="6" height="3"')}const QZ=qe.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:wp("#d11")},".cm-lintRange-warning":{backgroundImage:wp("orange")},".cm-lintRange-info":{backgroundImage:wp("#999")},".cm-lintRange-hint":{backgroundImage:wp("#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 $Z(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function HZ(t){let e="hint",n=1;for(let r of t){let s=$Z(r.severity);s>n&&(n=s,e=r.severity)}return e}const UZ=[ri,qe.decorations.compute([ri],t=>{let{selected:e,panel:n}=t.field(ri);return!e||!n||e.from==e.to?Je.none:Je.set([RZ.range(e.from,e.to)])}),NG(zZ,{hideOn:_Z}),QZ];var L7=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(kZ)),e.defaultKeymap!==!1&&(r=r.concat(aK)),e.searchKeymap!==!1&&(r=r.concat(_K)),e.historyKeymap!==!1&&(r=r.concat(fY)),e.foldKeymap!==!1&&(r=r.concat(kX)),e.completionKeymap!==!1&&(r=r.concat(w_)),e.lintKeymap!==!1&&(r=r.concat(IZ));var s=[];return e.lineNumbers!==!1&&s.push(BG()),e.highlightActiveLineGutter!==!1&&s.push(qG()),e.highlightSpecialChars!==!1&&s.push(tG()),e.history!==!1&&s.push(sY()),e.foldGutter!==!1&&s.push(CX()),e.drawSelection!==!1&&s.push(HW()),e.dropCursor!==!1&&s.push(XW()),e.allowMultipleSelections!==!1&&s.push(Vt.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(mX()),e.syntaxHighlighting!==!1&&s.push(hE(EX,{fallback:!0})),e.bracketMatching!==!1&&s.push(LX()),e.closeBrackets!==!1&&s.push(yZ()),e.autocompletion!==!1&&s.push(MZ()),e.rectangularSelection!==!1&&s.push(pG()),n!==!1&&s.push(vG()),e.highlightActiveLine!==!1&&s.push(lG()),e.highlightSelectionMatches!==!1&&s.push(fK()),e.tabSize&&typeof e.tabSize=="number"&&s.push(u0.of(" ".repeat(e.tabSize))),s.concat([o0.of(r.flat())]).filter(Boolean)};const VZ="#e5c07b",I7="#e06c75",WZ="#56b6c2",GZ="#ffffff",sg="#abb2bf",o4="#7d8799",XZ="#61afef",YZ="#98c379",q7="#d19a66",KZ="#c678dd",ZZ="#21252b",F7="#2c313a",Q7="#282c34",eb="#353a42",JZ="#3E4451",$7="#528bff",eJ=qe.theme({"&":{color:sg,backgroundColor:Q7},".cm-content":{caretColor:$7},".cm-cursor, .cm-dropCursor":{borderLeftColor:$7},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:JZ},".cm-panels":{backgroundColor:ZZ,color:sg},".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:Q7,color:o4,border:"none"},".cm-activeLineGutter":{backgroundColor:F7},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:eb},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:eb,borderBottomColor:eb},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:F7,color:sg}}},{dark:!0}),tJ=h0.define([{tag:he.keyword,color:KZ},{tag:[he.name,he.deleted,he.character,he.propertyName,he.macroName],color:I7},{tag:[he.function(he.variableName),he.labelName],color:XZ},{tag:[he.color,he.constant(he.name),he.standard(he.name)],color:q7},{tag:[he.definition(he.name),he.separator],color:sg},{tag:[he.typeName,he.className,he.number,he.changed,he.annotation,he.modifier,he.self,he.namespace],color:VZ},{tag:[he.operator,he.operatorKeyword,he.url,he.escape,he.regexp,he.link,he.special(he.string)],color:WZ},{tag:[he.meta,he.comment],color:o4},{tag:he.strong,fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.link,color:o4,textDecoration:"underline"},{tag:he.heading,fontWeight:"bold",color:I7},{tag:[he.atom,he.bool,he.special(he.variableName)],color:q7},{tag:[he.processingInstruction,he.string,he.inserted],color:YZ},{tag:he.invalid,color:GZ}]),N_=[eJ,hE(tJ)];var nJ=qe.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),rJ=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:l="",basicSetup:c=!0}=e,d=[];switch(n&&d.unshift(o0.of([lK])),c&&(typeof c=="boolean"?d.unshift(L7()):d.unshift(L7(c))),l&&d.unshift(dG(l)),i){case"light":d.push(nJ);break;case"dark":d.push(N_);break;case"none":break;default:d.push(i);break}return r===!1&&d.push(qe.editable.of(!1)),s&&d.push(Vt.readOnly.of(!0)),[...d]},sJ=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 iJ{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 H7{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 tb=null,aJ=()=>typeof window>"u"?new H7:(tb||(tb=new H7),tb),U7=ka.define(),lJ=200,oJ=[];function cJ(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:l,extensions:c=oJ,autoFocus:d,theme:h="light",height:m=null,minHeight:p=null,maxHeight:x=null,width:v=null,minWidth:b=null,maxWidth:k=null,placeholder:O="",editable:j=!0,readOnly:T=!1,indentWithTab:A=!0,basicSetup:_=!0,root:D,initialState:E}=t,[R,Q]=S.useState(),[F,L]=S.useState(),[U,V]=S.useState(),de=S.useState(()=>({current:null}))[0],W=S.useState(()=>({current:null}))[0],J=qe.theme({"&":{height:m,minHeight:p,maxHeight:x,width:v,minWidth:b,maxWidth:k},"& .cm-scroller":{height:"100% !important"}}),$=qe.updateListener.of(ce=>{if(ce.docChanged&&typeof r=="function"&&!ce.transactions.some(Y=>Y.annotation(U7))){de.current?de.current.reset():(de.current=new iJ(()=>{if(W.current){var Y=W.current;W.current=null,Y()}de.current=null},lJ),aJ().add(de.current));var z=ce.state.doc,xe=z.toString();r(xe,ce)}s&&s(sJ(ce))}),ae=rJ({theme:h,editable:j,readOnly:T,placeholder:O,indentWithTab:A,basicSetup:_}),ne=[$,J,...ae];return l&&typeof l=="function"&&ne.push(qe.updateListener.of(l)),ne=ne.concat(c),S.useLayoutEffect(()=>{if(R&&!U){var ce={doc:e,selection:n,extensions:ne},z=E?Vt.fromJSON(E.json,ce,E.fields):Vt.create(ce);if(V(z),!F){var xe=new qe({state:z,parent:R,root:D});L(xe),i&&i(xe,z)}}return()=>{F&&(V(void 0),L(void 0))}},[R,U]),S.useEffect(()=>{t.container&&Q(t.container)},[t.container]),S.useEffect(()=>()=>{F&&(F.destroy(),L(void 0)),de.current&&(de.current.cancel(),de.current=null)},[F]),S.useEffect(()=>{d&&F&&F.focus()},[d,F]),S.useEffect(()=>{F&&F.dispatch({effects:vt.reconfigure.of(ne)})},[h,c,m,p,x,v,b,k,O,j,T,A,_,r,l]),S.useEffect(()=>{if(e!==void 0){var ce=F?F.state.doc.toString():"";if(F&&e!==ce){var z=de.current&&!de.current.isDone,xe=()=>{F&&e!==F.state.doc.toString()&&F.dispatch({changes:{from:0,to:F.state.doc.toString().length,insert:e||""},annotations:[U7.of(!0)]})};z?W.current=xe:xe()}}},[e,F]),{state:U,setState:V,view:F,setView:L,container:R,setContainer:Q}}var uJ=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],C_=S.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,autoFocus:m,theme:p="light",height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,root:R,initialState:Q}=t,F=VI(t,uJ),L=S.useRef(null),{state:U,view:V,container:de,setContainer:W}=cJ({root:R,value:r,autoFocus:m,theme:p,height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,selection:s,onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,extensions:i,initialState:Q});S.useImperativeHandle(e,()=>({editor:L.current,state:U,view:V}),[L,de,U,V]);var J=S.useCallback(ae=>{L.current=ae,W(ae)},[W]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var $=typeof p=="string"?"cm-theme-"+p:"cm-theme";return a.jsx("div",WI({ref:J,className:""+$+(n?" "+n:"")},F))});C_.displayName="CodeMirror";var V7={};class Qg{constructor(e,n,r,s,i,l,c,d,h,m=0,p){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=l,this.buffer=c,this.bufferBase=d,this.curContext=h,this.lookAhead=m,this.parent=p}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 Qg(e,[],n,r,r,0,[],0,s?new W7(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,l=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSized;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&l.buffer[c-4]==0&&l.buffer[c-1]>-1){if(n==r)return;if(l.buffer[c-2]>=n){l.buffer[c-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let l=this.buffer.length;if(l>0&&(this.buffer[l-4]!=0||this.buffer[l-1]<0)){let c=!1;for(let d=l;d>0&&this.buffer[d-2]>r;d-=4)if(this.buffer[d-1]>=0){c=!0;break}if(c)for(;l>0&&this.buffer[l-2]>r;)this.buffer[l]=this.buffer[l-4],this.buffer[l+1]=this.buffer[l-3],this.buffer[l+2]=this.buffer[l-2],this.buffer[l+3]=this.buffer[l-1],l-=4,s>4&&(s-=4)}this.buffer[l]=e,this.buffer[l+1]=n,this.buffer[l+2]=r,this.buffer[l+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:l}=this.p;(s>this.pos||n<=l.maxNode)&&(this.pos=s,l.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=l.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 Qg(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 dJ(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,l;id&1&&c==l)||s.push(n[i],l)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let l=this.findForcedReduction();if(l==null)return!1;n=l}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,l=>{if(!(l&393216))if(l&65536){let c=(l>>19)-i;if(c>1){let d=l&65535,h=this.stack.length-c*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return c<<19|65536|d}}else{let c=r(l,i+1);if(c!=null)return c}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class W7{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class dJ{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 $g{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 $g(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 $g(this.stack,this.pos,this.index)}}function Sp(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&l--,l>=34&&l--;let d=l-32;if(d>=46&&(d-=46,c=!0),i+=d,c)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class ig{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const G7=new ig;class hJ{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=G7,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let l=this.ranges[++s];i+=l.from-r.to,r=l}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&rc.to&&(this.chunk2=this.chunk2.slice(0,c.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=G7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class Zu{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;fJ(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Zu.prototype.contextual=Zu.prototype.fallback=Zu.prototype.extend=!1;Zu.prototype.fallback=Zu.prototype.extend=!1;class Rx{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function fJ(t,e,n,r,s,i){let l=0,c=1<0){let b=t[v];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||mJ(b,e.token.value,s,i))){e.acceptToken(b);break}}let m=e.next,p=0,x=t[l+2];if(e.next<0&&x>p&&t[h+x*3-3]==65535){l=t[h+x*3-1];continue e}for(;p>1,b=h+v+(v<<1),k=t[b],O=t[b+1]||65536;if(m=O)p=v+1;else{l=t[b+2],e.advance();continue e}}break}}function X7(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function mJ(t,e,n,r){let s=X7(n,r,e);return s<0||X7(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class pJ{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?Y7(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Y7(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=l,null;if(i instanceof Dn){if(l==e){if(l=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(l),this.index.push(0))}else this.index[n]++,this.nextStart=l+i.length}}}class gJ{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new ig)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,l=s.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,d=0;for(let h=0;hp.end+25&&(d=Math.max(p.lookAhead,d)),p.value!=0)){let x=n;if(p.extended>-1&&(n=this.addActions(e,p.extended,p.end,n)),n=this.addActions(e,p.value,p.end,n),!m.extend&&(r=p,n>x))break}}for(;this.actions.length>n;)this.actions.pop();return d&&e.setLookAhead(d),!r&&e.pos==this.stream.end&&(r=new ig,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 ig,{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 l=0;l=0&&r.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new pJ(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[l]=e;for(;l.forceReduce()&&l.stack.length&&l.stack[l.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let l=0;ln)r.push(c);else{if(this.advanceStack(c,r,e))continue;{s||(s=[],i=[]),s.push(c);let d=this.tokens.getMainToken(c);i.push(d.value,d.end)}}break}}if(!r.length){let l=s&&bJ(s);if(l)return Ks&&console.log("Finish with "+this.stackID(l)),this.stackToTree(l);if(this.parser.strict)throw Ks&&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 l=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(l)return Ks&&console.log("Force-finish "+this.stackID(l)),this.stackToTree(l.forceAll())}if(this.recovering){let l=this.recovering==1?1:this.recovering*3;if(r.length>l)for(r.sort((c,d)=>d.score-c.score);r.length>l;)r.pop();r.some(c=>c.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let l=0;l500&&h.buffer.length>500)if((c.score-h.score||c.buffer.length-h.buffer.length)>0)r.splice(d--,1);else{r.splice(l--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let l=1;l ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,m=h?e.curContext.hash:0;for(let p=this.fragments.nodeAt(s);p;){let x=this.parser.nodeSet.types[p.type.id]==p.type?i.getGoto(e.state,p.type.id):-1;if(x>-1&&p.length&&(!h||(p.prop(Et.contextHash)||0)==m))return e.useNode(p,x),Ks&&console.log(l+this.stackID(e)+` (via reuse of ${i.getName(p.type.id)})`),!0;if(!(p instanceof Dn)||p.children.length==0||p.positions[0]>0)break;let v=p.children[0];if(v instanceof Dn&&p.positions[0]==0)p=v;else break}}let c=i.stateSlot(e.state,4);if(c>0)return e.reduce(c),Ks&&console.log(l+this.stackID(e)+` (via always-reduce ${i.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;hs?n.push(b):r.push(b)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return K7(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let l=0;l ":"";if(c.deadEnd&&(i||(i=!0,c.restart(),Ks&&console.log(m+this.stackID(c)+" (restarted)"),this.advanceFully(c,r))))continue;let p=c.split(),x=m;for(let v=0;v<10&&p.forceReduce()&&(Ks&&console.log(x+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,r));v++)Ks&&(x=this.stackID(p)+" -> ");for(let v of c.recoverByInsert(d))Ks&&console.log(m+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,r);this.stream.end>c.pos?(h==c.pos&&(h++,d=0),c.recoverByDelete(d,h),Ks&&console.log(m+this.stackID(c)+` (via recover-delete ${this.parser.getName(d)})`),K7(c,r)):(!s||s.scoret;class yJ{constructor(e){this.start=e.start,this.shift=e.shift||rb,this.reduce=e.reduce||rb,this.reuse=e.reuse||rb,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rf extends Bw{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 c=0;ce.topRules[c][1]),s=[];for(let c=0;c=0)i(m,d,c[h++]);else{let p=c[h+-m];for(let x=-m;x>0;x--)i(c[h++],d,p);h++}}}this.nodeSet=new jx(n.map((c,d)=>gs.define({name:d>=this.minRepeatTerm?void 0:c,id:d,props:s[d],top:r.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=VM;let l=Sp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;ctypeof c=="number"?new Zu(l,c):c),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 xJ(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 l=s[i++],c=l&1,d=s[i++];if(c&&r)return d;for(let h=i+(l>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=rl(this.data,i+2);else break;s=n(rl(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=rl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,l)=>l&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(Rf.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(c=>c.from==r.external);if(!i)return r;let l=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=Z7(l),l})),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 l=n.indexOf(i);l>=0&&(r[l]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const wJ=1,T_=194,A_=195,SJ=196,J7=197,kJ=198,OJ=199,jJ=200,NJ=2,M_=3,e8=201,CJ=24,TJ=25,AJ=49,MJ=50,EJ=55,_J=56,DJ=57,RJ=59,zJ=60,PJ=61,BJ=62,LJ=63,IJ=65,qJ=238,FJ=71,QJ=241,$J=242,HJ=243,UJ=244,VJ=245,WJ=246,GJ=247,XJ=248,E_=72,YJ=249,KJ=250,ZJ=251,JJ=252,eee=253,tee=254,nee=255,ree=256,see=73,iee=77,aee=263,lee=112,oee=130,cee=151,uee=152,dee=155,jc=10,zf=13,a5=32,zx=9,l5=35,hee=40,fee=46,c4=123,t8=125,__=39,D_=34,n8=92,mee=111,pee=120,gee=78,xee=117,vee=85,yee=new Set([TJ,AJ,MJ,aee,IJ,oee,_J,DJ,qJ,BJ,LJ,E_,see,iee,zJ,PJ,cee,uee,dee,lee]);function sb(t){return t==jc||t==zf}function ib(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const bee=new Rx((t,e)=>{let n;if(t.next<0)t.acceptToken(OJ);else if(e.context.flags&ag)sb(t.next)&&t.acceptToken(kJ,1);else if(((n=t.peek(-1))<0||sb(n))&&e.canShift(J7)){let r=0;for(;t.next==a5||t.next==zx;)t.advance(),r++;(t.next==jc||t.next==zf||t.next==l5)&&t.acceptToken(J7,-r)}else sb(t.next)&&t.acceptToken(SJ,1)},{contextual:!0}),wee=new Rx((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==jc||r==zf){let s=0,i=0;for(;;){if(t.next==a5)s++;else if(t.next==zx)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=jc&&t.next!=zf&&t.next!=l5&&(s[t,e|R_])),Oee=new yJ({start:See,reduce(t,e,n,r){return t.flags&ag&&yee.has(e)||(e==FJ||e==E_)&&t.flags&R_?t.parent:t},shift(t,e,n,r){return e==T_?new lg(t,kee(r.read(r.pos,n.pos)),0):e==A_?t.parent:e==CJ||e==EJ||e==RJ||e==M_?new lg(t,0,ag):r8.has(e)?new lg(t,0,r8.get(e)|t.flags&ag):t},hash(t){return t.hash}}),jee=new Rx(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==a5||n==zx)){n!=hee&&n!=fee&&n!=jc&&n!=zf&&n!=l5&&t.acceptToken(wJ);return}}}),Nee=new Rx((t,e)=>{let{flags:n}=e.context,r=n&Ja?D_:__,s=(n&el)>0,i=!(n&tl),l=(n&nl)>0,c=t.pos;for(;!(t.next<0);)if(l&&t.next==c4)if(t.peek(1)==c4)t.advance(2);else{if(t.pos==c){t.acceptToken(M_,1);return}break}else if(i&&t.next==n8){if(t.pos==c){t.advance();let d=t.next;d>=0&&(t.advance(),Cee(t,d)),t.acceptToken(NJ);return}break}else if(t.next==n8&&!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==c){t.acceptToken(e8,s?3:1);return}break}else if(t.next==jc){if(s)t.advance();else if(t.pos==c){t.acceptToken(e8);return}break}else t.advance();t.pos>c&&t.acceptToken(jJ)});function Cee(t,e){if(e==mee)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==pee)for(let n=0;n<2&&ib(t.next);n++)t.advance();else if(e==xee)for(let n=0;n<4&&ib(t.next);n++)t.advance();else if(e==vee)for(let n=0;n<8&&ib(t.next);n++)t.advance();else if(e==gee&&t.next==c4){for(t.advance();t.next>=0&&t.next!=t8&&t.next!=__&&t.next!=D_&&t.next!=jc;)t.advance();t.next==t8&&t.advance()}}const Tee=Lw({'async "*" "**" FormatConversion FormatSpec':he.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":he.controlKeyword,"in not and or is del":he.operatorKeyword,"from def class global nonlocal lambda":he.definitionKeyword,import:he.moduleKeyword,"with as print":he.keyword,Boolean:he.bool,None:he.null,VariableName:he.variableName,"CallExpression/VariableName":he.function(he.variableName),"FunctionDefinition/VariableName":he.function(he.definition(he.variableName)),"ClassDefinition/VariableName":he.definition(he.className),PropertyName:he.propertyName,"CallExpression/MemberExpression/PropertyName":he.function(he.propertyName),Comment:he.lineComment,Number:he.number,String:he.string,FormatString:he.special(he.string),Escape:he.escape,UpdateOp:he.updateOperator,"ArithOp!":he.arithmeticOperator,BitOp:he.bitwiseOperator,CompareOp:he.compareOperator,AssignOp:he.definitionOperator,Ellipsis:he.punctuation,At:he.meta,"( )":he.paren,"[ ]":he.squareBracket,"{ }":he.brace,".":he.derefOperator,", ;":he.separator}),Aee={__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},Mee=Rf.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[jee,wee,bee,Nee,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Aee[t]||-1}],tokenPrec:7668}),s8=new WG,z_=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function kp(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const Eee={FunctionDefinition:kp("function"),ClassDefinition:kp("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 l=s.getChild("import");l;l=l.nextSibling)l.name=="VariableName"&&((r=l.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(l,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:kp("variable"),AsPattern:kp("variable"),__proto__:null};function P_(t,e){let n=s8.get(e);if(n)return n;let r=[],s=!0;function i(l,c){let d=t.sliceString(l.from,l.to);r.push({label:d,type:c})}return e.cursor(Or.IncludeAnonymous).iterate(l=>{if(l.name){let c=Eee[l.name];if(c&&c(l,i,s)||!s&&z_.has(l.name))return!1;s=!1}else if(l.to-l.from>8192){for(let c of P_(t,l.node))r.push(c);return!1}}),s8.set(e,r),r}const i8=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,B_=["String","FormatString","Comment","PropertyName"];function _ee(t){let e=zr(t.state).resolveInner(t.pos,-1);if(B_.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&i8.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)z_.has(s.name)&&(r=r.concat(P_(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:i8}}const Dee=["__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"}))),Ree=[Ya("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ya("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ya("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ya("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ya(`if \${}: +`: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 jK(this):new kK(this)}getCursor(e,n=0,r){let s=e.doc?e:Vt.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?zu(this,s,n,r):Ru(this,s,n,r)}}class i_{constructor(e){this.spec=e}}function Ru(t,e,n,r){return new gd(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?SK(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function SK(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Ru(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 zu(t,e,n,r){return new n_(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?OK(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Pg(t,e){return t.slice(Vr(t,e,!1),e)}function Bg(t,e){return t.slice(e,Vr(t,e))}function OK(t){return(e,n,r)=>!r[0].length||(t(Pg(r.input,r.index))!=Vn.Word||t(Bg(r.input,r.index))!=Vn.Word)&&(t(Bg(r.input,r.index+r[0].length))!=Vn.Word||t(Pg(r.input,r.index+r[0].length))!=Vn.Word)}class jK extends i_{nextMatch(e,n,r){let s=zu(this.spec,e,r,e.doc.length).next();return s.done&&(s=zu(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),l=zu(this.spec,e,i,r),c=null;for(;!l.next().done;)c=l.value;if(c&&(i==n||c.from>i+10))return c;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=zu(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 Tf=vt.define(),Xw=vt.define(),lo=Br.define({create(t){return new Yy(l4(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Tf)?t=new Yy(n.value.create(),t.panel):n.is(Xw)&&(t=new Yy(t.query,n.value?Yw:null));return t},provide:t=>Sf.from(t,e=>e.panel)});class Yy{constructor(e,n){this.query=e,this.panel=n}}const NK=Je.mark({class:"cm-searchMatch"}),CK=Je.mark({class:"cm-searchMatch cm-searchMatch-selected"}),TK=lr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(lo))}update(t){let e=t.state.field(lo);(e!=t.startState.field(lo)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Je.none;let{view:n}=this,r=new ml;for(let s=0,i=n.visibleRanges,l=i.length;si[s+1].from-500;)d=i[++s].to;t.highlight(n.state,c,d,(h,m)=>{let p=n.state.selection.ranges.some(x=>x.from==h&&x.to==m);r.add(h,m,p?CK:NK)})}return r.finish()}},{decorations:t=>t.decorations});function m0(t){return e=>{let n=e.state.field(lo,!1);return n&&n.query.spec.valid?t(e,n):o_(e)}}const Lg=m0((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ce.single(r.from,r.to),i=t.state.facet(Md);return t.dispatch({selection:s,effects:[Kw(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),l_(t),!0}),Ig=m0((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ce.single(s.from,s.to),l=t.state.facet(Md);return t.dispatch({selection:i,effects:[Kw(t,s),l.scrollToMatch(i.main,t)],userEvent:"select.search"}),l_(t),!0}),AK=m0((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ce.create(n.map(r=>Ce.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),MK=({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=[],l=0;for(let c=new gd(t.doc,t.sliceDoc(r,s));!c.next().done;){if(i.length>1e3)return!1;c.value.from==r&&(l=i.length),i.push(Ce.range(c.value.from,c.value.to))}return e(t.update({selection:Ce.create(i,l),userEvent:"select.search.matches"})),!0},O7=m0((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 l=i,c=[],d,h,m=[];l.from==r&&l.to==s&&(h=n.toText(e.getReplacement(l)),c.push({from:l.from,to:l.to,insert:h}),l=e.nextMatch(n,l.from,l.to),m.push(qe.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let p=t.state.changes(c);return l&&(d=Ce.single(l.from,l.to).map(p),m.push(Kw(t,l)),m.push(n.facet(Md).scrollToMatch(d.main,t))),t.dispatch({changes:p,selection:d,effects:m,userEvent:"input.replace"}),!0}),EK=m0((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:l}=s;return{from:i,to:l,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:qe.announce.of(r),userEvent:"input.replace.all"}),!0});function Yw(t){return t.state.facet(Md).createPanel(t)}function l4(t,e){var n,r,s,i,l;let c=t.selection.main,d=c.empty||c.to>c.from+100?"":t.sliceDoc(c.from,c.to);if(e&&!d)return e;let h=t.facet(Md);return new s_({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?d:d.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:(l=e?.wholeWord)!==null&&l!==void 0?l:h.wholeWord})}function a_(t){let e=wf(t,Yw);return e&&e.dom.querySelector("[main-field]")}function l_(t){let e=a_(t);e&&e==t.root.activeElement&&e.select()}const o_=t=>{let e=t.state.field(lo,!1);if(e&&e.panel){let n=a_(t);if(n&&n!=t.root.activeElement){let r=l4(t.state,e.query.spec);r.valid&&t.dispatch({effects:Tf.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Xw.of(!0),e?Tf.of(l4(t.state,e.query.spec)):vt.appendConfig.of(zK)]});return!0},c_=t=>{let e=t.state.field(lo,!1);if(!e||!e.panel)return!1;let n=wf(t,Yw);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Xw.of(!1)}),!0},_K=[{key:"Mod-f",run:o_,scope:"editor search-panel"},{key:"F3",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Lg,shift:Ig,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:c_,scope:"editor search-panel"},{key:"Mod-Shift-l",run:MK},{key:"Mod-Alt-g",run:cK},{key:"Mod-d",run:wK,preventDefault:!0}];class DK{constructor(e){this.view=e;let n=this.query=e.state.field(lo).query.spec;this.commit=this.commit.bind(this),this.searchField=Mn("input",{value:n.search,placeholder:Ys(e,"Find"),"aria-label":Ys(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mn("input",{value:n.replace,placeholder:Ys(e,"Replace"),"aria-label":Ys(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mn("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Mn("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Mn("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,l){return Mn("button",{class:"cm-button",name:s,onclick:i,type:"button"},l)}this.dom=Mn("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Lg(e),[Ys(e,"next")]),r("prev",()=>Ig(e),[Ys(e,"previous")]),r("select",()=>AK(e),[Ys(e,"all")]),Mn("label",null,[this.caseField,Ys(e,"match case")]),Mn("label",null,[this.reField,Ys(e,"regexp")]),Mn("label",null,[this.wordField,Ys(e,"by word")]),...e.state.readOnly?[]:[Mn("br"),this.replaceField,r("replace",()=>O7(e),[Ys(e,"replace")]),r("replaceAll",()=>EK(e),[Ys(e,"replace all")])],Mn("button",{name:"close",onclick:()=>c_(e),"aria-label":Ys(e,"close"),type:"button"},["×"])])}commit(){let e=new s_({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:Tf.of(e)}))}keydown(e){LW(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ig:Lg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),O7(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Tf)&&!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(Md).top}}function Ys(t,e){return t.state.phrase(e)}const vp=30,yp=/[\s\.,:;?!]/;function Kw(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-vp),l=Math.min(s,n+vp),c=t.state.sliceDoc(i,l);if(i!=r.from){for(let d=0;dc.length-vp;d--)if(!yp.test(c[d-1])&&yp.test(c[d])){c=c.slice(0,d);break}}return qe.announce.of(`${t.state.phrase("current match")}. ${c} ${t.state.phrase("on line")} ${r.number}.`)}const RK=qe.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"}}),zK=[lo,No.low(TK),RK];class u_{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=zr(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(h_(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 j7(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 PK(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:PK(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function BK(t,e){return n=>{for(let r=zr(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 N7=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function gc(t){return t.selection.main.from}function h_(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 Zw=ka.define();function LK(t,e,n,r){let{main:s}=t.selection,i=n-s.from,l=r-s.from;return{...t.changeByRange(c=>{if(c!=s&&n!=r&&t.sliceDoc(c.from+i,c.from+l)!=t.sliceDoc(n,r))return{range:c};let d=t.toText(e);return{changes:{from:c.from+i,to:r==s.from?c.to:c.from+l,insert:d},range:Ce.cursor(c.from+i+d.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const C7=new WeakMap;function IK(t){if(!Array.isArray(t))return t;let e=C7.get(t);return e||C7.set(t,e=d_(t)),e}const qg=vt.define(),Af=vt.define();class qK{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(E=yw(D))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!T||z==1&&O||_==0&&z!=0)&&(n[p]==D||r[p]==D&&(x=!0)?l[p++]=T:l.length&&(j=!1)),_=z,T+=oa(D)}return p==d&&l[0]==0&&j?this.result(-100+(x?-200:0),l,e):v==d&&b==0?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==d?this.ret(-900-e.length,[b,k]):p==d?this.result(-100+(x?-200:0)+-700+(j?0:-1100),l,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 l of n){let c=l+(this.astral?oa(As(r,l)):1);i&&s[i-1]==l?s[i-1]=c:(s[i++]=l,s[i++]=c)}return this.ret(e-r.length,s)}}class FK{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:QK,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=>T7(e(r),n(r)),optionClass:(e,n)=>r=>T7(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function T7(t,e){return t?e?t+" "+e:t:e}function QK(t,e,n,r,s,i){let l=t.textDirection==Hn.RTL,c=l,d=!1,h="top",m,p,x=e.left-s.left,v=s.right-e.right,b=r.right-r.left,k=r.bottom-r.top;if(c&&x=k||T>e.top?m=n.bottom-e.top:(h="bottom",m=e.bottom-n.top)}let O=(e.bottom-e.top)/i.offsetHeight,j=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${m/O}px; max-width: ${p/j}px`,class:"cm-completionInfo-"+(d?l?"left-narrow":"right-narrow":c?"left":"right")}}function $K(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 l=document.createElement("span");l.className="cm-completionLabel";let c=n.displayLabel||n.label,d=0;for(let h=0;hd&&l.appendChild(document.createTextNode(c.slice(d,m)));let x=l.appendChild(document.createElement("span"));x.appendChild(document.createTextNode(c.slice(m,p))),x.className="cm-completionMatchedText",d=p}return dn.position-r.position).map(n=>n.render)}function Ky(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 HK{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:d=>this.placeInfo(d),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:l}=s.open,c=e.state.facet(Dr);this.optionContent=$K(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=Ky(i.length,l,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",d=>{let{options:h}=e.state.field(n).open;for(let m=d.target,p;m&&m!=this.dom;m=m.parentNode)if(m.nodeName=="LI"&&(p=/-(\d+)$/.exec(m.id))&&+p[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Dr).closeOnBlur&&d.relatedTarget!=e.contentDOM&&e.dispatch({effects:Af.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:l,disabled:c}=r.open;(!s.open||s.open.options!=i)&&(this.range=Ky(i.length,l,e.state.facet(Dr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),c!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Ky(n.options.length,n.selected,this.view.state.facet(Dr).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 l=typeof i=="string"?document.createTextNode(i):i(s);if(!l)return;"then"in l?l.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,s)}).catch(c=>_s(this.view.state,c,"completion info")):(this.addInfoPane(l,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&&VK(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 l=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{l.target==s&&l.preventDefault()});let i=null;for(let l=r.from;lr.from||r.from==0))if(i=x,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let v=s.appendChild(document.createElement("completion-section"));v.textContent=x}}const m=s.appendChild(document.createElement("li"));m.id=n+"-"+l,m.setAttribute("role","option");let p=this.optionClass(c);p&&(m.className=p);for(let x of this.optionContent){let v=x(c,this.view.state,this.view,d);v&&m.appendChild(v)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew HK(n,t,e)}function VK(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function A7(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function WK(t,e){let n=[],r=null,s=null,i=m=>{n.push(m);let{section:p}=m.completion;if(p){r||(r=[]);let x=typeof p=="string"?p:p.name;r.some(v=>v.name==x)||r.push(typeof p=="string"?{name:x}:p)}},l=e.facet(Dr);for(let m of t)if(m.hasResult()){let p=m.result.getMatch;if(m.result.filter===!1)for(let x of m.result.options)i(new N7(x,m.source,p?p(x):[],1e9-n.length));else{let x=e.sliceDoc(m.from,m.to),v,b=l.filterStrict?new FK(x):new qK(x);for(let k of m.result.options)if(v=b.match(k.label)){let O=k.displayLabel?p?p(k,v.matched):[]:v.matched,j=v.score+(k.boost||0);if(i(new N7(k,m.source,O,j)),typeof k.section=="object"&&k.section.rank==="dynamic"){let{name:T}=k.section;s||(s=Object.create(null)),s[T]=Math.max(j,s[T]||-1e9)}}}}if(r){let m=Object.create(null),p=0,x=(v,b)=>(v.rank==="dynamic"&&b.rank==="dynamic"?s[b.name]-s[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof b.rank=="number"?b.rank:1e9)||(v.namex.score-p.score||h(p.completion,x.completion))){let p=m.completion;!d||d.label!=p.label||d.detail!=p.detail||d.type!=null&&p.type!=null&&d.type!=p.type||d.apply!=p.apply||d.boost!=p.boost?c.push(m):A7(m.completion)>A7(d)&&(c[c.length-1]=m),d=m.completion}return c}class $u{constructor(e,n,r,s,i,l){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=l}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new $u(this.options,M7(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,l){if(s&&!l&&e.some(h=>h.isPending))return s.setDisabled();let c=WK(e,n);if(!c.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let d=n.facet(Dr).selectOnOpen?0:-1;if(s&&s.selected!=d&&s.selected!=-1){let h=s.options[s.selected].completion;for(let m=0;mm.hasResult()?Math.min(h,m.from):h,1e8),create:JK,above:i.aboveCursor},s?s.timestamp:Date.now(),d,!1)}map(e){return new $u(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new $u(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Fg{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new Fg(KK,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Dr),i=(r.override||n.languageDataAt("autocomplete",gc(n)).map(IK)).map(d=>(this.active.find(m=>m.source==d)||new ki(d,this.active.some(m=>m.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((d,h)=>d==this.active[h])&&(i=this.active);let l=this.open,c=e.effects.some(d=>d.is(Jw));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||i.some(d=>d.hasResult()&&e.changes.touchesRange(d.from,d.to))||!GK(i,this.active)||c?l=$u.build(i,n,this.id,l,r,c):l&&l.disabled&&!i.some(d=>d.isPending)&&(l=null),!l&&i.every(d=>!d.isPending)&&i.some(d=>d.hasResult())&&(i=i.map(d=>d.hasResult()?new ki(d.source,0):d));for(let d of e.effects)d.is(m_)&&(l=l&&l.setSelected(d.value,this.id));return i==this.active&&l==this.open?this:new Fg(i,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?XK:YK}}function GK(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const KK=[];function f_(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(Zw);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=f_(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(qg))s=new ki(s.source,1,i.value);else if(i.is(Af))s=new ki(s.source,0);else if(i.is(Jw))for(let l of i.value)l.source==s.source&&(s=l);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(gc(e.state))}}class Ku extends ki{constructor(e,n,r,s,i,l){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=l}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),l=e.changes.mapPos(this.to,1),c=gc(e.state);if(c>l||!s||n&2&&(gc(e.startState)==this.from||cn.map(e))}}),m_=vt.define(),Ms=Br.define({create(){return Fg.start()},update(t,e){return t.update(e)},provide:t=>[Dw.from(t,e=>e.tooltip),qe.contentAttributes.from(t,e=>e.attrs)]});function e5(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Ms).active.find(s=>s.source==e.source);return r instanceof Ku?(typeof n=="string"?t.dispatch({...LK(t.state,n,r.from,r.to),annotations:Zw.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const JK=UK(Ms,e5);function bp(t,e="option"){return n=>{let r=n.state.field(Ms,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:l-1;return c<0?c=e=="page"?0:l-1:c>=l&&(c=e=="page"?l-1:0),n.dispatch({effects:m_.of(c)}),!0}}const eZ=t=>{let e=t.state.field(Ms,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(Ms,!1)?(t.dispatch({effects:qg.of(!0)}),!0):!1,tZ=t=>{let e=t.state.field(Ms,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Af.of(null)}),!0)};class nZ{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const rZ=50,sZ=1e3,iZ=lr.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(Ms).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Ms),n=t.state.facet(Dr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Ms)==e)return;let r=t.transactions.some(i=>{let l=f_(i,n);return l&8||(i.selection||i.docChanged)&&!(l&3)});for(let i=0;irZ&&Date.now()-l.time>sZ){for(let c of l.context.abortListeners)try{c()}catch(d){_s(this.view.state,d)}l.context.abortListeners=null,this.running.splice(i--,1)}else l.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(l=>l.is(qg)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(l=>l.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(Ms);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(Dr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=gc(e),r=new u_(e,n,t.explicit,this.view),s=new nZ(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:Af.of(null)}),_s(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(Dr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Dr),r=this.view.state.field(Ms);for(let s=0;sc.source==i.active.source);if(l&&l.isPending)if(i.done==null){let c=new ki(i.active.source,0);for(let d of i.updates)c=c.update(d,n);c.isPending||e.push(c)}else this.startQuery(l)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Jw.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Ms,!1);if(e&&e.tooltip&&this.view.state.facet(Dr).closeOnBlur){let n=e.open&&QM(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Af.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:qg.of(!1)}),20),this.composing=0}}}),aZ=typeof navigator=="object"&&/Win/.test(navigator.platform),lZ=No.highest(qe.domEventHandlers({keydown(t,e){let n=e.state.field(Ms,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(aZ&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(l=>l.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&e5(e,r),!1}})),p_=qe.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 oZ{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class t5{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ur.TrackDel),r=e.mapPos(this.to,1,Ur.TrackDel);return n==null||r==null?null:new t5(this.field,n,r)}}class n5{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),l=/^\s*/.exec(i.text)[0];for(let d of this.lines){if(r.length){let h=l,m=/^\t*/.exec(d)[0].length;for(let p=0;pnew t5(d.field,s[d.line]+d.from,s[d.line]+d.to));return{text:r,ranges:c}}static parse(e){let n=[],r=[],s=[],i;for(let l of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let c=i[1]?+i[1]:null,d=i[2]||i[3]||"",h=-1,m=d.replace(/\\[{}]/g,p=>p[1]);for(let p=0;p=h&&x.field++}for(let p of s)if(p.line==r.length&&p.from>i.index){let x=i[2]?3+(i[1]||"").length:2;p.from-=x,p.to-=x}s.push(new oZ(h,r.length,i.index,i.index+m.length)),l=l.slice(0,i.index)+d+l.slice(i.index+i[0].length)}l=l.replace(/\\([{}])/g,(c,d,h)=>{for(let m of s)m.line==r.length&&m.from>h&&(m.from--,m.to--);return d}),r.push(l)}return new n5(r,s)}}let cZ=Je.widget({widget:new class extends ja{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),uZ=Je.mark({class:"cm-snippetField"});class Ed{constructor(e,n){this.ranges=e,this.active=n,this.deco=Je.set(e.map(r=>(r.from==r.to?cZ:uZ).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 Ed(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 p0=vt.define({map(t,e){return t&&t.map(e)}}),dZ=vt.define(),Mf=Br.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(p0))return n.value;if(n.is(dZ)&&t)return new Ed(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=>qe.decorations.from(t,e=>e?e.deco:Je.none)});function r5(t,e){return Ce.create(t.filter(n=>n.field==e).map(n=>Ce.range(n.from,n.to)))}function hZ(t){let e=n5.parse(t);return(n,r,s,i)=>{let{text:l,ranges:c}=e.instantiate(n.state,s),{main:d}=n.state.selection,h={changes:{from:s,to:i==d.from?d.to:i,insert:Xt.of(l)},scrollIntoView:!0,annotations:r?[Zw.of(r),gr.userEvent.of("input.complete")]:void 0};if(c.length&&(h.selection=r5(c,0)),c.some(m=>m.field>0)){let m=new Ed(c,0),p=h.effects=[p0.of(m)];n.state.field(Mf,!1)===void 0&&p.push(vt.appendConfig.of([Mf,xZ,vZ,p_]))}n.dispatch(n.state.update(h))}}function g_(t){return({state:e,dispatch:n})=>{let r=e.field(Mf,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(l=>l.field==s+t);return n(e.update({selection:r5(r.ranges,s),effects:p0.of(i?null:new Ed(r.ranges,s)),scrollIntoView:!0})),!0}}const fZ=({state:t,dispatch:e})=>t.field(Mf,!1)?(e(t.update({effects:p0.of(null)})),!0):!1,mZ=g_(1),pZ=g_(-1),gZ=[{key:"Tab",run:mZ,shift:pZ},{key:"Escape",run:fZ}],E7=He.define({combine(t){return t.length?t[0]:gZ}}),xZ=No.highest(o0.compute([E7],t=>t.facet(E7)));function Ya(t,e){return{...e,apply:hZ(t)}}const vZ=qe.domEventHandlers({mousedown(t,e){let n=e.state.field(Mf,!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:r5(n.ranges,s.field),effects:p0.of(n.ranges.some(i=>i.field>s.field)?new Ed(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Ef={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},cc=vt.define({map(t,e){let n=e.mapPos(t,-1,Ur.TrackAfter);return n??void 0}}),s5=new class extends yc{};s5.startSide=1;s5.endSide=-1;const x_=Br.define({create(){return Yt.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(cc)&&(t=t.update({add:[s5.range(n.value,n.value+1)]}));return t}});function yZ(){return[wZ,x_]}const Jy="()[]{}<>«»»«[]{}";function v_(t){for(let e=0;e{if((bZ?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&oa(As(r,0))==1||e!=s.from||n!=s.to)return!1;let i=OZ(t.state,r);return i?(t.dispatch(i),!0):!1}),SZ=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=y_(t,t.selection.main.head).brackets||Ef.brackets,s=null,i=t.changeByRange(l=>{if(l.empty){let c=jZ(t.doc,l.head);for(let d of r)if(d==c&&Dx(t.doc,l.head)==v_(As(d,0)))return{changes:{from:l.head-d.length,to:l.head+d.length},range:Ce.cursor(l.head-d.length)}}return{range:s=l}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},kZ=[{key:"Backspace",run:SZ}];function OZ(t,e){let n=y_(t,t.selection.main.head),r=n.brackets||Ef.brackets;for(let s of r){let i=v_(As(s,0));if(e==s)return i==s?TZ(t,s,r.indexOf(s+s+s)>-1,n):NZ(t,s,i,n.before||Ef.before);if(e==i&&b_(t,t.selection.main.from))return CZ(t,s,i)}return null}function b_(t,e){let n=!1;return t.field(x_).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Dx(t,e){let n=t.sliceString(e,e+2);return n.slice(0,oa(As(n,0)))}function jZ(t,e){let n=t.sliceString(e-2,e);return oa(As(n,0))==n.length?n:n.slice(1)}function NZ(t,e,n,r){let s=null,i=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:n,from:l.to}],effects:cc.of(l.to+e.length),range:Ce.range(l.anchor+e.length,l.head+e.length)};let c=Dx(t.doc,l.head);return!c||/\s/.test(c)||r.indexOf(c)>-1?{changes:{insert:e+n,from:l.head},effects:cc.of(l.head+e.length),range:Ce.cursor(l.head+e.length)}:{range:s=l}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function CZ(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&Dx(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ce.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function TZ(t,e,n,r){let s=r.stringPrefixes||Ef.stringPrefixes,i=null,l=t.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:cc.of(c.to+e.length),range:Ce.range(c.anchor+e.length,c.head+e.length)};let d=c.head,h=Dx(t.doc,d),m;if(h==e){if(_7(t,d))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(b_(t,d)){let x=n&&t.sliceDoc(d,d+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:d,to:d+x.length,insert:x},range:Ce.cursor(d+x.length)}}}else{if(n&&t.sliceDoc(d-2*e.length,d)==e+e&&(m=D7(t,d-2*e.length,s))>-1&&_7(t,m))return{changes:{insert:e+e+e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)};if(t.charCategorizer(d)(h)!=Vn.Word&&D7(t,d,s)>-1&&!AZ(t,d,e,s))return{changes:{insert:e+e,from:d},effects:cc.of(d+e.length),range:Ce.cursor(d+e.length)}}return{range:i=c}});return i?null:t.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function _7(t,e){let n=zr(t).resolveInner(e+1);return n.parent&&n.from==e}function AZ(t,e,n,r){let s=zr(t).resolveInner(e,-1),i=r.reduce((l,c)=>Math.max(l,c.length),0);for(let l=0;l<5;l++){let c=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),d=c.indexOf(n);if(!d||d>-1&&r.indexOf(c.slice(0,d))>-1){let m=s.firstChild;for(;m&&m.from==s.from&&m.to-m.from>n.length+d;){if(t.sliceDoc(m.to-n.length,m.to)==n)return!1;m=m.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function D7(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Vn.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))!=Vn.Word)return i}return-1}function MZ(t={}){return[lZ,Ms,Dr.of(t),iZ,EZ,p_]}const w_=[{key:"Ctrl-Space",run:Zy},{mac:"Alt-`",run:Zy},{mac:"Alt-i",run:Zy},{key:"Escape",run:tZ},{key:"ArrowDown",run:bp(!0)},{key:"ArrowUp",run:bp(!1)},{key:"PageDown",run:bp(!0,"page")},{key:"PageUp",run:bp(!1,"page")},{key:"Enter",run:eZ}],EZ=No.highest(o0.computeN([Dr],t=>t.facet(Dr).defaultKeymap?[w_]:[]));class R7{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class ic{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(_f).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((v,b)=>v.from-b.from||v.to-b.to),l=new ml,c=[],d=0,h=r.doc.iter(),m=0,p=r.doc.length;for(let v=0;;){let b=v==i.length?null:i[v];if(!b&&!c.length)break;let k,O;if(c.length)k=d,O=c.reduce((A,_)=>Math.min(A,_.to),b&&b.from>k?b.from:1e8);else{if(k=b.from,k>p)break;O=b.to,c.push(b),v++}for(;vA.from||A.to==k))c.push(A),v++,O=Math.min(A.to,O);else{O=Math.min(A.from,O);break}}O=Math.min(O,p);let j=!1;if(c.some(A=>A.from==k&&(A.to==O||O==p))&&(j=k==O,!j&&O-k<10)){let A=k-(m+h.value.length);A>0&&(h.next(A),m=k);for(let _=k;;){if(_>=O){j=!0;break}if(!h.lineBreak&&m+h.value.length>_)break;_=m+h.value.length,m+=h.value.length,h.next()}}let T=HZ(c);if(j)l.add(k,k,Je.widget({widget:new qZ(T),diagnostics:c.slice()}));else{let A=c.reduce((_,D)=>D.markClass?_+" "+D.markClass:_,"");l.add(k,O,Je.mark({class:"cm-lintRange cm-lintRange-"+T+A,diagnostics:c.slice(),inclusiveEnd:c.some(_=>_.to>O)}))}if(d=O,d==p)break;for(let A=0;A{if(!(e&&l.diagnostics.indexOf(e)<0))if(!r)r=new R7(s,i,e||l.diagnostics[0]);else{if(l.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new R7(r.from,i,r.diagnostic)}}),r}function _Z(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(_f).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(l=>l.is(S_))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function DZ(t,e){return t.field(ri,!1)?e:e.concat(vt.appendConfig.of(UZ))}const S_=vt.define(),i5=vt.define(),k_=vt.define(),ri=Br.define({create(){return new ic(Je.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=xd(n,t.selected.diagnostic,i)||xd(n,null,i)}!n.size&&s&&e.state.facet(_f).autoPanel&&(s=null),t=new ic(n,s,r)}for(let n of e.effects)if(n.is(S_)){let r=e.state.facet(_f).autoPanel?n.value.length?Df.open:null:t.panel;t=ic.init(n.value,r,e.state)}else n.is(i5)?t=new ic(t.diagnostics,n.value?Df.open:null,t.selected):n.is(k_)&&(t=new ic(t.diagnostics,t.panel,n.value));return t},provide:t=>[Sf.from(t,e=>e.panel),qe.decorations.from(t,e=>e.diagnostics)]}),RZ=Je.mark({class:"cm-lintRange cm-lintRange-active"});function zZ(t,e,n){let{diagnostics:r}=t.state.field(ri),s,i=-1,l=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(d,h,{spec:m})=>{if(e>=d&&e<=h&&(d==h||(e>d||n>0)&&(ej_(t,n,!1)))}const BZ=t=>{let e=t.state.field(ri,!1);(!e||!e.panel)&&t.dispatch({effects:DZ(t.state,[i5.of(!0)])});let n=wf(t,Df.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},z7=t=>{let e=t.state.field(ri,!1);return!e||!e.panel?!1:(t.dispatch({effects:i5.of(!1)}),!0)},LZ=t=>{let e=t.state.field(ri,!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)},IZ=[{key:"Mod-Shift-m",run:BZ,preventDefault:!0},{key:"F8",run:LZ}],_f=He.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Oa(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:P7,tooltipFilter:P7,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 P7(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function O_(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function j_(t,e,n){var r;let s=n?O_(e.actions):[];return Mn("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Mn("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,l)=>{let c=!1,d=v=>{if(v.preventDefault(),c)return;c=!0;let b=xd(t.state.field(ri).diagnostics,e);b&&i.apply(t,b.from,b.to)},{name:h}=i,m=s[l]?h.indexOf(s[l]):-1,p=m<0?h:[h.slice(0,m),Mn("u",h.slice(m,m+1)),h.slice(m+1)],x=i.markClass?" "+i.markClass:"";return Mn("button",{type:"button",class:"cm-diagnosticAction"+x,onclick:d,onmousedown:d,"aria-label":` Action: ${h}${m<0?"":` (access key "${s[l]})"`}.`},p)}),e.source&&Mn("div",{class:"cm-diagnosticSource"},e.source))}class qZ extends ja{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Mn("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class B7{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=j_(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Df{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)z7(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],l=O_(i.actions);for(let c=0;c{for(let i=0;iz7(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ri).selected;if(!e)return-1;for(let n=0;n{for(let m of h.diagnostics){if(l.has(m))continue;l.add(m);let p=-1,x;for(let v=r;vr&&(this.items.splice(r,p-r),s=!0)),n&&x.diagnostic==n.diagnostic?x.dom.hasAttribute("aria-selected")||(x.dom.setAttribute("aria-selected","true"),i=x):x.dom.hasAttribute("aria-selected")&&x.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:d})=>{let h=d.height/this.list.offsetHeight;c.topd.bottom&&(this.list.scrollTop+=(c.bottom-d.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(ri),r=xd(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:k_.of(r)})}static open(e){return new Df(e)}}function FZ(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function wp(t){return FZ(``,'width="6" height="3"')}const QZ=qe.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:wp("#d11")},".cm-lintRange-warning":{backgroundImage:wp("orange")},".cm-lintRange-info":{backgroundImage:wp("#999")},".cm-lintRange-hint":{backgroundImage:wp("#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 $Z(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function HZ(t){let e="hint",n=1;for(let r of t){let s=$Z(r.severity);s>n&&(n=s,e=r.severity)}return e}const UZ=[ri,qe.decorations.compute([ri],t=>{let{selected:e,panel:n}=t.field(ri);return!e||!n||e.from==e.to?Je.none:Je.set([RZ.range(e.from,e.to)])}),NG(zZ,{hideOn:_Z}),QZ];var L7=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(kZ)),e.defaultKeymap!==!1&&(r=r.concat(aK)),e.searchKeymap!==!1&&(r=r.concat(_K)),e.historyKeymap!==!1&&(r=r.concat(fY)),e.foldKeymap!==!1&&(r=r.concat(kX)),e.completionKeymap!==!1&&(r=r.concat(w_)),e.lintKeymap!==!1&&(r=r.concat(IZ));var s=[];return e.lineNumbers!==!1&&s.push(BG()),e.highlightActiveLineGutter!==!1&&s.push(qG()),e.highlightSpecialChars!==!1&&s.push(tG()),e.history!==!1&&s.push(sY()),e.foldGutter!==!1&&s.push(CX()),e.drawSelection!==!1&&s.push(HW()),e.dropCursor!==!1&&s.push(XW()),e.allowMultipleSelections!==!1&&s.push(Vt.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(mX()),e.syntaxHighlighting!==!1&&s.push(hE(EX,{fallback:!0})),e.bracketMatching!==!1&&s.push(LX()),e.closeBrackets!==!1&&s.push(yZ()),e.autocompletion!==!1&&s.push(MZ()),e.rectangularSelection!==!1&&s.push(pG()),n!==!1&&s.push(vG()),e.highlightActiveLine!==!1&&s.push(lG()),e.highlightSelectionMatches!==!1&&s.push(fK()),e.tabSize&&typeof e.tabSize=="number"&&s.push(u0.of(" ".repeat(e.tabSize))),s.concat([o0.of(r.flat())]).filter(Boolean)};const VZ="#e5c07b",I7="#e06c75",WZ="#56b6c2",GZ="#ffffff",sg="#abb2bf",o4="#7d8799",XZ="#61afef",YZ="#98c379",q7="#d19a66",KZ="#c678dd",ZZ="#21252b",F7="#2c313a",Q7="#282c34",eb="#353a42",JZ="#3E4451",$7="#528bff",eJ=qe.theme({"&":{color:sg,backgroundColor:Q7},".cm-content":{caretColor:$7},".cm-cursor, .cm-dropCursor":{borderLeftColor:$7},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:JZ},".cm-panels":{backgroundColor:ZZ,color:sg},".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:Q7,color:o4,border:"none"},".cm-activeLineGutter":{backgroundColor:F7},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:eb},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:eb,borderBottomColor:eb},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:F7,color:sg}}},{dark:!0}),tJ=h0.define([{tag:he.keyword,color:KZ},{tag:[he.name,he.deleted,he.character,he.propertyName,he.macroName],color:I7},{tag:[he.function(he.variableName),he.labelName],color:XZ},{tag:[he.color,he.constant(he.name),he.standard(he.name)],color:q7},{tag:[he.definition(he.name),he.separator],color:sg},{tag:[he.typeName,he.className,he.number,he.changed,he.annotation,he.modifier,he.self,he.namespace],color:VZ},{tag:[he.operator,he.operatorKeyword,he.url,he.escape,he.regexp,he.link,he.special(he.string)],color:WZ},{tag:[he.meta,he.comment],color:o4},{tag:he.strong,fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.link,color:o4,textDecoration:"underline"},{tag:he.heading,fontWeight:"bold",color:I7},{tag:[he.atom,he.bool,he.special(he.variableName)],color:q7},{tag:[he.processingInstruction,he.string,he.inserted],color:YZ},{tag:he.invalid,color:GZ}]),N_=[eJ,hE(tJ)];var nJ=qe.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),rJ=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:l="",basicSetup:c=!0}=e,d=[];switch(n&&d.unshift(o0.of([lK])),c&&(typeof c=="boolean"?d.unshift(L7()):d.unshift(L7(c))),l&&d.unshift(dG(l)),i){case"light":d.push(nJ);break;case"dark":d.push(N_);break;case"none":break;default:d.push(i);break}return r===!1&&d.push(qe.editable.of(!1)),s&&d.push(Vt.readOnly.of(!0)),[...d]},sJ=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 iJ{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 H7{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 tb=null,aJ=()=>typeof window>"u"?new H7:(tb||(tb=new H7),tb),U7=ka.define(),lJ=200,oJ=[];function cJ(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:l,extensions:c=oJ,autoFocus:d,theme:h="light",height:m=null,minHeight:p=null,maxHeight:x=null,width:v=null,minWidth:b=null,maxWidth:k=null,placeholder:O="",editable:j=!0,readOnly:T=!1,indentWithTab:A=!0,basicSetup:_=!0,root:D,initialState:E}=t,[z,Q]=S.useState(),[F,L]=S.useState(),[U,V]=S.useState(),ce=S.useState(()=>({current:null}))[0],W=S.useState(()=>({current:null}))[0],J=qe.theme({"&":{height:m,minHeight:p,maxHeight:x,width:v,minWidth:b,maxWidth:k},"& .cm-scroller":{height:"100% !important"}}),$=qe.updateListener.of(ue=>{if(ue.docChanged&&typeof r=="function"&&!ue.transactions.some(Y=>Y.annotation(U7))){ce.current?ce.current.reset():(ce.current=new iJ(()=>{if(W.current){var Y=W.current;W.current=null,Y()}ce.current=null},lJ),aJ().add(ce.current));var R=ue.state.doc,me=R.toString();r(me,ue)}s&&s(sJ(ue))}),ae=rJ({theme:h,editable:j,readOnly:T,placeholder:O,indentWithTab:A,basicSetup:_}),ne=[$,J,...ae];return l&&typeof l=="function"&&ne.push(qe.updateListener.of(l)),ne=ne.concat(c),S.useLayoutEffect(()=>{if(z&&!U){var ue={doc:e,selection:n,extensions:ne},R=E?Vt.fromJSON(E.json,ue,E.fields):Vt.create(ue);if(V(R),!F){var me=new qe({state:R,parent:z,root:D});L(me),i&&i(me,R)}}return()=>{F&&(V(void 0),L(void 0))}},[z,U]),S.useEffect(()=>{t.container&&Q(t.container)},[t.container]),S.useEffect(()=>()=>{F&&(F.destroy(),L(void 0)),ce.current&&(ce.current.cancel(),ce.current=null)},[F]),S.useEffect(()=>{d&&F&&F.focus()},[d,F]),S.useEffect(()=>{F&&F.dispatch({effects:vt.reconfigure.of(ne)})},[h,c,m,p,x,v,b,k,O,j,T,A,_,r,l]),S.useEffect(()=>{if(e!==void 0){var ue=F?F.state.doc.toString():"";if(F&&e!==ue){var R=ce.current&&!ce.current.isDone,me=()=>{F&&e!==F.state.doc.toString()&&F.dispatch({changes:{from:0,to:F.state.doc.toString().length,insert:e||""},annotations:[U7.of(!0)]})};R?W.current=me:me()}}},[e,F]),{state:U,setState:V,view:F,setView:L,container:z,setContainer:Q}}var uJ=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],C_=S.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,autoFocus:m,theme:p="light",height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,root:z,initialState:Q}=t,F=VI(t,uJ),L=S.useRef(null),{state:U,view:V,container:ce,setContainer:W}=cJ({root:z,value:r,autoFocus:m,theme:p,height:x,minHeight:v,maxHeight:b,width:k,minWidth:O,maxWidth:j,basicSetup:T,placeholder:A,indentWithTab:_,editable:D,readOnly:E,selection:s,onChange:l,onStatistics:c,onCreateEditor:d,onUpdate:h,extensions:i,initialState:Q});S.useImperativeHandle(e,()=>({editor:L.current,state:U,view:V}),[L,ce,U,V]);var J=S.useCallback(ae=>{L.current=ae,W(ae)},[W]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var $=typeof p=="string"?"cm-theme-"+p:"cm-theme";return a.jsx("div",WI({ref:J,className:""+$+(n?" "+n:"")},F))});C_.displayName="CodeMirror";var V7={};class Qg{constructor(e,n,r,s,i,l,c,d,h,m=0,p){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=l,this.buffer=c,this.bufferBase=d,this.curContext=h,this.lookAhead=m,this.parent=p}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 Qg(e,[],n,r,r,0,[],0,s?new W7(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,l=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSized;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&l.buffer[c-4]==0&&l.buffer[c-1]>-1){if(n==r)return;if(l.buffer[c-2]>=n){l.buffer[c-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let l=this.buffer.length;if(l>0&&(this.buffer[l-4]!=0||this.buffer[l-1]<0)){let c=!1;for(let d=l;d>0&&this.buffer[d-2]>r;d-=4)if(this.buffer[d-1]>=0){c=!0;break}if(c)for(;l>0&&this.buffer[l-2]>r;)this.buffer[l]=this.buffer[l-4],this.buffer[l+1]=this.buffer[l-3],this.buffer[l+2]=this.buffer[l-2],this.buffer[l+3]=this.buffer[l-1],l-=4,s>4&&(s-=4)}this.buffer[l]=e,this.buffer[l+1]=n,this.buffer[l+2]=r,this.buffer[l+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:l}=this.p;(s>this.pos||n<=l.maxNode)&&(this.pos=s,l.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=l.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 Qg(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 dJ(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,l;id&1&&c==l)||s.push(n[i],l)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let l=this.findForcedReduction();if(l==null)return!1;n=l}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,l=>{if(!(l&393216))if(l&65536){let c=(l>>19)-i;if(c>1){let d=l&65535,h=this.stack.length-c*3;if(h>=0&&e.getGoto(this.stack[h],d,!1)>=0)return c<<19|65536|d}}else{let c=r(l,i+1);if(c!=null)return c}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class W7{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class dJ{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 $g{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 $g(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 $g(this.stack,this.pos,this.index)}}function Sp(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&l--,l>=34&&l--;let d=l-32;if(d>=46&&(d-=46,c=!0),i+=d,c)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class ig{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const G7=new ig;class hJ{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=G7,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let l=this.ranges[++s];i+=l.from-r.to,r=l}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&rc.to&&(this.chunk2=this.chunk2.slice(0,c.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=G7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class Zu{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;fJ(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Zu.prototype.contextual=Zu.prototype.fallback=Zu.prototype.extend=!1;Zu.prototype.fallback=Zu.prototype.extend=!1;class Rx{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function fJ(t,e,n,r,s,i){let l=0,c=1<0){let b=t[v];if(d.allows(b)&&(e.token.value==-1||e.token.value==b||mJ(b,e.token.value,s,i))){e.acceptToken(b);break}}let m=e.next,p=0,x=t[l+2];if(e.next<0&&x>p&&t[h+x*3-3]==65535){l=t[h+x*3-1];continue e}for(;p>1,b=h+v+(v<<1),k=t[b],O=t[b+1]||65536;if(m=O)p=v+1;else{l=t[b+2],e.advance();continue e}}break}}function X7(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function mJ(t,e,n,r){let s=X7(n,r,e);return s<0||X7(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class pJ{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?Y7(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Y7(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=l,null;if(i instanceof Dn){if(l==e){if(l=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(l),this.index.push(0))}else this.index[n]++,this.nextStart=l+i.length}}}class gJ{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new ig)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,l=s.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,d=0;for(let h=0;hp.end+25&&(d=Math.max(p.lookAhead,d)),p.value!=0)){let x=n;if(p.extended>-1&&(n=this.addActions(e,p.extended,p.end,n)),n=this.addActions(e,p.value,p.end,n),!m.extend&&(r=p,n>x))break}}for(;this.actions.length>n;)this.actions.pop();return d&&e.setLookAhead(d),!r&&e.pos==this.stream.end&&(r=new ig,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 ig,{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 l=0;l=0&&r.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new pJ(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[l]=e;for(;l.forceReduce()&&l.stack.length&&l.stack[l.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let l=0;ln)r.push(c);else{if(this.advanceStack(c,r,e))continue;{s||(s=[],i=[]),s.push(c);let d=this.tokens.getMainToken(c);i.push(d.value,d.end)}}break}}if(!r.length){let l=s&&bJ(s);if(l)return Ks&&console.log("Finish with "+this.stackID(l)),this.stackToTree(l);if(this.parser.strict)throw Ks&&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 l=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(l)return Ks&&console.log("Force-finish "+this.stackID(l)),this.stackToTree(l.forceAll())}if(this.recovering){let l=this.recovering==1?1:this.recovering*3;if(r.length>l)for(r.sort((c,d)=>d.score-c.score);r.length>l;)r.pop();r.some(c=>c.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let l=0;l500&&h.buffer.length>500)if((c.score-h.score||c.buffer.length-h.buffer.length)>0)r.splice(d--,1);else{r.splice(l--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let l=1;l ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,m=h?e.curContext.hash:0;for(let p=this.fragments.nodeAt(s);p;){let x=this.parser.nodeSet.types[p.type.id]==p.type?i.getGoto(e.state,p.type.id):-1;if(x>-1&&p.length&&(!h||(p.prop(Et.contextHash)||0)==m))return e.useNode(p,x),Ks&&console.log(l+this.stackID(e)+` (via reuse of ${i.getName(p.type.id)})`),!0;if(!(p instanceof Dn)||p.children.length==0||p.positions[0]>0)break;let v=p.children[0];if(v instanceof Dn&&p.positions[0]==0)p=v;else break}}let c=i.stateSlot(e.state,4);if(c>0)return e.reduce(c),Ks&&console.log(l+this.stackID(e)+` (via always-reduce ${i.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let h=0;hs?n.push(b):r.push(b)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return K7(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let l=0;l ":"";if(c.deadEnd&&(i||(i=!0,c.restart(),Ks&&console.log(m+this.stackID(c)+" (restarted)"),this.advanceFully(c,r))))continue;let p=c.split(),x=m;for(let v=0;v<10&&p.forceReduce()&&(Ks&&console.log(x+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,r));v++)Ks&&(x=this.stackID(p)+" -> ");for(let v of c.recoverByInsert(d))Ks&&console.log(m+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,r);this.stream.end>c.pos?(h==c.pos&&(h++,d=0),c.recoverByDelete(d,h),Ks&&console.log(m+this.stackID(c)+` (via recover-delete ${this.parser.getName(d)})`),K7(c,r)):(!s||s.scoret;class yJ{constructor(e){this.start=e.start,this.shift=e.shift||rb,this.reduce=e.reduce||rb,this.reuse=e.reuse||rb,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rf extends Bw{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 c=0;ce.topRules[c][1]),s=[];for(let c=0;c=0)i(m,d,c[h++]);else{let p=c[h+-m];for(let x=-m;x>0;x--)i(c[h++],d,p);h++}}}this.nodeSet=new jx(n.map((c,d)=>gs.define({name:d>=this.minRepeatTerm?void 0:c,id:d,props:s[d],top:r.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=VM;let l=Sp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;ctypeof c=="number"?new Zu(l,c):c),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 xJ(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 l=s[i++],c=l&1,d=s[i++];if(c&&r)return d;for(let h=i+(l>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=rl(this.data,i+2);else break;s=n(rl(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=rl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,l)=>l&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(Rf.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(c=>c.from==r.external);if(!i)return r;let l=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=Z7(l),l})),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 l=n.indexOf(i);l>=0&&(r[l]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const wJ=1,T_=194,A_=195,SJ=196,J7=197,kJ=198,OJ=199,jJ=200,NJ=2,M_=3,e8=201,CJ=24,TJ=25,AJ=49,MJ=50,EJ=55,_J=56,DJ=57,RJ=59,zJ=60,PJ=61,BJ=62,LJ=63,IJ=65,qJ=238,FJ=71,QJ=241,$J=242,HJ=243,UJ=244,VJ=245,WJ=246,GJ=247,XJ=248,E_=72,YJ=249,KJ=250,ZJ=251,JJ=252,eee=253,tee=254,nee=255,ree=256,see=73,iee=77,aee=263,lee=112,oee=130,cee=151,uee=152,dee=155,jc=10,zf=13,a5=32,zx=9,l5=35,hee=40,fee=46,c4=123,t8=125,__=39,D_=34,n8=92,mee=111,pee=120,gee=78,xee=117,vee=85,yee=new Set([TJ,AJ,MJ,aee,IJ,oee,_J,DJ,qJ,BJ,LJ,E_,see,iee,zJ,PJ,cee,uee,dee,lee]);function sb(t){return t==jc||t==zf}function ib(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const bee=new Rx((t,e)=>{let n;if(t.next<0)t.acceptToken(OJ);else if(e.context.flags&ag)sb(t.next)&&t.acceptToken(kJ,1);else if(((n=t.peek(-1))<0||sb(n))&&e.canShift(J7)){let r=0;for(;t.next==a5||t.next==zx;)t.advance(),r++;(t.next==jc||t.next==zf||t.next==l5)&&t.acceptToken(J7,-r)}else sb(t.next)&&t.acceptToken(SJ,1)},{contextual:!0}),wee=new Rx((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==jc||r==zf){let s=0,i=0;for(;;){if(t.next==a5)s++;else if(t.next==zx)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=jc&&t.next!=zf&&t.next!=l5&&(s[t,e|R_])),Oee=new yJ({start:See,reduce(t,e,n,r){return t.flags&ag&&yee.has(e)||(e==FJ||e==E_)&&t.flags&R_?t.parent:t},shift(t,e,n,r){return e==T_?new lg(t,kee(r.read(r.pos,n.pos)),0):e==A_?t.parent:e==CJ||e==EJ||e==RJ||e==M_?new lg(t,0,ag):r8.has(e)?new lg(t,0,r8.get(e)|t.flags&ag):t},hash(t){return t.hash}}),jee=new Rx(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==a5||n==zx)){n!=hee&&n!=fee&&n!=jc&&n!=zf&&n!=l5&&t.acceptToken(wJ);return}}}),Nee=new Rx((t,e)=>{let{flags:n}=e.context,r=n&Ja?D_:__,s=(n&el)>0,i=!(n&tl),l=(n&nl)>0,c=t.pos;for(;!(t.next<0);)if(l&&t.next==c4)if(t.peek(1)==c4)t.advance(2);else{if(t.pos==c){t.acceptToken(M_,1);return}break}else if(i&&t.next==n8){if(t.pos==c){t.advance();let d=t.next;d>=0&&(t.advance(),Cee(t,d)),t.acceptToken(NJ);return}break}else if(t.next==n8&&!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==c){t.acceptToken(e8,s?3:1);return}break}else if(t.next==jc){if(s)t.advance();else if(t.pos==c){t.acceptToken(e8);return}break}else t.advance();t.pos>c&&t.acceptToken(jJ)});function Cee(t,e){if(e==mee)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==pee)for(let n=0;n<2&&ib(t.next);n++)t.advance();else if(e==xee)for(let n=0;n<4&&ib(t.next);n++)t.advance();else if(e==vee)for(let n=0;n<8&&ib(t.next);n++)t.advance();else if(e==gee&&t.next==c4){for(t.advance();t.next>=0&&t.next!=t8&&t.next!=__&&t.next!=D_&&t.next!=jc;)t.advance();t.next==t8&&t.advance()}}const Tee=Lw({'async "*" "**" FormatConversion FormatSpec':he.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":he.controlKeyword,"in not and or is del":he.operatorKeyword,"from def class global nonlocal lambda":he.definitionKeyword,import:he.moduleKeyword,"with as print":he.keyword,Boolean:he.bool,None:he.null,VariableName:he.variableName,"CallExpression/VariableName":he.function(he.variableName),"FunctionDefinition/VariableName":he.function(he.definition(he.variableName)),"ClassDefinition/VariableName":he.definition(he.className),PropertyName:he.propertyName,"CallExpression/MemberExpression/PropertyName":he.function(he.propertyName),Comment:he.lineComment,Number:he.number,String:he.string,FormatString:he.special(he.string),Escape:he.escape,UpdateOp:he.updateOperator,"ArithOp!":he.arithmeticOperator,BitOp:he.bitwiseOperator,CompareOp:he.compareOperator,AssignOp:he.definitionOperator,Ellipsis:he.punctuation,At:he.meta,"( )":he.paren,"[ ]":he.squareBracket,"{ }":he.brace,".":he.derefOperator,", ;":he.separator}),Aee={__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},Mee=Rf.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[jee,wee,bee,Nee,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Aee[t]||-1}],tokenPrec:7668}),s8=new WG,z_=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function kp(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const Eee={FunctionDefinition:kp("function"),ClassDefinition:kp("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 l=s.getChild("import");l;l=l.nextSibling)l.name=="VariableName"&&((r=l.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(l,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:kp("variable"),AsPattern:kp("variable"),__proto__:null};function P_(t,e){let n=s8.get(e);if(n)return n;let r=[],s=!0;function i(l,c){let d=t.sliceString(l.from,l.to);r.push({label:d,type:c})}return e.cursor(Or.IncludeAnonymous).iterate(l=>{if(l.name){let c=Eee[l.name];if(c&&c(l,i,s)||!s&&z_.has(l.name))return!1;s=!1}else if(l.to-l.from>8192){for(let c of P_(t,l.node))r.push(c);return!1}}),s8.set(e,r),r}const i8=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,B_=["String","FormatString","Comment","PropertyName"];function _ee(t){let e=zr(t.state).resolveInner(t.pos,-1);if(B_.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&i8.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)z_.has(s.name)&&(r=r.concat(P_(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:i8}}const Dee=["__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"}))),Ree=[Ya("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ya("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ya("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ya("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ya(`if \${}: -`,{label:"if",detail:"block",type:"keyword"}),Ya("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ya("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ya("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ya("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],zee=BK(B_,d_(Dee.concat(Ree)));function ab(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 lb(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const ob=jf.define({name:"python",parser:Mee.configure({props:[Cx.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&ab(t)||t.node;return(e=lb(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=ab(t);return(e=lb(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":Hy({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Hy({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Hy({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=ab(t);return(e=n&&lb(t,n))!==null&&e!==void 0?e:t.continue()}}),Fw.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":rE,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 Pee(){return new eE(ob,[ob.data.of({autocomplete:_ee}),ob.data.of({autocomplete:zee})])}const Bee=Lw({String:he.string,Number:he.number,"True False":he.bool,PropertyName:he.propertyName,Null:he.null,", :":he.separator,"[ ]":he.squareBracket,"{ }":he.brace}),Lee=Rf.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:[Bee],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}),Iee=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=qee(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function qee(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 Fee=jf.define({name:"json",parser:Lee.configure({props:[Cx.add({Object:a7({except:/^\s*\}/}),Array:a7({except:/^\s*\]/})}),Fw.add({"Object Array":rE})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Qee(){return new eE(Fee)}const $ee={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:"#"}}},Hee={python:[Pee()],json:[Qee(),Iee()],toml:[Qw.define($ee)],text:[]};function Uee({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:l,placeholder:c,theme:d="dark",className:h=""}){const[m,p]=S.useState(!1);if(S.useEffect(()=>{p(!0)},[]),!m)return a.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:l}});const x=[...Hee[n]||[],qe.lineWrapping];return r&&x.push(qe.editable.of(!1)),a.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:a.jsx(C_,{value:t,height:s,minHeight:i,maxHeight:l,theme:d==="dark"?N_:void 0,extensions:x,onChange:e,placeholder:c,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 Vee(){const[t,e]=S.useState(!0),[n,r]=S.useState(!1),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState("visual"),[b,k]=S.useState(""),[O,j]=S.useState(!1),{toast:T}=Pr(),[A,_]=S.useState(null),[D,E]=S.useState(null),[R,Q]=S.useState(null),[F,L]=S.useState(null),[U,V]=S.useState(null),[de,W]=S.useState(null),[J,$]=S.useState(null),[ae,ne]=S.useState(null),[ce,z]=S.useState(null),[xe,Y]=S.useState(null),[P,K]=S.useState(null),[H,fe]=S.useState(null),[ve,Re]=S.useState(null),[ue,We]=S.useState(null),[ct,Oe]=S.useState(null),[nt,ut]=S.useState(null),[Ct,In]=S.useState(null),[Tn,Jn]=S.useState(null),nn=S.useRef(null),_t=S.useRef(!0),Yr=S.useRef({}),qn=S.useCallback(async()=>{try{const re=await RU();k(re),j(!1)}catch(re){T({variant:"destructive",title:"加载失败",description:re instanceof Error?re.message:"加载源代码失败"})}},[T]),or=S.useCallback(async()=>{try{e(!0);const re=await DU();Yr.current=re,_(re.bot),E(re.personality);const Ae=re.chat;Ae.talk_value_rules||(Ae.talk_value_rules=[]),Q(Ae),L(re.expression),V(re.emoji),W(re.memory),$(re.tool),ne(re.mood),z(re.voice),Y(re.lpmm_knowledge),K(re.keyword_reaction),fe(re.response_post_process),Re(re.chinese_typo),We(re.response_splitter),Oe(re.log),ut(re.debug),In(re.maim_message),Jn(re.telemetry),c(!1),_t.current=!1,await qn()}catch(re){console.error("加载配置失败:",re),T({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[T,qn]);S.useEffect(()=>{or()},[or]);const yn=S.useCallback(async(re,Ae)=>{if(!_t.current)try{i(!0),await PU(re,Ae),c(!1)}catch(pt){console.error(`自动保存 ${re} 失败:`,pt),c(!0)}finally{i(!1)}},[]),ft=S.useCallback((re,Ae)=>{_t.current||(c(!0),nn.current&&clearTimeout(nn.current),nn.current=setTimeout(()=>{yn(re,Ae)},2e3))},[yn]);S.useEffect(()=>{A&&!_t.current&&ft("bot",A)},[A,ft]),S.useEffect(()=>{D&&!_t.current&&ft("personality",D)},[D,ft]),S.useEffect(()=>{R&&!_t.current&&ft("chat",R)},[R,ft]),S.useEffect(()=>{F&&!_t.current&&ft("expression",F)},[F,ft]),S.useEffect(()=>{U&&!_t.current&&ft("emoji",U)},[U,ft]),S.useEffect(()=>{de&&!_t.current&&ft("memory",de)},[de,ft]),S.useEffect(()=>{J&&!_t.current&&ft("tool",J)},[J,ft]),S.useEffect(()=>{ae&&!_t.current&&ft("mood",ae)},[ae,ft]),S.useEffect(()=>{ce&&!_t.current&&ft("voice",ce)},[ce,ft]),S.useEffect(()=>{xe&&!_t.current&&ft("lpmm_knowledge",xe)},[xe,ft]),S.useEffect(()=>{P&&!_t.current&&ft("keyword_reaction",P)},[P,ft]),S.useEffect(()=>{H&&!_t.current&&ft("response_post_process",H)},[H,ft]),S.useEffect(()=>{ve&&!_t.current&&ft("chinese_typo",ve)},[ve,ft]),S.useEffect(()=>{ue&&!_t.current&&ft("response_splitter",ue)},[ue,ft]),S.useEffect(()=>{ct&&!_t.current&&ft("log",ct)},[ct,ft]),S.useEffect(()=>{nt&&!_t.current&&ft("debug",nt)},[nt,ft]),S.useEffect(()=>{Ct&&!_t.current&&ft("maim_message",Ct)},[Ct,ft]),S.useEffect(()=>{Tn&&!_t.current&&ft("telemetry",Tn)},[Tn,ft]);const ee=async()=>{try{r(!0),await zU(b),c(!1),j(!1),T({title:"保存成功",description:"配置已保存"}),await or()}catch(re){j(!0),T({variant:"destructive",title:"保存失败",description:re instanceof Error?re.message:"保存配置失败"})}finally{r(!1)}},Se=async re=>{if(l){T({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}v(re),re==="source"?await qn():await or()},Be=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:R,expression:F,emoji:U,memory:de,tool:J,mood:ae,voice:ce,lpmm_knowledge:xe,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:ue,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(re){console.error("保存配置失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),xw().catch(()=>{}),p(!0)}catch(re){console.error("重启失败:",re),p(!1),T({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},Tt=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:R,expression:F,emoji:U,memory:de,tool:J,mood:ae,voice:ce,lpmm_knowledge:xe,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:ue,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ae=>setTimeout(Ae,500)),await rt()}catch(re){console.error("保存失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},cr=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Kr=()=>{p(!1),h(!1),T({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?a.jsx(vn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[a.jsx(hl,{value:x,onValueChange:re=>Se(re),className:"w-auto",children:a.jsxs(ya,{className:"h-9",children:[a.jsxs($t,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(bq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),a.jsxs($t,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(wq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),a.jsxs(ie,{onClick:x==="visual"?Be:ee,disabled:n||s||!l||d,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":l?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:n||s||d,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),d?"重启中...":l?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:l?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:l?Tt:rt,children:l?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),x==="source"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:[a.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",O&&a.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),a.jsx(Uee,{value:b,onChange:re=>{k(re),c(!0),O&&j(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&a.jsx(a.Fragment,{children:a.jsxs(hl,{defaultValue:"bot",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[a.jsx($t,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),a.jsx($t,{value:"personality",className:"flex-shrink-0",children:"人格"}),a.jsx($t,{value:"chat",className:"flex-shrink-0",children:"聊天"}),a.jsx($t,{value:"expression",className:"flex-shrink-0",children:"表达"}),a.jsx($t,{value:"features",className:"flex-shrink-0",children:"功能"}),a.jsx($t,{value:"processing",className:"flex-shrink-0",children:"处理"}),a.jsx($t,{value:"mood",className:"flex-shrink-0",children:"情绪"}),a.jsx($t,{value:"voice",className:"flex-shrink-0",children:"语音"}),a.jsx($t,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),a.jsx($t,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),a.jsx(kn,{value:"bot",className:"space-y-4",children:A&&a.jsx(Wee,{config:A,onChange:_})}),a.jsx(kn,{value:"personality",className:"space-y-4",children:D&&a.jsx(Gee,{config:D,onChange:E})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:R&&a.jsx(Xee,{config:R,onChange:Q})}),a.jsx(kn,{value:"expression",className:"space-y-4",children:F&&a.jsx(Yee,{config:F,onChange:L})}),a.jsx(kn,{value:"features",className:"space-y-4",children:U&&de&&J&&a.jsx(Kee,{emojiConfig:U,memoryConfig:de,toolConfig:J,onEmojiChange:V,onMemoryChange:W,onToolChange:$})}),a.jsx(kn,{value:"processing",className:"space-y-4",children:P&&H&&ve&&ue&&a.jsx(Zee,{keywordReactionConfig:P,responsePostProcessConfig:H,chineseTypoConfig:ve,responseSplitterConfig:ue,onKeywordReactionChange:K,onResponsePostProcessChange:fe,onChineseTypoChange:Re,onResponseSplitterChange:We})}),a.jsx(kn,{value:"mood",className:"space-y-4",children:ae&&a.jsx(Jee,{config:ae,onChange:ne})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:ce&&a.jsx(ete,{config:ce,onChange:z})}),a.jsx(kn,{value:"lpmm",className:"space-y-4",children:xe&&a.jsx(tte,{config:xe,onChange:Y})}),a.jsxs(kn,{value:"other",className:"space-y-4",children:[ct&&a.jsx(nte,{config:ct,onChange:Oe}),nt&&a.jsx(rte,{config:nt,onChange:ut}),Ct&&a.jsx(ste,{config:Ct,onChange:In}),Tn&&a.jsx(ite,{config:Tn,onChange:Jn})]})]})}),m&&a.jsx(vw,{onRestartComplete:cr,onRestartFailed:Kr})]})})}function Wee({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=d=>{e({...t,platforms:t.platforms.filter((h,m)=>m!==d)})},s=(d,h)=>{const m=[...t.platforms];m[d]=h,e({...t,platforms:m})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},l=d=>{e({...t,alias_names:t.alias_names.filter((h,m)=>m!==d)})},c=(d,h)=>{const m=[...t.alias_names];m[d]=h,e({...t,alias_names:m})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"platform",children:"平台"}),a.jsx(Me,{id:"platform",value:t.platform,onChange:d=>e({...t,platform:d.target.value}),placeholder:"qq"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号"}),a.jsx(Me,{id:"qq_account",value:t.qq_account,onChange:d=>e({...t,qq_account:d.target.value}),placeholder:"123456789"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:t.nickname,onChange:d=>e({...t,nickname:d.target.value}),placeholder:"麦麦"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"其他平台账号"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.platforms.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>s(h,m.target.value),placeholder:"wx:114514"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除平台账号 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"别名"}),a.jsxs(ie,{onClick:i,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>c(h,m.target.value),placeholder:"小麦"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除别名 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>l(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function Gee({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((l,c)=>c!==i)})},s=(i,l)=>{const c=[...t.states];c[i]=l,e({...t,states:c})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"personality",children:"人格特质"}),a.jsx(_n,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格"}),a.jsx(_n,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣"}),a.jsx(_n,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"plan_style",children:"说话规则与行为风格"}),a.jsx(_n,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"visual_style",children:"识图规则"}),a.jsx(_n,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊规则"}),a.jsx(_n,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"状态列表(人格多样性)"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),a.jsx("div",{className:"space-y-2",children:t.states.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(_n,{value:i,onChange:c=>s(l,c.target.value),placeholder:"描述一个人格状态",rows:2}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsx(dn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(l),children:"删除"})]})]})]})]},l))})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"state_probability",children:"状态替换概率"}),a.jsx(Me,{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)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function Xee({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=c=>{e({...t,talk_value_rules:t.talk_value_rules.filter((d,h)=>h!==c)})},s=(c,d,h)=>{const m=[...t.talk_value_rules];m[c]={...m[c],[d]:h},e({...t,talk_value_rules:m})},i=({value:c,onChange:d})=>{const[h,m]=S.useState("00"),[p,x]=S.useState("00"),[v,b]=S.useState("23"),[k,O]=S.useState("59");S.useEffect(()=>{const T=c.split("-");if(T.length===2){const[A,_]=T,[D,E]=A.split(":"),[R,Q]=_.split(":");D&&m(D.padStart(2,"0")),E&&x(E.padStart(2,"0")),R&&b(R.padStart(2,"0")),Q&&O(Q.padStart(2,"0"))}},[c]);const j=(T,A,_,D)=>{const E=`${T}:${A}-${_}:${D}`;d(E)};return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[a.jsx(dc,{className:"h-4 w-4 mr-2"}),c||"选择时间段"]})}),a.jsx(fl,{className:"w-80",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:h,onValueChange:T=>{m(T),j(T,p,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:p,onValueChange:T=>{x(T),j(h,T,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:v,onValueChange:T=>{b(T),j(h,p,T,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:k,onValueChange:T=>{O(T),j(h,p,v,T)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]})]})})]})},l=({rule:c})=>{const d=`{ target = "${c.target}", time = "${c.time}", value = ${c.value.toFixed(1)} }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:d}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),a.jsx(Me,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:c=>e({...t,talk_value:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),a.jsx(Me,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:t.mentioned_bot_reply,onChange:c=>e({...t,mentioned_bot_reply:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_context_size",children:"上下文长度"}),a.jsx(Me,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:c=>e({...t,max_context_size:parseInt(c.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"planner_smooth",children:"规划器平滑"}),a.jsx(Me,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:c=>e({...t,planner_smooth:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:c=>e({...t,enable_talk_value_rules:c})}),a.jsx(te,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:c=>e({...t,include_planner_reasoning:c})}),a.jsx(te,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&a.jsxs("div",{className:"border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),a.jsxs(ie,{onClick:n,size:"sm",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?a.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((c,d)=>a.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",d+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(l,{rule:c}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{variant:"ghost",size:"sm",children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除规则 #",d+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(d),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:c.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(d,"target",""):s(d,"target","qq::group")},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",children:"详细配置"})]})]})]}),c.target!==""&&(()=>{const h=c.target.split(":"),m=h[0]||"qq",p=h[1]||"",x=h[2]||"group";return a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:m,onValueChange:v=>{s(d,"target",`${v}:${p}:${x}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:p,onChange:v=>{s(d,"target",`${m}:${v.target.value}:${x}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:x,onValueChange:v=>{s(d,"target",`${m}:${p}:${v}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",c.target||"(未设置)"]})]})})(),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"时间段 (Time)"}),a.jsx(i,{value:c.time,onChange:h=>s(d,"time",h)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:`rule-value-${d}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),a.jsx(Me,{id:`rule-value-${d}`,type:"number",step:"0.01",min:"0",max:"1",value:c.value,onChange:h=>{const m=parseFloat(h.target.value);isNaN(m)||s(d,"value",Math.max(0,Math.min(1,m)))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[c.value],onValueChange:h=>s(d,"value",h[0]),min:0,max:1,step:.01,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (完全沉默)"}),a.jsx("span",{children:"0.5"}),a.jsx("span",{children:"1.0 (正常)"})]})]})]})]},d))}):a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:a.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),a.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:[a.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),a.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function Yee({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=x=>{e({...t,learning_list:t.learning_list.filter((v,b)=>b!==x)})},s=(x,v,b)=>{const k=[...t.learning_list];k[x][v]=b,e({...t,learning_list:k})},i=({rule:x})=>{const v=`["${x[0]}", "${x[1]}", "${x[2]}", "${x[3]}"]`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:v}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},l=({member:x,groupIndex:v,memberIndex:b,availableChatIds:k})=>{const O=k.includes(x)||x==="*",[j,T]=S.useState(!O);return a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex-1 flex gap-2",children:j?a.jsxs(a.Fragment,{children:[a.jsx(Me,{value:x,onChange:A=>p(v,b,A.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),k.length>0&&a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!1),title:"切换到下拉选择",children:"下拉"})]}):a.jsxs(a.Fragment,{children:[a.jsxs(Lt,{value:x,onValueChange:A=>p(v,b,A),children:[a.jsx(Dt,{className:"flex-1",children:a.jsx(It,{placeholder:"选择聊天流"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"*",children:"* (全局共享)"}),k.map((A,_)=>a.jsx(Pe,{value:A,children:A},_))]})]}),a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!0),title:"切换到手动输入",children:"输入"})]})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除组成员 "',x||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>m(v,b),children:"删除"})]})]})]})]})},c=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},d=x=>{e({...t,expression_groups:t.expression_groups.filter((v,b)=>b!==x)})},h=x=>{const v=[...t.expression_groups];v[x]=[...v[x],""],e({...t,expression_groups:v})},m=(x,v)=>{const b=[...t.expression_groups];b[x]=b[x].filter((k,O)=>O!==v),e({...t,expression_groups:b})},p=(x,v,b)=>{const k=[...t.expression_groups];k[x][v]=b,e({...t,expression_groups:k})};return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((x,v)=>{const b=t.learning_list.some((_,D)=>D!==v&&_[0]===""),k=x[0]==="",O=x[0].split(":"),j=O[0]||"qq",T=O[1]||"",A=O[2]||"group";return a.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["规则 ",v+1," ",k&&"(全局配置)"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(i,{rule:x}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除学习规则 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(v),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:k?"global":"specific",onValueChange:_=>{_==="global"?s(v,0,""):s(v,0,"qq::group")},disabled:b&&!k,children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",disabled:b&&!k,children:"详细配置"})]})]}),b&&!k&&a.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!k&&a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:j,onValueChange:_=>{s(v,0,`${_}:${T}:${A}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:T,onChange:_=>{s(v,0,`${j}:${_.target.value}:${A}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:A,onValueChange:_=>{s(v,0,`${j}:${T}:${_}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",x[0]||"(未设置)"]})]}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"使用学到的表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),a.jsx(jt,{checked:x[1]==="enable",onCheckedChange:_=>s(v,1,_?"enable":"disable")})]})}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"学习表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),a.jsx(jt,{checked:x[2]==="enable",onCheckedChange:_=>s(v,2,_?"enable":"disable")})]})}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"学习强度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"5",value:x[3],onChange:_=>{const D=parseFloat(_.target.value);isNaN(D)||s(v,3,Math.max(0,Math.min(5,D)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[parseFloat(x[3])||1],onValueChange:_=>s(v,3,_[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (不学习)"}),a.jsx("span",{children:"2.5"}),a.jsx("span",{children:"5.0 (快速学习)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},v)}),t.learning_list.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),a.jsxs(ie,{onClick:c,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((x,v)=>{const b=t.learning_list.map(k=>k[0]).filter(k=>k!=="");return a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",v+1,x.length===1&&x[0]==="*"&&"(全局共享)"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ie,{onClick:()=>h(v),size:"sm",variant:"outline",children:a.jsx(Wr,{className:"h-4 w-4"})}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除共享组 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(v),children:"删除"})]})]})]})]})]}),a.jsx("div",{className:"space-y-2",children:x.map((k,O)=>a.jsx(l,{member:k,groupIndex:v,memberIndex:O,availableChatIds:b},O))}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},v)}),t.expression_groups.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function Kee({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:l=>i({...n,enable_tool:l})}),a.jsx(te,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),a.jsx(Me,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:l=>s({...e,max_agent_iterations:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsx(Me,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:l=>r({...t,emoji_chance:parseFloat(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大注册数量"}),a.jsx(Me,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:l=>r({...t,max_reg_num:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:l=>r({...t,check_interval:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:l=>r({...t,do_replace:l})}),a.jsx(te,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:l=>r({...t,steal_emoji:l})}),a.jsx(te,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:l=>r({...t,content_filtration:l})}),a.jsx(te,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&a.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",value:t.filtration_prompt,onChange:l=>r({...t,filtration_prompt:l.target.value}),placeholder:"符合公序良俗"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function Zee({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:l,onResponseSplitterChange:c}){const d=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=_=>{s({...t,regex_rules:t.regex_rules.filter((D,E)=>E!==_)})},m=(_,D,E)=>{const R=[...t.regex_rules];D==="regex"&&typeof E=="string"?R[_]={...R[_],regex:[E]}:D==="reaction"&&typeof E=="string"&&(R[_]={...R[_],reaction:E}),s({...t,regex_rules:R})},p=({regex:_,reaction:D,onRegexChange:E,onReactionChange:R})=>{const[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,de]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState({}),[ne,ce]=S.useState(""),z=S.useRef(null),[xe,Y]=S.useState("build"),P=ve=>ve.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),K=(ve,Re=0)=>{const ue=z.current;if(!ue)return;const We=ue.selectionStart||0,ct=ue.selectionEnd||0,Oe=_.substring(0,We)+ve+_.substring(ct);E(Oe),setTimeout(()=>{const nt=We+ve.length+Re;ue.setSelectionRange(nt,nt),ue.focus()},0)};S.useEffect(()=>{if(!_||!L){de(null),ae({}),ce(D),J("");return}try{const ve=P(_),Re=new RegExp(ve,"g"),ue=L.match(Re);de(ue),J("");const ct=new RegExp(ve).exec(L);if(ct&&ct.groups){ae(ct.groups);let Oe=D;Object.entries(ct.groups).forEach(([nt,ut])=>{Oe=Oe.replace(new RegExp(`\\[${nt}\\]`,"g"),ut||"")}),ce(Oe)}else ae({}),ce(D)}catch(ve){J(ve.message),de(null),ae({}),ce(D)}},[_,L,D]);const H=()=>{if(!L||!V||V.length===0)return a.jsx("span",{className:"text-muted-foreground",children:L||"请输入测试文本"});try{const ve=P(_),Re=new RegExp(ve,"g");let ue=0;const We=[];let ct;for(;(ct=Re.exec(L))!==null;)ct.index>ue&&We.push(a.jsx("span",{children:L.substring(ue,ct.index)},`text-${ue}`)),We.push(a.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:ct[0]},`match-${ct.index}`)),ue=ct.index+ct[0].length;return ue)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return a.jsxs(Rr,{open:Q,onOpenChange:F,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(fg,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"正则表达式编辑器"}),a.jsx(Gr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),a.jsx(vn,{className:"max-h-[calc(90vh-120px)]",children:a.jsxs(hl,{value:xe,onValueChange:ve=>Y(ve),className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2",children:[a.jsx($t,{value:"build",children:"🔧 构建器"}),a.jsx($t,{value:"test",children:"🧪 测试器"})]}),a.jsxs(kn,{value:"build",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"正则表达式"}),a.jsx(Me,{ref:z,value:_,onChange:ve=>E(ve.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 内容"}),a.jsx(_n,{value:D,onChange:ve=>R(ve.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),a.jsxs("div",{className:"space-y-4 border-t pt-4",children:[fe.map(ve=>a.jsxs("div",{className:"space-y-2",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:ve.category}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ve.items.map(Re=>a.jsx(ie,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>K(Re.pattern,Re.moveCursor||0),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("div",{className:"flex items-center gap-2 w-full",children:[a.jsx("span",{className:"text-xs font-medium",children:Re.label}),a.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:Re.pattern})]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:Re.desc})]})},Re.label))})]},ve.category)),a.jsxs("div",{className:"space-y-2 border-t pt-4",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),a.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:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),a.jsxs("li",{children:["命名捕获组格式:",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),a.jsxs("li",{children:["在 reaction 中使用 ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),a.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),a.jsxs(kn,{value:"test",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"当前正则表达式"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:_||"(未设置)"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),a.jsx(_n,{id:"test-text",value:L,onChange:ve=>U(ve.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),W&&a.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[a.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),a.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:W})]}),!W&&L&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),a.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"匹配高亮"}),a.jsx(vn,{className:"h-40 rounded-md bg-muted p-3",children:a.jsx("div",{className:"text-sm break-words",children:H()})})]}),Object.keys($).length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"命名捕获组"}),a.jsx(vn,{className:"h-32 rounded-md border p-3",children:a.jsx("div",{className:"space-y-2",children:Object.entries($).map(([ve,Re])=>a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",ve,"]"]}),a.jsx("span",{className:"text-muted-foreground",children:"="}),a.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:Re})]},ve))})})]}),Object.keys($).length>0&&D&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 替换预览"}),a.jsx(vn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:a.jsx("div",{className:"text-sm break-words",children:ne})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),a.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:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),a.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),a.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),a.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},x=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},v=_=>{s({...t,keyword_rules:t.keyword_rules.filter((D,E)=>E!==_)})},b=(_,D,E)=>{const R=[...t.keyword_rules];typeof E=="string"&&(R[_]={...R[_],reaction:E}),s({...t,keyword_rules:R})},k=_=>{const D=[...t.keyword_rules];D[_]={...D[_],keywords:[...D[_].keywords||[],""]},s({...t,keyword_rules:D})},O=(_,D)=>{const E=[...t.keyword_rules];E[_]={...E[_],keywords:(E[_].keywords||[]).filter((R,Q)=>Q!==D)},s({...t,keyword_rules:E})},j=(_,D,E)=>{const R=[...t.keyword_rules],Q=[...R[_].keywords||[]];Q[D]=E,R[_]={...R[_],keywords:Q},s({...t,keyword_rules:R})},T=({rule:_})=>{const D=`{ regex = [${(_.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${_.reaction}" }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(vn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},A=({rule:_})=>{const D=`[[keyword_reaction.keyword_rules]] +`,{label:"if",detail:"block",type:"keyword"}),Ya("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ya("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ya("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ya("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],zee=BK(B_,d_(Dee.concat(Ree)));function ab(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 lb(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const ob=jf.define({name:"python",parser:Mee.configure({props:[Cx.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&ab(t)||t.node;return(e=lb(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=ab(t);return(e=lb(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":Hy({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Hy({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Hy({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=ab(t);return(e=n&&lb(t,n))!==null&&e!==void 0?e:t.continue()}}),Fw.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":rE,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 Pee(){return new eE(ob,[ob.data.of({autocomplete:_ee}),ob.data.of({autocomplete:zee})])}const Bee=Lw({String:he.string,Number:he.number,"True False":he.bool,PropertyName:he.propertyName,Null:he.null,", :":he.separator,"[ ]":he.squareBracket,"{ }":he.brace}),Lee=Rf.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:[Bee],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}),Iee=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=qee(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function qee(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 Fee=jf.define({name:"json",parser:Lee.configure({props:[Cx.add({Object:a7({except:/^\s*\}/}),Array:a7({except:/^\s*\]/})}),Fw.add({"Object Array":rE})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Qee(){return new eE(Fee)}const $ee={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:"#"}}},Hee={python:[Pee()],json:[Qee(),Iee()],toml:[Qw.define($ee)],text:[]};function Uee({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:l,placeholder:c,theme:d="dark",className:h=""}){const[m,p]=S.useState(!1);if(S.useEffect(()=>{p(!0)},[]),!m)return a.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:l}});const x=[...Hee[n]||[],qe.lineWrapping];return r&&x.push(qe.editable.of(!1)),a.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:a.jsx(C_,{value:t,height:s,minHeight:i,maxHeight:l,theme:d==="dark"?N_:void 0,extensions:x,onChange:e,placeholder:c,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 Vee(){const[t,e]=S.useState(!0),[n,r]=S.useState(!1),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState("visual"),[b,k]=S.useState(""),[O,j]=S.useState(!1),{toast:T}=Pr(),[A,_]=S.useState(null),[D,E]=S.useState(null),[z,Q]=S.useState(null),[F,L]=S.useState(null),[U,V]=S.useState(null),[ce,W]=S.useState(null),[J,$]=S.useState(null),[ae,ne]=S.useState(null),[ue,R]=S.useState(null),[me,Y]=S.useState(null),[P,K]=S.useState(null),[H,fe]=S.useState(null),[ve,Re]=S.useState(null),[de,We]=S.useState(null),[ct,Oe]=S.useState(null),[nt,ut]=S.useState(null),[Ct,In]=S.useState(null),[Tn,Jn]=S.useState(null),nn=S.useRef(null),_t=S.useRef(!0),Yr=S.useRef({}),qn=S.useCallback(async()=>{try{const re=await RU();k(re),j(!1)}catch(re){T({variant:"destructive",title:"加载失败",description:re instanceof Error?re.message:"加载源代码失败"})}},[T]),or=S.useCallback(async()=>{try{e(!0);const re=await DU();Yr.current=re,_(re.bot),E(re.personality);const Ae=re.chat;Ae.talk_value_rules||(Ae.talk_value_rules=[]),Q(Ae),L(re.expression),V(re.emoji),W(re.memory),$(re.tool),ne(re.mood),R(re.voice),Y(re.lpmm_knowledge),K(re.keyword_reaction),fe(re.response_post_process),Re(re.chinese_typo),We(re.response_splitter),Oe(re.log),ut(re.debug),In(re.maim_message),Jn(re.telemetry),c(!1),_t.current=!1,await qn()}catch(re){console.error("加载配置失败:",re),T({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[T,qn]);S.useEffect(()=>{or()},[or]);const yn=S.useCallback(async(re,Ae)=>{if(!_t.current)try{i(!0),await PU(re,Ae),c(!1)}catch(pt){console.error(`自动保存 ${re} 失败:`,pt),c(!0)}finally{i(!1)}},[]),ft=S.useCallback((re,Ae)=>{_t.current||(c(!0),nn.current&&clearTimeout(nn.current),nn.current=setTimeout(()=>{yn(re,Ae)},2e3))},[yn]);S.useEffect(()=>{A&&!_t.current&&ft("bot",A)},[A,ft]),S.useEffect(()=>{D&&!_t.current&&ft("personality",D)},[D,ft]),S.useEffect(()=>{z&&!_t.current&&ft("chat",z)},[z,ft]),S.useEffect(()=>{F&&!_t.current&&ft("expression",F)},[F,ft]),S.useEffect(()=>{U&&!_t.current&&ft("emoji",U)},[U,ft]),S.useEffect(()=>{ce&&!_t.current&&ft("memory",ce)},[ce,ft]),S.useEffect(()=>{J&&!_t.current&&ft("tool",J)},[J,ft]),S.useEffect(()=>{ae&&!_t.current&&ft("mood",ae)},[ae,ft]),S.useEffect(()=>{ue&&!_t.current&&ft("voice",ue)},[ue,ft]),S.useEffect(()=>{me&&!_t.current&&ft("lpmm_knowledge",me)},[me,ft]),S.useEffect(()=>{P&&!_t.current&&ft("keyword_reaction",P)},[P,ft]),S.useEffect(()=>{H&&!_t.current&&ft("response_post_process",H)},[H,ft]),S.useEffect(()=>{ve&&!_t.current&&ft("chinese_typo",ve)},[ve,ft]),S.useEffect(()=>{de&&!_t.current&&ft("response_splitter",de)},[de,ft]),S.useEffect(()=>{ct&&!_t.current&&ft("log",ct)},[ct,ft]),S.useEffect(()=>{nt&&!_t.current&&ft("debug",nt)},[nt,ft]),S.useEffect(()=>{Ct&&!_t.current&&ft("maim_message",Ct)},[Ct,ft]),S.useEffect(()=>{Tn&&!_t.current&&ft("telemetry",Tn)},[Tn,ft]);const ee=async()=>{try{r(!0),await zU(b),c(!1),j(!1),T({title:"保存成功",description:"配置已保存"}),await or()}catch(re){j(!0),T({variant:"destructive",title:"保存失败",description:re instanceof Error?re.message:"保存配置失败"})}finally{r(!1)}},Se=async re=>{if(l){T({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}v(re),re==="source"?await qn():await or()},Be=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:z,expression:F,emoji:U,memory:ce,tool:J,mood:ae,voice:ue,lpmm_knowledge:me,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:de,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(re){console.error("保存配置失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),xw().catch(()=>{}),p(!0)}catch(re){console.error("重启失败:",re),p(!1),T({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},Tt=async()=>{try{r(!0),nn.current&&clearTimeout(nn.current);const re={...Yr.current,bot:A,personality:D,chat:z,expression:F,emoji:U,memory:ce,tool:J,mood:ae,voice:ue,lpmm_knowledge:me,keyword_reaction:P,response_post_process:H,chinese_typo:ve,response_splitter:de,log:ct,debug:nt,maim_message:Ct,telemetry:Tn};await XO(re),c(!1),T({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ae=>setTimeout(Ae,500)),await rt()}catch(re){console.error("保存失败:",re),T({title:"保存失败",description:re.message,variant:"destructive"})}finally{r(!1)}},cr=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Kr=()=>{p(!1),h(!1),T({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?a.jsx(mn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[a.jsx(hl,{value:x,onValueChange:re=>Se(re),className:"w-auto",children:a.jsxs(ya,{className:"h-9",children:[a.jsxs($t,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(bq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),a.jsxs($t,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[a.jsx(wq,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),a.jsxs(ie,{onClick:x==="visual"?Be:ee,disabled:n||s||!l||d,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":l?"保存配置":"已保存"]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:n||s||d,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),d?"重启中...":l?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:l?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:l?Tt:rt,children:l?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),x==="source"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:[a.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",O&&a.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),a.jsx(Uee,{value:b,onChange:re=>{k(re),c(!0),O&&j(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&a.jsx(a.Fragment,{children:a.jsxs(hl,{defaultValue:"bot",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[a.jsx($t,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),a.jsx($t,{value:"personality",className:"flex-shrink-0",children:"人格"}),a.jsx($t,{value:"chat",className:"flex-shrink-0",children:"聊天"}),a.jsx($t,{value:"expression",className:"flex-shrink-0",children:"表达"}),a.jsx($t,{value:"features",className:"flex-shrink-0",children:"功能"}),a.jsx($t,{value:"processing",className:"flex-shrink-0",children:"处理"}),a.jsx($t,{value:"mood",className:"flex-shrink-0",children:"情绪"}),a.jsx($t,{value:"voice",className:"flex-shrink-0",children:"语音"}),a.jsx($t,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),a.jsx($t,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),a.jsx(kn,{value:"bot",className:"space-y-4",children:A&&a.jsx(Wee,{config:A,onChange:_})}),a.jsx(kn,{value:"personality",className:"space-y-4",children:D&&a.jsx(Gee,{config:D,onChange:E})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:z&&a.jsx(Xee,{config:z,onChange:Q})}),a.jsx(kn,{value:"expression",className:"space-y-4",children:F&&a.jsx(Yee,{config:F,onChange:L})}),a.jsx(kn,{value:"features",className:"space-y-4",children:U&&ce&&J&&a.jsx(Kee,{emojiConfig:U,memoryConfig:ce,toolConfig:J,onEmojiChange:V,onMemoryChange:W,onToolChange:$})}),a.jsx(kn,{value:"processing",className:"space-y-4",children:P&&H&&ve&&de&&a.jsx(Zee,{keywordReactionConfig:P,responsePostProcessConfig:H,chineseTypoConfig:ve,responseSplitterConfig:de,onKeywordReactionChange:K,onResponsePostProcessChange:fe,onChineseTypoChange:Re,onResponseSplitterChange:We})}),a.jsx(kn,{value:"mood",className:"space-y-4",children:ae&&a.jsx(Jee,{config:ae,onChange:ne})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:ue&&a.jsx(ete,{config:ue,onChange:R})}),a.jsx(kn,{value:"lpmm",className:"space-y-4",children:me&&a.jsx(tte,{config:me,onChange:Y})}),a.jsxs(kn,{value:"other",className:"space-y-4",children:[ct&&a.jsx(nte,{config:ct,onChange:Oe}),nt&&a.jsx(rte,{config:nt,onChange:ut}),Ct&&a.jsx(ste,{config:Ct,onChange:In}),Tn&&a.jsx(ite,{config:Tn,onChange:Jn})]})]})}),m&&a.jsx(vw,{onRestartComplete:cr,onRestartFailed:Kr})]})})}function Wee({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=d=>{e({...t,platforms:t.platforms.filter((h,m)=>m!==d)})},s=(d,h)=>{const m=[...t.platforms];m[d]=h,e({...t,platforms:m})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},l=d=>{e({...t,alias_names:t.alias_names.filter((h,m)=>m!==d)})},c=(d,h)=>{const m=[...t.alias_names];m[d]=h,e({...t,alias_names:m})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"platform",children:"平台"}),a.jsx(Me,{id:"platform",value:t.platform,onChange:d=>e({...t,platform:d.target.value}),placeholder:"qq"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"qq_account",children:"QQ账号"}),a.jsx(Me,{id:"qq_account",value:t.qq_account,onChange:d=>e({...t,qq_account:d.target.value}),placeholder:"123456789"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:t.nickname,onChange:d=>e({...t,nickname:d.target.value}),placeholder:"麦麦"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"其他平台账号"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.platforms.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>s(h,m.target.value),placeholder:"wx:114514"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除平台账号 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"别名"}),a.jsxs(ie,{onClick:i,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加"]})]}),a.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((d,h)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{value:d,onChange:m=>c(h,m.target.value),placeholder:"小麦"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除别名 "',d||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>l(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function Gee({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((l,c)=>c!==i)})},s=(i,l)=>{const c=[...t.states];c[i]=l,e({...t,states:c})};return a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"personality",children:"人格特质"}),a.jsx(_n,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"reply_style",children:"表达风格"}),a.jsx(_n,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"interest",children:"兴趣"}),a.jsx(_n,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"plan_style",children:"说话规则与行为风格"}),a.jsx(_n,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"visual_style",children:"识图规则"}),a.jsx(_n,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"private_plan_style",children:"私聊规则"}),a.jsx(_n,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"状态列表(人格多样性)"}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),a.jsx("div",{className:"space-y-2",children:t.states.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(_n,{value:i,onChange:c=>s(l,c.target.value),placeholder:"描述一个人格状态",rows:2}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsx(dn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(l),children:"删除"})]})]})]})]},l))})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"state_probability",children:"状态替换概率"}),a.jsx(Me,{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)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function Xee({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=c=>{e({...t,talk_value_rules:t.talk_value_rules.filter((d,h)=>h!==c)})},s=(c,d,h)=>{const m=[...t.talk_value_rules];m[c]={...m[c],[d]:h},e({...t,talk_value_rules:m})},i=({value:c,onChange:d})=>{const[h,m]=S.useState("00"),[p,x]=S.useState("00"),[v,b]=S.useState("23"),[k,O]=S.useState("59");S.useEffect(()=>{const T=c.split("-");if(T.length===2){const[A,_]=T,[D,E]=A.split(":"),[z,Q]=_.split(":");D&&m(D.padStart(2,"0")),E&&x(E.padStart(2,"0")),z&&b(z.padStart(2,"0")),Q&&O(Q.padStart(2,"0"))}},[c]);const j=(T,A,_,D)=>{const E=`${T}:${A}-${_}:${D}`;d(E)};return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[a.jsx(dc,{className:"h-4 w-4 mr-2"}),c||"选择时间段"]})}),a.jsx(fl,{className:"w-80",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:h,onValueChange:T=>{m(T),j(T,p,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:p,onValueChange:T=>{x(T),j(h,T,v,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"小时"}),a.jsxs(Lt,{value:v,onValueChange:T=>{b(T),j(h,p,T,k)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:24},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-xs",children:"分钟"}),a.jsxs(Lt,{value:k,onValueChange:T=>{O(T),j(h,p,v,T)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:Array.from({length:60},(T,A)=>A).map(T=>a.jsx(Pe,{value:T.toString().padStart(2,"0"),children:T.toString().padStart(2,"0")},T))})]})]})]})]})]})})]})},l=({rule:c})=>{const d=`{ target = "${c.target}", time = "${c.time}", value = ${c.value.toFixed(1)} }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:d}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),a.jsx(Me,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:c=>e({...t,talk_value:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"mentioned_bot_reply",children:"提及回复增幅"}),a.jsx(Me,{id:"mentioned_bot_reply",type:"number",step:"0.1",min:"0",max:"1",value:t.mentioned_bot_reply,onChange:c=>e({...t,mentioned_bot_reply:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"提及时回复概率增幅,1 为 100% 回复"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_context_size",children:"上下文长度"}),a.jsx(Me,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:c=>e({...t,max_context_size:parseInt(c.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"planner_smooth",children:"规划器平滑"}),a.jsx(Me,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:c=>e({...t,planner_smooth:parseFloat(c.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:c=>e({...t,enable_talk_value_rules:c})}),a.jsx(te,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:c=>e({...t,include_planner_reasoning:c})}),a.jsx(te,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&a.jsxs("div",{className:"border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),a.jsxs(ie,{onClick:n,size:"sm",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?a.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((c,d)=>a.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",d+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(l,{rule:c}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{variant:"ghost",size:"sm",children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除规则 #",d+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(d),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:c.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(d,"target",""):s(d,"target","qq::group")},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",children:"详细配置"})]})]})]}),c.target!==""&&(()=>{const h=c.target.split(":"),m=h[0]||"qq",p=h[1]||"",x=h[2]||"group";return a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:m,onValueChange:v=>{s(d,"target",`${v}:${p}:${x}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:p,onChange:v=>{s(d,"target",`${m}:${v.target.value}:${x}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:x,onValueChange:v=>{s(d,"target",`${m}:${p}:${v}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",c.target||"(未设置)"]})]})})(),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"时间段 (Time)"}),a.jsx(i,{value:c.time,onChange:h=>s(d,"time",h)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{htmlFor:`rule-value-${d}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),a.jsx(Me,{id:`rule-value-${d}`,type:"number",step:"0.01",min:"0",max:"1",value:c.value,onChange:h=>{const m=parseFloat(h.target.value);isNaN(m)||s(d,"value",Math.max(0,Math.min(1,m)))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[c.value],onValueChange:h=>s(d,"value",h[0]),min:0,max:1,step:.01,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (完全沉默)"}),a.jsx("span",{children:"0.5"}),a.jsx("span",{children:"1.0 (正常)"})]})]})]})]},d))}):a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:a.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),a.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:[a.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),a.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),a.jsxs("li",{children:["• ",a.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function Yee({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=x=>{e({...t,learning_list:t.learning_list.filter((v,b)=>b!==x)})},s=(x,v,b)=>{const k=[...t.learning_list];k[x][v]=b,e({...t,learning_list:k})},i=({rule:x})=>{const v=`["${x[0]}", "${x[1]}", "${x[2]}", "${x[3]}"]`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-96",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:v}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},l=({member:x,groupIndex:v,memberIndex:b,availableChatIds:k})=>{const O=k.includes(x)||x==="*",[j,T]=S.useState(!O);return a.jsxs("div",{className:"flex gap-2",children:[a.jsx("div",{className:"flex-1 flex gap-2",children:j?a.jsxs(a.Fragment,{children:[a.jsx(Me,{value:x,onChange:A=>p(v,b,A.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),k.length>0&&a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!1),title:"切换到下拉选择",children:"下拉"})]}):a.jsxs(a.Fragment,{children:[a.jsxs(Lt,{value:x,onValueChange:A=>p(v,b,A),children:[a.jsx(Dt,{className:"flex-1",children:a.jsx(It,{placeholder:"选择聊天流"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"*",children:"* (全局共享)"}),k.map((A,_)=>a.jsx(Pe,{value:A,children:A},_))]})]}),a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>T(!0),title:"切换到手动输入",children:"输入"})]})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除组成员 "',x||"(空)",'" 吗?此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>m(v,b),children:"删除"})]})]})]})]})},c=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},d=x=>{e({...t,expression_groups:t.expression_groups.filter((v,b)=>b!==x)})},h=x=>{const v=[...t.expression_groups];v[x]=[...v[x],""],e({...t,expression_groups:v})},m=(x,v)=>{const b=[...t.expression_groups];b[x]=b[x].filter((k,O)=>O!==v),e({...t,expression_groups:b})},p=(x,v,b)=>{const k=[...t.expression_groups];k[x][v]=b,e({...t,expression_groups:k})};return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),a.jsxs(ie,{onClick:n,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((x,v)=>{const b=t.learning_list.some((_,D)=>D!==v&&_[0]===""),k=x[0]==="",O=x[0].split(":"),j=O[0]||"qq",T=O[1]||"",A=O[2]||"group";return a.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["规则 ",v+1," ",k&&"(全局配置)"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(i,{rule:x}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除学习规则 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r(v),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"配置类型"}),a.jsxs(Lt,{value:k?"global":"specific",onValueChange:_=>{_==="global"?s(v,0,""):s(v,0,"qq::group")},disabled:b&&!k,children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"global",children:"全局配置"}),a.jsx(Pe,{value:"specific",disabled:b&&!k,children:"详细配置"})]})]}),b&&!k&&a.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!k&&a.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"平台"}),a.jsxs(Lt,{value:j,onValueChange:_=>{s(v,0,`${_}:${T}:${A}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"qq",children:"QQ"}),a.jsx(Pe,{value:"wx",children:"微信"})]})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"群 ID"}),a.jsx(Me,{value:T,onChange:_=>{s(v,0,`${j}:${_.target.value}:${A}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"类型"}),a.jsxs(Lt,{value:A,onValueChange:_=>{s(v,0,`${j}:${T}:${_}`)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"group",children:"群组(group)"}),a.jsx(Pe,{value:"private",children:"私聊(private)"})]})]})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",x[0]||"(未设置)"]})]}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"使用学到的表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),a.jsx(jt,{checked:x[1]==="enable",onCheckedChange:_=>s(v,1,_?"enable":"disable")})]})}),a.jsx("div",{className:"grid gap-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-xs font-medium",children:"学习表达"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),a.jsx(jt,{checked:x[2]==="enable",onCheckedChange:_=>s(v,2,_?"enable":"disable")})]})}),a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"学习强度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"5",value:x[3],onChange:_=>{const D=parseFloat(_.target.value);isNaN(D)||s(v,3,Math.max(0,Math.min(5,D)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),a.jsx(yx,{value:[parseFloat(x[3])||1],onValueChange:_=>s(v,3,_[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"0 (不学习)"}),a.jsx("span",{children:"2.5"}),a.jsx("span",{children:"5.0 (快速学习)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},v)}),t.learning_list.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),a.jsxs(ie,{onClick:c,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),a.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((x,v)=>{const b=t.learning_list.map(k=>k[0]).filter(k=>k!=="");return a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",v+1,x.length===1&&x[0]==="*"&&"(全局共享)"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ie,{onClick:()=>h(v),size:"sm",variant:"outline",children:a.jsx(Wr,{className:"h-4 w-4"})}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除共享组 ",v+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>d(v),children:"删除"})]})]})]})]})]}),a.jsx("div",{className:"space-y-2",children:x.map((k,O)=>a.jsx(l,{member:k,groupIndex:v,memberIndex:O,availableChatIds:b},O))}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},v)}),t.expression_groups.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function Kee({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:l=>i({...n,enable_tool:l})}),a.jsx(te,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),a.jsx(Me,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:l=>s({...e,max_agent_iterations:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),a.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"emoji_chance",children:"表情包激活概率"}),a.jsx(Me,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:l=>r({...t,emoji_chance:parseFloat(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_reg_num",children:"最大注册数量"}),a.jsx(Me,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:l=>r({...t,max_reg_num:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),a.jsx(Me,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:l=>r({...t,check_interval:parseInt(l.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"do_replace",checked:t.do_replace,onCheckedChange:l=>r({...t,do_replace:l})}),a.jsx(te,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:l=>r({...t,steal_emoji:l})}),a.jsx(te,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:l=>r({...t,content_filtration:l})}),a.jsx(te,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&a.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[a.jsx(te,{htmlFor:"filtration_prompt",children:"过滤要求"}),a.jsx(Me,{id:"filtration_prompt",value:t.filtration_prompt,onChange:l=>r({...t,filtration_prompt:l.target.value}),placeholder:"符合公序良俗"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function Zee({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:l,onResponseSplitterChange:c}){const d=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=_=>{s({...t,regex_rules:t.regex_rules.filter((D,E)=>E!==_)})},m=(_,D,E)=>{const z=[...t.regex_rules];D==="regex"&&typeof E=="string"?z[_]={...z[_],regex:[E]}:D==="reaction"&&typeof E=="string"&&(z[_]={...z[_],reaction:E}),s({...t,regex_rules:z})},p=({regex:_,reaction:D,onRegexChange:E,onReactionChange:z})=>{const[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState({}),[ne,ue]=S.useState(""),R=S.useRef(null),[me,Y]=S.useState("build"),P=ve=>ve.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),K=(ve,Re=0)=>{const de=R.current;if(!de)return;const We=de.selectionStart||0,ct=de.selectionEnd||0,Oe=_.substring(0,We)+ve+_.substring(ct);E(Oe),setTimeout(()=>{const nt=We+ve.length+Re;de.setSelectionRange(nt,nt),de.focus()},0)};S.useEffect(()=>{if(!_||!L){ce(null),ae({}),ue(D),J("");return}try{const ve=P(_),Re=new RegExp(ve,"g"),de=L.match(Re);ce(de),J("");const ct=new RegExp(ve).exec(L);if(ct&&ct.groups){ae(ct.groups);let Oe=D;Object.entries(ct.groups).forEach(([nt,ut])=>{Oe=Oe.replace(new RegExp(`\\[${nt}\\]`,"g"),ut||"")}),ue(Oe)}else ae({}),ue(D)}catch(ve){J(ve.message),ce(null),ae({}),ue(D)}},[_,L,D]);const H=()=>{if(!L||!V||V.length===0)return a.jsx("span",{className:"text-muted-foreground",children:L||"请输入测试文本"});try{const ve=P(_),Re=new RegExp(ve,"g");let de=0;const We=[];let ct;for(;(ct=Re.exec(L))!==null;)ct.index>de&&We.push(a.jsx("span",{children:L.substring(de,ct.index)},`text-${de}`)),We.push(a.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:ct[0]},`match-${ct.index}`)),de=ct.index+ct[0].length;return de)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return a.jsxs(Rr,{open:Q,onOpenChange:F,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(fg,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"正则表达式编辑器"}),a.jsx(Gr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),a.jsx(mn,{className:"max-h-[calc(90vh-120px)]",children:a.jsxs(hl,{value:me,onValueChange:ve=>Y(ve),className:"w-full",children:[a.jsxs(ya,{className:"grid w-full grid-cols-2",children:[a.jsx($t,{value:"build",children:"🔧 构建器"}),a.jsx($t,{value:"test",children:"🧪 测试器"})]}),a.jsxs(kn,{value:"build",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"正则表达式"}),a.jsx(Me,{ref:R,value:_,onChange:ve=>E(ve.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 内容"}),a.jsx(_n,{value:D,onChange:ve=>z(ve.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),a.jsxs("div",{className:"space-y-4 border-t pt-4",children:[fe.map(ve=>a.jsxs("div",{className:"space-y-2",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:ve.category}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:ve.items.map(Re=>a.jsx(ie,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>K(Re.pattern,Re.moveCursor||0),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("div",{className:"flex items-center gap-2 w-full",children:[a.jsx("span",{className:"text-xs font-medium",children:Re.label}),a.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:Re.pattern})]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:Re.desc})]})},Re.label))})]},ve.category)),a.jsxs("div",{className:"space-y-2 border-t pt-4",children:[a.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),a.jsx(ie,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:a.jsxs("div",{className:"flex flex-col items-start w-full",children:[a.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),a.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),a.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:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),a.jsxs("li",{children:["命名捕获组格式:",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),a.jsxs("li",{children:["在 reaction 中使用 ",a.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),a.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),a.jsxs(kn,{value:"test",className:"space-y-4 mt-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"当前正则表达式"}),a.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:_||"(未设置)"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),a.jsx(_n,{id:"test-text",value:L,onChange:ve=>U(ve.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),W&&a.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[a.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),a.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:W})]}),!W&&L&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),a.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"匹配高亮"}),a.jsx(mn,{className:"h-40 rounded-md bg-muted p-3",children:a.jsx("div",{className:"text-sm break-words",children:H()})})]}),Object.keys($).length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"命名捕获组"}),a.jsx(mn,{className:"h-32 rounded-md border p-3",children:a.jsx("div",{className:"space-y-2",children:Object.entries($).map(([ve,Re])=>a.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[a.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",ve,"]"]}),a.jsx("span",{className:"text-muted-foreground",children:"="}),a.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:Re})]},ve))})})]}),Object.keys($).length>0&&D&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{className:"text-sm font-medium",children:"Reaction 替换预览"}),a.jsx(mn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:a.jsx("div",{className:"text-sm break-words",children:ne})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),a.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:[a.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),a.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[a.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),a.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),a.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),a.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},x=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},v=_=>{s({...t,keyword_rules:t.keyword_rules.filter((D,E)=>E!==_)})},b=(_,D,E)=>{const z=[...t.keyword_rules];typeof E=="string"&&(z[_]={...z[_],reaction:E}),s({...t,keyword_rules:z})},k=_=>{const D=[...t.keyword_rules];D[_]={...D[_],keywords:[...D[_].keywords||[],""]},s({...t,keyword_rules:D})},O=(_,D)=>{const E=[...t.keyword_rules];E[_]={...E[_],keywords:(E[_].keywords||[]).filter((z,Q)=>Q!==D)},s({...t,keyword_rules:E})},j=(_,D,E)=>{const z=[...t.keyword_rules],Q=[...z[_].keywords||[]];Q[D]=E,z[_]={...z[_],keywords:Q},s({...t,keyword_rules:z})},T=({rule:_})=>{const D=`{ regex = [${(_.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${_.reaction}" }`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(mn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},A=({rule:_})=>{const D=`[[keyword_reaction.keyword_rules]] keywords = [${(_.keywords||[]).map(E=>`"${E}"`).join(", ")}] -reaction = "${_.reaction}"`;return a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"预览"]})}),a.jsx(fl,{className:"w-[95vw] sm:w-[500px]",children:a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),a.jsx(vn,{className:"h-60 rounded-md bg-muted p-3",children:a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:D})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),a.jsxs(ie,{onClick:d,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(p,{regex:_.regex&&_.regex[0]||"",reaction:_.reaction,onRegexChange:E=>m(D,"regex",E),onReactionChange:E=>m(D,"reaction",E)}),a.jsx(T,{rule:_}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除正则规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>h(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),a.jsx(Me,{value:_.regex&&_.regex[0]||"",onChange:E=>m(D,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>m(D,"reaction",E.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},D)),t.regex_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),a.jsxs("div",{className:"space-y-4 border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),a.jsxs(ie,{onClick:x,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(A,{rule:_}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除关键词规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>v(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"关键词列表"}),a.jsxs(ie,{onClick:()=>k(D),size:"sm",variant:"ghost",children:[a.jsx(Wr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),a.jsxs("div",{className:"space-y-2",children:[(_.keywords||[]).map((E,R)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{value:E,onChange:Q=>j(D,R,Q.target.value),placeholder:"关键词",className:"flex-1"}),a.jsx(ie,{onClick:()=>O(D,R),size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})]},R)),(!_.keywords||_.keywords.length===0)&&a.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>b(D,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},D)),t.keyword_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:_=>i({...e,enable_response_post_process:_})}),a.jsx(te,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:_=>l({...n,enable:_})}),a.jsx(te,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),a.jsx(Me,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:_=>l({...n,error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),a.jsx(Me,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:_=>l({...n,min_freq:parseInt(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),a.jsx(Me,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:_=>l({...n,tone_error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),a.jsx(Me,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:_=>l({...n,word_replace_rate:parseFloat(_.target.value)})})]})]})]})}),a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:_=>c({...r,enable:_})}),a.jsx(te,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),a.jsx(Me,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:_=>c({...r,max_length:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),a.jsx(Me,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:_=>c({...r,max_sentence_num:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:_=>c({...r,enable_kaomoji_protection:_})}),a.jsx(te,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:_=>c({...r,enable_overflow_return_all:_})}),a.jsx(te,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function Jee({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情绪更新阈值"}),a.jsx(Me,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情感特征"}),a.jsx(_n,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function ete({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用语音识别"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function tte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"LPMM 模式"}),a.jsxs(Lt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[a.jsx(Dt,{children:a.jsx(It,{placeholder:"选择 LPMM 模式"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"classic",children:"经典模式"}),a.jsx(Pe,{value:"agent",children:"Agent 模式"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词搜索 TopK"}),a.jsx(Me,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词阈值"}),a.jsx(Me,{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)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"实体提取线程数"}),a.jsx(Me,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"嵌入向量维度"}),a.jsx(Me,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function nte({config:t,onChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState("WARNING"),l=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},c=v=>{e({...t,suppress_libraries:t.suppress_libraries.filter(b=>b!==v)})},d=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=v=>{const b={...t.library_log_levels};delete b[v],e({...t,library_log_levels:b})},m=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],p=["FULL","compact","lite"],x=["none","title","full"];return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日期格式"}),a.jsx(Me,{value:t.date_style,onChange:v=>e({...t,date_style:v.target.value}),placeholder:"例如: m-d H:i:s"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志级别样式"}),a.jsxs(Lt,{value:t.log_level_style,onValueChange:v=>e({...t,log_level_style:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:p.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志文本颜色"}),a.jsxs(Lt,{value:t.color_text,onValueChange:v=>e({...t,color_text:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:x.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"全局日志级别"}),a.jsxs(Lt,{value:t.log_level,onValueChange:v=>e({...t,log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"控制台日志级别"}),a.jsxs(Lt,{value:t.console_log_level,onValueChange:v=>e({...t,console_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"文件日志级别"}),a.jsxs(Lt,{value:t.file_log_level,onValueChange:v=>e({...t,file_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"完全屏蔽的库"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),l())}}),a.jsx(ie,{onClick:l,size:"sm",className:"flex-shrink-0",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(v=>a.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[a.jsx("span",{className:"text-sm",children:v}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>c(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},v))})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"特定库的日志级别"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1"}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsx(Dt,{className:"w-32",children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]}),a.jsx(ie,{onClick:d,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([v,b])=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-medium",children:v}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:b}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},v))})]})]})}function rte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),a.jsx(jt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),a.jsx(jt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器推理"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),a.jsx(jt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Jargon Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),a.jsx(jt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]})]})]})}function ste({config:t,onChange:e}){const[n,r]=S.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=l=>{e({...t,auth_token:t.auth_token.filter((c,d)=>d!==l)})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用自定义服务器"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),a.jsx(jt,{checked:t.use_custom,onCheckedChange:l=>e({...t,use_custom:l})})]}),t.use_custom&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"主机地址"}),a.jsx(Me,{value:t.host,onChange:l=>e({...t,host:l.target.value}),placeholder:"127.0.0.1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"端口号"}),a.jsx(Me,{type:"number",value:t.port,onChange:l=>e({...t,port:parseInt(l.target.value)}),placeholder:"8090"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"连接模式"}),a.jsxs(Lt,{value:t.mode,onValueChange:l=>e({...t,mode:l}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"ws",children:"WebSocket (ws)"}),a.jsx(Pe,{value:"tcp",children:"TCP"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.use_wss,onCheckedChange:l=>e({...t,use_wss:l}),disabled:t.mode!=="ws"}),a.jsx(te,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 证书文件路径"}),a.jsx(Me,{value:t.cert_file,onChange:l=>e({...t,cert_file:l.target.value}),placeholder:"cert.pem"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 密钥文件路径"}),a.jsx(Me,{value:t.key_file,onChange:l=>e({...t,key_file:l.target.value}),placeholder:"key.pem"})]})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"认证令牌"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:l=>r(l.target.value),placeholder:"输入认证令牌",onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),s())}}),a.jsx(ie,{onClick:s,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:t.auth_token.map((l,c)=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-mono",children:l}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(c),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},c))})]})]})}function ite({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用统计信息发送"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Mc=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Mc.displayName="Table";const Ec=S.forwardRef(({className:t,...e},n)=>a.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Ec.displayName="TableHeader";const _c=S.forwardRef(({className:t,...e},n)=>a.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));_c.displayName="TableBody";const ate=S.forwardRef(({className:t,...e},n)=>a.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));ate.displayName="TableFooter";const xr=S.forwardRef(({className:t,...e},n)=>a.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));xr.displayName="TableRow";const xt=S.forwardRef(({className:t,...e},n)=>a.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}));xt.displayName="TableHead";const it=S.forwardRef(({className:t,...e},n)=>a.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));it.displayName="TableCell";const lte=S.forwardRef(({className:t,...e},n)=>a.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));lte.displayName="TableCaption";const ss=S.forwardRef(({className:t,...e},n)=>a.jsx(A9,{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:a.jsx(rq,{className:ye("grid place-content-center text-current"),children:a.jsx(hc,{className:"h-4 w-4"})})}));ss.displayName=A9.displayName;function ote(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(null),[T,A]=S.useState(null),[_,D]=S.useState(!1),[E,R]=S.useState(null),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,de]=S.useState(new Set),[W,J]=S.useState(!1),[$,ae]=S.useState(1),[ne,ce]=S.useState(20),[z,xe]=S.useState(""),{toast:Y}=Pr(),P=S.useRef(null),K=S.useRef(!0);S.useEffect(()=>{H()},[]);const H=async()=>{try{r(!0);const ee=await Vu();e(ee.api_providers||[]),h(!1),K.current=!1}catch(ee){console.error("加载配置失败:",ee)}finally{r(!1)}},fe=async()=>{try{p(!0),xw().catch(()=>{}),v(!0)}catch(ee){console.error("重启失败:",ee),v(!1),Y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),p(!1)}},ve=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"正在重启麦麦..."}),await fe()}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"}),i(!1)}},Re=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ue=()=>{v(!1),p(!1),Y({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},We=S.useCallback(async ee=>{if(!K.current)try{c(!0),await h2("api_providers",ee),h(!1)}catch(Se){console.error("自动保存失败:",Se),h(!0)}finally{c(!1)}},[]);S.useEffect(()=>{if(!K.current)return h(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{We(t)},2e3),()=>{P.current&&clearTimeout(P.current)}},[t,We]);const ct=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"模型提供商配置已保存"})}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"})}finally{i(!1)}},Oe=(ee,Se)=>{j(ee||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),A(Se),F(!1),k(!0)},nt=async()=>{if(O?.api_key)try{await navigator.clipboard.writeText(O.api_key),Y({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Y({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},ut=()=>{if(!O)return;const ee={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};if(T!==null){const Se=[...t];Se[T]=ee,e(Se)}else e([...t,ee]);k(!1),j(null),A(null)},Ct=ee=>{if(!ee&&O){const Se={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};j(Se)}k(ee)},In=ee=>{R(ee),D(!0)},Tn=()=>{if(E!==null){const ee=t.filter((Se,Be)=>Be!==E);e(ee),Y({title:"删除成功",description:"提供商已从列表中移除"})}D(!1),R(null)},Jn=ee=>{const Se=new Set(V);Se.has(ee)?Se.delete(ee):Se.add(ee),de(Se)},nn=()=>{if(V.size===qn.length)de(new Set);else{const ee=qn.map((Se,Be)=>t.findIndex(rt=>rt===qn[Be]));de(new Set(ee))}},_t=()=>{if(V.size===0){Y({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}J(!0)},Yr=()=>{const ee=t.filter((Se,Be)=>!V.has(Be));e(ee),de(new Set),J(!1),Y({title:"批量删除成功",description:`已删除 ${V.size} 个提供商`})},qn=t.filter(ee=>{if(!L)return!0;const Se=L.toLowerCase();return ee.name.toLowerCase().includes(Se)||ee.base_url.toLowerCase().includes(Se)||ee.client_type.toLowerCase().includes(Se)}),or=Math.ceil(qn.length/ne),yn=qn.slice(($-1)*ne,$*ne),ft=()=>{const ee=parseInt(z);ee>=1&&ee<=or&&(ae(ee),xe(""))};return n?a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[V.size>0&&a.jsxs(ie,{onClick:_t,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",V.size,")"]}),a.jsxs(ie,{onClick:()=>Oe(null,null),size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),a.jsxs(ie,{onClick:ct,disabled:s||l||!d||m,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":l?"自动保存中...":d?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:s||l||m,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),m?"重启中...":d?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:d?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:d?ve:fe,children:d?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(vn,{className:"h-[calc(100vh-260px)]",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索提供商名称、URL 或类型...",value:L,onChange:ee=>U(ee.target.value),className:"pl-9"})]}),L&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qn.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:qn.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"font-semibold text-base truncate",children:ee.name}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ee.base_url})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),a.jsx("p",{className:"font-medium",children:ee.client_type})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),a.jsx("p",{className:"font-medium",children:ee.max_retry})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),a.jsx("p",{className:"font-medium",children:ee.timeout})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),a.jsx("p",{className:"font-medium",children:ee.retry_interval})]})]})]},Se)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:V.size===qn.length&&qn.length>0,onCheckedChange:nn})}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"基础URL"}),a.jsx(xt,{children:"客户端类型"}),a.jsx(xt,{className:"text-right",children:"最大重试"}),a.jsx(xt,{className:"text-right",children:"超时(秒)"}),a.jsx(xt,{className:"text-right",children:"重试间隔(秒)"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:yn.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center text-muted-foreground py-8",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Be),onCheckedChange:()=>Jn(Be)})}),a.jsx(it,{className:"font-medium",children:ee.name}),a.jsx(it,{className:"max-w-xs truncate",title:ee.base_url,children:ee.base_url}),a.jsx(it,{children:ee.client_type}),a.jsx(it,{className:"text-right",children:ee.max_retry}),a.jsx(it,{className:"text-right",children:ee.timeout}),a.jsx(it,{className:"text-right",children:ee.retry_interval}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Se)})})]})}),qn.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:ne.toString(),onValueChange:ee=>{ce(parseInt(ee)),ae(1),de(new Set)},children:[a.jsx(Dt,{id:"page-size-provider",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",($-1)*ne+1," 到"," ",Math.min($*ne,qn.length)," 条,共 ",qn.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:$===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>Math.max(1,ee-1)),disabled:$===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:z,onChange:ee=>xe(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&ft(),placeholder:$.toString(),className:"w-16 h-8 text-center",min:1,max:or}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ft,disabled:!z,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>ee+1),disabled:$>=or,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(or),disabled:$>=or,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsx(Rr,{open:b,onOpenChange:Ct,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:T!==null?"编辑提供商":"添加提供商"}),a.jsx(Gr,{children:"配置 API 提供商的连接信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"name",children:"名称 *"}),a.jsx(Me,{id:"name",value:O?.name||"",onChange:ee=>j(Se=>Se?{...Se,name:ee.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"base_url",children:"基础 URL *"}),a.jsx(Me,{id:"base_url",value:O?.base_url||"",onChange:ee=>j(Se=>Se?{...Se,base_url:ee.target.value}:null),placeholder:"https://api.example.com/v1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_key",children:"API Key *"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"api_key",type:Q?"text":"password",value:O?.api_key||"",onChange:ee=>j(Se=>Se?{...Se,api_key:ee.target.value}:null),placeholder:"sk-...",className:"flex-1"}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:()=>F(!Q),title:Q?"隐藏密钥":"显示密钥",children:Q?a.jsx(Yb,{className:"h-4 w-4"}):a.jsx($i,{className:"h-4 w-4"})}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:nt,title:"复制密钥",children:a.jsx(Xb,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"client_type",children:"客户端类型"}),a.jsxs(Lt,{value:O?.client_type||"openai",onValueChange:ee=>j(Se=>Se?{...Se,client_type:ee}:null),children:[a.jsx(Dt,{id:"client_type",children:a.jsx(It,{placeholder:"选择客户端类型"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"openai",children:"OpenAI"}),a.jsx(Pe,{value:"gemini",children:"Gemini"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_retry",children:"最大重试"}),a.jsx(Me,{id:"max_retry",type:"number",min:"0",value:O?.max_retry??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,max_retry:Se}:null)},placeholder:"默认: 2"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"timeout",children:"超时(秒)"}),a.jsx(Me,{id:"timeout",type:"number",min:"1",value:O?.timeout??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,timeout:Se}:null)},placeholder:"默认: 30"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),a.jsx(Me,{id:"retry_interval",type:"number",min:"1",value:O?.retry_interval??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,retry_interval:Se}:null)},placeholder:"默认: 10"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>k(!1),children:"取消"}),a.jsx(ie,{onClick:ut,children:"保存"})]})]})}),a.jsx(mn,{open:_,onOpenChange:D,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除提供商 "',E!==null?t[E]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Tn,children:"删除"})]})]})}),a.jsx(mn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",V.size," 个提供商吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Yr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),x&&a.jsx(vw,{onRestartComplete:Re,onRestartFailed:ue})]})}var a8=1,cte=.9,ute=.8,dte=.17,cb=.1,ub=.999,hte=.9999,fte=.99,mte=/[\\\/_+.#"@\[\(\{&]/,pte=/[\\\/_+.#"@\[\(\{&]/g,gte=/[\s-]/,L_=/[\s-]/g;function u4(t,e,n,r,s,i,l){if(i===e.length)return s===t.length?a8:fte;var c=`${s},${i}`;if(l[c]!==void 0)return l[c];for(var d=r.charAt(i),h=n.indexOf(d,s),m=0,p,x,v,b;h>=0;)p=u4(t,e,n,r,h+1,i+1,l),p>m&&(h===s?p*=a8:mte.test(t.charAt(h-1))?(p*=ute,v=t.slice(s,h-1).match(pte),v&&s>0&&(p*=Math.pow(ub,v.length))):gte.test(t.charAt(h-1))?(p*=cte,b=t.slice(s,h-1).match(L_),b&&s>0&&(p*=Math.pow(ub,b.length))):(p*=dte,s>0&&(p*=Math.pow(ub,h-s))),t.charAt(h)!==e.charAt(i)&&(p*=hte)),(pp&&(p=x*cb)),p>m&&(m=p),h=n.indexOf(d,h+1);return l[c]=m,m}function l8(t){return t.toLowerCase().replace(L_," ")}function xte(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,u4(t,e,l8(t),l8(e),0,0,{})}var vte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],To=vte.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Bh='[cmdk-group=""]',db='[cmdk-group-items=""]',yte='[cmdk-group-heading=""]',I_='[cmdk-item=""]',o8=`${I_}:not([aria-disabled="true"])`,d4="cmdk-item-select",Pu="data-value",bte=(t,e,n)=>xte(t,e,n),q_=S.createContext(void 0),g0=()=>S.useContext(q_),F_=S.createContext(void 0),o5=()=>S.useContext(F_),Q_=S.createContext(void 0),$_=S.forwardRef((t,e)=>{let n=Bu(()=>{var Y,P;return{search:"",value:(P=(Y=t.value)!=null?Y:t.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Bu(()=>new Set),s=Bu(()=>new Map),i=Bu(()=>new Map),l=Bu(()=>new Set),c=H_(t),{label:d,children:h,value:m,onValueChange:p,filter:x,shouldFilter:v,loop:b,disablePointerSelection:k=!1,vimBindings:O=!0,...j}=t,T=ji(),A=ji(),_=ji(),D=S.useRef(null),E=Ete();Nc(()=>{if(m!==void 0){let Y=m.trim();n.current.value=Y,R.emit()}},[m]),Nc(()=>{E(6,de)},[]);let R=S.useMemo(()=>({subscribe:Y=>(l.current.add(Y),()=>l.current.delete(Y)),snapshot:()=>n.current,setState:(Y,P,K)=>{var H,fe,ve,Re;if(!Object.is(n.current[Y],P)){if(n.current[Y]=P,Y==="search")V(),L(),E(1,U);else if(Y==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ue=document.getElementById(_);ue?ue.focus():(H=document.getElementById(T))==null||H.focus()}if(E(7,()=>{var ue;n.current.selectedItemId=(ue=W())==null?void 0:ue.id,R.emit()}),K||E(5,de),((fe=c.current)==null?void 0:fe.value)!==void 0){let ue=P??"";(Re=(ve=c.current).onValueChange)==null||Re.call(ve,ue);return}}R.emit()}},emit:()=>{l.current.forEach(Y=>Y())}}),[]),Q=S.useMemo(()=>({value:(Y,P,K)=>{var H;P!==((H=i.current.get(Y))==null?void 0:H.value)&&(i.current.set(Y,{value:P,keywords:K}),n.current.filtered.items.set(Y,F(P,K)),E(2,()=>{L(),R.emit()}))},item:(Y,P)=>(r.current.add(Y),P&&(s.current.has(P)?s.current.get(P).add(Y):s.current.set(P,new Set([Y]))),E(3,()=>{V(),L(),n.current.value||U(),R.emit()}),()=>{i.current.delete(Y),r.current.delete(Y),n.current.filtered.items.delete(Y);let K=W();E(4,()=>{V(),K?.getAttribute("id")===Y&&U(),R.emit()})}),group:Y=>(s.current.has(Y)||s.current.set(Y,new Set),()=>{i.current.delete(Y),s.current.delete(Y)}),filter:()=>c.current.shouldFilter,label:d||t["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:T,inputId:_,labelId:A,listInnerRef:D}),[]);function F(Y,P){var K,H;let fe=(H=(K=c.current)==null?void 0:K.filter)!=null?H:bte;return Y?fe(Y,n.current.search,P):0}function L(){if(!n.current.search||c.current.shouldFilter===!1)return;let Y=n.current.filtered.items,P=[];n.current.filtered.groups.forEach(H=>{let fe=s.current.get(H),ve=0;fe.forEach(Re=>{let ue=Y.get(Re);ve=Math.max(ue,ve)}),P.push([H,ve])});let K=D.current;J().sort((H,fe)=>{var ve,Re;let ue=H.getAttribute("id"),We=fe.getAttribute("id");return((ve=Y.get(We))!=null?ve:0)-((Re=Y.get(ue))!=null?Re:0)}).forEach(H=>{let fe=H.closest(db);fe?fe.appendChild(H.parentElement===fe?H:H.closest(`${db} > *`)):K.appendChild(H.parentElement===K?H:H.closest(`${db} > *`))}),P.sort((H,fe)=>fe[1]-H[1]).forEach(H=>{var fe;let ve=(fe=D.current)==null?void 0:fe.querySelector(`${Bh}[${Pu}="${encodeURIComponent(H[0])}"]`);ve?.parentElement.appendChild(ve)})}function U(){let Y=J().find(K=>K.getAttribute("aria-disabled")!=="true"),P=Y?.getAttribute(Pu);R.setState("value",P||void 0)}function V(){var Y,P,K,H;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let fe=0;for(let ve of r.current){let Re=(P=(Y=i.current.get(ve))==null?void 0:Y.value)!=null?P:"",ue=(H=(K=i.current.get(ve))==null?void 0:K.keywords)!=null?H:[],We=F(Re,ue);n.current.filtered.items.set(ve,We),We>0&&fe++}for(let[ve,Re]of s.current)for(let ue of Re)if(n.current.filtered.items.get(ue)>0){n.current.filtered.groups.add(ve);break}n.current.filtered.count=fe}function de(){var Y,P,K;let H=W();H&&(((Y=H.parentElement)==null?void 0:Y.firstChild)===H&&((K=(P=H.closest(Bh))==null?void 0:P.querySelector(yte))==null||K.scrollIntoView({block:"nearest"})),H.scrollIntoView({block:"nearest"}))}function W(){var Y;return(Y=D.current)==null?void 0:Y.querySelector(`${I_}[aria-selected="true"]`)}function J(){var Y;return Array.from(((Y=D.current)==null?void 0:Y.querySelectorAll(o8))||[])}function $(Y){let P=J()[Y];P&&R.setState("value",P.getAttribute(Pu))}function ae(Y){var P;let K=W(),H=J(),fe=H.findIndex(Re=>Re===K),ve=H[fe+Y];(P=c.current)!=null&&P.loop&&(ve=fe+Y<0?H[H.length-1]:fe+Y===H.length?H[0]:H[fe+Y]),ve&&R.setState("value",ve.getAttribute(Pu))}function ne(Y){let P=W(),K=P?.closest(Bh),H;for(;K&&!H;)K=Y>0?Ate(K,Bh):Mte(K,Bh),H=K?.querySelector(o8);H?R.setState("value",H.getAttribute(Pu)):ae(Y)}let ce=()=>$(J().length-1),z=Y=>{Y.preventDefault(),Y.metaKey?ce():Y.altKey?ne(1):ae(1)},xe=Y=>{Y.preventDefault(),Y.metaKey?$(0):Y.altKey?ne(-1):ae(-1)};return S.createElement(To.div,{ref:e,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:Y=>{var P;(P=j.onKeyDown)==null||P.call(j,Y);let K=Y.nativeEvent.isComposing||Y.keyCode===229;if(!(Y.defaultPrevented||K))switch(Y.key){case"n":case"j":{O&&Y.ctrlKey&&z(Y);break}case"ArrowDown":{z(Y);break}case"p":case"k":{O&&Y.ctrlKey&&xe(Y);break}case"ArrowUp":{xe(Y);break}case"Home":{Y.preventDefault(),$(0);break}case"End":{Y.preventDefault(),ce();break}case"Enter":{Y.preventDefault();let H=W();if(H){let fe=new Event(d4);H.dispatchEvent(fe)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:Q.inputId,id:Q.labelId,style:Dte},d),Px(t,Y=>S.createElement(F_.Provider,{value:R},S.createElement(q_.Provider,{value:Q},Y))))}),wte=S.forwardRef((t,e)=>{var n,r;let s=ji(),i=S.useRef(null),l=S.useContext(Q_),c=g0(),d=H_(t),h=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;Nc(()=>{if(!h)return c.item(s,l?.id)},[h]);let m=U_(s,i,[t.value,t.children,i],t.keywords),p=o5(),x=vo(E=>E.value&&E.value===m.current),v=vo(E=>h||c.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);S.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener(d4,b),()=>E.removeEventListener(d4,b)},[v,t.onSelect,t.disabled]);function b(){var E,R;k(),(R=(E=d.current).onSelect)==null||R.call(E,m.current)}function k(){p.setState("value",m.current,!0)}if(!v)return null;let{disabled:O,value:j,onSelect:T,forceMount:A,keywords:_,...D}=t;return S.createElement(To.div,{ref:oo(i,e),...D,id:s,"cmdk-item":"",role:"option","aria-disabled":!!O,"aria-selected":!!x,"data-disabled":!!O,"data-selected":!!x,onPointerMove:O||c.getDisablePointerSelection()?void 0:k,onClick:O?void 0:b},t.children)}),Ste=S.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,l=ji(),c=S.useRef(null),d=S.useRef(null),h=ji(),m=g0(),p=vo(v=>s||m.filter()===!1?!0:v.search?v.filtered.groups.has(l):!0);Nc(()=>m.group(l),[]),U_(l,c,[t.value,t.heading,d]);let x=S.useMemo(()=>({id:l,forceMount:s}),[s]);return S.createElement(To.div,{ref:oo(c,e),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&S.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),Px(t,v=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},S.createElement(Q_.Provider,{value:x},v))))}),kte=S.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=S.useRef(null),i=vo(l=>!l.search);return!n&&!i?null:S.createElement(To.div,{ref:oo(s,e),...r,"cmdk-separator":"",role:"separator"})}),Ote=S.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=o5(),l=vo(h=>h.search),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),S.createElement(To.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:s?t.value:l,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),jte=S.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=S.useRef(null),l=S.useRef(null),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{if(l.current&&i.current){let h=l.current,m=i.current,p,x=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let v=h.offsetHeight;m.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(p),x.unobserve(h)}}},[]),S.createElement(To.div,{ref:oo(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:d.listId},Px(t,h=>S.createElement("div",{ref:oo(l,d.listInnerRef),"cmdk-list-sizer":""},h)))}),Nte=S.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:l,...c}=t;return S.createElement(W4,{open:n,onOpenChange:r},S.createElement($4,{container:l},S.createElement(nx,{"cmdk-overlay":"",className:s}),S.createElement(rx,{"aria-label":t.label,"cmdk-dialog":"",className:i},S.createElement($_,{ref:e,...c}))))}),Cte=S.forwardRef((t,e)=>vo(n=>n.filtered.count===0)?S.createElement(To.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Tte=S.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return S.createElement(To.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Px(t,l=>S.createElement("div",{"aria-hidden":!0},l)))}),Is=Object.assign($_,{List:jte,Item:wte,Input:Ote,Group:Ste,Separator:kte,Dialog:Nte,Empty:Cte,Loading:Tte});function Ate(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Mte(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function H_(t){let e=S.useRef(t);return Nc(()=>{e.current=t}),e}var Nc=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Bu(t){let e=S.useRef();return e.current===void 0&&(e.current=t()),e}function vo(t){let e=o5(),n=()=>t(e.snapshot());return S.useSyncExternalStore(e.subscribe,n,n)}function U_(t,e,n,r=[]){let s=S.useRef(),i=g0();return Nc(()=>{var l;let c=(()=>{var h;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(h=m.current.textContent)==null?void 0:h.trim():s.current}})(),d=r.map(h=>h.trim());i.value(t,c,d),(l=e.current)==null||l.setAttribute(Pu,c),s.current=c}),s}var Ete=()=>{let[t,e]=S.useState(),n=Bu(()=>new Map);return Nc(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function _te(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Px({asChild:t,children:e},n){return t&&S.isValidElement(e)?S.cloneElement(_te(e),{ref:e.ref},n(e.props.children)):n(e)}var Dte={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const V_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));V_.displayName=Is.displayName;const W_=S.forwardRef(({className:t,...e},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(Bs,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Is.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})]}));W_.displayName=Is.Input.displayName;const G_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));G_.displayName=Is.List.displayName;const X_=S.forwardRef((t,e)=>a.jsx(Is.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));X_.displayName=Is.Empty.displayName;const Y_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.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}));Y_.displayName=Is.Group.displayName;const Rte=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));Rte.displayName=Is.Separator.displayName;const K_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.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}));K_.displayName=Is.Item.displayName;function zte({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[l,c]=S.useState(!1),d=m=>{e.includes(m)?n(e.filter(p=>p!==m)):n([...e,m])},h=m=>{n(e.filter(p=>p!==m))};return a.jsxs(uo,{open:l,onOpenChange:c,children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",role:"combobox","aria-expanded":l,className:ye("w-full justify-between min-h-10 h-auto",i),children:[a.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?a.jsx("span",{className:"text-muted-foreground",children:r}):e.map(m=>{const p=t.find(x=>x.value===m);return a.jsxs(On,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:x=>{x.stopPropagation(),h(m)},children:[p?.label||m,a.jsx(Gf,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},m)})}),a.jsx(Sq,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),a.jsx(fl,{className:"w-full p-0",align:"start",children:a.jsxs(V_,{children:[a.jsx(W_,{placeholder:"搜索...",className:"h-9"}),a.jsxs(G_,{children:[a.jsx(X_,{children:s}),a.jsx(Y_,{children:t.map(m=>{const p=e.includes(m.value);return a.jsxs(K_,{value:m.value,onSelect:()=>d(m.value),children:[a.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",p?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:a.jsx(hc,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),a.jsx("span",{children:m.label})]},m.value)})})]})]})})]})}function Pte(){const[t,e]=S.useState([]),[n,r]=S.useState([]),[s,i]=S.useState([]),[l,c]=S.useState(null),[d,h]=S.useState(!0),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,R]=S.useState(null),[Q,F]=S.useState(null),[L,U]=S.useState(!1),[V,de]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState(new Set),[ne,ce]=S.useState(!1),[z,xe]=S.useState(1),[Y,P]=S.useState(20),[K,H]=S.useState(""),{toast:fe}=Pr(),ve=S.useRef(null),Re=S.useRef(null),ue=S.useRef(!0);S.useEffect(()=>{We()},[]);const We=async()=>{try{h(!0);const re=await Vu(),Ae=re.models||[];e(Ae),i(Ae.map(yt=>yt.name));const pt=re.api_providers||[];r(pt.map(yt=>yt.name)),c(re.model_task_config||null),k(!1),ue.current=!1}catch(re){console.error("加载配置失败:",re)}finally{h(!1)}},ct=async()=>{try{j(!0),xw().catch(()=>{}),A(!0)}catch(re){console.error("重启失败:",re),A(!1),fe({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),j(!1)}},Oe=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"正在重启麦麦..."}),await ct()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"}),p(!1)}},nt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ut=()=>{A(!1),j(!1),fe({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ct=S.useCallback(async re=>{if(!ue.current)try{v(!0),await h2("models",re),k(!1)}catch(Ae){console.error("自动保存模型列表失败:",Ae),k(!0)}finally{v(!1)}},[]),In=S.useCallback(async re=>{if(!ue.current)try{v(!0),await h2("model_task_config",re),k(!1)}catch(Ae){console.error("自动保存任务配置失败:",Ae),k(!0)}finally{v(!1)}},[]);S.useEffect(()=>{if(!ue.current)return k(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{Ct(t)},2e3),()=>{ve.current&&clearTimeout(ve.current)}},[t,Ct]),S.useEffect(()=>{if(!(ue.current||!l))return k(!0),Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{In(l)},2e3),()=>{Re.current&&clearTimeout(Re.current)}},[l,In]);const Tn=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"模型配置已保存"}),await We()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"})}finally{p(!1)}},Jn=(re,Ae)=>{R(re||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),F(Ae),D(!0)},nn=()=>{if(!E)return;const re={...E,price_in:E.price_in??0,price_out:E.price_out??0};let Ae;Q!==null?(Ae=[...t],Ae[Q]=re):Ae=[...t,re],e(Ae),i(Ae.map(pt=>pt.name)),D(!1),R(null),F(null)},_t=re=>{if(!re&&E){const Ae={...E,price_in:E.price_in??0,price_out:E.price_out??0};R(Ae)}D(re)},Yr=re=>{de(re),U(!0)},qn=()=>{if(V!==null){const re=t.filter((Ae,pt)=>pt!==V);e(re),i(re.map(Ae=>Ae.name)),fe({title:"删除成功",description:"模型已从列表中移除"})}U(!1),de(null)},or=re=>{const Ae=new Set($);Ae.has(re)?Ae.delete(re):Ae.add(re),ae(Ae)},yn=()=>{if($.size===Be.length)ae(new Set);else{const re=Be.map((Ae,pt)=>t.findIndex(yt=>yt===Be[pt]));ae(new Set(re))}},ft=()=>{if($.size===0){fe({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ce(!0)},ee=()=>{const re=t.filter((Ae,pt)=>!$.has(pt));e(re),i(re.map(Ae=>Ae.name)),ae(new Set),ce(!1),fe({title:"批量删除成功",description:`已删除 ${$.size} 个模型`})},Se=(re,Ae,pt)=>{l&&c({...l,[re]:{...l[re],[Ae]:pt}})},Be=t.filter(re=>{if(!W)return!0;const Ae=W.toLowerCase();return re.name.toLowerCase().includes(Ae)||re.model_identifier.toLowerCase().includes(Ae)||re.api_provider.toLowerCase().includes(Ae)}),rt=Math.ceil(Be.length/Y),Tt=Be.slice((z-1)*Y,z*Y),cr=()=>{const re=parseInt(K);re>=1&&re<=rt&&(xe(re),H(""))},Kr=re=>l?[l.utils?.model_list||[],l.utils_small?.model_list||[],l.tool_use?.model_list||[],l.replyer?.model_list||[],l.planner?.model_list||[],l.vlm?.model_list||[],l.voice?.model_list||[],l.embedding?.model_list||[],l.lpmm_entity_extract?.model_list||[],l.lpmm_rdf_build?.model_list||[],l.lpmm_qa?.model_list||[]].some(pt=>pt.includes(re)):!1;return d?a.jsx(vn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsxs(ie,{onClick:Tn,disabled:m||x||!b||O,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":x?"自动保存中...":b?"保存配置":"已保存"]}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:m||x||O,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),O?"重启中...":b?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:b?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:b?Oe:ct,children:b?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(hl,{defaultValue:"models",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[a.jsx($t,{value:"models",children:"模型配置"}),a.jsx($t,{value:"tasks",children:"模型任务配置"})]}),a.jsxs(kn,{value:"models",className:"space-y-4 mt-0",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[$.size>0&&a.jsxs(ie,{onClick:ft,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",$.size,")"]}),a.jsxs(ie,{onClick:()=>Jn(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索模型名称、标识符或提供商...",value:W,onChange:re=>J(re.target.value),className:"pl-9"})]}),W&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Be.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:Tt.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:W?"未找到匹配的模型":"暂无模型配置"}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("h3",{className:"font-semibold text-base",children:re.name}),a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})]}),a.jsx("p",{className:"text-xs text-muted-foreground break-all",title:re.model_identifier,children:re.model_identifier})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),a.jsx("p",{className:"font-medium",children:re.api_provider})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),a.jsx("p",{className:"font-medium",children:re.force_stream_mode?"是":"否"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_in,"/M"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_out,"/M"]})]})]})]},Ae)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:$.size===Be.length&&Be.length>0,onCheckedChange:yn})}),a.jsx(xt,{className:"w-24",children:"使用状态"}),a.jsx(xt,{children:"模型名称"}),a.jsx(xt,{children:"模型标识符"}),a.jsx(xt,{children:"提供商"}),a.jsx(xt,{className:"text-right",children:"输入价格"}),a.jsx(xt,{className:"text-right",children:"输出价格"}),a.jsx(xt,{className:"text-center",children:"强制流式"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:Tt.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:9,className:"text-center text-muted-foreground py-8",children:W?"未找到匹配的模型":"暂无模型配置"})}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:$.has(pt),onCheckedChange:()=>or(pt)})}),a.jsx(it,{children:a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})}),a.jsx(it,{className:"font-medium",children:re.name}),a.jsx(it,{className:"max-w-xs truncate",title:re.model_identifier,children:re.model_identifier}),a.jsx(it,{children:re.api_provider}),a.jsxs(it,{className:"text-right",children:["¥",re.price_in,"/M"]}),a.jsxs(it,{className:"text-right",children:["¥",re.price_out,"/M"]}),a.jsx(it,{className:"text-center",children:re.force_stream_mode?"是":"否"}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Ae)})})]})}),Be.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:Y.toString(),onValueChange:re=>{P(parseInt(re)),xe(1),ae(new Set)},children:[a.jsx(Dt,{id:"page-size-model",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(z-1)*Y+1," 到"," ",Math.min(z*Y,Be.length)," 条,共 ",Be.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>xe(1),disabled:z===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>xe(re=>Math.max(1,re-1)),disabled:z===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:K,onChange:re=>H(re.target.value),onKeyDown:re=>re.key==="Enter"&&cr(),placeholder:z.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),a.jsx(ie,{variant:"outline",size:"sm",onClick:cr,disabled:!K,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>xe(re=>re+1),disabled:z>=rt,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>xe(rt),disabled:z>=rt,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsxs(kn,{value:"tasks",className:"space-y-6 mt-0",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),l&&a.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[a.jsx(Pi,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:l.utils,modelNames:s,onChange:(re,Ae)=>Se("utils",re,Ae)}),a.jsx(Pi,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:l.utils_small,modelNames:s,onChange:(re,Ae)=>Se("utils_small",re,Ae)}),a.jsx(Pi,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:l.tool_use,modelNames:s,onChange:(re,Ae)=>Se("tool_use",re,Ae)}),a.jsx(Pi,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:l.replyer,modelNames:s,onChange:(re,Ae)=>Se("replyer",re,Ae)}),a.jsx(Pi,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:l.planner,modelNames:s,onChange:(re,Ae)=>Se("planner",re,Ae)}),a.jsx(Pi,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:l.vlm,modelNames:s,onChange:(re,Ae)=>Se("vlm",re,Ae),hideTemperature:!0}),a.jsx(Pi,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:l.voice,modelNames:s,onChange:(re,Ae)=>Se("voice",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsx(Pi,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:l.embedding,modelNames:s,onChange:(re,Ae)=>Se("embedding",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),a.jsx(Pi,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:l.lpmm_entity_extract,modelNames:s,onChange:(re,Ae)=>Se("lpmm_entity_extract",re,Ae)}),a.jsx(Pi,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:l.lpmm_rdf_build,modelNames:s,onChange:(re,Ae)=>Se("lpmm_rdf_build",re,Ae)}),a.jsx(Pi,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:l.lpmm_qa,modelNames:s,onChange:(re,Ae)=>Se("lpmm_qa",re,Ae)})]})]})]})]}),a.jsx(Rr,{open:_,onOpenChange:_t,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:Q!==null?"编辑模型":"添加模型"}),a.jsx(Gr,{children:"配置模型的基本信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_name",children:"模型名称 *"}),a.jsx(Me,{id:"model_name",value:E?.name||"",onChange:re=>R(Ae=>Ae?{...Ae,name:re.target.value}:null),placeholder:"例如: qwen3-30b"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_identifier",children:"模型标识符 *"}),a.jsx(Me,{id:"model_identifier",value:E?.model_identifier||"",onChange:re=>R(Ae=>Ae?{...Ae,model_identifier:re.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_provider",children:"API 提供商 *"}),a.jsxs(Lt,{value:E?.api_provider||"",onValueChange:re=>R(Ae=>Ae?{...Ae,api_provider:re}:null),children:[a.jsx(Dt,{id:"api_provider",children:a.jsx(It,{placeholder:"选择提供商"})}),a.jsx(Rt,{children:n.map(re=>a.jsx(Pe,{value:re,children:re},re))})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),a.jsx(Me,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);R(pt=>pt?{...pt,price_in:Ae}:null)},placeholder:"默认: 0"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),a.jsx(Me,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);R(pt=>pt?{...pt,price_out:Ae}:null)},placeholder:"默认: 0"})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:re=>R(Ae=>Ae?{...Ae,force_stream_mode:re}:null)}),a.jsx(te,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>D(!1),children:"取消"}),a.jsx(ie,{onClick:nn,children:"保存"})]})]})}),a.jsx(mn,{open:L,onOpenChange:U,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:qn,children:"删除"})]})]})}),a.jsx(mn,{open:ne,onOpenChange:ce,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",$.size," 个模型吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&a.jsx(vw,{onRestartComplete:nt,onRestartFailed:ut})]})})}function Pi({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:l=!1}){const c=d=>{s("model_list",d)};return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"模型列表"}),a.jsx(zte,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:c,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"温度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:d=>{const h=parseFloat(d.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),a.jsx(yx,{value:[n.temperature??.3],onValueChange:d=>s("temperature",d[0]),min:0,max:1,step:.1,className:"w-full"})]}),!l&&a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"最大 Token"}),a.jsx(Me,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:d=>s("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Bx="/api/webui/config";async function Bte(){const e=await(await ot(`${Bx}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function Lte(t){const n=await(await ot(`${Bx}/adapter-config/path`,{method:"POST",headers:bt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function Ite(t){const n=await(await ot(`${Bx}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function c8(t,e){const r=await(await ot(`${Bx}/adapter-config`,{method:"POST",headers:bt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Zs={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function qte(){const[t,e]=S.useState("upload"),[n,r]=S.useState(null),[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(""),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(null),_=S.useRef(null),{toast:D}=Pr(),E=S.useRef(null),R=K=>{if(!K.trim())return{valid:!1,error:"路径不能为空"};const H=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,fe=/^(\/|~\/).+\.toml$/i,ve=H.test(K),Re=fe.test(K);return!ve&&!Re?{valid:!1,error:"路径格式错误。Windows: C:\\path\\file.toml,Linux: /path/file.toml"}:K.toLowerCase().endsWith(".toml")?/[<>"|?*\x00-\x1F]/.test(K)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}:{valid:!1,error:"文件必须是 .toml 格式"}},Q=K=>{if(c(K),K.trim()){const H=R(K);h(H.error)}else h("")};S.useEffect(()=>{(async()=>{try{const H=await Bte();H&&H.path&&(c(H.path),e("path"),await F(H.path))}catch(H){console.error("加载保存的路径失败:",H)}})()},[]);const F=async K=>{const H=R(K);if(!H.valid){h(H.error),D({title:"路径无效",description:H.error,variant:"destructive"});return}h(""),v(!0);try{const fe=await Ite(K),ve=ce(fe);r(ve),c(K),await Lte(K),D({title:"加载成功",description:"已从配置文件加载"})}catch(fe){console.error("加载配置失败:",fe),D({title:"加载失败",description:fe instanceof Error?fe.message:"无法读取配置文件",variant:"destructive"})}finally{v(!1)}},L=S.useCallback(K=>{t!=="path"||!l||(E.current&&clearTimeout(E.current),E.current=setTimeout(async()=>{p(!0);try{const H=z(K);await c8(l,H),D({title:"自动保存成功",description:"配置已保存到文件"})}catch(H){console.error("自动保存失败:",H),D({title:"自动保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},1e3))},[t,l,D]),U=async()=>{if(!n||!l)return;const K=R(l);if(!K.valid){D({title:"保存失败",description:K.error,variant:"destructive"});return}p(!0);try{const H=z(n);await c8(l,H),D({title:"保存成功",description:"配置已保存到文件"})}catch(H){console.error("保存失败:",H),D({title:"保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},V=async()=>{l&&await F(l)},de=K=>{if(K!==t){if(n){A(K),k(!0);return}W(K)}},W=K=>{r(null),i(""),h(""),e(K),D({title:"已切换模式",description:K==="upload"?"现在可以上传配置文件":"现在可以指定配置文件路径"})},J=()=>{T&&(W(T),A(null)),k(!1)},$=()=>{if(n){j(!0);return}ae()},ae=()=>{c(""),r(null),h(""),D({title:"已清空",description:"路径和配置已清空"})},ne=()=>{ae(),j(!1)},ce=K=>{const H=JSON.parse(JSON.stringify(Zs)),fe=K.split(` -`);let ve="";for(const Re of fe){const ue=Re.trim();if(!ue||ue.startsWith("#"))continue;const We=ue.match(/^\[(\w+)\]$/);if(We){ve=We[1];continue}const ct=ue.match(/^(\w+)\s*=\s*(.+)$/);if(ct&&ve){const[,Oe,nt]=ct,ut=nt.trim();let Ct;if(ut==="true")Ct=!0;else if(ut==="false")Ct=!1;else if(ut.startsWith("[")&&ut.endsWith("]")){const In=ut.slice(1,-1).trim();if(In){const Tn=In.split(",").map(nn=>{const _t=nn.trim();return isNaN(Number(_t))?_t.replace(/"/g,""):Number(_t)}),Jn=typeof Tn[0];Ct=Tn.every(nn=>typeof nn===Jn)?Tn:Tn.filter(nn=>typeof nn=="number")}else Ct=[]}else ut.startsWith('"')&&ut.endsWith('"')?Ct=ut.slice(1,-1):isNaN(Number(ut))?Ct=ut.replace(/"/g,""):Ct=Number(ut);if(ve in H){const In=H[ve];In[Oe]=Ct}}}return H},z=K=>{const H=[],fe=(ve,Re)=>ve===""||ve===null||ve===void 0?Re:ve;return H.push("[inner]"),H.push(`version = "${fe(K.inner.version,Zs.inner.version)}" # 版本号`),H.push("# 请勿修改版本号,除非你知道自己在做什么"),H.push(""),H.push("[nickname] # 现在没用"),H.push(`nickname = "${fe(K.nickname.nickname,Zs.nickname.nickname)}"`),H.push(""),H.push("[napcat_server] # Napcat连接的ws服务设置"),H.push(`host = "${fe(K.napcat_server.host,Zs.napcat_server.host)}" # Napcat设定的主机地址`),H.push(`port = ${fe(K.napcat_server.port||0,Zs.napcat_server.port)} # Napcat设定的端口`),H.push(`token = "${fe(K.napcat_server.token,Zs.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),H.push(`heartbeat_interval = ${fe(K.napcat_server.heartbeat_interval||0,Zs.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),H.push(""),H.push("[maibot_server] # 连接麦麦的ws服务设置"),H.push(`host = "${fe(K.maibot_server.host,Zs.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),H.push(`port = ${fe(K.maibot_server.port||0,Zs.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),H.push(""),H.push("[chat] # 黑白名单功能"),H.push(`group_list_type = "${fe(K.chat.group_list_type,Zs.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),H.push(`group_list = [${K.chat.group_list.join(", ")}] # 群组名单`),H.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),H.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),H.push(`private_list_type = "${fe(K.chat.private_list_type,Zs.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),H.push(`private_list = [${K.chat.private_list.join(", ")}] # 私聊名单`),H.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),H.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),H.push(`ban_user_id = [${K.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),H.push(`ban_qq_bot = ${K.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),H.push(`enable_poke = ${K.chat.enable_poke} # 是否启用戳一戳功能`),H.push(""),H.push("[voice] # 发送语音设置"),H.push(`use_tts = ${K.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),H.push(""),H.push("[debug]"),H.push(`level = "${fe(K.debug.level,Zs.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),H.join(` -`)},xe=K=>{const H=K.target.files?.[0];if(!H)return;const fe=new FileReader;fe.onload=ve=>{try{const Re=ve.target?.result,ue=ce(Re);r(ue),i(H.name),D({title:"上传成功",description:`已加载配置文件:${H.name}`})}catch(Re){console.error("解析配置文件失败:",Re),D({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},fe.readAsText(H)},Y=()=>{if(!n)return;const K=z(n),H=new Blob([K],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL(H),ve=document.createElement("a");ve.href=fe,ve.download=s||"config.toml",document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(fe),D({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},P=()=>{r(JSON.parse(JSON.stringify(Zs))),i("config.toml"),D({title:"已加载默认配置",description:"可以开始编辑配置"})};return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"工作模式"}),a.jsx(Sr,{children:"选择配置文件的管理方式"})]}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4",children:[a.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:()=>de("upload"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(oO,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),a.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:()=>de("path"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(kq,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="path"&&a.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"flex-1 space-y-1",children:[a.jsx(Me,{id:"config-path",value:l,onChange:K=>Q(K.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${d?"border-destructive":""}`}),d&&a.jsx("p",{className:"text-xs text-destructive",children:d})]}),a.jsx(ie,{onClick:()=>F(l),disabled:x||!l||!!d,className:"w-full sm:w-auto",children:x?a.jsxs(a.Fragment,{children:[a.jsx(Fi,{className:"h-4 w-4 animate-spin mr-2"}),a.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sm:hidden",children:"加载配置"}),a.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),a.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[a.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[a.jsx("span",{children:"路径格式说明"}),a.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"C:\\Adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"/opt/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),a.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsx(od,{children:t==="upload"?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",m&&" (正在保存...)"]})})]}),t==="upload"&&!n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[a.jsx("input",{ref:_,type:"file",accept:".toml",className:"hidden",onChange:xe}),a.jsxs(ie,{onClick:()=>_.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(oO,{className:"mr-2 h-4 w-4"}),"上传配置"]}),a.jsxs(ie,{onClick:P,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&a.jsx("div",{className:"flex gap-2",children:a.jsxs(ie,{onClick:Y,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(fc,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),t==="path"&&n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs(ie,{onClick:U,size:"sm",disabled:m||!!d,className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4"}),m?"保存中...":"立即保存"]}),a.jsxs(ie,{onClick:V,size:"sm",variant:"outline",disabled:x,className:"w-full sm:w-auto",children:[a.jsx(Fi,{className:`mr-2 h-4 w-4 ${x?"animate-spin":""}`}),"刷新"]}),a.jsxs(ie,{onClick:$,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?a.jsxs(hl,{defaultValue:"napcat",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[a.jsxs($t,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),a.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),a.jsxs($t,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),a.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),a.jsxs($t,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),a.jsx("span",{className:"sm:hidden",children:"聊天"})]}),a.jsxs($t,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),a.jsx("span",{className:"sm:hidden",children:"语音"})]}),a.jsx($t,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),a.jsx(kn,{value:"napcat",className:"space-y-4",children:a.jsx(Fte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"maibot",className:"space-y-4",children:a.jsx(Qte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:a.jsx($te,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:a.jsx(Hte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"debug",className:"space-y-4",children:a.jsx(Ute,{config:n,onChange:K=>{r(K),L(K)}})})]}):a.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:a.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[a.jsx(ao,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),a.jsx(mn,{open:b,onOpenChange:k,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认切换模式"}),a.jsxs(dn,{children:["切换模式将清空当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>{k(!1),A(null)},children:"取消"}),a.jsx(hn,{onClick:J,children:"确认切换"})]})]})}),a.jsx(mn,{open:O,onOpenChange:j,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认清空路径"}),a.jsxs(dn,{children:["清空路径将清除当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>j(!1),children:"取消"}),a.jsx(hn,{onClick:ne,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Fte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Qte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function $te({config:t,onChange:e}){const n=i=>{const l={...t};i==="group"?l.chat.group_list=[...l.chat.group_list,0]:i==="private"?l.chat.private_list=[...l.chat.private_list,0]:l.chat.ban_user_id=[...l.chat.ban_user_id,0],e(l)},r=(i,l)=>{const c={...t};i==="group"?c.chat.group_list=c.chat.group_list.filter((d,h)=>h!==l):i==="private"?c.chat.private_list=c.chat.private_list.filter((d,h)=>h!==l):c.chat.ban_user_id=c.chat.ban_user_id.filter((d,h)=>h!==l),e(c)},s=(i,l,c)=>{const d={...t};i==="group"?d.chat.group_list[l]=c:i==="private"?d.chat.private_list[l]=c:d.chat.ban_user_id[l]=c,e(d)};return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),a.jsxs("div",{className:"grid gap-4 md:gap-6",children:[a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组名单类型"}),a.jsxs(Lt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组列表"}),a.jsxs(ie,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("group",l,parseInt(c.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("group",l),children:"删除"})]})]})]})]},l)),t.chat.group_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊名单类型"}),a.jsxs(Lt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊列表"}),a.jsxs(ie,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("private",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("private",l),children:"删除"})]})]})]})]},l)),t.chat.private_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"全局禁止名单"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),a.jsxs(ie,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("ban",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(mn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("ban",l),children:"删除"})]})]})]})]},l)),t.chat.ban_user_id.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),a.jsx(jt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),a.jsx(jt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Hte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),a.jsx(jt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Ute({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),a.jsx("div",{className:"grid gap-3 md:gap-4",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"日志等级"}),a.jsxs(Lt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"DEBUG",children:"DEBUG(调试)"}),a.jsx(Pe,{value:"INFO",children:"INFO(信息)"}),a.jsx(Pe,{value:"WARNING",children:"WARNING(警告)"}),a.jsx(Pe,{value:"ERROR",children:"ERROR(错误)"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function u8(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const l=n.slice(s,r).trim();(l||!i)&&e.push(l),s=r+1,r=n.indexOf(",",s)}return e}function Vte(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Wte=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gte=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xte={};function d8(t,e){return(Xte.jsx?Gte:Wte).test(t)}const Yte=/[ \t\n\f\r]/g;function Kte(t){return typeof t=="object"?t.type==="text"?h8(t.value):!1:h8(t)}function h8(t){return t.replace(Yte,"")===""}class x0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}x0.prototype.normal={};x0.prototype.property={};x0.prototype.space=void 0;function Z_(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new x0(n,r,e)}function Pf(t){return t.toLowerCase()}class qs{constructor(e,n){this.attribute=n,this.property=e}}qs.prototype.attribute="";qs.prototype.booleanish=!1;qs.prototype.boolean=!1;qs.prototype.commaOrSpaceSeparated=!1;qs.prototype.commaSeparated=!1;qs.prototype.defined=!1;qs.prototype.mustUseProperty=!1;qs.prototype.number=!1;qs.prototype.overloadedBoolean=!1;qs.prototype.property="";qs.prototype.spaceSeparated=!1;qs.prototype.space=void 0;let Zte=0;const Ot=Dc(),mr=Dc(),h4=Dc(),ze=Dc(),Bn=Dc(),Ju=Dc(),Js=Dc();function Dc(){return 2**++Zte}const f4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ot,booleanish:mr,commaOrSpaceSeparated:Js,commaSeparated:Ju,number:ze,overloadedBoolean:h4,spaceSeparated:Bn},Symbol.toStringTag,{value:"Module"})),hb=Object.keys(f4);class c5 extends qs{constructor(e,n,r,s){let i=-1;if(super(e,n),f8(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&rne.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(m8,ine);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!m8.test(i)){let l=i.replace(nne,sne);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}s=c5}return new s(r,e)}function sne(t){return"-"+t.toLowerCase()}function ine(t){return t.charAt(1).toUpperCase()}const aD=Z_([J_,Jte,nD,rD,sD],"html"),Lx=Z_([J_,ene,nD,rD,sD],"svg");function p8(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function ane(t){return t.join(" ").trim()}var Nu={},fb,g8;function lne(){if(g8)return fb;g8=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=` -`,h="/",m="*",p="",x="comment",v="declaration";function b(O,j){if(typeof O!="string")throw new TypeError("First argument must be a string");if(!O)return[];j=j||{};var T=1,A=1;function _(W){var J=W.match(e);J&&(T+=J.length);var $=W.lastIndexOf(d);A=~$?W.length-$:A+W.length}function D(){var W={line:T,column:A};return function(J){return J.position=new E(W),F(),J}}function E(W){this.start=W,this.end={line:T,column:A},this.source=j.source}E.prototype.content=O;function R(W){var J=new Error(j.source+":"+T+":"+A+": "+W);if(J.reason=W,J.filename=j.source,J.line=T,J.column=A,J.source=O,!j.silent)throw J}function Q(W){var J=W.exec(O);if(J){var $=J[0];return _($),O=O.slice($.length),J}}function F(){Q(n)}function L(W){var J;for(W=W||[];J=U();)J!==!1&&W.push(J);return W}function U(){var W=D();if(!(h!=O.charAt(0)||m!=O.charAt(1))){for(var J=2;p!=O.charAt(J)&&(m!=O.charAt(J)||h!=O.charAt(J+1));)++J;if(J+=2,p===O.charAt(J-1))return R("End of comment missing");var $=O.slice(2,J-2);return A+=2,_($),O=O.slice(J),A+=2,W({type:x,comment:$})}}function V(){var W=D(),J=Q(r);if(J){if(U(),!Q(s))return R("property missing ':'");var $=Q(i),ae=W({type:v,property:k(J[0].replace(t,p)),value:$?k($[0].replace(t,p)):p});return Q(l),ae}}function de(){var W=[];L(W);for(var J;J=V();)J!==!1&&(W.push(J),L(W));return W}return F(),de()}function k(O){return O?O.replace(c,p):p}return fb=b,fb}var x8;function one(){if(x8)return Nu;x8=1;var t=Nu&&Nu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.default=n;const e=t(lne());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const l=(0,e.default)(r),c=typeof s=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;c?s(h,m,d):m&&(i=i||{},i[h]=m)}),i}return Nu}var Lh={},v8;function cne(){if(v8)return Lh;v8=1,Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.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)},l=function(h,m){return m.toUpperCase()},c=function(h,m){return"".concat(m,"-")},d=function(h,m){return m===void 0&&(m={}),i(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(s,c):h=h.replace(r,c),h.replace(e,l))};return Lh.camelCase=d,Lh}var Ih,y8;function une(){if(y8)return Ih;y8=1;var t=Ih&&Ih.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(one()),n=cne();function r(s,i){var l={};return!s||typeof s!="string"||(0,e.default)(s,function(c,d){c&&d&&(l[(0,n.camelCase)(c,i)]=d)}),l}return r.default=r,Ih=r,Ih}var dne=une();const hne=u9(dne),lD=oD("end"),u5=oD("start");function oD(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 fne(t){const e=u5(t),n=lD(t);if(e&&n)return{start:e,end:n}}function af(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?b8(t.position):"start"in t||"end"in t?b8(t):"line"in t||"column"in t?m4(t):""}function m4(t){return w8(t&&t.line)+":"+w8(t&&t.column)}function b8(t){return m4(t&&t.start)+"-"+m4(t&&t.end)}function w8(t){return t&&typeof t=="number"?t:1}class as extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},l=!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&&(l=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?i.ruleId=r:(i.source=r.slice(0,d),i.ruleId=r.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const c=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=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=af(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=l&&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}}as.prototype.file="";as.prototype.name="";as.prototype.reason="";as.prototype.message="";as.prototype.stack="";as.prototype.column=void 0;as.prototype.line=void 0;as.prototype.ancestors=void 0;as.prototype.cause=void 0;as.prototype.fatal=void 0;as.prototype.place=void 0;as.prototype.ruleId=void 0;as.prototype.source=void 0;const d5={}.hasOwnProperty,mne=new Map,pne=/[A-Z]/g,gne=new Set(["table","tbody","thead","tfoot","tr"]),xne=new Set(["td","th"]),cD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vne(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=Nne(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=jne(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"?Lx:aD,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=uD(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function uD(t,e,n){if(e.type==="element")return yne(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return bne(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Sne(t,e,n);if(e.type==="mdxjsEsm")return wne(t,e);if(e.type==="root")return kne(t,e,n);if(e.type==="text")return One(t,e)}function yne(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=hD(t,e.tagName,!1),l=Cne(t,e);let c=f5(t,e);return gne.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Kte(d):!0})),dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function bne(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)}Bf(t,e.position)}function wne(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Bf(t,e.position)}function Sne(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:hD(t,e.name,!0),l=Tne(t,e),c=f5(t,e);return dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function kne(t,e,n){const r={};return h5(r,f5(t,e)),t.create(e,t.Fragment,r,n)}function One(t,e){return e.value}function dD(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function h5(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function jne(t,e,n){return r;function r(s,i,l,c){const h=Array.isArray(l.children)?n:e;return c?h(i,l,c):h(i,l)}}function Nne(t,e){return n;function n(r,s,i,l){const c=Array.isArray(i.children),d=u5(r);return e(s,i,l,c,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function Cne(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&d5.call(e.properties,s)){const i=Ane(t,s,e.properties[s]);if(i){const[l,c]=i;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&xne.has(e.tagName)?r=c:n[l]=c}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Tne(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 l=i.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else Bf(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 c=r.value.data.estree.body[0];c.type,i=t.evaluater.evaluateExpression(c.expression)}else Bf(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function f5(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:mne;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);i0?(si(t,t.length,0,e),t):e}const O8={}.hasOwnProperty;function mD(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ds=Ao(/[A-Za-z]/),rs=Ao(/[\dA-Za-z]/),Lne=Ao(/[#-'*+\--9=?A-Z^-~]/);function Hg(t){return t!==null&&(t<32||t===127)}const p4=Ao(/\d/),Ine=Ao(/[\dA-Fa-f]/),qne=Ao(/[!-/:-@[-`{-~]/);function Ze(t){return t!==null&&t<-2}function Rn(t){return t!==null&&(t<0||t===32)}function qt(t){return t===-2||t===-1||t===32}const Ix=Ao(new RegExp("\\p{P}|\\p{S}","u")),Cc=Ao(/\s/);function Ao(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Dd(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const c=t.charCodeAt(n+1);i<56320&&c>56319&&c<57344?(l=String.fromCharCode(i,c),s=1):l="�"}else l=String.fromCharCode(i);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function zt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(d){return qt(d)?(t.enter(n),c(d)):e(d)}function c(d){return qt(d)&&i++l))return;const R=e.events.length;let Q=R,F,L;for(;Q--;)if(e.events[Q][0]==="exit"&&e.events[Q][1].type==="chunkFlow"){if(F){L=e.events[Q][1].end;break}F=!0}for(j(r),E=R;EA;){const D=n[_];e.containerState=D[1],D[0].exit.call(e,t)}n.length=A}function T(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function Une(t,e,n){return zt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vd(t){if(t===null||Rn(t)||Cc(t))return 1;if(Ix(t))return 2}function qx(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const p={...t[r][1].end},x={...t[n][1].start};N8(p,-d),N8(x,d),l={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...t[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},i={type:d>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=bi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=bi(h,[["enter",s,e],["enter",l,e],["exit",l,e],["enter",i,e]]),h=bi(h,qx(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=bi(h,[["exit",i,e],["enter",c,e],["exit",c,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(m=2,h=bi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):m=0,si(t,r-1,n-r+3,h),n=r+h.length-m-2;break}}for(n=-1;++n0&&qt(E)?zt(t,T,"linePrefix",i+1)(E):T(E)}function T(E){return E===null||Ze(E)?t.check(C8,k,_)(E):(t.enter("codeFlowValue"),A(E))}function A(E){return E===null||Ze(E)?(t.exit("codeFlowValue"),T(E)):(t.consume(E),A)}function _(E){return t.exit("codeFenced"),e(E)}function D(E,R,Q){let F=0;return L;function L(J){return E.enter("lineEnding"),E.consume(J),E.exit("lineEnding"),U}function U(J){return E.enter("codeFencedFence"),qt(J)?zt(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):V(J)}function V(J){return J===c?(E.enter("codeFencedFenceSequence"),de(J)):Q(J)}function de(J){return J===c?(F++,E.consume(J),de):F>=l?(E.exit("codeFencedFenceSequence"),qt(J)?zt(E,W,"whitespace")(J):W(J)):Q(J)}function W(J){return J===null||Ze(J)?(E.exit("codeFencedFence"),R(J)):Q(J)}}}function rre(t,e,n){const r=this;return s;function s(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const pb={name:"codeIndented",tokenize:ire},sre={partial:!0,tokenize:are};function ire(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),zt(t,i,"linePrefix",5)(h)}function i(h){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?d(h):Ze(h)?t.attempt(sre,l,d)(h):(t.enter("codeFlowValue"),c(h))}function c(h){return h===null||Ze(h)?(t.exit("codeFlowValue"),l(h)):(t.consume(h),c)}function d(h){return t.exit("codeIndented"),e(h)}}function are(t,e,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):zt(t,i,"linePrefix",5)(l)}function i(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):Ze(l)?s(l):n(l)}}const lre={name:"codeText",previous:cre,resolve:ore,tokenize:ure};function ore(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&qh(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),qh(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qh(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function bD(t,e,n,r,s,i,l,c,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(j){return j===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(j),t.exit(i),x):j===null||j===32||j===41||Hg(j)?n(j):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),k(j))}function x(j){return j===62?(t.enter(i),t.consume(j),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),v(j))}function v(j){return j===62?(t.exit("chunkString"),t.exit(c),x(j)):j===null||j===60||Ze(j)?n(j):(t.consume(j),j===92?b:v)}function b(j){return j===60||j===62||j===92?(t.consume(j),v):v(j)}function k(j){return!m&&(j===null||j===41||Rn(j))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(j)):m999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(t.exit(i),t.enter(s),t.consume(v),t.exit(s),t.exit(r),e):Ze(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),m):(t.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Ze(v)||c++>999?(t.exit("chunkString"),m(v)):(t.consume(v),d||(d=!qt(v)),v===92?x:p)}function x(v){return v===91||v===92||v===93?(t.consume(v),c++,p):p(v)}}function SD(t,e,n,r,s,i){let l;return c;function c(x){return x===34||x===39||x===40?(t.enter(r),t.enter(s),t.consume(x),t.exit(s),l=x===40?41:x,d):n(x)}function d(x){return x===l?(t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):(t.enter(i),h(x))}function h(x){return x===l?(t.exit(i),d(l)):x===null?n(x):Ze(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),zt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===l||x===null||Ze(x)?(t.exit("chunkString"),h(x)):(t.consume(x),x===92?p:m)}function p(x){return x===l||x===92?(t.consume(x),m):m(x)}}function lf(t,e){let n;return r;function r(s){return Ze(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):qt(s)?zt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const vre={name:"definition",tokenize:bre},yre={partial:!0,tokenize:wre};function bre(t,e,n){const r=this;let s;return i;function i(v){return t.enter("definition"),l(v)}function l(v){return wD.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=Qi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),d):n(v)}function d(v){return Rn(v)?lf(t,h)(v):h(v)}function h(v){return bD(t,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return t.attempt(yre,p,p)(v)}function p(v){return qt(v)?zt(t,x,"whitespace")(v):x(v)}function x(v){return v===null||Ze(v)?(t.exit("definition"),r.parser.defined.push(s),e(v)):n(v)}}function wre(t,e,n){return r;function r(c){return Rn(c)?lf(t,s)(c):n(c)}function s(c){return SD(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function i(c){return qt(c)?zt(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Ze(c)?e(c):n(c)}}const Sre={name:"hardBreakEscape",tokenize:kre};function kre(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Ze(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Ore={name:"headingAtx",resolve:jre,tokenize:Nre};function jre(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"},si(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Nre(t,e,n){let r=0;return s;function s(m){return t.enter("atxHeading"),i(m)}function i(m){return t.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(t.consume(m),l):m===null||Rn(m)?(t.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(t.enter("atxHeadingSequence"),d(m)):m===null||Ze(m)?(t.exit("atxHeading"),e(m)):qt(m)?zt(t,c,"whitespace")(m):(t.enter("atxHeadingText"),h(m))}function d(m){return m===35?(t.consume(m),d):(t.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||Rn(m)?(t.exit("atxHeadingText"),c(m)):(t.consume(m),h)}}const Cre=["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"],A8=["pre","script","style","textarea"],Tre={concrete:!0,name:"htmlFlow",resolveTo:Ere,tokenize:_re},Are={partial:!0,tokenize:Rre},Mre={partial:!0,tokenize:Dre};function Ere(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 _re(t,e,n){const r=this;let s,i,l,c,d;return h;function h(P){return m(P)}function m(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),p}function p(P){return P===33?(t.consume(P),x):P===47?(t.consume(P),i=!0,k):P===63?(t.consume(P),s=3,r.interrupt?e:z):ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function x(P){return P===45?(t.consume(P),s=2,v):P===91?(t.consume(P),s=5,c=0,b):ds(P)?(t.consume(P),s=4,r.interrupt?e:z):n(P)}function v(P){return P===45?(t.consume(P),r.interrupt?e:z):n(P)}function b(P){const K="CDATA[";return P===K.charCodeAt(c++)?(t.consume(P),c===K.length?r.interrupt?e:V:b):n(P)}function k(P){return ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function O(P){if(P===null||P===47||P===62||Rn(P)){const K=P===47,H=l.toLowerCase();return!K&&!i&&A8.includes(H)?(s=1,r.interrupt?e(P):V(P)):Cre.includes(l.toLowerCase())?(s=6,K?(t.consume(P),j):r.interrupt?e(P):V(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):i?T(P):A(P))}return P===45||rs(P)?(t.consume(P),l+=String.fromCharCode(P),O):n(P)}function j(P){return P===62?(t.consume(P),r.interrupt?e:V):n(P)}function T(P){return qt(P)?(t.consume(P),T):L(P)}function A(P){return P===47?(t.consume(P),L):P===58||P===95||ds(P)?(t.consume(P),_):qt(P)?(t.consume(P),A):L(P)}function _(P){return P===45||P===46||P===58||P===95||rs(P)?(t.consume(P),_):D(P)}function D(P){return P===61?(t.consume(P),E):qt(P)?(t.consume(P),D):A(P)}function E(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),d=P,R):qt(P)?(t.consume(P),E):Q(P)}function R(P){return P===d?(t.consume(P),d=null,F):P===null||Ze(P)?n(P):(t.consume(P),R)}function Q(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Rn(P)?D(P):(t.consume(P),Q)}function F(P){return P===47||P===62||qt(P)?A(P):n(P)}function L(P){return P===62?(t.consume(P),U):n(P)}function U(P){return P===null||Ze(P)?V(P):qt(P)?(t.consume(P),U):n(P)}function V(P){return P===45&&s===2?(t.consume(P),$):P===60&&s===1?(t.consume(P),ae):P===62&&s===4?(t.consume(P),xe):P===63&&s===3?(t.consume(P),z):P===93&&s===5?(t.consume(P),ce):Ze(P)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Are,Y,de)(P)):P===null||Ze(P)?(t.exit("htmlFlowData"),de(P)):(t.consume(P),V)}function de(P){return t.check(Mre,W,Y)(P)}function W(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),J}function J(P){return P===null||Ze(P)?de(P):(t.enter("htmlFlowData"),V(P))}function $(P){return P===45?(t.consume(P),z):V(P)}function ae(P){return P===47?(t.consume(P),l="",ne):V(P)}function ne(P){if(P===62){const K=l.toLowerCase();return A8.includes(K)?(t.consume(P),xe):V(P)}return ds(P)&&l.length<8?(t.consume(P),l+=String.fromCharCode(P),ne):V(P)}function ce(P){return P===93?(t.consume(P),z):V(P)}function z(P){return P===62?(t.consume(P),xe):P===45&&s===2?(t.consume(P),z):V(P)}function xe(P){return P===null||Ze(P)?(t.exit("htmlFlowData"),Y(P)):(t.consume(P),xe)}function Y(P){return t.exit("htmlFlow"),e(P)}}function Dre(t,e,n){const r=this;return s;function s(l){return Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):n(l)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function Rre(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(v0,e,n)}}const zre={name:"htmlText",tokenize:Pre};function Pre(t,e,n){const r=this;let s,i,l;return c;function c(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),d}function d(z){return z===33?(t.consume(z),h):z===47?(t.consume(z),D):z===63?(t.consume(z),A):ds(z)?(t.consume(z),Q):n(z)}function h(z){return z===45?(t.consume(z),m):z===91?(t.consume(z),i=0,b):ds(z)?(t.consume(z),T):n(z)}function m(z){return z===45?(t.consume(z),v):n(z)}function p(z){return z===null?n(z):z===45?(t.consume(z),x):Ze(z)?(l=p,ae(z)):(t.consume(z),p)}function x(z){return z===45?(t.consume(z),v):p(z)}function v(z){return z===62?$(z):z===45?x(z):p(z)}function b(z){const xe="CDATA[";return z===xe.charCodeAt(i++)?(t.consume(z),i===xe.length?k:b):n(z)}function k(z){return z===null?n(z):z===93?(t.consume(z),O):Ze(z)?(l=k,ae(z)):(t.consume(z),k)}function O(z){return z===93?(t.consume(z),j):k(z)}function j(z){return z===62?$(z):z===93?(t.consume(z),j):k(z)}function T(z){return z===null||z===62?$(z):Ze(z)?(l=T,ae(z)):(t.consume(z),T)}function A(z){return z===null?n(z):z===63?(t.consume(z),_):Ze(z)?(l=A,ae(z)):(t.consume(z),A)}function _(z){return z===62?$(z):A(z)}function D(z){return ds(z)?(t.consume(z),E):n(z)}function E(z){return z===45||rs(z)?(t.consume(z),E):R(z)}function R(z){return Ze(z)?(l=R,ae(z)):qt(z)?(t.consume(z),R):$(z)}function Q(z){return z===45||rs(z)?(t.consume(z),Q):z===47||z===62||Rn(z)?F(z):n(z)}function F(z){return z===47?(t.consume(z),$):z===58||z===95||ds(z)?(t.consume(z),L):Ze(z)?(l=F,ae(z)):qt(z)?(t.consume(z),F):$(z)}function L(z){return z===45||z===46||z===58||z===95||rs(z)?(t.consume(z),L):U(z)}function U(z){return z===61?(t.consume(z),V):Ze(z)?(l=U,ae(z)):qt(z)?(t.consume(z),U):F(z)}function V(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(t.consume(z),s=z,de):Ze(z)?(l=V,ae(z)):qt(z)?(t.consume(z),V):(t.consume(z),W)}function de(z){return z===s?(t.consume(z),s=void 0,J):z===null?n(z):Ze(z)?(l=de,ae(z)):(t.consume(z),de)}function W(z){return z===null||z===34||z===39||z===60||z===61||z===96?n(z):z===47||z===62||Rn(z)?F(z):(t.consume(z),W)}function J(z){return z===47||z===62||Rn(z)?F(z):n(z)}function $(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),e):n(z)}function ae(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),ne}function ne(z){return qt(z)?zt(t,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):ce(z)}function ce(z){return t.enter("htmlTextData"),l(z)}}const g5={name:"labelEnd",resolveAll:qre,resolveTo:Fre,tokenize:Qre},Bre={tokenize:$re},Lre={tokenize:Hre},Ire={tokenize:Ure};function qre(t){let e=-1;const n=[];for(;++e=3&&(h===null||Ze(h))?(t.exit("thematicBreak"),e(h)):n(h)}function d(h){return h===s?(t.consume(h),r++,d):(t.exit("thematicBreakSequence"),qt(h)?zt(t,c,"whitespace")(h):c(h))}}const Ns={continuation:{tokenize:tse},exit:rse,name:"list",tokenize:ese},Zre={partial:!0,tokenize:sse},Jre={partial:!0,tokenize:nse};function ese(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,l=0;return c;function c(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:p4(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(og,n,h)(v):h(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(v)}return n(v)}function d(v){return p4(v)&&++l<10?(t.consume(v),d):(!r.interrupt||l<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),h(v)):n(v)}function h(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(v0,r.interrupt?n:m,t.attempt(Zre,x,p))}function m(v){return r.containerState.initialBlankLine=!0,i++,x(v)}function p(v){return qt(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),x):n(v)}function x(v){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function tse(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(v0,s,i);function s(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,zt(t,e,"listItemIndent",r.containerState.size+1)(c)}function i(c){return r.containerState.furtherBlankLines||!qt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Jre,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,zt(t,t.attempt(Ns,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function nse(t,e,n){const r=this;return zt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(i):n(i)}}function rse(t){t.exit(this.containerState.type)}function sse(t,e,n){const r=this;return zt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const l=r.events[r.events.length-1];return!qt(i)&&l&&l[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const M8={name:"setextUnderline",resolveTo:ise,tokenize:ase};function ise(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 l={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",l,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function ase(t,e,n){const r=this;let s;return i;function i(h){let m=r.events.length,p;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){p=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(t.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return t.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===s?(t.consume(h),c):(t.exit("setextHeadingLineSequence"),qt(h)?zt(t,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Ze(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const lse={tokenize:ose};function ose(t){const e=this,n=t.attempt(v0,r,t.attempt(this.parser.constructs.flowInitial,s,zt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(fre,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 cse={resolveAll:OD()},use=kD("string"),dse=kD("text");function kD(t){return{resolveAll:OD(t==="text"?hse:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,l,c);return l;function l(m){return h(m)?i(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),d}function d(m){return h(m)?(n.exit("data"),i(m)):(n.consume(m),d)}function h(m){if(m===null)return!0;const p=s[m];let x=-1;if(p)for(;++x-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}i>0&&l.push(t[s].slice(0,i))}return l}function jse(t,e){let n=-1;const r=[];let s;for(;++na.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(p,{regex:_.regex&&_.regex[0]||"",reaction:_.reaction,onRegexChange:E=>m(D,"regex",E),onReactionChange:E=>m(D,"reaction",E)}),a.jsx(T,{rule:_}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除正则规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>h(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),a.jsx(Me,{value:_.regex&&_.regex[0]||"",onChange:E=>m(D,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>m(D,"reaction",E.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},D)),t.regex_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),a.jsxs("div",{className:"space-y-4 border-t pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),a.jsxs(ie,{onClick:x,size:"sm",variant:"outline",children:[a.jsx(Wr,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),a.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((_,D)=>a.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",D+1]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(A,{rule:_}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除关键词规则 ",D+1," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>v(D),children:"删除"})]})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{className:"text-xs font-medium",children:"关键词列表"}),a.jsxs(ie,{onClick:()=>k(D),size:"sm",variant:"ghost",children:[a.jsx(Wr,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),a.jsxs("div",{className:"space-y-2",children:[(_.keywords||[]).map((E,z)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{value:E,onChange:Q=>j(D,z,Q.target.value),placeholder:"关键词",className:"flex-1"}),a.jsx(ie,{onClick:()=>O(D,z),size:"sm",variant:"ghost",children:a.jsx(Ht,{className:"h-4 w-4"})})]},z)),(!_.keywords||_.keywords.length===0)&&a.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-xs font-medium",children:"反应内容"}),a.jsx(_n,{value:_.reaction,onChange:E=>b(D,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},D)),t.keyword_rules.length===0&&a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:_=>i({...e,enable_response_post_process:_})}),a.jsx(te,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:_=>l({...n,enable:_})}),a.jsx(te,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),a.jsx(Me,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:_=>l({...n,error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),a.jsx(Me,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:_=>l({...n,min_freq:parseInt(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),a.jsx(Me,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:_=>l({...n,tone_error_rate:parseFloat(_.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),a.jsx(Me,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:_=>l({...n,word_replace_rate:parseFloat(_.target.value)})})]})]})]})}),a.jsx("div",{className:"border-t pt-6 space-y-4",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[a.jsx(jt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:_=>c({...r,enable:_})}),a.jsx(te,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&a.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),a.jsx(Me,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:_=>c({...r,max_length:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),a.jsx(Me,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:_=>c({...r,max_sentence_num:parseInt(_.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:_=>c({...r,enable_kaomoji_protection:_})}),a.jsx(te,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:_=>c({...r,enable_overflow_return_all:_})}),a.jsx(te,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),a.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function Jee({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情绪更新阈值"}),a.jsx(Me,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"情感特征"}),a.jsx(_n,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function ete({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用语音识别"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function tte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),a.jsx(te,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"LPMM 模式"}),a.jsxs(Lt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[a.jsx(Dt,{children:a.jsx(It,{placeholder:"选择 LPMM 模式"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"classic",children:"经典模式"}),a.jsx(Pe,{value:"agent",children:"Agent 模式"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词搜索 TopK"}),a.jsx(Me,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"同义词阈值"}),a.jsx(Me,{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)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"实体提取线程数"}),a.jsx(Me,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"嵌入向量维度"}),a.jsx(Me,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function nte({config:t,onChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState("WARNING"),l=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},c=v=>{e({...t,suppress_libraries:t.suppress_libraries.filter(b=>b!==v)})},d=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=v=>{const b={...t.library_log_levels};delete b[v],e({...t,library_log_levels:b})},m=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],p=["FULL","compact","lite"],x=["none","title","full"];return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日期格式"}),a.jsx(Me,{value:t.date_style,onChange:v=>e({...t,date_style:v.target.value}),placeholder:"例如: m-d H:i:s"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志级别样式"}),a.jsxs(Lt,{value:t.log_level_style,onValueChange:v=>e({...t,log_level_style:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:p.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"日志文本颜色"}),a.jsxs(Lt,{value:t.color_text,onValueChange:v=>e({...t,color_text:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:x.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"全局日志级别"}),a.jsxs(Lt,{value:t.log_level,onValueChange:v=>e({...t,log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"控制台日志级别"}),a.jsxs(Lt,{value:t.console_log_level,onValueChange:v=>e({...t,console_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"文件日志级别"}),a.jsxs(Lt,{value:t.file_log_level,onValueChange:v=>e({...t,file_log_level:v}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"完全屏蔽的库"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),l())}}),a.jsx(ie,{onClick:l,size:"sm",className:"flex-shrink-0",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(v=>a.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[a.jsx("span",{className:"text-sm",children:v}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>c(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},v))})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"特定库的日志级别"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:v=>r(v.target.value),placeholder:"输入库名",className:"flex-1"}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsx(Dt,{className:"w-32",children:a.jsx(It,{})}),a.jsx(Rt,{children:m.map(v=>a.jsx(Pe,{value:v,children:v},v))})]}),a.jsx(ie,{onClick:d,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([v,b])=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-medium",children:v}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:b}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(v),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},v))})]})]})}function rte({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),a.jsx(jt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器 Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),a.jsx(jt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示回复器推理"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),a.jsx(jt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"显示 Jargon Prompt"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),a.jsx(jt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]})]})]})}function ste({config:t,onChange:e}){const[n,r]=S.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=l=>{e({...t,auth_token:t.auth_token.filter((c,d)=>d!==l)})};return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用自定义服务器"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),a.jsx(jt,{checked:t.use_custom,onCheckedChange:l=>e({...t,use_custom:l})})]}),t.use_custom&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"主机地址"}),a.jsx(Me,{value:t.host,onChange:l=>e({...t,host:l.target.value}),placeholder:"127.0.0.1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"端口号"}),a.jsx(Me,{type:"number",value:t.port,onChange:l=>e({...t,port:parseInt(l.target.value)}),placeholder:"8090"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"连接模式"}),a.jsxs(Lt,{value:t.mode,onValueChange:l=>e({...t,mode:l}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"ws",children:"WebSocket (ws)"}),a.jsx(Pe,{value:"tcp",children:"TCP"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{checked:t.use_wss,onCheckedChange:l=>e({...t,use_wss:l}),disabled:t.mode!=="ws"}),a.jsx(te,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 证书文件路径"}),a.jsx(Me,{value:t.cert_file,onChange:l=>e({...t,cert_file:l.target.value}),placeholder:"cert.pem"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"SSL 密钥文件路径"}),a.jsx(Me,{value:t.key_file,onChange:l=>e({...t,key_file:l.target.value}),placeholder:"key.pem"})]})]})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"mb-2 block",children:"认证令牌"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(Me,{value:n,onChange:l=>r(l.target.value),placeholder:"输入认证令牌",onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),s())}}),a.jsx(ie,{onClick:s,size:"sm",children:a.jsx(Wr,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),a.jsx("div",{className:"space-y-2",children:t.auth_token.map((l,c)=>a.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[a.jsx("span",{className:"text-sm font-mono",children:l}),a.jsx(ie,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(c),children:a.jsx(Ht,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},c))})]})]})}function ite({config:t,onChange:e}){return a.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(te,{children:"启用统计信息发送"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),a.jsx(jt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Mc=S.forwardRef(({className:t,...e},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Mc.displayName="Table";const Ec=S.forwardRef(({className:t,...e},n)=>a.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Ec.displayName="TableHeader";const _c=S.forwardRef(({className:t,...e},n)=>a.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));_c.displayName="TableBody";const ate=S.forwardRef(({className:t,...e},n)=>a.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));ate.displayName="TableFooter";const xr=S.forwardRef(({className:t,...e},n)=>a.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));xr.displayName="TableRow";const xt=S.forwardRef(({className:t,...e},n)=>a.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}));xt.displayName="TableHead";const it=S.forwardRef(({className:t,...e},n)=>a.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));it.displayName="TableCell";const lte=S.forwardRef(({className:t,...e},n)=>a.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));lte.displayName="TableCaption";const ss=S.forwardRef(({className:t,...e},n)=>a.jsx(A9,{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:a.jsx(rq,{className:ye("grid place-content-center text-current"),children:a.jsx(hc,{className:"h-4 w-4"})})}));ss.displayName=A9.displayName;function ote(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(!1),[l,c]=S.useState(!1),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(null),[T,A]=S.useState(null),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState(new Set),[W,J]=S.useState(!1),[$,ae]=S.useState(1),[ne,ue]=S.useState(20),[R,me]=S.useState(""),{toast:Y}=Pr(),P=S.useRef(null),K=S.useRef(!0);S.useEffect(()=>{H()},[]);const H=async()=>{try{r(!0);const ee=await Vu();e(ee.api_providers||[]),h(!1),K.current=!1}catch(ee){console.error("加载配置失败:",ee)}finally{r(!1)}},fe=async()=>{try{p(!0),xw().catch(()=>{}),v(!0)}catch(ee){console.error("重启失败:",ee),v(!1),Y({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),p(!1)}},ve=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"正在重启麦麦..."}),await fe()}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"}),i(!1)}},Re=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},de=()=>{v(!1),p(!1),Y({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},We=S.useCallback(async ee=>{if(!K.current)try{c(!0),await h2("api_providers",ee),h(!1)}catch(Se){console.error("自动保存失败:",Se),h(!0)}finally{c(!1)}},[]);S.useEffect(()=>{if(!K.current)return h(!0),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{We(t)},2e3),()=>{P.current&&clearTimeout(P.current)}},[t,We]);const ct=async()=>{try{i(!0),P.current&&clearTimeout(P.current);const ee=await Vu();ee.api_providers=t,await wg(ee),h(!1),Y({title:"保存成功",description:"模型提供商配置已保存"})}catch(ee){console.error("保存配置失败:",ee),Y({title:"保存失败",description:ee.message,variant:"destructive"})}finally{i(!1)}},Oe=(ee,Se)=>{j(ee||{name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),A(Se),F(!1),k(!0)},nt=async()=>{if(O?.api_key)try{await navigator.clipboard.writeText(O.api_key),Y({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Y({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},ut=()=>{if(!O)return;const ee={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};if(T!==null){const Se=[...t];Se[T]=ee,e(Se)}else e([...t,ee]);k(!1),j(null),A(null)},Ct=ee=>{if(!ee&&O){const Se={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};j(Se)}k(ee)},In=ee=>{z(ee),D(!0)},Tn=()=>{if(E!==null){const ee=t.filter((Se,Be)=>Be!==E);e(ee),Y({title:"删除成功",description:"提供商已从列表中移除"})}D(!1),z(null)},Jn=ee=>{const Se=new Set(V);Se.has(ee)?Se.delete(ee):Se.add(ee),ce(Se)},nn=()=>{if(V.size===qn.length)ce(new Set);else{const ee=qn.map((Se,Be)=>t.findIndex(rt=>rt===qn[Be]));ce(new Set(ee))}},_t=()=>{if(V.size===0){Y({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}J(!0)},Yr=()=>{const ee=t.filter((Se,Be)=>!V.has(Be));e(ee),ce(new Set),J(!1),Y({title:"批量删除成功",description:`已删除 ${V.size} 个提供商`})},qn=t.filter(ee=>{if(!L)return!0;const Se=L.toLowerCase();return ee.name.toLowerCase().includes(Se)||ee.base_url.toLowerCase().includes(Se)||ee.client_type.toLowerCase().includes(Se)}),or=Math.ceil(qn.length/ne),yn=qn.slice(($-1)*ne,$*ne),ft=()=>{const ee=parseInt(R);ee>=1&&ee<=or&&(ae(ee),me(""))};return n?a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型提供商配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 API 提供商配置"})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[V.size>0&&a.jsxs(ie,{onClick:_t,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",V.size,")"]}),a.jsxs(ie,{onClick:()=>Oe(null,null),size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),a.jsxs(ie,{onClick:ct,disabled:s||l||!d||m,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":l?"自动保存中...":d?"保存配置":"已保存"]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:s||l||m,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),m?"重启中...":d?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:d?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:d?ve:fe,children:d?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(mn,{className:"h-[calc(100vh-260px)]",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索提供商名称、URL 或类型...",value:L,onChange:ee=>U(ee.target.value),className:"pl-9"})]}),L&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qn.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:qn.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"font-semibold text-base truncate",children:ee.name}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ee.base_url})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),a.jsx("p",{className:"font-medium",children:ee.client_type})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),a.jsx("p",{className:"font-medium",children:ee.max_retry})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),a.jsx("p",{className:"font-medium",children:ee.timeout})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),a.jsx("p",{className:"font-medium",children:ee.retry_interval})]})]})]},Se)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:V.size===qn.length&&qn.length>0,onCheckedChange:nn})}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"基础URL"}),a.jsx(xt,{children:"客户端类型"}),a.jsx(xt,{className:"text-right",children:"最大重试"}),a.jsx(xt,{className:"text-right",children:"超时(秒)"}),a.jsx(xt,{className:"text-right",children:"重试间隔(秒)"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:yn.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center text-muted-foreground py-8",children:L?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):yn.map((ee,Se)=>{const Be=t.findIndex(rt=>rt===ee);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Be),onCheckedChange:()=>Jn(Be)})}),a.jsx(it,{className:"font-medium",children:ee.name}),a.jsx(it,{className:"max-w-xs truncate",title:ee.base_url,children:ee.base_url}),a.jsx(it,{children:ee.client_type}),a.jsx(it,{className:"text-right",children:ee.max_retry}),a.jsx(it,{className:"text-right",children:ee.timeout}),a.jsx(it,{className:"text-right",children:ee.retry_interval}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Oe(ee,Be),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>In(Be),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Se)})})]})}),qn.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:ne.toString(),onValueChange:ee=>{ue(parseInt(ee)),ae(1),ce(new Set)},children:[a.jsx(Dt,{id:"page-size-provider",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",($-1)*ne+1," 到"," ",Math.min($*ne,qn.length)," 条,共 ",qn.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:$===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>Math.max(1,ee-1)),disabled:$===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:R,onChange:ee=>me(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&ft(),placeholder:$.toString(),className:"w-16 h-8 text-center",min:1,max:or}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ft,disabled:!R,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(ee=>ee+1),disabled:$>=or,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ae(or),disabled:$>=or,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsx(Rr,{open:b,onOpenChange:Ct,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:T!==null?"编辑提供商":"添加提供商"}),a.jsx(Gr,{children:"配置 API 提供商的连接信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"name",children:"名称 *"}),a.jsx(Me,{id:"name",value:O?.name||"",onChange:ee=>j(Se=>Se?{...Se,name:ee.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"base_url",children:"基础 URL *"}),a.jsx(Me,{id:"base_url",value:O?.base_url||"",onChange:ee=>j(Se=>Se?{...Se,base_url:ee.target.value}:null),placeholder:"https://api.example.com/v1"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_key",children:"API Key *"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{id:"api_key",type:Q?"text":"password",value:O?.api_key||"",onChange:ee=>j(Se=>Se?{...Se,api_key:ee.target.value}:null),placeholder:"sk-...",className:"flex-1"}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:()=>F(!Q),title:Q?"隐藏密钥":"显示密钥",children:Q?a.jsx(Yb,{className:"h-4 w-4"}):a.jsx($i,{className:"h-4 w-4"})}),a.jsx(ie,{type:"button",variant:"outline",size:"icon",onClick:nt,title:"复制密钥",children:a.jsx(Xb,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"client_type",children:"客户端类型"}),a.jsxs(Lt,{value:O?.client_type||"openai",onValueChange:ee=>j(Se=>Se?{...Se,client_type:ee}:null),children:[a.jsx(Dt,{id:"client_type",children:a.jsx(It,{placeholder:"选择客户端类型"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"openai",children:"OpenAI"}),a.jsx(Pe,{value:"gemini",children:"Gemini"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"max_retry",children:"最大重试"}),a.jsx(Me,{id:"max_retry",type:"number",min:"0",value:O?.max_retry??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,max_retry:Se}:null)},placeholder:"默认: 2"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"timeout",children:"超时(秒)"}),a.jsx(Me,{id:"timeout",type:"number",min:"1",value:O?.timeout??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,timeout:Se}:null)},placeholder:"默认: 30"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),a.jsx(Me,{id:"retry_interval",type:"number",min:"1",value:O?.retry_interval??"",onChange:ee=>{const Se=ee.target.value===""?null:parseInt(ee.target.value);j(Be=>Be?{...Be,retry_interval:Se}:null)},placeholder:"默认: 10"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>k(!1),children:"取消"}),a.jsx(ie,{onClick:ut,children:"保存"})]})]})}),a.jsx(pn,{open:_,onOpenChange:D,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除提供商 "',E!==null?t[E]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Tn,children:"删除"})]})]})}),a.jsx(pn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",V.size," 个提供商吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:Yr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),x&&a.jsx(vw,{onRestartComplete:Re,onRestartFailed:de})]})}var a8=1,cte=.9,ute=.8,dte=.17,cb=.1,ub=.999,hte=.9999,fte=.99,mte=/[\\\/_+.#"@\[\(\{&]/,pte=/[\\\/_+.#"@\[\(\{&]/g,gte=/[\s-]/,L_=/[\s-]/g;function u4(t,e,n,r,s,i,l){if(i===e.length)return s===t.length?a8:fte;var c=`${s},${i}`;if(l[c]!==void 0)return l[c];for(var d=r.charAt(i),h=n.indexOf(d,s),m=0,p,x,v,b;h>=0;)p=u4(t,e,n,r,h+1,i+1,l),p>m&&(h===s?p*=a8:mte.test(t.charAt(h-1))?(p*=ute,v=t.slice(s,h-1).match(pte),v&&s>0&&(p*=Math.pow(ub,v.length))):gte.test(t.charAt(h-1))?(p*=cte,b=t.slice(s,h-1).match(L_),b&&s>0&&(p*=Math.pow(ub,b.length))):(p*=dte,s>0&&(p*=Math.pow(ub,h-s))),t.charAt(h)!==e.charAt(i)&&(p*=hte)),(pp&&(p=x*cb)),p>m&&(m=p),h=n.indexOf(d,h+1);return l[c]=m,m}function l8(t){return t.toLowerCase().replace(L_," ")}function xte(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,u4(t,e,l8(t),l8(e),0,0,{})}var vte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],To=vte.reduce((t,e)=>{const n=Q4(`Primitive.${e}`),r=S.forwardRef((s,i)=>{const{asChild:l,...c}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Bh='[cmdk-group=""]',db='[cmdk-group-items=""]',yte='[cmdk-group-heading=""]',I_='[cmdk-item=""]',o8=`${I_}:not([aria-disabled="true"])`,d4="cmdk-item-select",Pu="data-value",bte=(t,e,n)=>xte(t,e,n),q_=S.createContext(void 0),g0=()=>S.useContext(q_),F_=S.createContext(void 0),o5=()=>S.useContext(F_),Q_=S.createContext(void 0),$_=S.forwardRef((t,e)=>{let n=Bu(()=>{var Y,P;return{search:"",value:(P=(Y=t.value)!=null?Y:t.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Bu(()=>new Set),s=Bu(()=>new Map),i=Bu(()=>new Map),l=Bu(()=>new Set),c=H_(t),{label:d,children:h,value:m,onValueChange:p,filter:x,shouldFilter:v,loop:b,disablePointerSelection:k=!1,vimBindings:O=!0,...j}=t,T=ji(),A=ji(),_=ji(),D=S.useRef(null),E=Ete();Nc(()=>{if(m!==void 0){let Y=m.trim();n.current.value=Y,z.emit()}},[m]),Nc(()=>{E(6,ce)},[]);let z=S.useMemo(()=>({subscribe:Y=>(l.current.add(Y),()=>l.current.delete(Y)),snapshot:()=>n.current,setState:(Y,P,K)=>{var H,fe,ve,Re;if(!Object.is(n.current[Y],P)){if(n.current[Y]=P,Y==="search")V(),L(),E(1,U);else if(Y==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let de=document.getElementById(_);de?de.focus():(H=document.getElementById(T))==null||H.focus()}if(E(7,()=>{var de;n.current.selectedItemId=(de=W())==null?void 0:de.id,z.emit()}),K||E(5,ce),((fe=c.current)==null?void 0:fe.value)!==void 0){let de=P??"";(Re=(ve=c.current).onValueChange)==null||Re.call(ve,de);return}}z.emit()}},emit:()=>{l.current.forEach(Y=>Y())}}),[]),Q=S.useMemo(()=>({value:(Y,P,K)=>{var H;P!==((H=i.current.get(Y))==null?void 0:H.value)&&(i.current.set(Y,{value:P,keywords:K}),n.current.filtered.items.set(Y,F(P,K)),E(2,()=>{L(),z.emit()}))},item:(Y,P)=>(r.current.add(Y),P&&(s.current.has(P)?s.current.get(P).add(Y):s.current.set(P,new Set([Y]))),E(3,()=>{V(),L(),n.current.value||U(),z.emit()}),()=>{i.current.delete(Y),r.current.delete(Y),n.current.filtered.items.delete(Y);let K=W();E(4,()=>{V(),K?.getAttribute("id")===Y&&U(),z.emit()})}),group:Y=>(s.current.has(Y)||s.current.set(Y,new Set),()=>{i.current.delete(Y),s.current.delete(Y)}),filter:()=>c.current.shouldFilter,label:d||t["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:T,inputId:_,labelId:A,listInnerRef:D}),[]);function F(Y,P){var K,H;let fe=(H=(K=c.current)==null?void 0:K.filter)!=null?H:bte;return Y?fe(Y,n.current.search,P):0}function L(){if(!n.current.search||c.current.shouldFilter===!1)return;let Y=n.current.filtered.items,P=[];n.current.filtered.groups.forEach(H=>{let fe=s.current.get(H),ve=0;fe.forEach(Re=>{let de=Y.get(Re);ve=Math.max(de,ve)}),P.push([H,ve])});let K=D.current;J().sort((H,fe)=>{var ve,Re;let de=H.getAttribute("id"),We=fe.getAttribute("id");return((ve=Y.get(We))!=null?ve:0)-((Re=Y.get(de))!=null?Re:0)}).forEach(H=>{let fe=H.closest(db);fe?fe.appendChild(H.parentElement===fe?H:H.closest(`${db} > *`)):K.appendChild(H.parentElement===K?H:H.closest(`${db} > *`))}),P.sort((H,fe)=>fe[1]-H[1]).forEach(H=>{var fe;let ve=(fe=D.current)==null?void 0:fe.querySelector(`${Bh}[${Pu}="${encodeURIComponent(H[0])}"]`);ve?.parentElement.appendChild(ve)})}function U(){let Y=J().find(K=>K.getAttribute("aria-disabled")!=="true"),P=Y?.getAttribute(Pu);z.setState("value",P||void 0)}function V(){var Y,P,K,H;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let fe=0;for(let ve of r.current){let Re=(P=(Y=i.current.get(ve))==null?void 0:Y.value)!=null?P:"",de=(H=(K=i.current.get(ve))==null?void 0:K.keywords)!=null?H:[],We=F(Re,de);n.current.filtered.items.set(ve,We),We>0&&fe++}for(let[ve,Re]of s.current)for(let de of Re)if(n.current.filtered.items.get(de)>0){n.current.filtered.groups.add(ve);break}n.current.filtered.count=fe}function ce(){var Y,P,K;let H=W();H&&(((Y=H.parentElement)==null?void 0:Y.firstChild)===H&&((K=(P=H.closest(Bh))==null?void 0:P.querySelector(yte))==null||K.scrollIntoView({block:"nearest"})),H.scrollIntoView({block:"nearest"}))}function W(){var Y;return(Y=D.current)==null?void 0:Y.querySelector(`${I_}[aria-selected="true"]`)}function J(){var Y;return Array.from(((Y=D.current)==null?void 0:Y.querySelectorAll(o8))||[])}function $(Y){let P=J()[Y];P&&z.setState("value",P.getAttribute(Pu))}function ae(Y){var P;let K=W(),H=J(),fe=H.findIndex(Re=>Re===K),ve=H[fe+Y];(P=c.current)!=null&&P.loop&&(ve=fe+Y<0?H[H.length-1]:fe+Y===H.length?H[0]:H[fe+Y]),ve&&z.setState("value",ve.getAttribute(Pu))}function ne(Y){let P=W(),K=P?.closest(Bh),H;for(;K&&!H;)K=Y>0?Ate(K,Bh):Mte(K,Bh),H=K?.querySelector(o8);H?z.setState("value",H.getAttribute(Pu)):ae(Y)}let ue=()=>$(J().length-1),R=Y=>{Y.preventDefault(),Y.metaKey?ue():Y.altKey?ne(1):ae(1)},me=Y=>{Y.preventDefault(),Y.metaKey?$(0):Y.altKey?ne(-1):ae(-1)};return S.createElement(To.div,{ref:e,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:Y=>{var P;(P=j.onKeyDown)==null||P.call(j,Y);let K=Y.nativeEvent.isComposing||Y.keyCode===229;if(!(Y.defaultPrevented||K))switch(Y.key){case"n":case"j":{O&&Y.ctrlKey&&R(Y);break}case"ArrowDown":{R(Y);break}case"p":case"k":{O&&Y.ctrlKey&&me(Y);break}case"ArrowUp":{me(Y);break}case"Home":{Y.preventDefault(),$(0);break}case"End":{Y.preventDefault(),ue();break}case"Enter":{Y.preventDefault();let H=W();if(H){let fe=new Event(d4);H.dispatchEvent(fe)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:Q.inputId,id:Q.labelId,style:Dte},d),Px(t,Y=>S.createElement(F_.Provider,{value:z},S.createElement(q_.Provider,{value:Q},Y))))}),wte=S.forwardRef((t,e)=>{var n,r;let s=ji(),i=S.useRef(null),l=S.useContext(Q_),c=g0(),d=H_(t),h=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;Nc(()=>{if(!h)return c.item(s,l?.id)},[h]);let m=U_(s,i,[t.value,t.children,i],t.keywords),p=o5(),x=vo(E=>E.value&&E.value===m.current),v=vo(E=>h||c.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);S.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener(d4,b),()=>E.removeEventListener(d4,b)},[v,t.onSelect,t.disabled]);function b(){var E,z;k(),(z=(E=d.current).onSelect)==null||z.call(E,m.current)}function k(){p.setState("value",m.current,!0)}if(!v)return null;let{disabled:O,value:j,onSelect:T,forceMount:A,keywords:_,...D}=t;return S.createElement(To.div,{ref:oo(i,e),...D,id:s,"cmdk-item":"",role:"option","aria-disabled":!!O,"aria-selected":!!x,"data-disabled":!!O,"data-selected":!!x,onPointerMove:O||c.getDisablePointerSelection()?void 0:k,onClick:O?void 0:b},t.children)}),Ste=S.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,l=ji(),c=S.useRef(null),d=S.useRef(null),h=ji(),m=g0(),p=vo(v=>s||m.filter()===!1?!0:v.search?v.filtered.groups.has(l):!0);Nc(()=>m.group(l),[]),U_(l,c,[t.value,t.heading,d]);let x=S.useMemo(()=>({id:l,forceMount:s}),[s]);return S.createElement(To.div,{ref:oo(c,e),...i,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&S.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),Px(t,v=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},S.createElement(Q_.Provider,{value:x},v))))}),kte=S.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=S.useRef(null),i=vo(l=>!l.search);return!n&&!i?null:S.createElement(To.div,{ref:oo(s,e),...r,"cmdk-separator":"",role:"separator"})}),Ote=S.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=o5(),l=vo(h=>h.search),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),S.createElement(To.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:s?t.value:l,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),jte=S.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=S.useRef(null),l=S.useRef(null),c=vo(h=>h.selectedItemId),d=g0();return S.useEffect(()=>{if(l.current&&i.current){let h=l.current,m=i.current,p,x=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let v=h.offsetHeight;m.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(p),x.unobserve(h)}}},[]),S.createElement(To.div,{ref:oo(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:d.listId},Px(t,h=>S.createElement("div",{ref:oo(l,d.listInnerRef),"cmdk-list-sizer":""},h)))}),Nte=S.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:l,...c}=t;return S.createElement(W4,{open:n,onOpenChange:r},S.createElement($4,{container:l},S.createElement(nx,{"cmdk-overlay":"",className:s}),S.createElement(rx,{"aria-label":t.label,"cmdk-dialog":"",className:i},S.createElement($_,{ref:e,...c}))))}),Cte=S.forwardRef((t,e)=>vo(n=>n.filtered.count===0)?S.createElement(To.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Tte=S.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return S.createElement(To.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Px(t,l=>S.createElement("div",{"aria-hidden":!0},l)))}),Is=Object.assign($_,{List:jte,Item:wte,Input:Ote,Group:Ste,Separator:kte,Dialog:Nte,Empty:Cte,Loading:Tte});function Ate(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Mte(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function H_(t){let e=S.useRef(t);return Nc(()=>{e.current=t}),e}var Nc=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Bu(t){let e=S.useRef();return e.current===void 0&&(e.current=t()),e}function vo(t){let e=o5(),n=()=>t(e.snapshot());return S.useSyncExternalStore(e.subscribe,n,n)}function U_(t,e,n,r=[]){let s=S.useRef(),i=g0();return Nc(()=>{var l;let c=(()=>{var h;for(let m of n){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(h=m.current.textContent)==null?void 0:h.trim():s.current}})(),d=r.map(h=>h.trim());i.value(t,c,d),(l=e.current)==null||l.setAttribute(Pu,c),s.current=c}),s}var Ete=()=>{let[t,e]=S.useState(),n=Bu(()=>new Map);return Nc(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function _te(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Px({asChild:t,children:e},n){return t&&S.isValidElement(e)?S.cloneElement(_te(e),{ref:e.ref},n(e.props.children)):n(e)}var Dte={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const V_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));V_.displayName=Is.displayName;const W_=S.forwardRef(({className:t,...e},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(Bs,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Is.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})]}));W_.displayName=Is.Input.displayName;const G_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));G_.displayName=Is.List.displayName;const X_=S.forwardRef((t,e)=>a.jsx(Is.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));X_.displayName=Is.Empty.displayName;const Y_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.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}));Y_.displayName=Is.Group.displayName;const Rte=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));Rte.displayName=Is.Separator.displayName;const K_=S.forwardRef(({className:t,...e},n)=>a.jsx(Is.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}));K_.displayName=Is.Item.displayName;function zte({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[l,c]=S.useState(!1),d=m=>{e.includes(m)?n(e.filter(p=>p!==m)):n([...e,m])},h=m=>{n(e.filter(p=>p!==m))};return a.jsxs(uo,{open:l,onOpenChange:c,children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",role:"combobox","aria-expanded":l,className:ye("w-full justify-between min-h-10 h-auto",i),children:[a.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?a.jsx("span",{className:"text-muted-foreground",children:r}):e.map(m=>{const p=t.find(x=>x.value===m);return a.jsxs(On,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:x=>{x.stopPropagation(),h(m)},children:[p?.label||m,a.jsx(Gf,{className:"ml-1 h-3 w-3",strokeWidth:2,fill:"none"})]},m)})}),a.jsx(Sq,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),a.jsx(fl,{className:"w-full p-0",align:"start",children:a.jsxs(V_,{children:[a.jsx(W_,{placeholder:"搜索...",className:"h-9"}),a.jsxs(G_,{children:[a.jsx(X_,{children:s}),a.jsx(Y_,{children:t.map(m=>{const p=e.includes(m.value);return a.jsxs(K_,{value:m.value,onSelect:()=>d(m.value),children:[a.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",p?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:a.jsx(hc,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),a.jsx("span",{children:m.label})]},m.value)})})]})]})})]})}function Pte(){const[t,e]=S.useState([]),[n,r]=S.useState([]),[s,i]=S.useState([]),[l,c]=S.useState(null),[d,h]=S.useState(!0),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState(null),[L,U]=S.useState(!1),[V,ce]=S.useState(null),[W,J]=S.useState(""),[$,ae]=S.useState(new Set),[ne,ue]=S.useState(!1),[R,me]=S.useState(1),[Y,P]=S.useState(20),[K,H]=S.useState(""),{toast:fe}=Pr(),ve=S.useRef(null),Re=S.useRef(null),de=S.useRef(!0);S.useEffect(()=>{We()},[]);const We=async()=>{try{h(!0);const re=await Vu(),Ae=re.models||[];e(Ae),i(Ae.map(yt=>yt.name));const pt=re.api_providers||[];r(pt.map(yt=>yt.name)),c(re.model_task_config||null),k(!1),de.current=!1}catch(re){console.error("加载配置失败:",re)}finally{h(!1)}},ct=async()=>{try{j(!0),xw().catch(()=>{}),A(!0)}catch(re){console.error("重启失败:",re),A(!1),fe({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),j(!1)}},Oe=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"正在重启麦麦..."}),await ct()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"}),p(!1)}},nt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},ut=()=>{A(!1),j(!1),fe({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ct=S.useCallback(async re=>{if(!de.current)try{v(!0),await h2("models",re),k(!1)}catch(Ae){console.error("自动保存模型列表失败:",Ae),k(!0)}finally{v(!1)}},[]),In=S.useCallback(async re=>{if(!de.current)try{v(!0),await h2("model_task_config",re),k(!1)}catch(Ae){console.error("自动保存任务配置失败:",Ae),k(!0)}finally{v(!1)}},[]);S.useEffect(()=>{if(!de.current)return k(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{Ct(t)},2e3),()=>{ve.current&&clearTimeout(ve.current)}},[t,Ct]),S.useEffect(()=>{if(!(de.current||!l))return k(!0),Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{In(l)},2e3),()=>{Re.current&&clearTimeout(Re.current)}},[l,In]);const Tn=async()=>{try{p(!0),ve.current&&clearTimeout(ve.current),Re.current&&clearTimeout(Re.current);const re=await Vu();re.models=t,re.model_task_config=l,await wg(re),k(!1),fe({title:"保存成功",description:"模型配置已保存"}),await We()}catch(re){console.error("保存配置失败:",re),fe({title:"保存失败",description:re.message,variant:"destructive"})}finally{p(!1)}},Jn=(re,Ae)=>{z(re||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),F(Ae),D(!0)},nn=()=>{if(!E)return;const re={...E,price_in:E.price_in??0,price_out:E.price_out??0};let Ae;Q!==null?(Ae=[...t],Ae[Q]=re):Ae=[...t,re],e(Ae),i(Ae.map(pt=>pt.name)),D(!1),z(null),F(null)},_t=re=>{if(!re&&E){const Ae={...E,price_in:E.price_in??0,price_out:E.price_out??0};z(Ae)}D(re)},Yr=re=>{ce(re),U(!0)},qn=()=>{if(V!==null){const re=t.filter((Ae,pt)=>pt!==V);e(re),i(re.map(Ae=>Ae.name)),fe({title:"删除成功",description:"模型已从列表中移除"})}U(!1),ce(null)},or=re=>{const Ae=new Set($);Ae.has(re)?Ae.delete(re):Ae.add(re),ae(Ae)},yn=()=>{if($.size===Be.length)ae(new Set);else{const re=Be.map((Ae,pt)=>t.findIndex(yt=>yt===Be[pt]));ae(new Set(re))}},ft=()=>{if($.size===0){fe({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ue(!0)},ee=()=>{const re=t.filter((Ae,pt)=>!$.has(pt));e(re),i(re.map(Ae=>Ae.name)),ae(new Set),ue(!1),fe({title:"批量删除成功",description:`已删除 ${$.size} 个模型`})},Se=(re,Ae,pt)=>{l&&c({...l,[re]:{...l[re],[Ae]:pt}})},Be=t.filter(re=>{if(!W)return!0;const Ae=W.toLowerCase();return re.name.toLowerCase().includes(Ae)||re.model_identifier.toLowerCase().includes(Ae)||re.api_provider.toLowerCase().includes(Ae)}),rt=Math.ceil(Be.length/Y),Tt=Be.slice((R-1)*Y,R*Y),cr=()=>{const re=parseInt(K);re>=1&&re<=rt&&(me(re),H(""))},Kr=re=>l?[l.utils?.model_list||[],l.utils_small?.model_list||[],l.tool_use?.model_list||[],l.replyer?.model_list||[],l.planner?.model_list||[],l.vlm?.model_list||[],l.voice?.model_list||[],l.embedding?.model_list||[],l.lpmm_entity_extract?.model_list||[],l.lpmm_rdf_build?.model_list||[],l.lpmm_qa?.model_list||[]].some(pt=>pt.includes(re)):!1;return d?a.jsx(mn,{className:"h-full",children:a.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理模型和任务配置"})]}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[a.jsxs(ie,{onClick:Tn,disabled:m||x||!b||O,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[a.jsx(lx,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),m?"保存中...":x?"自动保存中...":b?"保存配置":"已保存"]}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsxs(ie,{disabled:m||x||O,size:"sm",className:"flex-1 sm:flex-none",children:[a.jsx(Z4,{className:"mr-2 h-4 w-4"}),O?"重启中...":b?"保存并重启":"重启麦麦"]})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认重启麦麦?"}),a.jsx(dn,{children:b?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:b?Oe:ct,children:b?"保存并重启":"确认重启"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsxs(od,{children:["配置更新后需要",a.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),a.jsxs(hl,{defaultValue:"models",className:"w-full",children:[a.jsxs(ya,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[a.jsx($t,{value:"models",children:"模型配置"}),a.jsx($t,{value:"tasks",children:"模型任务配置"})]}),a.jsxs(kn,{value:"models",className:"space-y-4 mt-0",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),a.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[$.size>0&&a.jsxs(ie,{onClick:ft,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",$.size,")"]}),a.jsxs(ie,{onClick:()=>Jn(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(Wr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[a.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索模型名称、标识符或提供商...",value:W,onChange:re=>J(re.target.value),className:"pl-9"})]}),W&&a.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Be.length," 个结果"]})]}),a.jsx("div",{className:"md:hidden space-y-3",children:Tt.length===0?a.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:W?"未找到匹配的模型":"暂无模型配置"}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("h3",{className:"font-semibold text-base",children:re.name}),a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})]}),a.jsx("p",{className:"text-xs text-muted-foreground break-all",title:re.model_identifier,children:re.model_identifier})]}),a.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),a.jsx("p",{className:"font-medium",children:re.api_provider})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),a.jsx("p",{className:"font-medium",children:re.force_stream_mode?"是":"否"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_in,"/M"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),a.jsxs("p",{className:"font-medium",children:["¥",re.price_out,"/M"]})]})]})]},Ae)})}),a.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:$.size===Be.length&&Be.length>0,onCheckedChange:yn})}),a.jsx(xt,{className:"w-24",children:"使用状态"}),a.jsx(xt,{children:"模型名称"}),a.jsx(xt,{children:"模型标识符"}),a.jsx(xt,{children:"提供商"}),a.jsx(xt,{className:"text-right",children:"输入价格"}),a.jsx(xt,{className:"text-right",children:"输出价格"}),a.jsx(xt,{className:"text-center",children:"强制流式"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:Tt.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:9,className:"text-center text-muted-foreground py-8",children:W?"未找到匹配的模型":"暂无模型配置"})}):Tt.map((re,Ae)=>{const pt=t.findIndex(vs=>vs===re),yt=Kr(re.name);return a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:$.has(pt),onCheckedChange:()=>or(pt)})}),a.jsx(it,{children:a.jsx(On,{variant:yt?"default":"secondary",className:yt?"bg-green-600 hover:bg-green-700":"",children:yt?"已使用":"未使用"})}),a.jsx(it,{className:"font-medium",children:re.name}),a.jsx(it,{className:"max-w-xs truncate",title:re.model_identifier,children:re.model_identifier}),a.jsx(it,{children:re.api_provider}),a.jsxs(it,{className:"text-right",children:["¥",re.price_in,"/M"]}),a.jsxs(it,{className:"text-right",children:["¥",re.price_out,"/M"]}),a.jsx(it,{className:"text-center",children:re.force_stream_mode?"是":"否"}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Jn(re,pt),children:[a.jsx(nd,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>Yr(pt),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Ae)})})]})}),Be.length>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:Y.toString(),onValueChange:re=>{P(parseInt(re)),me(1),ae(new Set)},children:[a.jsx(Dt,{id:"page-size-model",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*Y+1," 到"," ",Math.min(R*Y,Be.length)," 条,共 ",Be.length," 条"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>me(1),disabled:R===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>me(re=>Math.max(1,re-1)),disabled:R===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:K,onChange:re=>H(re.target.value),onKeyDown:re=>re.key==="Enter"&&cr(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),a.jsx(ie,{variant:"outline",size:"sm",onClick:cr,disabled:!K,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>me(re=>re+1),disabled:R>=rt,children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>me(rt),disabled:R>=rt,className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]}),a.jsxs(kn,{value:"tasks",className:"space-y-6 mt-0",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),l&&a.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[a.jsx(Pi,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:l.utils,modelNames:s,onChange:(re,Ae)=>Se("utils",re,Ae)}),a.jsx(Pi,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:l.utils_small,modelNames:s,onChange:(re,Ae)=>Se("utils_small",re,Ae)}),a.jsx(Pi,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:l.tool_use,modelNames:s,onChange:(re,Ae)=>Se("tool_use",re,Ae)}),a.jsx(Pi,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:l.replyer,modelNames:s,onChange:(re,Ae)=>Se("replyer",re,Ae)}),a.jsx(Pi,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:l.planner,modelNames:s,onChange:(re,Ae)=>Se("planner",re,Ae)}),a.jsx(Pi,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:l.vlm,modelNames:s,onChange:(re,Ae)=>Se("vlm",re,Ae),hideTemperature:!0}),a.jsx(Pi,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:l.voice,modelNames:s,onChange:(re,Ae)=>Se("voice",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsx(Pi,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:l.embedding,modelNames:s,onChange:(re,Ae)=>Se("embedding",re,Ae),hideTemperature:!0,hideMaxTokens:!0}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),a.jsx(Pi,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:l.lpmm_entity_extract,modelNames:s,onChange:(re,Ae)=>Se("lpmm_entity_extract",re,Ae)}),a.jsx(Pi,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:l.lpmm_rdf_build,modelNames:s,onChange:(re,Ae)=>Se("lpmm_rdf_build",re,Ae)}),a.jsx(Pi,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:l.lpmm_qa,modelNames:s,onChange:(re,Ae)=>Se("lpmm_qa",re,Ae)})]})]})]})]}),a.jsx(Rr,{open:_,onOpenChange:_t,children:a.jsxs(Nr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:Q!==null?"编辑模型":"添加模型"}),a.jsx(Gr,{children:"配置模型的基本信息和参数"})]}),a.jsxs("div",{className:"grid gap-4 py-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_name",children:"模型名称 *"}),a.jsx(Me,{id:"model_name",value:E?.name||"",onChange:re=>z(Ae=>Ae?{...Ae,name:re.target.value}:null),placeholder:"例如: qwen3-30b"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"model_identifier",children:"模型标识符 *"}),a.jsx(Me,{id:"model_identifier",value:E?.model_identifier||"",onChange:re=>z(Ae=>Ae?{...Ae,model_identifier:re.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"api_provider",children:"API 提供商 *"}),a.jsxs(Lt,{value:E?.api_provider||"",onValueChange:re=>z(Ae=>Ae?{...Ae,api_provider:re}:null),children:[a.jsx(Dt,{id:"api_provider",children:a.jsx(It,{placeholder:"选择提供商"})}),a.jsx(Rt,{children:n.map(re=>a.jsx(Pe,{value:re,children:re},re))})]})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),a.jsx(Me,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);z(pt=>pt?{...pt,price_in:Ae}:null)},placeholder:"默认: 0"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),a.jsx(Me,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:re=>{const Ae=re.target.value===""?null:parseFloat(re.target.value);z(pt=>pt?{...pt,price_out:Ae}:null)},placeholder:"默认: 0"})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:re=>z(Ae=>Ae?{...Ae,force_stream_mode:re}:null)}),a.jsx(te,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>D(!1),children:"取消"}),a.jsx(ie,{onClick:nn,children:"保存"})]})]})}),a.jsx(pn,{open:L,onOpenChange:U,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:qn,children:"删除"})]})]})}),a.jsx(pn,{open:ne,onOpenChange:ue,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",$.size," 个模型吗? 此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&a.jsx(vw,{onRestartComplete:nt,onRestartFailed:ut})]})})}function Pi({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:l=!1}){const c=d=>{s("model_list",d)};return a.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),a.jsxs("div",{className:"grid gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"模型列表"}),a.jsx(zte,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:c,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(te,{children:"温度"}),a.jsx(Me,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:d=>{const h=parseFloat(d.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),a.jsx(yx,{value:[n.temperature??.3],onValueChange:d=>s("temperature",d[0]),min:0,max:1,step:.1,className:"w-full"})]}),!l&&a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{children:"最大 Token"}),a.jsx(Me,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:d=>s("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Bx="/api/webui/config";async function Bte(){const e=await(await ot(`${Bx}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function Lte(t){const n=await(await ot(`${Bx}/adapter-config/path`,{method:"POST",headers:bt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function Ite(t){const n=await(await ot(`${Bx}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function c8(t,e){const r=await(await ot(`${Bx}/adapter-config`,{method:"POST",headers:bt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Zs={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}};function qte(){const[t,e]=S.useState("upload"),[n,r]=S.useState(null),[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(""),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(null),_=S.useRef(null),{toast:D}=Pr(),E=S.useRef(null),z=K=>{if(!K.trim())return{valid:!1,error:"路径不能为空"};const H=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,fe=/^(\/|~\/).+\.toml$/i,ve=H.test(K),Re=fe.test(K);return!ve&&!Re?{valid:!1,error:"路径格式错误。Windows: C:\\path\\file.toml,Linux: /path/file.toml"}:K.toLowerCase().endsWith(".toml")?/[<>"|?*\x00-\x1F]/.test(K)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}:{valid:!1,error:"文件必须是 .toml 格式"}},Q=K=>{if(c(K),K.trim()){const H=z(K);h(H.error)}else h("")};S.useEffect(()=>{(async()=>{try{const H=await Bte();H&&H.path&&(c(H.path),e("path"),await F(H.path))}catch(H){console.error("加载保存的路径失败:",H)}})()},[]);const F=async K=>{const H=z(K);if(!H.valid){h(H.error),D({title:"路径无效",description:H.error,variant:"destructive"});return}h(""),v(!0);try{const fe=await Ite(K),ve=ue(fe);r(ve),c(K),await Lte(K),D({title:"加载成功",description:"已从配置文件加载"})}catch(fe){console.error("加载配置失败:",fe),D({title:"加载失败",description:fe instanceof Error?fe.message:"无法读取配置文件",variant:"destructive"})}finally{v(!1)}},L=S.useCallback(K=>{t!=="path"||!l||(E.current&&clearTimeout(E.current),E.current=setTimeout(async()=>{p(!0);try{const H=R(K);await c8(l,H),D({title:"自动保存成功",description:"配置已保存到文件"})}catch(H){console.error("自动保存失败:",H),D({title:"自动保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},1e3))},[t,l,D]),U=async()=>{if(!n||!l)return;const K=z(l);if(!K.valid){D({title:"保存失败",description:K.error,variant:"destructive"});return}p(!0);try{const H=R(n);await c8(l,H),D({title:"保存成功",description:"配置已保存到文件"})}catch(H){console.error("保存失败:",H),D({title:"保存失败",description:H instanceof Error?H.message:"保存配置失败",variant:"destructive"})}finally{p(!1)}},V=async()=>{l&&await F(l)},ce=K=>{if(K!==t){if(n){A(K),k(!0);return}W(K)}},W=K=>{r(null),i(""),h(""),e(K),D({title:"已切换模式",description:K==="upload"?"现在可以上传配置文件":"现在可以指定配置文件路径"})},J=()=>{T&&(W(T),A(null)),k(!1)},$=()=>{if(n){j(!0);return}ae()},ae=()=>{c(""),r(null),h(""),D({title:"已清空",description:"路径和配置已清空"})},ne=()=>{ae(),j(!1)},ue=K=>{const H=JSON.parse(JSON.stringify(Zs)),fe=K.split(` +`);let ve="";for(const Re of fe){const de=Re.trim();if(!de||de.startsWith("#"))continue;const We=de.match(/^\[(\w+)\]$/);if(We){ve=We[1];continue}const ct=de.match(/^(\w+)\s*=\s*(.+)$/);if(ct&&ve){const[,Oe,nt]=ct,ut=nt.trim();let Ct;if(ut==="true")Ct=!0;else if(ut==="false")Ct=!1;else if(ut.startsWith("[")&&ut.endsWith("]")){const In=ut.slice(1,-1).trim();if(In){const Tn=In.split(",").map(nn=>{const _t=nn.trim();return isNaN(Number(_t))?_t.replace(/"/g,""):Number(_t)}),Jn=typeof Tn[0];Ct=Tn.every(nn=>typeof nn===Jn)?Tn:Tn.filter(nn=>typeof nn=="number")}else Ct=[]}else ut.startsWith('"')&&ut.endsWith('"')?Ct=ut.slice(1,-1):isNaN(Number(ut))?Ct=ut.replace(/"/g,""):Ct=Number(ut);if(ve in H){const In=H[ve];In[Oe]=Ct}}}return H},R=K=>{const H=[],fe=(ve,Re)=>ve===""||ve===null||ve===void 0?Re:ve;return H.push("[inner]"),H.push(`version = "${fe(K.inner.version,Zs.inner.version)}" # 版本号`),H.push("# 请勿修改版本号,除非你知道自己在做什么"),H.push(""),H.push("[nickname] # 现在没用"),H.push(`nickname = "${fe(K.nickname.nickname,Zs.nickname.nickname)}"`),H.push(""),H.push("[napcat_server] # Napcat连接的ws服务设置"),H.push(`host = "${fe(K.napcat_server.host,Zs.napcat_server.host)}" # Napcat设定的主机地址`),H.push(`port = ${fe(K.napcat_server.port||0,Zs.napcat_server.port)} # Napcat设定的端口`),H.push(`token = "${fe(K.napcat_server.token,Zs.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),H.push(`heartbeat_interval = ${fe(K.napcat_server.heartbeat_interval||0,Zs.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),H.push(""),H.push("[maibot_server] # 连接麦麦的ws服务设置"),H.push(`host = "${fe(K.maibot_server.host,Zs.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),H.push(`port = ${fe(K.maibot_server.port||0,Zs.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),H.push(""),H.push("[chat] # 黑白名单功能"),H.push(`group_list_type = "${fe(K.chat.group_list_type,Zs.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),H.push(`group_list = [${K.chat.group_list.join(", ")}] # 群组名单`),H.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),H.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),H.push(`private_list_type = "${fe(K.chat.private_list_type,Zs.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),H.push(`private_list = [${K.chat.private_list.join(", ")}] # 私聊名单`),H.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),H.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),H.push(`ban_user_id = [${K.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),H.push(`ban_qq_bot = ${K.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),H.push(`enable_poke = ${K.chat.enable_poke} # 是否启用戳一戳功能`),H.push(""),H.push("[voice] # 发送语音设置"),H.push(`use_tts = ${K.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),H.push(""),H.push("[debug]"),H.push(`level = "${fe(K.debug.level,Zs.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),H.join(` +`)},me=K=>{const H=K.target.files?.[0];if(!H)return;const fe=new FileReader;fe.onload=ve=>{try{const Re=ve.target?.result,de=ue(Re);r(de),i(H.name),D({title:"上传成功",description:`已加载配置文件:${H.name}`})}catch(Re){console.error("解析配置文件失败:",Re),D({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},fe.readAsText(H)},Y=()=>{if(!n)return;const K=R(n),H=new Blob([K],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL(H),ve=document.createElement("a");ve.href=fe,ve.download=s||"config.toml",document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(fe),D({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},P=()=>{r(JSON.parse(JSON.stringify(Zs))),i("config.toml"),D({title:"已加载默认配置",description:"可以开始编辑配置"})};return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"工作模式"}),a.jsx(Sr,{children:"选择配置文件的管理方式"})]}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4",children:[a.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:()=>ce("upload"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(oO,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),a.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:()=>ce("path"),children:a.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[a.jsx(kq,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="path"&&a.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs("div",{className:"flex-1 space-y-1",children:[a.jsx(Me,{id:"config-path",value:l,onChange:K=>Q(K.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${d?"border-destructive":""}`}),d&&a.jsx("p",{className:"text-xs text-destructive",children:d})]}),a.jsx(ie,{onClick:()=>F(l),disabled:x||!l||!!d,className:"w-full sm:w-auto",children:x?a.jsxs(a.Fragment,{children:[a.jsx(Fi,{className:"h-4 w-4 animate-spin mr-2"}),a.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sm:hidden",children:"加载配置"}),a.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),a.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[a.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[a.jsx("span",{children:"路径格式说明"}),a.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"C:\\Adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),a.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[a.jsx("div",{children:"/opt/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),a.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),a.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),a.jsxs(ld,{children:[a.jsx(co,{className:"h-4 w-4"}),a.jsx(od,{children:t==="upload"?a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",m&&" (正在保存...)"]})})]}),t==="upload"&&!n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[a.jsx("input",{ref:_,type:"file",accept:".toml",className:"hidden",onChange:me}),a.jsxs(ie,{onClick:()=>_.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(oO,{className:"mr-2 h-4 w-4"}),"上传配置"]}),a.jsxs(ie,{onClick:P,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&a.jsx("div",{className:"flex gap-2",children:a.jsxs(ie,{onClick:Y,size:"sm",className:"w-full sm:w-auto",children:[a.jsx(fc,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),t==="path"&&n&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[a.jsxs(ie,{onClick:U,size:"sm",disabled:m||!!d,className:"w-full sm:w-auto",children:[a.jsx(lx,{className:"mr-2 h-4 w-4"}),m?"保存中...":"立即保存"]}),a.jsxs(ie,{onClick:V,size:"sm",variant:"outline",disabled:x,className:"w-full sm:w-auto",children:[a.jsx(Fi,{className:`mr-2 h-4 w-4 ${x?"animate-spin":""}`}),"刷新"]}),a.jsxs(ie,{onClick:$,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[a.jsx(Ht,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?a.jsxs(hl,{defaultValue:"napcat",className:"w-full",children:[a.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:a.jsxs(ya,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[a.jsxs($t,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),a.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),a.jsxs($t,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),a.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),a.jsxs($t,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),a.jsx("span",{className:"sm:hidden",children:"聊天"})]}),a.jsxs($t,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[a.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),a.jsx("span",{className:"sm:hidden",children:"语音"})]}),a.jsx($t,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),a.jsx(kn,{value:"napcat",className:"space-y-4",children:a.jsx(Fte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"maibot",className:"space-y-4",children:a.jsx(Qte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"chat",className:"space-y-4",children:a.jsx($te,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"voice",className:"space-y-4",children:a.jsx(Hte,{config:n,onChange:K=>{r(K),L(K)}})}),a.jsx(kn,{value:"debug",className:"space-y-4",children:a.jsx(Ute,{config:n,onChange:K=>{r(K),L(K)}})})]}):a.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:a.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[a.jsx(ao,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),a.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),a.jsx(pn,{open:b,onOpenChange:k,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认切换模式"}),a.jsxs(dn,{children:["切换模式将清空当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>{k(!1),A(null)},children:"取消"}),a.jsx(hn,{onClick:J,children:"确认切换"})]})]})}),a.jsx(pn,{open:O,onOpenChange:j,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认清空路径"}),a.jsxs(dn,{children:["清空路径将清除当前配置,确定要继续吗?",a.jsx("br",{}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),a.jsxs(cn,{children:[a.jsx(fn,{onClick:()=>j(!1),children:"取消"}),a.jsx(hn,{onClick:ne,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Fte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Qte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),a.jsxs("div",{className:"grid gap-3 md:gap-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),a.jsx(Me,{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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function $te({config:t,onChange:e}){const n=i=>{const l={...t};i==="group"?l.chat.group_list=[...l.chat.group_list,0]:i==="private"?l.chat.private_list=[...l.chat.private_list,0]:l.chat.ban_user_id=[...l.chat.ban_user_id,0],e(l)},r=(i,l)=>{const c={...t};i==="group"?c.chat.group_list=c.chat.group_list.filter((d,h)=>h!==l):i==="private"?c.chat.private_list=c.chat.private_list.filter((d,h)=>h!==l):c.chat.ban_user_id=c.chat.ban_user_id.filter((d,h)=>h!==l),e(c)},s=(i,l,c)=>{const d={...t};i==="group"?d.chat.group_list[l]=c:i==="private"?d.chat.private_list[l]=c:d.chat.ban_user_id[l]=c,e(d)};return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),a.jsxs("div",{className:"grid gap-4 md:gap-6",children:[a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组名单类型"}),a.jsxs(Lt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"群组列表"}),a.jsxs(ie,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("group",l,parseInt(c.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("group",l),children:"删除"})]})]})]})]},l)),t.chat.group_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),a.jsxs("div",{className:"space-y-3 md:space-y-4",children:[a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊名单类型"}),a.jsxs(Lt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),a.jsx(Pe,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsx(te,{className:"text-sm md:text-base",children:"私聊列表"}),a.jsxs(ie,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("private",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("private",l),children:"删除"})]})]})]})]},l)),t.chat.private_list.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"全局禁止名单"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),a.jsxs(ie,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[a.jsx(ao,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,l)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Me,{type:"number",value:i,onChange:c=>s("ban",l,parseInt(c.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),a.jsxs(pn,{children:[a.jsx(jr,{asChild:!0,children:a.jsx(ie,{size:"icon",variant:"outline",children:a.jsx(Ht,{className:"h-4 w-4"})})}),a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>r("ban",l),children:"删除"})]})]})]})]},l)),t.chat.ban_user_id.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),a.jsx(jt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),a.jsx(jt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Hte({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),a.jsx(jt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Ute({config:t,onChange:e}){return a.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),a.jsx("div",{className:"grid gap-3 md:gap-4",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsx(te,{className:"text-sm md:text-base",children:"日志等级"}),a.jsxs(Lt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"DEBUG",children:"DEBUG(调试)"}),a.jsx(Pe,{value:"INFO",children:"INFO(信息)"}),a.jsx(Pe,{value:"WARNING",children:"WARNING(警告)"}),a.jsx(Pe,{value:"ERROR",children:"ERROR(错误)"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function u8(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const l=n.slice(s,r).trim();(l||!i)&&e.push(l),s=r+1,r=n.indexOf(",",s)}return e}function Vte(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Wte=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gte=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xte={};function d8(t,e){return(Xte.jsx?Gte:Wte).test(t)}const Yte=/[ \t\n\f\r]/g;function Kte(t){return typeof t=="object"?t.type==="text"?h8(t.value):!1:h8(t)}function h8(t){return t.replace(Yte,"")===""}class x0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}x0.prototype.normal={};x0.prototype.property={};x0.prototype.space=void 0;function Z_(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new x0(n,r,e)}function Pf(t){return t.toLowerCase()}class qs{constructor(e,n){this.attribute=n,this.property=e}}qs.prototype.attribute="";qs.prototype.booleanish=!1;qs.prototype.boolean=!1;qs.prototype.commaOrSpaceSeparated=!1;qs.prototype.commaSeparated=!1;qs.prototype.defined=!1;qs.prototype.mustUseProperty=!1;qs.prototype.number=!1;qs.prototype.overloadedBoolean=!1;qs.prototype.property="";qs.prototype.spaceSeparated=!1;qs.prototype.space=void 0;let Zte=0;const Ot=Dc(),mr=Dc(),h4=Dc(),ze=Dc(),Bn=Dc(),Ju=Dc(),Js=Dc();function Dc(){return 2**++Zte}const f4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ot,booleanish:mr,commaOrSpaceSeparated:Js,commaSeparated:Ju,number:ze,overloadedBoolean:h4,spaceSeparated:Bn},Symbol.toStringTag,{value:"Module"})),hb=Object.keys(f4);class c5 extends qs{constructor(e,n,r,s){let i=-1;if(super(e,n),f8(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&rne.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(m8,ine);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!m8.test(i)){let l=i.replace(nne,sne);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}s=c5}return new s(r,e)}function sne(t){return"-"+t.toLowerCase()}function ine(t){return t.charAt(1).toUpperCase()}const aD=Z_([J_,Jte,nD,rD,sD],"html"),Lx=Z_([J_,ene,nD,rD,sD],"svg");function p8(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function ane(t){return t.join(" ").trim()}var Nu={},fb,g8;function lne(){if(g8)return fb;g8=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=` +`,h="/",m="*",p="",x="comment",v="declaration";function b(O,j){if(typeof O!="string")throw new TypeError("First argument must be a string");if(!O)return[];j=j||{};var T=1,A=1;function _(W){var J=W.match(e);J&&(T+=J.length);var $=W.lastIndexOf(d);A=~$?W.length-$:A+W.length}function D(){var W={line:T,column:A};return function(J){return J.position=new E(W),F(),J}}function E(W){this.start=W,this.end={line:T,column:A},this.source=j.source}E.prototype.content=O;function z(W){var J=new Error(j.source+":"+T+":"+A+": "+W);if(J.reason=W,J.filename=j.source,J.line=T,J.column=A,J.source=O,!j.silent)throw J}function Q(W){var J=W.exec(O);if(J){var $=J[0];return _($),O=O.slice($.length),J}}function F(){Q(n)}function L(W){var J;for(W=W||[];J=U();)J!==!1&&W.push(J);return W}function U(){var W=D();if(!(h!=O.charAt(0)||m!=O.charAt(1))){for(var J=2;p!=O.charAt(J)&&(m!=O.charAt(J)||h!=O.charAt(J+1));)++J;if(J+=2,p===O.charAt(J-1))return z("End of comment missing");var $=O.slice(2,J-2);return A+=2,_($),O=O.slice(J),A+=2,W({type:x,comment:$})}}function V(){var W=D(),J=Q(r);if(J){if(U(),!Q(s))return z("property missing ':'");var $=Q(i),ae=W({type:v,property:k(J[0].replace(t,p)),value:$?k($[0].replace(t,p)):p});return Q(l),ae}}function ce(){var W=[];L(W);for(var J;J=V();)J!==!1&&(W.push(J),L(W));return W}return F(),ce()}function k(O){return O?O.replace(c,p):p}return fb=b,fb}var x8;function one(){if(x8)return Nu;x8=1;var t=Nu&&Nu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.default=n;const e=t(lne());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const l=(0,e.default)(r),c=typeof s=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;c?s(h,m,d):m&&(i=i||{},i[h]=m)}),i}return Nu}var Lh={},v8;function cne(){if(v8)return Lh;v8=1,Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.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)},l=function(h,m){return m.toUpperCase()},c=function(h,m){return"".concat(m,"-")},d=function(h,m){return m===void 0&&(m={}),i(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(s,c):h=h.replace(r,c),h.replace(e,l))};return Lh.camelCase=d,Lh}var Ih,y8;function une(){if(y8)return Ih;y8=1;var t=Ih&&Ih.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(one()),n=cne();function r(s,i){var l={};return!s||typeof s!="string"||(0,e.default)(s,function(c,d){c&&d&&(l[(0,n.camelCase)(c,i)]=d)}),l}return r.default=r,Ih=r,Ih}var dne=une();const hne=u9(dne),lD=oD("end"),u5=oD("start");function oD(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 fne(t){const e=u5(t),n=lD(t);if(e&&n)return{start:e,end:n}}function af(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?b8(t.position):"start"in t||"end"in t?b8(t):"line"in t||"column"in t?m4(t):""}function m4(t){return w8(t&&t.line)+":"+w8(t&&t.column)}function b8(t){return m4(t&&t.start)+"-"+m4(t&&t.end)}function w8(t){return t&&typeof t=="number"?t:1}class as extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},l=!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&&(l=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?i.ruleId=r:(i.source=r.slice(0,d),i.ruleId=r.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const c=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=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=af(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=l&&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}}as.prototype.file="";as.prototype.name="";as.prototype.reason="";as.prototype.message="";as.prototype.stack="";as.prototype.column=void 0;as.prototype.line=void 0;as.prototype.ancestors=void 0;as.prototype.cause=void 0;as.prototype.fatal=void 0;as.prototype.place=void 0;as.prototype.ruleId=void 0;as.prototype.source=void 0;const d5={}.hasOwnProperty,mne=new Map,pne=/[A-Z]/g,gne=new Set(["table","tbody","thead","tfoot","tr"]),xne=new Set(["td","th"]),cD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vne(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=Nne(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=jne(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"?Lx:aD,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=uD(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function uD(t,e,n){if(e.type==="element")return yne(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return bne(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Sne(t,e,n);if(e.type==="mdxjsEsm")return wne(t,e);if(e.type==="root")return kne(t,e,n);if(e.type==="text")return One(t,e)}function yne(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=hD(t,e.tagName,!1),l=Cne(t,e);let c=f5(t,e);return gne.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Kte(d):!0})),dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function bne(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)}Bf(t,e.position)}function wne(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Bf(t,e.position)}function Sne(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Lx,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:hD(t,e.name,!0),l=Tne(t,e),c=f5(t,e);return dD(t,l,i,e),h5(l,c),t.ancestors.pop(),t.schema=r,t.create(e,i,l,n)}function kne(t,e,n){const r={};return h5(r,f5(t,e)),t.create(e,t.Fragment,r,n)}function One(t,e){return e.value}function dD(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function h5(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function jne(t,e,n){return r;function r(s,i,l,c){const h=Array.isArray(l.children)?n:e;return c?h(i,l,c):h(i,l)}}function Nne(t,e){return n;function n(r,s,i,l){const c=Array.isArray(i.children),d=u5(r);return e(s,i,l,c,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function Cne(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&d5.call(e.properties,s)){const i=Ane(t,s,e.properties[s]);if(i){const[l,c]=i;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&xne.has(e.tagName)?r=c:n[l]=c}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Tne(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 l=i.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else Bf(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 c=r.value.data.estree.body[0];c.type,i=t.evaluater.evaluateExpression(c.expression)}else Bf(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function f5(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:mne;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);i0?(si(t,t.length,0,e),t):e}const O8={}.hasOwnProperty;function mD(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ds=Ao(/[A-Za-z]/),rs=Ao(/[\dA-Za-z]/),Lne=Ao(/[#-'*+\--9=?A-Z^-~]/);function Hg(t){return t!==null&&(t<32||t===127)}const p4=Ao(/\d/),Ine=Ao(/[\dA-Fa-f]/),qne=Ao(/[!-/:-@[-`{-~]/);function Ze(t){return t!==null&&t<-2}function Rn(t){return t!==null&&(t<0||t===32)}function qt(t){return t===-2||t===-1||t===32}const Ix=Ao(new RegExp("\\p{P}|\\p{S}","u")),Cc=Ao(/\s/);function Ao(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Dd(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const c=t.charCodeAt(n+1);i<56320&&c>56319&&c<57344?(l=String.fromCharCode(i,c),s=1):l="�"}else l=String.fromCharCode(i);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+s+1,l=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function zt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(d){return qt(d)?(t.enter(n),c(d)):e(d)}function c(d){return qt(d)&&i++l))return;const z=e.events.length;let Q=z,F,L;for(;Q--;)if(e.events[Q][0]==="exit"&&e.events[Q][1].type==="chunkFlow"){if(F){L=e.events[Q][1].end;break}F=!0}for(j(r),E=z;EA;){const D=n[_];e.containerState=D[1],D[0].exit.call(e,t)}n.length=A}function T(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function Une(t,e,n){return zt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vd(t){if(t===null||Rn(t)||Cc(t))return 1;if(Ix(t))return 2}function qx(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const p={...t[r][1].end},x={...t[n][1].start};N8(p,-d),N8(x,d),l={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...t[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},i={type:d>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=bi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=bi(h,[["enter",s,e],["enter",l,e],["exit",l,e],["enter",i,e]]),h=bi(h,qx(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=bi(h,[["exit",i,e],["enter",c,e],["exit",c,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(m=2,h=bi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):m=0,si(t,r-1,n-r+3,h),n=r+h.length-m-2;break}}for(n=-1;++n0&&qt(E)?zt(t,T,"linePrefix",i+1)(E):T(E)}function T(E){return E===null||Ze(E)?t.check(C8,k,_)(E):(t.enter("codeFlowValue"),A(E))}function A(E){return E===null||Ze(E)?(t.exit("codeFlowValue"),T(E)):(t.consume(E),A)}function _(E){return t.exit("codeFenced"),e(E)}function D(E,z,Q){let F=0;return L;function L(J){return E.enter("lineEnding"),E.consume(J),E.exit("lineEnding"),U}function U(J){return E.enter("codeFencedFence"),qt(J)?zt(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):V(J)}function V(J){return J===c?(E.enter("codeFencedFenceSequence"),ce(J)):Q(J)}function ce(J){return J===c?(F++,E.consume(J),ce):F>=l?(E.exit("codeFencedFenceSequence"),qt(J)?zt(E,W,"whitespace")(J):W(J)):Q(J)}function W(J){return J===null||Ze(J)?(E.exit("codeFencedFence"),z(J)):Q(J)}}}function rre(t,e,n){const r=this;return s;function s(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const pb={name:"codeIndented",tokenize:ire},sre={partial:!0,tokenize:are};function ire(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),zt(t,i,"linePrefix",5)(h)}function i(h){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?d(h):Ze(h)?t.attempt(sre,l,d)(h):(t.enter("codeFlowValue"),c(h))}function c(h){return h===null||Ze(h)?(t.exit("codeFlowValue"),l(h)):(t.consume(h),c)}function d(h){return t.exit("codeIndented"),e(h)}}function are(t,e,n){const r=this;return s;function s(l){return r.parser.lazy[r.now().line]?n(l):Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):zt(t,i,"linePrefix",5)(l)}function i(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):Ze(l)?s(l):n(l)}}const lre={name:"codeText",previous:cre,resolve:ore,tokenize:ure};function ore(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&qh(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),qh(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qh(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function bD(t,e,n,r,s,i,l,c,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(j){return j===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(j),t.exit(i),x):j===null||j===32||j===41||Hg(j)?n(j):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),k(j))}function x(j){return j===62?(t.enter(i),t.consume(j),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),v(j))}function v(j){return j===62?(t.exit("chunkString"),t.exit(c),x(j)):j===null||j===60||Ze(j)?n(j):(t.consume(j),j===92?b:v)}function b(j){return j===60||j===62||j===92?(t.consume(j),v):v(j)}function k(j){return!m&&(j===null||j===41||Rn(j))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(j)):m999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(t.exit(i),t.enter(s),t.consume(v),t.exit(s),t.exit(r),e):Ze(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),m):(t.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Ze(v)||c++>999?(t.exit("chunkString"),m(v)):(t.consume(v),d||(d=!qt(v)),v===92?x:p)}function x(v){return v===91||v===92||v===93?(t.consume(v),c++,p):p(v)}}function SD(t,e,n,r,s,i){let l;return c;function c(x){return x===34||x===39||x===40?(t.enter(r),t.enter(s),t.consume(x),t.exit(s),l=x===40?41:x,d):n(x)}function d(x){return x===l?(t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):(t.enter(i),h(x))}function h(x){return x===l?(t.exit(i),d(l)):x===null?n(x):Ze(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),zt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===l||x===null||Ze(x)?(t.exit("chunkString"),h(x)):(t.consume(x),x===92?p:m)}function p(x){return x===l||x===92?(t.consume(x),m):m(x)}}function lf(t,e){let n;return r;function r(s){return Ze(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):qt(s)?zt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const vre={name:"definition",tokenize:bre},yre={partial:!0,tokenize:wre};function bre(t,e,n){const r=this;let s;return i;function i(v){return t.enter("definition"),l(v)}function l(v){return wD.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=Qi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),d):n(v)}function d(v){return Rn(v)?lf(t,h)(v):h(v)}function h(v){return bD(t,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return t.attempt(yre,p,p)(v)}function p(v){return qt(v)?zt(t,x,"whitespace")(v):x(v)}function x(v){return v===null||Ze(v)?(t.exit("definition"),r.parser.defined.push(s),e(v)):n(v)}}function wre(t,e,n){return r;function r(c){return Rn(c)?lf(t,s)(c):n(c)}function s(c){return SD(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function i(c){return qt(c)?zt(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Ze(c)?e(c):n(c)}}const Sre={name:"hardBreakEscape",tokenize:kre};function kre(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Ze(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Ore={name:"headingAtx",resolve:jre,tokenize:Nre};function jre(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"},si(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Nre(t,e,n){let r=0;return s;function s(m){return t.enter("atxHeading"),i(m)}function i(m){return t.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(t.consume(m),l):m===null||Rn(m)?(t.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(t.enter("atxHeadingSequence"),d(m)):m===null||Ze(m)?(t.exit("atxHeading"),e(m)):qt(m)?zt(t,c,"whitespace")(m):(t.enter("atxHeadingText"),h(m))}function d(m){return m===35?(t.consume(m),d):(t.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||Rn(m)?(t.exit("atxHeadingText"),c(m)):(t.consume(m),h)}}const Cre=["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"],A8=["pre","script","style","textarea"],Tre={concrete:!0,name:"htmlFlow",resolveTo:Ere,tokenize:_re},Are={partial:!0,tokenize:Rre},Mre={partial:!0,tokenize:Dre};function Ere(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 _re(t,e,n){const r=this;let s,i,l,c,d;return h;function h(P){return m(P)}function m(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),p}function p(P){return P===33?(t.consume(P),x):P===47?(t.consume(P),i=!0,k):P===63?(t.consume(P),s=3,r.interrupt?e:R):ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function x(P){return P===45?(t.consume(P),s=2,v):P===91?(t.consume(P),s=5,c=0,b):ds(P)?(t.consume(P),s=4,r.interrupt?e:R):n(P)}function v(P){return P===45?(t.consume(P),r.interrupt?e:R):n(P)}function b(P){const K="CDATA[";return P===K.charCodeAt(c++)?(t.consume(P),c===K.length?r.interrupt?e:V:b):n(P)}function k(P){return ds(P)?(t.consume(P),l=String.fromCharCode(P),O):n(P)}function O(P){if(P===null||P===47||P===62||Rn(P)){const K=P===47,H=l.toLowerCase();return!K&&!i&&A8.includes(H)?(s=1,r.interrupt?e(P):V(P)):Cre.includes(l.toLowerCase())?(s=6,K?(t.consume(P),j):r.interrupt?e(P):V(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):i?T(P):A(P))}return P===45||rs(P)?(t.consume(P),l+=String.fromCharCode(P),O):n(P)}function j(P){return P===62?(t.consume(P),r.interrupt?e:V):n(P)}function T(P){return qt(P)?(t.consume(P),T):L(P)}function A(P){return P===47?(t.consume(P),L):P===58||P===95||ds(P)?(t.consume(P),_):qt(P)?(t.consume(P),A):L(P)}function _(P){return P===45||P===46||P===58||P===95||rs(P)?(t.consume(P),_):D(P)}function D(P){return P===61?(t.consume(P),E):qt(P)?(t.consume(P),D):A(P)}function E(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),d=P,z):qt(P)?(t.consume(P),E):Q(P)}function z(P){return P===d?(t.consume(P),d=null,F):P===null||Ze(P)?n(P):(t.consume(P),z)}function Q(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Rn(P)?D(P):(t.consume(P),Q)}function F(P){return P===47||P===62||qt(P)?A(P):n(P)}function L(P){return P===62?(t.consume(P),U):n(P)}function U(P){return P===null||Ze(P)?V(P):qt(P)?(t.consume(P),U):n(P)}function V(P){return P===45&&s===2?(t.consume(P),$):P===60&&s===1?(t.consume(P),ae):P===62&&s===4?(t.consume(P),me):P===63&&s===3?(t.consume(P),R):P===93&&s===5?(t.consume(P),ue):Ze(P)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Are,Y,ce)(P)):P===null||Ze(P)?(t.exit("htmlFlowData"),ce(P)):(t.consume(P),V)}function ce(P){return t.check(Mre,W,Y)(P)}function W(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),J}function J(P){return P===null||Ze(P)?ce(P):(t.enter("htmlFlowData"),V(P))}function $(P){return P===45?(t.consume(P),R):V(P)}function ae(P){return P===47?(t.consume(P),l="",ne):V(P)}function ne(P){if(P===62){const K=l.toLowerCase();return A8.includes(K)?(t.consume(P),me):V(P)}return ds(P)&&l.length<8?(t.consume(P),l+=String.fromCharCode(P),ne):V(P)}function ue(P){return P===93?(t.consume(P),R):V(P)}function R(P){return P===62?(t.consume(P),me):P===45&&s===2?(t.consume(P),R):V(P)}function me(P){return P===null||Ze(P)?(t.exit("htmlFlowData"),Y(P)):(t.consume(P),me)}function Y(P){return t.exit("htmlFlow"),e(P)}}function Dre(t,e,n){const r=this;return s;function s(l){return Ze(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):n(l)}function i(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function Rre(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(v0,e,n)}}const zre={name:"htmlText",tokenize:Pre};function Pre(t,e,n){const r=this;let s,i,l;return c;function c(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),d}function d(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),D):R===63?(t.consume(R),A):ds(R)?(t.consume(R),Q):n(R)}function h(R){return R===45?(t.consume(R),m):R===91?(t.consume(R),i=0,b):ds(R)?(t.consume(R),T):n(R)}function m(R){return R===45?(t.consume(R),v):n(R)}function p(R){return R===null?n(R):R===45?(t.consume(R),x):Ze(R)?(l=p,ae(R)):(t.consume(R),p)}function x(R){return R===45?(t.consume(R),v):p(R)}function v(R){return R===62?$(R):R===45?x(R):p(R)}function b(R){const me="CDATA[";return R===me.charCodeAt(i++)?(t.consume(R),i===me.length?k:b):n(R)}function k(R){return R===null?n(R):R===93?(t.consume(R),O):Ze(R)?(l=k,ae(R)):(t.consume(R),k)}function O(R){return R===93?(t.consume(R),j):k(R)}function j(R){return R===62?$(R):R===93?(t.consume(R),j):k(R)}function T(R){return R===null||R===62?$(R):Ze(R)?(l=T,ae(R)):(t.consume(R),T)}function A(R){return R===null?n(R):R===63?(t.consume(R),_):Ze(R)?(l=A,ae(R)):(t.consume(R),A)}function _(R){return R===62?$(R):A(R)}function D(R){return ds(R)?(t.consume(R),E):n(R)}function E(R){return R===45||rs(R)?(t.consume(R),E):z(R)}function z(R){return Ze(R)?(l=z,ae(R)):qt(R)?(t.consume(R),z):$(R)}function Q(R){return R===45||rs(R)?(t.consume(R),Q):R===47||R===62||Rn(R)?F(R):n(R)}function F(R){return R===47?(t.consume(R),$):R===58||R===95||ds(R)?(t.consume(R),L):Ze(R)?(l=F,ae(R)):qt(R)?(t.consume(R),F):$(R)}function L(R){return R===45||R===46||R===58||R===95||rs(R)?(t.consume(R),L):U(R)}function U(R){return R===61?(t.consume(R),V):Ze(R)?(l=U,ae(R)):qt(R)?(t.consume(R),U):F(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,ce):Ze(R)?(l=V,ae(R)):qt(R)?(t.consume(R),V):(t.consume(R),W)}function ce(R){return R===s?(t.consume(R),s=void 0,J):R===null?n(R):Ze(R)?(l=ce,ae(R)):(t.consume(R),ce)}function W(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Rn(R)?F(R):(t.consume(R),W)}function J(R){return R===47||R===62||Rn(R)?F(R):n(R)}function $(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function ae(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),ne}function ne(R){return qt(R)?zt(t,ue,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):ue(R)}function ue(R){return t.enter("htmlTextData"),l(R)}}const g5={name:"labelEnd",resolveAll:qre,resolveTo:Fre,tokenize:Qre},Bre={tokenize:$re},Lre={tokenize:Hre},Ire={tokenize:Ure};function qre(t){let e=-1;const n=[];for(;++e=3&&(h===null||Ze(h))?(t.exit("thematicBreak"),e(h)):n(h)}function d(h){return h===s?(t.consume(h),r++,d):(t.exit("thematicBreakSequence"),qt(h)?zt(t,c,"whitespace")(h):c(h))}}const Ns={continuation:{tokenize:tse},exit:rse,name:"list",tokenize:ese},Zre={partial:!0,tokenize:sse},Jre={partial:!0,tokenize:nse};function ese(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,l=0;return c;function c(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:p4(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(og,n,h)(v):h(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(v)}return n(v)}function d(v){return p4(v)&&++l<10?(t.consume(v),d):(!r.interrupt||l<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),h(v)):n(v)}function h(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(v0,r.interrupt?n:m,t.attempt(Zre,x,p))}function m(v){return r.containerState.initialBlankLine=!0,i++,x(v)}function p(v){return qt(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),x):n(v)}function x(v){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function tse(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(v0,s,i);function s(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,zt(t,e,"listItemIndent",r.containerState.size+1)(c)}function i(c){return r.containerState.furtherBlankLines||!qt(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Jre,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,zt(t,t.attempt(Ns,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function nse(t,e,n){const r=this;return zt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(i):n(i)}}function rse(t){t.exit(this.containerState.type)}function sse(t,e,n){const r=this;return zt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const l=r.events[r.events.length-1];return!qt(i)&&l&&l[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const M8={name:"setextUnderline",resolveTo:ise,tokenize:ase};function ise(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 l={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",l,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function ase(t,e,n){const r=this;let s;return i;function i(h){let m=r.events.length,p;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){p=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(t.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return t.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===s?(t.consume(h),c):(t.exit("setextHeadingLineSequence"),qt(h)?zt(t,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Ze(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const lse={tokenize:ose};function ose(t){const e=this,n=t.attempt(v0,r,t.attempt(this.parser.constructs.flowInitial,s,zt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(fre,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 cse={resolveAll:OD()},use=kD("string"),dse=kD("text");function kD(t){return{resolveAll:OD(t==="text"?hse:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,l,c);return l;function l(m){return h(m)?i(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),d}function d(m){return h(m)?(n.exit("data"),i(m)):(n.consume(m),d)}function h(m){if(m===null)return!0;const p=s[m];let x=-1;if(p)for(;++x-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}i>0&&l.push(t[s].slice(0,i))}return l}function jse(t,e){let n=-1;const r=[];let s;for(;++n0){const cr=Be.tokenStack[Be.tokenStack.length-1];(cr[1]||_8).call(Be,void 0,cr[0])}for(Se.position={start:Xl(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:Xl(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},Tt=-1;++Tt0){const cr=Be.tokenStack[Be.tokenStack.length-1];(cr[1]||_8).call(Be,void 0,cr[0])}for(Se.position={start:Xl(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:Xl(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},Tt=-1;++Tt1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};t.patch(e,d);const h={type:"element",tagName:"sup",properties:{},children:[d]};return t.patch(e,h),t.applyData(e,h)}function Qse(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 $se(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function CD(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 l=s[s.length-1];return l&&l.type==="text"?l.value+=r:s.push({type:"text",value:r}),s}function Hse(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return CD(t,e);const s={src:Dd(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 Use(t,e){const n={src:Dd(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 Vse(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 Wse(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return CD(t,e);const s={href:Dd(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 Gse(t,e){const n={href:Dd(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 Xse(t,e,n){const r=t.all(e),s=n?Yse(n):TD(e),i={},l=[];if(typeof e.checked=="boolean"){const m=r[0];let p;m&&m.type==="element"&&m.tagName==="p"?p=m:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let c=-1;for(;++c",...d.current()})),h+=d.move(">")):(c=n.enter("destinationRaw"),h+=d.move(n.safe(t.url,{before:h,after:t.title?" ":")",...d.current()}))),c(),t.title&&(c=n.enter(`title${i}`),h+=d.move(" "+s),h+=d.move(n.safe(t.title,{before:h,after:s,...d.current()})),h+=d.move(s),c()),h+=d.move(")"),l(),h}function tle(){return"!"}$D.peek=nle;function $D(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("![");const h=n.safe(t.alt,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return l(),n.stack=m,i(),s==="full"||!h||h!==p?d+=c.move(p+"]"):s==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function nle(){return"!"}HD.peek=rle;function HD(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(t.url))}VD.peek=sle;function VD(t,e,n,r){const s=O5(n),i=s==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let c,d;if(UD(t,n)){const m=n.stack;n.stack=[],c=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(t,{before:p,after:">",...l.current()})),p+=l.move(">"),c(),n.stack=m,p}c=n.enter("link"),d=n.enter("label");let h=l.move("[");return h+=l.move(n.containerPhrasing(t,{before:h,after:"](",...l.current()})),h+=l.move("]("),d(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(d=n.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(n.safe(t.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(d=n.enter("destinationRaw"),h+=l.move(n.safe(t.url,{before:h,after:t.title?" ":")",...l.current()}))),d(),t.title&&(d=n.enter(`title${i}`),h+=l.move(" "+s),h+=l.move(n.safe(t.title,{before:h,after:s,...l.current()})),h+=l.move(s),d()),h+=l.move(")"),c(),h}function sle(t,e,n){return UD(t,n)?"<":"["}WD.peek=ile;function WD(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("[");const h=n.containerPhrasing(t,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return l(),n.stack=m,i(),s==="full"||!h||h!==p?d+=c.move(p+"]"):s==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function ile(){return"["}function j5(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 ale(t){const e=j5(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 lle(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 GD(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 ole(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let l=t.ordered?lle(n):j5(n);const c=t.ordered?l==="."?")":".":ale(n);let d=e&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!t.ordered){const m=t.children?t.children[0]:void 0;if((l==="*"||l==="-")&&m&&(!m.children||!m.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&&(d=!0),GD(n)===l&&m){let p=-1;for(;++p-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let l=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(r);c.move(i+" ".repeat(l-i.length)),c.shift(l);const d=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,c.current()),m);return d(),h;function m(p,x,v){return x?(v?"":" ".repeat(l))+p:(v?i:i+" ".repeat(l-i.length))+p}}function dle(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),l=n.containerPhrasing(t,r);return i(),s(),l}const hle=y0(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function fle(t,e,n,r){return(t.children.some(function(l){return hle(l)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function mle(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}XD.peek=ple;function XD(t,e,n,r){const s=mle(n),i=n.enter("strong"),l=n.createTracker(r),c=l.move(s+s);let d=l.move(n.containerPhrasing(t,{after:s,before:c,...l.current()}));const h=d.charCodeAt(0),m=Wg(r.before.charCodeAt(r.before.length-1),h,s);m.inside&&(d=Lf(h)+d.slice(1));const p=d.charCodeAt(d.length-1),x=Wg(r.after.charCodeAt(0),p,s);x.inside&&(d=d.slice(0,-1)+Lf(p));const v=l.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:x.outside,before:m.outside},c+d+v}function ple(t,e,n){return n.options.strong||"*"}function gle(t,e,n,r){return n.safe(t.value,r)}function xle(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 vle(t,e,n){const r=(GD(n)+(n.options.ruleSpaces?" ":"")).repeat(xle(n));return n.options.ruleSpaces?r.slice(0,-1):r}const YD={blockquote:Qae,break:K8,code:Wae,definition:Xae,emphasis:qD,hardBreak:K8,heading:Jae,html:FD,image:QD,imageReference:$D,inlineCode:HD,link:VD,linkReference:WD,list:ole,listItem:ule,paragraph:dle,root:fle,strong:XD,text:gle,thematicBreak:vle};function yle(){return{enter:{table:ble,tableData:Z8,tableHeader:Z8,tableRow:Sle},exit:{codeText:kle,table:wle,tableData:Tb,tableHeader:Tb,tableRow:Tb}}}function ble(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 wle(t){this.exit(t),this.data.inTable=void 0}function Sle(t){this.enter({type:"tableRow",children:[]},t)}function Tb(t){this.exit(t)}function Z8(t){this.enter({type:"tableCell",children:[]},t)}function kle(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Ole));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Ole(t,e){return e==="|"?e:t}function jle(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:x,table:l,tableCell:d,tableRow:c}};function l(v,b,k,O){return h(m(v,k,O),v.align)}function c(v,b,k,O){const j=p(v,k,O),T=h([j]);return T.slice(0,T.indexOf(` -`))}function d(v,b,k,O){const j=k.enter("tableCell"),T=k.enter("phrasing"),A=k.containerPhrasing(v,{...O,before:i,after:i});return T(),j(),A}function h(v,b){return qae(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function m(v,b,k){const O=v.children;let j=-1;const T=[],A=b.enter("table");for(;++j0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $le={tokenize:Kle,partial:!0};function Hle(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Gle,continuation:{tokenize:Xle},exit:Yle}},text:{91:{name:"gfmFootnoteCall",tokenize:Wle},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ule,resolveTo:Vle}}}}function Ule(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const d=r.events[s][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!l||!l._balanced)return n(d);const h=Qi(r.sliceSerialize({start:l.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(d):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),e(d))}}function Vle(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)},l={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},c=[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",l,e],["exit",l,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function Wle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,l;return c;function c(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?n(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(p){if(i>999||p===93&&!l||p===null||p===91||Rn(p))return n(p);if(p===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return s.includes(Qi(r.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(p)}return Rn(p)||(l=!0),i++,t.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(t.consume(p),i++,h):h(p)}}function Gle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,l=0,c;return d;function d(b){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(b){return b===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",m):n(b)}function m(b){if(l>999||b===93&&!c||b===null||b===91||Rn(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteDefinitionLabelString");return i=Qi(r.sliceSerialize(k)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return Rn(b)||(c=!0),l++,t.consume(b),b===92?p:m}function p(b){return b===91||b===92||b===93?(t.consume(b),l++,m):m(b)}function x(b){return b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),s.includes(i)||s.push(i),zt(t,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return e(b)}}function Xle(t,e,n){return t.check(v0,e,t.attempt($le,e,n))}function Yle(t){t.exit("gfmFootnoteDefinition")}function Kle(t,e,n){const r=this;return zt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(i):n(i)}}function Zle(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(l,c){let d=-1;for(;++d1?d(b):(l.consume(b),p++,v);if(p<2&&!n)return d(b);const O=l.exit("strikethroughSequenceTemporary"),j=vd(b);return O._open=!j||j===2&&!!k,O._close=!k||k===2&&!!j,c(b)}}}class Jle{constructor(){this.map=[]}add(e,n,r){eoe(this,e,n,r)}consume(e){if(this.map.sort(function(i,l){return i[0]-l[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 eoe(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const W=r.events[U][1].type;if(W==="lineEnding"||W==="linePrefix")U--;else break}const V=U>-1?r.events[U][1].type:null,de=V==="tableHead"||V==="tableRow"?E:d;return de===E&&r.parser.lazy[r.now().line]?n(L):de(L)}function d(L){return t.enter("tableHead"),t.enter("tableRow"),h(L)}function h(L){return L===124||(l=!0,i+=1),m(L)}function m(L){return L===null?n(L):Ze(L)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),v):n(L):qt(L)?zt(t,m,"whitespace")(L):(i+=1,l&&(l=!1,s+=1),L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),l=!0,m):(t.enter("data"),p(L)))}function p(L){return L===null||L===124||Rn(L)?(t.exit("data"),m(L)):(t.consume(L),L===92?x:p)}function x(L){return L===92||L===124?(t.consume(L),p):p(L)}function v(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(t.enter("tableDelimiterRow"),l=!1,qt(L)?zt(t,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):b(L))}function b(L){return L===45||L===58?O(L):L===124?(l=!0,t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),k):D(L)}function k(L){return qt(L)?zt(t,O,"whitespace")(L):O(L)}function O(L){return L===58?(i+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),j):L===45?(i+=1,j(L)):L===null||Ze(L)?_(L):D(L)}function j(L){return L===45?(t.enter("tableDelimiterFiller"),T(L)):D(L)}function T(L){return L===45?(t.consume(L),T):L===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),A):(t.exit("tableDelimiterFiller"),A(L))}function A(L){return qt(L)?zt(t,_,"whitespace")(L):_(L)}function _(L){return L===124?b(L):L===null||Ze(L)?!l||s!==i?D(L):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(L)):D(L)}function D(L){return n(L)}function E(L){return t.enter("tableRow"),R(L)}function R(L){return L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),R):L===null||Ze(L)?(t.exit("tableRow"),e(L)):qt(L)?zt(t,R,"whitespace")(L):(t.enter("data"),Q(L))}function Q(L){return L===null||L===124||Rn(L)?(t.exit("data"),R(L)):(t.consume(L),L===92?F:Q)}function F(L){return L===92||L===124?(t.consume(L),Q):Q(L)}}function soe(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],l=[0,0,0,0],c=!1,d=0,h,m,p;const x=new Jle;for(;++nn[2]+1){const b=n[2]+1,k=n[3]-n[2]-1;t.add(b,k,[])}}t.add(n[3]+1,0,[["exit",p,e]])}return s!==void 0&&(i.end=Object.assign({},Lu(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function eN(t,e,n,r,s){const i=[],l=Lu(e.events,n);s&&(s.end=Object.assign({},l),i.push(["exit",s,e])),r.end=Object.assign({},l),i.push(["exit",r,e]),t.add(n+1,0,i)}function Lu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const ioe={name:"tasklistCheck",tokenize:loe};function aoe(){return{text:{91:ioe}}}function loe(t,e,n){const r=this;return s;function s(d){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(d):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),i)}function i(d){return Rn(d)?(t.enter("taskListCheckValueUnchecked"),t.consume(d),t.exit("taskListCheckValueUnchecked"),l):d===88||d===120?(t.enter("taskListCheckValueChecked"),t.consume(d),t.exit("taskListCheckValueChecked"),l):n(d)}function l(d){return d===93?(t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(d)}function c(d){return Ze(d)?e(d):qt(d)?t.check({tokenize:ooe},e,n)(d):n(d)}}function ooe(t,e,n){return zt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function coe(t){return mD([Rle(),Hle(),Zle(t),noe(),aoe()])}const uoe={};function doe(t){const e=this,n=t||uoe,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(coe(n)),i.push(Mle()),l.push(Ele(n))}function hoe(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:c,mathText:l,mathTextData:c}};function t(d){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]}},d)}function e(){this.buffer()}function n(){const d=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=d}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(d){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h;const p=m.data.hChildren[0];p.type,p.tagName,p.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(d){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},d),this.buffer()}function l(d){const h=this.resume(),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h,m.data.hChildren.push({type:"text",value:h})}function c(d){this.config.enter.data.call(this,d),this.config.exit.data.call(this,d)}}function foe(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +`))}function d(v,b,k,O){const j=k.enter("tableCell"),T=k.enter("phrasing"),A=k.containerPhrasing(v,{...O,before:i,after:i});return T(),j(),A}function h(v,b){return qae(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function m(v,b,k){const O=v.children;let j=-1;const T=[],A=b.enter("table");for(;++j0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $le={tokenize:Kle,partial:!0};function Hle(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Gle,continuation:{tokenize:Xle},exit:Yle}},text:{91:{name:"gfmFootnoteCall",tokenize:Wle},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ule,resolveTo:Vle}}}}function Ule(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;s--;){const d=r.events[s][1];if(d.type==="labelImage"){l=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!l||!l._balanced)return n(d);const h=Qi(r.sliceSerialize({start:l.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(d):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),e(d))}}function Vle(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)},l={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},c=[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",l,e],["exit",l,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...c),t}function Wle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,l;return c;function c(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?n(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(p){if(i>999||p===93&&!l||p===null||p===91||Rn(p))return n(p);if(p===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return s.includes(Qi(r.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(p)}return Rn(p)||(l=!0),i++,t.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(t.consume(p),i++,h):h(p)}}function Gle(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,l=0,c;return d;function d(b){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(b){return b===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",m):n(b)}function m(b){if(l>999||b===93&&!c||b===null||b===91||Rn(b))return n(b);if(b===93){t.exit("chunkString");const k=t.exit("gfmFootnoteDefinitionLabelString");return i=Qi(r.sliceSerialize(k)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return Rn(b)||(c=!0),l++,t.consume(b),b===92?p:m}function p(b){return b===91||b===92||b===93?(t.consume(b),l++,m):m(b)}function x(b){return b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),s.includes(i)||s.push(i),zt(t,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return e(b)}}function Xle(t,e,n){return t.check(v0,e,t.attempt($le,e,n))}function Yle(t){t.exit("gfmFootnoteDefinition")}function Kle(t,e,n){const r=this;return zt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?e(i):n(i)}}function Zle(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(l,c){let d=-1;for(;++d1?d(b):(l.consume(b),p++,v);if(p<2&&!n)return d(b);const O=l.exit("strikethroughSequenceTemporary"),j=vd(b);return O._open=!j||j===2&&!!k,O._close=!k||k===2&&!!j,c(b)}}}class Jle{constructor(){this.map=[]}add(e,n,r){eoe(this,e,n,r)}consume(e){if(this.map.sort(function(i,l){return i[0]-l[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 eoe(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const W=r.events[U][1].type;if(W==="lineEnding"||W==="linePrefix")U--;else break}const V=U>-1?r.events[U][1].type:null,ce=V==="tableHead"||V==="tableRow"?E:d;return ce===E&&r.parser.lazy[r.now().line]?n(L):ce(L)}function d(L){return t.enter("tableHead"),t.enter("tableRow"),h(L)}function h(L){return L===124||(l=!0,i+=1),m(L)}function m(L){return L===null?n(L):Ze(L)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),v):n(L):qt(L)?zt(t,m,"whitespace")(L):(i+=1,l&&(l=!1,s+=1),L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),l=!0,m):(t.enter("data"),p(L)))}function p(L){return L===null||L===124||Rn(L)?(t.exit("data"),m(L)):(t.consume(L),L===92?x:p)}function x(L){return L===92||L===124?(t.consume(L),p):p(L)}function v(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(t.enter("tableDelimiterRow"),l=!1,qt(L)?zt(t,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):b(L))}function b(L){return L===45||L===58?O(L):L===124?(l=!0,t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),k):D(L)}function k(L){return qt(L)?zt(t,O,"whitespace")(L):O(L)}function O(L){return L===58?(i+=1,l=!0,t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),j):L===45?(i+=1,j(L)):L===null||Ze(L)?_(L):D(L)}function j(L){return L===45?(t.enter("tableDelimiterFiller"),T(L)):D(L)}function T(L){return L===45?(t.consume(L),T):L===58?(l=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),A):(t.exit("tableDelimiterFiller"),A(L))}function A(L){return qt(L)?zt(t,_,"whitespace")(L):_(L)}function _(L){return L===124?b(L):L===null||Ze(L)?!l||s!==i?D(L):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(L)):D(L)}function D(L){return n(L)}function E(L){return t.enter("tableRow"),z(L)}function z(L){return L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),z):L===null||Ze(L)?(t.exit("tableRow"),e(L)):qt(L)?zt(t,z,"whitespace")(L):(t.enter("data"),Q(L))}function Q(L){return L===null||L===124||Rn(L)?(t.exit("data"),z(L)):(t.consume(L),L===92?F:Q)}function F(L){return L===92||L===124?(t.consume(L),Q):Q(L)}}function soe(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],l=[0,0,0,0],c=!1,d=0,h,m,p;const x=new Jle;for(;++nn[2]+1){const b=n[2]+1,k=n[3]-n[2]-1;t.add(b,k,[])}}t.add(n[3]+1,0,[["exit",p,e]])}return s!==void 0&&(i.end=Object.assign({},Lu(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function eN(t,e,n,r,s){const i=[],l=Lu(e.events,n);s&&(s.end=Object.assign({},l),i.push(["exit",s,e])),r.end=Object.assign({},l),i.push(["exit",r,e]),t.add(n+1,0,i)}function Lu(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const ioe={name:"tasklistCheck",tokenize:loe};function aoe(){return{text:{91:ioe}}}function loe(t,e,n){const r=this;return s;function s(d){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(d):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),i)}function i(d){return Rn(d)?(t.enter("taskListCheckValueUnchecked"),t.consume(d),t.exit("taskListCheckValueUnchecked"),l):d===88||d===120?(t.enter("taskListCheckValueChecked"),t.consume(d),t.exit("taskListCheckValueChecked"),l):n(d)}function l(d){return d===93?(t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(d)}function c(d){return Ze(d)?e(d):qt(d)?t.check({tokenize:ooe},e,n)(d):n(d)}}function ooe(t,e,n){return zt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function coe(t){return mD([Rle(),Hle(),Zle(t),noe(),aoe()])}const uoe={};function doe(t){const e=this,n=t||uoe,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(coe(n)),i.push(Mle()),l.push(Ele(n))}function hoe(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:c,mathText:l,mathTextData:c}};function t(d){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]}},d)}function e(){this.buffer()}function n(){const d=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=d}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(d){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h;const p=m.data.hChildren[0];p.type,p.tagName,p.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(d){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},d),this.buffer()}function l(d){const h=this.resume(),m=this.stack[this.stack.length-1];m.type,this.exit(d),m.value=h,m.data.hChildren.push({type:"text",value:h})}function c(d){this.config.enter.data.call(this,d),this.config.exit.data.call(this,d)}}function foe(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,l,c,d){const h=i.value||"",m=c.createTracker(d),p="$".repeat(Math.max(ID(h,"$")+1,2)),x=c.enter("mathFlow");let v=m.move(p);if(i.meta){const b=c.enter("mathFlowMeta");v+=m.move(c.safe(i.meta,{after:` `,before:v,encode:["$"],...m.current()})),b()}return v+=m.move(` `),h&&(v+=m.move(h+` -`)),v+=m.move(p),x(),v}function r(i,l,c){let d=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(d);)h++;const m="$".repeat(h);/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^\$|\$$/.test(d))&&(d=" "+d+" ");let p=-1;for(;++p15?h="…"+c.slice(s-15,s):h=c.slice(0,s);var m;i+15":">","<":"<",'"':""","'":"'"},joe=/[&><"']/g;function Noe(t){return String(t).replace(joe,e=>Ooe[e])}var iR=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},Coe=function(e){var n=iR(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Toe=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Aoe=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},tn={deflt:woe,escape:Noe,hyphenate:koe,getBaseElem:iR,isCharacterBox:Coe,protocolFromUrl:Aoe},cg={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Moe(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 C5{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 cg)if(cg.hasOwnProperty(n)){var r=cg[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Moe(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 De("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=tn.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 Yl{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 la[Eoe[this.id]]}sub(){return la[_oe[this.id]]}fracNum(){return la[Doe[this.id]]}fracDen(){return la[Roe[this.id]]}cramp(){return la[zoe[this.id]]}text(){return la[Poe[this.id]]}isTight(){return this.size>=2}}var T5=0,Gg=1,ed=2,ul=3,If=4,Oi=5,yd=6,hs=7,la=[new Yl(T5,0,!1),new Yl(Gg,0,!0),new Yl(ed,1,!1),new Yl(ul,1,!0),new Yl(If,2,!1),new Yl(Oi,2,!0),new Yl(yd,3,!1),new Yl(hs,3,!0)],Eoe=[If,Oi,If,Oi,yd,hs,yd,hs],_oe=[Oi,Oi,Oi,Oi,hs,hs,hs,hs],Doe=[ed,ul,If,Oi,yd,hs,yd,hs],Roe=[ul,ul,Oi,Oi,hs,hs,hs,hs],zoe=[Gg,Gg,ul,ul,Oi,Oi,hs,hs],Poe=[T5,Gg,ed,ul,ed,ul,ed,ul],at={DISPLAY:la[T5],TEXT:la[ed],SCRIPT:la[If],SCRIPTSCRIPT:la[yd]},S4=[{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 Boe(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var ug=[];S4.forEach(t=>t.blocks.forEach(e=>ug.push(...e)));function aR(t){for(var e=0;e=ug[e]&&t<=ug[e+1])return!0;return!1}var Tu=80,Loe=function(e,n){return"M95,"+(622+e+n)+` +`)),v+=m.move(p),x(),v}function r(i,l,c){let d=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(d);)h++;const m="$".repeat(h);/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^\$|\$$/.test(d))&&(d=" "+d+" ");let p=-1;for(;++p15?h="…"+c.slice(s-15,s):h=c.slice(0,s);var m;i+15":">","<":"<",'"':""","'":"'"},joe=/[&><"']/g;function Noe(t){return String(t).replace(joe,e=>Ooe[e])}var iR=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},Coe=function(e){var n=iR(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Toe=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Aoe=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},tn={deflt:woe,escape:Noe,hyphenate:koe,getBaseElem:iR,isCharacterBox:Coe,protocolFromUrl:Aoe},cg={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Moe(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 C5{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 cg)if(cg.hasOwnProperty(n)){var r=cg[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Moe(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 De("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=tn.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 Yl{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 la[Eoe[this.id]]}sub(){return la[_oe[this.id]]}fracNum(){return la[Doe[this.id]]}fracDen(){return la[Roe[this.id]]}cramp(){return la[zoe[this.id]]}text(){return la[Poe[this.id]]}isTight(){return this.size>=2}}var T5=0,Gg=1,ed=2,ul=3,If=4,Oi=5,yd=6,hs=7,la=[new Yl(T5,0,!1),new Yl(Gg,0,!0),new Yl(ed,1,!1),new Yl(ul,1,!0),new Yl(If,2,!1),new Yl(Oi,2,!0),new Yl(yd,3,!1),new Yl(hs,3,!0)],Eoe=[If,Oi,If,Oi,yd,hs,yd,hs],_oe=[Oi,Oi,Oi,Oi,hs,hs,hs,hs],Doe=[ed,ul,If,Oi,yd,hs,yd,hs],Roe=[ul,ul,Oi,Oi,hs,hs,hs,hs],zoe=[Gg,Gg,ul,ul,Oi,Oi,hs,hs],Poe=[T5,Gg,ed,ul,ed,ul,ed,ul],at={DISPLAY:la[T5],TEXT:la[ed],SCRIPT:la[If],SCRIPTSCRIPT:la[yd]},S4=[{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 Boe(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var ug=[];S4.forEach(t=>t.blocks.forEach(e=>ug.push(...e)));function aR(t){for(var e=0;e=ug[e]&&t<=ug[e+1])return!0;return!1}var Tu=80,Loe=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 @@ -347,13 +347,13 @@ 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 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 w0{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var pa={"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]}},Tp={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]},rN={Å:"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 Goe(t,e){pa[t]=e}function A5(t,e,n){if(!pa[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=pa[e][r];if(!s&&t[0]in rN&&(r=rN[t[0]].charCodeAt(0),s=pa[e][r]),!s&&n==="text"&&aR(r)&&(s=pa[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var Ab={};function Xoe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Ab[e]){var n=Ab[e]={cssEmPerMu:Tp.quad[e]/18};for(var r in Tp)Tp.hasOwnProperty(r)&&(n[r]=Tp[r][e])}return Ab[e]}var Yoe=[[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]],sN=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],iN=function(e,n){return n.size<2?e:Yoe[e-1][n.size-1]};class sl{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||sl.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=sN[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 sl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:iN(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:sN[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=iN(sl.BASESIZE,e);return this.size===n&&this.textSize===sl.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!==sl.BASESIZE?["sizing","reset-size"+this.size,"size"+sl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Xoe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}sl.BASESIZE=6;var k4={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},Koe={ex:!0,em:!0,mu:!0},lR=function(e){return typeof e!="string"&&(e=e.unit),e in k4||e in Koe||e==="ex"},Kn=function(e,n){var r;if(e.unit in k4)r=k4[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 De("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Le=function(e){return+e.toFixed(4)+"em"},yo=function(e){return e.filter(n=>n).join(" ")},oR=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)}},cR=function(e){var n=document.createElement(e);n.className=yo(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,uR=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+tn.escape(yo(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+tn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(Zoe.test(i))throw new De("Invalid attribute name '"+i+"'");n+=" "+i+'="'+tn.escape(this.attributes[i])+'"'}n+=">";for(var l=0;l",n};class S0{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,oR.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"span")}toMarkup(){return uR.call(this,"span")}}class M5{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,oR.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 cR.call(this,"a")}toMarkup(){return uR.call(this,"a")}}class Joe{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=''+tn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Le(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=yo(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+tn.escape(r)+'"');var i=tn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class xl{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class O4{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var nce={bin:1,close:1,inner:1,open:1,punct:1,rel:1},rce={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ln={math:{},text:{}};function N(t,e,n,r,s,i){Ln[t][s]={font:e,group:n,replace:r},i&&r&&(Ln[t][r]=Ln[t][s])}var C="math",Ee="text",B="main",G="ams",Wn="accent-token",Ve="bin",xs="close",Rd="inner",st="mathord",yr="op-token",li="open",$x="punct",X="rel",Sl="spacing",le="textord";N(C,B,X,"≡","\\equiv",!0);N(C,B,X,"≺","\\prec",!0);N(C,B,X,"≻","\\succ",!0);N(C,B,X,"∼","\\sim",!0);N(C,B,X,"⊥","\\perp");N(C,B,X,"⪯","\\preceq",!0);N(C,B,X,"⪰","\\succeq",!0);N(C,B,X,"≃","\\simeq",!0);N(C,B,X,"∣","\\mid",!0);N(C,B,X,"≪","\\ll",!0);N(C,B,X,"≫","\\gg",!0);N(C,B,X,"≍","\\asymp",!0);N(C,B,X,"∥","\\parallel");N(C,B,X,"⋈","\\bowtie",!0);N(C,B,X,"⌣","\\smile",!0);N(C,B,X,"⊑","\\sqsubseteq",!0);N(C,B,X,"⊒","\\sqsupseteq",!0);N(C,B,X,"≐","\\doteq",!0);N(C,B,X,"⌢","\\frown",!0);N(C,B,X,"∋","\\ni",!0);N(C,B,X,"∝","\\propto",!0);N(C,B,X,"⊢","\\vdash",!0);N(C,B,X,"⊣","\\dashv",!0);N(C,B,X,"∋","\\owns");N(C,B,$x,".","\\ldotp");N(C,B,$x,"⋅","\\cdotp");N(C,B,le,"#","\\#");N(Ee,B,le,"#","\\#");N(C,B,le,"&","\\&");N(Ee,B,le,"&","\\&");N(C,B,le,"ℵ","\\aleph",!0);N(C,B,le,"∀","\\forall",!0);N(C,B,le,"ℏ","\\hbar",!0);N(C,B,le,"∃","\\exists",!0);N(C,B,le,"∇","\\nabla",!0);N(C,B,le,"♭","\\flat",!0);N(C,B,le,"ℓ","\\ell",!0);N(C,B,le,"♮","\\natural",!0);N(C,B,le,"♣","\\clubsuit",!0);N(C,B,le,"℘","\\wp",!0);N(C,B,le,"♯","\\sharp",!0);N(C,B,le,"♢","\\diamondsuit",!0);N(C,B,le,"ℜ","\\Re",!0);N(C,B,le,"♡","\\heartsuit",!0);N(C,B,le,"ℑ","\\Im",!0);N(C,B,le,"♠","\\spadesuit",!0);N(C,B,le,"§","\\S",!0);N(Ee,B,le,"§","\\S");N(C,B,le,"¶","\\P",!0);N(Ee,B,le,"¶","\\P");N(C,B,le,"†","\\dag");N(Ee,B,le,"†","\\dag");N(Ee,B,le,"†","\\textdagger");N(C,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\textdaggerdbl");N(C,B,xs,"⎱","\\rmoustache",!0);N(C,B,li,"⎰","\\lmoustache",!0);N(C,B,xs,"⟯","\\rgroup",!0);N(C,B,li,"⟮","\\lgroup",!0);N(C,B,Ve,"∓","\\mp",!0);N(C,B,Ve,"⊖","\\ominus",!0);N(C,B,Ve,"⊎","\\uplus",!0);N(C,B,Ve,"⊓","\\sqcap",!0);N(C,B,Ve,"∗","\\ast");N(C,B,Ve,"⊔","\\sqcup",!0);N(C,B,Ve,"◯","\\bigcirc",!0);N(C,B,Ve,"∙","\\bullet",!0);N(C,B,Ve,"‡","\\ddagger");N(C,B,Ve,"≀","\\wr",!0);N(C,B,Ve,"⨿","\\amalg");N(C,B,Ve,"&","\\And");N(C,B,X,"⟵","\\longleftarrow",!0);N(C,B,X,"⇐","\\Leftarrow",!0);N(C,B,X,"⟸","\\Longleftarrow",!0);N(C,B,X,"⟶","\\longrightarrow",!0);N(C,B,X,"⇒","\\Rightarrow",!0);N(C,B,X,"⟹","\\Longrightarrow",!0);N(C,B,X,"↔","\\leftrightarrow",!0);N(C,B,X,"⟷","\\longleftrightarrow",!0);N(C,B,X,"⇔","\\Leftrightarrow",!0);N(C,B,X,"⟺","\\Longleftrightarrow",!0);N(C,B,X,"↦","\\mapsto",!0);N(C,B,X,"⟼","\\longmapsto",!0);N(C,B,X,"↗","\\nearrow",!0);N(C,B,X,"↩","\\hookleftarrow",!0);N(C,B,X,"↪","\\hookrightarrow",!0);N(C,B,X,"↘","\\searrow",!0);N(C,B,X,"↼","\\leftharpoonup",!0);N(C,B,X,"⇀","\\rightharpoonup",!0);N(C,B,X,"↙","\\swarrow",!0);N(C,B,X,"↽","\\leftharpoondown",!0);N(C,B,X,"⇁","\\rightharpoondown",!0);N(C,B,X,"↖","\\nwarrow",!0);N(C,B,X,"⇌","\\rightleftharpoons",!0);N(C,G,X,"≮","\\nless",!0);N(C,G,X,"","\\@nleqslant");N(C,G,X,"","\\@nleqq");N(C,G,X,"⪇","\\lneq",!0);N(C,G,X,"≨","\\lneqq",!0);N(C,G,X,"","\\@lvertneqq");N(C,G,X,"⋦","\\lnsim",!0);N(C,G,X,"⪉","\\lnapprox",!0);N(C,G,X,"⊀","\\nprec",!0);N(C,G,X,"⋠","\\npreceq",!0);N(C,G,X,"⋨","\\precnsim",!0);N(C,G,X,"⪹","\\precnapprox",!0);N(C,G,X,"≁","\\nsim",!0);N(C,G,X,"","\\@nshortmid");N(C,G,X,"∤","\\nmid",!0);N(C,G,X,"⊬","\\nvdash",!0);N(C,G,X,"⊭","\\nvDash",!0);N(C,G,X,"⋪","\\ntriangleleft");N(C,G,X,"⋬","\\ntrianglelefteq",!0);N(C,G,X,"⊊","\\subsetneq",!0);N(C,G,X,"","\\@varsubsetneq");N(C,G,X,"⫋","\\subsetneqq",!0);N(C,G,X,"","\\@varsubsetneqq");N(C,G,X,"≯","\\ngtr",!0);N(C,G,X,"","\\@ngeqslant");N(C,G,X,"","\\@ngeqq");N(C,G,X,"⪈","\\gneq",!0);N(C,G,X,"≩","\\gneqq",!0);N(C,G,X,"","\\@gvertneqq");N(C,G,X,"⋧","\\gnsim",!0);N(C,G,X,"⪊","\\gnapprox",!0);N(C,G,X,"⊁","\\nsucc",!0);N(C,G,X,"⋡","\\nsucceq",!0);N(C,G,X,"⋩","\\succnsim",!0);N(C,G,X,"⪺","\\succnapprox",!0);N(C,G,X,"≆","\\ncong",!0);N(C,G,X,"","\\@nshortparallel");N(C,G,X,"∦","\\nparallel",!0);N(C,G,X,"⊯","\\nVDash",!0);N(C,G,X,"⋫","\\ntriangleright");N(C,G,X,"⋭","\\ntrianglerighteq",!0);N(C,G,X,"","\\@nsupseteqq");N(C,G,X,"⊋","\\supsetneq",!0);N(C,G,X,"","\\@varsupsetneq");N(C,G,X,"⫌","\\supsetneqq",!0);N(C,G,X,"","\\@varsupsetneqq");N(C,G,X,"⊮","\\nVdash",!0);N(C,G,X,"⪵","\\precneqq",!0);N(C,G,X,"⪶","\\succneqq",!0);N(C,G,X,"","\\@nsubseteqq");N(C,G,Ve,"⊴","\\unlhd");N(C,G,Ve,"⊵","\\unrhd");N(C,G,X,"↚","\\nleftarrow",!0);N(C,G,X,"↛","\\nrightarrow",!0);N(C,G,X,"⇍","\\nLeftarrow",!0);N(C,G,X,"⇏","\\nRightarrow",!0);N(C,G,X,"↮","\\nleftrightarrow",!0);N(C,G,X,"⇎","\\nLeftrightarrow",!0);N(C,G,X,"△","\\vartriangle");N(C,G,le,"ℏ","\\hslash");N(C,G,le,"▽","\\triangledown");N(C,G,le,"◊","\\lozenge");N(C,G,le,"Ⓢ","\\circledS");N(C,G,le,"®","\\circledR");N(Ee,G,le,"®","\\circledR");N(C,G,le,"∡","\\measuredangle",!0);N(C,G,le,"∄","\\nexists");N(C,G,le,"℧","\\mho");N(C,G,le,"Ⅎ","\\Finv",!0);N(C,G,le,"⅁","\\Game",!0);N(C,G,le,"‵","\\backprime");N(C,G,le,"▲","\\blacktriangle");N(C,G,le,"▼","\\blacktriangledown");N(C,G,le,"■","\\blacksquare");N(C,G,le,"⧫","\\blacklozenge");N(C,G,le,"★","\\bigstar");N(C,G,le,"∢","\\sphericalangle",!0);N(C,G,le,"∁","\\complement",!0);N(C,G,le,"ð","\\eth",!0);N(Ee,B,le,"ð","ð");N(C,G,le,"╱","\\diagup");N(C,G,le,"╲","\\diagdown");N(C,G,le,"□","\\square");N(C,G,le,"□","\\Box");N(C,G,le,"◊","\\Diamond");N(C,G,le,"¥","\\yen",!0);N(Ee,G,le,"¥","\\yen",!0);N(C,G,le,"✓","\\checkmark",!0);N(Ee,G,le,"✓","\\checkmark");N(C,G,le,"ℶ","\\beth",!0);N(C,G,le,"ℸ","\\daleth",!0);N(C,G,le,"ℷ","\\gimel",!0);N(C,G,le,"ϝ","\\digamma",!0);N(C,G,le,"ϰ","\\varkappa");N(C,G,li,"┌","\\@ulcorner",!0);N(C,G,xs,"┐","\\@urcorner",!0);N(C,G,li,"└","\\@llcorner",!0);N(C,G,xs,"┘","\\@lrcorner",!0);N(C,G,X,"≦","\\leqq",!0);N(C,G,X,"⩽","\\leqslant",!0);N(C,G,X,"⪕","\\eqslantless",!0);N(C,G,X,"≲","\\lesssim",!0);N(C,G,X,"⪅","\\lessapprox",!0);N(C,G,X,"≊","\\approxeq",!0);N(C,G,Ve,"⋖","\\lessdot");N(C,G,X,"⋘","\\lll",!0);N(C,G,X,"≶","\\lessgtr",!0);N(C,G,X,"⋚","\\lesseqgtr",!0);N(C,G,X,"⪋","\\lesseqqgtr",!0);N(C,G,X,"≑","\\doteqdot");N(C,G,X,"≓","\\risingdotseq",!0);N(C,G,X,"≒","\\fallingdotseq",!0);N(C,G,X,"∽","\\backsim",!0);N(C,G,X,"⋍","\\backsimeq",!0);N(C,G,X,"⫅","\\subseteqq",!0);N(C,G,X,"⋐","\\Subset",!0);N(C,G,X,"⊏","\\sqsubset",!0);N(C,G,X,"≼","\\preccurlyeq",!0);N(C,G,X,"⋞","\\curlyeqprec",!0);N(C,G,X,"≾","\\precsim",!0);N(C,G,X,"⪷","\\precapprox",!0);N(C,G,X,"⊲","\\vartriangleleft");N(C,G,X,"⊴","\\trianglelefteq");N(C,G,X,"⊨","\\vDash",!0);N(C,G,X,"⊪","\\Vvdash",!0);N(C,G,X,"⌣","\\smallsmile");N(C,G,X,"⌢","\\smallfrown");N(C,G,X,"≏","\\bumpeq",!0);N(C,G,X,"≎","\\Bumpeq",!0);N(C,G,X,"≧","\\geqq",!0);N(C,G,X,"⩾","\\geqslant",!0);N(C,G,X,"⪖","\\eqslantgtr",!0);N(C,G,X,"≳","\\gtrsim",!0);N(C,G,X,"⪆","\\gtrapprox",!0);N(C,G,Ve,"⋗","\\gtrdot");N(C,G,X,"⋙","\\ggg",!0);N(C,G,X,"≷","\\gtrless",!0);N(C,G,X,"⋛","\\gtreqless",!0);N(C,G,X,"⪌","\\gtreqqless",!0);N(C,G,X,"≖","\\eqcirc",!0);N(C,G,X,"≗","\\circeq",!0);N(C,G,X,"≜","\\triangleq",!0);N(C,G,X,"∼","\\thicksim");N(C,G,X,"≈","\\thickapprox");N(C,G,X,"⫆","\\supseteqq",!0);N(C,G,X,"⋑","\\Supset",!0);N(C,G,X,"⊐","\\sqsupset",!0);N(C,G,X,"≽","\\succcurlyeq",!0);N(C,G,X,"⋟","\\curlyeqsucc",!0);N(C,G,X,"≿","\\succsim",!0);N(C,G,X,"⪸","\\succapprox",!0);N(C,G,X,"⊳","\\vartriangleright");N(C,G,X,"⊵","\\trianglerighteq");N(C,G,X,"⊩","\\Vdash",!0);N(C,G,X,"∣","\\shortmid");N(C,G,X,"∥","\\shortparallel");N(C,G,X,"≬","\\between",!0);N(C,G,X,"⋔","\\pitchfork",!0);N(C,G,X,"∝","\\varpropto");N(C,G,X,"◀","\\blacktriangleleft");N(C,G,X,"∴","\\therefore",!0);N(C,G,X,"∍","\\backepsilon");N(C,G,X,"▶","\\blacktriangleright");N(C,G,X,"∵","\\because",!0);N(C,G,X,"⋘","\\llless");N(C,G,X,"⋙","\\gggtr");N(C,G,Ve,"⊲","\\lhd");N(C,G,Ve,"⊳","\\rhd");N(C,G,X,"≂","\\eqsim",!0);N(C,B,X,"⋈","\\Join");N(C,G,X,"≑","\\Doteq",!0);N(C,G,Ve,"∔","\\dotplus",!0);N(C,G,Ve,"∖","\\smallsetminus");N(C,G,Ve,"⋒","\\Cap",!0);N(C,G,Ve,"⋓","\\Cup",!0);N(C,G,Ve,"⩞","\\doublebarwedge",!0);N(C,G,Ve,"⊟","\\boxminus",!0);N(C,G,Ve,"⊞","\\boxplus",!0);N(C,G,Ve,"⋇","\\divideontimes",!0);N(C,G,Ve,"⋉","\\ltimes",!0);N(C,G,Ve,"⋊","\\rtimes",!0);N(C,G,Ve,"⋋","\\leftthreetimes",!0);N(C,G,Ve,"⋌","\\rightthreetimes",!0);N(C,G,Ve,"⋏","\\curlywedge",!0);N(C,G,Ve,"⋎","\\curlyvee",!0);N(C,G,Ve,"⊝","\\circleddash",!0);N(C,G,Ve,"⊛","\\circledast",!0);N(C,G,Ve,"⋅","\\centerdot");N(C,G,Ve,"⊺","\\intercal",!0);N(C,G,Ve,"⋒","\\doublecap");N(C,G,Ve,"⋓","\\doublecup");N(C,G,Ve,"⊠","\\boxtimes",!0);N(C,G,X,"⇢","\\dashrightarrow",!0);N(C,G,X,"⇠","\\dashleftarrow",!0);N(C,G,X,"⇇","\\leftleftarrows",!0);N(C,G,X,"⇆","\\leftrightarrows",!0);N(C,G,X,"⇚","\\Lleftarrow",!0);N(C,G,X,"↞","\\twoheadleftarrow",!0);N(C,G,X,"↢","\\leftarrowtail",!0);N(C,G,X,"↫","\\looparrowleft",!0);N(C,G,X,"⇋","\\leftrightharpoons",!0);N(C,G,X,"↶","\\curvearrowleft",!0);N(C,G,X,"↺","\\circlearrowleft",!0);N(C,G,X,"↰","\\Lsh",!0);N(C,G,X,"⇈","\\upuparrows",!0);N(C,G,X,"↿","\\upharpoonleft",!0);N(C,G,X,"⇃","\\downharpoonleft",!0);N(C,B,X,"⊶","\\origof",!0);N(C,B,X,"⊷","\\imageof",!0);N(C,G,X,"⊸","\\multimap",!0);N(C,G,X,"↭","\\leftrightsquigarrow",!0);N(C,G,X,"⇉","\\rightrightarrows",!0);N(C,G,X,"⇄","\\rightleftarrows",!0);N(C,G,X,"↠","\\twoheadrightarrow",!0);N(C,G,X,"↣","\\rightarrowtail",!0);N(C,G,X,"↬","\\looparrowright",!0);N(C,G,X,"↷","\\curvearrowright",!0);N(C,G,X,"↻","\\circlearrowright",!0);N(C,G,X,"↱","\\Rsh",!0);N(C,G,X,"⇊","\\downdownarrows",!0);N(C,G,X,"↾","\\upharpoonright",!0);N(C,G,X,"⇂","\\downharpoonright",!0);N(C,G,X,"⇝","\\rightsquigarrow",!0);N(C,G,X,"⇝","\\leadsto");N(C,G,X,"⇛","\\Rrightarrow",!0);N(C,G,X,"↾","\\restriction");N(C,B,le,"‘","`");N(C,B,le,"$","\\$");N(Ee,B,le,"$","\\$");N(Ee,B,le,"$","\\textdollar");N(C,B,le,"%","\\%");N(Ee,B,le,"%","\\%");N(C,B,le,"_","\\_");N(Ee,B,le,"_","\\_");N(Ee,B,le,"_","\\textunderscore");N(C,B,le,"∠","\\angle",!0);N(C,B,le,"∞","\\infty",!0);N(C,B,le,"′","\\prime");N(C,B,le,"△","\\triangle");N(C,B,le,"Γ","\\Gamma",!0);N(C,B,le,"Δ","\\Delta",!0);N(C,B,le,"Θ","\\Theta",!0);N(C,B,le,"Λ","\\Lambda",!0);N(C,B,le,"Ξ","\\Xi",!0);N(C,B,le,"Π","\\Pi",!0);N(C,B,le,"Σ","\\Sigma",!0);N(C,B,le,"Υ","\\Upsilon",!0);N(C,B,le,"Φ","\\Phi",!0);N(C,B,le,"Ψ","\\Psi",!0);N(C,B,le,"Ω","\\Omega",!0);N(C,B,le,"A","Α");N(C,B,le,"B","Β");N(C,B,le,"E","Ε");N(C,B,le,"Z","Ζ");N(C,B,le,"H","Η");N(C,B,le,"I","Ι");N(C,B,le,"K","Κ");N(C,B,le,"M","Μ");N(C,B,le,"N","Ν");N(C,B,le,"O","Ο");N(C,B,le,"P","Ρ");N(C,B,le,"T","Τ");N(C,B,le,"X","Χ");N(C,B,le,"¬","\\neg",!0);N(C,B,le,"¬","\\lnot");N(C,B,le,"⊤","\\top");N(C,B,le,"⊥","\\bot");N(C,B,le,"∅","\\emptyset");N(C,G,le,"∅","\\varnothing");N(C,B,st,"α","\\alpha",!0);N(C,B,st,"β","\\beta",!0);N(C,B,st,"γ","\\gamma",!0);N(C,B,st,"δ","\\delta",!0);N(C,B,st,"ϵ","\\epsilon",!0);N(C,B,st,"ζ","\\zeta",!0);N(C,B,st,"η","\\eta",!0);N(C,B,st,"θ","\\theta",!0);N(C,B,st,"ι","\\iota",!0);N(C,B,st,"κ","\\kappa",!0);N(C,B,st,"λ","\\lambda",!0);N(C,B,st,"μ","\\mu",!0);N(C,B,st,"ν","\\nu",!0);N(C,B,st,"ξ","\\xi",!0);N(C,B,st,"ο","\\omicron",!0);N(C,B,st,"π","\\pi",!0);N(C,B,st,"ρ","\\rho",!0);N(C,B,st,"σ","\\sigma",!0);N(C,B,st,"τ","\\tau",!0);N(C,B,st,"υ","\\upsilon",!0);N(C,B,st,"ϕ","\\phi",!0);N(C,B,st,"χ","\\chi",!0);N(C,B,st,"ψ","\\psi",!0);N(C,B,st,"ω","\\omega",!0);N(C,B,st,"ε","\\varepsilon",!0);N(C,B,st,"ϑ","\\vartheta",!0);N(C,B,st,"ϖ","\\varpi",!0);N(C,B,st,"ϱ","\\varrho",!0);N(C,B,st,"ς","\\varsigma",!0);N(C,B,st,"φ","\\varphi",!0);N(C,B,Ve,"∗","*",!0);N(C,B,Ve,"+","+");N(C,B,Ve,"−","-",!0);N(C,B,Ve,"⋅","\\cdot",!0);N(C,B,Ve,"∘","\\circ",!0);N(C,B,Ve,"÷","\\div",!0);N(C,B,Ve,"±","\\pm",!0);N(C,B,Ve,"×","\\times",!0);N(C,B,Ve,"∩","\\cap",!0);N(C,B,Ve,"∪","\\cup",!0);N(C,B,Ve,"∖","\\setminus",!0);N(C,B,Ve,"∧","\\land");N(C,B,Ve,"∨","\\lor");N(C,B,Ve,"∧","\\wedge",!0);N(C,B,Ve,"∨","\\vee",!0);N(C,B,le,"√","\\surd");N(C,B,li,"⟨","\\langle",!0);N(C,B,li,"∣","\\lvert");N(C,B,li,"∥","\\lVert");N(C,B,xs,"?","?");N(C,B,xs,"!","!");N(C,B,xs,"⟩","\\rangle",!0);N(C,B,xs,"∣","\\rvert");N(C,B,xs,"∥","\\rVert");N(C,B,X,"=","=");N(C,B,X,":",":");N(C,B,X,"≈","\\approx",!0);N(C,B,X,"≅","\\cong",!0);N(C,B,X,"≥","\\ge");N(C,B,X,"≥","\\geq",!0);N(C,B,X,"←","\\gets");N(C,B,X,">","\\gt",!0);N(C,B,X,"∈","\\in",!0);N(C,B,X,"","\\@not");N(C,B,X,"⊂","\\subset",!0);N(C,B,X,"⊃","\\supset",!0);N(C,B,X,"⊆","\\subseteq",!0);N(C,B,X,"⊇","\\supseteq",!0);N(C,G,X,"⊈","\\nsubseteq",!0);N(C,G,X,"⊉","\\nsupseteq",!0);N(C,B,X,"⊨","\\models");N(C,B,X,"←","\\leftarrow",!0);N(C,B,X,"≤","\\le");N(C,B,X,"≤","\\leq",!0);N(C,B,X,"<","\\lt",!0);N(C,B,X,"→","\\rightarrow",!0);N(C,B,X,"→","\\to");N(C,G,X,"≱","\\ngeq",!0);N(C,G,X,"≰","\\nleq",!0);N(C,B,Sl," ","\\ ");N(C,B,Sl," ","\\space");N(C,B,Sl," ","\\nobreakspace");N(Ee,B,Sl," ","\\ ");N(Ee,B,Sl," "," ");N(Ee,B,Sl," ","\\space");N(Ee,B,Sl," ","\\nobreakspace");N(C,B,Sl,null,"\\nobreak");N(C,B,Sl,null,"\\allowbreak");N(C,B,$x,",",",");N(C,B,$x,";",";");N(C,G,Ve,"⊼","\\barwedge",!0);N(C,G,Ve,"⊻","\\veebar",!0);N(C,B,Ve,"⊙","\\odot",!0);N(C,B,Ve,"⊕","\\oplus",!0);N(C,B,Ve,"⊗","\\otimes",!0);N(C,B,le,"∂","\\partial",!0);N(C,B,Ve,"⊘","\\oslash",!0);N(C,G,Ve,"⊚","\\circledcirc",!0);N(C,G,Ve,"⊡","\\boxdot",!0);N(C,B,Ve,"△","\\bigtriangleup");N(C,B,Ve,"▽","\\bigtriangledown");N(C,B,Ve,"†","\\dagger");N(C,B,Ve,"⋄","\\diamond");N(C,B,Ve,"⋆","\\star");N(C,B,Ve,"◃","\\triangleleft");N(C,B,Ve,"▹","\\triangleright");N(C,B,li,"{","\\{");N(Ee,B,le,"{","\\{");N(Ee,B,le,"{","\\textbraceleft");N(C,B,xs,"}","\\}");N(Ee,B,le,"}","\\}");N(Ee,B,le,"}","\\textbraceright");N(C,B,li,"{","\\lbrace");N(C,B,xs,"}","\\rbrace");N(C,B,li,"[","\\lbrack",!0);N(Ee,B,le,"[","\\lbrack",!0);N(C,B,xs,"]","\\rbrack",!0);N(Ee,B,le,"]","\\rbrack",!0);N(C,B,li,"(","\\lparen",!0);N(C,B,xs,")","\\rparen",!0);N(Ee,B,le,"<","\\textless",!0);N(Ee,B,le,">","\\textgreater",!0);N(C,B,li,"⌊","\\lfloor",!0);N(C,B,xs,"⌋","\\rfloor",!0);N(C,B,li,"⌈","\\lceil",!0);N(C,B,xs,"⌉","\\rceil",!0);N(C,B,le,"\\","\\backslash");N(C,B,le,"∣","|");N(C,B,le,"∣","\\vert");N(Ee,B,le,"|","\\textbar",!0);N(C,B,le,"∥","\\|");N(C,B,le,"∥","\\Vert");N(Ee,B,le,"∥","\\textbardbl");N(Ee,B,le,"~","\\textasciitilde");N(Ee,B,le,"\\","\\textbackslash");N(Ee,B,le,"^","\\textasciicircum");N(C,B,X,"↑","\\uparrow",!0);N(C,B,X,"⇑","\\Uparrow",!0);N(C,B,X,"↓","\\downarrow",!0);N(C,B,X,"⇓","\\Downarrow",!0);N(C,B,X,"↕","\\updownarrow",!0);N(C,B,X,"⇕","\\Updownarrow",!0);N(C,B,yr,"∐","\\coprod");N(C,B,yr,"⋁","\\bigvee");N(C,B,yr,"⋀","\\bigwedge");N(C,B,yr,"⨄","\\biguplus");N(C,B,yr,"⋂","\\bigcap");N(C,B,yr,"⋃","\\bigcup");N(C,B,yr,"∫","\\int");N(C,B,yr,"∫","\\intop");N(C,B,yr,"∬","\\iint");N(C,B,yr,"∭","\\iiint");N(C,B,yr,"∏","\\prod");N(C,B,yr,"∑","\\sum");N(C,B,yr,"⨂","\\bigotimes");N(C,B,yr,"⨁","\\bigoplus");N(C,B,yr,"⨀","\\bigodot");N(C,B,yr,"∮","\\oint");N(C,B,yr,"∯","\\oiint");N(C,B,yr,"∰","\\oiiint");N(C,B,yr,"⨆","\\bigsqcup");N(C,B,yr,"∫","\\smallint");N(Ee,B,Rd,"…","\\textellipsis");N(C,B,Rd,"…","\\mathellipsis");N(Ee,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"⋯","\\@cdots",!0);N(C,B,Rd,"⋱","\\ddots",!0);N(C,B,le,"⋮","\\varvdots");N(Ee,B,le,"⋮","\\varvdots");N(C,B,Wn,"ˊ","\\acute");N(C,B,Wn,"ˋ","\\grave");N(C,B,Wn,"¨","\\ddot");N(C,B,Wn,"~","\\tilde");N(C,B,Wn,"ˉ","\\bar");N(C,B,Wn,"˘","\\breve");N(C,B,Wn,"ˇ","\\check");N(C,B,Wn,"^","\\hat");N(C,B,Wn,"⃗","\\vec");N(C,B,Wn,"˙","\\dot");N(C,B,Wn,"˚","\\mathring");N(C,B,st,"","\\@imath");N(C,B,st,"","\\@jmath");N(C,B,le,"ı","ı");N(C,B,le,"ȷ","ȷ");N(Ee,B,le,"ı","\\i",!0);N(Ee,B,le,"ȷ","\\j",!0);N(Ee,B,le,"ß","\\ss",!0);N(Ee,B,le,"æ","\\ae",!0);N(Ee,B,le,"œ","\\oe",!0);N(Ee,B,le,"ø","\\o",!0);N(Ee,B,le,"Æ","\\AE",!0);N(Ee,B,le,"Œ","\\OE",!0);N(Ee,B,le,"Ø","\\O",!0);N(Ee,B,Wn,"ˊ","\\'");N(Ee,B,Wn,"ˋ","\\`");N(Ee,B,Wn,"ˆ","\\^");N(Ee,B,Wn,"˜","\\~");N(Ee,B,Wn,"ˉ","\\=");N(Ee,B,Wn,"˘","\\u");N(Ee,B,Wn,"˙","\\.");N(Ee,B,Wn,"¸","\\c");N(Ee,B,Wn,"˚","\\r");N(Ee,B,Wn,"ˇ","\\v");N(Ee,B,Wn,"¨",'\\"');N(Ee,B,Wn,"˝","\\H");N(Ee,B,Wn,"◯","\\textcircled");var dR={"--":!0,"---":!0,"``":!0,"''":!0};N(Ee,B,le,"–","--",!0);N(Ee,B,le,"–","\\textendash");N(Ee,B,le,"—","---",!0);N(Ee,B,le,"—","\\textemdash");N(Ee,B,le,"‘","`",!0);N(Ee,B,le,"‘","\\textquoteleft");N(Ee,B,le,"’","'",!0);N(Ee,B,le,"’","\\textquoteright");N(Ee,B,le,"“","``",!0);N(Ee,B,le,"“","\\textquotedblleft");N(Ee,B,le,"”","''",!0);N(Ee,B,le,"”","\\textquotedblright");N(C,B,le,"°","\\degree",!0);N(Ee,B,le,"°","\\degree");N(Ee,B,le,"°","\\textdegree",!0);N(C,B,le,"£","\\pounds");N(C,B,le,"£","\\mathsterling",!0);N(Ee,B,le,"£","\\pounds");N(Ee,B,le,"£","\\textsterling",!0);N(C,G,le,"✠","\\maltese");N(Ee,G,le,"✠","\\maltese");var lN='0123456789/@."';for(var Mb=0;Mb0)return Li(i,h,s,n,l.concat(m));if(d){var p,x;if(d==="boldsymbol"){var v=ace(i,s,n,l,r);p=v.fontName,x=[v.fontClass]}else c?(p=mR[d].fontName,x=[d]):(p=_p(d,n.fontWeight,n.fontShape),x=[d,n.fontWeight,n.fontShape]);if(Hx(i,p,s).metrics)return Li(i,p,s,n,l.concat(x));if(dR.hasOwnProperty(i)&&p.slice(0,10)==="Typewriter"){for(var b=[],k=0;k{if(yo(t.classes)!==yo(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},cce=t=>{for(var e=0;en&&(n=l.height),l.depth>r&&(r=l.depth),l.maxFontSize>s&&(s=l.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Cs=function(e,n,r,s){var i=new S0(e,n,r,s);return E5(i),i},hR=(t,e,n,r)=>new S0(t,e,n,r),uce=function(e,n,r){var s=Cs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Le(s.height),s.maxFontSize=1,s},dce=function(e,n,r,s){var i=new M5(e,n,r,s);return E5(i),i},fR=function(e){var n=new w0(e);return E5(n),n},hce=function(e,n){return e instanceof w0?Cs([],[e],n):e},fce=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,l=1;l{var n=Cs(["mspace"],[],e),r=Kn(t,e);return n.style.marginRight=Le(r),n},_p=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},mR={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"}},pR={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},gce=function(e,n){var[r,s,i]=pR[e],l=new bo(r),c=new xl([l],{width:Le(s),height:Le(i),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),d=hR(["overlay"],[c],n);return d.height=i,d.style.height=Le(i),d.style.width=Le(s),d},pe={fontMap:mR,makeSymbol:Li,mathsym:ice,makeSpan:Cs,makeSvgSpan:hR,makeLineSpan:uce,makeAnchor:dce,makeFragment:fR,wrapFragment:hce,makeVList:mce,makeOrd:lce,makeGlue:pce,staticSvg:gce,svgData:pR,tryCombineChars:cce},Xn={number:3,unit:"mu"},tc={number:4,unit:"mu"},Ka={number:5,unit:"mu"},xce={mord:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mop:{mord:Xn,mop:Xn,mrel:Ka,minner:Xn},mbin:{mord:tc,mop:tc,mopen:tc,minner:tc},mrel:{mord:Ka,mop:Ka,mopen:Ka,minner:Ka},mopen:{},mclose:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mpunct:{mord:Xn,mop:Xn,mrel:Ka,mopen:Xn,mclose:Xn,mpunct:Xn,minner:Xn},minner:{mord:Xn,mop:Xn,mbin:tc,mrel:Ka,mopen:Xn,mpunct:Xn,minner:Xn}},vce={mord:{mop:Xn},mop:{mord:Xn,mop:Xn},mbin:{},mrel:{},mopen:{},mclose:{mop:Xn},mpunct:{},minner:{mop:Xn}},gR={},Yg={},Kg={};function Qe(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={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},d=0;d{var O=k.classes[0],j=b.classes[0];O==="mbin"&&bce.includes(j)?k.classes[0]="mord":j==="mbin"&&yce.includes(O)&&(b.classes[0]="mord")},{node:p},x,v),hN(i,(b,k)=>{var O=N4(k),j=N4(b),T=O&&j?b.hasClass("mtight")?vce[O][j]:xce[O][j]:null;if(T)return pe.makeGlue(T,h)},{node:p},x,v),i},hN=function t(e,n,r,s,i){s&&e.push(s);for(var l=0;lx=>{e.splice(p+1,0,x),l++})(l)}s&&e.pop()},xR=function(e){return e instanceof w0||e instanceof M5||e instanceof S0&&e.hasClass("enclosing")?e:null},kce=function t(e,n){var r=xR(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},N4=function(e,n){return e?(n&&(e=kce(e,n)),Sce[e.classes[0]]||null):null},qf=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return vl(n.concat(r))},Kt=function(e,n,r){if(!e)return vl();if(Yg[e.type]){var s=Yg[e.type](e,n);if(r&&n.size!==r.size){s=vl(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new De("Got group of unknown type: '"+e.type+"'")};function Dp(t,e){var n=vl(["base"],t,e),r=vl(["strut"]);return r.style.height=Le(n.height+n.depth),n.depth&&(r.style.verticalAlign=Le(-n.depth)),n.children.unshift(r),n}function C4(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Ar(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],l=[],c=0;c0&&(i.push(Dp(l,e)),l=[]),i.push(r[c]));l.length>0&&i.push(Dp(l,e));var h;n?(h=Dp(Ar(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var m=vl(["katex-html"],i);if(m.setAttribute("aria-hidden","true"),h){var p=h.children[0];p.style.height=Le(m.height+m.depth),m.depth&&(p.style.verticalAlign=Le(-m.depth))}return m}function vR(t){return new w0(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=yo(this.classes));for(var r=0;r0&&(e+=' class ="'+tn.escape(yo(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class ga{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return tn.escape(this.toText())}toText(){return this.text}}class Oce{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",Le(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var _e={MathNode:ni,TextNode:ga,SpaceNode:Oce,newDocumentFragment:vR},Mi=function(e,n,r){return Ln[n][e]&&Ln[n][e].replace&&e.charCodeAt(0)!==55349&&!(dR.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Ln[n][e].replace),new _e.TextNode(e)},_5=function(e){return e.length===1?e[0]:new _e.MathNode("mrow",e)},D5=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;Ln[s][i]&&Ln[s][i].replace&&(i=Ln[s][i].replace);var l=pe.fontMap[r].fontName;return A5(i,l,s)?pe.fontMap[r].variant:null};function Rb(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof ga&&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 ga&&n.text===","}else return!1}var Fs=function(e,n,r){if(e.length===1){var s=zn(e[0],n);return r&&s instanceof ni&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],l,c=0;c=1&&(l.type==="mn"||Rb(l))){var h=d.children[0];h instanceof ni&&h.type==="mn"&&(h.children=[...l.children,...h.children],i.pop())}else if(l.type==="mi"&&l.children.length===1){var m=l.children[0];if(m instanceof ga&&m.text==="̸"&&(d.type==="mo"||d.type==="mi"||d.type==="mn")){var p=d.children[0];p instanceof ga&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),i.pop())}}}i.push(d),l=d}return i},wo=function(e,n,r){return _5(Fs(e,n,r))},zn=function(e,n){if(!e)return new _e.MathNode("mrow");if(Kg[e.type]){var r=Kg[e.type](e,n);return r}else throw new De("Got group of unknown type: '"+e.type+"'")};function fN(t,e,n,r,s){var i=Fs(t,n),l;i.length===1&&i[0]instanceof ni&&["mrow","mtable"].includes(i[0].type)?l=i[0]:l=new _e.MathNode("mrow",i);var c=new _e.MathNode("annotation",[new _e.TextNode(e)]);c.setAttribute("encoding","application/x-tex");var d=new _e.MathNode("semantics",[l,c]),h=new _e.MathNode("math",[d]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var m=s?"katex":"katex-mathml";return pe.makeSpan([m],[h])}var yR=function(e){return new sl({style:e.displayMode?at.DISPLAY:at.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},bR=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=pe.makeSpan(r,[e])}return e},jce=function(e,n,r){var s=yR(r),i;if(r.output==="mathml")return fN(e,n,s,r.displayMode,!0);if(r.output==="html"){var l=C4(e,s);i=pe.makeSpan(["katex"],[l])}else{var c=fN(e,n,s,r.displayMode,!1),d=C4(e,s);i=pe.makeSpan(["katex"],[c,d])}return bR(i,r)},Nce=function(e,n,r){var s=yR(r),i=C4(e,s),l=pe.makeSpan(["katex"],[i]);return bR(l,r)},Cce={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":"="},Tce=function(e){var n=new _e.MathNode("mo",[new _e.TextNode(Cce[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Ace={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]},Mce=function(e){return e.type==="ordgroup"?e.body.length:1},Ece=function(e,n){function r(){var c=4e5,d=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(d)){var h=e,m=Mce(h.base),p,x,v;if(m>5)d==="widehat"||d==="widecheck"?(p=420,c=2364,v=.42,x=d+"4"):(p=312,c=2340,v=.34,x="tilde4");else{var b=[1,1,2,2,3,3][m];d==="widehat"||d==="widecheck"?(c=[0,1062,2364,2364,2364][b],p=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],x=d+b):(c=[0,600,1033,2339,2340][b],p=[0,260,286,306,312][b],v=[0,.26,.286,.3,.306,.34][b],x="tilde"+b)}var k=new bo(x),O=new xl([k],{width:"100%",height:Le(v),viewBox:"0 0 "+c+" "+p,preserveAspectRatio:"none"});return{span:pe.makeSvgSpan([],[O],n),minWidth:0,height:v}}else{var j=[],T=Ace[d],[A,_,D]=T,E=D/1e3,R=A.length,Q,F;if(R===1){var L=T[3];Q=["hide-tail"],F=[L]}else if(R===2)Q=["halfarrow-left","halfarrow-right"],F=["xMinYMin","xMaxYMin"];else if(R===3)Q=["brace-left","brace-center","brace-right"],F=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+R+" children.");for(var U=0;U0&&(s.style.minWidth=Le(i)),s},_ce=function(e,n,r,s,i){var l,c=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(l=pe.makeSpan(["stretchy",n],[],i),n==="fbox"){var d=i.color&&i.getColor();d&&(l.style.borderColor=d)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var m=new xl(h,{width:"100%",height:Le(c)});l=pe.makeSvgSpan([],[m],i)}return l.height=c,l.style.height=Le(c),l},yl={encloseSpan:_ce,mathMLnode:Tce,svgSpan:Ece};function Nt(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 R5(t){var e=Ux(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 Ux(t){return t&&(t.type==="atom"||rce.hasOwnProperty(t.type))?t:null}var z5=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=Nt(t.base,"accent"),n=r.base,t.base=n,s=tce(Kt(t,e)),t.base=r):(r=Nt(t,"accent"),n=r.base);var i=Kt(n,e.havingCrampedStyle()),l=r.isShifty&&tn.isCharacterBox(n),c=0;if(l){var d=tn.getBaseElem(n),h=Kt(d,e.havingCrampedStyle());c=aN(h).skew}var m=r.label==="\\c",p=m?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),x;if(r.isStretchy)x=yl.svgSpan(r,e),x=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:x,wrapperClasses:["svg-align"],wrapperStyle:c>0?{width:"calc(100% - "+Le(2*c)+")",marginLeft:Le(2*c)}:void 0}]},e);else{var v,b;r.label==="\\vec"?(v=pe.staticSvg("vec",e),b=pe.svgData.vec[1]):(v=pe.makeOrd({mode:r.mode,text:r.label},e,"textord"),v=aN(v),v.italic=0,b=v.width,m&&(p+=v.depth)),x=pe.makeSpan(["accent-body"],[v]);var k=r.label==="\\textcircled";k&&(x.classes.push("accent-full"),p=i.height);var O=c;k||(O-=b/2),x.style.left=Le(O),r.label==="\\textcircled"&&(x.style.top=".2em"),x=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-p},{type:"elem",elem:x}]},e)}var j=pe.makeSpan(["mord","accent"],[x],e);return s?(s.children[0]=j,s.height=Math.max(j.height,s.height),s.classes[0]="mord",s):j},wR=(t,e)=>{var n=t.isStretchy?yl.mathMLnode(t.label):new _e.MathNode("mo",[Mi(t.label,t.mode)]),r=new _e.MathNode("mover",[zn(t.base,e),n]);return r.setAttribute("accent","true"),r},Dce=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Qe({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=Zg(e[0]),r=!Dce.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:z5,mathmlBuilder:wR});Qe({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:z5,mathmlBuilder:wR});Qe({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=Kt(t.base,e),r=yl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=pe.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return pe.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=yl.mathMLnode(t.label),r=new _e.MathNode("munder",[zn(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var Rp=t=>{var e=new _e.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Qe({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=pe.wrapFragment(Kt(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var l;t.below&&(r=e.havingStyle(n.sub()),l=pe.wrapFragment(Kt(t.below,r,e),e),l.classes.push(i+"-arrow-pad"));var c=yl.svgSpan(t,e),d=-e.fontMetrics().axisHeight+.5*c.height,h=-e.fontMetrics().axisHeight-.5*c.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var m;if(l){var p=-e.fontMetrics().axisHeight+l.height+.5*c.height+.111;m=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d},{type:"elem",elem:l,shift:p}]},e)}else m=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d}]},e);return m.children[0].children[0].children[1].classes.push("svg-align"),pe.makeSpan(["mrel","x-arrow"],[m],e)},mathmlBuilder(t,e){var n=yl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=Rp(zn(t.body,e));if(t.below){var i=Rp(zn(t.below,e));r=new _e.MathNode("munderover",[n,i,s])}else r=new _e.MathNode("mover",[n,s])}else if(t.below){var l=Rp(zn(t.below,e));r=new _e.MathNode("munder",[n,l])}else r=Rp(),r=new _e.MathNode("mover",[n,r]);return r}});var Rce=pe.makeSpan;function SR(t,e){var n=Ar(t.body,e,!0);return Rce([t.mclass],n,e)}function kR(t,e){var n,r=Fs(t.body,e);return t.mclass==="minner"?n=new _e.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new _e.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new _e.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}Qe({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:ar(s),isCharacterBox:tn.isCharacterBox(s)}},htmlBuilder:SR,mathmlBuilder:kR});var Vx=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"};Qe({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Vx(e[0]),body:ar(e[1]),isCharacterBox:tn.isCharacterBox(e[1])}}});Qe({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],l;r!=="\\stackrel"?l=Vx(s):l="mrel";var c={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:ar(s)},d={type:"supsub",mode:i.mode,base:c,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:l,body:[d],isCharacterBox:tn.isCharacterBox(d)}},htmlBuilder:SR,mathmlBuilder:kR});Qe({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Vx(e[0]),body:ar(e[0])}},htmlBuilder(t,e){var n=Ar(t.body,e,!0),r=pe.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Fs(t.body,e),r=new _e.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var zce={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},mN=()=>({type:"styling",body:[],mode:"math",style:"display"}),pN=t=>t.type==="textord"&&t.text==="@",Pce=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Bce(t,e,n){var r=zce[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"},l=n.callFunction("\\Big",[i],[]),c=n.callFunction("\\\\cdright",[e[1]],[]),d={type:"ordgroup",mode:"math",body:[s,l,c]};return n.callFunction("\\\\cdparent",[d],[])}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 Lce(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 De("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var p=0;p<2;p++){for(var x=!0,v=d+1;vAV=|." after @',l[d]);var b=Bce(h,m,t),k={type:"styling",body:[b],mode:"math",style:"display"};r.push(k),c=mN()}i%2===0?r.push(c):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var O=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:O,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Qe({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=pe.wrapFragment(Kt(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Le(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new _e.MathNode("mrow",[zn(t.label,e)]);return n=new _e.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new _e.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Qe({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=pe.wrapFragment(Kt(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new _e.MathNode("mrow",[zn(t.fragment,e)])}});Qe({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Nt(e[0],"ordgroup"),s=r.body,i="",l=0;l=1114111)throw new De("\\@char with invalid code point "+i);return d<=65535?h=String.fromCharCode(d):(d-=65536,h=String.fromCharCode((d>>10)+55296,(d&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var OR=(t,e)=>{var n=Ar(t.body,e.withColor(t.color),!1);return pe.makeFragment(n)},jR=(t,e)=>{var n=Fs(t.body,e.withColor(t.color)),r=new _e.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Qe({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Nt(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:ar(s)}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=Nt(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:OR,mathmlBuilder:jR});Qe({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&&Nt(s,"size").value}},htmlBuilder(t,e){var n=pe.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Le(Kn(t.size,e)))),n},mathmlBuilder(t,e){var n=new _e.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Le(Kn(t.size,e)))),n}});var T4={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},NR=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new De("Expected a control sequence",t);return e},Ice=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},CR=(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)};Qe({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(T4[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=T4[r.text]),Nt(e.parseFunction(),"internal");throw new De("Invalid token after macro prefix",r)}});Qe({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 De("Expected a control sequence",r);for(var i=0,l,c=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){l=e.gullet.future(),c[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new De('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new De('Argument number "'+r.text+'" out of order');i++,c.push([])}else{if(r.text==="EOF")throw new De("Expected a macro definition");c[i].push(r.text)}var{tokens:d}=e.gullet.consumeArg();return l&&d.unshift(l),(n==="\\edef"||n==="\\xdef")&&(d=e.gullet.expandTokens(d),d.reverse()),e.gullet.macros.set(s,{tokens:d,numArgs:i,delimiters:c},n===T4[n]),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken());e.gullet.consumeSpaces();var s=Ice(e);return CR(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return CR(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var Vh=function(e,n,r){var s=Ln.math[e]&&Ln.math[e].replace,i=A5(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},P5=function(e,n,r,s){var i=r.havingBaseStyle(n),l=pe.makeSpan(s.concat(i.sizingClasses(r)),[e],r),c=i.sizeMultiplier/r.sizeMultiplier;return l.height*=c,l.depth*=c,l.maxFontSize=i.sizeMultiplier,l},TR=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=Le(i),e.height-=i,e.depth+=i},qce=function(e,n,r,s,i,l){var c=pe.makeSymbol(e,"Main-Regular",i,s),d=P5(c,n,s,l);return r&&TR(d,s,n),d},Fce=function(e,n,r,s){return pe.makeSymbol(e,"Size"+n+"-Regular",r,s)},AR=function(e,n,r,s,i,l){var c=Fce(e,n,i,s),d=P5(pe.makeSpan(["delimsizing","size"+n],[c],s),at.TEXT,s,l);return r&&TR(d,s,at.TEXT),d},zb=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=pe.makeSpan(["delimsizinginner",s],[pe.makeSpan([],[pe.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},Pb=function(e,n,r){var s=pa["Size4-Regular"][e.charCodeAt(0)]?pa["Size4-Regular"][e.charCodeAt(0)][4]:pa["Size1-Regular"][e.charCodeAt(0)][4],i=new bo("inner",Voe(e,Math.round(1e3*n))),l=new xl([i],{width:Le(s),height:Le(n),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),c=pe.makeSvgSpan([],[l],r);return c.height=n,c.style.height=Le(n),c.style.width=Le(s),{type:"elem",elem:c}},A4=.008,zp={type:"kern",size:-1*A4},Qce=["|","\\lvert","\\rvert","\\vert"],$ce=["\\|","\\lVert","\\rVert","\\Vert"],MR=function(e,n,r,s,i,l){var c,d,h,m,p="",x=0;c=h=m=e,d=null;var v="Size1-Regular";e==="\\uparrow"?h=m="⏐":e==="\\Uparrow"?h=m="‖":e==="\\downarrow"?c=h="⏐":e==="\\Downarrow"?c=h="‖":e==="\\updownarrow"?(c="\\uparrow",h="⏐",m="\\downarrow"):e==="\\Updownarrow"?(c="\\Uparrow",h="‖",m="\\Downarrow"):Qce.includes(e)?(h="∣",p="vert",x=333):$ce.includes(e)?(h="∥",p="doublevert",x=556):e==="["||e==="\\lbrack"?(c="⎡",h="⎢",m="⎣",v="Size4-Regular",p="lbrack",x=667):e==="]"||e==="\\rbrack"?(c="⎤",h="⎥",m="⎦",v="Size4-Regular",p="rbrack",x=667):e==="\\lfloor"||e==="⌊"?(h=c="⎢",m="⎣",v="Size4-Regular",p="lfloor",x=667):e==="\\lceil"||e==="⌈"?(c="⎡",h=m="⎢",v="Size4-Regular",p="lceil",x=667):e==="\\rfloor"||e==="⌋"?(h=c="⎥",m="⎦",v="Size4-Regular",p="rfloor",x=667):e==="\\rceil"||e==="⌉"?(c="⎤",h=m="⎥",v="Size4-Regular",p="rceil",x=667):e==="("||e==="\\lparen"?(c="⎛",h="⎜",m="⎝",v="Size4-Regular",p="lparen",x=875):e===")"||e==="\\rparen"?(c="⎞",h="⎟",m="⎠",v="Size4-Regular",p="rparen",x=875):e==="\\{"||e==="\\lbrace"?(c="⎧",d="⎨",m="⎩",h="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(c="⎫",d="⎬",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(c="⎧",m="⎩",h="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(c="⎫",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(c="⎧",m="⎭",h="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(c="⎫",m="⎩",h="⎪",v="Size4-Regular");var b=Vh(c,v,i),k=b.height+b.depth,O=Vh(h,v,i),j=O.height+O.depth,T=Vh(m,v,i),A=T.height+T.depth,_=0,D=1;if(d!==null){var E=Vh(d,v,i);_=E.height+E.depth,D=2}var R=k+A+_,Q=Math.max(0,Math.ceil((n-R)/(D*j))),F=R+Q*D*j,L=s.fontMetrics().axisHeight;r&&(L*=s.sizeMultiplier);var U=F/2-L,V=[];if(p.length>0){var de=F-k-A,W=Math.round(F*1e3),J=Woe(p,Math.round(de*1e3)),$=new bo(p,J),ae=(x/1e3).toFixed(3)+"em",ne=(W/1e3).toFixed(3)+"em",ce=new xl([$],{width:ae,height:ne,viewBox:"0 0 "+x+" "+W}),z=pe.makeSvgSpan([],[ce],s);z.height=W/1e3,z.style.width=ae,z.style.height=ne,V.push({type:"elem",elem:z})}else{if(V.push(zb(m,v,i)),V.push(zp),d===null){var xe=F-k-A+2*A4;V.push(Pb(h,xe,s))}else{var Y=(F-k-A-_)/2+2*A4;V.push(Pb(h,Y,s)),V.push(zp),V.push(zb(d,v,i)),V.push(zp),V.push(Pb(h,Y,s))}V.push(zp),V.push(zb(c,v,i))}var P=s.havingBaseStyle(at.TEXT),K=pe.makeVList({positionType:"bottom",positionData:U,children:V},P);return P5(pe.makeSpan(["delimsizing","mult"],[K],P),at.TEXT,s,l)},Bb=80,Lb=.08,Ib=function(e,n,r,s,i){var l=Uoe(e,s,r),c=new bo(e,l),d=new xl([c],{width:"400em",height:Le(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return pe.makeSvgSpan(["hide-tail"],[d],i)},Hce=function(e,n){var r=n.havingBaseSizing(),s=RR("\\surd",e*r.sizeMultiplier,DR,r),i=r.sizeMultiplier,l=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),c,d=0,h=0,m=0,p;return s.type==="small"?(m=1e3+1e3*l+Bb,e<1?i=1:e<1.4&&(i=.7),d=(1+l+Lb)/i,h=(1+l)/i,c=Ib("sqrtMain",d,m,l,n),c.style.minWidth="0.853em",p=.833/i):s.type==="large"?(m=(1e3+Bb)*cf[s.size],h=(cf[s.size]+l)/i,d=(cf[s.size]+l+Lb)/i,c=Ib("sqrtSize"+s.size,d,m,l,n),c.style.minWidth="1.02em",p=1/i):(d=e+l+Lb,h=e+l,m=Math.floor(1e3*e+l)+Bb,c=Ib("sqrtTall",d,m,l,n),c.style.minWidth="0.742em",p=1.056),c.height=h,c.style.height=Le(d),{span:c,advanceWidth:p,ruleWidth:(n.fontMetrics().sqrtRuleThickness+l)*i}},ER=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Uce=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],_R=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],cf=[0,1.2,1.8,2.4,3],Vce=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),ER.includes(e)||_R.includes(e))return AR(e,n,!1,r,s,i);if(Uce.includes(e))return MR(e,cf[n],!1,r,s,i);throw new De("Illegal delimiter: '"+e+"'")},Wce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Gce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"stack"}],DR=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Xce=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.")},RR=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),l=i;ln)return r[l]}return r[r.length-1]},zR=function(e,n,r,s,i,l){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var c;_R.includes(e)?c=Wce:ER.includes(e)?c=DR:c=Gce;var d=RR(e,n,c,s);return d.type==="small"?qce(e,d.style,r,s,i,l):d.type==="large"?AR(e,d.size,r,s,i,l):MR(e,n,r,s,i,l)},Yce=function(e,n,r,s,i,l){var c=s.fontMetrics().axisHeight*s.sizeMultiplier,d=901,h=5/s.fontMetrics().ptPerEm,m=Math.max(n-c,r+c),p=Math.max(m/500*d,2*m-h);return zR(e,p,!0,s,i,l)},dl={sqrtImage:Hce,sizedDelim:Vce,sizeToMaxHeight:cf,customSizedDelim:zR,leftRightDelim:Yce},gN={"\\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}},Kce=["(","\\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 Wx(t,e){var n=Ux(t);if(n&&Kce.includes(n.text))return n;throw n?new De("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new De("Invalid delimiter type '"+t.type+"'",t)}Qe({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=Wx(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:gN[t.funcName].size,mclass:gN[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?pe.makeSpan([t.mclass]):dl.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Mi(t.delim,t.mode));var n=new _e.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Le(dl.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function xN(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Qe({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 De("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Wx(e[0],t).text,color:n}}});Qe({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Nt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{xN(t);for(var n=Ar(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,l=0;l{xN(t);var n=Fs(t.body,e);if(t.left!=="."){var r=new _e.MathNode("mo",[Mi(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new _e.MathNode("mo",[Mi(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return _5(n)}});Qe({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t);if(!t.parser.leftrightDepth)throw new De("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=qf(e,[]);else{n=dl.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==="|"?Mi("|","text"):Mi(t.delim,t.mode),r=new _e.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var B5=(t,e)=>{var n=pe.wrapFragment(Kt(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,l=0,c=tn.isCharacterBox(t.body);if(r==="sout")i=pe.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,l=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var d=Kn({number:.6,unit:"pt"},e),h=Kn({number:.35,unit:"ex"},e),m=e.havingBaseSizing();s=s/m.sizeMultiplier;var p=n.height+n.depth+d+h;n.style.paddingLeft=Le(p/2+d);var x=Math.floor(1e3*p*s),v=$oe(x),b=new xl([new bo("phase",v)],{width:"400em",height:Le(x/1e3),viewBox:"0 0 400000 "+x,preserveAspectRatio:"xMinYMin slice"});i=pe.makeSvgSpan(["hide-tail"],[b],e),i.style.height=Le(p),l=n.depth+d+h}else{/cancel/.test(r)?c||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k=0,O=0,j=0;/box/.test(r)?(j=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),k=e.fontMetrics().fboxsep+(r==="colorbox"?0:j),O=k):r==="angl"?(j=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),k=4*j,O=Math.max(0,.25-n.depth)):(k=c?.2:0,O=k),i=yl.encloseSpan(n,r,k,O,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Le(j)):r==="angl"&&j!==.049&&(i.style.borderTopWidth=Le(j),i.style.borderRightWidth=Le(j)),l=n.depth+O,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var T;if(t.backgroundColor)T=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:l},{type:"elem",elem:n,shift:0}]},e);else{var A=/cancel|phase/.test(r)?["svg-align"]:[];T=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:l,wrapperClasses:A}]},e)}return/cancel/.test(r)&&(T.height=n.height,T.depth=n.depth),/cancel/.test(r)&&!c?pe.makeSpan(["mord","cancel-lap"],[T],e):pe.makeSpan(["mord"],[T],e)},L5=(t,e)=>{var n=0,r=new _e.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[zn(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};Qe({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:l}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=Nt(e[1],"color-token").color,c=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:l,borderColor:i,body:c}},htmlBuilder:B5,mathmlBuilder:L5});Qe({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]}}});Qe({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:B5,mathmlBuilder:L5});Qe({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 PR={};function Ca(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},d=0;d{var e=t.parser.settings;if(!e.displayMode)throw new De("{"+t.envName+"} can be used only in display mode.")};function I5(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function Mo(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:l,colSeparationType:c,autoTag:d,singleRow:h,emptySingleRow:m,maxNumCols:p,leqno:x}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!l){var v=t.gullet.expandMacroAsText("\\arraystretch");if(v==null)l=1;else if(l=parseFloat(v),!l||l<0)throw new De("Invalid \\arraystretch: "+v)}t.gullet.beginGroup();var b=[],k=[b],O=[],j=[],T=d!=null?[]:void 0;function A(){d&&t.gullet.macros.set("\\@eqnsw","1",!0)}function _(){T&&(t.gullet.macros.get("\\df@tag")?(T.push(t.subparse([new ii("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!d&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),j.push(vN(t));;){var D=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),D={type:"ordgroup",mode:t.mode,body:D},n&&(D={type:"styling",mode:t.mode,style:n,body:[D]}),b.push(D);var E=t.fetch().text;if(E==="&"){if(p&&b.length===p){if(h||c)throw new De("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"){_(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(k.length>1||!m)&&k.pop(),j.length0&&(A+=.25),h.push({pos:A,isDashed:Jn[nn]})}for(_(l[0]),r=0;r0&&(U+=T,RJn))for(r=0;r=c)){var ve=void 0;(s>0||e.hskipBeforeAndAfter)&&(ve=tn.deflt(Y.pregap,x),ve!==0&&(J=pe.makeSpan(["arraycolsep"],[]),J.style.width=Le(ve),W.push(J)));var Re=[];for(r=0;r0){for(var Oe=pe.makeLineSpan("hline",n,m),nt=pe.makeLineSpan("hdashline",n,m),ut=[{type:"elem",elem:d,shift:0}];h.length>0;){var Ct=h.pop(),In=Ct.pos-V;Ct.isDashed?ut.push({type:"elem",elem:nt,shift:In}):ut.push({type:"elem",elem:Oe,shift:In})}d=pe.makeVList({positionType:"individualShift",children:ut},n)}if(ae.length===0)return pe.makeSpan(["mord"],[d],n);var Tn=pe.makeVList({positionType:"individualShift",children:ae},n);return Tn=pe.makeSpan(["tag"],[Tn],n),pe.makeFragment([d,Tn])},Zce={c:"center ",l:"left ",r:"right "},Aa=function(e,n){for(var r=[],s=new _e.MathNode("mtd",[],["mtr-glue"]),i=new _e.MathNode("mtd",[],["mml-eqn-num"]),l=0;l0){var b=e.cols,k="",O=!1,j=0,T=b.length;b[0].type==="separator"&&(x+="top ",j=1),b[b.length-1].type==="separator"&&(x+="bottom ",T-=1);for(var A=j;A0?"left ":"",x+=Q[Q.length-1].length>0?"right ":"";for(var F=1;F-1?"alignat":"align",i=e.envName==="split",l=Mo(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:I5(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),c,d=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var m="",p=0;p0&&v&&(O=1),r[b]={type:"align",align:k,pregap:O,postgap:0}}return l.colSeparationType=v?"align":"alignat",l};Ca({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lcr".indexOf(d)!==-1)return{type:"align",align:d};if(d==="|")return{type:"separator",separator:"|"};if(d===":")return{type:"separator",separator:":"};throw new De("Unknown column alignment: "+d,l)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Mo(t.parser,i,q5(t.envName))},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({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 De("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Mo(t.parser,r,q5(t.envName)),l=Math.max(0,...i.body.map(c=>c.length));return i.cols=new Array(l).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Mo(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lc".indexOf(d)!==-1)return{type:"align",align:d};throw new De("Unknown column alignment: "+d,l)});if(s.length>1)throw new De("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Mo(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new De("{subarray} can contain only one column");return i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({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=Mo(t.parser,e,q5(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:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Gx(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:I5(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Gx(t);var e={autoTag:I5(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Gx(t),Lce(t.parser)},htmlBuilder:Ta,mathmlBuilder:Aa});q("\\nonumber","\\gdef\\@eqnsw{0}");q("\\notag","\\nonumber");Qe({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new De(t.funcName+" valid only within array environment")}});var yN=PR;Qe({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 De("Invalid environment name",s);for(var i="",l=0;l{var n=t.font,r=e.withFont(n);return Kt(t.body,r)},qR=(t,e)=>{var n=t.font,r=e.withFont(n);return zn(t.body,r)},bN={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Qe({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=Zg(e[0]),i=r;return i in bN&&(i=bN[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:IR,mathmlBuilder:qR});Qe({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=tn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Vx(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Qe({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,l=n.parseExpression(!0,s),c="math"+r.slice(1);return{type:"font",mode:i,font:c,body:{type:"ordgroup",mode:n.mode,body:l}}},htmlBuilder:IR,mathmlBuilder:qR});var FR=(t,e)=>{var n=e;return t==="display"?n=n.id>=at.SCRIPT.id?n.text():at.DISPLAY:t==="text"&&n.size===at.DISPLAY.size?n=at.TEXT:t==="script"?n=at.SCRIPT:t==="scriptscript"&&(n=at.SCRIPTSCRIPT),n},F5=(t,e)=>{var n=FR(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var l=Kt(t.numer,i,e);if(t.continued){var c=8.5/e.fontMetrics().ptPerEm,d=3.5/e.fontMetrics().ptPerEm;l.height=l.height0?b=3*x:b=7*x,k=e.fontMetrics().denom1):(p>0?(v=e.fontMetrics().num2,b=x):(v=e.fontMetrics().num3,b=3*x),k=e.fontMetrics().denom2);var O;if(m){var T=e.fontMetrics().axisHeight;v-l.depth-(T+.5*p){var n=new _e.MathNode("mfrac",[zn(t.numer,e),zn(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Kn(t.barSize,e);n.setAttribute("linethickness",Le(r))}var s=FR(t.size,e.style);if(s.size!==e.style.size){n=new _e.MathNode("mstyle",[n]);var i=s.size===at.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var l=[];if(t.leftDelim!=null){var c=new _e.MathNode("mo",[new _e.TextNode(t.leftDelim.replace("\\",""))]);c.setAttribute("fence","true"),l.push(c)}if(l.push(n),t.rightDelim!=null){var d=new _e.MathNode("mo",[new _e.TextNode(t.rightDelim.replace("\\",""))]);d.setAttribute("fence","true"),l.push(d)}return _5(l)}return n};Qe({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],l,c=null,d=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":l=!0;break;case"\\\\atopfrac":l=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l=!1,c="(",d=")";break;case"\\\\bracefrac":l=!1,c="\\{",d="\\}";break;case"\\\\brackfrac":l=!1,c="[",d="]";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:l,leftDelim:c,rightDelim:d,size:h,barSize:null}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({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}}});Qe({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 wN=["display","text","script","scriptscript"],SN=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Qe({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=Zg(e[0]),l=i.type==="atom"&&i.family==="open"?SN(i.text):null,c=Zg(e[1]),d=c.type==="atom"&&c.family==="close"?SN(c.text):null,h=Nt(e[2],"size"),m,p=null;h.isBlank?m=!0:(p=h.value,m=p.number>0);var x="auto",v=e[3];if(v.type==="ordgroup"){if(v.body.length>0){var b=Nt(v.body[0],"textord");x=wN[Number(b.text)]}}else v=Nt(v,"textord"),x=wN[Number(v.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:m,barSize:p,leftDelim:l,rightDelim:d,size:x}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({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:Nt(e[0],"size").value,token:s}}});Qe({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Toe(Nt(e[1],"infix").size),l=e[2],c=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:l,continued:!1,hasBarLine:c,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:F5,mathmlBuilder:Q5});var QR=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Kt(t.sup,e.havingStyle(n.sup()),e):Kt(t.sub,e.havingStyle(n.sub()),e),s=Nt(t.base,"horizBrace")):s=Nt(t,"horizBrace");var i=Kt(s.base,e.havingBaseStyle(at.DISPLAY)),l=yl.svgSpan(s,e),c;if(s.isOver?(c=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:l}]},e),c.children[0].children[0].children[1].classes.push("svg-align")):(c=pe.makeVList({positionType:"bottom",positionData:i.depth+.1+l.height,children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:i}]},e),c.children[0].children[0].children[0].classes.push("svg-align")),r){var d=pe.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e);s.isOver?c=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:d},{type:"kern",size:.2},{type:"elem",elem:r}]},e):c=pe.makeVList({positionType:"bottom",positionData:d.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:d}]},e)}return pe.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e)},Jce=(t,e)=>{var n=yl.mathMLnode(t.label);return new _e.MathNode(t.isOver?"mover":"munder",[zn(t.base,e),n])};Qe({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:QR,mathmlBuilder:Jce});Qe({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=Nt(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:ar(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Ar(t.body,e,!1);return pe.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=wo(t.body,e);return n instanceof ni||(n=new ni("mrow",[n])),n.setAttribute("href",t.href),n}});Qe({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Nt(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=Nt(e[0],"raw").string,l=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var c,d={};switch(r){case"\\htmlClass":d.class=i,c={command:"\\htmlClass",class:i};break;case"\\htmlId":d.id=i,c={command:"\\htmlId",id:i};break;case"\\htmlStyle":d.style=i,c={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),m=0;m{var n=Ar(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=pe.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)=>wo(t.body,e)});Qe({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:ar(e[0]),mathml:ar(e[1])}},htmlBuilder:(t,e)=>{var n=Ar(t.html,e,!1);return pe.makeFragment(n)},mathmlBuilder:(t,e)=>wo(t.mathml,e)});var qb=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 De("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!lR(r))throw new De("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Qe({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"},l={number:0,unit:"em"},c="";if(n[0])for(var d=Nt(n[0],"raw").string,h=d.split(","),m=0;m{var n=Kn(t.height,e),r=0;t.totalheight.number>0&&(r=Kn(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=Kn(t.width,e));var i={height:Le(n+r)};s>0&&(i.width=Le(s)),r>0&&(i.verticalAlign=Le(-r));var l=new Joe(t.src,t.alt,i);return l.height=n,l.depth=r,l},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Kn(t.height,e),s=0;if(t.totalheight.number>0&&(s=Kn(t.totalheight,e)-r,n.setAttribute("valign",Le(-s))),n.setAttribute("height",Le(r+s)),t.width.number>0){var i=Kn(t.width,e);n.setAttribute("width",Le(i))}return n.setAttribute("src",t.src),n}});Qe({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=Nt(e[0],"size");if(n.settings.strict){var i=r[1]==="m",l=s.value.unit==="mu";i?(l||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")):l&&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 pe.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=Kn(t.dimension,e);return new _e.SpaceNode(n)}});Qe({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=pe.makeSpan([],[Kt(t.body,e)]),n=pe.makeSpan(["inner"],[n],e)):n=pe.makeSpan(["inner"],[Kt(t.body,e)]);var r=pe.makeSpan(["fix"],[]),s=pe.makeSpan([t.alignment],[n,r],e),i=pe.makeSpan(["strut"]);return i.style.height=Le(s.height+s.depth),s.depth&&(i.style.verticalAlign=Le(-s.depth)),s.children.unshift(i),s=pe.makeSpan(["thinbox"],[s],e),pe.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mpadded",[zn(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}});Qe({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==="\\("?"\\)":"$",l=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:l}}});Qe({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new De("Mismatched "+t.funcName)}});var kN=(t,e)=>{switch(e.style.size){case at.DISPLAY.size:return t.display;case at.TEXT.size:return t.text;case at.SCRIPT.size:return t.script;case at.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Qe({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:ar(e[0]),text:ar(e[1]),script:ar(e[2]),scriptscript:ar(e[3])}},htmlBuilder:(t,e)=>{var n=kN(t,e),r=Ar(n,e,!1);return pe.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=kN(t,e);return wo(n,e)}});var $R=(t,e,n,r,s,i,l)=>{t=pe.makeSpan([],[t]);var c=n&&tn.isCharacterBox(n),d,h;if(e){var m=Kt(e,r.havingStyle(s.sup()),r);h={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-m.depth)}}if(n){var p=Kt(n,r.havingStyle(s.sub()),r);d={elem:p,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-p.height)}}var x;if(h&&d){var v=r.fontMetrics().bigOpSpacing5+d.elem.height+d.elem.depth+d.kern+t.depth+l;x=pe.makeVList({positionType:"bottom",positionData:v,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(d){var b=t.height-l;x=pe.makeVList({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t}]},r)}else if(h){var k=t.depth+l;x=pe.makeVList({positionType:"bottom",positionData:k,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var O=[x];if(d&&i!==0&&!c){var j=pe.makeSpan(["mspace"],[],r);j.style.marginRight=Le(i),O.unshift(j)}return pe.makeSpan(["mop","op-limits"],O,r)},HR=["\\smallint"],zd=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"op"),s=!0):i=Nt(t,"op");var l=e.style,c=!1;l.size===at.DISPLAY.size&&i.symbol&&!HR.includes(i.name)&&(c=!0);var d;if(i.symbol){var h=c?"Size2-Regular":"Size1-Regular",m="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(m=i.name.slice(1),i.name=m==="oiint"?"\\iint":"\\iiint"),d=pe.makeSymbol(i.name,h,"math",e,["mop","op-symbol",c?"large-op":"small-op"]),m.length>0){var p=d.italic,x=pe.staticSvg(m+"Size"+(c?"2":"1"),e);d=pe.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:0},{type:"elem",elem:x,shift:c?.08:0}]},e),i.name="\\"+m,d.classes.unshift("mop"),d.italic=p}}else if(i.body){var v=Ar(i.body,e,!0);v.length===1&&v[0]instanceof Ai?(d=v[0],d.classes[0]="mop"):d=pe.makeSpan(["mop"],v,e)}else{for(var b=[],k=1;k{var n;if(t.symbol)n=new ni("mo",[Mi(t.name,t.mode)]),HR.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new ni("mo",Fs(t.body,e));else{n=new ni("mi",[new ga(t.name.slice(1))]);var r=new ni("mo",[Mi("⁡","text")]);t.parentIsSupSub?n=new ni("mrow",[n,r]):n=vR([n,r])}return n},eue={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Qe({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=eue[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:zd,mathmlBuilder:k0});Qe({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:ar(r)}},htmlBuilder:zd,mathmlBuilder:k0});var tue={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Qe({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:zd,mathmlBuilder:k0});Qe({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:zd,mathmlBuilder:k0});Qe({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=tue[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:zd,mathmlBuilder:k0});var UR=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"operatorname"),s=!0):i=Nt(t,"operatorname");var l;if(i.body.length>0){for(var c=i.body.map(p=>{var x=p.text;return typeof x=="string"?{type:"textord",mode:p.mode,text:x}:p}),d=Ar(c,e.withFont("mathrm"),!0),h=0;h{for(var n=Fs(t.body,e.withFont("mathrm")),r=!0,s=0;sm.toText()).join("");n=[new _e.TextNode(c)]}var d=new _e.MathNode("mi",n);d.setAttribute("mathvariant","normal");var h=new _e.MathNode("mo",[Mi("⁡","text")]);return t.parentIsSupSub?new _e.MathNode("mrow",[d,h]):_e.newDocumentFragment([d,h])};Qe({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:ar(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:UR,mathmlBuilder:nue});q("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Rc({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?pe.makeFragment(Ar(t.body,e,!1)):pe.makeSpan(["mord"],Ar(t.body,e,!0),e)},mathmlBuilder(t,e){return wo(t.body,e,!0)}});Qe({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=Kt(t.body,e.havingCrampedStyle()),r=pe.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return pe.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("mover",[zn(t.body,e),n]);return r.setAttribute("accent","true"),r}});Qe({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:ar(r)}},htmlBuilder:(t,e)=>{var n=Ar(t.body,e.withPhantom(),!1);return pe.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=Fs(t.body,e);return new _e.MathNode("mphantom",n)}});Qe({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=pe.makeSpan([],[Kt(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Qe({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=pe.makeSpan(["inner"],[Kt(t.body,e.withPhantom())]),r=pe.makeSpan(["fix"],[]);return pe.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Qe({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Nt(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Kt(t.body,e),r=Kn(t.dy,e);return pe.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new _e.MathNode("mpadded",[zn(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Qe({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Qe({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=Nt(e[0],"size"),l=Nt(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Nt(s,"size").value,width:i.value,height:l.value}},htmlBuilder(t,e){var n=pe.makeSpan(["mord","rule"],[],e),r=Kn(t.width,e),s=Kn(t.height,e),i=t.shift?Kn(t.shift,e):0;return n.style.borderRightWidth=Le(r),n.style.borderTopWidth=Le(s),n.style.bottom=Le(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Kn(t.width,e),r=Kn(t.height,e),s=t.shift?Kn(t.shift,e):0,i=e.color&&e.getColor()||"black",l=new _e.MathNode("mspace");l.setAttribute("mathbackground",i),l.setAttribute("width",Le(n)),l.setAttribute("height",Le(r));var c=new _e.MathNode("mpadded",[l]);return s>=0?c.setAttribute("height",Le(s)):(c.setAttribute("height",Le(s)),c.setAttribute("depth",Le(-s))),c.setAttribute("voffset",Le(s)),c}});function VR(t,e,n){for(var r=Ar(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return VR(t.body,n,e)};Qe({type:"sizing",names:ON,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:ON.indexOf(r)+1,body:i}},htmlBuilder:rue,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Fs(t.body,n),s=new _e.MathNode("mstyle",r);return s.setAttribute("mathsize",Le(n.sizeMultiplier)),s}});Qe({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,l=n[0]&&Nt(n[0],"ordgroup");if(l)for(var c="",d=0;d{var n=pe.makeSpan([],[Kt(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Qe({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=Kt(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=pe.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+l&&(l=(l+p-n.height-n.depth)/2);var x=d.height-n.height-l-h;n.style.paddingLeft=Le(m);var v=pe.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+x)},{type:"elem",elem:d},{type:"kern",size:h}]},e);if(t.index){var b=e.havingStyle(at.SCRIPTSCRIPT),k=Kt(t.index,b,e),O=.6*(v.height-v.depth),j=pe.makeVList({positionType:"shift",positionData:-O,children:[{type:"elem",elem:k}]},e),T=pe.makeSpan(["root"],[j]);return pe.makeSpan(["mord","sqrt"],[T,v],e)}else return pe.makeSpan(["mord","sqrt"],[v],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new _e.MathNode("mroot",[zn(n,e),zn(r,e)]):new _e.MathNode("msqrt",[zn(n,e)])}});var jN={display:at.DISPLAY,text:at.TEXT,script:at.SCRIPT,scriptscript:at.SCRIPTSCRIPT};Qe({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),l=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:l,body:i}},htmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n).withFont("");return VR(t.body,r,e)},mathmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n),s=Fs(t.body,r),i=new _e.MathNode("mstyle",s),l={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},c=l[t.style];return i.setAttribute("scriptlevel",c[0]),i.setAttribute("displaystyle",c[1]),i}});var sue=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===at.DISPLAY.size||r.alwaysHandleSupSub);return s?zd:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===at.DISPLAY.size||r.limits);return i?UR:null}else{if(r.type==="accent")return tn.isCharacterBox(r.base)?z5:null;if(r.type==="horizBrace"){var l=!e.sub;return l===r.isOver?QR:null}else return null}else return null};Rc({type:"supsub",htmlBuilder(t,e){var n=sue(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,l=Kt(r,e),c,d,h=e.fontMetrics(),m=0,p=0,x=r&&tn.isCharacterBox(r);if(s){var v=e.havingStyle(e.style.sup());c=Kt(s,v,e),x||(m=l.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(i){var b=e.havingStyle(e.style.sub());d=Kt(i,b,e),x||(p=l.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var k;e.style===at.DISPLAY?k=h.sup1:e.style.cramped?k=h.sup3:k=h.sup2;var O=e.sizeMultiplier,j=Le(.5/h.ptPerEm/O),T=null;if(d){var A=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(l instanceof Ai||A)&&(T=Le(-l.italic))}var _;if(c&&d){m=Math.max(m,k,c.depth+.25*h.xHeight),p=Math.max(p,h.sub2);var D=h.defaultRuleThickness,E=4*D;if(m-c.depth-(d.height-p)0&&(m+=R,p-=R)}var Q=[{type:"elem",elem:d,shift:p,marginRight:j,marginLeft:T},{type:"elem",elem:c,shift:-m,marginRight:j}];_=pe.makeVList({positionType:"individualShift",children:Q},e)}else if(d){p=Math.max(p,h.sub1,d.height-.8*h.xHeight);var F=[{type:"elem",elem:d,marginLeft:T,marginRight:j}];_=pe.makeVList({positionType:"shift",positionData:p,children:F},e)}else if(c)m=Math.max(m,k,c.depth+.25*h.xHeight),_=pe.makeVList({positionType:"shift",positionData:-m,children:[{type:"elem",elem:c,marginRight:j}]},e);else throw new Error("supsub must have either sup or sub.");var L=N4(l,"right")||"mord";return pe.makeSpan([L],[l,pe.makeSpan(["msupsub"],[_])],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=[zn(t.base,e)];t.sub&&i.push(zn(t.sub,e)),t.sup&&i.push(zn(t.sup,e));var l;if(n)l=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===at.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===at.DISPLAY||h.limits)?l="munderover":l="msubsup"}else{var d=t.base;d&&d.type==="op"&&d.limits&&(e.style===at.DISPLAY||d.alwaysHandleSupSub)||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(d.limits||e.style===at.DISPLAY)?l="munder":l="msub"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===at.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===at.DISPLAY)?l="mover":l="msup"}return new _e.MathNode(l,i)}});Rc({type:"atom",htmlBuilder(t,e){return pe.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[Mi(t.text,t.mode)]);if(t.family==="bin"){var r=D5(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 WR={mi:"italic",mn:"normal",mtext:"normal"};Rc({type:"mathord",htmlBuilder(t,e){return pe.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new _e.MathNode("mi",[Mi(t.text,t.mode,e)]),r=D5(t,e)||"italic";return r!==WR[n.type]&&n.setAttribute("mathvariant",r),n}});Rc({type:"textord",htmlBuilder(t,e){return pe.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Mi(t.text,t.mode,e),r=D5(t,e)||"normal",s;return t.mode==="text"?s=new _e.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new _e.MathNode("mn",[n]):t.text==="\\prime"?s=new _e.MathNode("mo",[n]):s=new _e.MathNode("mi",[n]),r!==WR[s.type]&&s.setAttribute("mathvariant",r),s}});var Fb={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Qb={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Rc({type:"spacing",htmlBuilder(t,e){if(Qb.hasOwnProperty(t.text)){var n=Qb[t.text].className||"";if(t.mode==="text"){var r=pe.makeOrd(t,e,"textord");return r.classes.push(n),r}else return pe.makeSpan(["mspace",n],[pe.mathsym(t.text,t.mode,e)],e)}else{if(Fb.hasOwnProperty(t.text))return pe.makeSpan(["mspace",Fb[t.text]],[],e);throw new De('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(Qb.hasOwnProperty(t.text))n=new _e.MathNode("mtext",[new _e.TextNode(" ")]);else{if(Fb.hasOwnProperty(t.text))return new _e.MathNode("mspace");throw new De('Unknown type of space "'+t.text+'"')}return n}});var NN=()=>{var t=new _e.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Rc({type:"tag",mathmlBuilder(t,e){var n=new _e.MathNode("mtable",[new _e.MathNode("mtr",[NN(),new _e.MathNode("mtd",[wo(t.body,e)]),NN(),new _e.MathNode("mtd",[wo(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var CN={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},TN={"\\textbf":"textbf","\\textmd":"textmd"},iue={"\\textit":"textit","\\textup":"textup"},AN=(t,e)=>{var n=t.font;if(n){if(CN[n])return e.withTextFontFamily(CN[n]);if(TN[n])return e.withTextFontWeight(TN[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(iue[n])};Qe({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:ar(s),font:r}},htmlBuilder(t,e){var n=AN(t,e),r=Ar(t.body,n,!0);return pe.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=AN(t,e);return wo(t.body,n)}});Qe({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=Kt(t.body,e),r=pe.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=pe.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 pe.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("munder",[zn(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Qe({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=Kt(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return pe.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new _e.MathNode("mpadded",[zn(t.body,e)],["vcenter"])}});Qe({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new De("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=MN(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),io=gR,GR=`[ \r +-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 w0{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var pa={"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]}},Tp={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]},rN={Å:"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 Goe(t,e){pa[t]=e}function A5(t,e,n){if(!pa[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=pa[e][r];if(!s&&t[0]in rN&&(r=rN[t[0]].charCodeAt(0),s=pa[e][r]),!s&&n==="text"&&aR(r)&&(s=pa[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var Ab={};function Xoe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Ab[e]){var n=Ab[e]={cssEmPerMu:Tp.quad[e]/18};for(var r in Tp)Tp.hasOwnProperty(r)&&(n[r]=Tp[r][e])}return Ab[e]}var Yoe=[[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]],sN=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],iN=function(e,n){return n.size<2?e:Yoe[e-1][n.size-1]};class sl{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||sl.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=sN[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 sl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:iN(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:sN[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=iN(sl.BASESIZE,e);return this.size===n&&this.textSize===sl.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!==sl.BASESIZE?["sizing","reset-size"+this.size,"size"+sl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Xoe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}sl.BASESIZE=6;var k4={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},Koe={ex:!0,em:!0,mu:!0},lR=function(e){return typeof e!="string"&&(e=e.unit),e in k4||e in Koe||e==="ex"},Kn=function(e,n){var r;if(e.unit in k4)r=k4[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 De("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Le=function(e){return+e.toFixed(4)+"em"},yo=function(e){return e.filter(n=>n).join(" ")},oR=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)}},cR=function(e){var n=document.createElement(e);n.className=yo(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,uR=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+tn.escape(yo(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+tn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(Zoe.test(i))throw new De("Invalid attribute name '"+i+"'");n+=" "+i+'="'+tn.escape(this.attributes[i])+'"'}n+=">";for(var l=0;l",n};class S0{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,oR.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return cR.call(this,"span")}toMarkup(){return uR.call(this,"span")}}class M5{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,oR.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 cR.call(this,"a")}toMarkup(){return uR.call(this,"a")}}class Joe{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=''+tn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Le(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=yo(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=tn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+tn.escape(r)+'"');var i=tn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class xl{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class O4{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var nce={bin:1,close:1,inner:1,open:1,punct:1,rel:1},rce={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ln={math:{},text:{}};function N(t,e,n,r,s,i){Ln[t][s]={font:e,group:n,replace:r},i&&r&&(Ln[t][r]=Ln[t][s])}var C="math",Ee="text",B="main",G="ams",Wn="accent-token",Ve="bin",xs="close",Rd="inner",st="mathord",yr="op-token",li="open",$x="punct",X="rel",Sl="spacing",le="textord";N(C,B,X,"≡","\\equiv",!0);N(C,B,X,"≺","\\prec",!0);N(C,B,X,"≻","\\succ",!0);N(C,B,X,"∼","\\sim",!0);N(C,B,X,"⊥","\\perp");N(C,B,X,"⪯","\\preceq",!0);N(C,B,X,"⪰","\\succeq",!0);N(C,B,X,"≃","\\simeq",!0);N(C,B,X,"∣","\\mid",!0);N(C,B,X,"≪","\\ll",!0);N(C,B,X,"≫","\\gg",!0);N(C,B,X,"≍","\\asymp",!0);N(C,B,X,"∥","\\parallel");N(C,B,X,"⋈","\\bowtie",!0);N(C,B,X,"⌣","\\smile",!0);N(C,B,X,"⊑","\\sqsubseteq",!0);N(C,B,X,"⊒","\\sqsupseteq",!0);N(C,B,X,"≐","\\doteq",!0);N(C,B,X,"⌢","\\frown",!0);N(C,B,X,"∋","\\ni",!0);N(C,B,X,"∝","\\propto",!0);N(C,B,X,"⊢","\\vdash",!0);N(C,B,X,"⊣","\\dashv",!0);N(C,B,X,"∋","\\owns");N(C,B,$x,".","\\ldotp");N(C,B,$x,"⋅","\\cdotp");N(C,B,le,"#","\\#");N(Ee,B,le,"#","\\#");N(C,B,le,"&","\\&");N(Ee,B,le,"&","\\&");N(C,B,le,"ℵ","\\aleph",!0);N(C,B,le,"∀","\\forall",!0);N(C,B,le,"ℏ","\\hbar",!0);N(C,B,le,"∃","\\exists",!0);N(C,B,le,"∇","\\nabla",!0);N(C,B,le,"♭","\\flat",!0);N(C,B,le,"ℓ","\\ell",!0);N(C,B,le,"♮","\\natural",!0);N(C,B,le,"♣","\\clubsuit",!0);N(C,B,le,"℘","\\wp",!0);N(C,B,le,"♯","\\sharp",!0);N(C,B,le,"♢","\\diamondsuit",!0);N(C,B,le,"ℜ","\\Re",!0);N(C,B,le,"♡","\\heartsuit",!0);N(C,B,le,"ℑ","\\Im",!0);N(C,B,le,"♠","\\spadesuit",!0);N(C,B,le,"§","\\S",!0);N(Ee,B,le,"§","\\S");N(C,B,le,"¶","\\P",!0);N(Ee,B,le,"¶","\\P");N(C,B,le,"†","\\dag");N(Ee,B,le,"†","\\dag");N(Ee,B,le,"†","\\textdagger");N(C,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\ddag");N(Ee,B,le,"‡","\\textdaggerdbl");N(C,B,xs,"⎱","\\rmoustache",!0);N(C,B,li,"⎰","\\lmoustache",!0);N(C,B,xs,"⟯","\\rgroup",!0);N(C,B,li,"⟮","\\lgroup",!0);N(C,B,Ve,"∓","\\mp",!0);N(C,B,Ve,"⊖","\\ominus",!0);N(C,B,Ve,"⊎","\\uplus",!0);N(C,B,Ve,"⊓","\\sqcap",!0);N(C,B,Ve,"∗","\\ast");N(C,B,Ve,"⊔","\\sqcup",!0);N(C,B,Ve,"◯","\\bigcirc",!0);N(C,B,Ve,"∙","\\bullet",!0);N(C,B,Ve,"‡","\\ddagger");N(C,B,Ve,"≀","\\wr",!0);N(C,B,Ve,"⨿","\\amalg");N(C,B,Ve,"&","\\And");N(C,B,X,"⟵","\\longleftarrow",!0);N(C,B,X,"⇐","\\Leftarrow",!0);N(C,B,X,"⟸","\\Longleftarrow",!0);N(C,B,X,"⟶","\\longrightarrow",!0);N(C,B,X,"⇒","\\Rightarrow",!0);N(C,B,X,"⟹","\\Longrightarrow",!0);N(C,B,X,"↔","\\leftrightarrow",!0);N(C,B,X,"⟷","\\longleftrightarrow",!0);N(C,B,X,"⇔","\\Leftrightarrow",!0);N(C,B,X,"⟺","\\Longleftrightarrow",!0);N(C,B,X,"↦","\\mapsto",!0);N(C,B,X,"⟼","\\longmapsto",!0);N(C,B,X,"↗","\\nearrow",!0);N(C,B,X,"↩","\\hookleftarrow",!0);N(C,B,X,"↪","\\hookrightarrow",!0);N(C,B,X,"↘","\\searrow",!0);N(C,B,X,"↼","\\leftharpoonup",!0);N(C,B,X,"⇀","\\rightharpoonup",!0);N(C,B,X,"↙","\\swarrow",!0);N(C,B,X,"↽","\\leftharpoondown",!0);N(C,B,X,"⇁","\\rightharpoondown",!0);N(C,B,X,"↖","\\nwarrow",!0);N(C,B,X,"⇌","\\rightleftharpoons",!0);N(C,G,X,"≮","\\nless",!0);N(C,G,X,"","\\@nleqslant");N(C,G,X,"","\\@nleqq");N(C,G,X,"⪇","\\lneq",!0);N(C,G,X,"≨","\\lneqq",!0);N(C,G,X,"","\\@lvertneqq");N(C,G,X,"⋦","\\lnsim",!0);N(C,G,X,"⪉","\\lnapprox",!0);N(C,G,X,"⊀","\\nprec",!0);N(C,G,X,"⋠","\\npreceq",!0);N(C,G,X,"⋨","\\precnsim",!0);N(C,G,X,"⪹","\\precnapprox",!0);N(C,G,X,"≁","\\nsim",!0);N(C,G,X,"","\\@nshortmid");N(C,G,X,"∤","\\nmid",!0);N(C,G,X,"⊬","\\nvdash",!0);N(C,G,X,"⊭","\\nvDash",!0);N(C,G,X,"⋪","\\ntriangleleft");N(C,G,X,"⋬","\\ntrianglelefteq",!0);N(C,G,X,"⊊","\\subsetneq",!0);N(C,G,X,"","\\@varsubsetneq");N(C,G,X,"⫋","\\subsetneqq",!0);N(C,G,X,"","\\@varsubsetneqq");N(C,G,X,"≯","\\ngtr",!0);N(C,G,X,"","\\@ngeqslant");N(C,G,X,"","\\@ngeqq");N(C,G,X,"⪈","\\gneq",!0);N(C,G,X,"≩","\\gneqq",!0);N(C,G,X,"","\\@gvertneqq");N(C,G,X,"⋧","\\gnsim",!0);N(C,G,X,"⪊","\\gnapprox",!0);N(C,G,X,"⊁","\\nsucc",!0);N(C,G,X,"⋡","\\nsucceq",!0);N(C,G,X,"⋩","\\succnsim",!0);N(C,G,X,"⪺","\\succnapprox",!0);N(C,G,X,"≆","\\ncong",!0);N(C,G,X,"","\\@nshortparallel");N(C,G,X,"∦","\\nparallel",!0);N(C,G,X,"⊯","\\nVDash",!0);N(C,G,X,"⋫","\\ntriangleright");N(C,G,X,"⋭","\\ntrianglerighteq",!0);N(C,G,X,"","\\@nsupseteqq");N(C,G,X,"⊋","\\supsetneq",!0);N(C,G,X,"","\\@varsupsetneq");N(C,G,X,"⫌","\\supsetneqq",!0);N(C,G,X,"","\\@varsupsetneqq");N(C,G,X,"⊮","\\nVdash",!0);N(C,G,X,"⪵","\\precneqq",!0);N(C,G,X,"⪶","\\succneqq",!0);N(C,G,X,"","\\@nsubseteqq");N(C,G,Ve,"⊴","\\unlhd");N(C,G,Ve,"⊵","\\unrhd");N(C,G,X,"↚","\\nleftarrow",!0);N(C,G,X,"↛","\\nrightarrow",!0);N(C,G,X,"⇍","\\nLeftarrow",!0);N(C,G,X,"⇏","\\nRightarrow",!0);N(C,G,X,"↮","\\nleftrightarrow",!0);N(C,G,X,"⇎","\\nLeftrightarrow",!0);N(C,G,X,"△","\\vartriangle");N(C,G,le,"ℏ","\\hslash");N(C,G,le,"▽","\\triangledown");N(C,G,le,"◊","\\lozenge");N(C,G,le,"Ⓢ","\\circledS");N(C,G,le,"®","\\circledR");N(Ee,G,le,"®","\\circledR");N(C,G,le,"∡","\\measuredangle",!0);N(C,G,le,"∄","\\nexists");N(C,G,le,"℧","\\mho");N(C,G,le,"Ⅎ","\\Finv",!0);N(C,G,le,"⅁","\\Game",!0);N(C,G,le,"‵","\\backprime");N(C,G,le,"▲","\\blacktriangle");N(C,G,le,"▼","\\blacktriangledown");N(C,G,le,"■","\\blacksquare");N(C,G,le,"⧫","\\blacklozenge");N(C,G,le,"★","\\bigstar");N(C,G,le,"∢","\\sphericalangle",!0);N(C,G,le,"∁","\\complement",!0);N(C,G,le,"ð","\\eth",!0);N(Ee,B,le,"ð","ð");N(C,G,le,"╱","\\diagup");N(C,G,le,"╲","\\diagdown");N(C,G,le,"□","\\square");N(C,G,le,"□","\\Box");N(C,G,le,"◊","\\Diamond");N(C,G,le,"¥","\\yen",!0);N(Ee,G,le,"¥","\\yen",!0);N(C,G,le,"✓","\\checkmark",!0);N(Ee,G,le,"✓","\\checkmark");N(C,G,le,"ℶ","\\beth",!0);N(C,G,le,"ℸ","\\daleth",!0);N(C,G,le,"ℷ","\\gimel",!0);N(C,G,le,"ϝ","\\digamma",!0);N(C,G,le,"ϰ","\\varkappa");N(C,G,li,"┌","\\@ulcorner",!0);N(C,G,xs,"┐","\\@urcorner",!0);N(C,G,li,"└","\\@llcorner",!0);N(C,G,xs,"┘","\\@lrcorner",!0);N(C,G,X,"≦","\\leqq",!0);N(C,G,X,"⩽","\\leqslant",!0);N(C,G,X,"⪕","\\eqslantless",!0);N(C,G,X,"≲","\\lesssim",!0);N(C,G,X,"⪅","\\lessapprox",!0);N(C,G,X,"≊","\\approxeq",!0);N(C,G,Ve,"⋖","\\lessdot");N(C,G,X,"⋘","\\lll",!0);N(C,G,X,"≶","\\lessgtr",!0);N(C,G,X,"⋚","\\lesseqgtr",!0);N(C,G,X,"⪋","\\lesseqqgtr",!0);N(C,G,X,"≑","\\doteqdot");N(C,G,X,"≓","\\risingdotseq",!0);N(C,G,X,"≒","\\fallingdotseq",!0);N(C,G,X,"∽","\\backsim",!0);N(C,G,X,"⋍","\\backsimeq",!0);N(C,G,X,"⫅","\\subseteqq",!0);N(C,G,X,"⋐","\\Subset",!0);N(C,G,X,"⊏","\\sqsubset",!0);N(C,G,X,"≼","\\preccurlyeq",!0);N(C,G,X,"⋞","\\curlyeqprec",!0);N(C,G,X,"≾","\\precsim",!0);N(C,G,X,"⪷","\\precapprox",!0);N(C,G,X,"⊲","\\vartriangleleft");N(C,G,X,"⊴","\\trianglelefteq");N(C,G,X,"⊨","\\vDash",!0);N(C,G,X,"⊪","\\Vvdash",!0);N(C,G,X,"⌣","\\smallsmile");N(C,G,X,"⌢","\\smallfrown");N(C,G,X,"≏","\\bumpeq",!0);N(C,G,X,"≎","\\Bumpeq",!0);N(C,G,X,"≧","\\geqq",!0);N(C,G,X,"⩾","\\geqslant",!0);N(C,G,X,"⪖","\\eqslantgtr",!0);N(C,G,X,"≳","\\gtrsim",!0);N(C,G,X,"⪆","\\gtrapprox",!0);N(C,G,Ve,"⋗","\\gtrdot");N(C,G,X,"⋙","\\ggg",!0);N(C,G,X,"≷","\\gtrless",!0);N(C,G,X,"⋛","\\gtreqless",!0);N(C,G,X,"⪌","\\gtreqqless",!0);N(C,G,X,"≖","\\eqcirc",!0);N(C,G,X,"≗","\\circeq",!0);N(C,G,X,"≜","\\triangleq",!0);N(C,G,X,"∼","\\thicksim");N(C,G,X,"≈","\\thickapprox");N(C,G,X,"⫆","\\supseteqq",!0);N(C,G,X,"⋑","\\Supset",!0);N(C,G,X,"⊐","\\sqsupset",!0);N(C,G,X,"≽","\\succcurlyeq",!0);N(C,G,X,"⋟","\\curlyeqsucc",!0);N(C,G,X,"≿","\\succsim",!0);N(C,G,X,"⪸","\\succapprox",!0);N(C,G,X,"⊳","\\vartriangleright");N(C,G,X,"⊵","\\trianglerighteq");N(C,G,X,"⊩","\\Vdash",!0);N(C,G,X,"∣","\\shortmid");N(C,G,X,"∥","\\shortparallel");N(C,G,X,"≬","\\between",!0);N(C,G,X,"⋔","\\pitchfork",!0);N(C,G,X,"∝","\\varpropto");N(C,G,X,"◀","\\blacktriangleleft");N(C,G,X,"∴","\\therefore",!0);N(C,G,X,"∍","\\backepsilon");N(C,G,X,"▶","\\blacktriangleright");N(C,G,X,"∵","\\because",!0);N(C,G,X,"⋘","\\llless");N(C,G,X,"⋙","\\gggtr");N(C,G,Ve,"⊲","\\lhd");N(C,G,Ve,"⊳","\\rhd");N(C,G,X,"≂","\\eqsim",!0);N(C,B,X,"⋈","\\Join");N(C,G,X,"≑","\\Doteq",!0);N(C,G,Ve,"∔","\\dotplus",!0);N(C,G,Ve,"∖","\\smallsetminus");N(C,G,Ve,"⋒","\\Cap",!0);N(C,G,Ve,"⋓","\\Cup",!0);N(C,G,Ve,"⩞","\\doublebarwedge",!0);N(C,G,Ve,"⊟","\\boxminus",!0);N(C,G,Ve,"⊞","\\boxplus",!0);N(C,G,Ve,"⋇","\\divideontimes",!0);N(C,G,Ve,"⋉","\\ltimes",!0);N(C,G,Ve,"⋊","\\rtimes",!0);N(C,G,Ve,"⋋","\\leftthreetimes",!0);N(C,G,Ve,"⋌","\\rightthreetimes",!0);N(C,G,Ve,"⋏","\\curlywedge",!0);N(C,G,Ve,"⋎","\\curlyvee",!0);N(C,G,Ve,"⊝","\\circleddash",!0);N(C,G,Ve,"⊛","\\circledast",!0);N(C,G,Ve,"⋅","\\centerdot");N(C,G,Ve,"⊺","\\intercal",!0);N(C,G,Ve,"⋒","\\doublecap");N(C,G,Ve,"⋓","\\doublecup");N(C,G,Ve,"⊠","\\boxtimes",!0);N(C,G,X,"⇢","\\dashrightarrow",!0);N(C,G,X,"⇠","\\dashleftarrow",!0);N(C,G,X,"⇇","\\leftleftarrows",!0);N(C,G,X,"⇆","\\leftrightarrows",!0);N(C,G,X,"⇚","\\Lleftarrow",!0);N(C,G,X,"↞","\\twoheadleftarrow",!0);N(C,G,X,"↢","\\leftarrowtail",!0);N(C,G,X,"↫","\\looparrowleft",!0);N(C,G,X,"⇋","\\leftrightharpoons",!0);N(C,G,X,"↶","\\curvearrowleft",!0);N(C,G,X,"↺","\\circlearrowleft",!0);N(C,G,X,"↰","\\Lsh",!0);N(C,G,X,"⇈","\\upuparrows",!0);N(C,G,X,"↿","\\upharpoonleft",!0);N(C,G,X,"⇃","\\downharpoonleft",!0);N(C,B,X,"⊶","\\origof",!0);N(C,B,X,"⊷","\\imageof",!0);N(C,G,X,"⊸","\\multimap",!0);N(C,G,X,"↭","\\leftrightsquigarrow",!0);N(C,G,X,"⇉","\\rightrightarrows",!0);N(C,G,X,"⇄","\\rightleftarrows",!0);N(C,G,X,"↠","\\twoheadrightarrow",!0);N(C,G,X,"↣","\\rightarrowtail",!0);N(C,G,X,"↬","\\looparrowright",!0);N(C,G,X,"↷","\\curvearrowright",!0);N(C,G,X,"↻","\\circlearrowright",!0);N(C,G,X,"↱","\\Rsh",!0);N(C,G,X,"⇊","\\downdownarrows",!0);N(C,G,X,"↾","\\upharpoonright",!0);N(C,G,X,"⇂","\\downharpoonright",!0);N(C,G,X,"⇝","\\rightsquigarrow",!0);N(C,G,X,"⇝","\\leadsto");N(C,G,X,"⇛","\\Rrightarrow",!0);N(C,G,X,"↾","\\restriction");N(C,B,le,"‘","`");N(C,B,le,"$","\\$");N(Ee,B,le,"$","\\$");N(Ee,B,le,"$","\\textdollar");N(C,B,le,"%","\\%");N(Ee,B,le,"%","\\%");N(C,B,le,"_","\\_");N(Ee,B,le,"_","\\_");N(Ee,B,le,"_","\\textunderscore");N(C,B,le,"∠","\\angle",!0);N(C,B,le,"∞","\\infty",!0);N(C,B,le,"′","\\prime");N(C,B,le,"△","\\triangle");N(C,B,le,"Γ","\\Gamma",!0);N(C,B,le,"Δ","\\Delta",!0);N(C,B,le,"Θ","\\Theta",!0);N(C,B,le,"Λ","\\Lambda",!0);N(C,B,le,"Ξ","\\Xi",!0);N(C,B,le,"Π","\\Pi",!0);N(C,B,le,"Σ","\\Sigma",!0);N(C,B,le,"Υ","\\Upsilon",!0);N(C,B,le,"Φ","\\Phi",!0);N(C,B,le,"Ψ","\\Psi",!0);N(C,B,le,"Ω","\\Omega",!0);N(C,B,le,"A","Α");N(C,B,le,"B","Β");N(C,B,le,"E","Ε");N(C,B,le,"Z","Ζ");N(C,B,le,"H","Η");N(C,B,le,"I","Ι");N(C,B,le,"K","Κ");N(C,B,le,"M","Μ");N(C,B,le,"N","Ν");N(C,B,le,"O","Ο");N(C,B,le,"P","Ρ");N(C,B,le,"T","Τ");N(C,B,le,"X","Χ");N(C,B,le,"¬","\\neg",!0);N(C,B,le,"¬","\\lnot");N(C,B,le,"⊤","\\top");N(C,B,le,"⊥","\\bot");N(C,B,le,"∅","\\emptyset");N(C,G,le,"∅","\\varnothing");N(C,B,st,"α","\\alpha",!0);N(C,B,st,"β","\\beta",!0);N(C,B,st,"γ","\\gamma",!0);N(C,B,st,"δ","\\delta",!0);N(C,B,st,"ϵ","\\epsilon",!0);N(C,B,st,"ζ","\\zeta",!0);N(C,B,st,"η","\\eta",!0);N(C,B,st,"θ","\\theta",!0);N(C,B,st,"ι","\\iota",!0);N(C,B,st,"κ","\\kappa",!0);N(C,B,st,"λ","\\lambda",!0);N(C,B,st,"μ","\\mu",!0);N(C,B,st,"ν","\\nu",!0);N(C,B,st,"ξ","\\xi",!0);N(C,B,st,"ο","\\omicron",!0);N(C,B,st,"π","\\pi",!0);N(C,B,st,"ρ","\\rho",!0);N(C,B,st,"σ","\\sigma",!0);N(C,B,st,"τ","\\tau",!0);N(C,B,st,"υ","\\upsilon",!0);N(C,B,st,"ϕ","\\phi",!0);N(C,B,st,"χ","\\chi",!0);N(C,B,st,"ψ","\\psi",!0);N(C,B,st,"ω","\\omega",!0);N(C,B,st,"ε","\\varepsilon",!0);N(C,B,st,"ϑ","\\vartheta",!0);N(C,B,st,"ϖ","\\varpi",!0);N(C,B,st,"ϱ","\\varrho",!0);N(C,B,st,"ς","\\varsigma",!0);N(C,B,st,"φ","\\varphi",!0);N(C,B,Ve,"∗","*",!0);N(C,B,Ve,"+","+");N(C,B,Ve,"−","-",!0);N(C,B,Ve,"⋅","\\cdot",!0);N(C,B,Ve,"∘","\\circ",!0);N(C,B,Ve,"÷","\\div",!0);N(C,B,Ve,"±","\\pm",!0);N(C,B,Ve,"×","\\times",!0);N(C,B,Ve,"∩","\\cap",!0);N(C,B,Ve,"∪","\\cup",!0);N(C,B,Ve,"∖","\\setminus",!0);N(C,B,Ve,"∧","\\land");N(C,B,Ve,"∨","\\lor");N(C,B,Ve,"∧","\\wedge",!0);N(C,B,Ve,"∨","\\vee",!0);N(C,B,le,"√","\\surd");N(C,B,li,"⟨","\\langle",!0);N(C,B,li,"∣","\\lvert");N(C,B,li,"∥","\\lVert");N(C,B,xs,"?","?");N(C,B,xs,"!","!");N(C,B,xs,"⟩","\\rangle",!0);N(C,B,xs,"∣","\\rvert");N(C,B,xs,"∥","\\rVert");N(C,B,X,"=","=");N(C,B,X,":",":");N(C,B,X,"≈","\\approx",!0);N(C,B,X,"≅","\\cong",!0);N(C,B,X,"≥","\\ge");N(C,B,X,"≥","\\geq",!0);N(C,B,X,"←","\\gets");N(C,B,X,">","\\gt",!0);N(C,B,X,"∈","\\in",!0);N(C,B,X,"","\\@not");N(C,B,X,"⊂","\\subset",!0);N(C,B,X,"⊃","\\supset",!0);N(C,B,X,"⊆","\\subseteq",!0);N(C,B,X,"⊇","\\supseteq",!0);N(C,G,X,"⊈","\\nsubseteq",!0);N(C,G,X,"⊉","\\nsupseteq",!0);N(C,B,X,"⊨","\\models");N(C,B,X,"←","\\leftarrow",!0);N(C,B,X,"≤","\\le");N(C,B,X,"≤","\\leq",!0);N(C,B,X,"<","\\lt",!0);N(C,B,X,"→","\\rightarrow",!0);N(C,B,X,"→","\\to");N(C,G,X,"≱","\\ngeq",!0);N(C,G,X,"≰","\\nleq",!0);N(C,B,Sl," ","\\ ");N(C,B,Sl," ","\\space");N(C,B,Sl," ","\\nobreakspace");N(Ee,B,Sl," ","\\ ");N(Ee,B,Sl," "," ");N(Ee,B,Sl," ","\\space");N(Ee,B,Sl," ","\\nobreakspace");N(C,B,Sl,null,"\\nobreak");N(C,B,Sl,null,"\\allowbreak");N(C,B,$x,",",",");N(C,B,$x,";",";");N(C,G,Ve,"⊼","\\barwedge",!0);N(C,G,Ve,"⊻","\\veebar",!0);N(C,B,Ve,"⊙","\\odot",!0);N(C,B,Ve,"⊕","\\oplus",!0);N(C,B,Ve,"⊗","\\otimes",!0);N(C,B,le,"∂","\\partial",!0);N(C,B,Ve,"⊘","\\oslash",!0);N(C,G,Ve,"⊚","\\circledcirc",!0);N(C,G,Ve,"⊡","\\boxdot",!0);N(C,B,Ve,"△","\\bigtriangleup");N(C,B,Ve,"▽","\\bigtriangledown");N(C,B,Ve,"†","\\dagger");N(C,B,Ve,"⋄","\\diamond");N(C,B,Ve,"⋆","\\star");N(C,B,Ve,"◃","\\triangleleft");N(C,B,Ve,"▹","\\triangleright");N(C,B,li,"{","\\{");N(Ee,B,le,"{","\\{");N(Ee,B,le,"{","\\textbraceleft");N(C,B,xs,"}","\\}");N(Ee,B,le,"}","\\}");N(Ee,B,le,"}","\\textbraceright");N(C,B,li,"{","\\lbrace");N(C,B,xs,"}","\\rbrace");N(C,B,li,"[","\\lbrack",!0);N(Ee,B,le,"[","\\lbrack",!0);N(C,B,xs,"]","\\rbrack",!0);N(Ee,B,le,"]","\\rbrack",!0);N(C,B,li,"(","\\lparen",!0);N(C,B,xs,")","\\rparen",!0);N(Ee,B,le,"<","\\textless",!0);N(Ee,B,le,">","\\textgreater",!0);N(C,B,li,"⌊","\\lfloor",!0);N(C,B,xs,"⌋","\\rfloor",!0);N(C,B,li,"⌈","\\lceil",!0);N(C,B,xs,"⌉","\\rceil",!0);N(C,B,le,"\\","\\backslash");N(C,B,le,"∣","|");N(C,B,le,"∣","\\vert");N(Ee,B,le,"|","\\textbar",!0);N(C,B,le,"∥","\\|");N(C,B,le,"∥","\\Vert");N(Ee,B,le,"∥","\\textbardbl");N(Ee,B,le,"~","\\textasciitilde");N(Ee,B,le,"\\","\\textbackslash");N(Ee,B,le,"^","\\textasciicircum");N(C,B,X,"↑","\\uparrow",!0);N(C,B,X,"⇑","\\Uparrow",!0);N(C,B,X,"↓","\\downarrow",!0);N(C,B,X,"⇓","\\Downarrow",!0);N(C,B,X,"↕","\\updownarrow",!0);N(C,B,X,"⇕","\\Updownarrow",!0);N(C,B,yr,"∐","\\coprod");N(C,B,yr,"⋁","\\bigvee");N(C,B,yr,"⋀","\\bigwedge");N(C,B,yr,"⨄","\\biguplus");N(C,B,yr,"⋂","\\bigcap");N(C,B,yr,"⋃","\\bigcup");N(C,B,yr,"∫","\\int");N(C,B,yr,"∫","\\intop");N(C,B,yr,"∬","\\iint");N(C,B,yr,"∭","\\iiint");N(C,B,yr,"∏","\\prod");N(C,B,yr,"∑","\\sum");N(C,B,yr,"⨂","\\bigotimes");N(C,B,yr,"⨁","\\bigoplus");N(C,B,yr,"⨀","\\bigodot");N(C,B,yr,"∮","\\oint");N(C,B,yr,"∯","\\oiint");N(C,B,yr,"∰","\\oiiint");N(C,B,yr,"⨆","\\bigsqcup");N(C,B,yr,"∫","\\smallint");N(Ee,B,Rd,"…","\\textellipsis");N(C,B,Rd,"…","\\mathellipsis");N(Ee,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"…","\\ldots",!0);N(C,B,Rd,"⋯","\\@cdots",!0);N(C,B,Rd,"⋱","\\ddots",!0);N(C,B,le,"⋮","\\varvdots");N(Ee,B,le,"⋮","\\varvdots");N(C,B,Wn,"ˊ","\\acute");N(C,B,Wn,"ˋ","\\grave");N(C,B,Wn,"¨","\\ddot");N(C,B,Wn,"~","\\tilde");N(C,B,Wn,"ˉ","\\bar");N(C,B,Wn,"˘","\\breve");N(C,B,Wn,"ˇ","\\check");N(C,B,Wn,"^","\\hat");N(C,B,Wn,"⃗","\\vec");N(C,B,Wn,"˙","\\dot");N(C,B,Wn,"˚","\\mathring");N(C,B,st,"","\\@imath");N(C,B,st,"","\\@jmath");N(C,B,le,"ı","ı");N(C,B,le,"ȷ","ȷ");N(Ee,B,le,"ı","\\i",!0);N(Ee,B,le,"ȷ","\\j",!0);N(Ee,B,le,"ß","\\ss",!0);N(Ee,B,le,"æ","\\ae",!0);N(Ee,B,le,"œ","\\oe",!0);N(Ee,B,le,"ø","\\o",!0);N(Ee,B,le,"Æ","\\AE",!0);N(Ee,B,le,"Œ","\\OE",!0);N(Ee,B,le,"Ø","\\O",!0);N(Ee,B,Wn,"ˊ","\\'");N(Ee,B,Wn,"ˋ","\\`");N(Ee,B,Wn,"ˆ","\\^");N(Ee,B,Wn,"˜","\\~");N(Ee,B,Wn,"ˉ","\\=");N(Ee,B,Wn,"˘","\\u");N(Ee,B,Wn,"˙","\\.");N(Ee,B,Wn,"¸","\\c");N(Ee,B,Wn,"˚","\\r");N(Ee,B,Wn,"ˇ","\\v");N(Ee,B,Wn,"¨",'\\"');N(Ee,B,Wn,"˝","\\H");N(Ee,B,Wn,"◯","\\textcircled");var dR={"--":!0,"---":!0,"``":!0,"''":!0};N(Ee,B,le,"–","--",!0);N(Ee,B,le,"–","\\textendash");N(Ee,B,le,"—","---",!0);N(Ee,B,le,"—","\\textemdash");N(Ee,B,le,"‘","`",!0);N(Ee,B,le,"‘","\\textquoteleft");N(Ee,B,le,"’","'",!0);N(Ee,B,le,"’","\\textquoteright");N(Ee,B,le,"“","``",!0);N(Ee,B,le,"“","\\textquotedblleft");N(Ee,B,le,"”","''",!0);N(Ee,B,le,"”","\\textquotedblright");N(C,B,le,"°","\\degree",!0);N(Ee,B,le,"°","\\degree");N(Ee,B,le,"°","\\textdegree",!0);N(C,B,le,"£","\\pounds");N(C,B,le,"£","\\mathsterling",!0);N(Ee,B,le,"£","\\pounds");N(Ee,B,le,"£","\\textsterling",!0);N(C,G,le,"✠","\\maltese");N(Ee,G,le,"✠","\\maltese");var lN='0123456789/@."';for(var Mb=0;Mb0)return Li(i,h,s,n,l.concat(m));if(d){var p,x;if(d==="boldsymbol"){var v=ace(i,s,n,l,r);p=v.fontName,x=[v.fontClass]}else c?(p=mR[d].fontName,x=[d]):(p=_p(d,n.fontWeight,n.fontShape),x=[d,n.fontWeight,n.fontShape]);if(Hx(i,p,s).metrics)return Li(i,p,s,n,l.concat(x));if(dR.hasOwnProperty(i)&&p.slice(0,10)==="Typewriter"){for(var b=[],k=0;k{if(yo(t.classes)!==yo(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},cce=t=>{for(var e=0;en&&(n=l.height),l.depth>r&&(r=l.depth),l.maxFontSize>s&&(s=l.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Cs=function(e,n,r,s){var i=new S0(e,n,r,s);return E5(i),i},hR=(t,e,n,r)=>new S0(t,e,n,r),uce=function(e,n,r){var s=Cs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Le(s.height),s.maxFontSize=1,s},dce=function(e,n,r,s){var i=new M5(e,n,r,s);return E5(i),i},fR=function(e){var n=new w0(e);return E5(n),n},hce=function(e,n){return e instanceof w0?Cs([],[e],n):e},fce=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,l=1;l{var n=Cs(["mspace"],[],e),r=Kn(t,e);return n.style.marginRight=Le(r),n},_p=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},mR={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"}},pR={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},gce=function(e,n){var[r,s,i]=pR[e],l=new bo(r),c=new xl([l],{width:Le(s),height:Le(i),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),d=hR(["overlay"],[c],n);return d.height=i,d.style.height=Le(i),d.style.width=Le(s),d},ge={fontMap:mR,makeSymbol:Li,mathsym:ice,makeSpan:Cs,makeSvgSpan:hR,makeLineSpan:uce,makeAnchor:dce,makeFragment:fR,wrapFragment:hce,makeVList:mce,makeOrd:lce,makeGlue:pce,staticSvg:gce,svgData:pR,tryCombineChars:cce},Xn={number:3,unit:"mu"},tc={number:4,unit:"mu"},Ka={number:5,unit:"mu"},xce={mord:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mop:{mord:Xn,mop:Xn,mrel:Ka,minner:Xn},mbin:{mord:tc,mop:tc,mopen:tc,minner:tc},mrel:{mord:Ka,mop:Ka,mopen:Ka,minner:Ka},mopen:{},mclose:{mop:Xn,mbin:tc,mrel:Ka,minner:Xn},mpunct:{mord:Xn,mop:Xn,mrel:Ka,mopen:Xn,mclose:Xn,mpunct:Xn,minner:Xn},minner:{mord:Xn,mop:Xn,mbin:tc,mrel:Ka,mopen:Xn,mpunct:Xn,minner:Xn}},vce={mord:{mop:Xn},mop:{mord:Xn,mop:Xn},mbin:{},mrel:{},mopen:{},mclose:{mop:Xn},mpunct:{},minner:{mop:Xn}},gR={},Yg={},Kg={};function Qe(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={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},d=0;d{var O=k.classes[0],j=b.classes[0];O==="mbin"&&bce.includes(j)?k.classes[0]="mord":j==="mbin"&&yce.includes(O)&&(b.classes[0]="mord")},{node:p},x,v),hN(i,(b,k)=>{var O=N4(k),j=N4(b),T=O&&j?b.hasClass("mtight")?vce[O][j]:xce[O][j]:null;if(T)return ge.makeGlue(T,h)},{node:p},x,v),i},hN=function t(e,n,r,s,i){s&&e.push(s);for(var l=0;lx=>{e.splice(p+1,0,x),l++})(l)}s&&e.pop()},xR=function(e){return e instanceof w0||e instanceof M5||e instanceof S0&&e.hasClass("enclosing")?e:null},kce=function t(e,n){var r=xR(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},N4=function(e,n){return e?(n&&(e=kce(e,n)),Sce[e.classes[0]]||null):null},qf=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return vl(n.concat(r))},Kt=function(e,n,r){if(!e)return vl();if(Yg[e.type]){var s=Yg[e.type](e,n);if(r&&n.size!==r.size){s=vl(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new De("Got group of unknown type: '"+e.type+"'")};function Dp(t,e){var n=vl(["base"],t,e),r=vl(["strut"]);return r.style.height=Le(n.height+n.depth),n.depth&&(r.style.verticalAlign=Le(-n.depth)),n.children.unshift(r),n}function C4(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Ar(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],l=[],c=0;c0&&(i.push(Dp(l,e)),l=[]),i.push(r[c]));l.length>0&&i.push(Dp(l,e));var h;n?(h=Dp(Ar(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var m=vl(["katex-html"],i);if(m.setAttribute("aria-hidden","true"),h){var p=h.children[0];p.style.height=Le(m.height+m.depth),m.depth&&(p.style.verticalAlign=Le(-m.depth))}return m}function vR(t){return new w0(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=yo(this.classes));for(var r=0;r0&&(e+=' class ="'+tn.escape(yo(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class ga{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return tn.escape(this.toText())}toText(){return this.text}}class Oce{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",Le(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var _e={MathNode:ni,TextNode:ga,SpaceNode:Oce,newDocumentFragment:vR},Mi=function(e,n,r){return Ln[n][e]&&Ln[n][e].replace&&e.charCodeAt(0)!==55349&&!(dR.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Ln[n][e].replace),new _e.TextNode(e)},_5=function(e){return e.length===1?e[0]:new _e.MathNode("mrow",e)},D5=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;Ln[s][i]&&Ln[s][i].replace&&(i=Ln[s][i].replace);var l=ge.fontMap[r].fontName;return A5(i,l,s)?ge.fontMap[r].variant:null};function Rb(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof ga&&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 ga&&n.text===","}else return!1}var Fs=function(e,n,r){if(e.length===1){var s=zn(e[0],n);return r&&s instanceof ni&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],l,c=0;c=1&&(l.type==="mn"||Rb(l))){var h=d.children[0];h instanceof ni&&h.type==="mn"&&(h.children=[...l.children,...h.children],i.pop())}else if(l.type==="mi"&&l.children.length===1){var m=l.children[0];if(m instanceof ga&&m.text==="̸"&&(d.type==="mo"||d.type==="mi"||d.type==="mn")){var p=d.children[0];p instanceof ga&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),i.pop())}}}i.push(d),l=d}return i},wo=function(e,n,r){return _5(Fs(e,n,r))},zn=function(e,n){if(!e)return new _e.MathNode("mrow");if(Kg[e.type]){var r=Kg[e.type](e,n);return r}else throw new De("Got group of unknown type: '"+e.type+"'")};function fN(t,e,n,r,s){var i=Fs(t,n),l;i.length===1&&i[0]instanceof ni&&["mrow","mtable"].includes(i[0].type)?l=i[0]:l=new _e.MathNode("mrow",i);var c=new _e.MathNode("annotation",[new _e.TextNode(e)]);c.setAttribute("encoding","application/x-tex");var d=new _e.MathNode("semantics",[l,c]),h=new _e.MathNode("math",[d]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var m=s?"katex":"katex-mathml";return ge.makeSpan([m],[h])}var yR=function(e){return new sl({style:e.displayMode?at.DISPLAY:at.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},bR=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=ge.makeSpan(r,[e])}return e},jce=function(e,n,r){var s=yR(r),i;if(r.output==="mathml")return fN(e,n,s,r.displayMode,!0);if(r.output==="html"){var l=C4(e,s);i=ge.makeSpan(["katex"],[l])}else{var c=fN(e,n,s,r.displayMode,!1),d=C4(e,s);i=ge.makeSpan(["katex"],[c,d])}return bR(i,r)},Nce=function(e,n,r){var s=yR(r),i=C4(e,s),l=ge.makeSpan(["katex"],[i]);return bR(l,r)},Cce={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":"="},Tce=function(e){var n=new _e.MathNode("mo",[new _e.TextNode(Cce[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Ace={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]},Mce=function(e){return e.type==="ordgroup"?e.body.length:1},Ece=function(e,n){function r(){var c=4e5,d=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(d)){var h=e,m=Mce(h.base),p,x,v;if(m>5)d==="widehat"||d==="widecheck"?(p=420,c=2364,v=.42,x=d+"4"):(p=312,c=2340,v=.34,x="tilde4");else{var b=[1,1,2,2,3,3][m];d==="widehat"||d==="widecheck"?(c=[0,1062,2364,2364,2364][b],p=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],x=d+b):(c=[0,600,1033,2339,2340][b],p=[0,260,286,306,312][b],v=[0,.26,.286,.3,.306,.34][b],x="tilde"+b)}var k=new bo(x),O=new xl([k],{width:"100%",height:Le(v),viewBox:"0 0 "+c+" "+p,preserveAspectRatio:"none"});return{span:ge.makeSvgSpan([],[O],n),minWidth:0,height:v}}else{var j=[],T=Ace[d],[A,_,D]=T,E=D/1e3,z=A.length,Q,F;if(z===1){var L=T[3];Q=["hide-tail"],F=[L]}else if(z===2)Q=["halfarrow-left","halfarrow-right"],F=["xMinYMin","xMaxYMin"];else if(z===3)Q=["brace-left","brace-center","brace-right"],F=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+z+" children.");for(var U=0;U0&&(s.style.minWidth=Le(i)),s},_ce=function(e,n,r,s,i){var l,c=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(l=ge.makeSpan(["stretchy",n],[],i),n==="fbox"){var d=i.color&&i.getColor();d&&(l.style.borderColor=d)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new O4({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var m=new xl(h,{width:"100%",height:Le(c)});l=ge.makeSvgSpan([],[m],i)}return l.height=c,l.style.height=Le(c),l},yl={encloseSpan:_ce,mathMLnode:Tce,svgSpan:Ece};function Nt(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 R5(t){var e=Ux(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 Ux(t){return t&&(t.type==="atom"||rce.hasOwnProperty(t.type))?t:null}var z5=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=Nt(t.base,"accent"),n=r.base,t.base=n,s=tce(Kt(t,e)),t.base=r):(r=Nt(t,"accent"),n=r.base);var i=Kt(n,e.havingCrampedStyle()),l=r.isShifty&&tn.isCharacterBox(n),c=0;if(l){var d=tn.getBaseElem(n),h=Kt(d,e.havingCrampedStyle());c=aN(h).skew}var m=r.label==="\\c",p=m?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),x;if(r.isStretchy)x=yl.svgSpan(r,e),x=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:x,wrapperClasses:["svg-align"],wrapperStyle:c>0?{width:"calc(100% - "+Le(2*c)+")",marginLeft:Le(2*c)}:void 0}]},e);else{var v,b;r.label==="\\vec"?(v=ge.staticSvg("vec",e),b=ge.svgData.vec[1]):(v=ge.makeOrd({mode:r.mode,text:r.label},e,"textord"),v=aN(v),v.italic=0,b=v.width,m&&(p+=v.depth)),x=ge.makeSpan(["accent-body"],[v]);var k=r.label==="\\textcircled";k&&(x.classes.push("accent-full"),p=i.height);var O=c;k||(O-=b/2),x.style.left=Le(O),r.label==="\\textcircled"&&(x.style.top=".2em"),x=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-p},{type:"elem",elem:x}]},e)}var j=ge.makeSpan(["mord","accent"],[x],e);return s?(s.children[0]=j,s.height=Math.max(j.height,s.height),s.classes[0]="mord",s):j},wR=(t,e)=>{var n=t.isStretchy?yl.mathMLnode(t.label):new _e.MathNode("mo",[Mi(t.label,t.mode)]),r=new _e.MathNode("mover",[zn(t.base,e),n]);return r.setAttribute("accent","true"),r},Dce=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Qe({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=Zg(e[0]),r=!Dce.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:z5,mathmlBuilder:wR});Qe({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:z5,mathmlBuilder:wR});Qe({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=Kt(t.base,e),r=yl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=ge.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return ge.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=yl.mathMLnode(t.label),r=new _e.MathNode("munder",[zn(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var Rp=t=>{var e=new _e.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Qe({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=ge.wrapFragment(Kt(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var l;t.below&&(r=e.havingStyle(n.sub()),l=ge.wrapFragment(Kt(t.below,r,e),e),l.classes.push(i+"-arrow-pad"));var c=yl.svgSpan(t,e),d=-e.fontMetrics().axisHeight+.5*c.height,h=-e.fontMetrics().axisHeight-.5*c.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var m;if(l){var p=-e.fontMetrics().axisHeight+l.height+.5*c.height+.111;m=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d},{type:"elem",elem:l,shift:p}]},e)}else m=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:c,shift:d}]},e);return m.children[0].children[0].children[1].classes.push("svg-align"),ge.makeSpan(["mrel","x-arrow"],[m],e)},mathmlBuilder(t,e){var n=yl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=Rp(zn(t.body,e));if(t.below){var i=Rp(zn(t.below,e));r=new _e.MathNode("munderover",[n,i,s])}else r=new _e.MathNode("mover",[n,s])}else if(t.below){var l=Rp(zn(t.below,e));r=new _e.MathNode("munder",[n,l])}else r=Rp(),r=new _e.MathNode("mover",[n,r]);return r}});var Rce=ge.makeSpan;function SR(t,e){var n=Ar(t.body,e,!0);return Rce([t.mclass],n,e)}function kR(t,e){var n,r=Fs(t.body,e);return t.mclass==="minner"?n=new _e.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new _e.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new _e.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}Qe({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:ar(s),isCharacterBox:tn.isCharacterBox(s)}},htmlBuilder:SR,mathmlBuilder:kR});var Vx=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"};Qe({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Vx(e[0]),body:ar(e[1]),isCharacterBox:tn.isCharacterBox(e[1])}}});Qe({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],l;r!=="\\stackrel"?l=Vx(s):l="mrel";var c={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:ar(s)},d={type:"supsub",mode:i.mode,base:c,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:l,body:[d],isCharacterBox:tn.isCharacterBox(d)}},htmlBuilder:SR,mathmlBuilder:kR});Qe({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Vx(e[0]),body:ar(e[0])}},htmlBuilder(t,e){var n=Ar(t.body,e,!0),r=ge.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Fs(t.body,e),r=new _e.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var zce={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},mN=()=>({type:"styling",body:[],mode:"math",style:"display"}),pN=t=>t.type==="textord"&&t.text==="@",Pce=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Bce(t,e,n){var r=zce[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"},l=n.callFunction("\\Big",[i],[]),c=n.callFunction("\\\\cdright",[e[1]],[]),d={type:"ordgroup",mode:"math",body:[s,l,c]};return n.callFunction("\\\\cdparent",[d],[])}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 Lce(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 De("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var p=0;p<2;p++){for(var x=!0,v=d+1;vAV=|." after @',l[d]);var b=Bce(h,m,t),k={type:"styling",body:[b],mode:"math",style:"display"};r.push(k),c=mN()}i%2===0?r.push(c):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var O=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:O,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Qe({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=ge.wrapFragment(Kt(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Le(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new _e.MathNode("mrow",[zn(t.label,e)]);return n=new _e.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new _e.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Qe({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=ge.wrapFragment(Kt(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new _e.MathNode("mrow",[zn(t.fragment,e)])}});Qe({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Nt(e[0],"ordgroup"),s=r.body,i="",l=0;l=1114111)throw new De("\\@char with invalid code point "+i);return d<=65535?h=String.fromCharCode(d):(d-=65536,h=String.fromCharCode((d>>10)+55296,(d&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var OR=(t,e)=>{var n=Ar(t.body,e.withColor(t.color),!1);return ge.makeFragment(n)},jR=(t,e)=>{var n=Fs(t.body,e.withColor(t.color)),r=new _e.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Qe({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Nt(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:ar(s)}},htmlBuilder:OR,mathmlBuilder:jR});Qe({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=Nt(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:OR,mathmlBuilder:jR});Qe({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&&Nt(s,"size").value}},htmlBuilder(t,e){var n=ge.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Le(Kn(t.size,e)))),n},mathmlBuilder(t,e){var n=new _e.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Le(Kn(t.size,e)))),n}});var T4={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},NR=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new De("Expected a control sequence",t);return e},Ice=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},CR=(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)};Qe({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(T4[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=T4[r.text]),Nt(e.parseFunction(),"internal");throw new De("Invalid token after macro prefix",r)}});Qe({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 De("Expected a control sequence",r);for(var i=0,l,c=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){l=e.gullet.future(),c[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new De('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new De('Argument number "'+r.text+'" out of order');i++,c.push([])}else{if(r.text==="EOF")throw new De("Expected a macro definition");c[i].push(r.text)}var{tokens:d}=e.gullet.consumeArg();return l&&d.unshift(l),(n==="\\edef"||n==="\\xdef")&&(d=e.gullet.expandTokens(d),d.reverse()),e.gullet.macros.set(s,{tokens:d,numArgs:i,delimiters:c},n===T4[n]),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken());e.gullet.consumeSpaces();var s=Ice(e);return CR(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Qe({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=NR(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return CR(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var Vh=function(e,n,r){var s=Ln.math[e]&&Ln.math[e].replace,i=A5(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},P5=function(e,n,r,s){var i=r.havingBaseStyle(n),l=ge.makeSpan(s.concat(i.sizingClasses(r)),[e],r),c=i.sizeMultiplier/r.sizeMultiplier;return l.height*=c,l.depth*=c,l.maxFontSize=i.sizeMultiplier,l},TR=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=Le(i),e.height-=i,e.depth+=i},qce=function(e,n,r,s,i,l){var c=ge.makeSymbol(e,"Main-Regular",i,s),d=P5(c,n,s,l);return r&&TR(d,s,n),d},Fce=function(e,n,r,s){return ge.makeSymbol(e,"Size"+n+"-Regular",r,s)},AR=function(e,n,r,s,i,l){var c=Fce(e,n,i,s),d=P5(ge.makeSpan(["delimsizing","size"+n],[c],s),at.TEXT,s,l);return r&&TR(d,s,at.TEXT),d},zb=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=ge.makeSpan(["delimsizinginner",s],[ge.makeSpan([],[ge.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},Pb=function(e,n,r){var s=pa["Size4-Regular"][e.charCodeAt(0)]?pa["Size4-Regular"][e.charCodeAt(0)][4]:pa["Size1-Regular"][e.charCodeAt(0)][4],i=new bo("inner",Voe(e,Math.round(1e3*n))),l=new xl([i],{width:Le(s),height:Le(n),style:"width:"+Le(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),c=ge.makeSvgSpan([],[l],r);return c.height=n,c.style.height=Le(n),c.style.width=Le(s),{type:"elem",elem:c}},A4=.008,zp={type:"kern",size:-1*A4},Qce=["|","\\lvert","\\rvert","\\vert"],$ce=["\\|","\\lVert","\\rVert","\\Vert"],MR=function(e,n,r,s,i,l){var c,d,h,m,p="",x=0;c=h=m=e,d=null;var v="Size1-Regular";e==="\\uparrow"?h=m="⏐":e==="\\Uparrow"?h=m="‖":e==="\\downarrow"?c=h="⏐":e==="\\Downarrow"?c=h="‖":e==="\\updownarrow"?(c="\\uparrow",h="⏐",m="\\downarrow"):e==="\\Updownarrow"?(c="\\Uparrow",h="‖",m="\\Downarrow"):Qce.includes(e)?(h="∣",p="vert",x=333):$ce.includes(e)?(h="∥",p="doublevert",x=556):e==="["||e==="\\lbrack"?(c="⎡",h="⎢",m="⎣",v="Size4-Regular",p="lbrack",x=667):e==="]"||e==="\\rbrack"?(c="⎤",h="⎥",m="⎦",v="Size4-Regular",p="rbrack",x=667):e==="\\lfloor"||e==="⌊"?(h=c="⎢",m="⎣",v="Size4-Regular",p="lfloor",x=667):e==="\\lceil"||e==="⌈"?(c="⎡",h=m="⎢",v="Size4-Regular",p="lceil",x=667):e==="\\rfloor"||e==="⌋"?(h=c="⎥",m="⎦",v="Size4-Regular",p="rfloor",x=667):e==="\\rceil"||e==="⌉"?(c="⎤",h=m="⎥",v="Size4-Regular",p="rceil",x=667):e==="("||e==="\\lparen"?(c="⎛",h="⎜",m="⎝",v="Size4-Regular",p="lparen",x=875):e===")"||e==="\\rparen"?(c="⎞",h="⎟",m="⎠",v="Size4-Regular",p="rparen",x=875):e==="\\{"||e==="\\lbrace"?(c="⎧",d="⎨",m="⎩",h="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(c="⎫",d="⎬",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(c="⎧",m="⎩",h="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(c="⎫",m="⎭",h="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(c="⎧",m="⎭",h="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(c="⎫",m="⎩",h="⎪",v="Size4-Regular");var b=Vh(c,v,i),k=b.height+b.depth,O=Vh(h,v,i),j=O.height+O.depth,T=Vh(m,v,i),A=T.height+T.depth,_=0,D=1;if(d!==null){var E=Vh(d,v,i);_=E.height+E.depth,D=2}var z=k+A+_,Q=Math.max(0,Math.ceil((n-z)/(D*j))),F=z+Q*D*j,L=s.fontMetrics().axisHeight;r&&(L*=s.sizeMultiplier);var U=F/2-L,V=[];if(p.length>0){var ce=F-k-A,W=Math.round(F*1e3),J=Woe(p,Math.round(ce*1e3)),$=new bo(p,J),ae=(x/1e3).toFixed(3)+"em",ne=(W/1e3).toFixed(3)+"em",ue=new xl([$],{width:ae,height:ne,viewBox:"0 0 "+x+" "+W}),R=ge.makeSvgSpan([],[ue],s);R.height=W/1e3,R.style.width=ae,R.style.height=ne,V.push({type:"elem",elem:R})}else{if(V.push(zb(m,v,i)),V.push(zp),d===null){var me=F-k-A+2*A4;V.push(Pb(h,me,s))}else{var Y=(F-k-A-_)/2+2*A4;V.push(Pb(h,Y,s)),V.push(zp),V.push(zb(d,v,i)),V.push(zp),V.push(Pb(h,Y,s))}V.push(zp),V.push(zb(c,v,i))}var P=s.havingBaseStyle(at.TEXT),K=ge.makeVList({positionType:"bottom",positionData:U,children:V},P);return P5(ge.makeSpan(["delimsizing","mult"],[K],P),at.TEXT,s,l)},Bb=80,Lb=.08,Ib=function(e,n,r,s,i){var l=Uoe(e,s,r),c=new bo(e,l),d=new xl([c],{width:"400em",height:Le(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return ge.makeSvgSpan(["hide-tail"],[d],i)},Hce=function(e,n){var r=n.havingBaseSizing(),s=RR("\\surd",e*r.sizeMultiplier,DR,r),i=r.sizeMultiplier,l=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),c,d=0,h=0,m=0,p;return s.type==="small"?(m=1e3+1e3*l+Bb,e<1?i=1:e<1.4&&(i=.7),d=(1+l+Lb)/i,h=(1+l)/i,c=Ib("sqrtMain",d,m,l,n),c.style.minWidth="0.853em",p=.833/i):s.type==="large"?(m=(1e3+Bb)*cf[s.size],h=(cf[s.size]+l)/i,d=(cf[s.size]+l+Lb)/i,c=Ib("sqrtSize"+s.size,d,m,l,n),c.style.minWidth="1.02em",p=1/i):(d=e+l+Lb,h=e+l,m=Math.floor(1e3*e+l)+Bb,c=Ib("sqrtTall",d,m,l,n),c.style.minWidth="0.742em",p=1.056),c.height=h,c.style.height=Le(d),{span:c,advanceWidth:p,ruleWidth:(n.fontMetrics().sqrtRuleThickness+l)*i}},ER=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Uce=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],_R=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],cf=[0,1.2,1.8,2.4,3],Vce=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),ER.includes(e)||_R.includes(e))return AR(e,n,!1,r,s,i);if(Uce.includes(e))return MR(e,cf[n],!1,r,s,i);throw new De("Illegal delimiter: '"+e+"'")},Wce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Gce=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"stack"}],DR=[{type:"small",style:at.SCRIPTSCRIPT},{type:"small",style:at.SCRIPT},{type:"small",style:at.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Xce=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.")},RR=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),l=i;ln)return r[l]}return r[r.length-1]},zR=function(e,n,r,s,i,l){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var c;_R.includes(e)?c=Wce:ER.includes(e)?c=DR:c=Gce;var d=RR(e,n,c,s);return d.type==="small"?qce(e,d.style,r,s,i,l):d.type==="large"?AR(e,d.size,r,s,i,l):MR(e,n,r,s,i,l)},Yce=function(e,n,r,s,i,l){var c=s.fontMetrics().axisHeight*s.sizeMultiplier,d=901,h=5/s.fontMetrics().ptPerEm,m=Math.max(n-c,r+c),p=Math.max(m/500*d,2*m-h);return zR(e,p,!0,s,i,l)},dl={sqrtImage:Hce,sizedDelim:Vce,sizeToMaxHeight:cf,customSizedDelim:zR,leftRightDelim:Yce},gN={"\\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}},Kce=["(","\\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 Wx(t,e){var n=Ux(t);if(n&&Kce.includes(n.text))return n;throw n?new De("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new De("Invalid delimiter type '"+t.type+"'",t)}Qe({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=Wx(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:gN[t.funcName].size,mclass:gN[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?ge.makeSpan([t.mclass]):dl.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Mi(t.delim,t.mode));var n=new _e.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Le(dl.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function xN(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Qe({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 De("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Wx(e[0],t).text,color:n}}});Qe({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Nt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{xN(t);for(var n=Ar(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,l=0;l{xN(t);var n=Fs(t.body,e);if(t.left!=="."){var r=new _e.MathNode("mo",[Mi(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new _e.MathNode("mo",[Mi(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return _5(n)}});Qe({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Wx(e[0],t);if(!t.parser.leftrightDepth)throw new De("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=qf(e,[]);else{n=dl.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==="|"?Mi("|","text"):Mi(t.delim,t.mode),r=new _e.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var B5=(t,e)=>{var n=ge.wrapFragment(Kt(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,l=0,c=tn.isCharacterBox(t.body);if(r==="sout")i=ge.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,l=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var d=Kn({number:.6,unit:"pt"},e),h=Kn({number:.35,unit:"ex"},e),m=e.havingBaseSizing();s=s/m.sizeMultiplier;var p=n.height+n.depth+d+h;n.style.paddingLeft=Le(p/2+d);var x=Math.floor(1e3*p*s),v=$oe(x),b=new xl([new bo("phase",v)],{width:"400em",height:Le(x/1e3),viewBox:"0 0 400000 "+x,preserveAspectRatio:"xMinYMin slice"});i=ge.makeSvgSpan(["hide-tail"],[b],e),i.style.height=Le(p),l=n.depth+d+h}else{/cancel/.test(r)?c||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var k=0,O=0,j=0;/box/.test(r)?(j=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),k=e.fontMetrics().fboxsep+(r==="colorbox"?0:j),O=k):r==="angl"?(j=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),k=4*j,O=Math.max(0,.25-n.depth)):(k=c?.2:0,O=k),i=yl.encloseSpan(n,r,k,O,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Le(j)):r==="angl"&&j!==.049&&(i.style.borderTopWidth=Le(j),i.style.borderRightWidth=Le(j)),l=n.depth+O,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var T;if(t.backgroundColor)T=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:l},{type:"elem",elem:n,shift:0}]},e);else{var A=/cancel|phase/.test(r)?["svg-align"]:[];T=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:l,wrapperClasses:A}]},e)}return/cancel/.test(r)&&(T.height=n.height,T.depth=n.depth),/cancel/.test(r)&&!c?ge.makeSpan(["mord","cancel-lap"],[T],e):ge.makeSpan(["mord"],[T],e)},L5=(t,e)=>{var n=0,r=new _e.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[zn(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};Qe({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:l}},htmlBuilder:B5,mathmlBuilder:L5});Qe({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Nt(e[0],"color-token").color,l=Nt(e[1],"color-token").color,c=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:l,borderColor:i,body:c}},htmlBuilder:B5,mathmlBuilder:L5});Qe({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]}}});Qe({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:B5,mathmlBuilder:L5});Qe({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 PR={};function Ca(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:l}=t,c={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},d=0;d{var e=t.parser.settings;if(!e.displayMode)throw new De("{"+t.envName+"} can be used only in display mode.")};function I5(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function Mo(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:l,colSeparationType:c,autoTag:d,singleRow:h,emptySingleRow:m,maxNumCols:p,leqno:x}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!l){var v=t.gullet.expandMacroAsText("\\arraystretch");if(v==null)l=1;else if(l=parseFloat(v),!l||l<0)throw new De("Invalid \\arraystretch: "+v)}t.gullet.beginGroup();var b=[],k=[b],O=[],j=[],T=d!=null?[]:void 0;function A(){d&&t.gullet.macros.set("\\@eqnsw","1",!0)}function _(){T&&(t.gullet.macros.get("\\df@tag")?(T.push(t.subparse([new ii("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!d&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),j.push(vN(t));;){var D=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),D={type:"ordgroup",mode:t.mode,body:D},n&&(D={type:"styling",mode:t.mode,style:n,body:[D]}),b.push(D);var E=t.fetch().text;if(E==="&"){if(p&&b.length===p){if(h||c)throw new De("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"){_(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(k.length>1||!m)&&k.pop(),j.length0&&(A+=.25),h.push({pos:A,isDashed:Jn[nn]})}for(_(l[0]),r=0;r0&&(U+=T,zJn))for(r=0;r=c)){var ve=void 0;(s>0||e.hskipBeforeAndAfter)&&(ve=tn.deflt(Y.pregap,x),ve!==0&&(J=ge.makeSpan(["arraycolsep"],[]),J.style.width=Le(ve),W.push(J)));var Re=[];for(r=0;r0){for(var Oe=ge.makeLineSpan("hline",n,m),nt=ge.makeLineSpan("hdashline",n,m),ut=[{type:"elem",elem:d,shift:0}];h.length>0;){var Ct=h.pop(),In=Ct.pos-V;Ct.isDashed?ut.push({type:"elem",elem:nt,shift:In}):ut.push({type:"elem",elem:Oe,shift:In})}d=ge.makeVList({positionType:"individualShift",children:ut},n)}if(ae.length===0)return ge.makeSpan(["mord"],[d],n);var Tn=ge.makeVList({positionType:"individualShift",children:ae},n);return Tn=ge.makeSpan(["tag"],[Tn],n),ge.makeFragment([d,Tn])},Zce={c:"center ",l:"left ",r:"right "},Aa=function(e,n){for(var r=[],s=new _e.MathNode("mtd",[],["mtr-glue"]),i=new _e.MathNode("mtd",[],["mml-eqn-num"]),l=0;l0){var b=e.cols,k="",O=!1,j=0,T=b.length;b[0].type==="separator"&&(x+="top ",j=1),b[b.length-1].type==="separator"&&(x+="bottom ",T-=1);for(var A=j;A0?"left ":"",x+=Q[Q.length-1].length>0?"right ":"";for(var F=1;F-1?"alignat":"align",i=e.envName==="split",l=Mo(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:I5(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),c,d=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var m="",p=0;p0&&v&&(O=1),r[b]={type:"align",align:k,pregap:O,postgap:0}}return l.colSeparationType=v?"align":"alignat",l};Ca({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lcr".indexOf(d)!==-1)return{type:"align",align:d};if(d==="|")return{type:"separator",separator:"|"};if(d===":")return{type:"separator",separator:":"};throw new De("Unknown column alignment: "+d,l)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Mo(t.parser,i,q5(t.envName))},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({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 De("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Mo(t.parser,r,q5(t.envName)),l=Math.max(0,...i.body.map(c=>c.length));return i.cols=new Array(l).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Mo(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Ux(e[0]),r=n?[e[0]]:Nt(e[0],"ordgroup").body,s=r.map(function(l){var c=R5(l),d=c.text;if("lc".indexOf(d)!==-1)return{type:"align",align:d};throw new De("Unknown column alignment: "+d,l)});if(s.length>1)throw new De("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Mo(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new De("{subarray} can contain only one column");return i},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({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=Mo(t.parser,e,q5(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:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Gx(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:I5(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:LR,htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Gx(t);var e={autoTag:I5(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Mo(t.parser,e,"display")},htmlBuilder:Ta,mathmlBuilder:Aa});Ca({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Gx(t),Lce(t.parser)},htmlBuilder:Ta,mathmlBuilder:Aa});q("\\nonumber","\\gdef\\@eqnsw{0}");q("\\notag","\\nonumber");Qe({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new De(t.funcName+" valid only within array environment")}});var yN=PR;Qe({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 De("Invalid environment name",s);for(var i="",l=0;l{var n=t.font,r=e.withFont(n);return Kt(t.body,r)},qR=(t,e)=>{var n=t.font,r=e.withFont(n);return zn(t.body,r)},bN={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Qe({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=Zg(e[0]),i=r;return i in bN&&(i=bN[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:IR,mathmlBuilder:qR});Qe({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=tn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Vx(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Qe({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,l=n.parseExpression(!0,s),c="math"+r.slice(1);return{type:"font",mode:i,font:c,body:{type:"ordgroup",mode:n.mode,body:l}}},htmlBuilder:IR,mathmlBuilder:qR});var FR=(t,e)=>{var n=e;return t==="display"?n=n.id>=at.SCRIPT.id?n.text():at.DISPLAY:t==="text"&&n.size===at.DISPLAY.size?n=at.TEXT:t==="script"?n=at.SCRIPT:t==="scriptscript"&&(n=at.SCRIPTSCRIPT),n},F5=(t,e)=>{var n=FR(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var l=Kt(t.numer,i,e);if(t.continued){var c=8.5/e.fontMetrics().ptPerEm,d=3.5/e.fontMetrics().ptPerEm;l.height=l.height0?b=3*x:b=7*x,k=e.fontMetrics().denom1):(p>0?(v=e.fontMetrics().num2,b=x):(v=e.fontMetrics().num3,b=3*x),k=e.fontMetrics().denom2);var O;if(m){var T=e.fontMetrics().axisHeight;v-l.depth-(T+.5*p){var n=new _e.MathNode("mfrac",[zn(t.numer,e),zn(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Kn(t.barSize,e);n.setAttribute("linethickness",Le(r))}var s=FR(t.size,e.style);if(s.size!==e.style.size){n=new _e.MathNode("mstyle",[n]);var i=s.size===at.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var l=[];if(t.leftDelim!=null){var c=new _e.MathNode("mo",[new _e.TextNode(t.leftDelim.replace("\\",""))]);c.setAttribute("fence","true"),l.push(c)}if(l.push(n),t.rightDelim!=null){var d=new _e.MathNode("mo",[new _e.TextNode(t.rightDelim.replace("\\",""))]);d.setAttribute("fence","true"),l.push(d)}return _5(l)}return n};Qe({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],l,c=null,d=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":l=!0;break;case"\\\\atopfrac":l=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l=!1,c="(",d=")";break;case"\\\\bracefrac":l=!1,c="\\{",d="\\}";break;case"\\\\brackfrac":l=!1,c="[",d="]";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:l,leftDelim:c,rightDelim:d,size:h,barSize:null}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({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}}});Qe({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 wN=["display","text","script","scriptscript"],SN=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Qe({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=Zg(e[0]),l=i.type==="atom"&&i.family==="open"?SN(i.text):null,c=Zg(e[1]),d=c.type==="atom"&&c.family==="close"?SN(c.text):null,h=Nt(e[2],"size"),m,p=null;h.isBlank?m=!0:(p=h.value,m=p.number>0);var x="auto",v=e[3];if(v.type==="ordgroup"){if(v.body.length>0){var b=Nt(v.body[0],"textord");x=wN[Number(b.text)]}}else v=Nt(v,"textord"),x=wN[Number(v.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:m,barSize:p,leftDelim:l,rightDelim:d,size:x}},htmlBuilder:F5,mathmlBuilder:Q5});Qe({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:Nt(e[0],"size").value,token:s}}});Qe({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Toe(Nt(e[1],"infix").size),l=e[2],c=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:l,continued:!1,hasBarLine:c,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:F5,mathmlBuilder:Q5});var QR=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Kt(t.sup,e.havingStyle(n.sup()),e):Kt(t.sub,e.havingStyle(n.sub()),e),s=Nt(t.base,"horizBrace")):s=Nt(t,"horizBrace");var i=Kt(s.base,e.havingBaseStyle(at.DISPLAY)),l=yl.svgSpan(s,e),c;if(s.isOver?(c=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:l}]},e),c.children[0].children[0].children[1].classes.push("svg-align")):(c=ge.makeVList({positionType:"bottom",positionData:i.depth+.1+l.height,children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:i}]},e),c.children[0].children[0].children[0].classes.push("svg-align")),r){var d=ge.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e);s.isOver?c=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:d},{type:"kern",size:.2},{type:"elem",elem:r}]},e):c=ge.makeVList({positionType:"bottom",positionData:d.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:d}]},e)}return ge.makeSpan(["mord",s.isOver?"mover":"munder"],[c],e)},Jce=(t,e)=>{var n=yl.mathMLnode(t.label);return new _e.MathNode(t.isOver?"mover":"munder",[zn(t.base,e),n])};Qe({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:QR,mathmlBuilder:Jce});Qe({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=Nt(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:ar(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Ar(t.body,e,!1);return ge.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=wo(t.body,e);return n instanceof ni||(n=new ni("mrow",[n])),n.setAttribute("href",t.href),n}});Qe({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Nt(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=Nt(e[0],"raw").string,l=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var c,d={};switch(r){case"\\htmlClass":d.class=i,c={command:"\\htmlClass",class:i};break;case"\\htmlId":d.id=i,c={command:"\\htmlId",id:i};break;case"\\htmlStyle":d.style=i,c={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),m=0;m{var n=Ar(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=ge.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)=>wo(t.body,e)});Qe({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:ar(e[0]),mathml:ar(e[1])}},htmlBuilder:(t,e)=>{var n=Ar(t.html,e,!1);return ge.makeFragment(n)},mathmlBuilder:(t,e)=>wo(t.mathml,e)});var qb=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 De("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!lR(r))throw new De("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Qe({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"},l={number:0,unit:"em"},c="";if(n[0])for(var d=Nt(n[0],"raw").string,h=d.split(","),m=0;m{var n=Kn(t.height,e),r=0;t.totalheight.number>0&&(r=Kn(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=Kn(t.width,e));var i={height:Le(n+r)};s>0&&(i.width=Le(s)),r>0&&(i.verticalAlign=Le(-r));var l=new Joe(t.src,t.alt,i);return l.height=n,l.depth=r,l},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Kn(t.height,e),s=0;if(t.totalheight.number>0&&(s=Kn(t.totalheight,e)-r,n.setAttribute("valign",Le(-s))),n.setAttribute("height",Le(r+s)),t.width.number>0){var i=Kn(t.width,e);n.setAttribute("width",Le(i))}return n.setAttribute("src",t.src),n}});Qe({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=Nt(e[0],"size");if(n.settings.strict){var i=r[1]==="m",l=s.value.unit==="mu";i?(l||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")):l&&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 ge.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=Kn(t.dimension,e);return new _e.SpaceNode(n)}});Qe({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=ge.makeSpan([],[Kt(t.body,e)]),n=ge.makeSpan(["inner"],[n],e)):n=ge.makeSpan(["inner"],[Kt(t.body,e)]);var r=ge.makeSpan(["fix"],[]),s=ge.makeSpan([t.alignment],[n,r],e),i=ge.makeSpan(["strut"]);return i.style.height=Le(s.height+s.depth),s.depth&&(i.style.verticalAlign=Le(-s.depth)),s.children.unshift(i),s=ge.makeSpan(["thinbox"],[s],e),ge.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new _e.MathNode("mpadded",[zn(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}});Qe({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==="\\("?"\\)":"$",l=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:l}}});Qe({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new De("Mismatched "+t.funcName)}});var kN=(t,e)=>{switch(e.style.size){case at.DISPLAY.size:return t.display;case at.TEXT.size:return t.text;case at.SCRIPT.size:return t.script;case at.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Qe({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:ar(e[0]),text:ar(e[1]),script:ar(e[2]),scriptscript:ar(e[3])}},htmlBuilder:(t,e)=>{var n=kN(t,e),r=Ar(n,e,!1);return ge.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=kN(t,e);return wo(n,e)}});var $R=(t,e,n,r,s,i,l)=>{t=ge.makeSpan([],[t]);var c=n&&tn.isCharacterBox(n),d,h;if(e){var m=Kt(e,r.havingStyle(s.sup()),r);h={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-m.depth)}}if(n){var p=Kt(n,r.havingStyle(s.sub()),r);d={elem:p,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-p.height)}}var x;if(h&&d){var v=r.fontMetrics().bigOpSpacing5+d.elem.height+d.elem.depth+d.kern+t.depth+l;x=ge.makeVList({positionType:"bottom",positionData:v,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(d){var b=t.height-l;x=ge.makeVList({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:d.elem,marginLeft:Le(-i)},{type:"kern",size:d.kern},{type:"elem",elem:t}]},r)}else if(h){var k=t.depth+l;x=ge.makeVList({positionType:"bottom",positionData:k,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Le(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var O=[x];if(d&&i!==0&&!c){var j=ge.makeSpan(["mspace"],[],r);j.style.marginRight=Le(i),O.unshift(j)}return ge.makeSpan(["mop","op-limits"],O,r)},HR=["\\smallint"],zd=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"op"),s=!0):i=Nt(t,"op");var l=e.style,c=!1;l.size===at.DISPLAY.size&&i.symbol&&!HR.includes(i.name)&&(c=!0);var d;if(i.symbol){var h=c?"Size2-Regular":"Size1-Regular",m="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(m=i.name.slice(1),i.name=m==="oiint"?"\\iint":"\\iiint"),d=ge.makeSymbol(i.name,h,"math",e,["mop","op-symbol",c?"large-op":"small-op"]),m.length>0){var p=d.italic,x=ge.staticSvg(m+"Size"+(c?"2":"1"),e);d=ge.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:0},{type:"elem",elem:x,shift:c?.08:0}]},e),i.name="\\"+m,d.classes.unshift("mop"),d.italic=p}}else if(i.body){var v=Ar(i.body,e,!0);v.length===1&&v[0]instanceof Ai?(d=v[0],d.classes[0]="mop"):d=ge.makeSpan(["mop"],v,e)}else{for(var b=[],k=1;k{var n;if(t.symbol)n=new ni("mo",[Mi(t.name,t.mode)]),HR.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new ni("mo",Fs(t.body,e));else{n=new ni("mi",[new ga(t.name.slice(1))]);var r=new ni("mo",[Mi("⁡","text")]);t.parentIsSupSub?n=new ni("mrow",[n,r]):n=vR([n,r])}return n},eue={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Qe({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=eue[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:zd,mathmlBuilder:k0});Qe({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:ar(r)}},htmlBuilder:zd,mathmlBuilder:k0});var tue={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Qe({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:zd,mathmlBuilder:k0});Qe({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:zd,mathmlBuilder:k0});Qe({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=tue[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:zd,mathmlBuilder:k0});var UR=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Nt(t.base,"operatorname"),s=!0):i=Nt(t,"operatorname");var l;if(i.body.length>0){for(var c=i.body.map(p=>{var x=p.text;return typeof x=="string"?{type:"textord",mode:p.mode,text:x}:p}),d=Ar(c,e.withFont("mathrm"),!0),h=0;h{for(var n=Fs(t.body,e.withFont("mathrm")),r=!0,s=0;sm.toText()).join("");n=[new _e.TextNode(c)]}var d=new _e.MathNode("mi",n);d.setAttribute("mathvariant","normal");var h=new _e.MathNode("mo",[Mi("⁡","text")]);return t.parentIsSupSub?new _e.MathNode("mrow",[d,h]):_e.newDocumentFragment([d,h])};Qe({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:ar(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:UR,mathmlBuilder:nue});q("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Rc({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?ge.makeFragment(Ar(t.body,e,!1)):ge.makeSpan(["mord"],Ar(t.body,e,!0),e)},mathmlBuilder(t,e){return wo(t.body,e,!0)}});Qe({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=Kt(t.body,e.havingCrampedStyle()),r=ge.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return ge.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("mover",[zn(t.body,e),n]);return r.setAttribute("accent","true"),r}});Qe({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:ar(r)}},htmlBuilder:(t,e)=>{var n=Ar(t.body,e.withPhantom(),!1);return ge.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=Fs(t.body,e);return new _e.MathNode("mphantom",n)}});Qe({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=ge.makeSpan([],[Kt(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Qe({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=ge.makeSpan(["inner"],[Kt(t.body,e.withPhantom())]),r=ge.makeSpan(["fix"],[]);return ge.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Fs(ar(t.body),e),r=new _e.MathNode("mphantom",n),s=new _e.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Qe({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Nt(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Kt(t.body,e),r=Kn(t.dy,e);return ge.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new _e.MathNode("mpadded",[zn(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Qe({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Qe({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=Nt(e[0],"size"),l=Nt(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Nt(s,"size").value,width:i.value,height:l.value}},htmlBuilder(t,e){var n=ge.makeSpan(["mord","rule"],[],e),r=Kn(t.width,e),s=Kn(t.height,e),i=t.shift?Kn(t.shift,e):0;return n.style.borderRightWidth=Le(r),n.style.borderTopWidth=Le(s),n.style.bottom=Le(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Kn(t.width,e),r=Kn(t.height,e),s=t.shift?Kn(t.shift,e):0,i=e.color&&e.getColor()||"black",l=new _e.MathNode("mspace");l.setAttribute("mathbackground",i),l.setAttribute("width",Le(n)),l.setAttribute("height",Le(r));var c=new _e.MathNode("mpadded",[l]);return s>=0?c.setAttribute("height",Le(s)):(c.setAttribute("height",Le(s)),c.setAttribute("depth",Le(-s))),c.setAttribute("voffset",Le(s)),c}});function VR(t,e,n){for(var r=Ar(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return VR(t.body,n,e)};Qe({type:"sizing",names:ON,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:ON.indexOf(r)+1,body:i}},htmlBuilder:rue,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Fs(t.body,n),s=new _e.MathNode("mstyle",r);return s.setAttribute("mathsize",Le(n.sizeMultiplier)),s}});Qe({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,l=n[0]&&Nt(n[0],"ordgroup");if(l)for(var c="",d=0;d{var n=ge.makeSpan([],[Kt(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new _e.MathNode("mpadded",[zn(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Qe({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=Kt(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=ge.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+l&&(l=(l+p-n.height-n.depth)/2);var x=d.height-n.height-l-h;n.style.paddingLeft=Le(m);var v=ge.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+x)},{type:"elem",elem:d},{type:"kern",size:h}]},e);if(t.index){var b=e.havingStyle(at.SCRIPTSCRIPT),k=Kt(t.index,b,e),O=.6*(v.height-v.depth),j=ge.makeVList({positionType:"shift",positionData:-O,children:[{type:"elem",elem:k}]},e),T=ge.makeSpan(["root"],[j]);return ge.makeSpan(["mord","sqrt"],[T,v],e)}else return ge.makeSpan(["mord","sqrt"],[v],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new _e.MathNode("mroot",[zn(n,e),zn(r,e)]):new _e.MathNode("msqrt",[zn(n,e)])}});var jN={display:at.DISPLAY,text:at.TEXT,script:at.SCRIPT,scriptscript:at.SCRIPTSCRIPT};Qe({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),l=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:l,body:i}},htmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n).withFont("");return VR(t.body,r,e)},mathmlBuilder(t,e){var n=jN[t.style],r=e.havingStyle(n),s=Fs(t.body,r),i=new _e.MathNode("mstyle",s),l={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},c=l[t.style];return i.setAttribute("scriptlevel",c[0]),i.setAttribute("displaystyle",c[1]),i}});var sue=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===at.DISPLAY.size||r.alwaysHandleSupSub);return s?zd:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===at.DISPLAY.size||r.limits);return i?UR:null}else{if(r.type==="accent")return tn.isCharacterBox(r.base)?z5:null;if(r.type==="horizBrace"){var l=!e.sub;return l===r.isOver?QR:null}else return null}else return null};Rc({type:"supsub",htmlBuilder(t,e){var n=sue(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,l=Kt(r,e),c,d,h=e.fontMetrics(),m=0,p=0,x=r&&tn.isCharacterBox(r);if(s){var v=e.havingStyle(e.style.sup());c=Kt(s,v,e),x||(m=l.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(i){var b=e.havingStyle(e.style.sub());d=Kt(i,b,e),x||(p=l.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var k;e.style===at.DISPLAY?k=h.sup1:e.style.cramped?k=h.sup3:k=h.sup2;var O=e.sizeMultiplier,j=Le(.5/h.ptPerEm/O),T=null;if(d){var A=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(l instanceof Ai||A)&&(T=Le(-l.italic))}var _;if(c&&d){m=Math.max(m,k,c.depth+.25*h.xHeight),p=Math.max(p,h.sub2);var D=h.defaultRuleThickness,E=4*D;if(m-c.depth-(d.height-p)0&&(m+=z,p-=z)}var Q=[{type:"elem",elem:d,shift:p,marginRight:j,marginLeft:T},{type:"elem",elem:c,shift:-m,marginRight:j}];_=ge.makeVList({positionType:"individualShift",children:Q},e)}else if(d){p=Math.max(p,h.sub1,d.height-.8*h.xHeight);var F=[{type:"elem",elem:d,marginLeft:T,marginRight:j}];_=ge.makeVList({positionType:"shift",positionData:p,children:F},e)}else if(c)m=Math.max(m,k,c.depth+.25*h.xHeight),_=ge.makeVList({positionType:"shift",positionData:-m,children:[{type:"elem",elem:c,marginRight:j}]},e);else throw new Error("supsub must have either sup or sub.");var L=N4(l,"right")||"mord";return ge.makeSpan([L],[l,ge.makeSpan(["msupsub"],[_])],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=[zn(t.base,e)];t.sub&&i.push(zn(t.sub,e)),t.sup&&i.push(zn(t.sup,e));var l;if(n)l=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===at.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===at.DISPLAY||h.limits)?l="munderover":l="msubsup"}else{var d=t.base;d&&d.type==="op"&&d.limits&&(e.style===at.DISPLAY||d.alwaysHandleSupSub)||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(d.limits||e.style===at.DISPLAY)?l="munder":l="msub"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===at.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===at.DISPLAY)?l="mover":l="msup"}return new _e.MathNode(l,i)}});Rc({type:"atom",htmlBuilder(t,e){return ge.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[Mi(t.text,t.mode)]);if(t.family==="bin"){var r=D5(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 WR={mi:"italic",mn:"normal",mtext:"normal"};Rc({type:"mathord",htmlBuilder(t,e){return ge.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new _e.MathNode("mi",[Mi(t.text,t.mode,e)]),r=D5(t,e)||"italic";return r!==WR[n.type]&&n.setAttribute("mathvariant",r),n}});Rc({type:"textord",htmlBuilder(t,e){return ge.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Mi(t.text,t.mode,e),r=D5(t,e)||"normal",s;return t.mode==="text"?s=new _e.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new _e.MathNode("mn",[n]):t.text==="\\prime"?s=new _e.MathNode("mo",[n]):s=new _e.MathNode("mi",[n]),r!==WR[s.type]&&s.setAttribute("mathvariant",r),s}});var Fb={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Qb={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Rc({type:"spacing",htmlBuilder(t,e){if(Qb.hasOwnProperty(t.text)){var n=Qb[t.text].className||"";if(t.mode==="text"){var r=ge.makeOrd(t,e,"textord");return r.classes.push(n),r}else return ge.makeSpan(["mspace",n],[ge.mathsym(t.text,t.mode,e)],e)}else{if(Fb.hasOwnProperty(t.text))return ge.makeSpan(["mspace",Fb[t.text]],[],e);throw new De('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(Qb.hasOwnProperty(t.text))n=new _e.MathNode("mtext",[new _e.TextNode(" ")]);else{if(Fb.hasOwnProperty(t.text))return new _e.MathNode("mspace");throw new De('Unknown type of space "'+t.text+'"')}return n}});var NN=()=>{var t=new _e.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Rc({type:"tag",mathmlBuilder(t,e){var n=new _e.MathNode("mtable",[new _e.MathNode("mtr",[NN(),new _e.MathNode("mtd",[wo(t.body,e)]),NN(),new _e.MathNode("mtd",[wo(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var CN={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},TN={"\\textbf":"textbf","\\textmd":"textmd"},iue={"\\textit":"textit","\\textup":"textup"},AN=(t,e)=>{var n=t.font;if(n){if(CN[n])return e.withTextFontFamily(CN[n]);if(TN[n])return e.withTextFontWeight(TN[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(iue[n])};Qe({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:ar(s),font:r}},htmlBuilder(t,e){var n=AN(t,e),r=Ar(t.body,n,!0);return ge.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=AN(t,e);return wo(t.body,n)}});Qe({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=Kt(t.body,e),r=ge.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=ge.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 ge.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new _e.MathNode("mo",[new _e.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new _e.MathNode("munder",[zn(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Qe({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=Kt(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return ge.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new _e.MathNode("mpadded",[zn(t.body,e)],["vcenter"])}});Qe({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new De("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=MN(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),io=gR,GR=`[ \r ]`,aue="\\\\[a-zA-Z@]+",lue="\\\\[^\uD800-\uDFFF]",oue="("+aue+")"+GR+"*",cue=`\\\\( |[ \r ]+ ?)[ \r ]*`,M4="[̀-ͯ]",uue=new RegExp(M4+"+$"),due="("+GR+"+)|"+(cue+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(M4+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(M4+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+oue)+("|"+lue+")");class EN{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(due,"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 ii("EOF",new Ts(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new De("Unexpected character: '"+e[n]+"'",new ii(e[n],new Ts(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 ii(s,new Ts(this,n,this.tokenRegex.lastIndex))}}class hue{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 De("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var fue=BR;q("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});q("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});q("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});q("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});q("\\@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}});q("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");q("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var _N={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};q("\\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 De("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=_N[e.text],r==null||r>=n)throw new De("Invalid base-"+n+" digit "+e.text);for(var s;(s=_N[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new De("\\newcommand's first argument must be a macro name");var i=s[0].text,l=t.isDefined(i);if(l&&!e)throw new De("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!l&&!n)throw new De("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var c=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var d="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)d+=h.text,h=t.expandNextToken();if(!d.match(/^\s*[0-9]+\s*$/))throw new De("Invalid number of arguments: "+d);c=parseInt(d),s=t.consumeArg().tokens}return l&&r||t.macros.set(i,{tokens:s,numArgs:c}),""};q("\\newcommand",t=>$5(t,!1,!0,!1));q("\\renewcommand",t=>$5(t,!0,!1,!1));q("\\providecommand",t=>$5(t,!0,!0,!0));q("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});q("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});q("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),io[n],Ln.math[n],Ln.text[n]),""});q("\\bgroup","{");q("\\egroup","}");q("~","\\nobreakspace");q("\\lq","`");q("\\rq","'");q("\\aa","\\r a");q("\\AA","\\r A");q("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");q("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");q("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");q("ℬ","\\mathscr{B}");q("ℰ","\\mathscr{E}");q("ℱ","\\mathscr{F}");q("ℋ","\\mathscr{H}");q("ℐ","\\mathscr{I}");q("ℒ","\\mathscr{L}");q("ℳ","\\mathscr{M}");q("ℛ","\\mathscr{R}");q("ℭ","\\mathfrak{C}");q("ℌ","\\mathfrak{H}");q("ℨ","\\mathfrak{Z}");q("\\Bbbk","\\Bbb{k}");q("·","\\cdotp");q("\\llap","\\mathllap{\\textrm{#1}}");q("\\rlap","\\mathrlap{\\textrm{#1}}");q("\\clap","\\mathclap{\\textrm{#1}}");q("\\mathstrut","\\vphantom{(}");q("\\underbar","\\underline{\\text{#1}}");q("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');q("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");q("\\ne","\\neq");q("≠","\\neq");q("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");q("∉","\\notin");q("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");q("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");q("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");q("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");q("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");q("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");q("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");q("⟂","\\perp");q("‼","\\mathclose{!\\mkern-0.8mu!}");q("∌","\\notni");q("⌜","\\ulcorner");q("⌝","\\urcorner");q("⌞","\\llcorner");q("⌟","\\lrcorner");q("©","\\copyright");q("®","\\textregistered");q("️","\\textregistered");q("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');q("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');q("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');q("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');q("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");q("⋮","\\vdots");q("\\varGamma","\\mathit{\\Gamma}");q("\\varDelta","\\mathit{\\Delta}");q("\\varTheta","\\mathit{\\Theta}");q("\\varLambda","\\mathit{\\Lambda}");q("\\varXi","\\mathit{\\Xi}");q("\\varPi","\\mathit{\\Pi}");q("\\varSigma","\\mathit{\\Sigma}");q("\\varUpsilon","\\mathit{\\Upsilon}");q("\\varPhi","\\mathit{\\Phi}");q("\\varPsi","\\mathit{\\Psi}");q("\\varOmega","\\mathit{\\Omega}");q("\\substack","\\begin{subarray}{c}#1\\end{subarray}");q("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");q("\\boxed","\\fbox{$\\displaystyle{#1}$}");q("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");q("\\implies","\\DOTSB\\;\\Longrightarrow\\;");q("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");q("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");q("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var DN={",":"\\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"};q("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in DN?e=DN[n]:(n.slice(0,4)==="\\not"||n in Ln.math&&["bin","rel"].includes(Ln.math[n].group))&&(e="\\dotsb"),e});var H5={")":!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};q("\\dotso",function(t){var e=t.future().text;return e in H5?"\\ldots\\,":"\\ldots"});q("\\dotsc",function(t){var e=t.future().text;return e in H5&&e!==","?"\\ldots\\,":"\\ldots"});q("\\cdots",function(t){var e=t.future().text;return e in H5?"\\@cdots\\,":"\\@cdots"});q("\\dotsb","\\cdots");q("\\dotsm","\\cdots");q("\\dotsi","\\!\\cdots");q("\\dotsx","\\ldots\\,");q("\\DOTSI","\\relax");q("\\DOTSB","\\relax");q("\\DOTSX","\\relax");q("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");q("\\,","\\tmspace+{3mu}{.1667em}");q("\\thinspace","\\,");q("\\>","\\mskip{4mu}");q("\\:","\\tmspace+{4mu}{.2222em}");q("\\medspace","\\:");q("\\;","\\tmspace+{5mu}{.2777em}");q("\\thickspace","\\;");q("\\!","\\tmspace-{3mu}{.1667em}");q("\\negthinspace","\\!");q("\\negmedspace","\\tmspace-{4mu}{.2222em}");q("\\negthickspace","\\tmspace-{5mu}{.277em}");q("\\enspace","\\kern.5em ");q("\\enskip","\\hskip.5em\\relax");q("\\quad","\\hskip1em\\relax");q("\\qquad","\\hskip2em\\relax");q("\\tag","\\@ifstar\\tag@literal\\tag@paren");q("\\tag@paren","\\tag@literal{({#1})}");q("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new De("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});q("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");q("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");q("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");q("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");q("\\newline","\\\\\\relax");q("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var XR=Le(pa["Main-Regular"][84][1]-.7*pa["Main-Regular"][65][1]);q("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");q("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+XR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");q("\\hspace","\\@ifstar\\@hspacer\\@hspace");q("\\@hspace","\\hskip #1\\relax");q("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");q("\\ordinarycolon",":");q("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");q("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');q("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');q("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');q("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');q("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');q("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');q("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');q("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');q("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');q("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');q("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');q("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');q("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');q("∷","\\dblcolon");q("∹","\\eqcolon");q("≔","\\coloneqq");q("≕","\\eqqcolon");q("⩴","\\Coloneqq");q("\\ratio","\\vcentcolon");q("\\coloncolon","\\dblcolon");q("\\colonequals","\\coloneqq");q("\\coloncolonequals","\\Coloneqq");q("\\equalscolon","\\eqqcolon");q("\\equalscoloncolon","\\Eqqcolon");q("\\colonminus","\\coloneq");q("\\coloncolonminus","\\Coloneq");q("\\minuscolon","\\eqcolon");q("\\minuscoloncolon","\\Eqcolon");q("\\coloncolonapprox","\\Colonapprox");q("\\coloncolonsim","\\Colonsim");q("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");q("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");q("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");q("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");q("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");q("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");q("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");q("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");q("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");q("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");q("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");q("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");q("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");q("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");q("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");q("\\nleqq","\\html@mathml{\\@nleqq}{≰}");q("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");q("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");q("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");q("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");q("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");q("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");q("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");q("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");q("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");q("\\imath","\\html@mathml{\\@imath}{ı}");q("\\jmath","\\html@mathml{\\@jmath}{ȷ}");q("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");q("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");q("⟦","\\llbracket");q("⟧","\\rrbracket");q("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");q("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");q("⦃","\\lBrace");q("⦄","\\rBrace");q("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");q("⦵","\\minuso");q("\\darr","\\downarrow");q("\\dArr","\\Downarrow");q("\\Darr","\\Downarrow");q("\\lang","\\langle");q("\\rang","\\rangle");q("\\uarr","\\uparrow");q("\\uArr","\\Uparrow");q("\\Uarr","\\Uparrow");q("\\N","\\mathbb{N}");q("\\R","\\mathbb{R}");q("\\Z","\\mathbb{Z}");q("\\alef","\\aleph");q("\\alefsym","\\aleph");q("\\Alpha","\\mathrm{A}");q("\\Beta","\\mathrm{B}");q("\\bull","\\bullet");q("\\Chi","\\mathrm{X}");q("\\clubs","\\clubsuit");q("\\cnums","\\mathbb{C}");q("\\Complex","\\mathbb{C}");q("\\Dagger","\\ddagger");q("\\diamonds","\\diamondsuit");q("\\empty","\\emptyset");q("\\Epsilon","\\mathrm{E}");q("\\Eta","\\mathrm{H}");q("\\exist","\\exists");q("\\harr","\\leftrightarrow");q("\\hArr","\\Leftrightarrow");q("\\Harr","\\Leftrightarrow");q("\\hearts","\\heartsuit");q("\\image","\\Im");q("\\infin","\\infty");q("\\Iota","\\mathrm{I}");q("\\isin","\\in");q("\\Kappa","\\mathrm{K}");q("\\larr","\\leftarrow");q("\\lArr","\\Leftarrow");q("\\Larr","\\Leftarrow");q("\\lrarr","\\leftrightarrow");q("\\lrArr","\\Leftrightarrow");q("\\Lrarr","\\Leftrightarrow");q("\\Mu","\\mathrm{M}");q("\\natnums","\\mathbb{N}");q("\\Nu","\\mathrm{N}");q("\\Omicron","\\mathrm{O}");q("\\plusmn","\\pm");q("\\rarr","\\rightarrow");q("\\rArr","\\Rightarrow");q("\\Rarr","\\Rightarrow");q("\\real","\\Re");q("\\reals","\\mathbb{R}");q("\\Reals","\\mathbb{R}");q("\\Rho","\\mathrm{P}");q("\\sdot","\\cdot");q("\\sect","\\S");q("\\spades","\\spadesuit");q("\\sub","\\subset");q("\\sube","\\subseteq");q("\\supe","\\supseteq");q("\\Tau","\\mathrm{T}");q("\\thetasym","\\vartheta");q("\\weierp","\\wp");q("\\Zeta","\\mathrm{Z}");q("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");q("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");q("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");q("\\bra","\\mathinner{\\langle{#1}|}");q("\\ket","\\mathinner{|{#1}\\rangle}");q("\\braket","\\mathinner{\\langle{#1}\\rangle}");q("\\Bra","\\left\\langle#1\\right|");q("\\Ket","\\left|#1\\right\\rangle");var YR=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,l=e.macros.get("|"),c=e.macros.get("\\|");e.macros.beginGroup();var d=p=>x=>{t&&(x.macros.set("|",l),s.length&&x.macros.set("\\|",c));var v=p;if(!p&&s.length){var b=x.future();b.text==="|"&&(x.popToken(),v=!0)}return{tokens:v?s:r,numArgs:0}};e.macros.set("|",d(!1)),s.length&&e.macros.set("\\|",d(!0));var h=e.consumeArg().tokens,m=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:m.reverse(),numArgs:0}};q("\\bra@ket",YR(!1));q("\\bra@set",YR(!0));q("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");q("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");q("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");q("\\angln","{\\angl n}");q("\\blue","\\textcolor{##6495ed}{#1}");q("\\orange","\\textcolor{##ffa500}{#1}");q("\\pink","\\textcolor{##ff00af}{#1}");q("\\red","\\textcolor{##df0030}{#1}");q("\\green","\\textcolor{##28ae7b}{#1}");q("\\gray","\\textcolor{gray}{#1}");q("\\purple","\\textcolor{##9d38bd}{#1}");q("\\blueA","\\textcolor{##ccfaff}{#1}");q("\\blueB","\\textcolor{##80f6ff}{#1}");q("\\blueC","\\textcolor{##63d9ea}{#1}");q("\\blueD","\\textcolor{##11accd}{#1}");q("\\blueE","\\textcolor{##0c7f99}{#1}");q("\\tealA","\\textcolor{##94fff5}{#1}");q("\\tealB","\\textcolor{##26edd5}{#1}");q("\\tealC","\\textcolor{##01d1c1}{#1}");q("\\tealD","\\textcolor{##01a995}{#1}");q("\\tealE","\\textcolor{##208170}{#1}");q("\\greenA","\\textcolor{##b6ffb0}{#1}");q("\\greenB","\\textcolor{##8af281}{#1}");q("\\greenC","\\textcolor{##74cf70}{#1}");q("\\greenD","\\textcolor{##1fab54}{#1}");q("\\greenE","\\textcolor{##0d923f}{#1}");q("\\goldA","\\textcolor{##ffd0a9}{#1}");q("\\goldB","\\textcolor{##ffbb71}{#1}");q("\\goldC","\\textcolor{##ff9c39}{#1}");q("\\goldD","\\textcolor{##e07d10}{#1}");q("\\goldE","\\textcolor{##a75a05}{#1}");q("\\redA","\\textcolor{##fca9a9}{#1}");q("\\redB","\\textcolor{##ff8482}{#1}");q("\\redC","\\textcolor{##f9685d}{#1}");q("\\redD","\\textcolor{##e84d39}{#1}");q("\\redE","\\textcolor{##bc2612}{#1}");q("\\maroonA","\\textcolor{##ffbde0}{#1}");q("\\maroonB","\\textcolor{##ff92c6}{#1}");q("\\maroonC","\\textcolor{##ed5fa6}{#1}");q("\\maroonD","\\textcolor{##ca337c}{#1}");q("\\maroonE","\\textcolor{##9e034e}{#1}");q("\\purpleA","\\textcolor{##ddd7ff}{#1}");q("\\purpleB","\\textcolor{##c6b9fc}{#1}");q("\\purpleC","\\textcolor{##aa87ff}{#1}");q("\\purpleD","\\textcolor{##7854ab}{#1}");q("\\purpleE","\\textcolor{##543b78}{#1}");q("\\mintA","\\textcolor{##f5f9e8}{#1}");q("\\mintB","\\textcolor{##edf2df}{#1}");q("\\mintC","\\textcolor{##e0e5cc}{#1}");q("\\grayA","\\textcolor{##f6f7f7}{#1}");q("\\grayB","\\textcolor{##f0f1f2}{#1}");q("\\grayC","\\textcolor{##e3e5e6}{#1}");q("\\grayD","\\textcolor{##d6d8da}{#1}");q("\\grayE","\\textcolor{##babec2}{#1}");q("\\grayF","\\textcolor{##888d93}{#1}");q("\\grayG","\\textcolor{##626569}{#1}");q("\\grayH","\\textcolor{##3b3e40}{#1}");q("\\grayI","\\textcolor{##21242c}{#1}");q("\\kaBlue","\\textcolor{##314453}{#1}");q("\\kaGreen","\\textcolor{##71B307}{#1}");var KR={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class mue{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 hue(fue,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new EN(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 ii("EOF",r.loc)),this.pushTokens(s),new ii("",Ts.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,l=0,c=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++l;else if(i.text==="}"){if(--l,l===-1)throw new De("Extra }",i)}else if(i.text==="EOF")throw new De("Unexpected end of input in a macro argument, expected '"+(e&&r?e[c]:"}")+"'",i);if(e&&r)if((l===0||l===1&&e[c]==="{")&&i.text===e[c]){if(++c,c===e.length){n.splice(-c,c);break}}else c=0}while(l!==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 De("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new De("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 De("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,l=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var c=i.length-1;c>=0;--c){var d=i[c];if(d.text==="#"){if(c===0)throw new De("Incomplete placeholder at end of macro body",d);if(d=i[--c],d.text==="#")i.splice(c+1,1);else if(/^[1-9]$/.test(d.text))i.splice(c,2,...l[+d.text-1]);else throw new De("Not a valid argument number",d)}}}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 ii(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 l=s.replace(/##/g,"");l.indexOf("#"+(i+1))!==-1;)++i;for(var c=new EN(s,this.settings),d=[],h=c.lex();h.text!=="EOF";)d.push(h),h=c.lex();d.reverse();var m={tokens:d,numArgs:i};return m}return s}isDefined(e){return this.macros.has(e)||io.hasOwnProperty(e)||Ln.math.hasOwnProperty(e)||Ln.text.hasOwnProperty(e)||KR.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:io.hasOwnProperty(e)&&!io[e].primitive}}var RN=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Pp=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),$b={"́":{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"}},zN={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Xx{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 mue(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 De("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 ii("}")),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(Xx.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&io[s.text]&&io[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,s=0;s=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var c=Ln[this.mode][n].group,d=Ts.range(e),h;if(nce.hasOwnProperty(c)){var m=c;h={type:"atom",mode:this.mode,family:m,loc:d,text:n}}else h={type:c,mode:this.mode,loc:d,text:n};l=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(aR(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)),l={type:"textord",mode:"text",loc:Ts.range(e),text:n};else return null;if(this.consume(),i)for(var p=0;ph&&(h=m):m&&(h!==void 0&&h>-1&&d.push(` + please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}zN.hasOwnProperty(n[0])&&!Ln[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=zN[n[0]]+n.slice(1));var i=uue.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var l;if(Ln[this.mode][n]){this.settings.strict&&this.mode==="math"&&j4.indexOf(n)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var c=Ln[this.mode][n].group,d=Ts.range(e),h;if(nce.hasOwnProperty(c)){var m=c;h={type:"atom",mode:this.mode,family:m,loc:d,text:n}}else h={type:c,mode:this.mode,loc:d,text:n};l=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(aR(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)),l={type:"textord",mode:"text",loc:Ts.range(e),text:n};else return null;if(this.consume(),i)for(var p=0;ph&&(h=m):m&&(h!==void 0&&h>-1&&d.push(` `.repeat(h)||" "),h=-1,d.push(m))}return d.join("")}function sz(t,e,n){return t.type==="element"?Uue(t,e,n):t.type==="text"?n.whitespace==="normal"?iz(t,n):Vue(t):[]}function Uue(t,e,n){const r=az(t,n),s=t.children||[];let i=-1,l=[];if($ue(t))return l;let c,d;for(_4(t)||HN(t)&&qN(e,t,HN)?d=` -`:Que(t)?(c=2,d=2):rz(t)&&(c=1,d=1);++i{try{i(!0);const Oe=await nde({page:l,page_size:m,search:x||void 0,is_registered:b==="all"?void 0:b==="registered",is_banned:O==="all"?void 0:O==="banned",format:T==="all"?void 0:T,sort_by:"usage_count",sort_order:"desc"});e(Oe.data),h(Oe.total)}catch(Oe){const nt=Oe instanceof Error?Oe.message:"加载表情包列表失败";ne({title:"错误",description:nt,variant:"destructive"})}finally{i(!1)}},[l,m,x,b,O,T,ne]),z=async()=>{try{const Oe=await ade();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};S.useEffect(()=>{ce()},[ce]),S.useEffect(()=>{z()},[]);const xe=async Oe=>{try{const nt=await rde(Oe.id);D(nt.data),R(!0)}catch(nt){const ut=nt instanceof Error?nt.message:"加载详情失败";ne({title:"错误",description:ut,variant:"destructive"})}},Y=Oe=>{D(Oe),F(!0)},P=Oe=>{D(Oe),U(!0)},K=async()=>{if(_)try{await ide(_.id),ne({title:"成功",description:"表情包已删除"}),U(!1),D(null),ce(),z()}catch(Oe){const nt=Oe instanceof Error?Oe.message:"删除失败";ne({title:"错误",description:nt,variant:"destructive"})}},H=async Oe=>{try{await lde(Oe.id),ne({title:"成功",description:"表情包已注册"}),ce(),z()}catch(nt){const ut=nt instanceof Error?nt.message:"注册失败";ne({title:"错误",description:ut,variant:"destructive"})}},fe=async Oe=>{try{await ode(Oe.id),ne({title:"成功",description:"表情包已封禁"}),ce(),z()}catch(nt){const ut=nt instanceof Error?nt.message:"封禁失败";ne({title:"错误",description:ut,variant:"destructive"})}},ve=Oe=>{const nt=new Set(V);nt.has(Oe)?nt.delete(Oe):nt.add(Oe),de(nt)},Re=()=>{V.size===t.length&&t.length>0?de(new Set):de(new Set(t.map(Oe=>Oe.id)))},ue=async()=>{try{const Oe=await cde(Array.from(V));ne({title:"批量删除完成",description:Oe.message}),de(new Set),J(!1),ce(),z()}catch(Oe){ne({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},We=()=>{const Oe=parseInt($),nt=Math.ceil(d/m);Oe>=1&&Oe<=nt?(c(Oe),ae("")):ne({title:"无效的页码",description:`请输入1-${nt}之间的页码`,variant:"destructive"})},ct=n?.formats?Object.keys(n.formats):[];return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsxs("div",{className:"mb-4 sm:mb-6",children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),a.jsx(vn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&a.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"总数"}),a.jsx(Gt,{className:"text-2xl",children:n.total})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已注册"}),a.jsx(Gt,{className:"text-2xl text-green-600",children:n.registered})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已封禁"}),a.jsx(Gt,{className:"text-2xl text-red-600",children:n.banned})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"未注册"}),a.jsx(Gt,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsxs(Gt,{className:"flex items-center gap-2",children:[a.jsx(t2,{className:"h-5 w-5"}),"搜索和筛选"]})}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"描述或哈希值...",value:x,onChange:Oe=>{v(Oe.target.value),c(1)},className:"pl-8"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"注册状态"}),a.jsxs(Lt,{value:b,onValueChange:Oe=>{k(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"registered",children:"已注册"}),a.jsx(Pe,{value:"unregistered",children:"未注册"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"封禁状态"}),a.jsxs(Lt,{value:O,onValueChange:Oe=>{j(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"banned",children:"已封禁"}),a.jsx(Pe,{value:"unbanned",children:"未封禁"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"格式"}),a.jsxs(Lt,{value:T,onValueChange:Oe=>{A(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),ct.map(Oe=>a.jsxs(Pe,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:V.size>0&&a.jsxs("span",{children:["已选择 ",V.size," 个表情包"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:m.toString(),onValueChange:Oe=>{p(parseInt(Oe)),c(1),de(new Set)},children:[a.jsx(Dt,{id:"emoji-page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),V.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>de(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>J(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t",children:a.jsxs(ie,{variant:"outline",size:"sm",onClick:ce,disabled:s,children:[a.jsx(Fi,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"表情包列表"}),a.jsxs(Sr,{children:["共 ",d," 个表情包,当前第 ",l," 页"]})]}),a.jsxs(an,{children:[a.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&V.size===t.length,onCheckedChange:Re,"aria-label":"全选"})}),a.jsx(xt,{className:"w-16",children:"预览"}),a.jsx(xt,{children:"描述"}),a.jsx(xt,{children:"格式"}),a.jsx(xt,{children:"情绪标签"}),a.jsx(xt,{className:"text-center",children:"状态"}),a.jsx(xt,{className:"text-right",children:"使用次数"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(Oe=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Oe.id),onCheckedChange:()=>ve(Oe.id),"aria-label":`选择 ${Oe.description}`})}),a.jsx(it,{children:a.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsx(it,{children:a.jsxs("div",{className:"space-y-1 max-w-xs",children:[a.jsx("div",{className:"font-medium truncate",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[Oe.emoji_hash.slice(0,16),"..."]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:Oe.format.toUpperCase()})}),a.jsx(it,{children:a.jsx(UN,{emotions:Oe.emotion})}),a.jsx(it,{className:"align-middle",children:a.jsxs("div",{className:"flex gap-2 justify-center",children:[Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),a.jsx(it,{className:"text-right font-mono",children:Oe.usage_count}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>xe(Oe),children:[a.jsx(co,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-4 w-4 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-4 w-4 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Oe.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3",children:t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(Oe=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[a.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[Oe.emoji_hash.slice(0,16),"..."]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[a.jsx(On,{variant:"outline",className:"text-xs flex-shrink-0",children:Oe.format.toUpperCase()}),Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",className:"text-xs flex-shrink-0",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]}),a.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",Oe.usage_count]})]}),Oe.emotion&&Oe.emotion.length>0&&a.jsx("div",{className:"min-w-0 overflow-hidden",children:a.jsx(UN,{emotions:Oe.emotion})})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>xe(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(co,{className:"h-3 w-3 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-3 w-3 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Oe.id))}),d>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*m+1," 到"," ",Math.min(l*m,d)," 条,共 ",d," 条"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Math.max(1,Oe-1)),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:$,onChange:Oe=>ae(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&We(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/m)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:We,disabled:!$,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Oe+1),disabled:l>=Math.ceil(d/m),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(d/m)),disabled:l>=Math.ceil(d/m),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]}),a.jsx(dde,{emoji:_,open:E,onOpenChange:R}),a.jsx(hde,{emoji:_,open:Q,onOpenChange:F,onSuccess:()=>{ce(),z()}})]})}),a.jsx(mn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["你确定要删除选中的 ",V.size," 个表情包吗?此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:ue,children:"确认删除"})]})]})}),a.jsx(Rr,{open:L,onOpenChange:U,children:a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"确认删除"}),a.jsx(Gr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>U(!1),children:"取消"}),a.jsx(ie,{variant:"destructive",onClick:K,children:"删除"})]})]})})]})}function dde({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[90vh]",children:[a.jsx(Cr,{children:a.jsx(Tr,{children:"表情包详情"})}),a.jsx(vn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex justify-center",children:a.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const l=i.parentElement;l&&(l.innerHTML='')}})})}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"ID"}),a.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"格式"}),a.jsx("div",{className:"mt-1",children:a.jsx(On,{variant:"outline",children:t.format.toUpperCase()})})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"文件路径"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"哈希值"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"描述"}),t.description?a.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:a.jsx(tde,{className:"prose-sm",children:t.description})}):a.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"情绪标签"}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(()=>{const s=t.emotion?t.emotion.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];return s.length>0?s.map((i,l)=>a.jsx(On,{variant:"secondary",children:i},l)):a.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})()})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"状态"}),a.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&a.jsx(On,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&a.jsx(On,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&a.jsx(On,{variant:"outline",children:"未注册"})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"使用次数"}),a.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"记录时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"注册时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"最后使用"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function hde({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),{toast:b}=Pr();S.useEffect(()=>{t&&(i(t.description||""),c(t.emotion||""),h(t.is_registered),p(t.is_banned))},[t]);const k=async()=>{if(t)try{v(!0);const O=l.split(/[,,]/).map(j=>j.trim()).filter(Boolean).join(",");await sde(t.id,{description:s||void 0,emotion:O||void 0,is_registered:d,is_banned:m}),b({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(O){const j=O instanceof Error?O.message:"保存失败";b({title:"错误",description:j,variant:"destructive"})}finally{v(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表情包"}),a.jsx(Gr,{children:"修改表情包的描述和标签信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"描述"}),a.jsx(_n,{value:s,onChange:O=>i(O.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"情绪标签"}),a.jsx(Me,{value:l,onChange:O=>c(O.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔(支持中英文逗号)"})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_registered",checked:d,onCheckedChange:O=>h(O===!0)}),a.jsx(te,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_banned",checked:m,onCheckedChange:O=>p(O===!0)}),a.jsx(te,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:k,disabled:x,children:x?"保存中...":"保存"})]})]})}):null}function UN({emotions:t}){const e=t?t.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];if(e.length===0)return a.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const n=(i,l=6)=>i.length<=l?i:i.slice(0,l)+"...",r=e.slice(0,3),s=e.length-3;return a.jsxs("div",{className:"flex flex-wrap gap-1 max-w-full overflow-hidden",children:[r.map((i,l)=>a.jsx(On,{variant:"secondary",className:"text-xs flex-shrink-0",title:i,children:n(i)},l)),s>0&&a.jsxs(On,{variant:"outline",className:"text-xs flex-shrink-0",title:`还有 ${s} 个标签: ${e.slice(3).join(", ")}`,children:["+",s]})]})}const Pc="/api/webui/expression";async function fde(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 ot(`${Pc}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function mde(t){const e=await ot(`${Pc}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function pde(t){const e=await ot(`${Pc}/`,{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function gde(t,e){const n=await ot(`${Pc}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function xde(t){const e=await ot(`${Pc}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function vde(t){const e=await ot(`${Pc}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function yde(){const t=await ot(`${Pc}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function bde(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(null),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(null),[E,R]=S.useState(new Set),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,de]=S.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:W}=Pr(),J=async()=>{try{r(!0);const H=await fde({page:l,page_size:d,search:m||void 0});e(H.data),i(H.total)}catch(H){W({title:"加载失败",description:H instanceof Error?H.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},$=async()=>{try{const H=await yde();de(H.data)}catch(H){console.error("加载统计数据失败:",H)}};S.useEffect(()=>{J(),$()},[l,d,m]);const ae=async H=>{try{const fe=await mde(H.id);v(fe.data),k(!0)}catch(fe){W({title:"加载详情失败",description:fe instanceof Error?fe.message:"无法加载表达方式详情",variant:"destructive"})}},ne=H=>{v(H),j(!0)},ce=async H=>{try{await xde(H.id),W({title:"删除成功",description:`已删除表达方式: ${H.situation}`}),D(null),J(),$()}catch(fe){W({title:"删除失败",description:fe instanceof Error?fe.message:"无法删除表达方式",variant:"destructive"})}},z=H=>{const fe=new Set(E);fe.has(H)?fe.delete(H):fe.add(H),R(fe)},xe=()=>{E.size===t.length&&t.length>0?R(new Set):R(new Set(t.map(H=>H.id)))},Y=async()=>{try{await vde(Array.from(E)),W({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),R(new Set),F(!1),J(),$()}catch(H){W({title:"批量删除失败",description:H instanceof Error?H.message:"无法批量删除表达方式",variant:"destructive"})}},P=()=>{const H=parseInt(L),fe=Math.ceil(s/d);H>=1&&H<=fe?(c(H),U("")):W({title:"无效的页码",description:`请输入1-${fe}之间的页码`,variant:"destructive"})},K=H=>H?new Date(H*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Wf,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),a.jsxs(ie,{onClick:()=>A(!0),className:"gap-2",children:[a.jsx(Wr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),a.jsx(vn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索情境、风格或上下文...",value:m,onChange:H=>p(H.target.value),className:"pl-9"})]})}),a.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:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&a.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:H=>{h(parseInt(H)),c(1),R(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),E.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>R(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>F(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:E.size===t.length&&t.length>0,onCheckedChange:xe})}),a.jsx(xt,{children:"情境"}),a.jsx(xt,{children:"风格"}),a.jsx(xt,{children:"聊天ID"}),a.jsx(xt,{children:"最后活跃"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(H=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>z(H.id)})}),a.jsx(it,{className:"font-medium max-w-xs truncate",children:H.situation}),a.jsx(it,{className:"max-w-xs truncate",children:H.style}),a.jsx(it,{className:"font-mono text-sm",children:H.chat_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:K(H.last_active_time)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ae(H),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ne(H),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>D(H),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},H.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(H=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>z(H.id),className:"mt-1"}),a.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:H.situation,children:H.situation})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),a.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:H.style,children:H.style})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),a.jsx("p",{className:"font-mono text-xs truncate",children:H.chat_id})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),a.jsx("p",{className:"text-xs",children:K(H.last_active_time)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ne(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>D(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},H.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:L,onChange:H=>U(H.target.value),onKeyDown:H=>H.key==="Enter"&&P(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:P,disabled:!L,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(wde,{expression:x,open:b,onOpenChange:k}),a.jsx(Sde,{open:T,onOpenChange:A,onSuccess:()=>{J(),$(),A(!1)}}),a.jsx(kde,{expression:x,open:O,onOpenChange:j,onSuccess:()=>{J(),$(),j(!1)}}),a.jsx(mn,{open:!!_,onOpenChange:()=>D(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除表达方式 "',_?.situation,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>_&&ce(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(Ode,{open:Q,onOpenChange:F,onConfirm:Y,count:E.size})]})}function wde({expression:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"表达方式详情"}),a.jsx(Gr,{children:"查看表达方式的完整信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{label:"情境",value:t.situation}),a.jsx(Au,{label:"风格",value:t.style}),a.jsx(Au,{icon:mg,label:"聊天ID",value:t.chat_id,mono:!0}),a.jsx(Au,{icon:mg,label:"记录ID",value:t.id.toString(),mono:!0})]}),t.context&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上下文"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.context})]}),t.up_content&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上文内容"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.up_content})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{icon:dc,label:"最后活跃",value:r(t.last_active_time)}),a.jsx(Au,{icon:dc,label:"创建时间",value:r(t.create_date)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Au({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Sde({open:t,onOpenChange:e,onSuccess:n}){const[r,s]=S.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[i,l]=S.useState(!1),{toast:c}=Pr(),d=async()=>{if(!r.situation||!r.style||!r.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{l(!0),await pde(r),c({title:"创建成功",description:"表达方式已创建"}),s({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(h){c({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"新增表达方式"}),a.jsx(Gr,{children:"创建新的表达方式记录"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"situation",children:["情境 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"situation",value:r.situation,onChange:h=>s({...r,situation:h.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"style",children:["风格 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"style",value:r.style,onChange:h=>s({...r,style:h.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"chat_id",children:["聊天ID ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"chat_id",value:r.chat_id,onChange:h=>s({...r,chat_id:h.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"context",children:"上下文"}),a.jsx(_n,{id:"context",value:r.context,onChange:h=>s({...r,context:h.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"up_content",children:"上文内容"}),a.jsx(_n,{id:"up_content",value:r.up_content,onChange:h=>s({...r,up_content:h.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>e(!1),children:"取消"}),a.jsx(ie,{onClick:d,disabled:i,children:i?"创建中...":"创建"})]})]})})}function kde({expression:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({situation:t.situation,style:t.style,context:t.context||"",up_content:t.up_content||"",chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{c(!0),await gde(t.id,s),d({title:"保存成功",description:"表达方式已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表达方式"}),a.jsx(Gr,{children:"修改表达方式的信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_situation",children:"情境"}),a.jsx(Me,{id:"edit_situation",value:s.situation||"",onChange:m=>i({...s,situation:m.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_style",children:"风格"}),a.jsx(Me,{id:"edit_style",value:s.style||"",onChange:m=>i({...s,style:m.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_chat_id",children:"聊天ID"}),a.jsx(Me,{id:"edit_chat_id",value:s.chat_id||"",onChange:m=>i({...s,chat_id:m.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_context",children:"上下文"}),a.jsx(_n,{id:"edit_context",value:s.context||"",onChange:m=>i({...s,context:m.target.value}),placeholder:"上下文信息",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_up_content",children:"上文内容"}),a.jsx(_n,{id:"edit_up_content",value:s.up_content||"",onChange:m=>i({...s,up_content:m.target.value}),placeholder:"上文内容",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Ode({open:t,onOpenChange:e,onConfirm:n,count:r}){return a.jsx(mn,{open:t,onOpenChange:e,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Pd="/api/webui/person";async function jde(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 ot(`${Pd}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function Nde(t){const e=await ot(`${Pd}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Cde(t,e){const n=await ot(`${Pd}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Tde(t){const e=await ot(`${Pd}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Ade(){const t=await ot(`${Pd}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Mde(t){const e=await ot(`${Pd}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Ede(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(void 0),[b,k]=S.useState(void 0),[O,j]=S.useState(null),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,R]=S.useState(null),[Q,F]=S.useState({total:0,known:0,unknown:0,platforms:{}}),[L,U]=S.useState(new Set),[V,de]=S.useState(!1),[W,J]=S.useState(""),{toast:$}=Pr(),ae=async()=>{try{r(!0);const ue=await jde({page:l,page_size:d,search:m||void 0,is_known:x,platform:b});e(ue.data),i(ue.total)}catch(ue){$({title:"加载失败",description:ue instanceof Error?ue.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},ne=async()=>{try{const ue=await Ade();F(ue.data)}catch(ue){console.error("加载统计数据失败:",ue)}};S.useEffect(()=>{ae(),ne()},[l,d,m,x,b]);const ce=async ue=>{try{const We=await Nde(ue.person_id);j(We.data),A(!0)}catch(We){$({title:"加载详情失败",description:We instanceof Error?We.message:"无法加载人物详情",variant:"destructive"})}},z=ue=>{j(ue),D(!0)},xe=async ue=>{try{await Tde(ue.person_id),$({title:"删除成功",description:`已删除人物信息: ${ue.person_name||ue.nickname||ue.user_id}`}),R(null),ae(),ne()}catch(We){$({title:"删除失败",description:We instanceof Error?We.message:"无法删除人物信息",variant:"destructive"})}},Y=S.useMemo(()=>Object.keys(Q.platforms),[Q.platforms]),P=ue=>{const We=new Set(L);We.has(ue)?We.delete(ue):We.add(ue),U(We)},K=()=>{L.size===t.length&&t.length>0?U(new Set):U(new Set(t.map(ue=>ue.person_id)))},H=()=>{if(L.size===0){$({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}de(!0)},fe=async()=>{try{const ue=await Mde(Array.from(L));$({title:"批量删除完成",description:ue.message}),U(new Set),de(!1),ae(),ne()}catch(ue){$({title:"批量删除失败",description:ue instanceof Error?ue.message:"批量删除失败",variant:"destructive"})}},ve=()=>{const ue=parseInt(W),We=Math.ceil(s/d);ue>=1&&ue<=We?(c(ue),J("")):$({title:"无效的页码",description:`请输入1-${We}之间的页码`,variant:"destructive"})},Re=ue=>ue?new Date(ue*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Oq,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),a.jsx(vn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:Q.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:Q.known})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:Q.unknown})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsxs("div",{className:"relative mt-1.5",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:m,onChange:ue=>p(ue.target.value),className:"pl-9"})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-known",children:"认识状态"}),a.jsxs(Lt,{value:x===void 0?"all":x.toString(),onValueChange:ue=>{v(ue==="all"?void 0:ue==="true"),c(1)},children:[a.jsx(Dt,{id:"filter-known",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"true",children:"已认识"}),a.jsx(Pe,{value:"false",children:"未认识"})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-platform",children:"平台"}),a.jsxs(Lt,{value:b||"all",onValueChange:ue=>{k(ue==="all"?void 0:ue),c(1)},children:[a.jsx(Dt,{id:"filter-platform",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部平台"}),Y.map(ue=>a.jsxs(Pe,{value:ue,children:[ue," (",Q.platforms[ue],")"]},ue))]})]})]})]}),a.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:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:L.size>0&&a.jsxs("span",{children:["已选择 ",L.size," 个人物"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:ue=>{h(parseInt(ue)),c(1),U(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),L.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>U(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:H,children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&L.size===t.length,onCheckedChange:K,"aria-label":"全选"})}),a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"昵称"}),a.jsx(xt,{children:"平台"}),a.jsx(xt,{children:"用户ID"}),a.jsx(xt,{children:"最后更新"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(ue=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:L.has(ue.person_id),onCheckedChange:()=>P(ue.person_id),"aria-label":`选择 ${ue.person_name||ue.nickname||ue.user_id}`})}),a.jsx(it,{children:a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",ue.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:ue.is_known?"已认识":"未认识"})}),a.jsx(it,{className:"font-medium",children:ue.person_name||a.jsx("span",{className:"text-muted-foreground",children:"-"})}),a.jsx(it,{children:ue.nickname||"-"}),a.jsx(it,{children:ue.platform}),a.jsx(it,{className:"font-mono text-sm",children:ue.user_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:Re(ue.last_know)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ce(ue),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>z(ue),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>R(ue),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ue.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(ue=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:L.has(ue.person_id),onCheckedChange:()=>P(ue.person_id),className:"mt-1"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",ue.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:ue.is_known?"已认识":"未认识"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:ue.person_name||a.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),ue.nickname&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",ue.nickname]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),a.jsx("p",{className:"font-medium text-xs",children:ue.platform})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),a.jsx("p",{className:"font-mono text-xs truncate",title:ue.user_id,children:ue.user_id})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),a.jsx("p",{className:"text-xs",children:Re(ue.last_know)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ce(ue),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>z(ue),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>R(ue),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ue.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:W,onChange:ue=>J(ue.target.value),onKeyDown:ue=>ue.key==="Enter"&&ve(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ve,disabled:!W,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(_de,{person:O,open:T,onOpenChange:A}),a.jsx(Dde,{person:O,open:_,onOpenChange:D,onSuccess:()=>{ae(),ne(),D(!1)}}),a.jsx(mn,{open:!!E,onOpenChange:()=>R(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>E&&xe(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(mn,{open:V,onOpenChange:de,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",L.size," 个人物信息吗? 此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:fe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function _de({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"人物详情"}),a.jsxs(Gr,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Za,{icon:D9,label:"人物名称",value:t.person_name}),a.jsx(Za,{icon:Wf,label:"昵称",value:t.nickname}),a.jsx(Za,{icon:mg,label:"用户ID",value:t.user_id,mono:!0}),a.jsx(Za,{icon:mg,label:"人物ID",value:t.person_id,mono:!0}),a.jsx(Za,{label:"平台",value:t.platform}),a.jsx(Za,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),a.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"个人印象"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"群昵称"}),a.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>a.jsxs("div",{className:"text-sm flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),a.jsx("span",{children:"→"}),a.jsx("span",{children:s.group_nick_name})]},i))})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(Za,{icon:dc,label:"认识时间",value:r(t.know_times)}),a.jsx(Za,{icon:dc,label:"首次记录",value:r(t.know_since)}),a.jsx(Za,{icon:dc,label:"最后更新",value:r(t.last_know)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Za({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Dde({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.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{c(!0),await Cde(t.person_id,s),d({title:"保存成功",description:"人物信息已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新人物信息",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑人物信息"}),a.jsxs(Gr,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"person_name",children:"人物名称"}),a.jsx(Me,{id:"person_name",value:s.person_name||"",onChange:m=>i({...s,person_name:m.target.value}),placeholder:"为这个人设置一个名称"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:s.nickname||"",onChange:m=>i({...s,nickname:m.target.value}),placeholder:"昵称"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"name_reason",children:"名称设定原因"}),a.jsx(_n,{id:"name_reason",value:s.name_reason||"",onChange:m=>i({...s,name_reason:m.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"memory_points",children:"个人印象"}),a.jsx(_n,{id:"memory_points",value:s.memory_points||"",onChange:m=>i({...s,memory_points:m.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),a.jsx(jt,{id:"is_known",checked:s.is_known,onCheckedChange:m=>i({...s,is_known:m})})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Rde(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 zde={},Wh={};function uc(t,e){try{const r=(zde[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Wh?Wh[r]:VN(r,r.split(":"))}catch{if(t in Wh)return Wh[t];const n=t?.match(Pde);return n?VN(t,n.slice(1)):NaN}}const Pde=/([+-]\d\d):?(\d\d)?/;function VN(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return Wh[t]=n*60+r>0?n*60+r+s:n*60-r-s}class xa extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(uc(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)),lz(this),R4(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new xa(...n,e):new xa(Date.now(),e)}withTimeZone(e){return new xa(+this,e)}getTimezoneOffset(){const e=-uc(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),R4(this),+this}[Symbol.for("constructDateFrom")](e){return new xa(+new Date(e),this.timeZone)}}const WN=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!WN.test(t))return;const e=t.replace(WN,"$1UTC");xa.prototype[e]&&(t.startsWith("get")?xa.prototype[t]=function(){return this.internal[e]()}:(xa.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),Bde(this),+this},xa.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),R4(this),+this}))});function R4(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-uc(t.timeZone,t)*60))}function Bde(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()),lz(t)}function lz(t){const e=uc(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(),l=s-i,c=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();l&&c&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+l);const d=s-n;d&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+d);const h=new Date(+t);h.setUTCSeconds(0);const m=s>0?h.getSeconds():(h.getSeconds()-60)%60,p=Math.round(-(uc(t.timeZone,t)*60))%60;(p||m)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+p),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+p+m));const x=uc(t.timeZone,t),v=x>0?Math.floor(x):Math.ceil(x),k=-new Date(+t).getTimezoneOffset()-v,O=v!==n,j=k-d;if(O&&j){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+j);const T=uc(t.timeZone,t),A=T>0?Math.floor(T):Math.ceil(T),_=v-A;_&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+_),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_))}}class Zr extends xa{static tz(e,...n){return n.length?new Zr(...n,e):new Zr(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} (${Rde(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 Zr(+this,e)}[Symbol.for("constructDateFrom")](e){return new Zr(+new Date(e),this.timeZone)}}const oz=6048e5,Lde=864e5,GN=Symbol.for("constructDateFrom");function vr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&GN in t?t[GN](e):t instanceof Date?new t.constructor(e):new Date(e)}function Nn(t,e){return vr(e||t,t)}function cz(t,e,n){const r=Nn(t,n?.in);return isNaN(e)?vr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function uz(t,e,n){const r=Nn(t,n?.in);if(isNaN(e))return vr(t,NaN);if(!e)return r;const s=r.getDate(),i=vr(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const l=i.getDate();return s>=l?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let Ide={};function O0(){return Ide}function So(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i=i.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function XN(t){const e=Nn(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 Bc(t,...e){const n=vr.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function Qf(t,e){const n=Nn(t,e?.in);return n.setHours(0,0,0,0),n}function hz(t,e,n){const[r,s]=Bc(n?.in,t,e),i=Qf(r),l=Qf(s),c=+i-XN(i),d=+l-XN(l);return Math.round((c-d)/Lde)}function qde(t,e){const n=dz(t,e),r=vr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ff(r)}function Fde(t,e,n){return cz(t,e*7,n)}function Qde(t,e,n){return uz(t,e*12,n)}function $de(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),vr(r,n||NaN)}function Ude(t,e,n){const[r,s]=Bc(n?.in,t,e);return+Qf(r)==+Qf(s)}function fz(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Vde(t){return!(!fz(t)&&typeof t!="number"||isNaN(+Nn(t)))}function Wde(t,e,n){const[r,s]=Bc(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),l=r.getMonth()-s.getMonth();return i*12+l}function Gde(t,e){const n=Nn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function mz(t,e){const[n,r]=Bc(t,e.start,e.end);return{start:n,end:r}}function Xde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setDate(1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setMonth(l.getMonth()+c);return s?d.reverse():d}function Yde(t,e){const n=Nn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Kde(t,e){const n=Nn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function pz(t,e){const n=Nn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Zde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setMonth(0,1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setFullYear(l.getFullYear()+c);return s?d.reverse():d}function gz(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i{let r;const s=ehe[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 td(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const nhe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rhe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},she={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ihe={date:td({formats:nhe,defaultWidth:"full"}),time:td({formats:rhe,defaultWidth:"full"}),dateTime:td({formats:she,defaultWidth:"full"})},ahe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},lhe=(t,e,n,r)=>ahe[t];function ua(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,c=n?.width?String(n.width):l;s=t.formattingValues[c]||t.formattingValues[l]}else{const l=t.defaultWidth,c=n?.width?String(n.width):t.defaultWidth;s=t.values[c]||t.values[l]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const ohe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},che={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},uhe={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"]},dhe={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"]},hhe={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"}},fhe={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"}},mhe=(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"},phe={ordinalNumber:mhe,era:ua({values:ohe,defaultWidth:"wide"}),quarter:ua({values:che,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:uhe,defaultWidth:"wide"}),day:ua({values:dhe,defaultWidth:"wide"}),dayPeriod:ua({values:hhe,defaultWidth:"wide",formattingValues:fhe,defaultFormattingWidth:"wide"})};function da(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 l=i[0],c=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(c)?xhe(c,p=>p.test(l)):ghe(c,p=>p.test(l));let h;h=t.valueCallback?t.valueCallback(d):d,h=n.valueCallback?n.valueCallback(h):h;const m=e.slice(l.length);return{value:h,rest:m}}}function ghe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function xhe(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let l=t.valueCallback?t.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const c=e.slice(s.length);return{value:l,rest:c}}}const vhe=/^(\d+)(th|st|nd|rd)?/i,yhe=/\d+/i,bhe={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},whe={any:[/^b/i,/^(a|c)/i]},She={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},khe={any:[/1/i,/2/i,/3/i,/4/i]},Ohe={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},jhe={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]},Nhe={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},Che={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]},The={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},Ahe={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}},Mhe={ordinalNumber:xz({matchPattern:vhe,parsePattern:yhe,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:bhe,defaultMatchWidth:"wide",parsePatterns:whe,defaultParseWidth:"any"}),quarter:da({matchPatterns:She,defaultMatchWidth:"wide",parsePatterns:khe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:Ohe,defaultMatchWidth:"wide",parsePatterns:jhe,defaultParseWidth:"any"}),day:da({matchPatterns:Nhe,defaultMatchWidth:"wide",parsePatterns:Che,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:The,defaultMatchWidth:"any",parsePatterns:Ahe,defaultParseWidth:"any"})},G5={code:"en-US",formatDistance:the,formatLong:ihe,formatRelative:lhe,localize:phe,match:Mhe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ehe(t,e){const n=Nn(t,e?.in);return hz(n,pz(n))+1}function vz(t,e){const n=Nn(t,e?.in),r=+Ff(n)-+qde(n);return Math.round(r/oz)+1}function yz(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=O0(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,l=vr(e?.in||t,0);l.setFullYear(r+1,0,i),l.setHours(0,0,0,0);const c=So(l,e),d=vr(e?.in||t,0);d.setFullYear(r,0,i),d.setHours(0,0,0,0);const h=So(d,e);return+n>=+c?r+1:+n>=+h?r:r-1}function _he(t,e){const n=O0(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=yz(t,e),i=vr(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),So(i,e)}function bz(t,e){const n=Nn(t,e?.in),r=+So(n,e)-+_he(n,e);return Math.round(r/oz)+1}function xn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Zl={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return xn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):xn(n+1,2)},d(t,e){return xn(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 xn(t.getHours()%12||12,e.length)},H(t,e){return xn(t.getHours(),e.length)},m(t,e){return xn(t.getMinutes(),e.length)},s(t,e){return xn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return xn(s,e.length)}},Mu={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},YN={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 Zl.y(t,e)},Y:function(t,e,n,r){const s=yz(t,r),i=s>0?s:1-s;if(e==="YY"){const l=i%100;return xn(l,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):xn(i,e.length)},R:function(t,e){const n=dz(t);return xn(n,e.length)},u:function(t,e){const n=t.getFullYear();return xn(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 xn(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 xn(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 Zl.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 xn(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=bz(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):xn(s,e.length)},I:function(t,e,n){const r=vz(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):xn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Zl.d(t,e)},D:function(t,e,n){const r=Ehe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):xn(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 xn(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 xn(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 xn(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=Mu.noon:r===0?s=Mu.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=Mu.evening:r>=12?s=Mu.afternoon:r>=4?s=Mu.morning:s=Mu.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 Zl.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Zl.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):xn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):xn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Zl.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Zl.s(t,e)},S:function(t,e){return Zl.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ZN(r);case"XXXX":case"XX":return rc(r);case"XXXXX":case"XXX":default:return rc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ZN(r);case"xxxx":case"xx":return rc(r);case"xxxxx":case"xxx":default:return rc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+KN(r,":");case"OOOO":default:return"GMT"+rc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+KN(r,":");case"zzzz":default:return"GMT"+rc(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return xn(r,e.length)},T:function(t,e,n){return xn(+t,e.length)}};function KN(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+xn(i,2)}function ZN(t,e){return t%60===0?(t>0?"-":"+")+xn(Math.abs(t)/60,2):rc(t,e)}function rc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=xn(Math.trunc(r/60),2),i=xn(r%60,2);return n+s+e+i}const JN=(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"})}},wz=(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"})}},Dhe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return JN(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}}",JN(r,e)).replace("{{time}}",wz(s,e))},Rhe={p:wz,P:Dhe},zhe=/^D+$/,Phe=/^Y+$/,Bhe=["D","DD","YY","YYYY"];function Lhe(t){return zhe.test(t)}function Ihe(t){return Phe.test(t)}function qhe(t,e,n){const r=Fhe(t,e,n);if(console.warn(r),Bhe.includes(t))throw new RangeError(r)}function Fhe(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 Qhe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$he=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hhe=/^'([^]*?)'?$/,Uhe=/''/g,Vhe=/[a-zA-Z]/;function dg(t,e,n){const r=O0(),s=n?.locale??r.locale??G5,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,c=Nn(t,n?.in);if(!Vde(c))throw new RangeError("Invalid time value");let d=e.match($he).map(m=>{const p=m[0];if(p==="p"||p==="P"){const x=Rhe[p];return x(m,s.formatLong)}return m}).join("").match(Qhe).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const p=m[0];if(p==="'")return{isToken:!1,value:Whe(m)};if(YN[p])return{isToken:!0,value:m};if(p.match(Vhe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:m}});s.localize.preprocessor&&(d=s.localize.preprocessor(c,d));const h={firstWeekContainsDate:i,weekStartsOn:l,locale:s};return d.map(m=>{if(!m.isToken)return m.value;const p=m.value;(!n?.useAdditionalWeekYearTokens&&Ihe(p)||!n?.useAdditionalDayOfYearTokens&&Lhe(p))&&qhe(p,e,String(t));const x=YN[p[0]];return x(c,p,s.localize,h)}).join("")}function Whe(t){const e=t.match(Hhe);return e?e[1].replace(Uhe,"'"):t}function Ghe(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=vr(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Xhe(t,e){return Nn(t,e?.in).getMonth()}function Yhe(t,e){return Nn(t,e?.in).getFullYear()}function Khe(t,e){return+Nn(t)>+Nn(e)}function Zhe(t,e){return+Nn(t)<+Nn(e)}function Jhe(t,e,n){const[r,s]=Bc(n?.in,t,e);return+So(r,n)==+So(s,n)}function efe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function tfe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function nfe(t,e,n){const r=Nn(t,n?.in),s=r.getFullYear(),i=r.getDate(),l=vr(t,0);l.setFullYear(s,e,15),l.setHours(0,0,0,0);const c=Ghe(l);return r.setMonth(e,Math.min(i,c)),r}function rfe(t,e,n){const r=Nn(t,n?.in);return isNaN(+r)?vr(t,NaN):(r.setFullYear(e),r)}const e9=5,sfe=4;function ife(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,e9*7-1);return e.getMonth(t)===e.getMonth(i)?e9:sfe}function Sz(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 afe(t,e){const n=Sz(t,e),r=ife(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?Zr.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 Zr(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):cz(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):uz(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):Fde(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):Qde(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):hz(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):Wde(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Xde(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Zde(r),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const l=[];return i.forEach(c=>{l.push(new Date(c,0,1))}),l},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):afe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Jde(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Gde(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):gz(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Kde(r),this.format=(r,s,i)=>{const l=this.overrides?.format?this.overrides.format(r,s,this.options):dg(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):vz(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Xhe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Yhe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):bz(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):Khe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):Zhe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):fz(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):Ude(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):efe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):tfe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):$de(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Hde(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):nfe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):rfe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Sz(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Qf(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Ff(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Yde(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):So(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):pz(r),this.options={locale:G5,...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 l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,l)}}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 Ma=new ai;class kz{constructor(e,n,r=Ma){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 lfe{constructor(e,n){this.date=e,this.weeks=n}}class ofe{constructor(e,n){this.days=n,this.weekNumber=e}}function cfe(t){return Ue.createElement("button",{...t})}function ufe(t){return Ue.createElement("span",{...t})}function dfe(t){const{size:e=24,orientation:n="left",className:r}=t;return Ue.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&Ue.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Ue.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Ue.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Ue.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function hfe(t){const{day:e,modifiers:n,...r}=t;return Ue.createElement("td",{...r})}function ffe(t){const{day:e,modifiers:n,...r}=t,s=Ue.useRef(null);return Ue.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),Ue.createElement("button",{ref:s,...r})}var et;(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"})(et||(et={}));var Yn;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(Yn||(Yn={}));var qi;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(qi||(qi={}));var ti;(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"})(ti||(ti={}));function mfe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,l=[s[et.Dropdown],n].join(" "),c=e?.find(({value:d})=>d===i.value);return Ue.createElement("span",{"data-disabled":i.disabled,className:s[et.DropdownRoot]},Ue.createElement(r.Select,{className:l,...i},e?.map(({value:d,label:h,disabled:m})=>Ue.createElement(r.Option,{key:d,value:d,disabled:m},h))),Ue.createElement("span",{className:s[et.CaptionLabel],"aria-hidden":!0},c?.label,Ue.createElement(r.Chevron,{orientation:"down",size:18,className:s[et.Chevron]})))}function pfe(t){return Ue.createElement("div",{...t})}function gfe(t){return Ue.createElement("div",{...t})}function xfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r},t.children)}function vfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r})}function yfe(t){return Ue.createElement("table",{...t})}function bfe(t){return Ue.createElement("div",{...t})}const Oz=S.createContext(void 0);function j0(){const t=S.useContext(Oz);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function wfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}function Sfe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:l,classNames:c,labels:{labelPrevious:d,labelNext:h}}=j0(),m=S.useCallback(x=>{s&&n?.(x)},[s,n]),p=S.useCallback(x=>{r&&e?.(x)},[r,e]);return Ue.createElement("nav",{...i},Ue.createElement(l.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:p},Ue.createElement(l.Chevron,{disabled:r?void 0:!0,className:c[et.Chevron],orientation:"left"})),Ue.createElement(l.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:m},Ue.createElement(l.Chevron,{disabled:s?void 0:!0,orientation:"right",className:c[et.Chevron]})))}function kfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Ofe(t){return Ue.createElement("option",{...t})}function jfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Nfe(t){const{rootRef:e,...n}=t;return Ue.createElement("div",{...n,ref:e})}function Cfe(t){return Ue.createElement("select",{...t})}function Tfe(t){const{week:e,...n}=t;return Ue.createElement("tr",{...n})}function Afe(t){return Ue.createElement("th",{...t})}function Mfe(t){return Ue.createElement("thead",{"aria-hidden":!0},Ue.createElement("tr",{...t}))}function Efe(t){const{week:e,...n}=t;return Ue.createElement("th",{...n})}function _fe(t){return Ue.createElement("th",{...t})}function Dfe(t){return Ue.createElement("tbody",{...t})}function Rfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}const zfe=Object.freeze(Object.defineProperty({__proto__:null,Button:cfe,CaptionLabel:ufe,Chevron:dfe,Day:hfe,DayButton:ffe,Dropdown:mfe,DropdownNav:pfe,Footer:gfe,Month:xfe,MonthCaption:vfe,MonthGrid:yfe,Months:bfe,MonthsDropdown:wfe,Nav:Sfe,NextMonthButton:kfe,Option:Ofe,PreviousMonthButton:jfe,Root:Nfe,Select:Cfe,Week:Tfe,WeekNumber:Efe,WeekNumberHeader:_fe,Weekday:Afe,Weekdays:Mfe,Weeks:Dfe,YearsDropdown:Rfe},Symbol.toStringTag,{value:"Module"}));function ll(t,e,n=!1,r=Ma){let{from:s,to:i}=t;const{differenceInCalendarDays:l,isSameDay:c}=r;return s&&i?(l(i,s)<0&&([s,i]=[i,s]),l(e,s)>=(n?1:0)&&l(i,e)>=(n?1:0)):!n&&i?c(i,e):!n&&s?c(s,e):!1}function jz(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function X5(t){return!!(t&&typeof t=="object"&&"from"in t)}function Nz(t){return!!(t&&typeof t=="object"&&"after"in t)}function Cz(t){return!!(t&&typeof t=="object"&&"before"in t)}function Tz(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Az(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ol(t,e,n=Ma){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:l}=n;return r.some(c=>{if(typeof c=="boolean")return c;if(n.isDate(c))return s(t,c);if(Az(c,n))return c.includes(t);if(X5(c))return ll(c,t,!1,n);if(Tz(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(t.getDay()):c.dayOfWeek===t.getDay();if(jz(c)){const d=i(c.before,t),h=i(c.after,t),m=d>0,p=h<0;return l(c.before,c.after)?p&&m:m||p}return Nz(c)?i(t,c.after)>0:Cz(c)?i(c.before,t)>0:typeof c=="function"?c(t):!1})}function Pfe(t,e,n,r,s){const{disabled:i,hidden:l,modifiers:c,showOutsideDays:d,broadcastCalendar:h,today:m}=e,{isSameDay:p,isSameMonth:x,startOfMonth:v,isBefore:b,endOfMonth:k,isAfter:O}=s,j=n&&v(n),T=r&&k(r),A={[Yn.focused]:[],[Yn.outside]:[],[Yn.disabled]:[],[Yn.hidden]:[],[Yn.today]:[]},_={};for(const D of t){const{date:E,displayMonth:R}=D,Q=!!(R&&!x(E,R)),F=!!(j&&b(E,j)),L=!!(T&&O(E,T)),U=!!(i&&ol(E,i,s)),V=!!(l&&ol(E,l,s))||F||L||!h&&!d&&Q||h&&d===!1&&Q,de=p(E,m??s.today());Q&&A.outside.push(D),U&&A.disabled.push(D),V&&A.hidden.push(D),de&&A.today.push(D),c&&Object.keys(c).forEach(W=>{const J=c?.[W];J&&ol(E,J,s)&&(_[W]?_[W].push(D):_[W]=[D])})}return D=>{const E={[Yn.focused]:!1,[Yn.disabled]:!1,[Yn.hidden]:!1,[Yn.outside]:!1,[Yn.today]:!1},R={};for(const Q in A){const F=A[Q];E[Q]=F.some(L=>L===D)}for(const Q in _)R[Q]=_[Q].some(F=>F===D);return{...E,...R}}}function Bfe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[Yn[i]]?s.push(e[Yn[i]]):e[qi[i]]&&s.push(e[qi[i]]),s),[e[et.Day]])}function Lfe(t){return{...zfe,...t}}function Ife(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 Y5(){const t={};for(const e in et)t[et[e]]=`rdp-${et[e]}`;for(const e in Yn)t[Yn[e]]=`rdp-${Yn[e]}`;for(const e in qi)t[qi[e]]=`rdp-${qi[e]}`;for(const e in ti)t[ti[e]]=`rdp-${ti[e]}`;return t}function Mz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const qfe=Mz;function Ffe(t,e,n){return(n??new ai(e)).format(t,"d")}function Qfe(t,e=Ma){return e.format(t,"LLLL")}function $fe(t,e,n){return(n??new ai(e)).format(t,"cccccc")}function Hfe(t,e=Ma){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Ufe(){return""}function Ez(t,e=Ma){return e.format(t,"yyyy")}const Vfe=Ez,Wfe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Mz,formatDay:Ffe,formatMonthCaption:qfe,formatMonthDropdown:Qfe,formatWeekNumber:Hfe,formatWeekNumberHeader:Ufe,formatWeekdayName:$fe,formatYearCaption:Vfe,formatYearDropdown:Ez},Symbol.toStringTag,{value:"Module"}));function Gfe(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...Wfe,...t}}function Xfe(t,e,n,r,s){const{startOfMonth:i,startOfYear:l,endOfYear:c,eachMonthOfInterval:d,getMonth:h}=s;return d({start:l(t),end:c(t)}).map(x=>{const v=r.formatMonthDropdown(x,s),b=h(x),k=e&&xi(n)||!1;return{value:b,label:v,disabled:k}})}function Yfe(t,e={},n={}){let r={...e?.[et.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function Kfe(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let l=0;l<7;l++){const c=t.addDays(s,l);i.push(c)}return i}function Zfe(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:l,eachYearOfInterval:c,getYear:d}=r,h=i(t),m=l(e),p=c({start:h,end:m});return s&&p.reverse(),p.map(x=>{const v=n.formatYearDropdown(x,r);return{value:d(x),label:v,disabled:!1}})}function _z(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 Jfe=_z;function Dz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const e0e=Dz;function t0e(t,e,n,r){let s=(r??new ai(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function n0e(t){return"Choose the Month"}function r0e(){return""}function s0e(t){return"Go to the Next Month"}function i0e(t){return"Go to the Previous Month"}function a0e(t,e,n){return(n??new ai(e)).format(t,"cccc")}function l0e(t,e){return`Week ${t}`}function o0e(t){return"Week Number"}function c0e(t){return"Choose the Year"}const u0e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:e0e,labelDay:Jfe,labelDayButton:_z,labelGrid:Dz,labelGridcell:t0e,labelMonthDropdown:n0e,labelNav:r0e,labelNext:s0e,labelPrevious:i0e,labelWeekNumber:l0e,labelWeekNumberHeader:o0e,labelWeekday:a0e,labelYearDropdown:c0e},Symbol.toStringTag,{value:"Module"})),N0=t=>t instanceof HTMLElement?t:null,Ub=t=>[...t.querySelectorAll("[data-animated-month]")??[]],d0e=t=>N0(t.querySelector("[data-animated-month]")),Vb=t=>N0(t.querySelector("[data-animated-caption]")),Wb=t=>N0(t.querySelector("[data-animated-weeks]")),h0e=t=>N0(t.querySelector("[data-animated-nav]")),f0e=t=>N0(t.querySelector("[data-animated-weekdays]"));function m0e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const l=S.useRef(null),c=S.useRef(r),d=S.useRef(!1);S.useLayoutEffect(()=>{const h=c.current;if(c.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const m=i.isSameMonth(r[0].date,h[0].date),p=i.isAfter(r[0].date,h[0].date),x=p?n[ti.caption_after_enter]:n[ti.caption_before_enter],v=p?n[ti.weeks_after_enter]:n[ti.weeks_before_enter],b=l.current,k=t.current.cloneNode(!0);if(k instanceof HTMLElement?(Ub(k).forEach(A=>{if(!(A instanceof HTMLElement))return;const _=d0e(A);_&&A.contains(_)&&A.removeChild(_);const D=Vb(A);D&&D.classList.remove(x);const E=Wb(A);E&&E.classList.remove(v)}),l.current=k):l.current=null,d.current||m||s)return;const O=b instanceof HTMLElement?Ub(b):[],j=Ub(t.current);if(j?.every(T=>T instanceof HTMLElement)&&O&&O.every(T=>T instanceof HTMLElement)){d.current=!0,t.current.style.isolation="isolate";const T=h0e(t.current);T&&(T.style.zIndex="1"),j.forEach((A,_)=>{const D=O[_];if(!D)return;A.style.position="relative",A.style.overflow="hidden";const E=Vb(A);E&&E.classList.add(x);const R=Wb(A);R&&R.classList.add(v);const Q=()=>{d.current=!1,t.current&&(t.current.style.isolation=""),T&&(T.style.zIndex=""),E&&E.classList.remove(x),R&&R.classList.remove(v),A.style.position="",A.style.overflow="",A.contains(D)&&A.removeChild(D)};D.style.pointerEvents="none",D.style.position="absolute",D.style.overflow="hidden",D.setAttribute("aria-hidden","true");const F=f0e(D);F&&(F.style.opacity="0");const L=Vb(D);L&&(L.classList.add(p?n[ti.caption_before_exit]:n[ti.caption_after_exit]),L.addEventListener("animationend",Q));const U=Wb(D);U&&U.classList.add(p?n[ti.weeks_before_exit]:n[ti.weeks_after_exit]),A.insertBefore(D,A.firstChild)})}})}function p0e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:l,fixedWeeks:c,broadcastCalendar:d}=n??{},{addDays:h,differenceInCalendarDays:m,differenceInCalendarMonths:p,endOfBroadcastWeek:x,endOfISOWeek:v,endOfMonth:b,endOfWeek:k,isAfter:O,startOfBroadcastWeek:j,startOfISOWeek:T,startOfWeek:A}=r,_=d?j(s,r):l?T(s):A(s),D=d?x(i):l?v(b(i)):k(b(i)),E=m(D,_),R=p(i,s)+1,Q=[];for(let U=0;U<=E;U++){const V=h(_,U);if(e&&O(V,e))break;Q.push(V)}const L=(d?35:42)*R;if(c&&Q.length{const s=r.weeks.reduce((i,l)=>i.concat(l.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function x0e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let l=0;le)break;i.push(c)}return i}function t9(t,e,n,r){const{month:s,defaultMonth:i,today:l=r.today(),numberOfMonths:c=1}=t;let d=s||i||l;const{differenceInCalendarMonths:h,addMonths:m,startOfMonth:p}=r;if(n&&h(n,d){const j=n.broadcastCalendar?p(O,r):n.ISOWeek?x(O):v(O),T=n.broadcastCalendar?i(O):n.ISOWeek?l(c(O)):d(c(O)),A=e.filter(R=>R>=j&&R<=T),_=n.broadcastCalendar?35:42;if(n.fixedWeeks&&A.length<_){const R=e.filter(Q=>{const F=_-A.length;return Q>T&&Q<=s(T,F)});A.push(...R)}const D=A.reduce((R,Q)=>{const F=n.ISOWeek?h(Q):m(Q),L=R.find(V=>V.weekNumber===F),U=new kz(Q,O,r);return L?L.days.push(U):R.push(new ofe(F,[U])),R},[]),E=new lfe(O,D);return k.push(E),k},[]);return n.reverseMonths?b.reverse():b}function y0e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:l,endOfMonth:c,addYears:d,endOfYear:h,newDate:m,today:p}=e,{fromYear:x,toYear:v,fromMonth:b,toMonth:k}=t;!n&&b&&(n=b),!n&&x&&(n=e.newDate(x,0,1)),!r&&k&&(r=k),!r&&v&&(r=m(v,11,31));const O=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=l(n):x?n=m(x,0,1):!n&&O&&(n=s(d(t.today??p(),-100))),r?r=c(r):v?r=m(v,11,31):!r&&O&&(r=h(t.today??p())),[n&&i(n),r&&i(r)]}function b0e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:d}=r,h=s?i:1,m=l(t);if(!e)return c(m,h);if(!(d(e,t)n.concat(r.weeks.slice()),e.slice())}function Yx(t,e){const[n,r]=S.useState(t);return[e===void 0?n:e,r]}function k0e(t,e){const[n,r]=y0e(t,e),{startOfMonth:s,endOfMonth:i}=e,l=t9(t,n,r,e),[c,d]=Yx(l,t.month?l:void 0);S.useEffect(()=>{const E=t9(t,n,r,e);d(E)},[t.timeZone]);const h=x0e(c,r,t,e),m=p0e(h,t.endMonth?i(t.endMonth):void 0,t,e),p=v0e(h,m,t,e),x=S0e(p),v=g0e(p),b=w0e(c,n,t,e),k=b0e(c,r,t,e),{disableNavigation:O,onMonthChange:j}=t,T=E=>x.some(R=>R.days.some(Q=>Q.isEqualTo(E))),A=E=>{if(O)return;let R=s(E);n&&Rs(r)&&(R=s(r)),d(R),j?.(R)};return{months:p,weeks:x,days:v,navStart:n,navEnd:r,previousMonth:b,nextMonth:k,goToMonth:A,goToDay:E=>{T(E)||A(E.date)}}}var aa;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(aa||(aa={}));function n9(t){return!t[Yn.disabled]&&!t[Yn.hidden]&&!t[Yn.outside]}function O0e(t,e,n,r){let s,i=-1;for(const l of t){const c=e(l);n9(c)&&(c[Yn.focused]&&in9(e(l)))),s}function j0e(t,e,n,r,s,i,l){const{ISOWeek:c,broadcastCalendar:d}=i,{addDays:h,addMonths:m,addWeeks:p,addYears:x,endOfBroadcastWeek:v,endOfISOWeek:b,endOfWeek:k,max:O,min:j,startOfBroadcastWeek:T,startOfISOWeek:A,startOfWeek:_}=l;let E={day:h,week:p,month:m,year:x,startOfWeek:R=>d?T(R,l):c?A(R):_(R),endOfWeek:R=>d?v(R):c?b(R):k(R)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=O([r,E]):e==="after"&&s&&(E=j([s,E])),E}function Rz(t,e,n,r,s,i,l,c=0){if(c>365)return;const d=j0e(t,e,n.date,r,s,i,l),h=!!(i.disabled&&ol(d,i.disabled,l)),m=!!(i.hidden&&ol(d,i.hidden,l)),p=d,x=new kz(d,p,l);return!h&&!m?x:Rz(t,e,x,r,s,i,l,c+1)}function N0e(t,e,n,r,s){const{autoFocus:i}=t,[l,c]=S.useState(),d=O0e(e.days,n,r||(()=>!1),l),[h,m]=S.useState(i?d:void 0);return{isFocusTarget:k=>!!d?.isEqualTo(k),setFocused:m,focused:h,blur:()=>{c(h),m(void 0)},moveFocus:(k,O)=>{if(!h)return;const j=Rz(k,O,h,e.navStart,e.navEnd,t,s);j&&(t.disableNavigation&&!e.days.some(A=>A.isEqualTo(j))||(e.goToDay(j),m(j)))}}}function C0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e,h=v=>c?.some(b=>d(b,v))??!1,{min:m,max:p}=t;return{selected:c,select:(v,b,k)=>{let O=[...c??[]];if(h(v)){if(c?.length===m||r&&c?.length===1)return;O=c?.filter(j=>!d(j,v))}else c?.length===p?O=[v]:O=[...O,v];return s||l(O),s?.(O,v,b,k),O},isSelected:h}}function T0e(t,e,n=0,r=0,s=!1,i=Ma){const{from:l,to:c}=e||{},{isSameDay:d,isAfter:h,isBefore:m}=i;let p;if(!l&&!c)p={from:t,to:n>0?void 0:t};else if(l&&!c)d(l,t)?n===0?p={from:l,to:t}:s?p={from:l,to:void 0}:p=void 0:m(t,l)?p={from:t,to:l}:p={from:l,to:t};else if(l&&c)if(d(l,t)&&d(c,t))s?p={from:l,to:c}:p=void 0;else if(d(l,t))p={from:l,to:n>0?void 0:t};else if(d(c,t))p={from:t,to:n>0?void 0:t};else if(m(t,l))p={from:t,to:c};else if(h(t,l))p={from:l,to:t};else if(h(t,c))p={from:l,to:t};else throw new Error("Invalid range");if(p?.from&&p?.to){const x=i.differenceInCalendarDays(p.to,p.from);r>0&&x>r?p={from:t,to:void 0}:n>1&&xtypeof c!="function").some(c=>typeof c=="boolean"?c:n.isDate(c)?ll(t,c,!1,n):Az(c,n)?c.some(d=>ll(t,d,!1,n)):X5(c)?c.from&&c.to?r9(t,{from:c.from,to:c.to},n):!1:Tz(c)?A0e(t,c.dayOfWeek,n):jz(c)?n.isAfter(c.before,c.after)?r9(t,{from:n.addDays(c.after,1),to:n.addDays(c.before,-1)},n):ol(t.from,c,n)||ol(t.to,c,n):Nz(c)||Cz(c)?ol(t.from,c,n)||ol(t.to,c,n):!1))return!0;const l=r.filter(c=>typeof c=="function");if(l.length){let c=t.from;const d=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=d;h++){if(l.some(m=>m(c)))return!0;c=n.addDays(c,1)}}return!1}function E0e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:l}=t,[c,d]=Yx(s,l?s:void 0),h=l?s:c;return{selected:h,select:(x,v,b)=>{const{min:k,max:O}=t,j=x?T0e(x,h,k,O,i,e):void 0;return r&&n&&j?.from&&j.to&&M0e({from:j.from,to:j.to},n,e)&&(j.from=x,j.to=void 0),l||d(j),l?.(j,x,v,b),j},isSelected:x=>h&&ll(h,x,!1,e)}}function _0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e;return{selected:c,select:(p,x,v)=>{let b=p;return!r&&c&&c&&d(p,c)&&(b=void 0),s||l(b),s?.(b,p,x,v),b},isSelected:p=>c?d(c,p):!1}}function D0e(t,e){const n=_0e(t,e),r=C0e(t,e),s=E0e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function R0e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new Zr(e.today,e.timeZone)),e.month&&(e.month=new Zr(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new Zr(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new Zr(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new Zr(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new Zr(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(dt=>new Zr(dt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new Zr(e.selected.from,e.timeZone):void 0,to:e.selected.to?new Zr(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:l,classNames:c}=S.useMemo(()=>{const dt={...G5,...e.locale};return{dateLib:new ai({locale:dt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:Lfe(e.components),formatters:Gfe(e.formatters),labels:{...u0e,...e.labels},locale:dt,classNames:{...Y5(),...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:d,mode:h,navLayout:m,numberOfMonths:p=1,onDayBlur:x,onDayClick:v,onDayFocus:b,onDayKeyDown:k,onDayMouseEnter:O,onDayMouseLeave:j,onNextClick:T,onPrevClick:A,showWeekNumber:_,styles:D}=e,{formatCaption:E,formatDay:R,formatMonthDropdown:Q,formatWeekNumber:F,formatWeekNumberHeader:L,formatWeekdayName:U,formatYearDropdown:V}=r,de=k0e(e,i),{days:W,months:J,navStart:$,navEnd:ae,previousMonth:ne,nextMonth:ce,goToMonth:z}=de,xe=Pfe(W,e,$,ae,i),{isSelected:Y,select:P,selected:K}=D0e(e,i)??{},{blur:H,focused:fe,isFocusTarget:ve,moveFocus:Re,setFocused:ue}=N0e(e,de,xe,Y??(()=>!1),i),{labelDayButton:We,labelGridcell:ct,labelGrid:Oe,labelMonthDropdown:nt,labelNav:ut,labelPrevious:Ct,labelNext:In,labelWeekday:Tn,labelWeekNumber:Jn,labelWeekNumberHeader:nn,labelYearDropdown:_t}=s,Yr=S.useMemo(()=>Kfe(i,e.ISOWeek),[i,e.ISOWeek]),qn=h!==void 0||v!==void 0,or=S.useCallback(()=>{ne&&(z(ne),A?.(ne))},[ne,z,A]),yn=S.useCallback(()=>{ce&&(z(ce),T?.(ce))},[z,ce,T]),ft=S.useCallback((dt,Pn)=>mt=>{mt.preventDefault(),mt.stopPropagation(),ue(dt),P?.(dt.date,Pn,mt),v?.(dt.date,Pn,mt)},[P,v,ue]),ee=S.useCallback((dt,Pn)=>mt=>{ue(dt),b?.(dt.date,Pn,mt)},[b,ue]),Se=S.useCallback((dt,Pn)=>mt=>{H(),x?.(dt.date,Pn,mt)},[H,x]),Be=S.useCallback((dt,Pn)=>mt=>{const rn={ArrowLeft:[mt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[mt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[mt.shiftKey?"year":"week","after"],ArrowUp:[mt.shiftKey?"year":"week","before"],PageUp:[mt.shiftKey?"year":"month","before"],PageDown:[mt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(rn[mt.key]){mt.preventDefault(),mt.stopPropagation();const[Mr,At]=rn[mt.key];Re(Mr,At)}k?.(dt.date,Pn,mt)},[Re,k,e.dir]),rt=S.useCallback((dt,Pn)=>mt=>{O?.(dt.date,Pn,mt)},[O]),Tt=S.useCallback((dt,Pn)=>mt=>{j?.(dt.date,Pn,mt)},[j]),cr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setMonth(i.startOfMonth(dt),mt);z(rn)},[i,z]),Kr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setYear(i.startOfMonth(dt),mt);z(rn)},[i,z]),{className:re,style:Ae}=S.useMemo(()=>({className:[c[et.Root],e.className].filter(Boolean).join(" "),style:{...D?.[et.Root],...e.style}}),[c,e.className,e.style,D]),pt=Ife(e),yt=S.useRef(null);m0e(yt,!!e.animate,{classNames:c,months:J,focused:fe,dateLib:i});const vs={dayPickerProps:e,selected:K,select:P,isSelected:Y,months:J,nextMonth:ce,previousMonth:ne,goToMonth:z,getModifiers:xe,components:n,classNames:c,styles:D,labels:s,formatters:r};return Ue.createElement(Oz.Provider,{value:vs},Ue.createElement(n.Root,{rootRef:e.animate?yt:void 0,className:re,style:Ae,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"],...pt},Ue.createElement(n.Months,{className:c[et.Months],style:D?.[et.Months]},!e.hideNavigation&&!m&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ce}),J.map((dt,Pn)=>Ue.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:c[et.Month],style:D?.[et.Month],key:Pn,displayIndex:Pn,calendarMonth:dt},m==="around"&&!e.hideNavigation&&Pn===0&&Ue.createElement(n.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:ne?void 0:-1,"aria-disabled":ne?void 0:!0,"aria-label":Ct(ne),onClick:or,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ne?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"right":"left"})),Ue.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:c[et.MonthCaption],style:D?.[et.MonthCaption],calendarMonth:dt,displayIndex:Pn},d?.startsWith("dropdown")?Ue.createElement(n.DropdownNav,{className:c[et.Dropdowns],style:D?.[et.Dropdowns]},(()=>{const mt=d==="dropdown"||d==="dropdown-months"?Ue.createElement(n.MonthsDropdown,{key:"month",className:c[et.MonthsDropdown],"aria-label":nt(),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:cr(dt.date),options:Xfe(dt.date,$,ae,r,i),style:D?.[et.Dropdown],value:i.getMonth(dt.date)}):Ue.createElement("span",{key:"month"},Q(dt.date,i)),rn=d==="dropdown"||d==="dropdown-years"?Ue.createElement(n.YearsDropdown,{key:"year",className:c[et.YearsDropdown],"aria-label":_t(i.options),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:Kr(dt.date),options:Zfe($,ae,r,i,!!e.reverseYears),style:D?.[et.Dropdown],value:i.getYear(dt.date)}):Ue.createElement("span",{key:"year"},V(dt.date,i));return i.getMonthYearOrder()==="year-first"?[rn,mt]:[mt,rn]})(),Ue.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(dt.date,i.options,i))):Ue.createElement(n.CaptionLabel,{className:c[et.CaptionLabel],role:"status","aria-live":"polite"},E(dt.date,i.options,i))),m==="around"&&!e.hideNavigation&&Pn===p-1&&Ue.createElement(n.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:ce?void 0:-1,"aria-disabled":ce?void 0:!0,"aria-label":In(ce),onClick:yn,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ce?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Pn===p-1&&m==="after"&&!e.hideNavigation&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ce}),Ue.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Oe(dt.date,i.options,i)||void 0,className:c[et.MonthGrid],style:D?.[et.MonthGrid]},!e.hideWeekdays&&Ue.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:c[et.Weekdays],style:D?.[et.Weekdays]},_&&Ue.createElement(n.WeekNumberHeader,{"aria-label":nn(i.options),className:c[et.WeekNumberHeader],style:D?.[et.WeekNumberHeader],scope:"col"},L()),Yr.map(mt=>Ue.createElement(n.Weekday,{"aria-label":Tn(mt,i.options,i),className:c[et.Weekday],key:String(mt),style:D?.[et.Weekday],scope:"col"},U(mt,i.options,i)))),Ue.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:c[et.Weeks],style:D?.[et.Weeks]},dt.weeks.map(mt=>Ue.createElement(n.Week,{className:c[et.Week],key:mt.weekNumber,style:D?.[et.Week],week:mt},_&&Ue.createElement(n.WeekNumber,{week:mt,style:D?.[et.WeekNumber],"aria-label":Jn(mt.weekNumber,{locale:l}),className:c[et.WeekNumber],scope:"row",role:"rowheader"},F(mt.weekNumber,i)),mt.days.map(rn=>{const{date:Mr}=rn,At=xe(rn);if(At[Yn.focused]=!At.hidden&&!!fe?.isEqualTo(rn),At[qi.selected]=Y?.(Mr)||At.selected,X5(K)){const{from:qc,to:Do}=K;At[qi.range_start]=!!(qc&&Do&&i.isSameDay(Mr,qc)),At[qi.range_end]=!!(qc&&Do&&i.isSameDay(Mr,Do)),At[qi.range_middle]=ll(K,Mr,!0,i)}const Ic=Yfe(At,D,e.modifiersStyles),_o=Bfe(At,c,e.modifiersClassNames),t1=!qn&&!At.hidden?ct(Mr,At,i.options,i):void 0;return Ue.createElement(n.Day,{key:`${i.format(Mr,"yyyy-MM-dd")}_${i.format(rn.displayMonth,"yyyy-MM")}`,day:rn,modifiers:At,className:_o.join(" "),style:Ic,role:"gridcell","aria-selected":At.selected||void 0,"aria-label":t1,"data-day":i.format(Mr,"yyyy-MM-dd"),"data-month":rn.outside?i.format(Mr,"yyyy-MM"):void 0,"data-selected":At.selected||void 0,"data-disabled":At.disabled||void 0,"data-hidden":At.hidden||void 0,"data-outside":rn.outside||void 0,"data-focused":At.focused||void 0,"data-today":At.today||void 0},!At.hidden&&qn?Ue.createElement(n.DayButton,{className:c[et.DayButton],style:D?.[et.DayButton],type:"button",day:rn,modifiers:At,disabled:At.disabled||void 0,tabIndex:ve(rn)?0:-1,"aria-label":We(Mr,At,i.options,i),onClick:ft(rn,At),onBlur:Se(rn,At),onFocus:ee(rn,At),onKeyDown:Be(rn,At),onMouseEnter:rt(rn,At),onMouseLeave:Tt(rn,At)},R(Mr,i.options,i)):!At.hidden&&R(rn.date,i.options,i))})))))))),e.footer&&Ue.createElement(n.Footer,{className:c[et.Footer],style:D?.[et.Footer],role:"status","aria-live":"polite"},e.footer)))}function s9({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:l,...c}){const d=Y5();return a.jsx(R0e,{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",d.root),months:ye("relative flex flex-col gap-4 md:flex-row",d.months),month:ye("flex w-full flex-col gap-4",d.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",d.nav),button_previous:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_previous),button_next:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",d.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",d.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",d.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",d.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",d.caption_label),table:"w-full border-collapse",weekdays:ye("flex",d.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",d.weekday),week:ye("mt-2 flex w-full",d.week),week_number_header:ye("w-[--cell-size] select-none",d.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",d.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",d.day),range_start:ye("bg-accent rounded-l-md",d.range_start),range_middle:ye("rounded-none",d.range_middle),range_end:ye("bg-accent rounded-r-md",d.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",d.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:ye("text-muted-foreground opacity-50",d.disabled),hidden:ye("invisible",d.hidden),...e},components:{Root:({className:h,rootRef:m,...p})=>a.jsx("div",{"data-slot":"calendar",ref:m,className:ye(h),...p}),Chevron:({className:h,orientation:m,...p})=>m==="left"?a.jsx(Tc,{className:ye("size-4",h),...p}):m==="right"?a.jsx(Ac,{className:ye("size-4",h),...p}):a.jsx(df,{className:ye("size-4",h),...p}),DayButton:z0e,WeekNumber:({children:h,...m})=>a.jsx("td",{...m,children:a.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...l},...c})}function z0e({className:t,day:e,modifiers:n,...r}){const s=Y5(),i=S.useRef(null);return S.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),a.jsx(ie,{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 P0e{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 Iu=new P0e;typeof window<"u"&&Iu.connect();const B0e={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}} 年"}},L0e=(t,e,n)=>{let r;const s=B0e[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},I0e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},q0e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},F0e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Q0e={date:td({formats:I0e,defaultWidth:"full"}),time:td({formats:q0e,defaultWidth:"full"}),dateTime:td({formats:F0e,defaultWidth:"full"})};function i9(t,e,n){const r="eeee p";return Jhe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const $0e={lastWeek:i9,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:i9,other:"PP p"},H0e=(t,e,n,r)=>{const s=$0e[t];return typeof s=="function"?s(e,n,r):s},U0e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},V0e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},W0e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},G0e={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},X0e={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:"夜间"}},Y0e={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:"夜间"}},K0e=(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()}},Z0e={ordinalNumber:K0e,era:ua({values:U0e,defaultWidth:"wide"}),quarter:ua({values:V0e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:W0e,defaultWidth:"wide"}),day:ua({values:G0e,defaultWidth:"wide"}),dayPeriod:ua({values:X0e,defaultWidth:"wide",formattingValues:Y0e,defaultFormattingWidth:"wide"})},J0e=/^(第\s*)?\d+(日|时|分|秒)?/i,eme=/\d+/i,tme={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},nme={any:[/^(前)/i,/^(公元)/i]},rme={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},sme={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},ime={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},ame={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]},lme={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},ome={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},cme={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},ume={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},dme={ordinalNumber:xz({matchPattern:J0e,parsePattern:eme,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:tme,defaultMatchWidth:"wide",parsePatterns:nme,defaultParseWidth:"any"}),quarter:da({matchPatterns:rme,defaultMatchWidth:"wide",parsePatterns:sme,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:ime,defaultMatchWidth:"wide",parsePatterns:ame,defaultParseWidth:"any"}),day:da({matchPatterns:lme,defaultMatchWidth:"wide",parsePatterns:ome,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:cme,defaultMatchWidth:"any",parsePatterns:ume,defaultParseWidth:"any"})},Bp={code:"zh-CN",formatDistance:L0e,formatLong:Q0e,formatRelative:H0e,localize:Z0e,match:dme,options:{weekStartsOn:1,firstWeekContainsDate:4}};function hme(){const[t,e]=S.useState([]),[n,r]=S.useState(""),[s,i]=S.useState("all"),[l,c]=S.useState("all"),[d,h]=S.useState(void 0),[m,p]=S.useState(void 0),[x,v]=S.useState(!0),[b,k]=S.useState(!1),O=S.useRef(null),j=S.useRef(null);S.useEffect(()=>{const U=Iu.getAllLogs();e(U);const V=Iu.onLog(()=>{e(Iu.getAllLogs())}),de=Iu.onConnectionChange(W=>{k(W)});return()=>{V(),de()}},[]),S.useEffect(()=>{x&&j.current&&j.current.scrollIntoView({behavior:"smooth",block:"end"})},[t,x]);const T=S.useMemo(()=>{const U=new Set(t.map(V=>V.module));return Array.from(U).sort()},[t]),A=U=>{switch(U){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"}},_=U=>{switch(U){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"}},D=()=>{window.location.reload()},E=()=>{Iu.clearLogs(),e([])},R=()=>{const U=L.map(J=>`${J.timestamp} [${J.level.padEnd(8)}] [${J.module}] ${J.message}`).join(` -`),V=new Blob([U],{type:"text/plain;charset=utf-8"}),de=URL.createObjectURL(V),W=document.createElement("a");W.href=de,W.download=`logs-${dg(new Date,"yyyy-MM-dd-HHmmss")}.txt`,W.click(),URL.revokeObjectURL(de)},Q=()=>{v(!x)},F=()=>{h(void 0),p(void 0)},L=S.useMemo(()=>t.filter(U=>{const V=n===""||U.message.toLowerCase().includes(n.toLowerCase())||U.module.toLowerCase().includes(n.toLowerCase()),de=s==="all"||U.level===s,W=l==="all"||U.module===l;let J=!0;if(d||m){const $=new Date(U.timestamp);if(d){const ae=new Date(d);ae.setHours(0,0,0,0),J=J&&$>=ae}if(m){const ae=new Date(m);ae.setHours(23,59,59,999),J=J&&$<=ae}}return V&&de&&W&&J}),[t,n,s,l,d,m]);return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",b?"bg-green-500 animate-pulse":"bg-red-500")}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:b?"已连接":"未连接"})]})]}),a.jsx(gt,{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索日志...",value:n,onChange:U=>r(U.target.value),className:"pl-9 h-9 text-sm"})]}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsxs(Dt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"级别"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部级别"}),a.jsx(Pe,{value:"DEBUG",children:"DEBUG"}),a.jsx(Pe,{value:"INFO",children:"INFO"}),a.jsx(Pe,{value:"WARNING",children:"WARNING"}),a.jsx(Pe,{value:"ERROR",children:"ERROR"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL"})]})]}),a.jsxs(Lt,{value:l,onValueChange:c,children:[a.jsxs(Dt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"模块"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部模块"}),T.map(U=>a.jsx(Pe,{value:U,children:U},U))]})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!d&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:d?dg(d,"PPP",{locale:Bp}):"开始日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:d,onSelect:h,initialFocus:!0,locale:Bp})})]}),a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:m?dg(m,"PPP",{locale:Bp}):"结束日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:m,onSelect:p,initialFocus:!0,locale:Bp})})]}),(d||m)&&a.jsxs(ie,{variant:"outline",size:"sm",onClick:F,className:"w-full sm:w-auto h-9",children:[a.jsx(Gf,{className:"h-4 w-4 sm:mr-2"}),a.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),a.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsxs(ie,{variant:x?"default":"outline",size:"sm",onClick:Q,className:"flex-1 sm:flex-none h-9",children:[x?a.jsx(jq,{className:"h-4 w-4"}):a.jsx(Nq,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:x?"自动滚动":"已暂停"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:D,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Fi,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:E,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Ht,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:R,className:"flex-1 sm:flex-none h-9",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),a.jsx("div",{className:"flex-1 hidden sm:block"}),a.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[a.jsxs("span",{className:"font-mono",children:[L.length," / ",t.length]}),a.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),a.jsx(gt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:a.jsx(vn,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:a.jsxs("div",{ref:O,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[L.length===0?a.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):L.map(U=>a.jsxs("div",{className:ye("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",_(U.level)),children:[a.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:U.timestamp}),a.jsxs("span",{className:ye("text-xs font-semibold",A(U.level)),children:["[",U.level,"]"]})]}),a.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:U.module}),a.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs break-all",children:U.message})]}),a.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:U.timestamp}),a.jsxs("span",{className:ye("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",A(U.level)),children:["[",U.level,"]"]}),a.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:U.module}),a.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 break-all text-xs lg:text-sm",children:U.message})]})]},U.id)),a.jsx("div",{ref:j,className:"h-4"})]})})})]})})}const fme="Mai-with-u",mme="plugin-repo",pme="main",gme="plugin_details.json";async function xme(){try{const t=await ot("/api/webui/plugins/fetch-raw",{method:"POST",headers:bt(),body:JSON.stringify({owner:fme,repo:mme,branch:pme,file_path:gme})});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 vme(){try{const t=await ot("/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 yme(){try{const t=await ot("/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 bme(t,e,n){const r=t.split(".").map(c=>parseInt(c)||0),s=r[0]||0,i=r[1]||0,l=r[2]||0;if(n.version_majorparseInt(p)||0),d=c[0]||0,h=c[1]||0,m=c[2]||0;if(n.version_major>d||n.version_major===d&&n.version_minor>h||n.version_major===d&&n.version_minor===h&&n.version_patch>m)return!1}return!0}function wme(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 l=JSON.parse(i.data);t(l)}catch(l){console.error("Failed to parse progress data:",l)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Lp(){try{const t=await ot("/api/webui/plugins/installed",{headers:bt()});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 Ip(t,e){return e.some(n=>n.id===t)}function qp(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function Sme(t,e,n="main"){const r=await ot("/api/webui/plugins/install",{method:"POST",headers:bt(),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 kme(t){const e=await ot("/api/webui/plugins/uninstall",{method:"POST",headers:bt(),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 Ome(t,e,n="main"){const r=await ot("/api/webui/plugins/update",{method:"POST",headers:bt(),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 C0="https://maibot-plugin-stats.maibot-webui.workers.dev";async function zz(t){try{const e=await fetch(`${C0}/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 jme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/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 Nme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/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 Cme(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||K5(),i=await fetch(`${C0}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),l=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...l}:{success:!1,error:l.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function Tme(t){try{const e=await fetch(`${C0}/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 Ame(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const j=await zz(t);j&&r(j),i(!1)};S.useEffect(()=>{v()},[t]);const b=async()=>{const j=await jme(t);j.success?(x({title:"已点赞",description:"感谢你的支持!"}),v()):x({title:"点赞失败",description:j.error||"未知错误",variant:"destructive"})},k=async()=>{const j=await Nme(t);j.success?(x({title:"已反馈",description:"感谢你的反馈!"}),v()):x({title:"操作失败",description:j.error||"未知错误",variant:"destructive"})},O=async()=>{if(l===0){x({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const j=await Cme(t,l,d||void 0);j.success?(x({title:"评分成功",description:"感谢你的评价!"}),p(!1),c(0),h(""),v()):x({title:"评分失败",description:j.error||"未知错误",variant:"destructive"})};return s?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]})]}):n?e?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:n.downloads.toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:n.rating.toFixed(1)})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[a.jsx(my,{className:"h-4 w-4"}),a.jsx("span",{children:n.likes})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(fc,{className:"h-5 w-5 text-muted-foreground mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(Jl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),a.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(my,{className:"h-5 w-5 text-green-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.likes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(dO,{className:"h-5 w-5 text-red-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:b,children:[a.jsx(my,{className:"h-4 w-4 mr-1"}),"点赞"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:k,children:[a.jsx(dO,{className:"h-4 w-4 mr-1"}),"点踩"]}),a.jsxs(Rr,{open:m,onOpenChange:p,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"default",size:"sm",children:[a.jsx(Jl,{className:"h-4 w-4 mr-1"}),"评分"]})}),a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"为插件评分"}),a.jsx(Gr,{children:"分享你的使用体验,帮助其他用户"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(j=>a.jsx("button",{onClick:()=>c(j),className:"focus:outline-none",children:a.jsx(Jl,{className:`h-8 w-8 transition-colors ${j<=l?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},j))}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[l===0&&"点击星星进行评分",l===1&&"很差",l===2&&"一般",l===3&&"还行",l===4&&"不错",l===5&&"非常好"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),a.jsx(_n,{value:d,onChange:j=>h(j.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[d.length," / 500"]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:O,disabled:l===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),a.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((j,T)=>a.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(A=>a.jsx(Jl,{className:`h-3 w-3 ${A<=j.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},A))}),a.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(j.created_at).toLocaleDateString()})]}),j.comment&&a.jsx("p",{className:"text-sm text-muted-foreground",children:j.comment})]},T))})]})]}):null}const a9={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function Eme(){const t=wa(),[e,n]=S.useState(null),[r,s]=S.useState(""),[i,l]=S.useState("all"),[c,d]=S.useState("all"),[h,m]=S.useState(!1),[p,x]=S.useState([]),[v,b]=S.useState(!0),[k,O]=S.useState(null),[j,T]=S.useState(null),[A,_]=S.useState(null),[D,E]=S.useState(null),[,R]=S.useState([]),[Q,F]=S.useState({}),{toast:L}=Pr(),U=async z=>{const xe=z.map(async K=>{try{const H=await zz(K.id);return{id:K.id,stats:H}}catch(H){return console.warn(`Failed to load stats for ${K.id}:`,H),{id:K.id,stats:null}}}),Y=await Promise.all(xe),P={};Y.forEach(({id:K,stats:H})=>{H&&(P[K]=H)}),F(P)};S.useEffect(()=>{let z=null,xe=!1;return(async()=>{if(z=wme(P=>{xe||(_(P),P.stage==="success"?setTimeout(()=>{xe||_(null)},2e3):P.stage==="error"&&(b(!1),O(P.error||"加载失败")))},P=>{console.error("WebSocket error:",P),xe||L({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(P=>{if(!z){P();return}const K=()=>{z&&z.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),P()):z&&z.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),P()):setTimeout(K,100)};K()}),!xe){const P=await vme();T(P),P.installed||L({title:"Git 未安装",description:P.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!xe){const P=await yme();E(P)}if(!xe)try{b(!0),O(null);const P=await xme();if(!xe){const K=await Lp();R(K);const H=P.map(fe=>{const ve=Ip(fe.id,K),Re=qp(fe.id,K);return{...fe,installed:ve,installed_version:Re}});for(const fe of K)!H.some(Re=>Re.id===fe.id)&&fe.manifest&&H.push({id:fe.id,manifest:{manifest_version:fe.manifest.manifest_version||1,name:fe.manifest.name,version:fe.manifest.version,description:fe.manifest.description||"",author:fe.manifest.author,license:fe.manifest.license||"Unknown",host_application:fe.manifest.host_application,homepage_url:fe.manifest.homepage_url,repository_url:fe.manifest.repository_url,keywords:fe.manifest.keywords||[],categories:fe.manifest.categories||[],default_locale:fe.manifest.default_locale||"zh-CN",locales_path:fe.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:fe.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});x(H),U(H)}}catch(P){if(!xe){const K=P instanceof Error?P.message:"加载插件列表失败";O(K),L({title:"加载失败",description:K,variant:"destructive"})}}finally{xe||b(!1)}})(),()=>{xe=!0,z&&z.close()}},[L]);const V=z=>{if(!z.installed&&D&&!de(z))return a.jsxs(On,{variant:"destructive",className:"gap-1",children:[a.jsx(xc,{className:"h-3 w-3"}),"不兼容"]});if(z.installed){const xe=z.installed_version?.trim(),Y=z.manifest.version?.trim();if(xe!==Y){const P=xe?.split(".").map(Number)||[0,0,0],K=Y?.split(".").map(Number)||[0,0,0];for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return a.jsxs(On,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[a.jsx(xc,{className:"h-3 w-3"}),"可更新"]});if((K[H]||0)<(P[H]||0))break}}return a.jsxs(On,{variant:"default",className:"gap-1",children:[a.jsx(Es,{className:"h-3 w-3"}),"已安装"]})}return null},de=z=>!D||!z.manifest?.host_application?!0:bme(z.manifest.host_application.min_version,z.manifest.host_application.max_version,D),W=z=>{if(!z.installed||!z.installed_version||!z.manifest?.version)return!1;const xe=z.installed_version.trim(),Y=z.manifest.version.trim();if(xe===Y)return!1;const P=xe.split(".").map(Number),K=Y.split(".").map(Number);for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return!0;if((K[H]||0)<(P[H]||0))return!1}return!1},J=p.filter(z=>{if(!z.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",z.id),!1;const xe=r===""||z.manifest.name?.toLowerCase().includes(r.toLowerCase())||z.manifest.description?.toLowerCase().includes(r.toLowerCase())||z.manifest.keywords&&z.manifest.keywords.some(H=>H.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||z.manifest.categories&&z.manifest.categories.includes(i);let P=!0;c==="installed"?P=z.installed===!0:c==="updates"&&(P=z.installed===!0&&W(z));const K=!h||!D||de(z);return xe&&Y&&P&&K}),$=()=>{n(null)},ae=async z=>{if(!j?.installed){L({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(D&&!de(z)){L({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await Sme(z.id,z.manifest.repository_url||"","main"),Tme(z.id).catch(Y=>{console.warn("Failed to record download:",Y)}),L({title:"安装成功",description:`${z.manifest.name} 已成功安装`});const xe=await Lp();R(xe),x(Y=>Y.map(P=>{if(P.id===z.id){const K=Ip(P.id,xe),H=qp(P.id,xe);return{...P,installed:K,installed_version:H}}return P}))}catch(xe){L({title:"安装失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}},ne=async z=>{try{await kme(z.id),L({title:"卸载成功",description:`${z.manifest.name} 已成功卸载`});const xe=await Lp();R(xe),x(Y=>Y.map(P=>{if(P.id===z.id){const K=Ip(P.id,xe),H=qp(P.id,xe);return{...P,installed:K,installed_version:H}}return P}))}catch(xe){L({title:"卸载失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}},ce=async z=>{if(!j?.installed){L({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const xe=await Ome(z.id,z.manifest.repository_url||"","main");L({title:"更新成功",description:`${z.manifest.name} 已从 ${xe.old_version} 更新到 ${xe.new_version}`});const Y=await Lp();R(Y),x(P=>P.map(K=>{if(K.id===z.id){const H=Ip(K.id,Y),fe=qp(K.id,Y);return{...K,installed:H,installed_version:fe}}return K}))}catch(xe){L({title:"更新失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}};return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),a.jsxs(ie,{onClick:()=>t({to:"/plugin-mirrors"}),children:[a.jsx(Cq,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),j&&!j.installed&&a.jsxs(gt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-orange-600"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),a.jsx(Sr,{className:"text-orange-800 dark:text-orange-200",children:j.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),a.jsx(an,{children:a.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",a.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索插件...",value:r,onChange:z=>s(z.target.value),className:"pl-9"})]}),a.jsxs(Lt,{value:i,onValueChange:l,children:[a.jsx(Dt,{className:"w-full sm:w-[200px]",children:a.jsx(It,{placeholder:"选择分类"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部分类"}),a.jsx(Pe,{value:"Group Management",children:"群组管理"}),a.jsx(Pe,{value:"Entertainment & Interaction",children:"娱乐互动"}),a.jsx(Pe,{value:"Utility Tools",children:"实用工具"}),a.jsx(Pe,{value:"Content Generation",children:"内容生成"}),a.jsx(Pe,{value:"Multimedia",children:"多媒体"}),a.jsx(Pe,{value:"External Integration",children:"外部集成"}),a.jsx(Pe,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),a.jsx(Pe,{value:"Other",children:"其他"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"compatible-only",checked:h,onCheckedChange:z=>m(z===!0)}),a.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),a.jsx(hl,{value:c,onValueChange:d,className:"w-full",children:a.jsxs(ya,{className:"grid w-full grid-cols-3",children:[a.jsxs($t,{value:"all",children:["全部插件 (",p.length,")"]}),a.jsxs($t,{value:"installed",children:["已安装 (",p.filter(z=>z.installed).length,")"]}),a.jsxs($t,{value:"updates",children:["可更新 (",p.filter(z=>z.installed&&W(z)).length,")"]})]})}),A&&A.stage==="loading"&&a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(hf,{className:"h-4 w-4 animate-spin"}),a.jsxs("span",{className:"text-sm font-medium",children:[A.operation==="fetch"&&"加载插件列表",A.operation==="install"&&`安装插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="uninstall"&&`卸载插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="update"&&`更新插件${A.plugin_id?`: ${A.plugin_id}`:""}`]})]}),a.jsxs("span",{className:"text-sm font-medium",children:[A.progress,"%"]})]}),a.jsx(n0,{value:A.progress,className:"h-2"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:A.message}),A.operation==="fetch"&&A.total_plugins>0&&a.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",A.loaded_plugins," / ",A.total_plugins," 个插件"]})]})}),A&&A.stage==="error"&&A.error&&a.jsx(gt,{className:"border-destructive bg-destructive/10",children:a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-destructive"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-destructive",children:"加载失败"}),a.jsx(Sr,{className:"text-destructive/80",children:A.error})]})]})})}),v?a.jsxs("div",{className:"flex items-center justify-center py-12",children:[a.jsx(hf,{className:"h-8 w-8 animate-spin text-muted-foreground"}),a.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):k?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:k}),a.jsx(ie,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):J.length===0?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:J.map(z=>a.jsxs(gt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[a.jsxs(Wt,{children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx(Gt,{className:"text-xl",children:z.manifest?.name||z.id}),a.jsxs("div",{className:"flex flex-col gap-1",children:[z.manifest?.categories&&z.manifest.categories[0]&&a.jsx(On,{variant:"secondary",className:"text-xs whitespace-nowrap",children:a9[z.manifest.categories[0]]||z.manifest.categories[0]}),V(z)]})]}),a.jsx(Sr,{className:"line-clamp-2",children:z.manifest?.description||"无描述"})]}),a.jsx(an,{className:"flex-1",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:(Q[z.id]?.downloads??z.downloads??0).toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:(Q[z.id]?.rating??z.rating??0).toFixed(1)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[z.manifest?.keywords&&z.manifest.keywords.slice(0,3).map(xe=>a.jsx(On,{variant:"outline",className:"text-xs",children:xe},xe)),z.manifest?.keywords&&z.manifest.keywords.length>3&&a.jsxs(On,{variant:"outline",className:"text-xs",children:["+",z.manifest.keywords.length-3]})]}),a.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[a.jsxs("div",{children:["v",z.manifest?.version||"unknown"," · ",z.manifest?.author?.name||"Unknown"]}),z.manifest?.host_application&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{children:"支持:"}),a.jsxs("span",{className:"font-medium",children:[z.manifest.host_application.min_version,z.manifest.host_application.max_version?` - ${z.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),a.jsx(bC,{className:"pt-4",children:a.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>n(z),children:"查看详情"}),z.installed?W(z)?a.jsxs(ie,{size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ce(z),children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"更新"]}):a.jsxs(ie,{variant:"destructive",size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ne(z),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"卸载"]}):a.jsxs(ie,{size:"sm",disabled:!j?.installed||A?.operation==="install"||D!==null&&!de(z),title:j?.installed?D!==null&&!de(z)?`不兼容当前版本 (需要 ${z.manifest?.host_application?.min_version||"未知"}${z.manifest?.host_application?.max_version?` - ${z.manifest.host_application.max_version}`:"+"},当前 ${D?.version})`:void 0:"Git 未安装",onClick:()=>ae(z),children:[a.jsx(fc,{className:"h-4 w-4 mr-1"}),A?.operation==="install"&&A?.plugin_id===z.id?"安装中...":"安装"]})]})})]},z.id))}),a.jsx(Rr,{open:e!==null,onOpenChange:$,children:e&&e.manifest&&a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsx(Cr,{children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"space-y-2 flex-1",children:[a.jsx(Tr,{className:"text-2xl",children:e.manifest.name}),a.jsxs(Gr,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&a.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:a.jsx(Yh,{className:"h-3 w-3 inline"})})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&a.jsx(On,{variant:"secondary",children:a9[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(Mme,{pluginId:e.id}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"下载量"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:(Q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"评分"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.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,")"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"许可证"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),a.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}`:" - 最新版本"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(z=>a.jsx(On,{variant:"outline",children:z},z))})]}),e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),a.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"主页: "}),a.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&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"仓库: "}),a.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),a.jsxs(ps,{children:[e.manifest.homepage_url&&a.jsxs(ie,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&a.jsxs(ie,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function _me(){return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-2"}),"刷新"]}),a.jsxs(ie,{size:"sm",children:[a.jsx(Ii,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已安装插件"}),a.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已启用"}),a.jsx(Es,{className:"h-4 w-4 text-green-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已禁用"}),a.jsx(xc,{className:"h-4 w-4 text-orange-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"可更新"}),a.jsx(Fi,{className:"h-4 w-4 text-blue-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"已安装的插件"}),a.jsx(Sr,{children:"查看和管理已安装插件的配置"})]}),a.jsx(an,{children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx(pg,{className:"h-16 w-16 text-muted-foreground/50"}),a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),a.jsx("div",{className:"flex gap-2",children:a.jsx(ie,{variant:"outline",asChild:!0,children:a.jsxs("a",{href:"/plugins",children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"即将推出的功能"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件启用/禁用"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"快速切换插件运行状态"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置参数编辑"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"可视化编辑插件配置文件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"依赖管理"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看和安装插件依赖包"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件日志"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看插件运行日志和错误信息"})]})]})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"开发者工具"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"热重载"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"无需重启即可重新加载插件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置验证"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查配置文件格式和完整性"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"性能监控"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"监控插件的资源占用情况"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"调试模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"详细的调试信息和错误追踪"})]})]})]})})]})]}),a.jsx(gt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:a.jsx(an,{className:"pt-6",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(xc,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),a.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",a.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function Dme(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState([]),[s,i]=S.useState(!0),[l,c]=S.useState(null),[d,h]=S.useState(null),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O=S.useCallback(async()=>{try{i(!0),c(null);const R=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${R}`}});if(!Q.ok)throw new Error("获取镜像源列表失败");const F=await Q.json();r(F.mirrors||[])}catch(R){const Q=R instanceof Error?R.message:"加载镜像源失败";c(Q),e({title:"加载失败",description:Q,variant:"destructive"})}finally{i(!1)}},[e]);S.useEffect(()=>{O()},[O]);const j=async()=>{try{const R=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${R}`,"Content-Type":"application/json"},body:JSON.stringify(b)});if(!Q.ok){const F=await Q.json();throw new Error(F.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),p(!1),k({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O()}catch(R){e({title:"添加失败",description:R instanceof Error?R.message:"未知错误",variant:"destructive"})}},T=async()=>{if(d)try{const R=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${d.id}`,{method:"PUT",headers:{Authorization:`Bearer ${R}`,"Content-Type":"application/json"},body:JSON.stringify({name:b.name,raw_prefix:b.raw_prefix,clone_prefix:b.clone_prefix,enabled:b.enabled,priority:b.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),v(!1),h(null),O()}catch(R){e({title:"更新失败",description:R instanceof Error?R.message:"未知错误",variant:"destructive"})}},A=async R=>{if(confirm("确定要删除这个镜像源吗?"))try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R}`,{method:"DELETE",headers:{Authorization:`Bearer ${Q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),O()}catch(Q){e({title:"删除失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},_=async R=>{try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R.id}`,{method:"PUT",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!R.enabled})})).ok)throw new Error("更新状态失败");O()}catch(Q){e({title:"更新失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},D=R=>{h(R),k({id:R.id,name:R.name,raw_prefix:R.raw_prefix,clone_prefix:R.clone_prefix,enabled:R.enabled,priority:R.priority}),v(!0)},E=async(R,Q)=>{const F=Q==="up"?R.priority-1:R.priority+1;if(!(F<1))try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${R.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({priority:F})})).ok)throw new Error("更新优先级失败");O()}catch(L){e({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}};return a.jsx(vn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:a.jsx(R9,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),a.jsxs(ie,{onClick:()=>p(!0),children:[a.jsx(Wr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?a.jsx(gt,{className:"p-6",children:a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(hf,{className:"h-8 w-8 animate-spin text-primary"})})}):l?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l}),a.jsx(ie,{onClick:O,children:"重新加载"})]})}):a.jsxs(gt,{children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"ID"}),a.jsx(xt,{children:"优先级"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n.map(R=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(jt,{checked:R.enabled,onCheckedChange:()=>_(R)})}),a.jsx(it,{children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:R.name}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",R.raw_prefix]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:R.id})}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono",children:R.priority}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(R,"up"),disabled:R.priority===1,children:a.jsx(e2,{className:"h-3 w-3"})}),a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(R,"down"),children:a.jsx(df,{className:"h-3 w-3"})})]})]})}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>D(R),children:a.jsx(nd,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>A(R.id),children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})]})})]},R.id))})]})}),a.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(R=>a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"font-semibold",children:R.name}),R.enabled&&a.jsx(On,{variant:"default",className:"text-xs",children:"启用"})]}),a.jsx(On,{variant:"outline",className:"mt-1 text-xs",children:R.id})]}),a.jsx(jt,{checked:R.enabled,onCheckedChange:()=>_(R)})]}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"Raw: "}),a.jsx("span",{className:"break-all",children:R.raw_prefix})]}),a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"优先级: "}),a.jsx("span",{className:"font-mono",children:R.priority})]})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[a.jsxs(ie,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>D(R),children:[a.jsx(nd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(R,"up"),disabled:R.priority===1,children:a.jsx(e2,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(R,"down"),children:a.jsx(df,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>A(R.id),children:a.jsx(Ht,{className:"h-4 w-4"})})]})]})},R.id))})]}),a.jsx(Rr,{open:m,onOpenChange:p,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"添加镜像源"}),a.jsx(Gr,{children:"添加新的 Git 镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-id",children:"镜像源 ID *"}),a.jsx(Me,{id:"add-id",placeholder:"例如: my-mirror",value:b.id,onChange:R=>k({...b,id:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-name",children:"名称 *"}),a.jsx(Me,{id:"add-name",placeholder:"例如: 我的镜像源",value:b.name,onChange:R=>k({...b,name:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"add-raw",placeholder:"https://example.com/raw",value:b.raw_prefix,onChange:R=>k({...b,raw_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"add-clone",placeholder:"https://example.com/clone",value:b.clone_prefix,onChange:R=>k({...b,clone_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-priority",children:"优先级"}),a.jsx(Me,{id:"add-priority",type:"number",min:"1",value:b.priority,onChange:R=>k({...b,priority:parseInt(R.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"add-enabled",checked:b.enabled,onCheckedChange:R=>k({...b,enabled:R})}),a.jsx(te,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:j,children:"添加"})]})]})}),a.jsx(Rr,{open:x,onOpenChange:v,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑镜像源"}),a.jsx(Gr,{children:"修改镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"镜像源 ID"}),a.jsx(Me,{value:b.id,disabled:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-name",children:"名称 *"}),a.jsx(Me,{id:"edit-name",value:b.name,onChange:R=>k({...b,name:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"edit-raw",value:b.raw_prefix,onChange:R=>k({...b,raw_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"edit-clone",value:b.clone_prefix,onChange:R=>k({...b,clone_prefix:R.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-priority",children:"优先级"}),a.jsx(Me,{id:"edit-priority",type:"number",min:"1",value:b.priority,onChange:R=>k({...b,priority:parseInt(R.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"edit-enabled",checked:b.enabled,onCheckedChange:R=>k({...b,enabled:R})}),a.jsx(te,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>v(!1),children:"取消"}),a.jsx(ie,{onClick:T,children:"保存"})]})]})})]})})}const Rme=Nd("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"}}),Pz=S.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>a.jsx("kbd",{className:ye(Rme({size:e,className:t})),ref:i,...s,children:n?a.jsx("abbr",{title:n,children:r}):r}));Pz.displayName="Kbd";const zme=[{icon:hg,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:ao,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:z9,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:P9,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:K4,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Wf,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:B9,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Tq,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:pg,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:fg,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Ii,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function Pme({open:t,onOpenChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState(0),l=wa(),c=zme.filter(m=>m.title.toLowerCase().includes(n.toLowerCase())||m.description.toLowerCase().includes(n.toLowerCase())||m.category.toLowerCase().includes(n.toLowerCase()));S.useEffect(()=>{t&&(r(""),i(0))},[t]);const d=S.useCallback(m=>{l({to:m}),e(!1)},[l,e]),h=S.useCallback(m=>{m.key==="ArrowDown"?(m.preventDefault(),i(p=>(p+1)%c.length)):m.key==="ArrowUp"?(m.preventDefault(),i(p=>(p-1+c.length)%c.length)):m.key==="Enter"&&c[s]&&(m.preventDefault(),d(c[s].path))},[c,s,d]);return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl p-0 gap-0",children:[a.jsxs(Cr,{className:"px-4 pt-4 pb-0",children:[a.jsx(Tr,{className:"sr-only",children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),a.jsx(Me,{value:n,onChange:m=>{r(m.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),a.jsx("div",{className:"border-t",children:a.jsx(vn,{className:"h-[400px]",children:c.length>0?a.jsx("div",{className:"p-2",children:c.map((m,p)=>{const x=m.icon;return a.jsxs("button",{onClick:()=>d(m.path),onMouseEnter:()=>i(p),className:ye("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",p===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[a.jsx(x,{className:"h-5 w-5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm",children:m.title}),a.jsx("div",{className:"text-xs text-muted-foreground truncate",children:m.description})]}),a.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:m.category})]},m.path)})}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),a.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function Bme(t){const e=Lme(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(qme);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function Lme(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=Qme(s),c=Fme(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ime=Symbol("radix.slottable");function qme(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ime}function Fme(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]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Qme(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 z4=["Enter"," "],$me=["ArrowDown","PageUp","Home"],Bz=["ArrowUp","PageDown","End"],Hme=[...$me,...Bz],Ume={ltr:[...z4,"ArrowRight"],rtl:[...z4,"ArrowLeft"]},Vme={ltr:["ArrowLeft"],rtl:["ArrowRight"]},T0="Menu",[$f,Wme,Gme]=tx(T0),[Lc,Lz]=Vi(T0,[Gme,wd,fx]),A0=wd(),Iz=fx(),[qz,Eo]=Lc(T0),[Xme,M0]=Lc(T0),Fz=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:l=!0}=t,c=A0(e),[d,h]=S.useState(null),m=S.useRef(!1),p=es(i),x=Vf(s);return S.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),a.jsx(ix,{...c,children:a.jsx(qz,{scope:e,open:n,onOpenChange:p,content:d,onContentChange:h,children:a.jsx(Xme,{scope:e,onClose:S.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:x,modal:l,children:r})})})};Fz.displayName=T0;var Yme="MenuAnchor",Z5=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(ax,{...s,...r,ref:e})});Z5.displayName=Yme;var J5="MenuPortal",[Kme,Qz]=Lc(J5,{forceMount:void 0}),$z=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Eo(J5,e);return a.jsx(Kme,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};$z.displayName=J5;var Ci="MenuContent",[Zme,e3]=Lc(Ci),Hz=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:l.modal?a.jsx(Jme,{...s,ref:e}):a.jsx(epe,{...s,ref:e})})})})}),Jme=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu),r=S.useRef(null),s=Cn(e,r);return S.useEffect(()=>{const i=r.current;if(i)return j9(i)},[]),a.jsx(t3,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:$e(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),epe=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu);return a.jsx(t3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),tpe=Bme("MenuContent.ScrollLock"),t3=S.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,disableOutsideScroll:b,...k}=t,O=Eo(Ci,n),j=M0(Ci,n),T=A0(n),A=Iz(n),_=Wme(n),[D,E]=S.useState(null),R=S.useRef(null),Q=Cn(e,R,O.onContentChange),F=S.useRef(0),L=S.useRef(""),U=S.useRef(0),V=S.useRef(null),de=S.useRef("right"),W=S.useRef(0),J=b?N9:S.Fragment,$=b?{as:tpe,allowPinchZoom:!0}:void 0,ae=ce=>{const z=L.current+ce,xe=_().filter(ve=>!ve.disabled),Y=document.activeElement,P=xe.find(ve=>ve.ref.current===Y)?.textValue,K=xe.map(ve=>ve.textValue),H=fpe(K,z,P),fe=xe.find(ve=>ve.textValue===H)?.ref.current;(function ve(Re){L.current=Re,window.clearTimeout(F.current),Re!==""&&(F.current=window.setTimeout(()=>ve(""),1e3))})(z),fe&&setTimeout(()=>fe.focus())};S.useEffect(()=>()=>window.clearTimeout(F.current),[]),C9();const ne=S.useCallback(ce=>de.current===V.current?.side&&ppe(ce,V.current?.area),[]);return a.jsx(Zme,{scope:n,searchRef:L,onItemEnter:S.useCallback(ce=>{ne(ce)&&ce.preventDefault()},[ne]),onItemLeave:S.useCallback(ce=>{ne(ce)||(R.current?.focus(),E(null))},[ne]),onTriggerLeave:S.useCallback(ce=>{ne(ce)&&ce.preventDefault()},[ne]),pointerGraceTimerRef:U,onPointerGraceIntentChange:S.useCallback(ce=>{V.current=ce},[]),children:a.jsx(J,{...$,children:a.jsx(T9,{asChild:!0,trapped:s,onMountAutoFocus:$e(i,ce=>{ce.preventDefault(),R.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,children:a.jsx(NC,{asChild:!0,...A,dir:j.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:E,onEntryFocus:$e(d,ce=>{j.isUsingKeyboardRef.current||ce.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(X4,{role:"menu","aria-orientation":"vertical","data-state":lP(O.open),"data-radix-menu-content":"",dir:j.dir,...T,...k,ref:Q,style:{outline:"none",...k.style},onKeyDown:$e(k.onKeyDown,ce=>{const xe=ce.target.closest("[data-radix-menu-content]")===ce.currentTarget,Y=ce.ctrlKey||ce.altKey||ce.metaKey,P=ce.key.length===1;xe&&(ce.key==="Tab"&&ce.preventDefault(),!Y&&P&&ae(ce.key));const K=R.current;if(ce.target!==K||!Hme.includes(ce.key))return;ce.preventDefault();const fe=_().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);Bz.includes(ce.key)&&fe.reverse(),dpe(fe)}),onBlur:$e(t.onBlur,ce=>{ce.currentTarget.contains(ce.target)||(window.clearTimeout(F.current),L.current="")}),onPointerMove:$e(t.onPointerMove,Hf(ce=>{const z=ce.target,xe=W.current!==ce.clientX;if(ce.currentTarget.contains(z)&&xe){const Y=ce.clientX>W.current?"right":"left";de.current=Y,W.current=ce.clientX}}))})})})})})})});Hz.displayName=Ci;var npe="MenuGroup",n3=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"group",...r,ref:e})});n3.displayName=npe;var rpe="MenuLabel",Uz=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});Uz.displayName=rpe;var Jg="MenuItem",l9="menu.itemSelect",Kx=S.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=S.useRef(null),l=M0(Jg,t.__scopeMenu),c=e3(Jg,t.__scopeMenu),d=Cn(e,i),h=S.useRef(!1),m=()=>{const p=i.current;if(!n&&p){const x=new CustomEvent(l9,{bubbles:!0,cancelable:!0});p.addEventListener(l9,v=>r?.(v),{once:!0}),M9(p,x),x.defaultPrevented?h.current=!1:l.onClose()}};return a.jsx(Vz,{...s,ref:d,disabled:n,onClick:$e(t.onClick,m),onPointerDown:p=>{t.onPointerDown?.(p),h.current=!0},onPointerUp:$e(t.onPointerUp,p=>{h.current||p.currentTarget?.click()}),onKeyDown:$e(t.onKeyDown,p=>{const x=c.searchRef.current!=="";n||x&&p.key===" "||z4.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Kx.displayName=Jg;var Vz=S.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,l=e3(Jg,n),c=Iz(n),d=S.useRef(null),h=Cn(e,d),[m,p]=S.useState(!1),[x,v]=S.useState("");return S.useEffect(()=>{const b=d.current;b&&v((b.textContent??"").trim())},[i.children]),a.jsx($f.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:a.jsx(CC,{asChild:!0,...c,focusable:!r,children:a.jsx(Zt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:$e(t.onPointerMove,Hf(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$e(t.onPointerLeave,Hf(b=>l.onItemLeave(b))),onFocus:$e(t.onFocus,()=>p(!0)),onBlur:$e(t.onBlur,()=>p(!1))})})})}),spe="MenuCheckboxItem",Wz=S.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return a.jsx(Zz,{scope:t.__scopeMenu,checked:n,children:a.jsx(Kx,{role:"menuitemcheckbox","aria-checked":ex(n)?"mixed":n,...s,ref:e,"data-state":i3(n),onSelect:$e(s.onSelect,()=>r?.(ex(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Wz.displayName=spe;var Gz="MenuRadioGroup",[ipe,ape]=Lc(Gz,{value:void 0,onValueChange:()=>{}}),Xz=S.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=es(r);return a.jsx(ipe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:a.jsx(n3,{...s,ref:e})})});Xz.displayName=Gz;var Yz="MenuRadioItem",Kz=S.forwardRef((t,e)=>{const{value:n,...r}=t,s=ape(Yz,t.__scopeMenu),i=n===s.value;return a.jsx(Zz,{scope:t.__scopeMenu,checked:i,children:a.jsx(Kx,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":i3(i),onSelect:$e(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Kz.displayName=Yz;var r3="MenuItemIndicator",[Zz,lpe]=Lc(r3,{checked:!1}),Jz=S.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=lpe(r3,n);return a.jsx(Ls,{present:r||ex(i.checked)||i.checked===!0,children:a.jsx(Zt.span,{...s,ref:e,"data-state":i3(i.checked)})})});Jz.displayName=r3;var ope="MenuSeparator",eP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});eP.displayName=ope;var cpe="MenuArrow",tP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(Y4,{...s,...r,ref:e})});tP.displayName=cpe;var s3="MenuSub",[upe,nP]=Lc(s3),rP=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Eo(s3,e),l=A0(e),[c,d]=S.useState(null),[h,m]=S.useState(null),p=es(s);return S.useEffect(()=>(i.open===!1&&p(!1),()=>p(!1)),[i.open,p]),a.jsx(ix,{...l,children:a.jsx(qz,{scope:e,open:r,onOpenChange:p,content:h,onContentChange:m,children:a.jsx(upe,{scope:e,contentId:ji(),triggerId:ji(),trigger:c,onTriggerChange:d,children:n})})})};rP.displayName=s3;var Gh="MenuSubTrigger",sP=S.forwardRef((t,e)=>{const n=Eo(Gh,t.__scopeMenu),r=M0(Gh,t.__scopeMenu),s=nP(Gh,t.__scopeMenu),i=e3(Gh,t.__scopeMenu),l=S.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=i,h={__scopeMenu:t.__scopeMenu},m=S.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return S.useEffect(()=>m,[m]),S.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),d(null)}},[c,d]),a.jsx(Z5,{asChild:!0,...h,children:a.jsx(Vz,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":lP(n.open),...t,ref:oo(e,s.onTriggerChange),onClick:p=>{t.onClick?.(p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:$e(t.onPointerMove,Hf(p=>{i.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!n.open&&!l.current&&(i.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:$e(t.onPointerLeave,Hf(p=>{m();const x=n.content?.getBoundingClientRect();if(x){const v=n.content?.dataset.side,b=v==="right",k=b?-5:5,O=x[b?"left":"right"],j=x[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+k,y:p.clientY},{x:O,y:x.top},{x:j,y:x.top},{x:j,y:x.bottom},{x:O,y:x.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$e(t.onKeyDown,p=>{const x=i.searchRef.current!=="";t.disabled||x&&p.key===" "||Ume[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});sP.displayName=Gh;var iP="MenuSubContent",aP=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu),c=nP(iP,t.__scopeMenu),d=S.useRef(null),h=Cn(e,d);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:a.jsx(t3,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:h,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{l.isUsingKeyboardRef.current&&d.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:$e(t.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$e(t.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:$e(t.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),x=Vme[l.dir].includes(m.key);p&&x&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});aP.displayName=iP;function lP(t){return t?"open":"closed"}function ex(t){return t==="indeterminate"}function i3(t){return ex(t)?"indeterminate":t?"checked":"unchecked"}function dpe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function hpe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function fpe(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 l=hpe(t,Math.max(i,0));s.length===1&&(l=l.filter(h=>h!==n));const d=l.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function mpe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function ppe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return mpe(n,e)}function Hf(t){return e=>e.pointerType==="mouse"?t(e):void 0}var gpe=Fz,xpe=Z5,vpe=$z,ype=Hz,bpe=n3,wpe=Uz,Spe=Kx,kpe=Wz,Ope=Xz,jpe=Kz,Npe=Jz,Cpe=eP,Tpe=tP,Ape=rP,Mpe=sP,Epe=aP,a3="ContextMenu",[_pe]=Vi(a3,[Lz]),ls=Lz(),[Dpe,oP]=_pe(a3),cP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[l,c]=S.useState(!1),d=ls(e),h=es(r),m=S.useCallback(p=>{c(p),h(p)},[h]);return a.jsx(Dpe,{scope:e,open:l,onOpenChange:m,modal:i,children:a.jsx(gpe,{...d,dir:s,open:l,onOpenChange:m,modal:i,children:n})})};cP.displayName=a3;var uP="ContextMenuTrigger",dP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=oP(uP,n),l=ls(n),c=S.useRef({x:0,y:0}),d=S.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),h=S.useRef(0),m=S.useCallback(()=>window.clearTimeout(h.current),[]),p=x=>{c.current={x:x.clientX,y:x.clientY},i.onOpenChange(!0)};return S.useEffect(()=>m,[m]),S.useEffect(()=>void(r&&m()),[r,m]),a.jsxs(a.Fragment,{children:[a.jsx(xpe,{...l,virtualRef:d}),a.jsx(Zt.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:$e(t.onContextMenu,x=>{m(),p(x),x.preventDefault()}),onPointerDown:r?t.onPointerDown:$e(t.onPointerDown,Fp(x=>{m(),h.current=window.setTimeout(()=>p(x),700)})),onPointerMove:r?t.onPointerMove:$e(t.onPointerMove,Fp(m)),onPointerCancel:r?t.onPointerCancel:$e(t.onPointerCancel,Fp(m)),onPointerUp:r?t.onPointerUp:$e(t.onPointerUp,Fp(m))})]})});dP.displayName=uP;var Rpe="ContextMenuPortal",hP=t=>{const{__scopeContextMenu:e,...n}=t,r=ls(e);return a.jsx(vpe,{...r,...n})};hP.displayName=Rpe;var fP="ContextMenuContent",mP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=oP(fP,n),i=ls(n),l=S.useRef(!1);return a.jsx(ype,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{t.onCloseAutoFocus?.(c),!c.defaultPrevented&&l.current&&c.preventDefault(),l.current=!1},onInteractOutside:c=>{t.onInteractOutside?.(c),!c.defaultPrevented&&!s.modal&&(l.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)"}})});mP.displayName=fP;var zpe="ContextMenuGroup",Ppe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(bpe,{...s,...r,ref:e})});Ppe.displayName=zpe;var Bpe="ContextMenuLabel",pP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(wpe,{...s,...r,ref:e})});pP.displayName=Bpe;var Lpe="ContextMenuItem",gP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Spe,{...s,...r,ref:e})});gP.displayName=Lpe;var Ipe="ContextMenuCheckboxItem",xP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(kpe,{...s,...r,ref:e})});xP.displayName=Ipe;var qpe="ContextMenuRadioGroup",Fpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Ope,{...s,...r,ref:e})});Fpe.displayName=qpe;var Qpe="ContextMenuRadioItem",vP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(jpe,{...s,...r,ref:e})});vP.displayName=Qpe;var $pe="ContextMenuItemIndicator",yP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Npe,{...s,...r,ref:e})});yP.displayName=$pe;var Hpe="ContextMenuSeparator",bP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Cpe,{...s,...r,ref:e})});bP.displayName=Hpe;var Upe="ContextMenuArrow",Vpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Tpe,{...s,...r,ref:e})});Vpe.displayName=Upe;var wP="ContextMenuSub",SP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,l=ls(e),[c,d]=ko({prop:s,defaultProp:i??!1,onChange:r,caller:wP});return a.jsx(Ape,{...l,open:c,onOpenChange:d,children:n})};SP.displayName=wP;var Wpe="ContextMenuSubTrigger",kP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Mpe,{...s,...r,ref:e})});kP.displayName=Wpe;var Gpe="ContextMenuSubContent",OP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Epe,{...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)"}})});OP.displayName=Gpe;function Fp(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var Xpe=cP,Ype=dP,Kpe=hP,jP=mP,NP=pP,CP=gP,TP=xP,AP=vP,MP=yP,EP=bP,Zpe=SP,_P=kP,DP=OP;const Jpe=Xpe,ege=Ype,tge=Zpe,RP=S.forwardRef(({className:t,inset:e,children:n,...r},s)=>a.jsxs(_P,{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,a.jsx(Ac,{className:"ml-auto h-4 w-4"})]}));RP.displayName=_P.displayName;const zP=S.forwardRef(({className:t,...e},n)=>a.jsx(DP,{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}));zP.displayName=DP.displayName;const PP=S.forwardRef(({className:t,...e},n)=>a.jsx(Kpe,{children:a.jsx(jP,{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})}));PP.displayName=jP.displayName;const Bi=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(CP,{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}));Bi.displayName=CP.displayName;const nge=S.forwardRef(({className:t,children:e,checked:n,...r},s)=>a.jsxs(TP,{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:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(MP,{children:a.jsx(hc,{className:"h-4 w-4"})})}),e]}));nge.displayName=TP.displayName;const rge=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(AP,{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:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(MP,{children:a.jsx(Aq,{className:"h-2 w-2 fill-current"})})}),e]}));rge.displayName=AP.displayName;const sge=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(NP,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));sge.displayName=NP.displayName;const Xh=S.forwardRef(({className:t,...e},n)=>a.jsx(EP,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Xh.displayName=EP.displayName;const qu=({className:t,...e})=>a.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});qu.displayName="ContextMenuShortcut";var ige=Symbol("radix.slottable");function age(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=ige,e}var[Zx]=Vi("Tooltip",[wd]),Jx=wd(),BP="TooltipProvider",lge=700,P4="tooltip.open",[oge,l3]=Zx(BP),LP=t=>{const{__scopeTooltip:e,delayDuration:n=lge,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,l=S.useRef(!0),c=S.useRef(!1),d=S.useRef(0);return S.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),a.jsx(oge,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:S.useCallback(h=>{c.current=h},[]),disableHoverableContent:s,children:i})};LP.displayName=BP;var Uf="Tooltip",[cge,E0]=Zx(Uf),IP=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:l,delayDuration:c}=t,d=l3(Uf,t.__scopeTooltip),h=Jx(e),[m,p]=S.useState(null),x=ji(),v=S.useRef(0),b=l??d.disableHoverableContent,k=c??d.delayDuration,O=S.useRef(!1),[j,T]=ko({prop:r,defaultProp:s??!1,onChange:R=>{R?(d.onOpen(),document.dispatchEvent(new CustomEvent(P4))):d.onClose(),i?.(R)},caller:Uf}),A=S.useMemo(()=>j?O.current?"delayed-open":"instant-open":"closed",[j]),_=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,O.current=!1,T(!0)},[T]),D=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,T(!1)},[T]),E=S.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{O.current=!0,T(!0),v.current=0},k)},[k,T]);return S.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),a.jsx(ix,{...h,children:a.jsx(cge,{scope:e,contentId:x,open:j,stateAttribute:A,trigger:m,onTriggerChange:p,onTriggerEnter:S.useCallback(()=>{d.isOpenDelayedRef.current?E():_()},[d.isOpenDelayedRef,E,_]),onTriggerLeave:S.useCallback(()=>{b?D():(window.clearTimeout(v.current),v.current=0)},[D,b]),onOpen:_,onClose:D,disableHoverableContent:b,children:n})})};IP.displayName=Uf;var B4="TooltipTrigger",qP=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=E0(B4,n),i=l3(B4,n),l=Jx(n),c=S.useRef(null),d=Cn(e,c,s.onTriggerChange),h=S.useRef(!1),m=S.useRef(!1),p=S.useCallback(()=>h.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(ax,{asChild:!0,...l,children:a.jsx(Zt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:d,onPointerMove:$e(t.onPointerMove,x=>{x.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:$e(t.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:$e(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:$e(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:$e(t.onBlur,s.onClose),onClick:$e(t.onClick,s.onClose)})})});qP.displayName=B4;var o3="TooltipPortal",[uge,dge]=Zx(o3,{forceMount:void 0}),FP=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=E0(o3,e);return a.jsx(uge,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};FP.displayName=o3;var bd="TooltipContent",QP=S.forwardRef((t,e)=>{const n=dge(bd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,l=E0(bd,t.__scopeTooltip);return a.jsx(Ls,{present:r||l.open,children:l.disableHoverableContent?a.jsx($P,{side:s,...i,ref:e}):a.jsx(hge,{side:s,...i,ref:e})})}),hge=S.forwardRef((t,e)=>{const n=E0(bd,t.__scopeTooltip),r=l3(bd,t.__scopeTooltip),s=S.useRef(null),i=Cn(e,s),[l,c]=S.useState(null),{trigger:d,onClose:h}=n,m=s.current,{onPointerInTransitChange:p}=r,x=S.useCallback(()=>{c(null),p(!1)},[p]),v=S.useCallback((b,k)=>{const O=b.currentTarget,j={x:b.clientX,y:b.clientY},T=xge(j,O.getBoundingClientRect()),A=vge(j,T),_=yge(k.getBoundingClientRect()),D=wge([...A,..._]);c(D),p(!0)},[p]);return S.useEffect(()=>()=>x(),[x]),S.useEffect(()=>{if(d&&m){const b=O=>v(O,m),k=O=>v(O,d);return d.addEventListener("pointerleave",b),m.addEventListener("pointerleave",k),()=>{d.removeEventListener("pointerleave",b),m.removeEventListener("pointerleave",k)}}},[d,m,v,x]),S.useEffect(()=>{if(l){const b=k=>{const O=k.target,j={x:k.clientX,y:k.clientY},T=d?.contains(O)||m?.contains(O),A=!bge(j,l);T?x():A&&(x(),h())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[d,m,l,h,x]),a.jsx($P,{...t,ref:i})}),[fge,mge]=Zx(Uf,{isInside:!1}),pge=age("TooltipContent"),$P=S.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:l,...c}=t,d=E0(bd,n),h=Jx(n),{onClose:m}=d;return S.useEffect(()=>(document.addEventListener(P4,m),()=>document.removeEventListener(P4,m)),[m]),S.useEffect(()=>{if(d.trigger){const p=x=>{x.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:a.jsxs(X4,{"data-state":d.stateAttribute,...h,...c,ref:e,style:{...c.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:[a.jsx(pge,{children:r}),a.jsx(fge,{scope:n,isInside:!0,children:a.jsx(sq,{id:d.contentId,role:"tooltip",children:s||r})})]})})});QP.displayName=bd;var HP="TooltipArrow",gge=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Jx(n);return mge(HP,n).isInside?null:a.jsx(Y4,{...s,...r,ref:e})});gge.displayName=HP;function xge(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 vge(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 yge(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 bge(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function wge(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Sge(e)}function Sge(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],l=e[e.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.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],l=n[n.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.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 kge=LP,Oge=IP,jge=qP,Nge=FP,UP=QP;const Cge=kge,Tge=Oge,Age=jge,VP=S.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(Nge,{children:a.jsx(UP,{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})}));VP.displayName=UP.displayName;function Mge({children:t}){CH();const[e,n]=S.useState(!0),[r,s]=S.useState(!1),[i,l]=S.useState(!1),{theme:c,setTheme:d}=dw(),h=AI(),m=wa();S.useEffect(()=>{const k=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),l(!0))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const p=[{title:"概览",items:[{icon:hg,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:ao,label:"麦麦主程序配置",path:"/config/bot"},{icon:z9,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:P9,label:"麦麦模型配置",path:"/config/model"},{icon:hO,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:K4,label:"表情包管理",path:"/resource/emoji"},{icon:Wf,label:"表达方式管理",path:"/resource/expression"},{icon:B9,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:pg,label:"插件市场",path:"/plugins"},{icon:hO,label:"插件配置",path:"/plugin-config"},{icon:fg,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Ii,label:"系统设置",path:"/settings"}]}],v=c==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c,b=()=>{localStorage.removeItem("access-token"),m({to:"/auth"})};return a.jsx(Cge,{delayDuration:300,children:a.jsxs("div",{className:"flex h-screen overflow-hidden",children:[a.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:[a.jsx("div",{className:"flex h-16 items-center border-b px-4",children:a.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:[a.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[a.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),a.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:rH()})]}),!e&&a.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),a.jsx("nav",{className:"flex-1 overflow-y-auto p-4",children:a.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3"),children:p.map((k,O)=>a.jsxs("li",{children:[a.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:k.title})}),!e&&O>0&&a.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),a.jsx("ul",{className:"space-y-1",children:k.items.map(j=>{const T=h({to:j.path}),A=j.icon,_=a.jsxs(a.Fragment,{children:[T&&a.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"}),a.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"lg:gap-0"),children:[a.jsx(A,{className:ye("h-5 w-5 flex-shrink-0",T&&"text-primary"),strokeWidth:2,fill:"none"}),a.jsx("span",{className:ye("text-sm font-medium whitespace-nowrap transition-all duration-300",T&&"font-semibold",e?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:j.label})]})]});return a.jsx("li",{className:"relative",children:a.jsxs(Tge,{children:[a.jsx(Age,{asChild:!0,children:a.jsx(MI,{to:j.path,className:ye("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",T?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>s(!1),children:_})}),!e&&a.jsx(VP,{side:"right",className:"hidden lg:block",children:a.jsx("p",{children:j.label})})]})},j.path)})})]},k.title))})})]}),r&&a.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),a.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[a.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:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:a.jsx(Mq,{className:"h-5 w-5"})}),a.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:a.jsx(Tc,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>l(!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:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),a.jsxs(Pz,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[a.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),a.jsx(Pme,{open:i,onOpenChange:l}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[a.jsx(Eq,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),a.jsx("button",{onClick:k=>{Q$(v==="dark"?"light":"dark",d,k)},className:"rounded-lg p-2 hover:bg-accent",title:v==="dark"?"切换到浅色模式":"切换到深色模式",children:v==="dark"?a.jsx(Zb,{className:"h-5 w-5"}):a.jsx(Jb,{className:"h-5 w-5"})}),a.jsx("div",{className:"h-6 w-px bg-border"}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",title:"登出系统",children:[a.jsx(fO,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),a.jsxs(Jpe,{children:[a.jsx(ege,{asChild:!0,children:a.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),a.jsxs(PP,{className:"w-64",children:[a.jsxs(Bi,{onClick:()=>m({to:"/"}),children:[a.jsx(hg,{className:"mr-2 h-4 w-4"}),"首页"]}),a.jsxs(Bi,{onClick:()=>m({to:"/settings"}),children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"系统设置"]}),a.jsxs(Bi,{onClick:()=>m({to:"/logs"}),children:[a.jsx(fg,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),a.jsx(Xh,{}),a.jsxs(tge,{children:[a.jsxs(RP,{children:[a.jsx(_9,{className:"mr-2 h-4 w-4"}),"切换主题"]}),a.jsxs(zP,{className:"w-48",children:[a.jsxs(Bi,{onClick:()=>d("light"),disabled:c==="light",children:[a.jsx(Zb,{className:"mr-2 h-4 w-4"}),"浅色",c==="light"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("dark"),disabled:c==="dark",children:[a.jsx(Jb,{className:"mr-2 h-4 w-4"}),"深色",c==="dark"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("system"),disabled:c==="system",children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"跟随系统",c==="system"&&a.jsx(qu,{children:"✓"})]})]})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.location.reload(),children:[a.jsx(_q,{className:"mr-2 h-4 w-4"}),"刷新页面",a.jsx(qu,{children:"⌘R"})]}),a.jsxs(Bi,{onClick:()=>l(!0),children:[a.jsx(Bs,{className:"mr-2 h-4 w-4"}),"搜索",a.jsx(qu,{children:"⌘K"})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[a.jsx(Yh,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:b,className:"text-destructive focus:text-destructive",children:[a.jsx(fO,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const _0=EI({component:()=>a.jsxs(a.Fragment,{children:[a.jsx(c9,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!qT())throw DI({to:"/auth"})}}),Ege=Xr({getParentRoute:()=>_0,path:"/auth",component:TH}),_ge=Xr({getParentRoute:()=>_0,path:"/setup",component:WH}),Qs=Xr({getParentRoute:()=>_0,id:"protected",component:()=>a.jsx(Mge,{children:a.jsx(c9,{})})}),Dge=Xr({getParentRoute:()=>Qs,path:"/",component:q$}),Rge=Xr({getParentRoute:()=>Qs,path:"/config/bot",component:Vee}),zge=Xr({getParentRoute:()=>Qs,path:"/config/modelProvider",component:ote}),Pge=Xr({getParentRoute:()=>Qs,path:"/config/model",component:Pte}),Bge=Xr({getParentRoute:()=>Qs,path:"/config/adapter",component:qte}),Lge=Xr({getParentRoute:()=>Qs,path:"/resource/emoji",component:ude}),Ige=Xr({getParentRoute:()=>Qs,path:"/resource/expression",component:bde}),qge=Xr({getParentRoute:()=>Qs,path:"/resource/person",component:Ede}),Fge=Xr({getParentRoute:()=>Qs,path:"/logs",component:hme}),Qge=Xr({getParentRoute:()=>Qs,path:"/plugins",component:Eme}),$ge=Xr({getParentRoute:()=>Qs,path:"/plugin-config",component:_me}),Hge=Xr({getParentRoute:()=>Qs,path:"/plugin-mirrors",component:Dme}),Uge=Xr({getParentRoute:()=>Qs,path:"/settings",component:bH}),Vge=Xr({getParentRoute:()=>_0,path:"*",component:$T}),Wge=_0.addChildren([Ege,_ge,Qs.addChildren([Dge,Rge,zge,Pge,Bge,Lge,Ige,qge,Qge,$ge,Hge,Fge,Uge]),Vge]),Gge=_I({routeTree:Wge,defaultNotFoundComponent:$T});function Xge({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=S.useState(()=>localStorage.getItem(n)||e);S.useEffect(()=>{const c=window.document.documentElement;if(c.classList.remove("light","dark"),s==="system"){const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";c.classList.add(d);return}c.classList.add(s)},[s]),S.useEffect(()=>{const c=localStorage.getItem("accent-color");if(c){const d=document.documentElement,m={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%)"}}[c];m&&(d.style.setProperty("--primary",m.hsl),m.gradient?(d.style.setProperty("--primary-gradient",m.gradient),d.classList.add("has-gradient")):(d.style.removeProperty("--primary-gradient"),d.classList.remove("has-gradient")))}},[]);const l={theme:s,setTheme:c=>{localStorage.setItem(n,c),i(c)}};return a.jsx(uT.Provider,{...r,value:l,children:t})}function Yge({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,l]=S.useState(()=>{const m=localStorage.getItem(r);return m!==null?m==="true":e}),[c,d]=S.useState(()=>{const m=localStorage.getItem(s);return m!==null?m==="true":n});S.useEffect(()=>{const m=document.documentElement;i?m.classList.remove("no-animations"):m.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),S.useEffect(()=>{localStorage.setItem(s,String(c))},[c,s]);const h={enableAnimations:i,setEnableAnimations:l,enableWavesBackground:c,setEnableWavesBackground:d};return a.jsx(dT.Provider,{value:h,children:t})}var c3="ToastProvider",[u3,Kge,Zge]=tx("Toast"),[WP]=Vi("Toast",[Zge]),[Jge,e1]=WP(c3),GP=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:l}=t,[c,d]=S.useState(null),[h,m]=S.useState(0),p=S.useRef(!1),x=S.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${c3}\`. Expected non-empty \`string\`.`),a.jsx(u3.Provider,{scope:e,children:a.jsx(Jge,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:c,onViewportChange:d,onToastAdd:S.useCallback(()=>m(v=>v+1),[]),onToastRemove:S.useCallback(()=>m(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:x,children:l})})};GP.displayName=c3;var XP="ToastViewport",exe=["F8"],L4="toast.viewportPause",I4="toast.viewportResume",YP=S.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=exe,label:s="Notifications ({hotkey})",...i}=t,l=e1(XP,n),c=Kge(n),d=S.useRef(null),h=S.useRef(null),m=S.useRef(null),p=S.useRef(null),x=Cn(e,p,l.onViewportChange),v=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=l.toastCount>0;S.useEffect(()=>{const O=j=>{r.length!==0&&r.every(A=>j[A]||j.code===A)&&p.current?.focus()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[r]),S.useEffect(()=>{const O=d.current,j=p.current;if(b&&O&&j){const T=()=>{if(!l.isClosePausedRef.current){const E=new CustomEvent(L4);j.dispatchEvent(E),l.isClosePausedRef.current=!0}},A=()=>{if(l.isClosePausedRef.current){const E=new CustomEvent(I4);j.dispatchEvent(E),l.isClosePausedRef.current=!1}},_=E=>{!O.contains(E.relatedTarget)&&A()},D=()=>{O.contains(document.activeElement)||A()};return O.addEventListener("focusin",T),O.addEventListener("focusout",_),O.addEventListener("pointermove",T),O.addEventListener("pointerleave",D),window.addEventListener("blur",T),window.addEventListener("focus",A),()=>{O.removeEventListener("focusin",T),O.removeEventListener("focusout",_),O.removeEventListener("pointermove",T),O.removeEventListener("pointerleave",D),window.removeEventListener("blur",T),window.removeEventListener("focus",A)}}},[b,l.isClosePausedRef]);const k=S.useCallback(({tabbingDirection:O})=>{const T=c().map(A=>{const _=A.ref.current,D=[_,...fxe(_)];return O==="forwards"?D:D.reverse()});return(O==="forwards"?T.reverse():T).flat()},[c]);return S.useEffect(()=>{const O=p.current;if(O){const j=T=>{const A=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!A){const D=document.activeElement,E=T.shiftKey;if(T.target===O&&E){h.current?.focus();return}const F=k({tabbingDirection:E?"backwards":"forwards"}),L=F.findIndex(U=>U===D);Gb(F.slice(L+1))?T.preventDefault():E?h.current?.focus():m.current?.focus()}};return O.addEventListener("keydown",j),()=>O.removeEventListener("keydown",j)}},[c,k]),a.jsxs(iq,{ref:d,role:"region","aria-label":s.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&a.jsx(q4,{ref:h,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"forwards"});Gb(O)}}),a.jsx(u3.Slot,{scope:n,children:a.jsx(Zt.ol,{tabIndex:-1,...i,ref:x})}),b&&a.jsx(q4,{ref:m,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"backwards"});Gb(O)}})]})});YP.displayName=XP;var KP="ToastFocusProxy",q4=S.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=e1(KP,n);return a.jsx(E9,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:l=>{const c=l.relatedTarget;!i.viewport?.contains(c)&&r()}})});q4.displayName=KP;var D0="Toast",txe="toast.swipeStart",nxe="toast.swipeMove",rxe="toast.swipeCancel",sxe="toast.swipeEnd",ZP=S.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...l}=t,[c,d]=ko({prop:r,defaultProp:s??!0,onChange:i,caller:D0});return a.jsx(Ls,{present:n||c,children:a.jsx(lxe,{open:c,...l,ref:e,onClose:()=>d(!1),onPause:es(t.onPause),onResume:es(t.onResume),onSwipeStart:$e(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:$e(t.onSwipeMove,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:$e(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:$e(t.onSwipeEnd,h=>{const{x:m,y:p}=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",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});ZP.displayName=D0;var[ixe,axe]=WP(D0,{onClose(){}}),lxe=S.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:l,onEscapeKeyDown:c,onPause:d,onResume:h,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:x,onSwipeEnd:v,...b}=t,k=e1(D0,n),[O,j]=S.useState(null),T=Cn(e,W=>j(W)),A=S.useRef(null),_=S.useRef(null),D=s||k.duration,E=S.useRef(0),R=S.useRef(D),Q=S.useRef(0),{onToastAdd:F,onToastRemove:L}=k,U=es(()=>{O?.contains(document.activeElement)&&k.viewport?.focus(),l()}),V=S.useCallback(W=>{!W||W===1/0||(window.clearTimeout(Q.current),E.current=new Date().getTime(),Q.current=window.setTimeout(U,W))},[U]);S.useEffect(()=>{const W=k.viewport;if(W){const J=()=>{V(R.current),h?.()},$=()=>{const ae=new Date().getTime()-E.current;R.current=R.current-ae,window.clearTimeout(Q.current),d?.()};return W.addEventListener(L4,$),W.addEventListener(I4,J),()=>{W.removeEventListener(L4,$),W.removeEventListener(I4,J)}}},[k.viewport,D,d,h,V]),S.useEffect(()=>{i&&!k.isClosePausedRef.current&&V(D)},[i,D,k.isClosePausedRef,V]),S.useEffect(()=>(F(),()=>L()),[F,L]);const de=S.useMemo(()=>O?iB(O):null,[O]);return k.viewport?a.jsxs(a.Fragment,{children:[de&&a.jsx(oxe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:de}),a.jsx(ixe,{scope:n,onClose:U,children:RI.createPortal(a.jsx(u3.ItemSlot,{scope:n,children:a.jsx(aq,{asChild:!0,onEscapeKeyDown:$e(c,()=>{k.isFocusedToastEscapeKeyDownRef.current||U(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(Zt.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":k.swipeDirection,...b,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:$e(t.onKeyDown,W=>{W.key==="Escape"&&(c?.(W.nativeEvent),W.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,U()))}),onPointerDown:$e(t.onPointerDown,W=>{W.button===0&&(A.current={x:W.clientX,y:W.clientY})}),onPointerMove:$e(t.onPointerMove,W=>{if(!A.current)return;const J=W.clientX-A.current.x,$=W.clientY-A.current.y,ae=!!_.current,ne=["left","right"].includes(k.swipeDirection),ce=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,z=ne?ce(0,J):0,xe=ne?0:ce(0,$),Y=W.pointerType==="touch"?10:2,P={x:z,y:xe},K={originalEvent:W,delta:P};ae?(_.current=P,Qp(nxe,p,K,{discrete:!1})):o9(P,k.swipeDirection,Y)?(_.current=P,Qp(txe,m,K,{discrete:!1}),W.target.setPointerCapture(W.pointerId)):(Math.abs(J)>Y||Math.abs($)>Y)&&(A.current=null)}),onPointerUp:$e(t.onPointerUp,W=>{const J=_.current,$=W.target;if($.hasPointerCapture(W.pointerId)&&$.releasePointerCapture(W.pointerId),_.current=null,A.current=null,J){const ae=W.currentTarget,ne={originalEvent:W,delta:J};o9(J,k.swipeDirection,k.swipeThreshold)?Qp(sxe,v,ne,{discrete:!0}):Qp(rxe,x,ne,{discrete:!0}),ae.addEventListener("click",ce=>ce.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),oxe=t=>{const{__scopeToast:e,children:n,...r}=t,s=e1(D0,e),[i,l]=S.useState(!1),[c,d]=S.useState(!1);return dxe(()=>l(!0)),S.useEffect(()=>{const h=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(h)},[]),c?null:a.jsx(sx,{asChild:!0,children:a.jsx(E9,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},cxe="ToastTitle",JP=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});JP.displayName=cxe;var uxe="ToastDescription",eB=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});eB.displayName=uxe;var tB="ToastAction",nB=S.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?a.jsx(sB,{altText:n,asChild:!0,children:a.jsx(d3,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${tB}\`. Expected non-empty \`string\`.`),null)});nB.displayName=tB;var rB="ToastClose",d3=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=axe(rB,n);return a.jsx(sB,{asChild:!0,children:a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,s.onClose)})})});d3.displayName=rB;var sB=S.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return a.jsx(Zt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function iB(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),hxe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const l=r.dataset.radixToastAnnounceAlt;l&&e.push(l)}else e.push(...iB(r))}}),e}function Qp(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?M9(s,i):s.dispatchEvent(i)}var o9=(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 dxe(t=()=>{}){const e=es(t);h9(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function hxe(t){return t.nodeType===t.ELEMENT_NODE}function fxe(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 Gb(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var mxe=GP,aB=YP,lB=ZP,oB=JP,cB=eB,uB=nB,dB=d3;const pxe=mxe,hB=S.forwardRef(({className:t,...e},n)=>a.jsx(aB,{ref:n,className:ye("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));hB.displayName=aB.displayName;const gxe=Nd("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-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),fB=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx(lB,{ref:r,className:ye(gxe({variant:e}),t),...n}));fB.displayName=lB.displayName;const xxe=S.forwardRef(({className:t,...e},n)=>a.jsx(uB,{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}));xxe.displayName=uB.displayName;const mB=S.forwardRef(({className:t,...e},n)=>a.jsx(dB,{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:a.jsx(Gf,{className:"h-4 w-4"})}));mB.displayName=dB.displayName;const pB=S.forwardRef(({className:t,...e},n)=>a.jsx(oB,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));pB.displayName=oB.displayName;const gB=S.forwardRef(({className:t,...e},n)=>a.jsx(cB,{ref:n,className:ye("text-sm opacity-90",t),...e}));gB.displayName=cB.displayName;function vxe(){const{toasts:t}=Pr();return a.jsxs(pxe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return a.jsxs(fB,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(pB,{children:n}),r&&a.jsx(gB,{children:r})]}),s,a.jsx(mB,{})]},e)}),a.jsx(hB,{})]})}Bq.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(Xge,{defaultTheme:"system",children:a.jsxs(Yge,{children:[a.jsx(zI,{router:Gge}),a.jsx(vxe,{})]})})})); +`:Que(t)?(c=2,d=2):rz(t)&&(c=1,d=1);++i{try{i(!0);const Oe=await nde({page:l,page_size:m,search:x||void 0,is_registered:b==="all"?void 0:b==="registered",is_banned:O==="all"?void 0:O==="banned",format:T==="all"?void 0:T,sort_by:"usage_count",sort_order:"desc"});e(Oe.data),h(Oe.total)}catch(Oe){const nt=Oe instanceof Error?Oe.message:"加载表情包列表失败";ne({title:"错误",description:nt,variant:"destructive"})}finally{i(!1)}},[l,m,x,b,O,T,ne]),R=async()=>{try{const Oe=await ade();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};S.useEffect(()=>{ue()},[ue]),S.useEffect(()=>{R()},[]);const me=async Oe=>{try{const nt=await rde(Oe.id);D(nt.data),z(!0)}catch(nt){const ut=nt instanceof Error?nt.message:"加载详情失败";ne({title:"错误",description:ut,variant:"destructive"})}},Y=Oe=>{D(Oe),F(!0)},P=Oe=>{D(Oe),U(!0)},K=async()=>{if(_)try{await ide(_.id),ne({title:"成功",description:"表情包已删除"}),U(!1),D(null),ue(),R()}catch(Oe){const nt=Oe instanceof Error?Oe.message:"删除失败";ne({title:"错误",description:nt,variant:"destructive"})}},H=async Oe=>{try{await lde(Oe.id),ne({title:"成功",description:"表情包已注册"}),ue(),R()}catch(nt){const ut=nt instanceof Error?nt.message:"注册失败";ne({title:"错误",description:ut,variant:"destructive"})}},fe=async Oe=>{try{await ode(Oe.id),ne({title:"成功",description:"表情包已封禁"}),ue(),R()}catch(nt){const ut=nt instanceof Error?nt.message:"封禁失败";ne({title:"错误",description:ut,variant:"destructive"})}},ve=Oe=>{const nt=new Set(V);nt.has(Oe)?nt.delete(Oe):nt.add(Oe),ce(nt)},Re=()=>{V.size===t.length&&t.length>0?ce(new Set):ce(new Set(t.map(Oe=>Oe.id)))},de=async()=>{try{const Oe=await cde(Array.from(V));ne({title:"批量删除完成",description:Oe.message}),ce(new Set),J(!1),ue(),R()}catch(Oe){ne({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},We=()=>{const Oe=parseInt($),nt=Math.ceil(d/m);Oe>=1&&Oe<=nt?(c(Oe),ae("")):ne({title:"无效的页码",description:`请输入1-${nt}之间的页码`,variant:"destructive"})},ct=n?.formats?Object.keys(n.formats):[];return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsxs("div",{className:"mb-4 sm:mb-6",children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),a.jsx(mn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&a.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"总数"}),a.jsx(Gt,{className:"text-2xl",children:n.total})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已注册"}),a.jsx(Gt,{className:"text-2xl text-green-600",children:n.registered})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"已封禁"}),a.jsx(Gt,{className:"text-2xl text-red-600",children:n.banned})]})}),a.jsx(gt,{children:a.jsxs(Wt,{className:"pb-2",children:[a.jsx(Sr,{children:"未注册"}),a.jsx(Gt,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsxs(Gt,{className:"flex items-center gap-2",children:[a.jsx(t2,{className:"h-5 w-5"}),"搜索和筛选"]})}),a.jsxs(an,{className:"space-y-4",children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"描述或哈希值...",value:x,onChange:Oe=>{v(Oe.target.value),c(1)},className:"pl-8"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"注册状态"}),a.jsxs(Lt,{value:b,onValueChange:Oe=>{k(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"registered",children:"已注册"}),a.jsx(Pe,{value:"unregistered",children:"未注册"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"封禁状态"}),a.jsxs(Lt,{value:O,onValueChange:Oe=>{j(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"banned",children:"已封禁"}),a.jsx(Pe,{value:"unbanned",children:"未封禁"})]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"格式"}),a.jsxs(Lt,{value:T,onValueChange:Oe=>{A(Oe),c(1)},children:[a.jsx(Dt,{children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),ct.map(Oe=>a.jsxs(Pe,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:V.size>0&&a.jsxs("span",{children:["已选择 ",V.size," 个表情包"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:m.toString(),onValueChange:Oe=>{p(parseInt(Oe)),c(1),ce(new Set)},children:[a.jsx(Dt,{id:"emoji-page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),V.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>ce(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>J(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),a.jsx("div",{className:"flex justify-end pt-4 border-t",children:a.jsxs(ie,{variant:"outline",size:"sm",onClick:ue,disabled:s,children:[a.jsx(Fi,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"表情包列表"}),a.jsxs(Sr,{children:["共 ",d," 个表情包,当前第 ",l," 页"]})]}),a.jsxs(an,{children:[a.jsx("div",{className:"hidden md:block rounded-md border overflow-hidden",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&V.size===t.length,onCheckedChange:Re,"aria-label":"全选"})}),a.jsx(xt,{className:"w-16",children:"预览"}),a.jsx(xt,{children:"描述"}),a.jsx(xt,{children:"格式"}),a.jsx(xt,{children:"情绪标签"}),a.jsx(xt,{className:"text-center",children:"状态"}),a.jsx(xt,{className:"text-right",children:"使用次数"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(Oe=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:V.has(Oe.id),onCheckedChange:()=>ve(Oe.id),"aria-label":`选择 ${Oe.description}`})}),a.jsx(it,{children:a.jsx("div",{className:"w-20 h-20 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsx(it,{children:a.jsxs("div",{className:"space-y-1 max-w-xs",children:[a.jsx("div",{className:"font-medium truncate",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[Oe.emoji_hash.slice(0,16),"..."]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:Oe.format.toUpperCase()})}),a.jsx(it,{children:a.jsx(UN,{emotions:Oe.emotion})}),a.jsx(it,{className:"align-middle",children:a.jsxs("div",{className:"flex gap-2 justify-center",children:[Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]})]})}),a.jsx(it,{className:"text-right font-mono",children:Oe.usage_count}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>me(Oe),children:[a.jsx(co,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-4 w-4 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-4 w-4 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Oe.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3",children:t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(Oe=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(Oe.id),alt:Oe.description||"表情包",className:"w-full h-full object-cover",onError:nt=>{const ut=nt.target;ut.style.display="none";const Ct=ut.parentElement;Ct&&(Ct.innerHTML='')}})})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[a.jsxs("div",{className:"min-w-0 w-full overflow-hidden",children:[a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",title:Oe.description||"无描述",children:Oe.description||"无描述"}),a.jsxs("p",{className:"text-xs text-muted-foreground font-mono line-clamp-1 w-full break-all",children:[Oe.emoji_hash.slice(0,16),"..."]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-w-0",children:[a.jsx(On,{variant:"outline",className:"text-xs flex-shrink-0",children:Oe.format.toUpperCase()}),Oe.is_registered&&a.jsxs(On,{variant:"default",className:"bg-green-600 text-xs flex-shrink-0",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"已注册"]}),Oe.is_banned&&a.jsxs(On,{variant:"destructive",className:"text-xs flex-shrink-0",children:[a.jsx(Kb,{className:"h-3 w-3 mr-1"}),"已封禁"]}),a.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["使用: ",Oe.usage_count]})]}),Oe.emotion&&Oe.emotion.length>0&&a.jsx("div",{className:"min-w-0 overflow-hidden",children:a.jsx(UN,{emotions:Oe.emotion})})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>me(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(co,{className:"h-3 w-3 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>Y(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),!Oe.is_registered&&a.jsxs(ie,{size:"sm",onClick:()=>H(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(Es,{className:"h-3 w-3 mr-1"}),"注册"]}),!Oe.is_banned&&a.jsxs(ie,{size:"sm",onClick:()=>fe(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-orange-600 hover:bg-orange-700 text-white",children:[a.jsx(cO,{className:"h-3 w-3 mr-1"}),"封禁"]}),a.jsxs(ie,{size:"sm",onClick:()=>P(Oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Oe.id))}),d>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*m+1," 到"," ",Math.min(l*m,d)," 条,共 ",d," 条"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Math.max(1,Oe-1)),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:$,onChange:Oe=>ae(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&We(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/m)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:We,disabled:!$,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(Oe=>Oe+1),disabled:l>=Math.ceil(d/m),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(d/m)),disabled:l>=Math.ceil(d/m),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]}),a.jsx(dde,{emoji:_,open:E,onOpenChange:z}),a.jsx(hde,{emoji:_,open:Q,onOpenChange:F,onSuccess:()=>{ue(),R()}})]})}),a.jsx(pn,{open:W,onOpenChange:J,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["你确定要删除选中的 ",V.size," 个表情包吗?此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:de,children:"确认删除"})]})]})}),a.jsx(Rr,{open:L,onOpenChange:U,children:a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"确认删除"}),a.jsx(Gr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>U(!1),children:"取消"}),a.jsx(ie,{variant:"destructive",onClick:K,children:"删除"})]})]})})]})}function dde({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[90vh]",children:[a.jsx(Cr,{children:a.jsx(Tr,{children:"表情包详情"})}),a.jsx(mn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex justify-center",children:a.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:a.jsx("img",{src:D4(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const l=i.parentElement;l&&(l.innerHTML='')}})})}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"ID"}),a.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"格式"}),a.jsx("div",{className:"mt-1",children:a.jsx(On,{variant:"outline",children:t.format.toUpperCase()})})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"文件路径"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"哈希值"}),a.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"描述"}),t.description?a.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:a.jsx(tde,{className:"prose-sm",children:t.description})}):a.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"情绪标签"}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(()=>{const s=t.emotion?t.emotion.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];return s.length>0?s.map((i,l)=>a.jsx(On,{variant:"secondary",children:i},l)):a.jsx("span",{className:"text-sm text-muted-foreground",children:"无"})})()})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"状态"}),a.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&a.jsx(On,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&a.jsx(On,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&a.jsx(On,{variant:"outline",children:"未注册"})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"使用次数"}),a.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"记录时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"注册时间"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),a.jsxs("div",{children:[a.jsx(te,{className:"text-muted-foreground",children:"最后使用"}),a.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function hde({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState(""),[l,c]=S.useState(""),[d,h]=S.useState(!1),[m,p]=S.useState(!1),[x,v]=S.useState(!1),{toast:b}=Pr();S.useEffect(()=>{t&&(i(t.description||""),c(t.emotion||""),h(t.is_registered),p(t.is_banned))},[t]);const k=async()=>{if(t)try{v(!0);const O=l.split(/[,,]/).map(j=>j.trim()).filter(Boolean).join(",");await sde(t.id,{description:s||void 0,emotion:O||void 0,is_registered:d,is_banned:m}),b({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(O){const j=O instanceof Error?O.message:"保存失败";b({title:"错误",description:j,variant:"destructive"})}finally{v(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表情包"}),a.jsx(Gr,{children:"修改表情包的描述和标签信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(te,{children:"描述"}),a.jsx(_n,{value:s,onChange:O=>i(O.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),a.jsxs("div",{children:[a.jsx(te,{children:"情绪标签"}),a.jsx(Me,{value:l,onChange:O=>c(O.target.value),placeholder:"使用逗号分隔多个标签,如:开心, 微笑, 快乐",className:"mt-1"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入多个标签时使用逗号分隔(支持中英文逗号)"})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_registered",checked:d,onCheckedChange:O=>h(O===!0)}),a.jsx(te,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"is_banned",checked:m,onCheckedChange:O=>p(O===!0)}),a.jsx(te,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:k,disabled:x,children:x?"保存中...":"保存"})]})]})}):null}function UN({emotions:t}){const e=t?t.split(/[,,]/).map(i=>i.trim()).filter(Boolean):[];if(e.length===0)return a.jsx("span",{className:"text-xs text-muted-foreground",children:"-"});const n=(i,l=6)=>i.length<=l?i:i.slice(0,l)+"...",r=e.slice(0,3),s=e.length-3;return a.jsxs("div",{className:"flex flex-wrap gap-1 max-w-full overflow-hidden",children:[r.map((i,l)=>a.jsx(On,{variant:"secondary",className:"text-xs flex-shrink-0",title:i,children:n(i)},l)),s>0&&a.jsxs(On,{variant:"outline",className:"text-xs flex-shrink-0",title:`还有 ${s} 个标签: ${e.slice(3).join(", ")}`,children:["+",s]})]})}const Pc="/api/webui/expression";async function fde(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 ot(`${Pc}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function mde(t){const e=await ot(`${Pc}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function pde(t){const e=await ot(`${Pc}/`,{method:"POST",headers:bt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function gde(t,e){const n=await ot(`${Pc}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function xde(t){const e=await ot(`${Pc}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function vde(t){const e=await ot(`${Pc}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function yde(){const t=await ot(`${Pc}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function bde(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(null),[b,k]=S.useState(!1),[O,j]=S.useState(!1),[T,A]=S.useState(!1),[_,D]=S.useState(null),[E,z]=S.useState(new Set),[Q,F]=S.useState(!1),[L,U]=S.useState(""),[V,ce]=S.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),{toast:W}=Pr(),J=async()=>{try{r(!0);const H=await fde({page:l,page_size:d,search:m||void 0});e(H.data),i(H.total)}catch(H){W({title:"加载失败",description:H instanceof Error?H.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},$=async()=>{try{const H=await yde();ce(H.data)}catch(H){console.error("加载统计数据失败:",H)}};S.useEffect(()=>{J(),$()},[l,d,m]);const ae=async H=>{try{const fe=await mde(H.id);v(fe.data),k(!0)}catch(fe){W({title:"加载详情失败",description:fe instanceof Error?fe.message:"无法加载表达方式详情",variant:"destructive"})}},ne=H=>{v(H),j(!0)},ue=async H=>{try{await xde(H.id),W({title:"删除成功",description:`已删除表达方式: ${H.situation}`}),D(null),J(),$()}catch(fe){W({title:"删除失败",description:fe instanceof Error?fe.message:"无法删除表达方式",variant:"destructive"})}},R=H=>{const fe=new Set(E);fe.has(H)?fe.delete(H):fe.add(H),z(fe)},me=()=>{E.size===t.length&&t.length>0?z(new Set):z(new Set(t.map(H=>H.id)))},Y=async()=>{try{await vde(Array.from(E)),W({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),z(new Set),F(!1),J(),$()}catch(H){W({title:"批量删除失败",description:H instanceof Error?H.message:"无法批量删除表达方式",variant:"destructive"})}},P=()=>{const H=parseInt(L),fe=Math.ceil(s/d);H>=1&&H<=fe?(c(H),U("")):W({title:"无效的页码",description:`请输入1-${fe}之间的页码`,variant:"destructive"})},K=H=>H?new Date(H*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Wf,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),a.jsxs(ie,{onClick:()=>A(!0),className:"gap-2",children:[a.jsx(Wr,{className:"h-4 w-4"}),"新增表达方式"]})]})}),a.jsx(mn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索情境、风格或上下文...",value:m,onChange:H=>p(H.target.value),className:"pl-9"})]})}),a.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:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&a.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:H=>{h(parseInt(H)),c(1),z(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),E.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>z(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>F(!0),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:E.size===t.length&&t.length>0,onCheckedChange:me})}),a.jsx(xt,{children:"情境"}),a.jsx(xt,{children:"风格"}),a.jsx(xt,{children:"聊天ID"}),a.jsx(xt,{children:"最后活跃"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(H=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>R(H.id)})}),a.jsx(it,{className:"font-medium max-w-xs truncate",children:H.situation}),a.jsx(it,{className:"max-w-xs truncate",children:H.style}),a.jsx(it,{className:"font-mono text-sm",children:H.chat_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:K(H.last_active_time)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ae(H),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ne(H),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>D(H),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},H.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(H=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:E.has(H.id),onCheckedChange:()=>R(H.id),className:"mt-1"}),a.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:H.situation,children:H.situation})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),a.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:H.style,children:H.style})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天ID"}),a.jsx("p",{className:"font-mono text-xs truncate",children:H.chat_id})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后活跃"}),a.jsx("p",{className:"text-xs",children:K(H.last_active_time)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ae(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ne(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>D(H),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},H.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:L,onChange:H=>U(H.target.value),onKeyDown:H=>H.key==="Enter"&&P(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:P,disabled:!L,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(wde,{expression:x,open:b,onOpenChange:k}),a.jsx(Sde,{open:T,onOpenChange:A,onSuccess:()=>{J(),$(),A(!1)}}),a.jsx(kde,{expression:x,open:O,onOpenChange:j,onSuccess:()=>{J(),$(),j(!1)}}),a.jsx(pn,{open:!!_,onOpenChange:()=>D(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除表达方式 "',_?.situation,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>_&&ue(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(Ode,{open:Q,onOpenChange:F,onConfirm:Y,count:E.size})]})}function wde({expression:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"表达方式详情"}),a.jsx(Gr,{children:"查看表达方式的完整信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{label:"情境",value:t.situation}),a.jsx(Au,{label:"风格",value:t.style}),a.jsx(Au,{icon:mg,label:"聊天ID",value:t.chat_id,mono:!0}),a.jsx(Au,{icon:mg,label:"记录ID",value:t.id.toString(),mono:!0})]}),t.context&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上下文"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.context})]}),t.up_content&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"上文内容"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.up_content})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Au,{icon:dc,label:"最后活跃",value:r(t.last_active_time)}),a.jsx(Au,{icon:dc,label:"创建时间",value:r(t.create_date)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Au({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Sde({open:t,onOpenChange:e,onSuccess:n}){const[r,s]=S.useState({situation:"",style:"",context:"",up_content:"",chat_id:""}),[i,l]=S.useState(!1),{toast:c}=Pr(),d=async()=>{if(!r.situation||!r.style||!r.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天ID",variant:"destructive"});return}try{l(!0),await pde(r),c({title:"创建成功",description:"表达方式已创建"}),s({situation:"",style:"",context:"",up_content:"",chat_id:""}),n()}catch(h){c({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"新增表达方式"}),a.jsx(Gr,{children:"创建新的表达方式记录"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"situation",children:["情境 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"situation",value:r.situation,onChange:h=>s({...r,situation:h.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"style",children:["风格 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"style",value:r.style,onChange:h=>s({...r,style:h.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(te,{htmlFor:"chat_id",children:["聊天ID ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Me,{id:"chat_id",value:r.chat_id,onChange:h=>s({...r,chat_id:h.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"context",children:"上下文"}),a.jsx(_n,{id:"context",value:r.context,onChange:h=>s({...r,context:h.target.value}),placeholder:"上下文信息(可选)",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"up_content",children:"上文内容"}),a.jsx(_n,{id:"up_content",value:r.up_content,onChange:h=>s({...r,up_content:h.target.value}),placeholder:"上文内容(可选)",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>e(!1),children:"取消"}),a.jsx(ie,{onClick:d,disabled:i,children:i?"创建中...":"创建"})]})]})})}function kde({expression:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.useEffect(()=>{t&&i({situation:t.situation,style:t.style,context:t.context||"",up_content:t.up_content||"",chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{c(!0),await gde(t.id,s),d({title:"保存成功",description:"表达方式已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑表达方式"}),a.jsx(Gr,{children:"修改表达方式的信息"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_situation",children:"情境"}),a.jsx(Me,{id:"edit_situation",value:s.situation||"",onChange:m=>i({...s,situation:m.target.value}),placeholder:"描述使用场景"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_style",children:"风格"}),a.jsx(Me,{id:"edit_style",value:s.style||"",onChange:m=>i({...s,style:m.target.value}),placeholder:"描述表达风格"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_chat_id",children:"聊天ID"}),a.jsx(Me,{id:"edit_chat_id",value:s.chat_id||"",onChange:m=>i({...s,chat_id:m.target.value}),placeholder:"关联的聊天ID"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_context",children:"上下文"}),a.jsx(_n,{id:"edit_context",value:s.context||"",onChange:m=>i({...s,context:m.target.value}),placeholder:"上下文信息",rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit_up_content",children:"上文内容"}),a.jsx(_n,{id:"edit_up_content",value:s.up_content||"",onChange:m=>i({...s,up_content:m.target.value}),placeholder:"上文内容",rows:3})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Ode({open:t,onOpenChange:e,onConfirm:n,count:r}){return a.jsx(pn,{open:t,onOpenChange:e,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Pd="/api/webui/person";async function jde(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 ot(`${Pd}/list?${e}`,{headers:bt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function Nde(t){const e=await ot(`${Pd}/${t}`,{headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Cde(t,e){const n=await ot(`${Pd}/${t}`,{method:"PATCH",headers:bt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Tde(t){const e=await ot(`${Pd}/${t}`,{method:"DELETE",headers:bt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Ade(){const t=await ot(`${Pd}/stats/summary`,{headers:bt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Mde(t){const e=await ot(`${Pd}/batch/delete`,{method:"POST",headers:bt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Ede(){const[t,e]=S.useState([]),[n,r]=S.useState(!0),[s,i]=S.useState(0),[l,c]=S.useState(1),[d,h]=S.useState(20),[m,p]=S.useState(""),[x,v]=S.useState(void 0),[b,k]=S.useState(void 0),[O,j]=S.useState(null),[T,A]=S.useState(!1),[_,D]=S.useState(!1),[E,z]=S.useState(null),[Q,F]=S.useState({total:0,known:0,unknown:0,platforms:{}}),[L,U]=S.useState(new Set),[V,ce]=S.useState(!1),[W,J]=S.useState(""),{toast:$}=Pr(),ae=async()=>{try{r(!0);const de=await jde({page:l,page_size:d,search:m||void 0,is_known:x,platform:b});e(de.data),i(de.total)}catch(de){$({title:"加载失败",description:de instanceof Error?de.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},ne=async()=>{try{const de=await Ade();F(de.data)}catch(de){console.error("加载统计数据失败:",de)}};S.useEffect(()=>{ae(),ne()},[l,d,m,x,b]);const ue=async de=>{try{const We=await Nde(de.person_id);j(We.data),A(!0)}catch(We){$({title:"加载详情失败",description:We instanceof Error?We.message:"无法加载人物详情",variant:"destructive"})}},R=de=>{j(de),D(!0)},me=async de=>{try{await Tde(de.person_id),$({title:"删除成功",description:`已删除人物信息: ${de.person_name||de.nickname||de.user_id}`}),z(null),ae(),ne()}catch(We){$({title:"删除失败",description:We instanceof Error?We.message:"无法删除人物信息",variant:"destructive"})}},Y=S.useMemo(()=>Object.keys(Q.platforms),[Q.platforms]),P=de=>{const We=new Set(L);We.has(de)?We.delete(de):We.add(de),U(We)},K=()=>{L.size===t.length&&t.length>0?U(new Set):U(new Set(t.map(de=>de.person_id)))},H=()=>{if(L.size===0){$({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ce(!0)},fe=async()=>{try{const de=await Mde(Array.from(L));$({title:"批量删除完成",description:de.message}),U(new Set),ce(!1),ae(),ne()}catch(de){$({title:"批量删除失败",description:de instanceof Error?de.message:"批量删除失败",variant:"destructive"})}},ve=()=>{const de=parseInt(W),We=Math.ceil(s/d);de>=1&&de<=We?(c(de),J("")):$({title:"无效的页码",description:`请输入1-${We}之间的页码`,variant:"destructive"})},Re=de=>de?new Date(de*1e3).toLocaleString("zh-CN"):"-";return a.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[a.jsx("div",{className:"mb-4 sm:mb-6",children:a.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[a.jsx(Oq,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),a.jsx(mn,{className:"flex-1",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),a.jsx("div",{className:"text-2xl font-bold mt-1",children:Q.total})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:Q.known})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),a.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:Q.unknown})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"sm:col-span-2",children:[a.jsx(te,{htmlFor:"search",children:"搜索"}),a.jsxs("div",{className:"relative mt-1.5",children:[a.jsx(Bs,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:m,onChange:de=>p(de.target.value),className:"pl-9"})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-known",children:"认识状态"}),a.jsxs(Lt,{value:x===void 0?"all":x.toString(),onValueChange:de=>{v(de==="all"?void 0:de==="true"),c(1)},children:[a.jsx(Dt,{id:"filter-known",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部"}),a.jsx(Pe,{value:"true",children:"已认识"}),a.jsx(Pe,{value:"false",children:"未认识"})]})]})]}),a.jsxs("div",{children:[a.jsx(te,{htmlFor:"filter-platform",children:"平台"}),a.jsxs(Lt,{value:b||"all",onValueChange:de=>{k(de==="all"?void 0:de),c(1)},children:[a.jsx(Dt,{id:"filter-platform",className:"mt-1.5",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部平台"}),Y.map(de=>a.jsxs(Pe,{value:de,children:[de," (",Q.platforms[de],")"]},de))]})]})]})]}),a.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:[a.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:L.size>0&&a.jsxs("span",{children:["已选择 ",L.size," 个人物"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(te,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),a.jsxs(Lt,{value:d.toString(),onValueChange:de=>{h(parseInt(de)),c(1),U(new Set)},children:[a.jsx(Dt,{id:"page-size",className:"w-20",children:a.jsx(It,{})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"10",children:"10"}),a.jsx(Pe,{value:"20",children:"20"}),a.jsx(Pe,{value:"50",children:"50"}),a.jsx(Pe,{value:"100",children:"100"})]})]}),L.size>0&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>U(new Set),children:"取消选择"}),a.jsxs(ie,{variant:"destructive",size:"sm",onClick:H,children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),a.jsxs("div",{className:"rounded-lg border bg-card",children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{className:"w-12",children:a.jsx(ss,{checked:t.length>0&&L.size===t.length,onCheckedChange:K,"aria-label":"全选"})}),a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"昵称"}),a.jsx(xt,{children:"平台"}),a.jsx(xt,{children:"用户ID"}),a.jsx(xt,{children:"最后更新"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?a.jsx(xr,{children:a.jsx(it,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(de=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(ss,{checked:L.has(de.person_id),onCheckedChange:()=>P(de.person_id),"aria-label":`选择 ${de.person_name||de.nickname||de.user_id}`})}),a.jsx(it,{children:a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",de.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:de.is_known?"已认识":"未认识"})}),a.jsx(it,{className:"font-medium",children:de.person_name||a.jsx("span",{className:"text-muted-foreground",children:"-"})}),a.jsx(it,{children:de.nickname||"-"}),a.jsx(it,{children:de.platform}),a.jsx(it,{className:"font-mono text-sm",children:de.user_id}),a.jsx(it,{className:"text-sm text-muted-foreground",children:Re(de.last_know)}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>ue(de),children:[a.jsx($i,{className:"h-4 w-4 mr-1"}),"详情"]}),a.jsxs(ie,{variant:"default",size:"sm",onClick:()=>R(de),children:[a.jsx(rd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsxs(ie,{size:"sm",onClick:()=>z(de),className:"bg-red-600 hover:bg-red-700 text-white",children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},de.id))})]})}),a.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?a.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(de=>a.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(ss,{checked:L.has(de.person_id),onCheckedChange:()=>P(de.person_id),className:"mt-1"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",de.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:de.is_known?"已认识":"未认识"}),a.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:de.person_name||a.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),de.nickname&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",de.nickname]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),a.jsx("p",{className:"font-medium text-xs",children:de.platform})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),a.jsx("p",{className:"font-mono text-xs truncate",title:de.user_id,children:de.user_id})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),a.jsx("p",{className:"text-xs",children:Re(de.last_know)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>ue(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx($i,{className:"h-3 w-3 mr-1"}),"查看"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>R(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[a.jsx(rd,{className:"h-3 w-3 mr-1"}),"编辑"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>z(de),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[a.jsx(Ht,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},de.id))}),s>0&&a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",l," / ",Math.ceil(s/d)," 页"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(1),disabled:l===1,className:"hidden sm:flex",children:a.jsx(Xf,{className:"h-4 w-4"})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l-1),disabled:l===1,children:[a.jsx(Tc,{className:"h-4 w-4 sm:mr-1"}),a.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Me,{type:"number",value:W,onChange:de=>J(de.target.value),onKeyDown:de=>de.key==="Enter"&&ve(),placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/d)}),a.jsx(ie,{variant:"outline",size:"sm",onClick:ve,disabled:!W,className:"h-8",children:"跳转"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(l+1),disabled:l>=Math.ceil(s/d),children:[a.jsx("span",{className:"hidden sm:inline",children:"下一页"}),a.jsx(Ac,{className:"h-4 w-4 sm:ml-1"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>c(Math.ceil(s/d)),disabled:l>=Math.ceil(s/d),className:"hidden sm:flex",children:a.jsx(Yf,{className:"h-4 w-4"})})]})]})]})]})}),a.jsx(_de,{person:O,open:T,onOpenChange:A}),a.jsx(Dde,{person:O,open:_,onOpenChange:D,onSuccess:()=>{ae(),ne(),D(!1)}}),a.jsx(pn,{open:!!E,onOpenChange:()=>z(null),children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认删除"}),a.jsxs(dn,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:()=>E&&me(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),a.jsx(pn,{open:V,onOpenChange:ce,children:a.jsxs(ln,{children:[a.jsxs(on,{children:[a.jsx(un,{children:"确认批量删除"}),a.jsxs(dn,{children:["确定要删除选中的 ",L.size," 个人物信息吗? 此操作不可撤销。"]})]}),a.jsxs(cn,{children:[a.jsx(fn,{children:"取消"}),a.jsx(hn,{onClick:fe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function _de({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"人物详情"}),a.jsxs(Gr,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Za,{icon:D9,label:"人物名称",value:t.person_name}),a.jsx(Za,{icon:Wf,label:"昵称",value:t.nickname}),a.jsx(Za,{icon:mg,label:"用户ID",value:t.user_id,mono:!0}),a.jsx(Za,{icon:mg,label:"人物ID",value:t.person_id,mono:!0}),a.jsx(Za,{label:"平台",value:t.platform}),a.jsx(Za,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),a.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"个人印象"}),a.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&a.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[a.jsx(te,{className:"text-xs text-muted-foreground",children:"群昵称"}),a.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>a.jsxs("div",{className:"text-sm flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),a.jsx("span",{children:"→"}),a.jsx("span",{children:s.group_nick_name})]},i))})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsx(Za,{icon:dc,label:"认识时间",value:r(t.know_times)}),a.jsx(Za,{icon:dc,label:"首次记录",value:r(t.know_since)}),a.jsx(Za,{icon:dc,label:"最后更新",value:r(t.last_know)})]})]}),a.jsx(ps,{children:a.jsx(ie,{onClick:()=>n(!1),children:"关闭"})})]})})}function Za({icon:t,label:e,value:n,mono:r=!1}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(te,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&a.jsx(t,{className:"h-3 w-3"}),e]}),a.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Dde({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=S.useState({}),[l,c]=S.useState(!1),{toast:d}=Pr();S.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{c(!0),await Cde(t.person_id,s),d({title:"保存成功",description:"人物信息已更新"}),r()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新人物信息",variant:"destructive"})}finally{c(!1)}};return t?a.jsx(Rr,{open:e,onOpenChange:n,children:a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑人物信息"}),a.jsxs(Gr,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"person_name",children:"人物名称"}),a.jsx(Me,{id:"person_name",value:s.person_name||"",onChange:m=>i({...s,person_name:m.target.value}),placeholder:"为这个人设置一个名称"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"nickname",children:"昵称"}),a.jsx(Me,{id:"nickname",value:s.nickname||"",onChange:m=>i({...s,nickname:m.target.value}),placeholder:"昵称"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"name_reason",children:"名称设定原因"}),a.jsx(_n,{id:"name_reason",value:s.name_reason||"",onChange:m=>i({...s,name_reason:m.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"memory_points",children:"个人印象"}),a.jsx(_n,{id:"memory_points",value:s.memory_points||"",onChange:m=>i({...s,memory_points:m.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[a.jsxs("div",{children:[a.jsx(te,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),a.jsx(jt,{id:"is_known",checked:s.is_known,onCheckedChange:m=>i({...s,is_known:m})})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>n(!1),children:"取消"}),a.jsx(ie,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function Rde(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 zde={},Wh={};function uc(t,e){try{const r=(zde[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Wh?Wh[r]:VN(r,r.split(":"))}catch{if(t in Wh)return Wh[t];const n=t?.match(Pde);return n?VN(t,n.slice(1)):NaN}}const Pde=/([+-]\d\d):?(\d\d)?/;function VN(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return Wh[t]=n*60+r>0?n*60+r+s:n*60-r-s}class xa extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(uc(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)),lz(this),R4(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new xa(...n,e):new xa(Date.now(),e)}withTimeZone(e){return new xa(+this,e)}getTimezoneOffset(){const e=-uc(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),R4(this),+this}[Symbol.for("constructDateFrom")](e){return new xa(+new Date(e),this.timeZone)}}const WN=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!WN.test(t))return;const e=t.replace(WN,"$1UTC");xa.prototype[e]&&(t.startsWith("get")?xa.prototype[t]=function(){return this.internal[e]()}:(xa.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),Bde(this),+this},xa.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),R4(this),+this}))});function R4(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-uc(t.timeZone,t)*60))}function Bde(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()),lz(t)}function lz(t){const e=uc(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(),l=s-i,c=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();l&&c&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+l);const d=s-n;d&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+d);const h=new Date(+t);h.setUTCSeconds(0);const m=s>0?h.getSeconds():(h.getSeconds()-60)%60,p=Math.round(-(uc(t.timeZone,t)*60))%60;(p||m)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+p),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+p+m));const x=uc(t.timeZone,t),v=x>0?Math.floor(x):Math.ceil(x),k=-new Date(+t).getTimezoneOffset()-v,O=v!==n,j=k-d;if(O&&j){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+j);const T=uc(t.timeZone,t),A=T>0?Math.floor(T):Math.ceil(T),_=v-A;_&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+_),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_))}}class Zr extends xa{static tz(e,...n){return n.length?new Zr(...n,e):new Zr(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} (${Rde(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 Zr(+this,e)}[Symbol.for("constructDateFrom")](e){return new Zr(+new Date(e),this.timeZone)}}const oz=6048e5,Lde=864e5,GN=Symbol.for("constructDateFrom");function vr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&GN in t?t[GN](e):t instanceof Date?new t.constructor(e):new Date(e)}function Nn(t,e){return vr(e||t,t)}function cz(t,e,n){const r=Nn(t,n?.in);return isNaN(e)?vr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function uz(t,e,n){const r=Nn(t,n?.in);if(isNaN(e))return vr(t,NaN);if(!e)return r;const s=r.getDate(),i=vr(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const l=i.getDate();return s>=l?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let Ide={};function O0(){return Ide}function So(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i=i.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function XN(t){const e=Nn(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 Bc(t,...e){const n=vr.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function Qf(t,e){const n=Nn(t,e?.in);return n.setHours(0,0,0,0),n}function hz(t,e,n){const[r,s]=Bc(n?.in,t,e),i=Qf(r),l=Qf(s),c=+i-XN(i),d=+l-XN(l);return Math.round((c-d)/Lde)}function qde(t,e){const n=dz(t,e),r=vr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ff(r)}function Fde(t,e,n){return cz(t,e*7,n)}function Qde(t,e,n){return uz(t,e*12,n)}function $de(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n{!r&&typeof s=="object"&&(r=vr.bind(null,s));const i=Nn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),vr(r,n||NaN)}function Ude(t,e,n){const[r,s]=Bc(n?.in,t,e);return+Qf(r)==+Qf(s)}function fz(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Vde(t){return!(!fz(t)&&typeof t!="number"||isNaN(+Nn(t)))}function Wde(t,e,n){const[r,s]=Bc(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),l=r.getMonth()-s.getMonth();return i*12+l}function Gde(t,e){const n=Nn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function mz(t,e){const[n,r]=Bc(t,e.start,e.end);return{start:n,end:r}}function Xde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setDate(1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setMonth(l.getMonth()+c);return s?d.reverse():d}function Yde(t,e){const n=Nn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Kde(t,e){const n=Nn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function pz(t,e){const n=Nn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Zde(t,e){const{start:n,end:r}=mz(e?.in,t);let s=+n>+r;const i=s?+n:+r,l=s?r:n;l.setHours(0,0,0,0),l.setMonth(0,1);let c=1;const d=[];for(;+l<=i;)d.push(vr(n,l)),l.setFullYear(l.getFullYear()+c);return s?d.reverse():d}function gz(t,e){const n=O0(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Nn(t,e?.in),i=s.getDay(),l=(i{let r;const s=ehe[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 td(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const nhe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rhe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},she={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ihe={date:td({formats:nhe,defaultWidth:"full"}),time:td({formats:rhe,defaultWidth:"full"}),dateTime:td({formats:she,defaultWidth:"full"})},ahe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},lhe=(t,e,n,r)=>ahe[t];function ua(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,c=n?.width?String(n.width):l;s=t.formattingValues[c]||t.formattingValues[l]}else{const l=t.defaultWidth,c=n?.width?String(n.width):t.defaultWidth;s=t.values[c]||t.values[l]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const ohe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},che={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},uhe={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"]},dhe={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"]},hhe={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"}},fhe={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"}},mhe=(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"},phe={ordinalNumber:mhe,era:ua({values:ohe,defaultWidth:"wide"}),quarter:ua({values:che,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:uhe,defaultWidth:"wide"}),day:ua({values:dhe,defaultWidth:"wide"}),dayPeriod:ua({values:hhe,defaultWidth:"wide",formattingValues:fhe,defaultFormattingWidth:"wide"})};function da(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 l=i[0],c=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(c)?xhe(c,p=>p.test(l)):ghe(c,p=>p.test(l));let h;h=t.valueCallback?t.valueCallback(d):d,h=n.valueCallback?n.valueCallback(h):h;const m=e.slice(l.length);return{value:h,rest:m}}}function ghe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function xhe(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let l=t.valueCallback?t.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const c=e.slice(s.length);return{value:l,rest:c}}}const vhe=/^(\d+)(th|st|nd|rd)?/i,yhe=/\d+/i,bhe={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},whe={any:[/^b/i,/^(a|c)/i]},She={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},khe={any:[/1/i,/2/i,/3/i,/4/i]},Ohe={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},jhe={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]},Nhe={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},Che={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]},The={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},Ahe={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}},Mhe={ordinalNumber:xz({matchPattern:vhe,parsePattern:yhe,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:bhe,defaultMatchWidth:"wide",parsePatterns:whe,defaultParseWidth:"any"}),quarter:da({matchPatterns:She,defaultMatchWidth:"wide",parsePatterns:khe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:Ohe,defaultMatchWidth:"wide",parsePatterns:jhe,defaultParseWidth:"any"}),day:da({matchPatterns:Nhe,defaultMatchWidth:"wide",parsePatterns:Che,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:The,defaultMatchWidth:"any",parsePatterns:Ahe,defaultParseWidth:"any"})},G5={code:"en-US",formatDistance:the,formatLong:ihe,formatRelative:lhe,localize:phe,match:Mhe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ehe(t,e){const n=Nn(t,e?.in);return hz(n,pz(n))+1}function vz(t,e){const n=Nn(t,e?.in),r=+Ff(n)-+qde(n);return Math.round(r/oz)+1}function yz(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=O0(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,l=vr(e?.in||t,0);l.setFullYear(r+1,0,i),l.setHours(0,0,0,0);const c=So(l,e),d=vr(e?.in||t,0);d.setFullYear(r,0,i),d.setHours(0,0,0,0);const h=So(d,e);return+n>=+c?r+1:+n>=+h?r:r-1}function _he(t,e){const n=O0(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=yz(t,e),i=vr(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),So(i,e)}function bz(t,e){const n=Nn(t,e?.in),r=+So(n,e)-+_he(n,e);return Math.round(r/oz)+1}function vn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Zl={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return vn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):vn(n+1,2)},d(t,e){return vn(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 vn(t.getHours()%12||12,e.length)},H(t,e){return vn(t.getHours(),e.length)},m(t,e){return vn(t.getMinutes(),e.length)},s(t,e){return vn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return vn(s,e.length)}},Mu={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},YN={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 Zl.y(t,e)},Y:function(t,e,n,r){const s=yz(t,r),i=s>0?s:1-s;if(e==="YY"){const l=i%100;return vn(l,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):vn(i,e.length)},R:function(t,e){const n=dz(t);return vn(n,e.length)},u:function(t,e){const n=t.getFullYear();return vn(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 vn(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 vn(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 Zl.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 vn(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=bz(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):vn(s,e.length)},I:function(t,e,n){const r=vz(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):vn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Zl.d(t,e)},D:function(t,e,n){const r=Ehe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):vn(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 vn(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 vn(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 vn(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=Mu.noon:r===0?s=Mu.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=Mu.evening:r>=12?s=Mu.afternoon:r>=4?s=Mu.morning:s=Mu.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 Zl.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Zl.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):vn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):vn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Zl.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Zl.s(t,e)},S:function(t,e){return Zl.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ZN(r);case"XXXX":case"XX":return rc(r);case"XXXXX":case"XXX":default:return rc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ZN(r);case"xxxx":case"xx":return rc(r);case"xxxxx":case"xxx":default:return rc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+KN(r,":");case"OOOO":default:return"GMT"+rc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+KN(r,":");case"zzzz":default:return"GMT"+rc(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return vn(r,e.length)},T:function(t,e,n){return vn(+t,e.length)}};function KN(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+vn(i,2)}function ZN(t,e){return t%60===0?(t>0?"-":"+")+vn(Math.abs(t)/60,2):rc(t,e)}function rc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=vn(Math.trunc(r/60),2),i=vn(r%60,2);return n+s+e+i}const JN=(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"})}},wz=(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"})}},Dhe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return JN(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}}",JN(r,e)).replace("{{time}}",wz(s,e))},Rhe={p:wz,P:Dhe},zhe=/^D+$/,Phe=/^Y+$/,Bhe=["D","DD","YY","YYYY"];function Lhe(t){return zhe.test(t)}function Ihe(t){return Phe.test(t)}function qhe(t,e,n){const r=Fhe(t,e,n);if(console.warn(r),Bhe.includes(t))throw new RangeError(r)}function Fhe(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 Qhe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$he=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hhe=/^'([^]*?)'?$/,Uhe=/''/g,Vhe=/[a-zA-Z]/;function dg(t,e,n){const r=O0(),s=n?.locale??r.locale??G5,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,l=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,c=Nn(t,n?.in);if(!Vde(c))throw new RangeError("Invalid time value");let d=e.match($he).map(m=>{const p=m[0];if(p==="p"||p==="P"){const x=Rhe[p];return x(m,s.formatLong)}return m}).join("").match(Qhe).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const p=m[0];if(p==="'")return{isToken:!1,value:Whe(m)};if(YN[p])return{isToken:!0,value:m};if(p.match(Vhe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:m}});s.localize.preprocessor&&(d=s.localize.preprocessor(c,d));const h={firstWeekContainsDate:i,weekStartsOn:l,locale:s};return d.map(m=>{if(!m.isToken)return m.value;const p=m.value;(!n?.useAdditionalWeekYearTokens&&Ihe(p)||!n?.useAdditionalDayOfYearTokens&&Lhe(p))&&qhe(p,e,String(t));const x=YN[p[0]];return x(c,p,s.localize,h)}).join("")}function Whe(t){const e=t.match(Hhe);return e?e[1].replace(Uhe,"'"):t}function Ghe(t,e){const n=Nn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=vr(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Xhe(t,e){return Nn(t,e?.in).getMonth()}function Yhe(t,e){return Nn(t,e?.in).getFullYear()}function Khe(t,e){return+Nn(t)>+Nn(e)}function Zhe(t,e){return+Nn(t)<+Nn(e)}function Jhe(t,e,n){const[r,s]=Bc(n?.in,t,e);return+So(r,n)==+So(s,n)}function efe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function tfe(t,e,n){const[r,s]=Bc(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function nfe(t,e,n){const r=Nn(t,n?.in),s=r.getFullYear(),i=r.getDate(),l=vr(t,0);l.setFullYear(s,e,15),l.setHours(0,0,0,0);const c=Ghe(l);return r.setMonth(e,Math.min(i,c)),r}function rfe(t,e,n){const r=Nn(t,n?.in);return isNaN(+r)?vr(t,NaN):(r.setFullYear(e),r)}const e9=5,sfe=4;function ife(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,e9*7-1);return e.getMonth(t)===e.getMonth(i)?e9:sfe}function Sz(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 afe(t,e){const n=Sz(t,e),r=ife(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?Zr.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 Zr(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):cz(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):uz(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):Fde(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):Qde(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):hz(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):Wde(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Xde(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Zde(r),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const l=[];return i.forEach(c=>{l.push(new Date(c,0,1))}),l},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):afe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Jde(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Gde(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):gz(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Kde(r),this.format=(r,s,i)=>{const l=this.overrides?.format?this.overrides.format(r,s,this.options):dg(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(l):l},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):vz(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Xhe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Yhe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):bz(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):Khe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):Zhe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):fz(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):Ude(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):efe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):tfe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):$de(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Hde(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):nfe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):rfe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Sz(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Qf(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Ff(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Yde(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):So(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):pz(r),this.options={locale:G5,...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 l=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,l)}}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 Ma=new ai;class kz{constructor(e,n,r=Ma){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 lfe{constructor(e,n){this.date=e,this.weeks=n}}class ofe{constructor(e,n){this.days=n,this.weekNumber=e}}function cfe(t){return Ue.createElement("button",{...t})}function ufe(t){return Ue.createElement("span",{...t})}function dfe(t){const{size:e=24,orientation:n="left",className:r}=t;return Ue.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&Ue.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&Ue.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&Ue.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&Ue.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function hfe(t){const{day:e,modifiers:n,...r}=t;return Ue.createElement("td",{...r})}function ffe(t){const{day:e,modifiers:n,...r}=t,s=Ue.useRef(null);return Ue.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),Ue.createElement("button",{ref:s,...r})}var et;(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"})(et||(et={}));var Yn;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(Yn||(Yn={}));var qi;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(qi||(qi={}));var ti;(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"})(ti||(ti={}));function mfe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,l=[s[et.Dropdown],n].join(" "),c=e?.find(({value:d})=>d===i.value);return Ue.createElement("span",{"data-disabled":i.disabled,className:s[et.DropdownRoot]},Ue.createElement(r.Select,{className:l,...i},e?.map(({value:d,label:h,disabled:m})=>Ue.createElement(r.Option,{key:d,value:d,disabled:m},h))),Ue.createElement("span",{className:s[et.CaptionLabel],"aria-hidden":!0},c?.label,Ue.createElement(r.Chevron,{orientation:"down",size:18,className:s[et.Chevron]})))}function pfe(t){return Ue.createElement("div",{...t})}function gfe(t){return Ue.createElement("div",{...t})}function xfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r},t.children)}function vfe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return Ue.createElement("div",{...r})}function yfe(t){return Ue.createElement("table",{...t})}function bfe(t){return Ue.createElement("div",{...t})}const Oz=S.createContext(void 0);function j0(){const t=S.useContext(Oz);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function wfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}function Sfe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:l,classNames:c,labels:{labelPrevious:d,labelNext:h}}=j0(),m=S.useCallback(x=>{s&&n?.(x)},[s,n]),p=S.useCallback(x=>{r&&e?.(x)},[r,e]);return Ue.createElement("nav",{...i},Ue.createElement(l.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:p},Ue.createElement(l.Chevron,{disabled:r?void 0:!0,className:c[et.Chevron],orientation:"left"})),Ue.createElement(l.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:m},Ue.createElement(l.Chevron,{disabled:s?void 0:!0,orientation:"right",className:c[et.Chevron]})))}function kfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Ofe(t){return Ue.createElement("option",{...t})}function jfe(t){const{components:e}=j0();return Ue.createElement(e.Button,{...t})}function Nfe(t){const{rootRef:e,...n}=t;return Ue.createElement("div",{...n,ref:e})}function Cfe(t){return Ue.createElement("select",{...t})}function Tfe(t){const{week:e,...n}=t;return Ue.createElement("tr",{...n})}function Afe(t){return Ue.createElement("th",{...t})}function Mfe(t){return Ue.createElement("thead",{"aria-hidden":!0},Ue.createElement("tr",{...t}))}function Efe(t){const{week:e,...n}=t;return Ue.createElement("th",{...n})}function _fe(t){return Ue.createElement("th",{...t})}function Dfe(t){return Ue.createElement("tbody",{...t})}function Rfe(t){const{components:e}=j0();return Ue.createElement(e.Dropdown,{...t})}const zfe=Object.freeze(Object.defineProperty({__proto__:null,Button:cfe,CaptionLabel:ufe,Chevron:dfe,Day:hfe,DayButton:ffe,Dropdown:mfe,DropdownNav:pfe,Footer:gfe,Month:xfe,MonthCaption:vfe,MonthGrid:yfe,Months:bfe,MonthsDropdown:wfe,Nav:Sfe,NextMonthButton:kfe,Option:Ofe,PreviousMonthButton:jfe,Root:Nfe,Select:Cfe,Week:Tfe,WeekNumber:Efe,WeekNumberHeader:_fe,Weekday:Afe,Weekdays:Mfe,Weeks:Dfe,YearsDropdown:Rfe},Symbol.toStringTag,{value:"Module"}));function ll(t,e,n=!1,r=Ma){let{from:s,to:i}=t;const{differenceInCalendarDays:l,isSameDay:c}=r;return s&&i?(l(i,s)<0&&([s,i]=[i,s]),l(e,s)>=(n?1:0)&&l(i,e)>=(n?1:0)):!n&&i?c(i,e):!n&&s?c(s,e):!1}function jz(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function X5(t){return!!(t&&typeof t=="object"&&"from"in t)}function Nz(t){return!!(t&&typeof t=="object"&&"after"in t)}function Cz(t){return!!(t&&typeof t=="object"&&"before"in t)}function Tz(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Az(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ol(t,e,n=Ma){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:l}=n;return r.some(c=>{if(typeof c=="boolean")return c;if(n.isDate(c))return s(t,c);if(Az(c,n))return c.includes(t);if(X5(c))return ll(c,t,!1,n);if(Tz(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(t.getDay()):c.dayOfWeek===t.getDay();if(jz(c)){const d=i(c.before,t),h=i(c.after,t),m=d>0,p=h<0;return l(c.before,c.after)?p&&m:m||p}return Nz(c)?i(t,c.after)>0:Cz(c)?i(c.before,t)>0:typeof c=="function"?c(t):!1})}function Pfe(t,e,n,r,s){const{disabled:i,hidden:l,modifiers:c,showOutsideDays:d,broadcastCalendar:h,today:m}=e,{isSameDay:p,isSameMonth:x,startOfMonth:v,isBefore:b,endOfMonth:k,isAfter:O}=s,j=n&&v(n),T=r&&k(r),A={[Yn.focused]:[],[Yn.outside]:[],[Yn.disabled]:[],[Yn.hidden]:[],[Yn.today]:[]},_={};for(const D of t){const{date:E,displayMonth:z}=D,Q=!!(z&&!x(E,z)),F=!!(j&&b(E,j)),L=!!(T&&O(E,T)),U=!!(i&&ol(E,i,s)),V=!!(l&&ol(E,l,s))||F||L||!h&&!d&&Q||h&&d===!1&&Q,ce=p(E,m??s.today());Q&&A.outside.push(D),U&&A.disabled.push(D),V&&A.hidden.push(D),ce&&A.today.push(D),c&&Object.keys(c).forEach(W=>{const J=c?.[W];J&&ol(E,J,s)&&(_[W]?_[W].push(D):_[W]=[D])})}return D=>{const E={[Yn.focused]:!1,[Yn.disabled]:!1,[Yn.hidden]:!1,[Yn.outside]:!1,[Yn.today]:!1},z={};for(const Q in A){const F=A[Q];E[Q]=F.some(L=>L===D)}for(const Q in _)z[Q]=_[Q].some(F=>F===D);return{...E,...z}}}function Bfe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[Yn[i]]?s.push(e[Yn[i]]):e[qi[i]]&&s.push(e[qi[i]]),s),[e[et.Day]])}function Lfe(t){return{...zfe,...t}}function Ife(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 Y5(){const t={};for(const e in et)t[et[e]]=`rdp-${et[e]}`;for(const e in Yn)t[Yn[e]]=`rdp-${Yn[e]}`;for(const e in qi)t[qi[e]]=`rdp-${qi[e]}`;for(const e in ti)t[ti[e]]=`rdp-${ti[e]}`;return t}function Mz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const qfe=Mz;function Ffe(t,e,n){return(n??new ai(e)).format(t,"d")}function Qfe(t,e=Ma){return e.format(t,"LLLL")}function $fe(t,e,n){return(n??new ai(e)).format(t,"cccccc")}function Hfe(t,e=Ma){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Ufe(){return""}function Ez(t,e=Ma){return e.format(t,"yyyy")}const Vfe=Ez,Wfe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Mz,formatDay:Ffe,formatMonthCaption:qfe,formatMonthDropdown:Qfe,formatWeekNumber:Hfe,formatWeekNumberHeader:Ufe,formatWeekdayName:$fe,formatYearCaption:Vfe,formatYearDropdown:Ez},Symbol.toStringTag,{value:"Module"}));function Gfe(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...Wfe,...t}}function Xfe(t,e,n,r,s){const{startOfMonth:i,startOfYear:l,endOfYear:c,eachMonthOfInterval:d,getMonth:h}=s;return d({start:l(t),end:c(t)}).map(x=>{const v=r.formatMonthDropdown(x,s),b=h(x),k=e&&xi(n)||!1;return{value:b,label:v,disabled:k}})}function Yfe(t,e={},n={}){let r={...e?.[et.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function Kfe(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let l=0;l<7;l++){const c=t.addDays(s,l);i.push(c)}return i}function Zfe(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:l,eachYearOfInterval:c,getYear:d}=r,h=i(t),m=l(e),p=c({start:h,end:m});return s&&p.reverse(),p.map(x=>{const v=n.formatYearDropdown(x,r);return{value:d(x),label:v,disabled:!1}})}function _z(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 Jfe=_z;function Dz(t,e,n){return(n??new ai(e)).formatMonthYear(t)}const e0e=Dz;function t0e(t,e,n,r){let s=(r??new ai(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function n0e(t){return"Choose the Month"}function r0e(){return""}function s0e(t){return"Go to the Next Month"}function i0e(t){return"Go to the Previous Month"}function a0e(t,e,n){return(n??new ai(e)).format(t,"cccc")}function l0e(t,e){return`Week ${t}`}function o0e(t){return"Week Number"}function c0e(t){return"Choose the Year"}const u0e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:e0e,labelDay:Jfe,labelDayButton:_z,labelGrid:Dz,labelGridcell:t0e,labelMonthDropdown:n0e,labelNav:r0e,labelNext:s0e,labelPrevious:i0e,labelWeekNumber:l0e,labelWeekNumberHeader:o0e,labelWeekday:a0e,labelYearDropdown:c0e},Symbol.toStringTag,{value:"Module"})),N0=t=>t instanceof HTMLElement?t:null,Ub=t=>[...t.querySelectorAll("[data-animated-month]")??[]],d0e=t=>N0(t.querySelector("[data-animated-month]")),Vb=t=>N0(t.querySelector("[data-animated-caption]")),Wb=t=>N0(t.querySelector("[data-animated-weeks]")),h0e=t=>N0(t.querySelector("[data-animated-nav]")),f0e=t=>N0(t.querySelector("[data-animated-weekdays]"));function m0e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const l=S.useRef(null),c=S.useRef(r),d=S.useRef(!1);S.useLayoutEffect(()=>{const h=c.current;if(c.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const m=i.isSameMonth(r[0].date,h[0].date),p=i.isAfter(r[0].date,h[0].date),x=p?n[ti.caption_after_enter]:n[ti.caption_before_enter],v=p?n[ti.weeks_after_enter]:n[ti.weeks_before_enter],b=l.current,k=t.current.cloneNode(!0);if(k instanceof HTMLElement?(Ub(k).forEach(A=>{if(!(A instanceof HTMLElement))return;const _=d0e(A);_&&A.contains(_)&&A.removeChild(_);const D=Vb(A);D&&D.classList.remove(x);const E=Wb(A);E&&E.classList.remove(v)}),l.current=k):l.current=null,d.current||m||s)return;const O=b instanceof HTMLElement?Ub(b):[],j=Ub(t.current);if(j?.every(T=>T instanceof HTMLElement)&&O&&O.every(T=>T instanceof HTMLElement)){d.current=!0,t.current.style.isolation="isolate";const T=h0e(t.current);T&&(T.style.zIndex="1"),j.forEach((A,_)=>{const D=O[_];if(!D)return;A.style.position="relative",A.style.overflow="hidden";const E=Vb(A);E&&E.classList.add(x);const z=Wb(A);z&&z.classList.add(v);const Q=()=>{d.current=!1,t.current&&(t.current.style.isolation=""),T&&(T.style.zIndex=""),E&&E.classList.remove(x),z&&z.classList.remove(v),A.style.position="",A.style.overflow="",A.contains(D)&&A.removeChild(D)};D.style.pointerEvents="none",D.style.position="absolute",D.style.overflow="hidden",D.setAttribute("aria-hidden","true");const F=f0e(D);F&&(F.style.opacity="0");const L=Vb(D);L&&(L.classList.add(p?n[ti.caption_before_exit]:n[ti.caption_after_exit]),L.addEventListener("animationend",Q));const U=Wb(D);U&&U.classList.add(p?n[ti.weeks_before_exit]:n[ti.weeks_after_exit]),A.insertBefore(D,A.firstChild)})}})}function p0e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:l,fixedWeeks:c,broadcastCalendar:d}=n??{},{addDays:h,differenceInCalendarDays:m,differenceInCalendarMonths:p,endOfBroadcastWeek:x,endOfISOWeek:v,endOfMonth:b,endOfWeek:k,isAfter:O,startOfBroadcastWeek:j,startOfISOWeek:T,startOfWeek:A}=r,_=d?j(s,r):l?T(s):A(s),D=d?x(i):l?v(b(i)):k(b(i)),E=m(D,_),z=p(i,s)+1,Q=[];for(let U=0;U<=E;U++){const V=h(_,U);if(e&&O(V,e))break;Q.push(V)}const L=(d?35:42)*z;if(c&&Q.length{const s=r.weeks.reduce((i,l)=>i.concat(l.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function x0e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let l=0;le)break;i.push(c)}return i}function t9(t,e,n,r){const{month:s,defaultMonth:i,today:l=r.today(),numberOfMonths:c=1}=t;let d=s||i||l;const{differenceInCalendarMonths:h,addMonths:m,startOfMonth:p}=r;if(n&&h(n,d){const j=n.broadcastCalendar?p(O,r):n.ISOWeek?x(O):v(O),T=n.broadcastCalendar?i(O):n.ISOWeek?l(c(O)):d(c(O)),A=e.filter(z=>z>=j&&z<=T),_=n.broadcastCalendar?35:42;if(n.fixedWeeks&&A.length<_){const z=e.filter(Q=>{const F=_-A.length;return Q>T&&Q<=s(T,F)});A.push(...z)}const D=A.reduce((z,Q)=>{const F=n.ISOWeek?h(Q):m(Q),L=z.find(V=>V.weekNumber===F),U=new kz(Q,O,r);return L?L.days.push(U):z.push(new ofe(F,[U])),z},[]),E=new lfe(O,D);return k.push(E),k},[]);return n.reverseMonths?b.reverse():b}function y0e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:l,endOfMonth:c,addYears:d,endOfYear:h,newDate:m,today:p}=e,{fromYear:x,toYear:v,fromMonth:b,toMonth:k}=t;!n&&b&&(n=b),!n&&x&&(n=e.newDate(x,0,1)),!r&&k&&(r=k),!r&&v&&(r=m(v,11,31));const O=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=l(n):x?n=m(x,0,1):!n&&O&&(n=s(d(t.today??p(),-100))),r?r=c(r):v?r=m(v,11,31):!r&&O&&(r=h(t.today??p())),[n&&i(n),r&&i(r)]}function b0e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:l,addMonths:c,differenceInCalendarMonths:d}=r,h=s?i:1,m=l(t);if(!e)return c(m,h);if(!(d(e,t)n.concat(r.weeks.slice()),e.slice())}function Yx(t,e){const[n,r]=S.useState(t);return[e===void 0?n:e,r]}function k0e(t,e){const[n,r]=y0e(t,e),{startOfMonth:s,endOfMonth:i}=e,l=t9(t,n,r,e),[c,d]=Yx(l,t.month?l:void 0);S.useEffect(()=>{const E=t9(t,n,r,e);d(E)},[t.timeZone]);const h=x0e(c,r,t,e),m=p0e(h,t.endMonth?i(t.endMonth):void 0,t,e),p=v0e(h,m,t,e),x=S0e(p),v=g0e(p),b=w0e(c,n,t,e),k=b0e(c,r,t,e),{disableNavigation:O,onMonthChange:j}=t,T=E=>x.some(z=>z.days.some(Q=>Q.isEqualTo(E))),A=E=>{if(O)return;let z=s(E);n&&zs(r)&&(z=s(r)),d(z),j?.(z)};return{months:p,weeks:x,days:v,navStart:n,navEnd:r,previousMonth:b,nextMonth:k,goToMonth:A,goToDay:E=>{T(E)||A(E.date)}}}var aa;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(aa||(aa={}));function n9(t){return!t[Yn.disabled]&&!t[Yn.hidden]&&!t[Yn.outside]}function O0e(t,e,n,r){let s,i=-1;for(const l of t){const c=e(l);n9(c)&&(c[Yn.focused]&&in9(e(l)))),s}function j0e(t,e,n,r,s,i,l){const{ISOWeek:c,broadcastCalendar:d}=i,{addDays:h,addMonths:m,addWeeks:p,addYears:x,endOfBroadcastWeek:v,endOfISOWeek:b,endOfWeek:k,max:O,min:j,startOfBroadcastWeek:T,startOfISOWeek:A,startOfWeek:_}=l;let E={day:h,week:p,month:m,year:x,startOfWeek:z=>d?T(z,l):c?A(z):_(z),endOfWeek:z=>d?v(z):c?b(z):k(z)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=O([r,E]):e==="after"&&s&&(E=j([s,E])),E}function Rz(t,e,n,r,s,i,l,c=0){if(c>365)return;const d=j0e(t,e,n.date,r,s,i,l),h=!!(i.disabled&&ol(d,i.disabled,l)),m=!!(i.hidden&&ol(d,i.hidden,l)),p=d,x=new kz(d,p,l);return!h&&!m?x:Rz(t,e,x,r,s,i,l,c+1)}function N0e(t,e,n,r,s){const{autoFocus:i}=t,[l,c]=S.useState(),d=O0e(e.days,n,r||(()=>!1),l),[h,m]=S.useState(i?d:void 0);return{isFocusTarget:k=>!!d?.isEqualTo(k),setFocused:m,focused:h,blur:()=>{c(h),m(void 0)},moveFocus:(k,O)=>{if(!h)return;const j=Rz(k,O,h,e.navStart,e.navEnd,t,s);j&&(t.disableNavigation&&!e.days.some(A=>A.isEqualTo(j))||(e.goToDay(j),m(j)))}}}function C0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e,h=v=>c?.some(b=>d(b,v))??!1,{min:m,max:p}=t;return{selected:c,select:(v,b,k)=>{let O=[...c??[]];if(h(v)){if(c?.length===m||r&&c?.length===1)return;O=c?.filter(j=>!d(j,v))}else c?.length===p?O=[v]:O=[...O,v];return s||l(O),s?.(O,v,b,k),O},isSelected:h}}function T0e(t,e,n=0,r=0,s=!1,i=Ma){const{from:l,to:c}=e||{},{isSameDay:d,isAfter:h,isBefore:m}=i;let p;if(!l&&!c)p={from:t,to:n>0?void 0:t};else if(l&&!c)d(l,t)?n===0?p={from:l,to:t}:s?p={from:l,to:void 0}:p=void 0:m(t,l)?p={from:t,to:l}:p={from:l,to:t};else if(l&&c)if(d(l,t)&&d(c,t))s?p={from:l,to:c}:p=void 0;else if(d(l,t))p={from:l,to:n>0?void 0:t};else if(d(c,t))p={from:t,to:n>0?void 0:t};else if(m(t,l))p={from:t,to:c};else if(h(t,l))p={from:l,to:t};else if(h(t,c))p={from:l,to:t};else throw new Error("Invalid range");if(p?.from&&p?.to){const x=i.differenceInCalendarDays(p.to,p.from);r>0&&x>r?p={from:t,to:void 0}:n>1&&xtypeof c!="function").some(c=>typeof c=="boolean"?c:n.isDate(c)?ll(t,c,!1,n):Az(c,n)?c.some(d=>ll(t,d,!1,n)):X5(c)?c.from&&c.to?r9(t,{from:c.from,to:c.to},n):!1:Tz(c)?A0e(t,c.dayOfWeek,n):jz(c)?n.isAfter(c.before,c.after)?r9(t,{from:n.addDays(c.after,1),to:n.addDays(c.before,-1)},n):ol(t.from,c,n)||ol(t.to,c,n):Nz(c)||Cz(c)?ol(t.from,c,n)||ol(t.to,c,n):!1))return!0;const l=r.filter(c=>typeof c=="function");if(l.length){let c=t.from;const d=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=d;h++){if(l.some(m=>m(c)))return!0;c=n.addDays(c,1)}}return!1}function E0e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:l}=t,[c,d]=Yx(s,l?s:void 0),h=l?s:c;return{selected:h,select:(x,v,b)=>{const{min:k,max:O}=t,j=x?T0e(x,h,k,O,i,e):void 0;return r&&n&&j?.from&&j.to&&M0e({from:j.from,to:j.to},n,e)&&(j.from=x,j.to=void 0),l||d(j),l?.(j,x,v,b),j},isSelected:x=>h&&ll(h,x,!1,e)}}function _0e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,l]=Yx(n,s?n:void 0),c=s?n:i,{isSameDay:d}=e;return{selected:c,select:(p,x,v)=>{let b=p;return!r&&c&&c&&d(p,c)&&(b=void 0),s||l(b),s?.(b,p,x,v),b},isSelected:p=>c?d(c,p):!1}}function D0e(t,e){const n=_0e(t,e),r=C0e(t,e),s=E0e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function R0e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new Zr(e.today,e.timeZone)),e.month&&(e.month=new Zr(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new Zr(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new Zr(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new Zr(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new Zr(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(dt=>new Zr(dt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new Zr(e.selected.from,e.timeZone):void 0,to:e.selected.to?new Zr(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:l,classNames:c}=S.useMemo(()=>{const dt={...G5,...e.locale};return{dateLib:new ai({locale:dt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:Lfe(e.components),formatters:Gfe(e.formatters),labels:{...u0e,...e.labels},locale:dt,classNames:{...Y5(),...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:d,mode:h,navLayout:m,numberOfMonths:p=1,onDayBlur:x,onDayClick:v,onDayFocus:b,onDayKeyDown:k,onDayMouseEnter:O,onDayMouseLeave:j,onNextClick:T,onPrevClick:A,showWeekNumber:_,styles:D}=e,{formatCaption:E,formatDay:z,formatMonthDropdown:Q,formatWeekNumber:F,formatWeekNumberHeader:L,formatWeekdayName:U,formatYearDropdown:V}=r,ce=k0e(e,i),{days:W,months:J,navStart:$,navEnd:ae,previousMonth:ne,nextMonth:ue,goToMonth:R}=ce,me=Pfe(W,e,$,ae,i),{isSelected:Y,select:P,selected:K}=D0e(e,i)??{},{blur:H,focused:fe,isFocusTarget:ve,moveFocus:Re,setFocused:de}=N0e(e,ce,me,Y??(()=>!1),i),{labelDayButton:We,labelGridcell:ct,labelGrid:Oe,labelMonthDropdown:nt,labelNav:ut,labelPrevious:Ct,labelNext:In,labelWeekday:Tn,labelWeekNumber:Jn,labelWeekNumberHeader:nn,labelYearDropdown:_t}=s,Yr=S.useMemo(()=>Kfe(i,e.ISOWeek),[i,e.ISOWeek]),qn=h!==void 0||v!==void 0,or=S.useCallback(()=>{ne&&(R(ne),A?.(ne))},[ne,R,A]),yn=S.useCallback(()=>{ue&&(R(ue),T?.(ue))},[R,ue,T]),ft=S.useCallback((dt,Pn)=>mt=>{mt.preventDefault(),mt.stopPropagation(),de(dt),P?.(dt.date,Pn,mt),v?.(dt.date,Pn,mt)},[P,v,de]),ee=S.useCallback((dt,Pn)=>mt=>{de(dt),b?.(dt.date,Pn,mt)},[b,de]),Se=S.useCallback((dt,Pn)=>mt=>{H(),x?.(dt.date,Pn,mt)},[H,x]),Be=S.useCallback((dt,Pn)=>mt=>{const rn={ArrowLeft:[mt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[mt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[mt.shiftKey?"year":"week","after"],ArrowUp:[mt.shiftKey?"year":"week","before"],PageUp:[mt.shiftKey?"year":"month","before"],PageDown:[mt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(rn[mt.key]){mt.preventDefault(),mt.stopPropagation();const[Mr,At]=rn[mt.key];Re(Mr,At)}k?.(dt.date,Pn,mt)},[Re,k,e.dir]),rt=S.useCallback((dt,Pn)=>mt=>{O?.(dt.date,Pn,mt)},[O]),Tt=S.useCallback((dt,Pn)=>mt=>{j?.(dt.date,Pn,mt)},[j]),cr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setMonth(i.startOfMonth(dt),mt);R(rn)},[i,R]),Kr=S.useCallback(dt=>Pn=>{const mt=Number(Pn.target.value),rn=i.setYear(i.startOfMonth(dt),mt);R(rn)},[i,R]),{className:re,style:Ae}=S.useMemo(()=>({className:[c[et.Root],e.className].filter(Boolean).join(" "),style:{...D?.[et.Root],...e.style}}),[c,e.className,e.style,D]),pt=Ife(e),yt=S.useRef(null);m0e(yt,!!e.animate,{classNames:c,months:J,focused:fe,dateLib:i});const vs={dayPickerProps:e,selected:K,select:P,isSelected:Y,months:J,nextMonth:ue,previousMonth:ne,goToMonth:R,getModifiers:me,components:n,classNames:c,styles:D,labels:s,formatters:r};return Ue.createElement(Oz.Provider,{value:vs},Ue.createElement(n.Root,{rootRef:e.animate?yt:void 0,className:re,style:Ae,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"],...pt},Ue.createElement(n.Months,{className:c[et.Months],style:D?.[et.Months]},!e.hideNavigation&&!m&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ue}),J.map((dt,Pn)=>Ue.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:c[et.Month],style:D?.[et.Month],key:Pn,displayIndex:Pn,calendarMonth:dt},m==="around"&&!e.hideNavigation&&Pn===0&&Ue.createElement(n.PreviousMonthButton,{type:"button",className:c[et.PreviousMonthButton],tabIndex:ne?void 0:-1,"aria-disabled":ne?void 0:!0,"aria-label":Ct(ne),onClick:or,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ne?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"right":"left"})),Ue.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:c[et.MonthCaption],style:D?.[et.MonthCaption],calendarMonth:dt,displayIndex:Pn},d?.startsWith("dropdown")?Ue.createElement(n.DropdownNav,{className:c[et.Dropdowns],style:D?.[et.Dropdowns]},(()=>{const mt=d==="dropdown"||d==="dropdown-months"?Ue.createElement(n.MonthsDropdown,{key:"month",className:c[et.MonthsDropdown],"aria-label":nt(),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:cr(dt.date),options:Xfe(dt.date,$,ae,r,i),style:D?.[et.Dropdown],value:i.getMonth(dt.date)}):Ue.createElement("span",{key:"month"},Q(dt.date,i)),rn=d==="dropdown"||d==="dropdown-years"?Ue.createElement(n.YearsDropdown,{key:"year",className:c[et.YearsDropdown],"aria-label":_t(i.options),classNames:c,components:n,disabled:!!e.disableNavigation,onChange:Kr(dt.date),options:Zfe($,ae,r,i,!!e.reverseYears),style:D?.[et.Dropdown],value:i.getYear(dt.date)}):Ue.createElement("span",{key:"year"},V(dt.date,i));return i.getMonthYearOrder()==="year-first"?[rn,mt]:[mt,rn]})(),Ue.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(dt.date,i.options,i))):Ue.createElement(n.CaptionLabel,{className:c[et.CaptionLabel],role:"status","aria-live":"polite"},E(dt.date,i.options,i))),m==="around"&&!e.hideNavigation&&Pn===p-1&&Ue.createElement(n.NextMonthButton,{type:"button",className:c[et.NextMonthButton],tabIndex:ue?void 0:-1,"aria-disabled":ue?void 0:!0,"aria-label":In(ue),onClick:yn,"data-animated-button":e.animate?"true":void 0},Ue.createElement(n.Chevron,{disabled:ue?void 0:!0,className:c[et.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Pn===p-1&&m==="after"&&!e.hideNavigation&&Ue.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[et.Nav],style:D?.[et.Nav],"aria-label":ut(),onPreviousClick:or,onNextClick:yn,previousMonth:ne,nextMonth:ue}),Ue.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Oe(dt.date,i.options,i)||void 0,className:c[et.MonthGrid],style:D?.[et.MonthGrid]},!e.hideWeekdays&&Ue.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:c[et.Weekdays],style:D?.[et.Weekdays]},_&&Ue.createElement(n.WeekNumberHeader,{"aria-label":nn(i.options),className:c[et.WeekNumberHeader],style:D?.[et.WeekNumberHeader],scope:"col"},L()),Yr.map(mt=>Ue.createElement(n.Weekday,{"aria-label":Tn(mt,i.options,i),className:c[et.Weekday],key:String(mt),style:D?.[et.Weekday],scope:"col"},U(mt,i.options,i)))),Ue.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:c[et.Weeks],style:D?.[et.Weeks]},dt.weeks.map(mt=>Ue.createElement(n.Week,{className:c[et.Week],key:mt.weekNumber,style:D?.[et.Week],week:mt},_&&Ue.createElement(n.WeekNumber,{week:mt,style:D?.[et.WeekNumber],"aria-label":Jn(mt.weekNumber,{locale:l}),className:c[et.WeekNumber],scope:"row",role:"rowheader"},F(mt.weekNumber,i)),mt.days.map(rn=>{const{date:Mr}=rn,At=me(rn);if(At[Yn.focused]=!At.hidden&&!!fe?.isEqualTo(rn),At[qi.selected]=Y?.(Mr)||At.selected,X5(K)){const{from:qc,to:Do}=K;At[qi.range_start]=!!(qc&&Do&&i.isSameDay(Mr,qc)),At[qi.range_end]=!!(qc&&Do&&i.isSameDay(Mr,Do)),At[qi.range_middle]=ll(K,Mr,!0,i)}const Ic=Yfe(At,D,e.modifiersStyles),_o=Bfe(At,c,e.modifiersClassNames),t1=!qn&&!At.hidden?ct(Mr,At,i.options,i):void 0;return Ue.createElement(n.Day,{key:`${i.format(Mr,"yyyy-MM-dd")}_${i.format(rn.displayMonth,"yyyy-MM")}`,day:rn,modifiers:At,className:_o.join(" "),style:Ic,role:"gridcell","aria-selected":At.selected||void 0,"aria-label":t1,"data-day":i.format(Mr,"yyyy-MM-dd"),"data-month":rn.outside?i.format(Mr,"yyyy-MM"):void 0,"data-selected":At.selected||void 0,"data-disabled":At.disabled||void 0,"data-hidden":At.hidden||void 0,"data-outside":rn.outside||void 0,"data-focused":At.focused||void 0,"data-today":At.today||void 0},!At.hidden&&qn?Ue.createElement(n.DayButton,{className:c[et.DayButton],style:D?.[et.DayButton],type:"button",day:rn,modifiers:At,disabled:At.disabled||void 0,tabIndex:ve(rn)?0:-1,"aria-label":We(Mr,At,i.options,i),onClick:ft(rn,At),onBlur:Se(rn,At),onFocus:ee(rn,At),onKeyDown:Be(rn,At),onMouseEnter:rt(rn,At),onMouseLeave:Tt(rn,At)},z(Mr,i.options,i)):!At.hidden&&z(rn.date,i.options,i))})))))))),e.footer&&Ue.createElement(n.Footer,{className:c[et.Footer],style:D?.[et.Footer],role:"status","aria-live":"polite"},e.footer)))}function s9({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:l,...c}){const d=Y5();return a.jsx(R0e,{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",d.root),months:ye("relative flex flex-col gap-4 md:flex-row",d.months),month:ye("flex w-full flex-col gap-4",d.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",d.nav),button_previous:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_previous),button_next:ye(ff({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",d.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",d.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",d.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",d.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",d.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",d.caption_label),table:"w-full border-collapse",weekdays:ye("flex",d.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",d.weekday),week:ye("mt-2 flex w-full",d.week),week_number_header:ye("w-[--cell-size] select-none",d.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",d.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",d.day),range_start:ye("bg-accent rounded-l-md",d.range_start),range_middle:ye("rounded-none",d.range_middle),range_end:ye("bg-accent rounded-r-md",d.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",d.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",d.outside),disabled:ye("text-muted-foreground opacity-50",d.disabled),hidden:ye("invisible",d.hidden),...e},components:{Root:({className:h,rootRef:m,...p})=>a.jsx("div",{"data-slot":"calendar",ref:m,className:ye(h),...p}),Chevron:({className:h,orientation:m,...p})=>m==="left"?a.jsx(Tc,{className:ye("size-4",h),...p}):m==="right"?a.jsx(Ac,{className:ye("size-4",h),...p}):a.jsx(df,{className:ye("size-4",h),...p}),DayButton:z0e,WeekNumber:({children:h,...m})=>a.jsx("td",{...m,children:a.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...l},...c})}function z0e({className:t,day:e,modifiers:n,...r}){const s=Y5(),i=S.useRef(null);return S.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),a.jsx(ie,{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 P0e{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 Iu=new P0e;typeof window<"u"&&Iu.connect();const B0e={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}} 年"}},L0e=(t,e,n)=>{let r;const s=B0e[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},I0e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},q0e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},F0e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Q0e={date:td({formats:I0e,defaultWidth:"full"}),time:td({formats:q0e,defaultWidth:"full"}),dateTime:td({formats:F0e,defaultWidth:"full"})};function i9(t,e,n){const r="eeee p";return Jhe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const $0e={lastWeek:i9,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:i9,other:"PP p"},H0e=(t,e,n,r)=>{const s=$0e[t];return typeof s=="function"?s(e,n,r):s},U0e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},V0e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},W0e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},G0e={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},X0e={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:"夜间"}},Y0e={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:"夜间"}},K0e=(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()}},Z0e={ordinalNumber:K0e,era:ua({values:U0e,defaultWidth:"wide"}),quarter:ua({values:V0e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ua({values:W0e,defaultWidth:"wide"}),day:ua({values:G0e,defaultWidth:"wide"}),dayPeriod:ua({values:X0e,defaultWidth:"wide",formattingValues:Y0e,defaultFormattingWidth:"wide"})},J0e=/^(第\s*)?\d+(日|时|分|秒)?/i,eme=/\d+/i,tme={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},nme={any:[/^(前)/i,/^(公元)/i]},rme={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},sme={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},ime={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},ame={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]},lme={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},ome={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},cme={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},ume={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},dme={ordinalNumber:xz({matchPattern:J0e,parsePattern:eme,valueCallback:t=>parseInt(t,10)}),era:da({matchPatterns:tme,defaultMatchWidth:"wide",parsePatterns:nme,defaultParseWidth:"any"}),quarter:da({matchPatterns:rme,defaultMatchWidth:"wide",parsePatterns:sme,defaultParseWidth:"any",valueCallback:t=>t+1}),month:da({matchPatterns:ime,defaultMatchWidth:"wide",parsePatterns:ame,defaultParseWidth:"any"}),day:da({matchPatterns:lme,defaultMatchWidth:"wide",parsePatterns:ome,defaultParseWidth:"any"}),dayPeriod:da({matchPatterns:cme,defaultMatchWidth:"any",parsePatterns:ume,defaultParseWidth:"any"})},Bp={code:"zh-CN",formatDistance:L0e,formatLong:Q0e,formatRelative:H0e,localize:Z0e,match:dme,options:{weekStartsOn:1,firstWeekContainsDate:4}};function hme(){const[t,e]=S.useState([]),[n,r]=S.useState(""),[s,i]=S.useState("all"),[l,c]=S.useState("all"),[d,h]=S.useState(void 0),[m,p]=S.useState(void 0),[x,v]=S.useState(!0),[b,k]=S.useState(!1),O=S.useRef(null),j=S.useRef(null);S.useEffect(()=>{const U=Iu.getAllLogs();e(U);const V=Iu.onLog(()=>{e(Iu.getAllLogs())}),ce=Iu.onConnectionChange(W=>{k(W)});return()=>{V(),ce()}},[]),S.useEffect(()=>{x&&j.current&&j.current.scrollIntoView({behavior:"smooth",block:"end"})},[t,x]);const T=S.useMemo(()=>{const U=new Set(t.map(V=>V.module));return Array.from(U).sort()},[t]),A=U=>{switch(U){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"}},_=U=>{switch(U){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"}},D=()=>{window.location.reload()},E=()=>{Iu.clearLogs(),e([])},z=()=>{const U=L.map(J=>`${J.timestamp} [${J.level.padEnd(8)}] [${J.module}] ${J.message}`).join(` +`),V=new Blob([U],{type:"text/plain;charset=utf-8"}),ce=URL.createObjectURL(V),W=document.createElement("a");W.href=ce,W.download=`logs-${dg(new Date,"yyyy-MM-dd-HHmmss")}.txt`,W.click(),URL.revokeObjectURL(ce)},Q=()=>{v(!x)},F=()=>{h(void 0),p(void 0)},L=S.useMemo(()=>t.filter(U=>{const V=n===""||U.message.toLowerCase().includes(n.toLowerCase())||U.module.toLowerCase().includes(n.toLowerCase()),ce=s==="all"||U.level===s,W=l==="all"||U.module===l;let J=!0;if(d||m){const $=new Date(U.timestamp);if(d){const ae=new Date(d);ae.setHours(0,0,0,0),J=J&&$>=ae}if(m){const ae=new Date(m);ae.setHours(23,59,59,999),J=J&&$<=ae}}return V&&ce&&W&&J}),[t,n,s,l,d,m]);return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 p-3 sm:p-4 lg:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),a.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",b?"bg-green-500 animate-pulse":"bg-red-500")}),a.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:b?"已连接":"未连接"})]})]}),a.jsx(gt,{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索日志...",value:n,onChange:U=>r(U.target.value),className:"pl-9 h-9 text-sm"})]}),a.jsxs(Lt,{value:s,onValueChange:i,children:[a.jsxs(Dt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"级别"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部级别"}),a.jsx(Pe,{value:"DEBUG",children:"DEBUG"}),a.jsx(Pe,{value:"INFO",children:"INFO"}),a.jsx(Pe,{value:"WARNING",children:"WARNING"}),a.jsx(Pe,{value:"ERROR",children:"ERROR"}),a.jsx(Pe,{value:"CRITICAL",children:"CRITICAL"})]})]}),a.jsxs(Lt,{value:l,onValueChange:c,children:[a.jsxs(Dt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[a.jsx(t2,{className:"h-4 w-4 mr-2"}),a.jsx(It,{placeholder:"模块"})]}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部模块"}),T.map(U=>a.jsx(Pe,{value:U,children:U},U))]})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!d&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:d?dg(d,"PPP",{locale:Bp}):"开始日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:d,onSelect:h,initialFocus:!0,locale:Bp})})]}),a.jsxs(uo,{children:[a.jsx(ho,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!m&&"text-muted-foreground"),children:[a.jsx(uO,{className:"mr-2 h-4 w-4"}),a.jsx("span",{className:"text-xs sm:text-sm",children:m?dg(m,"PPP",{locale:Bp}):"结束日期"})]})}),a.jsx(fl,{className:"w-auto p-0",align:"start",children:a.jsx(s9,{mode:"single",selected:m,onSelect:p,initialFocus:!0,locale:Bp})})]}),(d||m)&&a.jsxs(ie,{variant:"outline",size:"sm",onClick:F,className:"w-full sm:w-auto h-9",children:[a.jsx(Gf,{className:"h-4 w-4 sm:mr-2"}),a.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),a.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[a.jsxs("div",{className:"flex gap-2 flex-wrap",children:[a.jsxs(ie,{variant:x?"default":"outline",size:"sm",onClick:Q,className:"flex-1 sm:flex-none h-9",children:[x?a.jsx(jq,{className:"h-4 w-4"}):a.jsx(Nq,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:x?"自动滚动":"已暂停"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:D,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Fi,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:E,className:"flex-1 sm:flex-none h-9",children:[a.jsx(Ht,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:z,className:"flex-1 sm:flex-none h-9",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),a.jsx("div",{className:"flex-1 hidden sm:block"}),a.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[a.jsxs("span",{className:"font-mono",children:[L.length," / ",t.length]}),a.jsx("span",{className:"ml-1",children:"条日志"})]})]})]})}),a.jsx(gt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900",children:a.jsx(mn,{className:"h-[calc(100vh-280px)] sm:h-[calc(100vh-320px)] lg:h-[calc(100vh-400px)]",children:a.jsxs("div",{ref:O,className:"p-2 sm:p-3 lg:p-4 font-mono text-xs sm:text-sm space-y-1",children:[L.length===0?a.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):L.map(U=>a.jsxs("div",{className:ye("py-2 px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",_(U.level)),children:[a.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-xs",children:U.timestamp}),a.jsxs("span",{className:ye("text-xs font-semibold",A(U.level)),children:["[",U.level,"]"]})]}),a.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 text-xs truncate",children:U.module}),a.jsx("div",{className:"text-gray-300 dark:text-gray-400 text-xs whitespace-pre-wrap break-words",children:U.message})]}),a.jsxs("div",{className:"hidden sm:flex gap-3 items-start",children:[a.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[140px] lg:w-[180px] text-xs lg:text-sm",children:U.timestamp}),a.jsxs("span",{className:ye("flex-shrink-0 w-[70px] lg:w-[80px] font-semibold text-xs lg:text-sm",A(U.level)),children:["[",U.level,"]"]}),a.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[120px] lg:w-[150px] truncate text-xs lg:text-sm",children:U.module}),a.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words text-xs lg:text-sm",children:U.message})]})]},U.id)),a.jsx("div",{ref:j,className:"h-4"})]})})})]})})}const fme="Mai-with-u",mme="plugin-repo",pme="main",gme="plugin_details.json";async function xme(){try{const t=await ot("/api/webui/plugins/fetch-raw",{method:"POST",headers:bt(),body:JSON.stringify({owner:fme,repo:mme,branch:pme,file_path:gme})});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 vme(){try{const t=await ot("/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 yme(){try{const t=await ot("/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 bme(t,e,n){const r=t.split(".").map(c=>parseInt(c)||0),s=r[0]||0,i=r[1]||0,l=r[2]||0;if(n.version_majorparseInt(p)||0),d=c[0]||0,h=c[1]||0,m=c[2]||0;if(n.version_major>d||n.version_major===d&&n.version_minor>h||n.version_major===d&&n.version_minor===h&&n.version_patch>m)return!1}return!0}function wme(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 l=JSON.parse(i.data);t(l)}catch(l){console.error("Failed to parse progress data:",l)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Lp(){try{const t=await ot("/api/webui/plugins/installed",{headers:bt()});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 Ip(t,e){return e.some(n=>n.id===t)}function qp(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function Sme(t,e,n="main"){const r=await ot("/api/webui/plugins/install",{method:"POST",headers:bt(),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 kme(t){const e=await ot("/api/webui/plugins/uninstall",{method:"POST",headers:bt(),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 Ome(t,e,n="main"){const r=await ot("/api/webui/plugins/update",{method:"POST",headers:bt(),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 C0="https://maibot-plugin-stats.maibot-webui.workers.dev";async function zz(t){try{const e=await fetch(`${C0}/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 jme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/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 Nme(t,e){try{const n=e||K5(),r=await fetch(`${C0}/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 Cme(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||K5(),i=await fetch(`${C0}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),l=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...l}:{success:!1,error:l.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function Tme(t){try{const e=await fetch(`${C0}/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 Ame(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const j=await zz(t);j&&r(j),i(!1)};S.useEffect(()=>{v()},[t]);const b=async()=>{const j=await jme(t);j.success?(x({title:"已点赞",description:"感谢你的支持!"}),v()):x({title:"点赞失败",description:j.error||"未知错误",variant:"destructive"})},k=async()=>{const j=await Nme(t);j.success?(x({title:"已反馈",description:"感谢你的反馈!"}),v()):x({title:"操作失败",description:j.error||"未知错误",variant:"destructive"})},O=async()=>{if(l===0){x({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const j=await Cme(t,l,d||void 0);j.success?(x({title:"评分成功",description:"感谢你的评价!"}),p(!1),c(0),h(""),v()):x({title:"评分失败",description:j.error||"未知错误",variant:"destructive"})};return s?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4"}),a.jsx("span",{children:"-"})]})]}):n?e?a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:n.downloads.toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:n.rating.toFixed(1)})]}),a.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[a.jsx(my,{className:"h-4 w-4"}),a.jsx("span",{children:n.likes})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(fc,{className:"h-5 w-5 text-muted-foreground mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(Jl,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),a.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(my,{className:"h-5 w-5 text-green-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.likes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),a.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[a.jsx(dO,{className:"h-5 w-5 text-red-500 mb-1"}),a.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",onClick:b,children:[a.jsx(my,{className:"h-4 w-4 mr-1"}),"点赞"]}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:k,children:[a.jsx(dO,{className:"h-4 w-4 mr-1"}),"点踩"]}),a.jsxs(Rr,{open:m,onOpenChange:p,children:[a.jsx(mw,{asChild:!0,children:a.jsxs(ie,{variant:"default",size:"sm",children:[a.jsx(Jl,{className:"h-4 w-4 mr-1"}),"评分"]})}),a.jsxs(Nr,{children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"为插件评分"}),a.jsx(Gr,{children:"分享你的使用体验,帮助其他用户"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(j=>a.jsx("button",{onClick:()=>c(j),className:"focus:outline-none",children:a.jsx(Jl,{className:`h-8 w-8 transition-colors ${j<=l?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},j))}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[l===0&&"点击星星进行评分",l===1&&"很差",l===2&&"一般",l===3&&"还行",l===4&&"不错",l===5&&"非常好"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),a.jsx(_n,{value:d,onChange:j=>h(j.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[d.length," / 500"]})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:O,disabled:l===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),a.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((j,T)=>a.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(A=>a.jsx(Jl,{className:`h-3 w-3 ${A<=j.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},A))}),a.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(j.created_at).toLocaleDateString()})]}),j.comment&&a.jsx("p",{className:"text-sm text-muted-foreground",children:j.comment})]},T))})]})]}):null}const a9={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function Eme(){const t=wa(),[e,n]=S.useState(null),[r,s]=S.useState(""),[i,l]=S.useState("all"),[c,d]=S.useState("all"),[h,m]=S.useState(!0),[p,x]=S.useState([]),[v,b]=S.useState(!0),[k,O]=S.useState(null),[j,T]=S.useState(null),[A,_]=S.useState(null),[D,E]=S.useState(null),[,z]=S.useState([]),[Q,F]=S.useState({}),{toast:L}=Pr(),U=async R=>{const me=R.map(async K=>{try{const H=await zz(K.id);return{id:K.id,stats:H}}catch(H){return console.warn(`Failed to load stats for ${K.id}:`,H),{id:K.id,stats:null}}}),Y=await Promise.all(me),P={};Y.forEach(({id:K,stats:H})=>{H&&(P[K]=H)}),F(P)};S.useEffect(()=>{let R=null,me=!1;return(async()=>{if(R=wme(P=>{me||(_(P),P.stage==="success"?setTimeout(()=>{me||_(null)},2e3):P.stage==="error"&&(b(!1),O(P.error||"加载失败")))},P=>{console.error("WebSocket error:",P),me||L({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(P=>{if(!R){P();return}const K=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),P()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),P()):setTimeout(K,100)};K()}),!me){const P=await vme();T(P),P.installed||L({title:"Git 未安装",description:P.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!me){const P=await yme();E(P)}if(!me)try{b(!0),O(null);const P=await xme();if(!me){const K=await Lp();z(K);const H=P.map(fe=>{const ve=Ip(fe.id,K),Re=qp(fe.id,K);return{...fe,installed:ve,installed_version:Re}});for(const fe of K)!H.some(Re=>Re.id===fe.id)&&fe.manifest&&H.push({id:fe.id,manifest:{manifest_version:fe.manifest.manifest_version||1,name:fe.manifest.name,version:fe.manifest.version,description:fe.manifest.description||"",author:fe.manifest.author,license:fe.manifest.license||"Unknown",host_application:fe.manifest.host_application,homepage_url:fe.manifest.homepage_url,repository_url:fe.manifest.repository_url,keywords:fe.manifest.keywords||[],categories:fe.manifest.categories||[],default_locale:fe.manifest.default_locale||"zh-CN",locales_path:fe.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:fe.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});x(H),U(H)}}catch(P){if(!me){const K=P instanceof Error?P.message:"加载插件列表失败";O(K),L({title:"加载失败",description:K,variant:"destructive"})}}finally{me||b(!1)}})(),()=>{me=!0,R&&R.close()}},[L]);const V=R=>{if(!R.installed&&D&&!ce(R))return a.jsxs(On,{variant:"destructive",className:"gap-1",children:[a.jsx(xc,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const me=R.installed_version?.trim(),Y=R.manifest.version?.trim();if(me!==Y){const P=me?.split(".").map(Number)||[0,0,0],K=Y?.split(".").map(Number)||[0,0,0];for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return a.jsxs(On,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[a.jsx(xc,{className:"h-3 w-3"}),"可更新"]});if((K[H]||0)<(P[H]||0))break}}return a.jsxs(On,{variant:"default",className:"gap-1",children:[a.jsx(Es,{className:"h-3 w-3"}),"已安装"]})}return null},ce=R=>!D||!R.manifest?.host_application?!0:bme(R.manifest.host_application.min_version,R.manifest.host_application.max_version,D),W=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const me=R.installed_version.trim(),Y=R.manifest.version.trim();if(me===Y)return!1;const P=me.split(".").map(Number),K=Y.split(".").map(Number);for(let H=0;H<3;H++){if((K[H]||0)>(P[H]||0))return!0;if((K[H]||0)<(P[H]||0))return!1}return!1},J=p.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(H=>H.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let P=!0;c==="installed"?P=R.installed===!0:c==="updates"&&(P=R.installed===!0&&W(R));const K=!h||!D||ce(R);return me&&Y&&P&&K}),$=()=>{n(null)},ae=async R=>{if(!j?.installed){L({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(D&&!ce(R)){L({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await Sme(R.id,R.manifest.repository_url||"","main"),Tme(R.id).catch(Y=>{console.warn("Failed to record download:",Y)}),L({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const me=await Lp();z(me),x(Y=>Y.map(P=>{if(P.id===R.id){const K=Ip(P.id,me),H=qp(P.id,me);return{...P,installed:K,installed_version:H}}return P}))}catch(me){L({title:"安装失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},ne=async R=>{try{await kme(R.id),L({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const me=await Lp();z(me),x(Y=>Y.map(P=>{if(P.id===R.id){const K=Ip(P.id,me),H=qp(P.id,me);return{...P,installed:K,installed_version:H}}return P}))}catch(me){L({title:"卸载失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}},ue=async R=>{if(!j?.installed){L({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const me=await Ome(R.id,R.manifest.repository_url||"","main");L({title:"更新成功",description:`${R.manifest.name} 已从 ${me.old_version} 更新到 ${me.new_version}`});const Y=await Lp();z(Y),x(P=>P.map(K=>{if(K.id===R.id){const H=Ip(K.id,Y),fe=qp(K.id,Y);return{...K,installed:H,installed_version:fe}}return K}))}catch(me){L({title:"更新失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}};return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),a.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),a.jsxs(ie,{onClick:()=>t({to:"/plugin-mirrors"}),children:[a.jsx(Cq,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),j&&!j.installed&&a.jsxs(gt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-orange-600"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),a.jsx(Sr,{className:"text-orange-800 dark:text-orange-200",children:j.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),a.jsx(an,{children:a.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",a.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Me,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),a.jsxs(Lt,{value:i,onValueChange:l,children:[a.jsx(Dt,{className:"w-full sm:w-[200px]",children:a.jsx(It,{placeholder:"选择分类"})}),a.jsxs(Rt,{children:[a.jsx(Pe,{value:"all",children:"全部分类"}),a.jsx(Pe,{value:"Group Management",children:"群组管理"}),a.jsx(Pe,{value:"Entertainment & Interaction",children:"娱乐互动"}),a.jsx(Pe,{value:"Utility Tools",children:"实用工具"}),a.jsx(Pe,{value:"Content Generation",children:"内容生成"}),a.jsx(Pe,{value:"Multimedia",children:"多媒体"}),a.jsx(Pe,{value:"External Integration",children:"外部集成"}),a.jsx(Pe,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),a.jsx(Pe,{value:"Other",children:"其他"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ss,{id:"compatible-only",checked:h,onCheckedChange:R=>m(R===!0)}),a.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),a.jsx(hl,{value:c,onValueChange:d,className:"w-full",children:a.jsxs(ya,{className:"grid w-full grid-cols-3",children:[a.jsxs($t,{value:"all",children:["全部插件 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return me&&Y&&P}).length,")"]}),a.jsxs($t,{value:"installed",children:["已安装 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return R.installed&&me&&Y&&P}).length,")"]}),a.jsxs($t,{value:"updates",children:["可更新 (",p.filter(R=>{if(!R.manifest)return!1;const me=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(K=>K.toLowerCase().includes(r.toLowerCase())),Y=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),P=!h||!D||ce(R);return R.installed&&W(R)&&me&&Y&&P}).length,")"]})]})}),A&&A.stage==="loading"&&a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(hf,{className:"h-4 w-4 animate-spin"}),a.jsxs("span",{className:"text-sm font-medium",children:[A.operation==="fetch"&&"加载插件列表",A.operation==="install"&&`安装插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="uninstall"&&`卸载插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="update"&&`更新插件${A.plugin_id?`: ${A.plugin_id}`:""}`]})]}),a.jsxs("span",{className:"text-sm font-medium",children:[A.progress,"%"]})]}),a.jsx(n0,{value:A.progress,className:"h-2"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:A.message}),A.operation==="fetch"&&A.total_plugins>0&&a.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",A.loaded_plugins," / ",A.total_plugins," 个插件"]})]})}),A&&A.stage==="error"&&A.error&&a.jsx(gt,{className:"border-destructive bg-destructive/10",children:a.jsx(Wt,{children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Hu,{className:"h-5 w-5 text-destructive"}),a.jsxs("div",{children:[a.jsx(Gt,{className:"text-lg text-destructive",children:"加载失败"}),a.jsx(Sr,{className:"text-destructive/80",children:A.error})]})]})})}),v?a.jsxs("div",{className:"flex items-center justify-center py-12",children:[a.jsx(hf,{className:"h-8 w-8 animate-spin text-muted-foreground"}),a.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):k?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:k}),a.jsx(ie,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):J.length===0?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:J.map(R=>a.jsxs(gt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[a.jsxs(Wt,{children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx(Gt,{className:"text-xl",children:R.manifest?.name||R.id}),a.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&a.jsx(On,{variant:"secondary",className:"text-xs whitespace-nowrap",children:a9[R.manifest.categories[0]]||R.manifest.categories[0]}),V(R)]})]}),a.jsx(Sr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),a.jsx(an,{className:"flex-1",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fc,{className:"h-4 w-4"}),a.jsx("span",{children:(Q[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.jsx("span",{children:(Q[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(me=>a.jsx(On,{variant:"outline",className:"text-xs",children:me},me)),R.manifest?.keywords&&R.manifest.keywords.length>3&&a.jsxs(On,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),a.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[a.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{children:"支持:"}),a.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),a.jsx(bC,{className:"pt-4",children:a.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?W(R)?a.jsxs(ie,{size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ue(R),children:[a.jsx(Fi,{className:"h-4 w-4 mr-1"}),"更新"]}):a.jsxs(ie,{variant:"destructive",size:"sm",disabled:!j?.installed,title:j?.installed?void 0:"Git 未安装",onClick:()=>ne(R),children:[a.jsx(Ht,{className:"h-4 w-4 mr-1"}),"卸载"]}):a.jsxs(ie,{size:"sm",disabled:!j?.installed||A?.operation==="install"||D!==null&&!ce(R),title:j?.installed?D!==null&&!ce(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${D?.version})`:void 0:"Git 未安装",onClick:()=>ae(R),children:[a.jsx(fc,{className:"h-4 w-4 mr-1"}),A?.operation==="install"&&A?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),a.jsx(Rr,{open:e!==null,onOpenChange:$,children:e&&e.manifest&&a.jsxs(Nr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[a.jsx(Cr,{children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"space-y-2 flex-1",children:[a.jsx(Tr,{className:"text-2xl",children:e.manifest.name}),a.jsxs(Gr,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&a.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:a.jsx(Yh,{className:"h-3 w-3 inline"})})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&a.jsx(On,{variant:"secondary",children:a9[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(Mme,{pluginId:e.id}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"版本"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"下载量"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:(Q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"评分"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Jl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),a.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,")"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"许可证"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),a.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}`:" - 最新版本"]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>a.jsx(On,{variant:"outline",children:R},R))})]}),e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),a.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),a.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"主页: "}),a.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&&a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"font-medium",children:"仓库: "}),a.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),a.jsxs(ps,{children:[e.manifest.homepage_url&&a.jsxs(ie,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&a.jsxs(ie,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function _me(){return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),a.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ie,{variant:"outline",size:"sm",children:[a.jsx(Fi,{className:"h-4 w-4 mr-2"}),"刷新"]}),a.jsxs(ie,{size:"sm",children:[a.jsx(Ii,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已安装插件"}),a.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已启用"}),a.jsx(Es,{className:"h-4 w-4 text-green-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"已禁用"}),a.jsx(xc,{className:"h-4 w-4 text-orange-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[a.jsx(Gt,{className:"text-sm font-medium",children:"可更新"}),a.jsx(Fi,{className:"h-4 w-4 text-blue-600"})]}),a.jsxs(an,{children:[a.jsx("div",{className:"text-2xl font-bold",children:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),a.jsxs(gt,{children:[a.jsxs(Wt,{children:[a.jsx(Gt,{children:"已安装的插件"}),a.jsx(Sr,{children:"查看和管理已安装插件的配置"})]}),a.jsx(an,{children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx(pg,{className:"h-16 w-16 text-muted-foreground/50"}),a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),a.jsx("div",{className:"flex gap-2",children:a.jsx(ie,{variant:"outline",asChild:!0,children:a.jsxs("a",{href:"/plugins",children:[a.jsx(Yh,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),a.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"即将推出的功能"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件启用/禁用"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"快速切换插件运行状态"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置参数编辑"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"可视化编辑插件配置文件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"依赖管理"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看和安装插件依赖包"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-primary/10 p-1 mt-0.5",children:a.jsx(Es,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"插件日志"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"查看插件运行日志和错误信息"})]})]})]})})]}),a.jsxs(gt,{children:[a.jsx(Wt,{children:a.jsx(Gt,{className:"text-base",children:"开发者工具"})}),a.jsx(an,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"热重载"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"无需重启即可重新加载插件"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"配置验证"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"检查配置文件格式和完整性"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"性能监控"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"监控插件的资源占用情况"})]})]}),a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-full bg-blue-500/10 p-1 mt-0.5",children:a.jsx(Ii,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"调试模式"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"详细的调试信息和错误追踪"})]})]})]})})]})]}),a.jsx(gt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:a.jsx(an,{className:"pt-6",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(xc,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),a.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",a.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function Dme(){const t=wa(),{toast:e}=Pr(),[n,r]=S.useState([]),[s,i]=S.useState(!0),[l,c]=S.useState(null),[d,h]=S.useState(null),[m,p]=S.useState(!1),[x,v]=S.useState(!1),[b,k]=S.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O=S.useCallback(async()=>{try{i(!0),c(null);const z=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${z}`}});if(!Q.ok)throw new Error("获取镜像源列表失败");const F=await Q.json();r(F.mirrors||[])}catch(z){const Q=z instanceof Error?z.message:"加载镜像源失败";c(Q),e({title:"加载失败",description:Q,variant:"destructive"})}finally{i(!1)}},[e]);S.useEffect(()=>{O()},[O]);const j=async()=>{try{const z=localStorage.getItem("access-token"),Q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify(b)});if(!Q.ok){const F=await Q.json();throw new Error(F.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),p(!1),k({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O()}catch(z){e({title:"添加失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},T=async()=>{if(d)try{const z=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${d.id}`,{method:"PUT",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify({name:b.name,raw_prefix:b.raw_prefix,clone_prefix:b.clone_prefix,enabled:b.enabled,priority:b.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),v(!1),h(null),O()}catch(z){e({title:"更新失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},A=async z=>{if(confirm("确定要删除这个镜像源吗?"))try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z}`,{method:"DELETE",headers:{Authorization:`Bearer ${Q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),O()}catch(Q){e({title:"删除失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},_=async z=>{try{const Q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!z.enabled})})).ok)throw new Error("更新状态失败");O()}catch(Q){e({title:"更新失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},D=z=>{h(z),k({id:z.id,name:z.name,raw_prefix:z.raw_prefix,clone_prefix:z.clone_prefix,enabled:z.enabled,priority:z.priority}),v(!0)},E=async(z,Q)=>{const F=Q==="up"?z.priority-1:z.priority+1;if(!(F<1))try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({priority:F})})).ok)throw new Error("更新优先级失败");O()}catch(L){e({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}};return a.jsx(mn,{className:"h-full",children:a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:a.jsx(R9,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),a.jsxs(ie,{onClick:()=>p(!0),children:[a.jsx(Wr,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?a.jsx(gt,{className:"p-6",children:a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(hf,{className:"h-8 w-8 animate-spin text-primary"})})}):l?a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a.jsx(Hu,{className:"h-12 w-12 text-destructive mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l}),a.jsx(ie,{onClick:O,children:"重新加载"})]})}):a.jsxs(gt,{children:[a.jsx("div",{className:"hidden md:block",children:a.jsxs(Mc,{children:[a.jsx(Ec,{children:a.jsxs(xr,{children:[a.jsx(xt,{children:"状态"}),a.jsx(xt,{children:"名称"}),a.jsx(xt,{children:"ID"}),a.jsx(xt,{children:"优先级"}),a.jsx(xt,{className:"text-right",children:"操作"})]})}),a.jsx(_c,{children:n.map(z=>a.jsxs(xr,{children:[a.jsx(it,{children:a.jsx(jt,{checked:z.enabled,onCheckedChange:()=>_(z)})}),a.jsx(it,{children:a.jsxs("div",{children:[a.jsx("div",{className:"font-medium",children:z.name}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",z.raw_prefix]})]})}),a.jsx(it,{children:a.jsx(On,{variant:"outline",children:z.id})}),a.jsx(it,{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono",children:z.priority}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(z,"up"),disabled:z.priority===1,children:a.jsx(e2,{className:"h-3 w-3"})}),a.jsx(ie,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(z,"down"),children:a.jsx(df,{className:"h-3 w-3"})})]})]})}),a.jsx(it,{className:"text-right",children:a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>D(z),children:a.jsx(nd,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>A(z.id),children:a.jsx(Ht,{className:"h-4 w-4 text-destructive"})})]})})]},z.id))})]})}),a.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(z=>a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"font-semibold",children:z.name}),z.enabled&&a.jsx(On,{variant:"default",className:"text-xs",children:"启用"})]}),a.jsx(On,{variant:"outline",className:"mt-1 text-xs",children:z.id})]}),a.jsx(jt,{checked:z.enabled,onCheckedChange:()=>_(z)})]}),a.jsxs("div",{className:"text-sm space-y-1",children:[a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"Raw: "}),a.jsx("span",{className:"break-all",children:z.raw_prefix})]}),a.jsxs("div",{className:"text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"优先级: "}),a.jsx("span",{className:"font-mono",children:z.priority})]})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[a.jsxs(ie,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>D(z),children:[a.jsx(nd,{className:"h-4 w-4 mr-1"}),"编辑"]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(z,"up"),disabled:z.priority===1,children:a.jsx(e2,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>E(z,"down"),children:a.jsx(df,{className:"h-4 w-4"})}),a.jsx(ie,{variant:"destructive",size:"sm",onClick:()=>A(z.id),children:a.jsx(Ht,{className:"h-4 w-4"})})]})]})},z.id))})]}),a.jsx(Rr,{open:m,onOpenChange:p,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"添加镜像源"}),a.jsx(Gr,{children:"添加新的 Git 镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-id",children:"镜像源 ID *"}),a.jsx(Me,{id:"add-id",placeholder:"例如: my-mirror",value:b.id,onChange:z=>k({...b,id:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-name",children:"名称 *"}),a.jsx(Me,{id:"add-name",placeholder:"例如: 我的镜像源",value:b.name,onChange:z=>k({...b,name:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"add-raw",placeholder:"https://example.com/raw",value:b.raw_prefix,onChange:z=>k({...b,raw_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"add-clone",placeholder:"https://example.com/clone",value:b.clone_prefix,onChange:z=>k({...b,clone_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"add-priority",children:"优先级"}),a.jsx(Me,{id:"add-priority",type:"number",min:"1",value:b.priority,onChange:z=>k({...b,priority:parseInt(z.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"add-enabled",checked:b.enabled,onCheckedChange:z=>k({...b,enabled:z})}),a.jsx(te,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>p(!1),children:"取消"}),a.jsx(ie,{onClick:j,children:"添加"})]})]})}),a.jsx(Rr,{open:x,onOpenChange:v,children:a.jsxs(Nr,{className:"max-w-lg",children:[a.jsxs(Cr,{children:[a.jsx(Tr,{children:"编辑镜像源"}),a.jsx(Gr,{children:"修改镜像源配置"})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{children:"镜像源 ID"}),a.jsx(Me,{value:b.id,disabled:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-name",children:"名称 *"}),a.jsx(Me,{id:"edit-name",value:b.name,onChange:z=>k({...b,name:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),a.jsx(Me,{id:"edit-raw",value:b.raw_prefix,onChange:z=>k({...b,raw_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-clone",children:"克隆前缀 *"}),a.jsx(Me,{id:"edit-clone",value:b.clone_prefix,onChange:z=>k({...b,clone_prefix:z.target.value})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(te,{htmlFor:"edit-priority",children:"优先级"}),a.jsx(Me,{id:"edit-priority",type:"number",min:"1",value:b.priority,onChange:z=>k({...b,priority:parseInt(z.target.value)||1})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(jt,{id:"edit-enabled",checked:b.enabled,onCheckedChange:z=>k({...b,enabled:z})}),a.jsx(te,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),a.jsxs(ps,{children:[a.jsx(ie,{variant:"outline",onClick:()=>v(!1),children:"取消"}),a.jsx(ie,{onClick:T,children:"保存"})]})]})})]})})}const Rme=Nd("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"}}),Pz=S.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>a.jsx("kbd",{className:ye(Rme({size:e,className:t})),ref:i,...s,children:n?a.jsx("abbr",{title:n,children:r}):r}));Pz.displayName="Kbd";const zme=[{icon:hg,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:ao,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:z9,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:P9,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:K4,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Wf,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:B9,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Tq,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:pg,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:fg,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Ii,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function Pme({open:t,onOpenChange:e}){const[n,r]=S.useState(""),[s,i]=S.useState(0),l=wa(),c=zme.filter(m=>m.title.toLowerCase().includes(n.toLowerCase())||m.description.toLowerCase().includes(n.toLowerCase())||m.category.toLowerCase().includes(n.toLowerCase()));S.useEffect(()=>{t&&(r(""),i(0))},[t]);const d=S.useCallback(m=>{l({to:m}),e(!1)},[l,e]),h=S.useCallback(m=>{m.key==="ArrowDown"?(m.preventDefault(),i(p=>(p+1)%c.length)):m.key==="ArrowUp"?(m.preventDefault(),i(p=>(p-1+c.length)%c.length)):m.key==="Enter"&&c[s]&&(m.preventDefault(),d(c[s].path))},[c,s,d]);return a.jsx(Rr,{open:t,onOpenChange:e,children:a.jsxs(Nr,{className:"max-w-2xl p-0 gap-0",children:[a.jsxs(Cr,{className:"px-4 pt-4 pb-0",children:[a.jsx(Tr,{className:"sr-only",children:"搜索"}),a.jsxs("div",{className:"relative",children:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),a.jsx(Me,{value:n,onChange:m=>{r(m.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),a.jsx("div",{className:"border-t",children:a.jsx(mn,{className:"h-[400px]",children:c.length>0?a.jsx("div",{className:"p-2",children:c.map((m,p)=>{const x=m.icon;return a.jsxs("button",{onClick:()=>d(m.path),onMouseEnter:()=>i(p),className:ye("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",p===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[a.jsx(x,{className:"h-5 w-5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-sm",children:m.title}),a.jsx("div",{className:"text-xs text-muted-foreground truncate",children:m.description})]}),a.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:m.category})]},m.path)})}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(Bs,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),a.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function Bme(t){const e=Lme(t),n=S.forwardRef((r,s)=>{const{children:i,...l}=r,c=S.Children.toArray(i),d=c.find(qme);if(d){const h=d.props.children,m=c.map(p=>p===d?S.Children.count(h)>1?S.Children.only(null):S.isValidElement(h)?h.props.children:null:p);return a.jsx(e,{...l,ref:s,children:S.isValidElement(h)?S.cloneElement(h,void 0,m):null})}return a.jsx(e,{...l,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function Lme(t){const e=S.forwardRef((n,r)=>{const{children:s,...i}=n;if(S.isValidElement(s)){const l=Qme(s),c=Fme(i,s.props);return s.type!==S.Fragment&&(c.ref=r?oo(r,l):l),S.cloneElement(s,c)}return S.Children.count(s)>1?S.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ime=Symbol("radix.slottable");function qme(t){return S.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ime}function Fme(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]=(...c)=>{const d=i(...c);return s(...c),d}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Qme(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 z4=["Enter"," "],$me=["ArrowDown","PageUp","Home"],Bz=["ArrowUp","PageDown","End"],Hme=[...$me,...Bz],Ume={ltr:[...z4,"ArrowRight"],rtl:[...z4,"ArrowLeft"]},Vme={ltr:["ArrowLeft"],rtl:["ArrowRight"]},T0="Menu",[$f,Wme,Gme]=tx(T0),[Lc,Lz]=Vi(T0,[Gme,wd,fx]),A0=wd(),Iz=fx(),[qz,Eo]=Lc(T0),[Xme,M0]=Lc(T0),Fz=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:l=!0}=t,c=A0(e),[d,h]=S.useState(null),m=S.useRef(!1),p=es(i),x=Vf(s);return S.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),a.jsx(ix,{...c,children:a.jsx(qz,{scope:e,open:n,onOpenChange:p,content:d,onContentChange:h,children:a.jsx(Xme,{scope:e,onClose:S.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:x,modal:l,children:r})})})};Fz.displayName=T0;var Yme="MenuAnchor",Z5=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(ax,{...s,...r,ref:e})});Z5.displayName=Yme;var J5="MenuPortal",[Kme,Qz]=Lc(J5,{forceMount:void 0}),$z=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Eo(J5,e);return a.jsx(Kme,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};$z.displayName=J5;var Ci="MenuContent",[Zme,e3]=Lc(Ci),Hz=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:l.modal?a.jsx(Jme,{...s,ref:e}):a.jsx(epe,{...s,ref:e})})})})}),Jme=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu),r=S.useRef(null),s=Cn(e,r);return S.useEffect(()=>{const i=r.current;if(i)return j9(i)},[]),a.jsx(t3,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:$e(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),epe=S.forwardRef((t,e)=>{const n=Eo(Ci,t.__scopeMenu);return a.jsx(t3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),tpe=Bme("MenuContent.ScrollLock"),t3=S.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,disableOutsideScroll:b,...k}=t,O=Eo(Ci,n),j=M0(Ci,n),T=A0(n),A=Iz(n),_=Wme(n),[D,E]=S.useState(null),z=S.useRef(null),Q=Cn(e,z,O.onContentChange),F=S.useRef(0),L=S.useRef(""),U=S.useRef(0),V=S.useRef(null),ce=S.useRef("right"),W=S.useRef(0),J=b?N9:S.Fragment,$=b?{as:tpe,allowPinchZoom:!0}:void 0,ae=ue=>{const R=L.current+ue,me=_().filter(ve=>!ve.disabled),Y=document.activeElement,P=me.find(ve=>ve.ref.current===Y)?.textValue,K=me.map(ve=>ve.textValue),H=fpe(K,R,P),fe=me.find(ve=>ve.textValue===H)?.ref.current;(function ve(Re){L.current=Re,window.clearTimeout(F.current),Re!==""&&(F.current=window.setTimeout(()=>ve(""),1e3))})(R),fe&&setTimeout(()=>fe.focus())};S.useEffect(()=>()=>window.clearTimeout(F.current),[]),C9();const ne=S.useCallback(ue=>ce.current===V.current?.side&&ppe(ue,V.current?.area),[]);return a.jsx(Zme,{scope:n,searchRef:L,onItemEnter:S.useCallback(ue=>{ne(ue)&&ue.preventDefault()},[ne]),onItemLeave:S.useCallback(ue=>{ne(ue)||(z.current?.focus(),E(null))},[ne]),onTriggerLeave:S.useCallback(ue=>{ne(ue)&&ue.preventDefault()},[ne]),pointerGraceTimerRef:U,onPointerGraceIntentChange:S.useCallback(ue=>{V.current=ue},[]),children:a.jsx(J,{...$,children:a.jsx(T9,{asChild:!0,trapped:s,onMountAutoFocus:$e(i,ue=>{ue.preventDefault(),z.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:h,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:x,onDismiss:v,children:a.jsx(NC,{asChild:!0,...A,dir:j.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:E,onEntryFocus:$e(d,ue=>{j.isUsingKeyboardRef.current||ue.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(X4,{role:"menu","aria-orientation":"vertical","data-state":lP(O.open),"data-radix-menu-content":"",dir:j.dir,...T,...k,ref:Q,style:{outline:"none",...k.style},onKeyDown:$e(k.onKeyDown,ue=>{const me=ue.target.closest("[data-radix-menu-content]")===ue.currentTarget,Y=ue.ctrlKey||ue.altKey||ue.metaKey,P=ue.key.length===1;me&&(ue.key==="Tab"&&ue.preventDefault(),!Y&&P&&ae(ue.key));const K=z.current;if(ue.target!==K||!Hme.includes(ue.key))return;ue.preventDefault();const fe=_().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);Bz.includes(ue.key)&&fe.reverse(),dpe(fe)}),onBlur:$e(t.onBlur,ue=>{ue.currentTarget.contains(ue.target)||(window.clearTimeout(F.current),L.current="")}),onPointerMove:$e(t.onPointerMove,Hf(ue=>{const R=ue.target,me=W.current!==ue.clientX;if(ue.currentTarget.contains(R)&&me){const Y=ue.clientX>W.current?"right":"left";ce.current=Y,W.current=ue.clientX}}))})})})})})})});Hz.displayName=Ci;var npe="MenuGroup",n3=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"group",...r,ref:e})});n3.displayName=npe;var rpe="MenuLabel",Uz=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});Uz.displayName=rpe;var Jg="MenuItem",l9="menu.itemSelect",Kx=S.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=S.useRef(null),l=M0(Jg,t.__scopeMenu),c=e3(Jg,t.__scopeMenu),d=Cn(e,i),h=S.useRef(!1),m=()=>{const p=i.current;if(!n&&p){const x=new CustomEvent(l9,{bubbles:!0,cancelable:!0});p.addEventListener(l9,v=>r?.(v),{once:!0}),M9(p,x),x.defaultPrevented?h.current=!1:l.onClose()}};return a.jsx(Vz,{...s,ref:d,disabled:n,onClick:$e(t.onClick,m),onPointerDown:p=>{t.onPointerDown?.(p),h.current=!0},onPointerUp:$e(t.onPointerUp,p=>{h.current||p.currentTarget?.click()}),onKeyDown:$e(t.onKeyDown,p=>{const x=c.searchRef.current!=="";n||x&&p.key===" "||z4.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Kx.displayName=Jg;var Vz=S.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,l=e3(Jg,n),c=Iz(n),d=S.useRef(null),h=Cn(e,d),[m,p]=S.useState(!1),[x,v]=S.useState("");return S.useEffect(()=>{const b=d.current;b&&v((b.textContent??"").trim())},[i.children]),a.jsx($f.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:a.jsx(CC,{asChild:!0,...c,focusable:!r,children:a.jsx(Zt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:$e(t.onPointerMove,Hf(b=>{r?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$e(t.onPointerLeave,Hf(b=>l.onItemLeave(b))),onFocus:$e(t.onFocus,()=>p(!0)),onBlur:$e(t.onBlur,()=>p(!1))})})})}),spe="MenuCheckboxItem",Wz=S.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return a.jsx(Zz,{scope:t.__scopeMenu,checked:n,children:a.jsx(Kx,{role:"menuitemcheckbox","aria-checked":ex(n)?"mixed":n,...s,ref:e,"data-state":i3(n),onSelect:$e(s.onSelect,()=>r?.(ex(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Wz.displayName=spe;var Gz="MenuRadioGroup",[ipe,ape]=Lc(Gz,{value:void 0,onValueChange:()=>{}}),Xz=S.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=es(r);return a.jsx(ipe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:a.jsx(n3,{...s,ref:e})})});Xz.displayName=Gz;var Yz="MenuRadioItem",Kz=S.forwardRef((t,e)=>{const{value:n,...r}=t,s=ape(Yz,t.__scopeMenu),i=n===s.value;return a.jsx(Zz,{scope:t.__scopeMenu,checked:i,children:a.jsx(Kx,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":i3(i),onSelect:$e(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Kz.displayName=Yz;var r3="MenuItemIndicator",[Zz,lpe]=Lc(r3,{checked:!1}),Jz=S.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=lpe(r3,n);return a.jsx(Ls,{present:r||ex(i.checked)||i.checked===!0,children:a.jsx(Zt.span,{...s,ref:e,"data-state":i3(i.checked)})})});Jz.displayName=r3;var ope="MenuSeparator",eP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Zt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});eP.displayName=ope;var cpe="MenuArrow",tP=S.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=A0(n);return a.jsx(Y4,{...s,...r,ref:e})});tP.displayName=cpe;var s3="MenuSub",[upe,nP]=Lc(s3),rP=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Eo(s3,e),l=A0(e),[c,d]=S.useState(null),[h,m]=S.useState(null),p=es(s);return S.useEffect(()=>(i.open===!1&&p(!1),()=>p(!1)),[i.open,p]),a.jsx(ix,{...l,children:a.jsx(qz,{scope:e,open:r,onOpenChange:p,content:h,onContentChange:m,children:a.jsx(upe,{scope:e,contentId:ji(),triggerId:ji(),trigger:c,onTriggerChange:d,children:n})})})};rP.displayName=s3;var Gh="MenuSubTrigger",sP=S.forwardRef((t,e)=>{const n=Eo(Gh,t.__scopeMenu),r=M0(Gh,t.__scopeMenu),s=nP(Gh,t.__scopeMenu),i=e3(Gh,t.__scopeMenu),l=S.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=i,h={__scopeMenu:t.__scopeMenu},m=S.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return S.useEffect(()=>m,[m]),S.useEffect(()=>{const p=c.current;return()=>{window.clearTimeout(p),d(null)}},[c,d]),a.jsx(Z5,{asChild:!0,...h,children:a.jsx(Vz,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":lP(n.open),...t,ref:oo(e,s.onTriggerChange),onClick:p=>{t.onClick?.(p),!(t.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:$e(t.onPointerMove,Hf(p=>{i.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!n.open&&!l.current&&(i.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:$e(t.onPointerLeave,Hf(p=>{m();const x=n.content?.getBoundingClientRect();if(x){const v=n.content?.dataset.side,b=v==="right",k=b?-5:5,O=x[b?"left":"right"],j=x[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+k,y:p.clientY},{x:O,y:x.top},{x:j,y:x.top},{x:j,y:x.bottom},{x:O,y:x.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$e(t.onKeyDown,p=>{const x=i.searchRef.current!=="";t.disabled||x&&p.key===" "||Ume[r.dir].includes(p.key)&&(n.onOpenChange(!0),n.content?.focus(),p.preventDefault())})})})});sP.displayName=Gh;var iP="MenuSubContent",aP=S.forwardRef((t,e)=>{const n=Qz(Ci,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Eo(Ci,t.__scopeMenu),l=M0(Ci,t.__scopeMenu),c=nP(iP,t.__scopeMenu),d=S.useRef(null),h=Cn(e,d);return a.jsx($f.Provider,{scope:t.__scopeMenu,children:a.jsx(Ls,{present:r||i.open,children:a.jsx($f.Slot,{scope:t.__scopeMenu,children:a.jsx(t3,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:h,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{l.isUsingKeyboardRef.current&&d.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:$e(t.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$e(t.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:$e(t.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),x=Vme[l.dir].includes(m.key);p&&x&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});aP.displayName=iP;function lP(t){return t?"open":"closed"}function ex(t){return t==="indeterminate"}function i3(t){return ex(t)?"indeterminate":t?"checked":"unchecked"}function dpe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function hpe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function fpe(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 l=hpe(t,Math.max(i,0));s.length===1&&(l=l.filter(h=>h!==n));const d=l.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function mpe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function ppe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return mpe(n,e)}function Hf(t){return e=>e.pointerType==="mouse"?t(e):void 0}var gpe=Fz,xpe=Z5,vpe=$z,ype=Hz,bpe=n3,wpe=Uz,Spe=Kx,kpe=Wz,Ope=Xz,jpe=Kz,Npe=Jz,Cpe=eP,Tpe=tP,Ape=rP,Mpe=sP,Epe=aP,a3="ContextMenu",[_pe]=Vi(a3,[Lz]),ls=Lz(),[Dpe,oP]=_pe(a3),cP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[l,c]=S.useState(!1),d=ls(e),h=es(r),m=S.useCallback(p=>{c(p),h(p)},[h]);return a.jsx(Dpe,{scope:e,open:l,onOpenChange:m,modal:i,children:a.jsx(gpe,{...d,dir:s,open:l,onOpenChange:m,modal:i,children:n})})};cP.displayName=a3;var uP="ContextMenuTrigger",dP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=oP(uP,n),l=ls(n),c=S.useRef({x:0,y:0}),d=S.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),h=S.useRef(0),m=S.useCallback(()=>window.clearTimeout(h.current),[]),p=x=>{c.current={x:x.clientX,y:x.clientY},i.onOpenChange(!0)};return S.useEffect(()=>m,[m]),S.useEffect(()=>void(r&&m()),[r,m]),a.jsxs(a.Fragment,{children:[a.jsx(xpe,{...l,virtualRef:d}),a.jsx(Zt.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:$e(t.onContextMenu,x=>{m(),p(x),x.preventDefault()}),onPointerDown:r?t.onPointerDown:$e(t.onPointerDown,Fp(x=>{m(),h.current=window.setTimeout(()=>p(x),700)})),onPointerMove:r?t.onPointerMove:$e(t.onPointerMove,Fp(m)),onPointerCancel:r?t.onPointerCancel:$e(t.onPointerCancel,Fp(m)),onPointerUp:r?t.onPointerUp:$e(t.onPointerUp,Fp(m))})]})});dP.displayName=uP;var Rpe="ContextMenuPortal",hP=t=>{const{__scopeContextMenu:e,...n}=t,r=ls(e);return a.jsx(vpe,{...r,...n})};hP.displayName=Rpe;var fP="ContextMenuContent",mP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=oP(fP,n),i=ls(n),l=S.useRef(!1);return a.jsx(ype,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{t.onCloseAutoFocus?.(c),!c.defaultPrevented&&l.current&&c.preventDefault(),l.current=!1},onInteractOutside:c=>{t.onInteractOutside?.(c),!c.defaultPrevented&&!s.modal&&(l.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)"}})});mP.displayName=fP;var zpe="ContextMenuGroup",Ppe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(bpe,{...s,...r,ref:e})});Ppe.displayName=zpe;var Bpe="ContextMenuLabel",pP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(wpe,{...s,...r,ref:e})});pP.displayName=Bpe;var Lpe="ContextMenuItem",gP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Spe,{...s,...r,ref:e})});gP.displayName=Lpe;var Ipe="ContextMenuCheckboxItem",xP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(kpe,{...s,...r,ref:e})});xP.displayName=Ipe;var qpe="ContextMenuRadioGroup",Fpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Ope,{...s,...r,ref:e})});Fpe.displayName=qpe;var Qpe="ContextMenuRadioItem",vP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(jpe,{...s,...r,ref:e})});vP.displayName=Qpe;var $pe="ContextMenuItemIndicator",yP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Npe,{...s,...r,ref:e})});yP.displayName=$pe;var Hpe="ContextMenuSeparator",bP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Cpe,{...s,...r,ref:e})});bP.displayName=Hpe;var Upe="ContextMenuArrow",Vpe=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Tpe,{...s,...r,ref:e})});Vpe.displayName=Upe;var wP="ContextMenuSub",SP=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,l=ls(e),[c,d]=ko({prop:s,defaultProp:i??!1,onChange:r,caller:wP});return a.jsx(Ape,{...l,open:c,onOpenChange:d,children:n})};SP.displayName=wP;var Wpe="ContextMenuSubTrigger",kP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Mpe,{...s,...r,ref:e})});kP.displayName=Wpe;var Gpe="ContextMenuSubContent",OP=S.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=ls(n);return a.jsx(Epe,{...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)"}})});OP.displayName=Gpe;function Fp(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var Xpe=cP,Ype=dP,Kpe=hP,jP=mP,NP=pP,CP=gP,TP=xP,AP=vP,MP=yP,EP=bP,Zpe=SP,_P=kP,DP=OP;const Jpe=Xpe,ege=Ype,tge=Zpe,RP=S.forwardRef(({className:t,inset:e,children:n,...r},s)=>a.jsxs(_P,{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,a.jsx(Ac,{className:"ml-auto h-4 w-4"})]}));RP.displayName=_P.displayName;const zP=S.forwardRef(({className:t,...e},n)=>a.jsx(DP,{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}));zP.displayName=DP.displayName;const PP=S.forwardRef(({className:t,...e},n)=>a.jsx(Kpe,{children:a.jsx(jP,{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})}));PP.displayName=jP.displayName;const Bi=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(CP,{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}));Bi.displayName=CP.displayName;const nge=S.forwardRef(({className:t,children:e,checked:n,...r},s)=>a.jsxs(TP,{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:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(MP,{children:a.jsx(hc,{className:"h-4 w-4"})})}),e]}));nge.displayName=TP.displayName;const rge=S.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(AP,{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:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(MP,{children:a.jsx(Aq,{className:"h-2 w-2 fill-current"})})}),e]}));rge.displayName=AP.displayName;const sge=S.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(NP,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));sge.displayName=NP.displayName;const Xh=S.forwardRef(({className:t,...e},n)=>a.jsx(EP,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Xh.displayName=EP.displayName;const qu=({className:t,...e})=>a.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});qu.displayName="ContextMenuShortcut";var ige=Symbol("radix.slottable");function age(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=ige,e}var[Zx]=Vi("Tooltip",[wd]),Jx=wd(),BP="TooltipProvider",lge=700,P4="tooltip.open",[oge,l3]=Zx(BP),LP=t=>{const{__scopeTooltip:e,delayDuration:n=lge,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,l=S.useRef(!0),c=S.useRef(!1),d=S.useRef(0);return S.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),a.jsx(oge,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:S.useCallback(h=>{c.current=h},[]),disableHoverableContent:s,children:i})};LP.displayName=BP;var Uf="Tooltip",[cge,E0]=Zx(Uf),IP=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:l,delayDuration:c}=t,d=l3(Uf,t.__scopeTooltip),h=Jx(e),[m,p]=S.useState(null),x=ji(),v=S.useRef(0),b=l??d.disableHoverableContent,k=c??d.delayDuration,O=S.useRef(!1),[j,T]=ko({prop:r,defaultProp:s??!1,onChange:z=>{z?(d.onOpen(),document.dispatchEvent(new CustomEvent(P4))):d.onClose(),i?.(z)},caller:Uf}),A=S.useMemo(()=>j?O.current?"delayed-open":"instant-open":"closed",[j]),_=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,O.current=!1,T(!0)},[T]),D=S.useCallback(()=>{window.clearTimeout(v.current),v.current=0,T(!1)},[T]),E=S.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{O.current=!0,T(!0),v.current=0},k)},[k,T]);return S.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),a.jsx(ix,{...h,children:a.jsx(cge,{scope:e,contentId:x,open:j,stateAttribute:A,trigger:m,onTriggerChange:p,onTriggerEnter:S.useCallback(()=>{d.isOpenDelayedRef.current?E():_()},[d.isOpenDelayedRef,E,_]),onTriggerLeave:S.useCallback(()=>{b?D():(window.clearTimeout(v.current),v.current=0)},[D,b]),onOpen:_,onClose:D,disableHoverableContent:b,children:n})})};IP.displayName=Uf;var B4="TooltipTrigger",qP=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=E0(B4,n),i=l3(B4,n),l=Jx(n),c=S.useRef(null),d=Cn(e,c,s.onTriggerChange),h=S.useRef(!1),m=S.useRef(!1),p=S.useCallback(()=>h.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(ax,{asChild:!0,...l,children:a.jsx(Zt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:d,onPointerMove:$e(t.onPointerMove,x=>{x.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:$e(t.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:$e(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:$e(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:$e(t.onBlur,s.onClose),onClick:$e(t.onClick,s.onClose)})})});qP.displayName=B4;var o3="TooltipPortal",[uge,dge]=Zx(o3,{forceMount:void 0}),FP=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=E0(o3,e);return a.jsx(uge,{scope:e,forceMount:n,children:a.jsx(Ls,{present:n||i.open,children:a.jsx(sx,{asChild:!0,container:s,children:r})})})};FP.displayName=o3;var bd="TooltipContent",QP=S.forwardRef((t,e)=>{const n=dge(bd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,l=E0(bd,t.__scopeTooltip);return a.jsx(Ls,{present:r||l.open,children:l.disableHoverableContent?a.jsx($P,{side:s,...i,ref:e}):a.jsx(hge,{side:s,...i,ref:e})})}),hge=S.forwardRef((t,e)=>{const n=E0(bd,t.__scopeTooltip),r=l3(bd,t.__scopeTooltip),s=S.useRef(null),i=Cn(e,s),[l,c]=S.useState(null),{trigger:d,onClose:h}=n,m=s.current,{onPointerInTransitChange:p}=r,x=S.useCallback(()=>{c(null),p(!1)},[p]),v=S.useCallback((b,k)=>{const O=b.currentTarget,j={x:b.clientX,y:b.clientY},T=xge(j,O.getBoundingClientRect()),A=vge(j,T),_=yge(k.getBoundingClientRect()),D=wge([...A,..._]);c(D),p(!0)},[p]);return S.useEffect(()=>()=>x(),[x]),S.useEffect(()=>{if(d&&m){const b=O=>v(O,m),k=O=>v(O,d);return d.addEventListener("pointerleave",b),m.addEventListener("pointerleave",k),()=>{d.removeEventListener("pointerleave",b),m.removeEventListener("pointerleave",k)}}},[d,m,v,x]),S.useEffect(()=>{if(l){const b=k=>{const O=k.target,j={x:k.clientX,y:k.clientY},T=d?.contains(O)||m?.contains(O),A=!bge(j,l);T?x():A&&(x(),h())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[d,m,l,h,x]),a.jsx($P,{...t,ref:i})}),[fge,mge]=Zx(Uf,{isInside:!1}),pge=age("TooltipContent"),$P=S.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:l,...c}=t,d=E0(bd,n),h=Jx(n),{onClose:m}=d;return S.useEffect(()=>(document.addEventListener(P4,m),()=>document.removeEventListener(P4,m)),[m]),S.useEffect(()=>{if(d.trigger){const p=x=>{x.target?.contains(d.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,m]),a.jsx(G4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:a.jsxs(X4,{"data-state":d.stateAttribute,...h,...c,ref:e,style:{...c.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:[a.jsx(pge,{children:r}),a.jsx(fge,{scope:n,isInside:!0,children:a.jsx(sq,{id:d.contentId,role:"tooltip",children:s||r})})]})})});QP.displayName=bd;var HP="TooltipArrow",gge=S.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Jx(n);return mge(HP,n).isInside?null:a.jsx(Y4,{...s,...r,ref:e})});gge.displayName=HP;function xge(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 vge(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 yge(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 bge(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,l=e.length-1;ir!=x>r&&n<(p-h)*(r-m)/(x-m)+h&&(s=!s)}return s}function wge(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Sge(e)}function Sge(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],l=e[e.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.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],l=n[n.length-2];if((i.x-l.x)*(s.y-l.y)>=(i.y-l.y)*(s.x-l.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 kge=LP,Oge=IP,jge=qP,Nge=FP,UP=QP;const Cge=kge,Tge=Oge,Age=jge,VP=S.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(Nge,{children:a.jsx(UP,{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})}));VP.displayName=UP.displayName;function Mge({children:t}){CH();const[e,n]=S.useState(!0),[r,s]=S.useState(!1),[i,l]=S.useState(!1),{theme:c,setTheme:d}=dw(),h=AI(),m=wa();S.useEffect(()=>{const k=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),l(!0))};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[]);const p=[{title:"概览",items:[{icon:hg,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:ao,label:"麦麦主程序配置",path:"/config/bot"},{icon:z9,label:"麦麦模型提供商配置",path:"/config/modelProvider"},{icon:P9,label:"麦麦模型配置",path:"/config/model"},{icon:hO,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:K4,label:"表情包管理",path:"/resource/emoji"},{icon:Wf,label:"表达方式管理",path:"/resource/expression"},{icon:B9,label:"人物信息管理",path:"/resource/person"}]},{title:"扩展与监控",items:[{icon:pg,label:"插件市场",path:"/plugins"},{icon:hO,label:"插件配置",path:"/plugin-config"},{icon:fg,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:Ii,label:"系统设置",path:"/settings"}]}],v=c==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c,b=()=>{localStorage.removeItem("access-token"),m({to:"/auth"})};return a.jsx(Cge,{delayDuration:300,children:a.jsxs("div",{className:"flex h-screen overflow-hidden",children:[a.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:[a.jsx("div",{className:"flex h-16 items-center border-b px-4",children:a.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:[a.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[a.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),a.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:rH()})]}),!e&&a.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),a.jsx(mn,{className:"flex-1",children:a.jsx("nav",{className:"p-4",children:a.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3"),children:p.map((k,O)=>a.jsxs("li",{children:[a.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:k.title})}),!e&&O>0&&a.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),a.jsx("ul",{className:"space-y-1",children:k.items.map(j=>{const T=h({to:j.path}),A=j.icon,_=a.jsxs(a.Fragment,{children:[T&&a.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"}),a.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"lg:gap-0"),children:[a.jsx(A,{className:ye("h-5 w-5 flex-shrink-0",T&&"text-primary"),strokeWidth:2,fill:"none"}),a.jsx("span",{className:ye("text-sm font-medium whitespace-nowrap transition-all duration-300",T&&"font-semibold",e?"opacity-100 max-w-[200px]":"lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:j.label})]})]});return a.jsx("li",{className:"relative",children:a.jsxs(Tge,{children:[a.jsx(Age,{asChild:!0,children:a.jsx(MI,{to:j.path,className:ye("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",T?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"lg:px-0 lg:justify-center"),onClick:()=>s(!1),children:_})}),!e&&a.jsx(VP,{side:"right",className:"hidden lg:block",children:a.jsx("p",{children:j.label})})]})},j.path)})})]},k.title))})})})]}),r&&a.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),a.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[a.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:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:a.jsx(Mq,{className:"h-5 w-5"})}),a.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:a.jsx(Tc,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>l(!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:[a.jsx(Bs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),a.jsxs(Pz,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[a.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),a.jsx(Pme,{open:i,onOpenChange:l}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[a.jsx(Eq,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),a.jsx("button",{onClick:k=>{Q$(v==="dark"?"light":"dark",d,k)},className:"rounded-lg p-2 hover:bg-accent",title:v==="dark"?"切换到浅色模式":"切换到深色模式",children:v==="dark"?a.jsx(Zb,{className:"h-5 w-5"}):a.jsx(Jb,{className:"h-5 w-5"})}),a.jsx("div",{className:"h-6 w-px bg-border"}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",title:"登出系统",children:[a.jsx(fO,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),a.jsxs(Jpe,{children:[a.jsx(ege,{asChild:!0,children:a.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),a.jsxs(PP,{className:"w-64",children:[a.jsxs(Bi,{onClick:()=>m({to:"/"}),children:[a.jsx(hg,{className:"mr-2 h-4 w-4"}),"首页"]}),a.jsxs(Bi,{onClick:()=>m({to:"/settings"}),children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"系统设置"]}),a.jsxs(Bi,{onClick:()=>m({to:"/logs"}),children:[a.jsx(fg,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),a.jsx(Xh,{}),a.jsxs(tge,{children:[a.jsxs(RP,{children:[a.jsx(_9,{className:"mr-2 h-4 w-4"}),"切换主题"]}),a.jsxs(zP,{className:"w-48",children:[a.jsxs(Bi,{onClick:()=>d("light"),disabled:c==="light",children:[a.jsx(Zb,{className:"mr-2 h-4 w-4"}),"浅色",c==="light"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("dark"),disabled:c==="dark",children:[a.jsx(Jb,{className:"mr-2 h-4 w-4"}),"深色",c==="dark"&&a.jsx(qu,{children:"✓"})]}),a.jsxs(Bi,{onClick:()=>d("system"),disabled:c==="system",children:[a.jsx(Ii,{className:"mr-2 h-4 w-4"}),"跟随系统",c==="system"&&a.jsx(qu,{children:"✓"})]})]})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.location.reload(),children:[a.jsx(_q,{className:"mr-2 h-4 w-4"}),"刷新页面",a.jsx(qu,{children:"⌘R"})]}),a.jsxs(Bi,{onClick:()=>l(!0),children:[a.jsx(Bs,{className:"mr-2 h-4 w-4"}),"搜索",a.jsx(qu,{children:"⌘K"})]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[a.jsx(Yh,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),a.jsx(Xh,{}),a.jsxs(Bi,{onClick:b,className:"text-destructive focus:text-destructive",children:[a.jsx(fO,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const _0=EI({component:()=>a.jsxs(a.Fragment,{children:[a.jsx(c9,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!qT())throw DI({to:"/auth"})}}),Ege=Xr({getParentRoute:()=>_0,path:"/auth",component:TH}),_ge=Xr({getParentRoute:()=>_0,path:"/setup",component:WH}),Qs=Xr({getParentRoute:()=>_0,id:"protected",component:()=>a.jsx(Mge,{children:a.jsx(c9,{})})}),Dge=Xr({getParentRoute:()=>Qs,path:"/",component:q$}),Rge=Xr({getParentRoute:()=>Qs,path:"/config/bot",component:Vee}),zge=Xr({getParentRoute:()=>Qs,path:"/config/modelProvider",component:ote}),Pge=Xr({getParentRoute:()=>Qs,path:"/config/model",component:Pte}),Bge=Xr({getParentRoute:()=>Qs,path:"/config/adapter",component:qte}),Lge=Xr({getParentRoute:()=>Qs,path:"/resource/emoji",component:ude}),Ige=Xr({getParentRoute:()=>Qs,path:"/resource/expression",component:bde}),qge=Xr({getParentRoute:()=>Qs,path:"/resource/person",component:Ede}),Fge=Xr({getParentRoute:()=>Qs,path:"/logs",component:hme}),Qge=Xr({getParentRoute:()=>Qs,path:"/plugins",component:Eme}),$ge=Xr({getParentRoute:()=>Qs,path:"/plugin-config",component:_me}),Hge=Xr({getParentRoute:()=>Qs,path:"/plugin-mirrors",component:Dme}),Uge=Xr({getParentRoute:()=>Qs,path:"/settings",component:bH}),Vge=Xr({getParentRoute:()=>_0,path:"*",component:$T}),Wge=_0.addChildren([Ege,_ge,Qs.addChildren([Dge,Rge,zge,Pge,Bge,Lge,Ige,qge,Qge,$ge,Hge,Fge,Uge]),Vge]),Gge=_I({routeTree:Wge,defaultNotFoundComponent:$T});function Xge({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=S.useState(()=>localStorage.getItem(n)||e);S.useEffect(()=>{const c=window.document.documentElement;if(c.classList.remove("light","dark"),s==="system"){const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";c.classList.add(d);return}c.classList.add(s)},[s]),S.useEffect(()=>{const c=localStorage.getItem("accent-color");if(c){const d=document.documentElement,m={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%)"}}[c];m&&(d.style.setProperty("--primary",m.hsl),m.gradient?(d.style.setProperty("--primary-gradient",m.gradient),d.classList.add("has-gradient")):(d.style.removeProperty("--primary-gradient"),d.classList.remove("has-gradient")))}},[]);const l={theme:s,setTheme:c=>{localStorage.setItem(n,c),i(c)}};return a.jsx(uT.Provider,{...r,value:l,children:t})}function Yge({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,l]=S.useState(()=>{const m=localStorage.getItem(r);return m!==null?m==="true":e}),[c,d]=S.useState(()=>{const m=localStorage.getItem(s);return m!==null?m==="true":n});S.useEffect(()=>{const m=document.documentElement;i?m.classList.remove("no-animations"):m.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),S.useEffect(()=>{localStorage.setItem(s,String(c))},[c,s]);const h={enableAnimations:i,setEnableAnimations:l,enableWavesBackground:c,setEnableWavesBackground:d};return a.jsx(dT.Provider,{value:h,children:t})}var c3="ToastProvider",[u3,Kge,Zge]=tx("Toast"),[WP]=Vi("Toast",[Zge]),[Jge,e1]=WP(c3),GP=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:l}=t,[c,d]=S.useState(null),[h,m]=S.useState(0),p=S.useRef(!1),x=S.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${c3}\`. Expected non-empty \`string\`.`),a.jsx(u3.Provider,{scope:e,children:a.jsx(Jge,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:c,onViewportChange:d,onToastAdd:S.useCallback(()=>m(v=>v+1),[]),onToastRemove:S.useCallback(()=>m(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:x,children:l})})};GP.displayName=c3;var XP="ToastViewport",exe=["F8"],L4="toast.viewportPause",I4="toast.viewportResume",YP=S.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=exe,label:s="Notifications ({hotkey})",...i}=t,l=e1(XP,n),c=Kge(n),d=S.useRef(null),h=S.useRef(null),m=S.useRef(null),p=S.useRef(null),x=Cn(e,p,l.onViewportChange),v=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=l.toastCount>0;S.useEffect(()=>{const O=j=>{r.length!==0&&r.every(A=>j[A]||j.code===A)&&p.current?.focus()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[r]),S.useEffect(()=>{const O=d.current,j=p.current;if(b&&O&&j){const T=()=>{if(!l.isClosePausedRef.current){const E=new CustomEvent(L4);j.dispatchEvent(E),l.isClosePausedRef.current=!0}},A=()=>{if(l.isClosePausedRef.current){const E=new CustomEvent(I4);j.dispatchEvent(E),l.isClosePausedRef.current=!1}},_=E=>{!O.contains(E.relatedTarget)&&A()},D=()=>{O.contains(document.activeElement)||A()};return O.addEventListener("focusin",T),O.addEventListener("focusout",_),O.addEventListener("pointermove",T),O.addEventListener("pointerleave",D),window.addEventListener("blur",T),window.addEventListener("focus",A),()=>{O.removeEventListener("focusin",T),O.removeEventListener("focusout",_),O.removeEventListener("pointermove",T),O.removeEventListener("pointerleave",D),window.removeEventListener("blur",T),window.removeEventListener("focus",A)}}},[b,l.isClosePausedRef]);const k=S.useCallback(({tabbingDirection:O})=>{const T=c().map(A=>{const _=A.ref.current,D=[_,...fxe(_)];return O==="forwards"?D:D.reverse()});return(O==="forwards"?T.reverse():T).flat()},[c]);return S.useEffect(()=>{const O=p.current;if(O){const j=T=>{const A=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!A){const D=document.activeElement,E=T.shiftKey;if(T.target===O&&E){h.current?.focus();return}const F=k({tabbingDirection:E?"backwards":"forwards"}),L=F.findIndex(U=>U===D);Gb(F.slice(L+1))?T.preventDefault():E?h.current?.focus():m.current?.focus()}};return O.addEventListener("keydown",j),()=>O.removeEventListener("keydown",j)}},[c,k]),a.jsxs(iq,{ref:d,role:"region","aria-label":s.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&a.jsx(q4,{ref:h,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"forwards"});Gb(O)}}),a.jsx(u3.Slot,{scope:n,children:a.jsx(Zt.ol,{tabIndex:-1,...i,ref:x})}),b&&a.jsx(q4,{ref:m,onFocusFromOutsideViewport:()=>{const O=k({tabbingDirection:"backwards"});Gb(O)}})]})});YP.displayName=XP;var KP="ToastFocusProxy",q4=S.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=e1(KP,n);return a.jsx(E9,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:l=>{const c=l.relatedTarget;!i.viewport?.contains(c)&&r()}})});q4.displayName=KP;var D0="Toast",txe="toast.swipeStart",nxe="toast.swipeMove",rxe="toast.swipeCancel",sxe="toast.swipeEnd",ZP=S.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...l}=t,[c,d]=ko({prop:r,defaultProp:s??!0,onChange:i,caller:D0});return a.jsx(Ls,{present:n||c,children:a.jsx(lxe,{open:c,...l,ref:e,onClose:()=>d(!1),onPause:es(t.onPause),onResume:es(t.onResume),onSwipeStart:$e(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:$e(t.onSwipeMove,h=>{const{x:m,y:p}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:$e(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:$e(t.onSwipeEnd,h=>{const{x:m,y:p}=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",`${m}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),d(!1)})})})});ZP.displayName=D0;var[ixe,axe]=WP(D0,{onClose(){}}),lxe=S.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:l,onEscapeKeyDown:c,onPause:d,onResume:h,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:x,onSwipeEnd:v,...b}=t,k=e1(D0,n),[O,j]=S.useState(null),T=Cn(e,W=>j(W)),A=S.useRef(null),_=S.useRef(null),D=s||k.duration,E=S.useRef(0),z=S.useRef(D),Q=S.useRef(0),{onToastAdd:F,onToastRemove:L}=k,U=es(()=>{O?.contains(document.activeElement)&&k.viewport?.focus(),l()}),V=S.useCallback(W=>{!W||W===1/0||(window.clearTimeout(Q.current),E.current=new Date().getTime(),Q.current=window.setTimeout(U,W))},[U]);S.useEffect(()=>{const W=k.viewport;if(W){const J=()=>{V(z.current),h?.()},$=()=>{const ae=new Date().getTime()-E.current;z.current=z.current-ae,window.clearTimeout(Q.current),d?.()};return W.addEventListener(L4,$),W.addEventListener(I4,J),()=>{W.removeEventListener(L4,$),W.removeEventListener(I4,J)}}},[k.viewport,D,d,h,V]),S.useEffect(()=>{i&&!k.isClosePausedRef.current&&V(D)},[i,D,k.isClosePausedRef,V]),S.useEffect(()=>(F(),()=>L()),[F,L]);const ce=S.useMemo(()=>O?iB(O):null,[O]);return k.viewport?a.jsxs(a.Fragment,{children:[ce&&a.jsx(oxe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:ce}),a.jsx(ixe,{scope:n,onClose:U,children:RI.createPortal(a.jsx(u3.ItemSlot,{scope:n,children:a.jsx(aq,{asChild:!0,onEscapeKeyDown:$e(c,()=>{k.isFocusedToastEscapeKeyDownRef.current||U(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(Zt.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":k.swipeDirection,...b,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:$e(t.onKeyDown,W=>{W.key==="Escape"&&(c?.(W.nativeEvent),W.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,U()))}),onPointerDown:$e(t.onPointerDown,W=>{W.button===0&&(A.current={x:W.clientX,y:W.clientY})}),onPointerMove:$e(t.onPointerMove,W=>{if(!A.current)return;const J=W.clientX-A.current.x,$=W.clientY-A.current.y,ae=!!_.current,ne=["left","right"].includes(k.swipeDirection),ue=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,R=ne?ue(0,J):0,me=ne?0:ue(0,$),Y=W.pointerType==="touch"?10:2,P={x:R,y:me},K={originalEvent:W,delta:P};ae?(_.current=P,Qp(nxe,p,K,{discrete:!1})):o9(P,k.swipeDirection,Y)?(_.current=P,Qp(txe,m,K,{discrete:!1}),W.target.setPointerCapture(W.pointerId)):(Math.abs(J)>Y||Math.abs($)>Y)&&(A.current=null)}),onPointerUp:$e(t.onPointerUp,W=>{const J=_.current,$=W.target;if($.hasPointerCapture(W.pointerId)&&$.releasePointerCapture(W.pointerId),_.current=null,A.current=null,J){const ae=W.currentTarget,ne={originalEvent:W,delta:J};o9(J,k.swipeDirection,k.swipeThreshold)?Qp(sxe,v,ne,{discrete:!0}):Qp(rxe,x,ne,{discrete:!0}),ae.addEventListener("click",ue=>ue.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),oxe=t=>{const{__scopeToast:e,children:n,...r}=t,s=e1(D0,e),[i,l]=S.useState(!1),[c,d]=S.useState(!1);return dxe(()=>l(!0)),S.useEffect(()=>{const h=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(h)},[]),c?null:a.jsx(sx,{asChild:!0,children:a.jsx(E9,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},cxe="ToastTitle",JP=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});JP.displayName=cxe;var uxe="ToastDescription",eB=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Zt.div,{...r,ref:e})});eB.displayName=uxe;var tB="ToastAction",nB=S.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?a.jsx(sB,{altText:n,asChild:!0,children:a.jsx(d3,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${tB}\`. Expected non-empty \`string\`.`),null)});nB.displayName=tB;var rB="ToastClose",d3=S.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=axe(rB,n);return a.jsx(sB,{asChild:!0,children:a.jsx(Zt.button,{type:"button",...r,ref:e,onClick:$e(t.onClick,s.onClose)})})});d3.displayName=rB;var sB=S.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return a.jsx(Zt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function iB(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),hxe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const l=r.dataset.radixToastAnnounceAlt;l&&e.push(l)}else e.push(...iB(r))}}),e}function Qp(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?M9(s,i):s.dispatchEvent(i)}var o9=(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 dxe(t=()=>{}){const e=es(t);h9(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function hxe(t){return t.nodeType===t.ELEMENT_NODE}function fxe(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 Gb(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var mxe=GP,aB=YP,lB=ZP,oB=JP,cB=eB,uB=nB,dB=d3;const pxe=mxe,hB=S.forwardRef(({className:t,...e},n)=>a.jsx(aB,{ref:n,className:ye("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));hB.displayName=aB.displayName;const gxe=Nd("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-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),fB=S.forwardRef(({className:t,variant:e,...n},r)=>a.jsx(lB,{ref:r,className:ye(gxe({variant:e}),t),...n}));fB.displayName=lB.displayName;const xxe=S.forwardRef(({className:t,...e},n)=>a.jsx(uB,{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}));xxe.displayName=uB.displayName;const mB=S.forwardRef(({className:t,...e},n)=>a.jsx(dB,{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:a.jsx(Gf,{className:"h-4 w-4"})}));mB.displayName=dB.displayName;const pB=S.forwardRef(({className:t,...e},n)=>a.jsx(oB,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));pB.displayName=oB.displayName;const gB=S.forwardRef(({className:t,...e},n)=>a.jsx(cB,{ref:n,className:ye("text-sm opacity-90",t),...e}));gB.displayName=cB.displayName;function vxe(){const{toasts:t}=Pr();return a.jsxs(pxe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return a.jsxs(fB,{...i,children:[a.jsxs("div",{className:"grid gap-1",children:[n&&a.jsx(pB,{children:n}),r&&a.jsx(gB,{children:r})]}),s,a.jsx(mB,{})]},e)}),a.jsx(hB,{})]})}Bq.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(Xge,{defaultTheme:"system",children:a.jsxs(Yge,{children:[a.jsx(zI,{router:Gge}),a.jsx(vxe,{})]})})})); diff --git a/webui/dist/index.html b/webui/dist/index.html index e0bd7ed3..dad21f82 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -5,7 +5,7 @@ MaiBot Dashboard - +