diff --git a/webui/dist/assets/icons-CqUsKJFR.js b/webui/dist/assets/icons-CqUsKJFR.js new file mode 100644 index 00000000..f4df2379 --- /dev/null +++ b/webui/dist/assets/icons-CqUsKJFR.js @@ -0,0 +1 @@ +import{r as s}from"./router-DQNkr8RI.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},k=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),m=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var v={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const x=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:y="",children:n,iconNode:r,...h},p)=>s.createElement("svg",{ref:p,...v,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:k("lucide",y),...!n&&!m(h)&&{"aria-hidden":"true"},...h},[...r.map(([i,l])=>s.createElement(i,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=s.forwardRef(({className:o,...y},n)=>s.createElement(x,{ref:n,iconNode:a,className:k(`lucide-${_(d(t))}`,`lucide-${t}`,o),...y}));return c.displayName=d(t),c};const f=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],n2=e("activity",f);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],s2=e("arrow-left",u);const g=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],y2=e("arrow-right",g);const $=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],h2=e("ban",$);const N=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],d2=e("book-open",N);const w=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],k2=e("bot",w);const z=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],r2=e("boxes",z);const b=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],p2=e("bug",b);const q=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],i2=e("calendar",q);const j=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],l2=e("chart-column",j);const C=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_2=e("check",C);const V=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],M2=e("chevron-down",V);const A=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],m2=e("chevron-left",A);const L=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],v2=e("chevron-right",L);const H=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],x2=e("chevron-up",H);const S=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],f2=e("chevrons-left",S);const P=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],u2=e("chevrons-right",P);const U=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],g2=e("chevrons-up-down",U);const T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],$2=e("circle-alert",T);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],N2=e("circle-check",Z);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],w2=e("circle-question-mark",B);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],z2=e("circle-user",R);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],b2=e("circle-x",E);const D=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],q2=e("circle",D);const O=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],j2=e("clock",O);const F=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],C2=e("code-xml",F);const W=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],V2=e("container",W);const I=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],A2=e("copy",I);const G=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],L2=e("database",G);const K=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],H2=e("dollar-sign",K);const X=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],S2=e("download",X);const Q=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],P2=e("external-link",Q);const J=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],U2=e("eye-off",J);const Y=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],T2=e("eye",Y);const e1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],Z2=e("file-search",e1);const a1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],B2=e("file-text",a1);const t1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],R2=e("folder-open",t1);const c1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],E2=e("funnel",c1);const o1=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],D2=e("graduation-cap",o1);const n1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],O2=e("grip-vertical",n1);const s1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],F2=e("hash",s1);const y1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],W2=e("house",y1);const h1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],I2=e("info",h1);const d1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],G2=e("key",d1);const k1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],K2=e("loader-circle",k1);const r1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],X2=e("lock",r1);const p1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Q2=e("log-out",p1);const i1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],J2=e("menu",i1);const l1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Y2=e("message-square",l1);const _1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],e0=e("moon",_1);const M1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],a0=e("network",M1);const m1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],t0=e("package",m1);const v1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],c0=e("palette",v1);const x1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],o0=e("panels-top-left",x1);const f1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],n0=e("pause",f1);const u1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],s0=e("pen",u1);const g1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],y0=e("pencil",g1);const $1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],h0=e("play",$1);const N1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],d0=e("plus",N1);const w1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],k0=e("power",w1);const z1=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],r0=e("puzzle",z1);const b1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],p0=e("refresh-cw",b1);const q1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],i0=e("rotate-ccw",q1);const j1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],l0=e("rotate-cw",j1);const C1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],_0=e("save",C1);const V1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],M0=e("search",V1);const A1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],m0=e("send",A1);const L1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],v0=e("server",L1);const H1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],x0=e("settings-2",H1);const S1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],f0=e("settings",S1);const P1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],u0=e("shield",P1);const U1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],g0=e("skip-forward",U1);const T1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],$0=e("sliders-vertical",T1);const Z1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],N0=e("smile",Z1);const B1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],w0=e("sparkles",B1);const R1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],z0=e("square-pen",R1);const E1=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],b0=e("star",E1);const D1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],q0=e("sun",D1);const O1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],j0=e("terminal",O1);const F1=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],C0=e("thumbs-up",F1);const W1=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],V0=e("thumbs-down",W1);const I1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],A0=e("trash-2",I1);const G1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],L0=e("trending-up",G1);const K1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],H0=e("triangle-alert",K1);const X1=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],S0=e("type",X1);const Q1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],P0=e("upload",Q1);const J1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],U0=e("user",J1);const Y1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],T0=e("users",Y1);const e2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Z0=e("wifi-off",e2);const a2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],B0=e("wifi",a2);const t2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],R0=e("x",t2);const c2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],E0=e("zap",c2);export{v2 as $,n2 as A,k2 as B,N2 as C,H2 as D,U2 as E,B2 as F,o0 as G,W2 as H,I2 as I,C2 as J,G2 as K,X2 as L,Y2 as M,_0 as N,d0 as O,k0 as P,A0 as Q,p0 as R,f0 as S,L0 as T,U0 as U,Z2 as V,y0 as W,R0 as X,f2 as Y,E0 as Z,m2 as _,$2 as a,u2 as a0,g2 as a1,O2 as a2,D2 as a3,V2 as a4,t0 as a5,P0 as a6,R2 as a7,S2 as a8,E2 as a9,l0 as aA,p2 as aB,z0 as aa,h2 as ab,F2 as ac,T0 as ad,a0 as ae,i2 as af,n0 as ag,h0 as ah,S0 as ai,b0 as aj,C0 as ak,V0 as al,x0 as am,B0 as an,Z0 as ao,s0 as ap,m0 as aq,v0 as ar,r2 as as,z2 as at,l2 as au,q2 as av,$0 as aw,J2 as ax,d2 as ay,Q2 as az,i0 as b,r0 as c,L2 as d,j2 as e,c0 as f,u0 as g,H0 as h,_2 as i,A2 as j,T2 as k,b2 as l,q0 as m,e0 as n,w2 as o,j0 as p,P2 as q,K2 as r,w0 as s,N0 as t,g0 as u,y2 as v,M0 as w,s2 as x,M2 as y,x2 as z}; diff --git a/webui/dist/assets/icons-wa0wi-vG.js b/webui/dist/assets/icons-wa0wi-vG.js deleted file mode 100644 index 9add2cce..00000000 --- a/webui/dist/assets/icons-wa0wi-vG.js +++ /dev/null @@ -1 +0,0 @@ -import{r as s}from"./router-DQNkr8RI.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},k=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),m=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var v={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const x=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:y="",children:n,iconNode:r,...h},p)=>s.createElement("svg",{ref:p,...v,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:k("lucide",y),...!n&&!m(h)&&{"aria-hidden":"true"},...h},[...r.map(([i,l])=>s.createElement(i,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=s.forwardRef(({className:o,...y},n)=>s.createElement(x,{ref:n,iconNode:a,className:k(`lucide-${_(d(t))}`,`lucide-${t}`,o),...y}));return c.displayName=d(t),c};const f=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],o2=e("activity",f);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],n2=e("arrow-left",u);const g=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],s2=e("arrow-right",g);const $=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],y2=e("ban",$);const N=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],h2=e("book-open",N);const w=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],d2=e("bot",w);const z=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],k2=e("boxes",z);const b=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],r2=e("bug",b);const q=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],p2=e("calendar",q);const j=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],i2=e("chart-column",j);const C=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],l2=e("check",C);const V=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_2=e("chevron-down",V);const A=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],M2=e("chevron-left",A);const H=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],m2=e("chevron-right",H);const L=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],v2=e("chevron-up",L);const S=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],x2=e("chevrons-left",S);const P=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],f2=e("chevrons-right",P);const U=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],u2=e("chevrons-up-down",U);const T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],g2=e("circle-alert",T);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$2=e("circle-check",Z);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],N2=e("circle-question-mark",R);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],w2=e("circle-user",B);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],z2=e("circle-x",E);const D=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],b2=e("circle",D);const O=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],q2=e("clock",O);const F=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],j2=e("code-xml",F);const W=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],C2=e("container",W);const I=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],V2=e("copy",I);const G=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],A2=e("database",G);const K=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],H2=e("dollar-sign",K);const X=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],L2=e("download",X);const Q=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],S2=e("external-link",Q);const J=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],P2=e("eye-off",J);const Y=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],U2=e("eye",Y);const e1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],T2=e("file-search",e1);const a1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Z2=e("file-text",a1);const t1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],R2=e("folder-open",t1);const c1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],B2=e("funnel",c1);const o1=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],E2=e("graduation-cap",o1);const n1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],D2=e("grip-vertical",n1);const s1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],O2=e("hash",s1);const y1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],F2=e("house",y1);const h1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],W2=e("info",h1);const d1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],I2=e("key",d1);const k1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],G2=e("loader-circle",k1);const r1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],K2=e("lock",r1);const p1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],X2=e("log-out",p1);const i1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Q2=e("menu",i1);const l1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],J2=e("message-square",l1);const _1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Y2=e("moon",_1);const M1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],e0=e("network",M1);const m1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],a0=e("package",m1);const v1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],t0=e("palette",v1);const x1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],c0=e("panels-top-left",x1);const f1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],o0=e("pause",f1);const u1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],n0=e("pen",u1);const g1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],s0=e("pencil",g1);const $1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],y0=e("play",$1);const N1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],h0=e("plus",N1);const w1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],d0=e("power",w1);const z1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],k0=e("refresh-cw",z1);const b1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],r0=e("rotate-ccw",b1);const q1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],p0=e("rotate-cw",q1);const j1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],i0=e("save",j1);const C1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],l0=e("search",C1);const V1=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],_0=e("send",V1);const A1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],M0=e("server",A1);const H1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],m0=e("settings-2",H1);const L1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],v0=e("settings",L1);const S1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],x0=e("shield",S1);const P1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],f0=e("skip-forward",P1);const U1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],u0=e("sliders-vertical",U1);const T1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],g0=e("smile",T1);const Z1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],$0=e("sparkles",Z1);const R1=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],N0=e("square-pen",R1);const B1=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],w0=e("star",B1);const E1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],z0=e("sun",E1);const D1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],b0=e("terminal",D1);const O1=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],q0=e("thumbs-up",O1);const F1=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],j0=e("thumbs-down",F1);const W1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],C0=e("trash-2",W1);const I1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],V0=e("trending-up",I1);const G1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],A0=e("triangle-alert",G1);const K1=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],H0=e("type",K1);const X1=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],L0=e("upload",X1);const Q1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],S0=e("user",Q1);const J1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],P0=e("users",J1);const Y1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],U0=e("wifi-off",Y1);const e2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],T0=e("wifi",e2);const a2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Z0=e("x",a2);const t2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],R0=e("zap",t2);export{f2 as $,o2 as A,d2 as B,q2 as C,H2 as D,P2 as E,Z2 as F,i0 as G,F2 as H,W2 as I,d0 as J,I2 as K,K2 as L,J2 as M,h0 as N,C0 as O,t0 as P,T2 as Q,k0 as R,x0 as S,V0 as T,S0 as U,s0 as V,x2 as W,Z0 as X,M2 as Y,R0 as Z,m2 as _,A2 as a,u2 as a0,D2 as a1,E2 as a2,C2 as a3,a0 as a4,L0 as a5,R2 as a6,L2 as a7,B2 as a8,N0 as a9,r2 as aA,y2 as aa,O2 as ab,P0 as ac,e0 as ad,p2 as ae,o0 as af,y0 as ag,H0 as ah,w0 as ai,q0 as aj,j0 as ak,m0 as al,T0 as am,U0 as an,n0 as ao,_0 as ap,M0 as aq,k2 as ar,w2 as as,i2 as at,b2 as au,u0 as av,Q2 as aw,h2 as ax,X2 as ay,p0 as az,v0 as b,A0 as c,l2 as d,V2 as e,U2 as f,$2 as g,z2 as h,r0 as i,z0 as j,Y2 as k,g2 as l,N2 as m,b0 as n,S2 as o,G2 as p,$0 as q,g0 as r,f0 as s,s2 as t,l0 as u,n2 as v,_2 as w,v2 as x,c0 as y,j2 as z}; diff --git a/webui/dist/assets/index-JgAL2W8G.js b/webui/dist/assets/index-CnFGj4Iv.js similarity index 53% rename from webui/dist/assets/index-JgAL2W8G.js rename to webui/dist/assets/index-CnFGj4Iv.js index dadd1eea..e6aa6582 100644 --- a/webui/dist/assets/index-JgAL2W8G.js +++ b/webui/dist/assets/index-CnFGj4Iv.js @@ -1,65 +1,65 @@ -import{r as b,j as o,u as Zi,R as ae,c as J1,b as pa,d as pJ,e as gJ,f as xJ,L as vJ,g as yJ,h as ms,k as bJ,l as wJ,O as Bz,m as SJ}from"./router-DQNkr8RI.js";import{a as kJ,b as OJ,g as gd}from"./react-vendor-Dtc2IqVY.js";import{c as Fz,R as jJ,T as NJ,L as CJ,a as TJ,C as Ux,X as Wx,Y as Dm,b as EJ,B as v4,d as Gx,P as _J,e as AJ,f as MJ,_ as RJ,g as DJ,h as Ge,i as PJ,j as x9,k as zJ,l as v9,m as IJ,n as LJ,o as BJ,r as qz,p as FJ,q as pj,s as $z,t as xd,u as gj,v as qJ,w as $J,x as Hz,y as Qz,z as Vz,A as xj,D as vj,E as yj,F as HJ,G as QJ,H as VJ,I as UJ,J as WJ,K as GJ,M as XJ,N as bj,O as Iy,Q as YJ,S as KJ,U as wj,V as ZJ,W as JJ,Z as Uz,$ as Wz,a0 as Gz,a1 as Xz,a2 as Ly,a3 as Yz,a4 as Kz,a5 as eee,a6 as tee,a7 as nee,a8 as ree,a9 as see,aa as iee,ab as aee,ac as oee,ad as Zz,ae as Jz,af as lee,ag as cee,ah as uee,ai as dee,aj as hee,ak as fee,al as mee,am as pee,an as gee,ao as xee,ap as vee,aq as yee,ar as bee,as as wee,at as See,au as kee}from"./charts-Cdq_Jxe7.js";import{c as Ra,a as By,u as Ui,P as xn,b as nt,d as Yn,e as Ep,f as Xl,g as Rs,h as ii,i as Uh,j as Sj,k as Fy,S as Oee,l as eI,m as tI,R as nI,O as qy,n as kj,C as $y,o as Hy,T as Oj,D as jj,p as Nj,q as rI,r as sI,W as jee,s as iI,I as Nee,t as aI,v as oI,w as Cee,x as lI,V as Tee,L as cI,y as uI,z as Eee,A as _ee,B as dI,E as Aee,F as Mee,G as Qc,H as Qy,J as vf,K as hI,M as fI,N as mI,Q as pI,U as Cj,X as Tj,Y as Vy,Z as Uy,_ as Ej,$ as gI,a0 as Ree,a1 as xI,a2 as Dee,a3 as Pee,a4 as vI,a5 as zee}from"./ui-vendor-BgfqR_Xz.js";import{R as Ps,A as Iee,D as Lee,a as ek,Z as tk,C as _h,M as Wh,T as Bee,X as _p,P as yI,S as Fee,b as Xu,I as Oa,c as Wa,d as Ro,e as Mv,E as Rv,f as Ea,g as Vc,h as qee,i as $ee,j as nk,k as rk,L as y9,K as bI,l as Uc,m as Wy,n as Hee,F as zl,o as Ah,p as Po,q as Qee,B as a0,U as Dv,r as _j,s as Vee,t as Uee,u as Ni,H as D0,v as wI,w as nd,x as P0,y as Wee,z as Gee,G as Gy,J as Aj,N as Ls,O as Sn,Q as Pv,V as Yu,W as Ap,Y as vd,_ as yd,$ as Mp,a0 as Mj,a1 as Xee,a2 as Yee,a3 as Kee,a4 as Gh,a5 as b9,a6 as Zee,a7 as Ku,a8 as sk,a9 as z0,aa as Jee,ab as ik,ac as ete,ad as SI,ae as w9,af as tte,ag as nte,ah as rte,ai as Ac,aj as y4,ak as S9,al as ste,am as ite,an as ate,ao as ote,ap as lte,aq as kI,ar as OI,as as jI,at as cte,au as ute,av as k9,aw as dte,ax as hte,ay as O9,az as fte,aA as mte}from"./icons-wa0wi-vG.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var b4={exports:{}},Pm={},w4={exports:{}},S4={};var j9;function pte(){return j9||(j9=1,(function(t){function e(F,Y){var J=F.length;F.push(Y);e:for(;0>>1,R=F[X];if(0>>1;Xs(I,J))Vs(ee,I)?(F[X]=ee,F[V]=J,X=V):(F[X]=I,F[G]=J,X=G);else if(Vs(ee,J))F[X]=ee,F[V]=J,X=V;else break e}}return Y}function s(F,Y){var J=F.sortIndex-Y.sortIndex;return J!==0?J:F.id-Y.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var c=[],d=[],h=1,m=null,g=3,x=!1,y=!1,w=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function T(F){for(var Y=n(d);Y!==null;){if(Y.callback===null)r(d);else if(Y.startTime<=F)r(d),Y.sortIndex=Y.expirationTime,e(c,Y);else break;Y=n(d)}}function E(F){if(w=!1,T(F),!y)if(n(c)!==null)y=!0,_||(_=!0,U());else{var Y=n(d);Y!==null&&Q(E,Y.startTime-F)}}var _=!1,A=-1,L=5,P=-1;function B(){return S?!0:!(t.unstable_now()-PF&&B());){var X=m.callback;if(typeof X=="function"){m.callback=null,g=m.priorityLevel;var R=X(m.expirationTime<=F);if(F=t.unstable_now(),typeof R=="function"){m.callback=R,T(F),Y=!0;break t}m===n(c)&&r(c),T(F)}else r(c);m=n(c)}if(m!==null)Y=!0;else{var ie=n(d);ie!==null&&Q(E,ie.startTime-F),Y=!1}}break e}finally{m=null,g=J,x=!1}Y=void 0}}finally{Y?U():_=!1}}}var U;if(typeof N=="function")U=function(){N($)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,z=te.port2;te.port1.onmessage=$,U=function(){z.postMessage(null)}}else U=function(){k($,0)};function Q(F,Y){A=k(function(){F(t.unstable_now())},Y)}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(F){F.callback=null},t.unstable_forceFrameRate=function(F){0>F||125X?(F.sortIndex=J,e(d,F),n(c)===null&&F===n(d)&&(w?(j(A),A=-1):w=!0,Q(E,J-X))):(F.sortIndex=R,e(c,F),y||x||(y=!0,_||(_=!0,U()))),F},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(F){var Y=g;return function(){var J=g;g=Y;try{return F.apply(this,arguments)}finally{g=J}}}})(S4)),S4}var N9;function gte(){return N9||(N9=1,w4.exports=pte()),w4.exports}var C9;function xte(){if(C9)return Pm;C9=1;var t=gte(),e=kJ(),n=OJ();function r(u){var f="https://react.dev/errors/"+u;if(1R||(u.current=X[R],X[R]=null,R--)}function I(u,f){R++,X[R]=u.current,u.current=f}var V=ie(null),ee=ie(null),ne=ie(null),W=ie(null);function se(u,f){switch(I(ne,f),I(ee,u),I(V,null),f.nodeType){case 9:case 11:u=(u=f.documentElement)&&(u=u.namespaceURI)?FT(u):0;break;default:if(u=f.tagName,f=f.namespaceURI)f=FT(f),u=qT(f,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}G(V),I(V,u)}function re(){G(V),G(ee),G(ne)}function oe(u){u.memoizedState!==null&&I(W,u);var f=V.current,p=qT(f,u.type);f!==p&&(I(ee,u),I(V,p))}function Te(u){ee.current===u&&(G(V),G(ee)),W.current===u&&(G(W),_m._currentValue=J)}var We,Ye;function Je(u){if(We===void 0)try{throw Error()}catch(p){var f=p.stack.trim().match(/\n( *(at )?)/);We=f&&f[1]||"",Ye=-1{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var O4={exports:{}},zm={},j4={exports:{}},N4={};var A9;function xte(){return A9||(A9=1,(function(t){function e(L,$){var K=L.length;L.push($);e:for(;0>>1,R=L[Y];if(0>>1;Ys(z,K))Us(te,z)?(L[Y]=te,L[U]=K,Y=U):(L[Y]=z,L[X]=K,Y=X);else if(Us(te,K))L[Y]=te,L[U]=K,Y=U;else break e}}return $}function s(L,$){var K=L.sortIndex-$.sortIndex;return K!==0?K:L.id-$.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var c=[],d=[],h=1,m=null,g=3,x=!1,y=!1,w=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function T(L){for(var $=n(d);$!==null;){if($.callback===null)r(d);else if($.startTime<=L)r(d),$.sortIndex=$.expirationTime,e(c,$);else break;$=n(d)}}function E(L){if(w=!1,T(L),!y)if(n(c)!==null)y=!0,_||(_=!0,W());else{var $=n(d);$!==null&&V(E,$.startTime-L)}}var _=!1,A=-1,D=5,q=-1;function B(){return S?!0:!(t.unstable_now()-qL&&B());){var Y=m.callback;if(typeof Y=="function"){m.callback=null,g=m.priorityLevel;var R=Y(m.expirationTime<=L);if(L=t.unstable_now(),typeof R=="function"){m.callback=R,T(L),$=!0;break t}m===n(c)&&r(c),T(L)}else r(c);m=n(c)}if(m!==null)$=!0;else{var ie=n(d);ie!==null&&V(E,ie.startTime-L),$=!1}}break e}finally{m=null,g=K,x=!1}$=void 0}}finally{$?W():_=!1}}}var W;if(typeof N=="function")W=function(){N(H)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,I=ee.port2;ee.port1.onmessage=H,W=function(){I.postMessage(null)}}else W=function(){k(H,0)};function V(L,$){A=k(function(){L(t.unstable_now())},$)}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(L){L.callback=null},t.unstable_forceFrameRate=function(L){0>L||125Y?(L.sortIndex=K,e(d,L),n(c)===null&&L===n(d)&&(w?(j(A),A=-1):w=!0,V(E,K-Y))):(L.sortIndex=R,e(c,L),y||x||(y=!0,_||(_=!0,W()))),L},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(L){var $=g;return function(){var K=g;g=$;try{return L.apply(this,arguments)}finally{g=K}}}})(N4)),N4}var M9;function vte(){return M9||(M9=1,j4.exports=xte()),j4.exports}var R9;function yte(){if(R9)return zm;R9=1;var t=vte(),e=NJ(),n=CJ();function r(u){var f="https://react.dev/errors/"+u;if(1R||(u.current=Y[R],Y[R]=null,R--)}function z(u,f){R++,Y[R]=u.current,u.current=f}var U=ie(null),te=ie(null),ne=ie(null),G=ie(null);function se(u,f){switch(z(ne,f),z(te,u),z(U,null),f.nodeType){case 9:case 11:u=(u=f.documentElement)&&(u=u.namespaceURI)?UT(u):0;break;default:if(u=f.tagName,f=f.namespaceURI)f=UT(f),u=WT(f,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}X(U),z(U,u)}function re(){X(U),X(te),X(ne)}function ae(u){u.memoizedState!==null&&z(G,u);var f=U.current,p=WT(f,u.type);f!==p&&(z(te,u),z(U,p))}function _e(u){te.current===u&&(X(U),X(te)),G.current===u&&(X(G),Am._currentValue=K)}var Be,Ye;function Je(u){if(Be===void 0)try{throw Error()}catch(p){var f=p.stack.trim().match(/\n( *(at )?)/);Be=f&&f[1]||"",Ye=-1)":-1O||ue[v]!==we[O]){var Ee=` -`+ue[v].replace(" at new "," at ");return u.displayName&&Ee.includes("")&&(Ee=Ee.replace("",u.displayName)),Ee}while(1<=v&&0<=O);break}}}finally{Oe=!1,Error.prepareStackTrace=p}return(p=u?u.displayName||u.name:"")?Je(p):""}function Ue(u,f){switch(u.tag){case 26:case 27:case 5:return Je(u.type);case 16:return Je("Lazy");case 13:return u.child!==f&&f!==null?Je("Suspense Fallback"):Je("Suspense");case 19:return Je("SuspenseList");case 0:case 15:return Ve(u.type,!1);case 11:return Ve(u.type.render,!1);case 1:return Ve(u.type,!0);case 31:return Je("Activity");default:return""}}function He(u){try{var f="",p=null;do f+=Ue(u,p),p=u,u=u.return;while(u);return f}catch(v){return` +`+Be+u+Ye}var Oe=!1;function Ve(u,f){if(!u||Oe)return"";Oe=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(f){var Re=function(){throw Error()};if(Object.defineProperty(Re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Re,[])}catch(Ce){var ke=Ce}Reflect.construct(u,[],Re)}else{try{Re.call()}catch(Ce){ke=Ce}u.call(Re.prototype)}}else{try{throw Error()}catch(Ce){ke=Ce}(Re=u())&&typeof Re.catch=="function"&&Re.catch(function(){})}}catch(Ce){if(Ce&&ke&&typeof Ce.stack=="string")return[Ce.stack,ke.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var O=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");O&&O.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var C=v.DetermineComponentFrameRoot(),F=C[0],Z=C[1];if(F&&Z){var de=F.split(` +`),Se=Z.split(` +`);for(O=v=0;vO||de[v]!==Se[O]){var Te=` +`+de[v].replace(" at new "," at ");return u.displayName&&Te.includes("")&&(Te=Te.replace("",u.displayName)),Te}while(1<=v&&0<=O);break}}}finally{Oe=!1,Error.prepareStackTrace=p}return(p=u?u.displayName||u.name:"")?Je(p):""}function Ue(u,f){switch(u.tag){case 26:case 27:case 5:return Je(u.type);case 16:return Je("Lazy");case 13:return u.child!==f&&f!==null?Je("Suspense Fallback"):Je("Suspense");case 19:return Je("SuspenseList");case 0:case 15:return Ve(u.type,!1);case 11:return Ve(u.type.render,!1);case 1:return Ve(u.type,!0);case 31:return Je("Activity");default:return""}}function $e(u){try{var f="",p=null;do f+=Ue(u,p),p=u,u=u.return;while(u);return f}catch(v){return` Error generating stack: `+v.message+` -`+v.stack}}var Ot=Object.prototype.hasOwnProperty,xt=t.unstable_scheduleCallback,kn=t.unstable_cancelCallback,It=t.unstable_shouldYield,Yt=t.unstable_requestPaint,_t=t.unstable_now,mt=t.unstable_getCurrentPriorityLevel,Ne=t.unstable_ImmediatePriority,Ie=t.unstable_UserBlockingPriority,st=t.unstable_NormalPriority,yt=t.unstable_LowPriority,Pt=t.unstable_IdlePriority,Mt=t.log,zn=t.unstable_setDisableYieldValue,Fe=null,rt=null;function tn(u){if(typeof Mt=="function"&&zn(u),rt&&typeof rt.setStrictMode=="function")try{rt.setStrictMode(Fe,u)}catch{}}var Rt=Math.clz32?Math.clz32:it,ke=Math.log,Pe=Math.LN2;function it(u){return u>>>=0,u===0?32:31-(ke(u)/Pe|0)|0}var ot=256,nn=262144,Kt=4194304;function pt(u){var f=u&42;if(f!==0)return f;switch(u&-u){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function xr(u,f,p){var v=u.pendingLanes;if(v===0)return 0;var O=0,C=u.suspendedLanes,q=u.pingedLanes;u=u.warmLanes;var K=v&134217727;return K!==0?(v=K&~C,v!==0?O=pt(v):(q&=K,q!==0?O=pt(q):p||(p=K&~u,p!==0&&(O=pt(p))))):(K=v&~C,K!==0?O=pt(K):q!==0?O=pt(q):p||(p=v&~u,p!==0&&(O=pt(p)))),O===0?0:f!==0&&f!==O&&(f&C)===0&&(C=O&-O,p=f&-f,C>=p||C===32&&(p&4194048)!==0)?f:O}function Ur(u,f){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&f)===0}function Wr(u,f){switch(u){case 1:case 2:case 4:case 8:case 64:return f+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 f+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 vr(){var u=Kt;return Kt<<=1,(Kt&62914560)===0&&(Kt=4194304),u}function In(u){for(var f=[],p=0;31>p;p++)f.push(u);return f}function cr(u,f){u.pendingLanes|=f,f!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function nr(u,f,p,v,O,C){var q=u.pendingLanes;u.pendingLanes=p,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=p,u.entangledLanes&=p,u.errorRecoveryDisabledLanes&=p,u.shellSuspendCounter=0;var K=u.entanglements,ue=u.expirationTimes,we=u.hiddenUpdates;for(p=q&~p;0"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var cK=/[\n"\\]/g;function ta(u){return u.replace(cK,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function hw(u,f,p,v,O,C,q,K){u.name="",q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"?u.type=q:u.removeAttribute("type"),f!=null?q==="number"?(f===0&&u.value===""||u.value!=f)&&(u.value=""+ea(f)):u.value!==""+ea(f)&&(u.value=""+ea(f)):q!=="submit"&&q!=="reset"||u.removeAttribute("value"),f!=null?fw(u,q,ea(f)):p!=null?fw(u,q,ea(p)):v!=null&&u.removeAttribute("value"),O==null&&C!=null&&(u.defaultChecked=!!C),O!=null&&(u.checked=O&&typeof O!="function"&&typeof O!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?u.name=""+ea(K):u.removeAttribute("name")}function D7(u,f,p,v,O,C,q,K){if(C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(u.type=C),f!=null||p!=null){if(!(C!=="submit"&&C!=="reset"||f!=null)){dw(u);return}p=p!=null?""+ea(p):"",f=f!=null?""+ea(f):p,K||f===u.value||(u.value=f),u.defaultValue=f}v=v??O,v=typeof v!="function"&&typeof v!="symbol"&&!!v,u.checked=K?u.checked:!!v,u.defaultChecked=!!v,q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"&&(u.name=q),dw(u)}function fw(u,f,p){f==="number"&&zg(u.ownerDocument)===u||u.defaultValue===""+p||(u.defaultValue=""+p)}function Nd(u,f,p,v){if(u=u.options,f){f={};for(var O=0;O"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vw=!1;if(tl)try{var Gf={};Object.defineProperty(Gf,"passive",{get:function(){vw=!0}}),window.addEventListener("test",Gf,Gf),window.removeEventListener("test",Gf,Gf)}catch{vw=!1}var nc=null,yw=null,Lg=null;function q7(){if(Lg)return Lg;var u,f=yw,p=f.length,v,O="value"in nc?nc.value:nc.textContent,C=O.length;for(u=0;u=Kf),W7=" ",G7=!1;function X7(u,f){switch(u){case"keyup":return IK.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Y7(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var _d=!1;function BK(u,f){switch(u){case"compositionend":return Y7(f);case"keypress":return f.which!==32?null:(G7=!0,W7);case"textInput":return u=f.data,u===W7&&G7?null:u;default:return null}}function FK(u,f){if(_d)return u==="compositionend"||!Ow&&X7(u,f)?(u=q7(),Lg=yw=nc=null,_d=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1=f)return{node:p,offset:f-u};u=v}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=sC(p)}}function aC(u,f){return u&&f?u===f?!0:u&&u.nodeType===3?!1:f&&f.nodeType===3?aC(u,f.parentNode):"contains"in u?u.contains(f):u.compareDocumentPosition?!!(u.compareDocumentPosition(f)&16):!1:!1}function oC(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var f=zg(u.document);f instanceof u.HTMLIFrameElement;){try{var p=typeof f.contentWindow.location.href=="string"}catch{p=!1}if(p)u=f.contentWindow;else break;f=zg(u.document)}return f}function Cw(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f&&(f==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||f==="textarea"||u.contentEditable==="true")}var GK=tl&&"documentMode"in document&&11>=document.documentMode,Ad=null,Tw=null,tm=null,Ew=!1;function lC(u,f,p){var v=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Ew||Ad==null||Ad!==zg(v)||(v=Ad,"selectionStart"in v&&Cw(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),tm&&em(tm,v)||(tm=v,v=Ax(Tw,"onSelect"),0>=q,O-=q,ao=1<<32-Rt(f)+O|p<Zt?(fn=vt,vt=null):fn=vt.sibling;var Bn=Se(pe,vt,ye[Zt],Ae);if(Bn===null){vt===null&&(vt=fn);break}u&&vt&&Bn.alternate===null&&f(pe,vt),fe=C(Bn,fe,Zt),Ln===null?Nt=Bn:Ln.sibling=Bn,Ln=Bn,vt=fn}if(Zt===ye.length)return p(pe,vt),yn&&rl(pe,Zt),Nt;if(vt===null){for(;ZtZt?(fn=vt,vt=null):fn=vt.sibling;var Oc=Se(pe,vt,Bn.value,Ae);if(Oc===null){vt===null&&(vt=fn);break}u&&vt&&Oc.alternate===null&&f(pe,vt),fe=C(Oc,fe,Zt),Ln===null?Nt=Oc:Ln.sibling=Oc,Ln=Oc,vt=fn}if(Bn.done)return p(pe,vt),yn&&rl(pe,Zt),Nt;if(vt===null){for(;!Bn.done;Zt++,Bn=ye.next())Bn=Re(pe,Bn.value,Ae),Bn!==null&&(fe=C(Bn,fe,Zt),Ln===null?Nt=Bn:Ln.sibling=Bn,Ln=Bn);return yn&&rl(pe,Zt),Nt}for(vt=v(vt);!Bn.done;Zt++,Bn=ye.next())Bn=Ce(vt,pe,Zt,Bn.value,Ae),Bn!==null&&(u&&Bn.alternate!==null&&vt.delete(Bn.key===null?Zt:Bn.key),fe=C(Bn,fe,Zt),Ln===null?Nt=Bn:Ln.sibling=Bn,Ln=Bn);return u&&vt.forEach(function(mJ){return f(pe,mJ)}),yn&&rl(pe,Zt),Nt}function Jn(pe,fe,ye,Ae){if(typeof ye=="object"&&ye!==null&&ye.type===w&&ye.key===null&&(ye=ye.props.children),typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case x:e:{for(var Nt=ye.key;fe!==null;){if(fe.key===Nt){if(Nt=ye.type,Nt===w){if(fe.tag===7){p(pe,fe.sibling),Ae=O(fe,ye.props.children),Ae.return=pe,pe=Ae;break e}}else if(fe.elementType===Nt||typeof Nt=="object"&&Nt!==null&&Nt.$$typeof===L&&ju(Nt)===fe.type){p(pe,fe.sibling),Ae=O(fe,ye.props),om(Ae,ye),Ae.return=pe,pe=Ae;break e}p(pe,fe);break}else f(pe,fe);fe=fe.sibling}ye.type===w?(Ae=bu(ye.props.children,pe.mode,Ae,ye.key),Ae.return=pe,pe=Ae):(Ae=Gg(ye.type,ye.key,ye.props,null,pe.mode,Ae),om(Ae,ye),Ae.return=pe,pe=Ae)}return q(pe);case y:e:{for(Nt=ye.key;fe!==null;){if(fe.key===Nt)if(fe.tag===4&&fe.stateNode.containerInfo===ye.containerInfo&&fe.stateNode.implementation===ye.implementation){p(pe,fe.sibling),Ae=O(fe,ye.children||[]),Ae.return=pe,pe=Ae;break e}else{p(pe,fe);break}else f(pe,fe);fe=fe.sibling}Ae=zw(ye,pe.mode,Ae),Ae.return=pe,pe=Ae}return q(pe);case L:return ye=ju(ye),Jn(pe,fe,ye,Ae)}if(Q(ye))return ut(pe,fe,ye,Ae);if(U(ye)){if(Nt=U(ye),typeof Nt!="function")throw Error(r(150));return ye=Nt.call(ye),At(pe,fe,ye,Ae)}if(typeof ye.then=="function")return Jn(pe,fe,tx(ye),Ae);if(ye.$$typeof===N)return Jn(pe,fe,Kg(pe,ye),Ae);nx(pe,ye)}return typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint"?(ye=""+ye,fe!==null&&fe.tag===6?(p(pe,fe.sibling),Ae=O(fe,ye),Ae.return=pe,pe=Ae):(p(pe,fe),Ae=Pw(ye,pe.mode,Ae),Ae.return=pe,pe=Ae),q(pe)):p(pe,fe)}return function(pe,fe,ye,Ae){try{am=0;var Nt=Jn(pe,fe,ye,Ae);return $d=null,Nt}catch(vt){if(vt===qd||vt===Jg)throw vt;var Ln=Mi(29,vt,null,pe.mode);return Ln.lanes=Ae,Ln.return=pe,Ln}finally{}}}var Cu=AC(!0),MC=AC(!1),oc=!1;function Gw(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xw(u,f){u=u.updateQueue,f.updateQueue===u&&(f.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function lc(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function cc(u,f,p){var v=u.updateQueue;if(v===null)return null;if(v=v.shared,(Hn&2)!==0){var O=v.pending;return O===null?f.next=f:(f.next=O.next,O.next=f),v.pending=f,f=Wg(u),pC(u,null,p),f}return Ug(u,v,f,p),Wg(u)}function lm(u,f,p){if(f=f.updateQueue,f!==null&&(f=f.shared,(p&4194048)!==0)){var v=f.lanes;v&=u.pendingLanes,p|=v,f.lanes=p,xs(u,p)}}function Yw(u,f){var p=u.updateQueue,v=u.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var O=null,C=null;if(p=p.firstBaseUpdate,p!==null){do{var q={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};C===null?O=C=q:C=C.next=q,p=p.next}while(p!==null);C===null?O=C=f:C=C.next=f}else O=C=f;p={baseState:v.baseState,firstBaseUpdate:O,lastBaseUpdate:C,shared:v.shared,callbacks:v.callbacks},u.updateQueue=p;return}u=p.lastBaseUpdate,u===null?p.firstBaseUpdate=f:u.next=f,p.lastBaseUpdate=f}var Kw=!1;function cm(){if(Kw){var u=Fd;if(u!==null)throw u}}function um(u,f,p,v){Kw=!1;var O=u.updateQueue;oc=!1;var C=O.firstBaseUpdate,q=O.lastBaseUpdate,K=O.shared.pending;if(K!==null){O.shared.pending=null;var ue=K,we=ue.next;ue.next=null,q===null?C=we:q.next=we,q=ue;var Ee=u.alternate;Ee!==null&&(Ee=Ee.updateQueue,K=Ee.lastBaseUpdate,K!==q&&(K===null?Ee.firstBaseUpdate=we:K.next=we,Ee.lastBaseUpdate=ue))}if(C!==null){var Re=O.baseState;q=0,Ee=we=ue=null,K=C;do{var Se=K.lane&-536870913,Ce=Se!==K.lane;if(Ce?(hn&Se)===Se:(v&Se)===Se){Se!==0&&Se===Bd&&(Kw=!0),Ee!==null&&(Ee=Ee.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var ut=u,At=K;Se=f;var Jn=p;switch(At.tag){case 1:if(ut=At.payload,typeof ut=="function"){Re=ut.call(Jn,Re,Se);break e}Re=ut;break e;case 3:ut.flags=ut.flags&-65537|128;case 0:if(ut=At.payload,Se=typeof ut=="function"?ut.call(Jn,Re,Se):ut,Se==null)break e;Re=m({},Re,Se);break e;case 2:oc=!0}}Se=K.callback,Se!==null&&(u.flags|=64,Ce&&(u.flags|=8192),Ce=O.callbacks,Ce===null?O.callbacks=[Se]:Ce.push(Se))}else Ce={lane:Se,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ee===null?(we=Ee=Ce,ue=Re):Ee=Ee.next=Ce,q|=Se;if(K=K.next,K===null){if(K=O.shared.pending,K===null)break;Ce=K,K=Ce.next,Ce.next=null,O.lastBaseUpdate=Ce,O.shared.pending=null}}while(!0);Ee===null&&(ue=Re),O.baseState=ue,O.firstBaseUpdate=we,O.lastBaseUpdate=Ee,C===null&&(O.shared.lanes=0),mc|=q,u.lanes=q,u.memoizedState=Re}}function RC(u,f){if(typeof u!="function")throw Error(r(191,u));u.call(f)}function DC(u,f){var p=u.callbacks;if(p!==null)for(u.callbacks=null,u=0;uC?C:8;var q=F.T,K={};F.T=K,g2(u,!1,f,p);try{var ue=O(),we=F.S;if(we!==null&&we(K,ue),ue!==null&&typeof ue=="object"&&typeof ue.then=="function"){var Ee=rZ(ue,v);fm(u,f,Ee,Ii(u))}else fm(u,f,v,Ii(u))}catch(Re){fm(u,f,{then:function(){},status:"rejected",reason:Re},Ii())}finally{Y.p=C,q!==null&&K.types!==null&&(q.types=K.types),F.T=q}}function cZ(){}function m2(u,f,p,v){if(u.tag!==5)throw Error(r(476));var O=h8(u).queue;d8(u,O,f,J,p===null?cZ:function(){return f8(u),p(v)})}function h8(u){var f=u.memoizedState;if(f!==null)return f;f={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:J},next:null};var p={};return f.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:p},next:null},u.memoizedState=f,u=u.alternate,u!==null&&(u.memoizedState=f),f}function f8(u){var f=h8(u);f.next===null&&(f=u.alternate.memoizedState),fm(u,f.next.queue,{},Ii())}function p2(){return Ts(_m)}function m8(){return $r().memoizedState}function p8(){return $r().memoizedState}function uZ(u){for(var f=u.return;f!==null;){switch(f.tag){case 24:case 3:var p=Ii();u=lc(p);var v=cc(f,u,p);v!==null&&(hi(v,f,p),lm(v,f,p)),f={cache:Qw()},u.payload=f;return}f=f.return}}function dZ(u,f,p){var v=Ii();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},hx(u)?x8(f,p):(p=Rw(u,f,p,v),p!==null&&(hi(p,u,v),v8(p,f,v)))}function g8(u,f,p){var v=Ii();fm(u,f,p,v)}function fm(u,f,p,v){var O={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(hx(u))x8(f,O);else{var C=u.alternate;if(u.lanes===0&&(C===null||C.lanes===0)&&(C=f.lastRenderedReducer,C!==null))try{var q=f.lastRenderedState,K=C(q,p);if(O.hasEagerState=!0,O.eagerState=K,Ai(K,q))return Ug(u,f,O,0),rr===null&&Vg(),!1}catch{}finally{}if(p=Rw(u,f,O,v),p!==null)return hi(p,u,v),v8(p,f,v),!0}return!1}function g2(u,f,p,v){if(v={lane:2,revertLane:G2(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},hx(u)){if(f)throw Error(r(479))}else f=Rw(u,p,v,2),f!==null&&hi(f,u,2)}function hx(u){var f=u.alternate;return u===Wt||f!==null&&f===Wt}function x8(u,f){Qd=ix=!0;var p=u.pending;p===null?f.next=f:(f.next=p.next,p.next=f),u.pending=f}function v8(u,f,p){if((p&4194048)!==0){var v=f.lanes;v&=u.pendingLanes,p|=v,f.lanes=p,xs(u,p)}}var mm={readContext:Ts,use:lx,useCallback:Pr,useContext:Pr,useEffect:Pr,useImperativeHandle:Pr,useLayoutEffect:Pr,useInsertionEffect:Pr,useMemo:Pr,useReducer:Pr,useRef:Pr,useState:Pr,useDebugValue:Pr,useDeferredValue:Pr,useTransition:Pr,useSyncExternalStore:Pr,useId:Pr,useHostTransitionStatus:Pr,useFormState:Pr,useActionState:Pr,useOptimistic:Pr,useMemoCache:Pr,useCacheRefresh:Pr};mm.useEffectEvent=Pr;var y8={readContext:Ts,use:lx,useCallback:function(u,f){return Ys().memoizedState=[u,f===void 0?null:f],u},useContext:Ts,useEffect:n8,useImperativeHandle:function(u,f,p){p=p!=null?p.concat([u]):null,ux(4194308,4,a8.bind(null,f,u),p)},useLayoutEffect:function(u,f){return ux(4194308,4,u,f)},useInsertionEffect:function(u,f){ux(4,2,u,f)},useMemo:function(u,f){var p=Ys();f=f===void 0?null:f;var v=u();if(Tu){tn(!0);try{u()}finally{tn(!1)}}return p.memoizedState=[v,f],v},useReducer:function(u,f,p){var v=Ys();if(p!==void 0){var O=p(f);if(Tu){tn(!0);try{p(f)}finally{tn(!1)}}}else O=f;return v.memoizedState=v.baseState=O,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:O},v.queue=u,u=u.dispatch=dZ.bind(null,Wt,u),[v.memoizedState,u]},useRef:function(u){var f=Ys();return u={current:u},f.memoizedState=u},useState:function(u){u=c2(u);var f=u.queue,p=g8.bind(null,Wt,f);return f.dispatch=p,[u.memoizedState,p]},useDebugValue:h2,useDeferredValue:function(u,f){var p=Ys();return f2(p,u,f)},useTransition:function(){var u=c2(!1);return u=d8.bind(null,Wt,u.queue,!0,!1),Ys().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,f,p){var v=Wt,O=Ys();if(yn){if(p===void 0)throw Error(r(407));p=p()}else{if(p=f(),rr===null)throw Error(r(349));(hn&127)!==0||FC(v,f,p)}O.memoizedState=p;var C={value:p,getSnapshot:f};return O.queue=C,n8($C.bind(null,v,C,u),[u]),v.flags|=2048,Ud(9,{destroy:void 0},qC.bind(null,v,C,p,f),null),p},useId:function(){var u=Ys(),f=rr.identifierPrefix;if(yn){var p=oo,v=ao;p=(v&~(1<<32-Rt(v)-1)).toString(32)+p,f="_"+f+"R_"+p,p=ax++,0<\/script>",C=C.removeChild(C.firstChild);break;case"select":C=typeof v.is=="string"?q.createElement("select",{is:v.is}):q.createElement("select"),v.multiple?C.multiple=!0:v.size&&(C.size=v.size);break;default:C=typeof v.is=="string"?q.createElement(O,{is:v.is}):q.createElement(O)}}C[Cr]=f,C[Tr]=v;e:for(q=f.child;q!==null;){if(q.tag===5||q.tag===6)C.appendChild(q.stateNode);else if(q.tag!==4&&q.tag!==27&&q.child!==null){q.child.return=q,q=q.child;continue}if(q===f)break e;for(;q.sibling===null;){if(q.return===null||q.return===f)break e;q=q.return}q.sibling.return=q.return,q=q.sibling}f.stateNode=C;e:switch(_s(C,O,v),O){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&cl(f)}}return mr(f),_2(f,f.type,u===null?null:u.memoizedProps,f.pendingProps,p),null;case 6:if(u&&f.stateNode!=null)u.memoizedProps!==v&&cl(f);else{if(typeof v!="string"&&f.stateNode===null)throw Error(r(166));if(u=ne.current,Id(f)){if(u=f.stateNode,p=f.memoizedProps,v=null,O=Cs,O!==null)switch(O.tag){case 27:case 5:v=O.memoizedProps}u[Cr]=f,u=!!(u.nodeValue===p||v!==null&&v.suppressHydrationWarning===!0||LT(u.nodeValue,p)),u||ic(f,!0)}else u=Mx(u).createTextNode(v),u[Cr]=f,f.stateNode=u}return mr(f),null;case 31:if(p=f.memoizedState,u===null||u.memoizedState!==null){if(v=Id(f),p!==null){if(u===null){if(!v)throw Error(r(318));if(u=f.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[Cr]=f}else wu(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;mr(f),u=!1}else p=Fw(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=p),u=!0;if(!u)return f.flags&256?(Di(f),f):(Di(f),null);if((f.flags&128)!==0)throw Error(r(558))}return mr(f),null;case 13:if(v=f.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(O=Id(f),v!==null&&v.dehydrated!==null){if(u===null){if(!O)throw Error(r(318));if(O=f.memoizedState,O=O!==null?O.dehydrated:null,!O)throw Error(r(317));O[Cr]=f}else wu(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;mr(f),O=!1}else O=Fw(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=O),O=!0;if(!O)return f.flags&256?(Di(f),f):(Di(f),null)}return Di(f),(f.flags&128)!==0?(f.lanes=p,f):(p=v!==null,u=u!==null&&u.memoizedState!==null,p&&(v=f.child,O=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(O=v.alternate.memoizedState.cachePool.pool),C=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(C=v.memoizedState.cachePool.pool),C!==O&&(v.flags|=2048)),p!==u&&p&&(f.child.flags|=8192),xx(f,f.updateQueue),mr(f),null);case 4:return re(),u===null&&Z2(f.stateNode.containerInfo),mr(f),null;case 10:return il(f.type),mr(f),null;case 19:if(G(qr),v=f.memoizedState,v===null)return mr(f),null;if(O=(f.flags&128)!==0,C=v.rendering,C===null)if(O)gm(v,!1);else{if(zr!==0||u!==null&&(u.flags&128)!==0)for(u=f.child;u!==null;){if(C=sx(u),C!==null){for(f.flags|=128,gm(v,!1),u=C.updateQueue,f.updateQueue=u,xx(f,u),f.subtreeFlags=0,u=p,p=f.child;p!==null;)gC(p,u),p=p.sibling;return I(qr,qr.current&1|2),yn&&rl(f,v.treeForkCount),f.child}u=u.sibling}v.tail!==null&&_t()>Sx&&(f.flags|=128,O=!0,gm(v,!1),f.lanes=4194304)}else{if(!O)if(u=sx(C),u!==null){if(f.flags|=128,O=!0,u=u.updateQueue,f.updateQueue=u,xx(f,u),gm(v,!0),v.tail===null&&v.tailMode==="hidden"&&!C.alternate&&!yn)return mr(f),null}else 2*_t()-v.renderingStartTime>Sx&&p!==536870912&&(f.flags|=128,O=!0,gm(v,!1),f.lanes=4194304);v.isBackwards?(C.sibling=f.child,f.child=C):(u=v.last,u!==null?u.sibling=C:f.child=C,v.last=C)}return v.tail!==null?(u=v.tail,v.rendering=u,v.tail=u.sibling,v.renderingStartTime=_t(),u.sibling=null,p=qr.current,I(qr,O?p&1|2:p&1),yn&&rl(f,v.treeForkCount),u):(mr(f),null);case 22:case 23:return Di(f),Jw(),v=f.memoizedState!==null,u!==null?u.memoizedState!==null!==v&&(f.flags|=8192):v&&(f.flags|=8192),v?(p&536870912)!==0&&(f.flags&128)===0&&(mr(f),f.subtreeFlags&6&&(f.flags|=8192)):mr(f),p=f.updateQueue,p!==null&&xx(f,p.retryQueue),p=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==p&&(f.flags|=2048),u!==null&&G(Ou),null;case 24:return p=null,u!==null&&(p=u.memoizedState.cache),f.memoizedState.cache!==p&&(f.flags|=2048),il(Xr),mr(f),null;case 25:return null;case 30:return null}throw Error(r(156,f.tag))}function gZ(u,f){switch(Lw(f),f.tag){case 1:return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return il(Xr),re(),u=f.flags,(u&65536)!==0&&(u&128)===0?(f.flags=u&-65537|128,f):null;case 26:case 27:case 5:return Te(f),null;case 31:if(f.memoizedState!==null){if(Di(f),f.alternate===null)throw Error(r(340));wu()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 13:if(Di(f),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(r(340));wu()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return G(qr),null;case 4:return re(),null;case 10:return il(f.type),null;case 22:case 23:return Di(f),Jw(),u!==null&&G(Ou),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 24:return il(Xr),null;case 25:return null;default:return null}}function H8(u,f){switch(Lw(f),f.tag){case 3:il(Xr),re();break;case 26:case 27:case 5:Te(f);break;case 4:re();break;case 31:f.memoizedState!==null&&Di(f);break;case 13:Di(f);break;case 19:G(qr);break;case 10:il(f.type);break;case 22:case 23:Di(f),Jw(),u!==null&&G(Ou);break;case 24:il(Xr)}}function xm(u,f){try{var p=f.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var O=v.next;p=O;do{if((p.tag&u)===u){v=void 0;var C=p.create,q=p.inst;v=C(),q.destroy=v}p=p.next}while(p!==O)}}catch(K){Un(f,f.return,K)}}function hc(u,f,p){try{var v=f.updateQueue,O=v!==null?v.lastEffect:null;if(O!==null){var C=O.next;v=C;do{if((v.tag&u)===u){var q=v.inst,K=q.destroy;if(K!==void 0){q.destroy=void 0,O=f;var ue=p,we=K;try{we()}catch(Ee){Un(O,ue,Ee)}}}v=v.next}while(v!==C)}}catch(Ee){Un(f,f.return,Ee)}}function Q8(u){var f=u.updateQueue;if(f!==null){var p=u.stateNode;try{DC(f,p)}catch(v){Un(u,u.return,v)}}}function V8(u,f,p){p.props=Eu(u.type,u.memoizedProps),p.state=u.memoizedState;try{p.componentWillUnmount()}catch(v){Un(u,f,v)}}function vm(u,f){try{var p=u.ref;if(p!==null){switch(u.tag){case 26:case 27:case 5:var v=u.stateNode;break;case 30:v=u.stateNode;break;default:v=u.stateNode}typeof p=="function"?u.refCleanup=p(v):p.current=v}}catch(O){Un(u,f,O)}}function lo(u,f){var p=u.ref,v=u.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(O){Un(u,f,O)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(O){Un(u,f,O)}else p.current=null}function U8(u){var f=u.type,p=u.memoizedProps,v=u.stateNode;try{e:switch(f){case"button":case"input":case"select":case"textarea":p.autoFocus&&v.focus();break e;case"img":p.src?v.src=p.src:p.srcSet&&(v.srcset=p.srcSet)}}catch(O){Un(u,u.return,O)}}function A2(u,f,p){try{var v=u.stateNode;LZ(v,u.type,p,f),v[Tr]=f}catch(O){Un(u,u.return,O)}}function W8(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&yc(u.type)||u.tag===4}function M2(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||W8(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&yc(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function R2(u,f,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,f?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(u,f):(f=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,f.appendChild(u),p=p._reactRootContainer,p!=null||f.onclick!==null||(f.onclick=el));else if(v!==4&&(v===27&&yc(u.type)&&(p=u.stateNode,f=null),u=u.child,u!==null))for(R2(u,f,p),u=u.sibling;u!==null;)R2(u,f,p),u=u.sibling}function vx(u,f,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,f?p.insertBefore(u,f):p.appendChild(u);else if(v!==4&&(v===27&&yc(u.type)&&(p=u.stateNode),u=u.child,u!==null))for(vx(u,f,p),u=u.sibling;u!==null;)vx(u,f,p),u=u.sibling}function G8(u){var f=u.stateNode,p=u.memoizedProps;try{for(var v=u.type,O=f.attributes;O.length;)f.removeAttributeNode(O[0]);_s(f,v,p),f[Cr]=u,f[Tr]=p}catch(C){Un(u,u.return,C)}}var ul=!1,Zr=!1,D2=!1,X8=typeof WeakSet=="function"?WeakSet:Set,vs=null;function xZ(u,f){if(u=u.containerInfo,t4=Bx,u=oC(u),Cw(u)){if("selectionStart"in u)var p={start:u.selectionStart,end:u.selectionEnd};else e:{p=(p=u.ownerDocument)&&p.defaultView||window;var v=p.getSelection&&p.getSelection();if(v&&v.rangeCount!==0){p=v.anchorNode;var O=v.anchorOffset,C=v.focusNode;v=v.focusOffset;try{p.nodeType,C.nodeType}catch{p=null;break e}var q=0,K=-1,ue=-1,we=0,Ee=0,Re=u,Se=null;t:for(;;){for(var Ce;Re!==p||O!==0&&Re.nodeType!==3||(K=q+O),Re!==C||v!==0&&Re.nodeType!==3||(ue=q+v),Re.nodeType===3&&(q+=Re.nodeValue.length),(Ce=Re.firstChild)!==null;)Se=Re,Re=Ce;for(;;){if(Re===u)break t;if(Se===p&&++we===O&&(K=q),Se===C&&++Ee===v&&(ue=q),(Ce=Re.nextSibling)!==null)break;Re=Se,Se=Re.parentNode}Re=Ce}p=K===-1||ue===-1?null:{start:K,end:ue}}else p=null}p=p||{start:0,end:0}}else p=null;for(n4={focusedElem:u,selectionRange:p},Bx=!1,vs=f;vs!==null;)if(f=vs,u=f.child,(f.subtreeFlags&1028)!==0&&u!==null)u.return=f,vs=u;else for(;vs!==null;){switch(f=vs,C=f.alternate,u=f.flags,f.tag){case 0:if((u&4)!==0&&(u=f.updateQueue,u=u!==null?u.events:null,u!==null))for(p=0;p title"))),_s(C,v,p),C[Cr]=u,Gr(C),v=C;break e;case"link":var q=t9("link","href",O).get(v+(p.href||""));if(q){for(var K=0;KJn&&(q=Jn,Jn=At,At=q);var pe=iC(K,At),fe=iC(K,Jn);if(pe&&fe&&(Ce.rangeCount!==1||Ce.anchorNode!==pe.node||Ce.anchorOffset!==pe.offset||Ce.focusNode!==fe.node||Ce.focusOffset!==fe.offset)){var ye=Re.createRange();ye.setStart(pe.node,pe.offset),Ce.removeAllRanges(),At>Jn?(Ce.addRange(ye),Ce.extend(fe.node,fe.offset)):(ye.setEnd(fe.node,fe.offset),Ce.addRange(ye))}}}}for(Re=[],Ce=K;Ce=Ce.parentNode;)Ce.nodeType===1&&Re.push({element:Ce,left:Ce.scrollLeft,top:Ce.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;Kp?32:p,F.T=null,p=q2,q2=null;var C=gc,q=pl;if(ls=0,Kd=gc=null,pl=0,(Hn&6)!==0)throw Error(r(331));var K=Hn;if(Hn|=4,aT(C.current),rT(C,C.current,q,p),Hn=K,Om(0,!1),rt&&typeof rt.onPostCommitFiberRoot=="function")try{rt.onPostCommitFiberRoot(Fe,C)}catch{}return!0}finally{Y.p=O,F.T=v,OT(u,f)}}function NT(u,f,p){f=ra(p,f),f=b2(u.stateNode,f,2),u=cc(u,f,2),u!==null&&(cr(u,2),co(u))}function Un(u,f,p){if(u.tag===3)NT(u,u,p);else for(;f!==null;){if(f.tag===3){NT(f,u,p);break}else if(f.tag===1){var v=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(pc===null||!pc.has(v))){u=ra(p,u),p=C8(2),v=cc(f,p,2),v!==null&&(T8(p,v,f,u),cr(v,2),co(v));break}}f=f.return}}function V2(u,f,p){var v=u.pingCache;if(v===null){v=u.pingCache=new bZ;var O=new Set;v.set(f,O)}else O=v.get(f),O===void 0&&(O=new Set,v.set(f,O));O.has(p)||(I2=!0,O.add(p),u=jZ.bind(null,u,f,p),f.then(u,u))}function jZ(u,f,p){var v=u.pingCache;v!==null&&v.delete(f),u.pingedLanes|=u.suspendedLanes&p,u.warmLanes&=~p,rr===u&&(hn&p)===p&&(zr===4||zr===3&&(hn&62914560)===hn&&300>_t()-wx?(Hn&2)===0&&Zd(u,0):L2|=p,Yd===hn&&(Yd=0)),co(u)}function CT(u,f){f===0&&(f=vr()),u=yu(u,f),u!==null&&(cr(u,f),co(u))}function NZ(u){var f=u.memoizedState,p=0;f!==null&&(p=f.retryLane),CT(u,p)}function CZ(u,f){var p=0;switch(u.tag){case 31:case 13:var v=u.stateNode,O=u.memoizedState;O!==null&&(p=O.retryLane);break;case 19:v=u.stateNode;break;case 22:v=u.stateNode._retryCache;break;default:throw Error(r(314))}v!==null&&v.delete(f),CT(u,p)}function TZ(u,f){return xt(u,f)}var Tx=null,eh=null,U2=!1,Ex=!1,W2=!1,vc=0;function co(u){u!==eh&&u.next===null&&(eh===null?Tx=eh=u:eh=eh.next=u),Ex=!0,U2||(U2=!0,_Z())}function Om(u,f){if(!W2&&Ex){W2=!0;do for(var p=!1,v=Tx;v!==null;){if(u!==0){var O=v.pendingLanes;if(O===0)var C=0;else{var q=v.suspendedLanes,K=v.pingedLanes;C=(1<<31-Rt(42|u)+1)-1,C&=O&~(q&~K),C=C&201326741?C&201326741|1:C?C|2:0}C!==0&&(p=!0,AT(v,C))}else C=hn,C=xr(v,v===rr?C:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(C&3)===0||Ur(v,C)||(p=!0,AT(v,C));v=v.next}while(p);W2=!1}}function EZ(){TT()}function TT(){Ex=U2=!1;var u=0;vc!==0&&FZ()&&(u=vc);for(var f=_t(),p=null,v=Tx;v!==null;){var O=v.next,C=ET(v,f);C===0?(v.next=null,p===null?Tx=O:p.next=O,O===null&&(eh=p)):(p=v,(u!==0||(C&3)!==0)&&(Ex=!0)),v=O}ls!==0&&ls!==5||Om(u),vc!==0&&(vc=0)}function ET(u,f){for(var p=u.suspendedLanes,v=u.pingedLanes,O=u.expirationTimes,C=u.pendingLanes&-62914561;0K)break;var Ee=ue.transferSize,Re=ue.initiatorType;Ee&&BT(Re)&&(ue=ue.responseEnd,q+=Ee*(ue"u"?null:document;function KT(u,f,p){var v=th;if(v&&typeof f=="string"&&f){var O=ta(f);O='link[rel="'+u+'"][href="'+O+'"]',typeof p=="string"&&(O+='[crossorigin="'+p+'"]'),YT.has(O)||(YT.add(O),u={rel:u,crossOrigin:p,href:f},v.querySelector(O)===null&&(f=v.createElement("link"),_s(f,"link",u),Gr(f),v.head.appendChild(f)))}}function XZ(u){gl.D(u),KT("dns-prefetch",u,null)}function YZ(u,f){gl.C(u,f),KT("preconnect",u,f)}function KZ(u,f,p){gl.L(u,f,p);var v=th;if(v&&u&&f){var O='link[rel="preload"][as="'+ta(f)+'"]';f==="image"&&p&&p.imageSrcSet?(O+='[imagesrcset="'+ta(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(O+='[imagesizes="'+ta(p.imageSizes)+'"]')):O+='[href="'+ta(u)+'"]';var C=O;switch(f){case"style":C=nh(u);break;case"script":C=rh(u)}ca.has(C)||(u=m({rel:"preload",href:f==="image"&&p&&p.imageSrcSet?void 0:u,as:f},p),ca.set(C,u),v.querySelector(O)!==null||f==="style"&&v.querySelector(Tm(C))||f==="script"&&v.querySelector(Em(C))||(f=v.createElement("link"),_s(f,"link",u),Gr(f),v.head.appendChild(f)))}}function ZZ(u,f){gl.m(u,f);var p=th;if(p&&u){var v=f&&typeof f.as=="string"?f.as:"script",O='link[rel="modulepreload"][as="'+ta(v)+'"][href="'+ta(u)+'"]',C=O;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":C=rh(u)}if(!ca.has(C)&&(u=m({rel:"modulepreload",href:u},f),ca.set(C,u),p.querySelector(O)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(Em(C)))return}v=p.createElement("link"),_s(v,"link",u),Gr(v),p.head.appendChild(v)}}}function JZ(u,f,p){gl.S(u,f,p);var v=th;if(v&&u){var O=tc(v).hoistableStyles,C=nh(u);f=f||"default";var q=O.get(C);if(!q){var K={loading:0,preload:null};if(q=v.querySelector(Tm(C)))K.loading=5;else{u=m({rel:"stylesheet",href:u,"data-precedence":f},p),(p=ca.get(C))&&c4(u,p);var ue=q=v.createElement("link");Gr(ue),_s(ue,"link",u),ue._p=new Promise(function(we,Ee){ue.onload=we,ue.onerror=Ee}),ue.addEventListener("load",function(){K.loading|=1}),ue.addEventListener("error",function(){K.loading|=2}),K.loading|=4,Dx(q,f,v)}q={type:"stylesheet",instance:q,count:1,state:K},O.set(C,q)}}}function eJ(u,f){gl.X(u,f);var p=th;if(p&&u){var v=tc(p).hoistableScripts,O=rh(u),C=v.get(O);C||(C=p.querySelector(Em(O)),C||(u=m({src:u,async:!0},f),(f=ca.get(O))&&u4(u,f),C=p.createElement("script"),Gr(C),_s(C,"link",u),p.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},v.set(O,C))}}function tJ(u,f){gl.M(u,f);var p=th;if(p&&u){var v=tc(p).hoistableScripts,O=rh(u),C=v.get(O);C||(C=p.querySelector(Em(O)),C||(u=m({src:u,async:!0,type:"module"},f),(f=ca.get(O))&&u4(u,f),C=p.createElement("script"),Gr(C),_s(C,"link",u),p.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},v.set(O,C))}}function ZT(u,f,p,v){var O=(O=ne.current)?Rx(O):null;if(!O)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(f=nh(p.href),p=tc(O).hoistableStyles,v=p.get(f),v||(v={type:"style",instance:null,count:0,state:null},p.set(f,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){u=nh(p.href);var C=tc(O).hoistableStyles,q=C.get(u);if(q||(O=O.ownerDocument||O,q={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},C.set(u,q),(C=O.querySelector(Tm(u)))&&!C._p&&(q.instance=C,q.state.loading=5),ca.has(u)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},ca.set(u,p),C||nJ(O,u,p,q.state))),f&&v===null)throw Error(r(528,""));return q}if(f&&v!==null)throw Error(r(529,""));return null;case"script":return f=p.async,p=p.src,typeof p=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?(f=rh(p),p=tc(O).hoistableScripts,v=p.get(f),v||(v={type:"script",instance:null,count:0,state:null},p.set(f,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,u))}}function nh(u){return'href="'+ta(u)+'"'}function Tm(u){return'link[rel="stylesheet"]['+u+"]"}function JT(u){return m({},u,{"data-precedence":u.precedence,precedence:null})}function nJ(u,f,p,v){u.querySelector('link[rel="preload"][as="style"]['+f+"]")?v.loading=1:(f=u.createElement("link"),v.preload=f,f.addEventListener("load",function(){return v.loading|=1}),f.addEventListener("error",function(){return v.loading|=2}),_s(f,"link",p),Gr(f),u.head.appendChild(f))}function rh(u){return'[src="'+ta(u)+'"]'}function Em(u){return"script[async]"+u}function e9(u,f,p){if(f.count++,f.instance===null)switch(f.type){case"style":var v=u.querySelector('style[data-href~="'+ta(p.href)+'"]');if(v)return f.instance=v,Gr(v),v;var O=m({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return v=(u.ownerDocument||u).createElement("style"),Gr(v),_s(v,"style",O),Dx(v,p.precedence,u),f.instance=v;case"stylesheet":O=nh(p.href);var C=u.querySelector(Tm(O));if(C)return f.state.loading|=4,f.instance=C,Gr(C),C;v=JT(p),(O=ca.get(O))&&c4(v,O),C=(u.ownerDocument||u).createElement("link"),Gr(C);var q=C;return q._p=new Promise(function(K,ue){q.onload=K,q.onerror=ue}),_s(C,"link",v),f.state.loading|=4,Dx(C,p.precedence,u),f.instance=C;case"script":return C=rh(p.src),(O=u.querySelector(Em(C)))?(f.instance=O,Gr(O),O):(v=p,(O=ca.get(C))&&(v=m({},p),u4(v,O)),u=u.ownerDocument||u,O=u.createElement("script"),Gr(O),_s(O,"link",v),u.head.appendChild(O),f.instance=O);case"void":return null;default:throw Error(r(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(v=f.instance,f.state.loading|=4,Dx(v,p.precedence,u));return f.instance}function Dx(u,f,p){for(var v=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),O=v.length?v[v.length-1]:null,C=O,q=0;q title"):null)}function rJ(u,f,p){if(p===1||f.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;switch(f.rel){case"stylesheet":return u=f.disabled,typeof f.precedence=="string"&&u==null;default:return!0}case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function r9(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function sJ(u,f,p,v){if(p.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var O=nh(v.href),C=f.querySelector(Tm(O));if(C){f=C._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(u.count++,u=zx.bind(u),f.then(u,u)),p.state.loading|=4,p.instance=C,Gr(C);return}C=f.ownerDocument||f,v=JT(v),(O=ca.get(O))&&c4(v,O),C=C.createElement("link"),Gr(C);var q=C;q._p=new Promise(function(K,ue){q.onload=K,q.onerror=ue}),_s(C,"link",v),p.instance=C}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(p,f),(f=p.state.preload)&&(p.state.loading&3)===0&&(u.count++,p=zx.bind(u),f.addEventListener("load",p),f.addEventListener("error",p))}}var d4=0;function iJ(u,f){return u.stylesheets&&u.count===0&&Lx(u,u.stylesheets),0d4?50:800)+f);return u.unsuspend=p,function(){u.unsuspend=null,clearTimeout(v),clearTimeout(O)}}:null}function zx(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lx(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var Ix=null;function Lx(u,f){u.stylesheets=null,u.unsuspend!==null&&(u.count++,Ix=new Map,f.forEach(aJ,u),Ix=null,zx.call(u))}function aJ(u,f){if(!(f.state.loading&4)){var p=Ix.get(u);if(p)var v=p.get(null);else{p=new Map,Ix.set(u,p);for(var O=u.querySelectorAll("link[data-precedence],style[data-precedence]"),C=0;C"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),b4.exports=xte(),b4.exports}var yte=vte();function NI(t,e){return function(){return t.apply(e,arguments)}}const{toString:bte}=Object.prototype,{getPrototypeOf:Rj}=Object,{iterator:Xy,toStringTag:CI}=Symbol,Yy=(t=>e=>{const n=bte.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),eo=t=>(t=t.toLowerCase(),e=>Yy(e)===t),Ky=t=>e=>typeof e===t,{isArray:yf}=Array,Xh=Ky("undefined");function Rp(t){return t!==null&&!Xh(t)&&t.constructor!==null&&!Xh(t.constructor)&&wi(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const TI=eo("ArrayBuffer");function wte(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&TI(t.buffer),e}const Ste=Ky("string"),wi=Ky("function"),EI=Ky("number"),Dp=t=>t!==null&&typeof t=="object",kte=t=>t===!0||t===!1,ev=t=>{if(Yy(t)!=="object")return!1;const e=Rj(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(CI in t)&&!(Xy in t)},Ote=t=>{if(!Dp(t)||Rp(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},jte=eo("Date"),Nte=eo("File"),Cte=eo("Blob"),Tte=eo("FileList"),Ete=t=>Dp(t)&&wi(t.pipe),_te=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||wi(t.append)&&((e=Yy(t))==="formdata"||e==="object"&&wi(t.toString)&&t.toString()==="[object FormData]"))},Ate=eo("URLSearchParams"),[Mte,Rte,Dte,Pte]=["ReadableStream","Request","Response","Headers"].map(eo),zte=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Pp(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),yf(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const $u=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,AI=t=>!Xh(t)&&t!==$u;function ak(){const{caseless:t,skipUndefined:e}=AI(this)&&this||{},n={},r=(s,i)=>{const a=t&&_I(n,i)||i;ev(n[a])&&ev(s)?n[a]=ak(n[a],s):ev(s)?n[a]=ak({},s):yf(s)?n[a]=s.slice():(!e||!Xh(s))&&(n[a]=s)};for(let s=0,i=arguments.length;s(Pp(e,(s,i)=>{n&&wi(s)?t[i]=NI(s,n):t[i]=s},{allOwnKeys:r}),t),Lte=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Bte=(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)},Fte=(t,e,n,r)=>{let s,i,a;const l={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)a=s[i],(!r||r(a,t,e))&&!l[a]&&(e[a]=t[a],l[a]=!0);t=n!==!1&&Rj(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},qte=(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},$te=t=>{if(!t)return null;if(yf(t))return t;let e=t.length;if(!EI(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Hte=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Rj(Uint8Array)),Qte=(t,e)=>{const r=(t&&t[Xy]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},Vte=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Ute=eo("HTMLFormElement"),Wte=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),E9=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Gte=eo("RegExp"),MI=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Pp(n,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(r[i]=a||s)}),Object.defineProperties(t,r)},Xte=t=>{MI(t,(e,n)=>{if(wi(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(wi(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+"'")})}})},Yte=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return yf(t)?r(t):r(String(t).split(e)),n},Kte=()=>{},Zte=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Jte(t){return!!(t&&wi(t.append)&&t[CI]==="FormData"&&t[Xy])}const ene=t=>{const e=new Array(10),n=(r,s)=>{if(Dp(r)){if(e.indexOf(r)>=0)return;if(Rp(r))return r;if(!("toJSON"in r)){e[s]=r;const i=yf(r)?[]:{};return Pp(r,(a,l)=>{const c=n(a,s+1);!Xh(c)&&(i[l]=c)}),e[s]=void 0,i}}return r};return n(t,0)},tne=eo("AsyncFunction"),nne=t=>t&&(Dp(t)||wi(t))&&wi(t.then)&&wi(t.catch),RI=((t,e)=>t?setImmediate:e?((n,r)=>($u.addEventListener("message",({source:s,data:i})=>{s===$u&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),$u.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",wi($u.postMessage)),rne=typeof queueMicrotask<"u"?queueMicrotask.bind($u):typeof process<"u"&&process.nextTick||RI,sne=t=>t!=null&&wi(t[Xy]),je={isArray:yf,isArrayBuffer:TI,isBuffer:Rp,isFormData:_te,isArrayBufferView:wte,isString:Ste,isNumber:EI,isBoolean:kte,isObject:Dp,isPlainObject:ev,isEmptyObject:Ote,isReadableStream:Mte,isRequest:Rte,isResponse:Dte,isHeaders:Pte,isUndefined:Xh,isDate:jte,isFile:Nte,isBlob:Cte,isRegExp:Gte,isFunction:wi,isStream:Ete,isURLSearchParams:Ate,isTypedArray:Hte,isFileList:Tte,forEach:Pp,merge:ak,extend:Ite,trim:zte,stripBOM:Lte,inherits:Bte,toFlatObject:Fte,kindOf:Yy,kindOfTest:eo,endsWith:qte,toArray:$te,forEachEntry:Qte,matchAll:Vte,isHTMLForm:Ute,hasOwnProperty:E9,hasOwnProp:E9,reduceDescriptors:MI,freezeMethods:Xte,toObjectSet:Yte,toCamelCase:Wte,noop:Kte,toFiniteNumber:Zte,findKey:_I,global:$u,isContextDefined:AI,isSpecCompliantForm:Jte,toJSONObject:ene,isAsyncFn:tne,isThenable:nne,setImmediate:RI,asap:rne,isIterable:sne};function Xt(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}je.inherits(Xt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:je.toJSONObject(this.config),code:this.code,status:this.status}}});const DI=Xt.prototype,PI={};["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=>{PI[t]={value:t}});Object.defineProperties(Xt,PI);Object.defineProperty(DI,"isAxiosError",{value:!0});Xt.from=(t,e,n,r,s,i)=>{const a=Object.create(DI);je.toFlatObject(t,a,function(h){return h!==Error.prototype},d=>d!=="isAxiosError");const l=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return Xt.call(a,l,c,n,r,s),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",i&&Object.assign(a,i),a};const ine=null;function ok(t){return je.isPlainObject(t)||je.isArray(t)}function zI(t){return je.endsWith(t,"[]")?t.slice(0,-2):t}function _9(t,e,n){return t?t.concat(e).map(function(s,i){return s=zI(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function ane(t){return je.isArray(t)&&!t.some(ok)}const one=je.toFlatObject(je,{},null,function(e){return/^is[A-Z]/.test(e)});function Zy(t,e,n){if(!je.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=je.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,S){return!je.isUndefined(S[w])});const r=n.metaTokens,s=n.visitor||h,i=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&je.isSpecCompliantForm(e);if(!je.isFunction(s))throw new TypeError("visitor must be a function");function d(y){if(y===null)return"";if(je.isDate(y))return y.toISOString();if(je.isBoolean(y))return y.toString();if(!c&&je.isBlob(y))throw new Xt("Blob is not supported. Use a Buffer instead.");return je.isArrayBuffer(y)||je.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function h(y,w,S){let k=y;if(y&&!S&&typeof y=="object"){if(je.endsWith(w,"{}"))w=r?w:w.slice(0,-2),y=JSON.stringify(y);else if(je.isArray(y)&&ane(y)||(je.isFileList(y)||je.endsWith(w,"[]"))&&(k=je.toArray(y)))return w=zI(w),k.forEach(function(N,T){!(je.isUndefined(N)||N===null)&&e.append(a===!0?_9([w],T,i):a===null?w:w+"[]",d(N))}),!1}return ok(y)?!0:(e.append(_9(S,w,i),d(y)),!1)}const m=[],g=Object.assign(one,{defaultVisitor:h,convertValue:d,isVisitable:ok});function x(y,w){if(!je.isUndefined(y)){if(m.indexOf(y)!==-1)throw Error("Circular reference detected in "+w.join("."));m.push(y),je.forEach(y,function(k,j){(!(je.isUndefined(k)||k===null)&&s.call(e,k,je.isString(j)?j.trim():j,w,g))===!0&&x(k,w?w.concat(j):[j])}),m.pop()}}if(!je.isObject(t))throw new TypeError("data must be an object");return x(t),e}function A9(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Dj(t,e){this._pairs=[],t&&Zy(t,this,e)}const II=Dj.prototype;II.append=function(e,n){this._pairs.push([e,n])};II.toString=function(e){const n=e?function(r){return e.call(this,r,A9)}:A9;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function lne(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function LI(t,e,n){if(!e)return t;const r=n&&n.encode||lne;je.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=je.isURLSearchParams(e)?e.toString():new Dj(e,n).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class M9{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){je.forEach(this.handlers,function(r){r!==null&&e(r)})}}const BI={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},cne=typeof URLSearchParams<"u"?URLSearchParams:Dj,une=typeof FormData<"u"?FormData:null,dne=typeof Blob<"u"?Blob:null,hne={isBrowser:!0,classes:{URLSearchParams:cne,FormData:une,Blob:dne},protocols:["http","https","file","blob","url","data"]},Pj=typeof window<"u"&&typeof document<"u",lk=typeof navigator=="object"&&navigator||void 0,fne=Pj&&(!lk||["ReactNative","NativeScript","NS"].indexOf(lk.product)<0),mne=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",pne=Pj&&window.location.href||"http://localhost",gne=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Pj,hasStandardBrowserEnv:fne,hasStandardBrowserWebWorkerEnv:mne,navigator:lk,origin:pne},Symbol.toStringTag,{value:"Module"})),Hs={...gne,...hne};function xne(t,e){return Zy(t,new Hs.classes.URLSearchParams,{visitor:function(n,r,s,i){return Hs.isNode&&je.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function vne(t){return je.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function yne(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return a=!a&&je.isArray(s)?s.length:a,c?(je.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!l):((!s[a]||!je.isObject(s[a]))&&(s[a]=[]),e(n,r,s[a],i)&&je.isArray(s[a])&&(s[a]=yne(s[a])),!l)}if(je.isFormData(t)&&je.isFunction(t.entries)){const n={};return je.forEachEntry(t,(r,s)=>{e(vne(r),s,n,0)}),n}return null}function bne(t,e,n){if(je.isString(t))try{return(e||JSON.parse)(t),je.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const zp={transitional:BI,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=je.isObject(e);if(i&&je.isHTMLForm(e)&&(e=new FormData(e)),je.isFormData(e))return s?JSON.stringify(FI(e)):e;if(je.isArrayBuffer(e)||je.isBuffer(e)||je.isStream(e)||je.isFile(e)||je.isBlob(e)||je.isReadableStream(e))return e;if(je.isArrayBufferView(e))return e.buffer;if(je.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return xne(e,this.formSerializer).toString();if((l=je.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Zy(l?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),bne(e)):e}],transformResponse:[function(e){const n=this.transitional||zp.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(je.isResponse(e)||je.isReadableStream(e))return e;if(e&&je.isString(e)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?Xt.from(l,Xt.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Hs.classes.FormData,Blob:Hs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};je.forEach(["delete","get","head","post","put","patch"],t=>{zp.headers[t]={}});const wne=je.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Sne=t=>{const e={};let n,r,s;return t&&t.split(` -`).forEach(function(a){s=a.indexOf(":"),n=a.substring(0,s).trim().toLowerCase(),r=a.substring(s+1).trim(),!(!n||e[n]&&wne[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},R9=Symbol("internals");function zm(t){return t&&String(t).trim().toLowerCase()}function tv(t){return t===!1||t==null?t:je.isArray(t)?t.map(tv):String(t)}function kne(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 One=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function k4(t,e,n,r,s){if(je.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!je.isString(e)){if(je.isString(r))return e.indexOf(r)!==-1;if(je.isRegExp(r))return r.test(e)}}function jne(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Nne(t,e){const n=je.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,a){return this[r].call(this,e,s,i,a)},configurable:!0})})}let Si=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(l,c,d){const h=zm(c);if(!h)throw new Error("header name must be a non-empty string");const m=je.findKey(s,h);(!m||s[m]===void 0||d===!0||d===void 0&&s[m]!==!1)&&(s[m||c]=tv(l))}const a=(l,c)=>je.forEach(l,(d,h)=>i(d,h,c));if(je.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(je.isString(e)&&(e=e.trim())&&!One(e))a(Sne(e),n);else if(je.isObject(e)&&je.isIterable(e)){let l={},c,d;for(const h of e){if(!je.isArray(h))throw TypeError("Object iterator must return a key-value pair");l[d=h[0]]=(c=l[d])?je.isArray(c)?[...c,h[1]]:[c,h[1]]:h[1]}a(l,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=zm(e),e){const r=je.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return kne(s);if(je.isFunction(n))return n.call(this,s,r);if(je.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=zm(e),e){const r=je.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||k4(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(a){if(a=zm(a),a){const l=je.findKey(r,a);l&&(!n||k4(r,r[l],l,n))&&(delete r[l],s=!0)}}return je.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||k4(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return je.forEach(this,(s,i)=>{const a=je.findKey(r,i);if(a){n[a]=tv(s),delete n[i];return}const l=e?jne(i):String(i).trim();l!==i&&delete n[i],n[l]=tv(s),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return je.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&je.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[R9]=this[R9]={accessors:{}}).accessors,s=this.prototype;function i(a){const l=zm(a);r[l]||(Nne(s,a),r[l]=!0)}return je.isArray(e)?e.forEach(i):i(e),this}};Si.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);je.reduceDescriptors(Si.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});je.freezeMethods(Si);function O4(t,e){const n=this||zp,r=e||n,s=Si.from(r.headers);let i=r.data;return je.forEach(t,function(l){i=l.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function qI(t){return!!(t&&t.__CANCEL__)}function bf(t,e,n){Xt.call(this,t??"canceled",Xt.ERR_CANCELED,e,n),this.name="CanceledError"}je.inherits(bf,Xt,{__CANCEL__:!0});function $I(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Xt("Request failed with status code "+n.status,[Xt.ERR_BAD_REQUEST,Xt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Cne(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Tne(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,a;return e=e!==void 0?e:1e3,function(c){const d=Date.now(),h=r[i];a||(a=d),n[s]=c,r[s]=d;let m=i,g=0;for(;m!==s;)g+=n[m++],m=m%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),d-a{n=h,s=null,i&&(clearTimeout(i),i=null),t(...d)};return[(...d)=>{const h=Date.now(),m=h-n;m>=r?a(d,h):(s=d,i||(i=setTimeout(()=>{i=null,a(s)},r-m)))},()=>s&&a(s)]}const zv=(t,e,n=3)=>{let r=0;const s=Tne(50,250);return Ene(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,c=a-r,d=s(c),h=a<=l;r=a;const m={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:d||void 0,estimated:d&&l&&h?(l-a)/d:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(m)},n)},D9=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},P9=t=>(...e)=>je.asap(()=>t(...e)),_ne=Hs.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Hs.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Hs.origin),Hs.navigator&&/(msie|trident)/i.test(Hs.navigator.userAgent)):()=>!0,Ane=Hs.hasStandardBrowserEnv?{write(t,e,n,r,s,i,a){if(typeof document>"u")return;const l=[`${t}=${encodeURIComponent(e)}`];je.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),je.isString(r)&&l.push(`path=${r}`),je.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),je.isString(a)&&l.push(`SameSite=${a}`),document.cookie=l.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Mne(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Rne(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function HI(t,e,n){let r=!Mne(e);return t&&(r||n==!1)?Rne(t,e):e}const z9=t=>t instanceof Si?{...t}:t;function rd(t,e){e=e||{};const n={};function r(d,h,m,g){return je.isPlainObject(d)&&je.isPlainObject(h)?je.merge.call({caseless:g},d,h):je.isPlainObject(h)?je.merge({},h):je.isArray(h)?h.slice():h}function s(d,h,m,g){if(je.isUndefined(h)){if(!je.isUndefined(d))return r(void 0,d,m,g)}else return r(d,h,m,g)}function i(d,h){if(!je.isUndefined(h))return r(void 0,h)}function a(d,h){if(je.isUndefined(h)){if(!je.isUndefined(d))return r(void 0,d)}else return r(void 0,h)}function l(d,h,m){if(m in e)return r(d,h);if(m in t)return r(void 0,d)}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(d,h,m)=>s(z9(d),z9(h),m,!0)};return je.forEach(Object.keys({...t,...e}),function(h){const m=c[h]||s,g=m(t[h],e[h],h);je.isUndefined(g)&&m!==l||(n[h]=g)}),n}const QI=t=>{const e=rd({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:l}=e;if(e.headers=a=Si.from(a),e.url=LI(HI(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),je.isFormData(n)){if(Hs.hasStandardBrowserEnv||Hs.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(je.isFunction(n.getHeaders)){const c=n.getHeaders(),d=["content-type","content-length"];Object.entries(c).forEach(([h,m])=>{d.includes(h.toLowerCase())&&a.set(h,m)})}}if(Hs.hasStandardBrowserEnv&&(r&&je.isFunction(r)&&(r=r(e)),r||r!==!1&&_ne(e.url))){const c=s&&i&&Ane.read(i);c&&a.set(s,c)}return e},Dne=typeof XMLHttpRequest<"u",Pne=Dne&&function(t){return new Promise(function(n,r){const s=QI(t);let i=s.data;const a=Si.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:d}=s,h,m,g,x,y;function w(){x&&x(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(h),s.signal&&s.signal.removeEventListener("abort",h)}let S=new XMLHttpRequest;S.open(s.method.toUpperCase(),s.url,!0),S.timeout=s.timeout;function k(){if(!S)return;const N=Si.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),E={data:!l||l==="text"||l==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:N,config:t,request:S};$I(function(A){n(A),w()},function(A){r(A),w()},E),S=null}"onloadend"in S?S.onloadend=k:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(k)},S.onabort=function(){S&&(r(new Xt("Request aborted",Xt.ECONNABORTED,t,S)),S=null)},S.onerror=function(T){const E=T&&T.message?T.message:"Network Error",_=new Xt(E,Xt.ERR_NETWORK,t,S);_.event=T||null,r(_),S=null},S.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||BI;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new Xt(T,E.clarifyTimeoutError?Xt.ETIMEDOUT:Xt.ECONNABORTED,t,S)),S=null},i===void 0&&a.setContentType(null),"setRequestHeader"in S&&je.forEach(a.toJSON(),function(T,E){S.setRequestHeader(E,T)}),je.isUndefined(s.withCredentials)||(S.withCredentials=!!s.withCredentials),l&&l!=="json"&&(S.responseType=s.responseType),d&&([g,y]=zv(d,!0),S.addEventListener("progress",g)),c&&S.upload&&([m,x]=zv(c),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",x)),(s.cancelToken||s.signal)&&(h=N=>{S&&(r(!N||N.type?new bf(null,t,S):N),S.abort(),S=null)},s.cancelToken&&s.cancelToken.subscribe(h),s.signal&&(s.signal.aborted?h():s.signal.addEventListener("abort",h)));const j=Cne(s.url);if(j&&Hs.protocols.indexOf(j)===-1){r(new Xt("Unsupported protocol "+j+":",Xt.ERR_BAD_REQUEST,t));return}S.send(i||null)})},zne=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(d){if(!s){s=!0,l();const h=d instanceof Error?d:this.reason;r.abort(h instanceof Xt?h:new bf(h instanceof Error?h.message:h))}};let a=e&&setTimeout(()=>{a=null,i(new Xt(`timeout ${e} of ms exceeded`,Xt.ETIMEDOUT))},e);const l=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),t=null)};t.forEach(d=>d.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>je.asap(l),c}},Ine=function*(t,e){let n=t.byteLength;if(n{const s=Lne(t,e);let i=0,a,l=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:d,value:h}=await s.next();if(d){l(),c.close();return}let m=h.byteLength;if(n){let g=i+=m;n(g)}c.enqueue(new Uint8Array(h))}catch(d){throw l(d),d}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},L9=64*1024,{isFunction:Xx}=je,Fne=(({Request:t,Response:e})=>({Request:t,Response:e}))(je.global),{ReadableStream:B9,TextEncoder:F9}=je.global,q9=(t,...e)=>{try{return!!t(...e)}catch{return!1}},qne=t=>{t=je.merge.call({skipUndefined:!0},Fne,t);const{fetch:e,Request:n,Response:r}=t,s=e?Xx(e):typeof fetch=="function",i=Xx(n),a=Xx(r);if(!s)return!1;const l=s&&Xx(B9),c=s&&(typeof F9=="function"?(y=>w=>y.encode(w))(new F9):async y=>new Uint8Array(await new n(y).arrayBuffer())),d=i&&l&&q9(()=>{let y=!1;const w=new n(Hs.origin,{body:new B9,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!w}),h=a&&l&&q9(()=>je.isReadableStream(new r("").body)),m={stream:h&&(y=>y.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!m[y]&&(m[y]=(w,S)=>{let k=w&&w[y];if(k)return k.call(w);throw new Xt(`Response type '${y}' is not supported`,Xt.ERR_NOT_SUPPORT,S)})});const g=async y=>{if(y==null)return 0;if(je.isBlob(y))return y.size;if(je.isSpecCompliantForm(y))return(await new n(Hs.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(je.isArrayBufferView(y)||je.isArrayBuffer(y))return y.byteLength;if(je.isURLSearchParams(y)&&(y=y+""),je.isString(y))return(await c(y)).byteLength},x=async(y,w)=>{const S=je.toFiniteNumber(y.getContentLength());return S??g(w)};return async y=>{let{url:w,method:S,data:k,signal:j,cancelToken:N,timeout:T,onDownloadProgress:E,onUploadProgress:_,responseType:A,headers:L,withCredentials:P="same-origin",fetchOptions:B}=QI(y),$=e||fetch;A=A?(A+"").toLowerCase():"text";let U=zne([j,N&&N.toAbortSignal()],T),te=null;const z=U&&U.unsubscribe&&(()=>{U.unsubscribe()});let Q;try{if(_&&d&&S!=="get"&&S!=="head"&&(Q=await x(L,k))!==0){let ie=new n(w,{method:"POST",body:k,duplex:"half"}),G;if(je.isFormData(k)&&(G=ie.headers.get("content-type"))&&L.setContentType(G),ie.body){const[I,V]=D9(Q,zv(P9(_)));k=I9(ie.body,L9,I,V)}}je.isString(P)||(P=P?"include":"omit");const F=i&&"credentials"in n.prototype,Y={...B,signal:U,method:S.toUpperCase(),headers:L.normalize().toJSON(),body:k,duplex:"half",credentials:F?P:void 0};te=i&&new n(w,Y);let J=await(i?$(te,B):$(w,Y));const X=h&&(A==="stream"||A==="response");if(h&&(E||X&&z)){const ie={};["status","statusText","headers"].forEach(ee=>{ie[ee]=J[ee]});const G=je.toFiniteNumber(J.headers.get("content-length")),[I,V]=E&&D9(G,zv(P9(E),!0))||[];J=new r(I9(J.body,L9,I,()=>{V&&V(),z&&z()}),ie)}A=A||"text";let R=await m[je.findKey(m,A)||"text"](J,y);return!X&&z&&z(),await new Promise((ie,G)=>{$I(ie,G,{data:R,headers:Si.from(J.headers),status:J.status,statusText:J.statusText,config:y,request:te})})}catch(F){throw z&&z(),F&&F.name==="TypeError"&&/Load failed|fetch/i.test(F.message)?Object.assign(new Xt("Network Error",Xt.ERR_NETWORK,y,te),{cause:F.cause||F}):Xt.from(F,F&&F.code,y,te)}}},$ne=new Map,VI=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let a=i.length,l=a,c,d,h=$ne;for(;l--;)c=i[l],d=h.get(c),d===void 0&&h.set(c,d=l?new Map:qne(e)),h=d;return d};VI();const zj={http:ine,xhr:Pne,fetch:{get:VI}};je.forEach(zj,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const $9=t=>`- ${t}`,Hne=t=>je.isFunction(t)||t===null||t===!1;function Qne(t,e){t=je.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let a=0;a`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=n?a.length>1?`since : -`+a.map($9).join(` -`):" "+$9(a[0]):"as no adapter specified";throw new Xt("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const UI={getAdapter:Qne,adapters:zj};function j4(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new bf(null,t)}function H9(t){return j4(t),t.headers=Si.from(t.headers),t.data=O4.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),UI.getAdapter(t.adapter||zp.adapter,t)(t).then(function(r){return j4(t),r.data=O4.call(t,t.transformResponse,r),r.headers=Si.from(r.headers),r},function(r){return qI(r)||(j4(t),r&&r.response&&(r.response.data=O4.call(t,t.transformResponse,r.response),r.response.headers=Si.from(r.response.headers))),Promise.reject(r)})}const WI="1.13.2",Jy={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Jy[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const Q9={};Jy.transitional=function(e,n,r){function s(i,a){return"[Axios v"+WI+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(e===!1)throw new Xt(s(a," has been removed"+(n?" in "+n:"")),Xt.ERR_DEPRECATED);return n&&!Q9[a]&&(Q9[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,a,l):!0}};Jy.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function Vne(t,e,n){if(typeof t!="object")throw new Xt("options must be an object",Xt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],a=e[i];if(a){const l=t[i],c=l===void 0||a(l,i,t);if(c!==!0)throw new Xt("option "+i+" must be "+c,Xt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Xt("Unknown option "+i,Xt.ERR_BAD_OPTION)}}const nv={assertOptions:Vne,validators:Jy},uo=nv.validators;let Zu=class{constructor(e){this.defaults=e||{},this.interceptors={request:new M9,response:new M9}}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=rd(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&nv.assertOptions(r,{silentJSONParsing:uo.transitional(uo.boolean),forcedJSONParsing:uo.transitional(uo.boolean),clarifyTimeoutError:uo.transitional(uo.boolean)},!1),s!=null&&(je.isFunction(s)?n.paramsSerializer={serialize:s}:nv.assertOptions(s,{encode:uo.function,serialize:uo.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),nv.assertOptions(n,{baseUrl:uo.spelling("baseURL"),withXsrfToken:uo.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&je.merge(i.common,i[n.method]);i&&je.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=Si.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(c=c&&w.synchronous,l.unshift(w.fulfilled,w.rejected))});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let h,m=0,g;if(!c){const y=[H9.bind(this),void 0];for(y.unshift(...l),y.push(...d),g=y.length,h=Promise.resolve(n);m{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(l=>{r.subscribe(l),i=l}).then(s);return a.cancel=function(){r.unsubscribe(i)},a},e(function(i,a,l){r.reason||(r.reason=new bf(i,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new GI(function(s){e=s}),cancel:e}}};function Wne(t){return function(n){return t.apply(null,n)}}function Gne(t){return je.isObject(t)&&t.isAxiosError===!0}const ck={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(ck).forEach(([t,e])=>{ck[e]=t});function XI(t){const e=new Zu(t),n=NI(Zu.prototype.request,e);return je.extend(n,Zu.prototype,e,{allOwnKeys:!0}),je.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return XI(rd(t,s))},n}const Br=XI(zp);Br.Axios=Zu;Br.CanceledError=bf;Br.CancelToken=Une;Br.isCancel=qI;Br.VERSION=WI;Br.toFormData=Zy;Br.AxiosError=Xt;Br.Cancel=Br.CanceledError;Br.all=function(e){return Promise.all(e)};Br.spread=Wne;Br.isAxiosError=Gne;Br.mergeConfig=rd;Br.AxiosHeaders=Si;Br.formToJSON=t=>FI(je.isHTMLForm(t)?new FormData(t):t);Br.getAdapter=UI.getAdapter;Br.HttpStatusCode=ck;Br.default=Br;const{Axios:nPe,AxiosError:rPe,CanceledError:sPe,isCancel:iPe,CancelToken:aPe,VERSION:oPe,all:lPe,Cancel:cPe,isAxiosError:uPe,spread:dPe,toFormData:hPe,AxiosHeaders:fPe,HttpStatusCode:mPe,formToJSON:pPe,getAdapter:gPe,mergeConfig:xPe}=Br,Xne=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),YI=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Iv="-",V9=[],Kne="arbitrary..",Zne=t=>{const e=ere(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Jne(a);const l=a.split(Iv),c=l[0]===""&&l.length>1?1:0;return KI(l,c,e)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=r[a],d=n[a];return c?d?Xne(d,c):c:d||V9}return n[a]||V9}}},KI=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const d=KI(t,e+1,i);if(d)return d}const a=n.validators;if(a===null)return;const l=e===0?t.join(Iv):t.slice(e).join(Iv),c=a.length;for(let d=0;dt.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?Kne+r:void 0})(),ere=t=>{const{theme:e,classGroups:n}=t;return tre(n,e)},tre=(t,e)=>{const n=YI();for(const r in t){const s=t[r];Ij(s,n,r,e)}return n},Ij=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){rre(t,e,n);return}if(typeof t=="function"){sre(t,e,n,r);return}ire(t,e,n,r)},rre=(t,e,n)=>{const r=t===""?e:ZI(e,t);r.classGroupId=n},sre=(t,e,n,r)=>{if(are(t)){Ij(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(Yne(n,t))},ire=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let a=0;a{let n=t;const r=e.split(Iv),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,ore=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,a)=>{n[i]=a,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return s(i,a),a},set(i,a){i in n?n[i]=a:s(i,a)}}},uk="!",U9=":",lre=[],W9=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),cre=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let a=0,l=0,c=0,d;const h=s.length;for(let w=0;wc?d-c:void 0;return W9(i,x,g,y)};if(e){const s=e+U9,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):W9(lre,!1,a,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},ure=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},dre=t=>({cache:ore(t.cacheSize),parseClassName:cre(t),sortModifiers:ure(t),...Zne(t)}),hre=/\s+/,fre=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,a=[],l=t.trim().split(hre);let c="";for(let d=l.length-1;d>=0;d-=1){const h=l[d],{isExternal:m,modifiers:g,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:w}=n(h);if(m){c=h+(c.length>0?" "+c:c);continue}let S=!!w,k=r(S?y.substring(0,w):y);if(!k){if(!S){c=h+(c.length>0?" "+c:c);continue}if(k=r(y),!k){c=h+(c.length>0?" "+c:c);continue}S=!1}const j=g.length===0?"":g.length===1?g[0]:i(g).join(":"),N=x?j+uk:j,T=N+k;if(a.indexOf(T)>-1)continue;a.push(T);const E=s(k,S);for(let _=0;_0?" "+c:c)}return c},mre=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const a=c=>{const d=e.reduce((h,m)=>m(h),t());return n=dre(d),r=n.cache.get,s=n.cache.set,i=l,l(c)},l=c=>{const d=r(c);if(d)return d;const h=fre(c,n);return s(c,h),h};return i=a,(...c)=>i(mre(...c))},gre=[],cs=t=>{const e=n=>n[t]||gre;return e.isThemeGetter=!0,e},eL=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,tL=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xre=/^\d+\/\d+$/,vre=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yre=/\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$/,bre=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wre=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Sre=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ih=t=>xre.test(t),rn=t=>!!t&&!Number.isNaN(Number(t)),jc=t=>!!t&&Number.isInteger(Number(t)),N4=t=>t.endsWith("%")&&rn(t.slice(0,-1)),xl=t=>vre.test(t),kre=()=>!0,Ore=t=>yre.test(t)&&!bre.test(t),nL=()=>!1,jre=t=>wre.test(t),Nre=t=>Sre.test(t),Cre=t=>!dt(t)&&!ht(t),Tre=t=>wf(t,iL,nL),dt=t=>eL.test(t),Mu=t=>wf(t,aL,Ore),C4=t=>wf(t,Rre,rn),G9=t=>wf(t,rL,nL),Ere=t=>wf(t,sL,Nre),Yx=t=>wf(t,oL,jre),ht=t=>tL.test(t),Im=t=>Sf(t,aL),_re=t=>Sf(t,Dre),X9=t=>Sf(t,rL),Are=t=>Sf(t,iL),Mre=t=>Sf(t,sL),Kx=t=>Sf(t,oL,!0),wf=(t,e,n)=>{const r=eL.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Sf=(t,e,n=!1)=>{const r=tL.exec(t);return r?r[1]?e(r[1]):n:!1},rL=t=>t==="position"||t==="percentage",sL=t=>t==="image"||t==="url",iL=t=>t==="length"||t==="size"||t==="bg-size",aL=t=>t==="length",Rre=t=>t==="number",Dre=t=>t==="family-name",oL=t=>t==="shadow",Pre=()=>{const t=cs("color"),e=cs("font"),n=cs("text"),r=cs("font-weight"),s=cs("tracking"),i=cs("leading"),a=cs("breakpoint"),l=cs("container"),c=cs("spacing"),d=cs("radius"),h=cs("shadow"),m=cs("inset-shadow"),g=cs("text-shadow"),x=cs("drop-shadow"),y=cs("blur"),w=cs("perspective"),S=cs("aspect"),k=cs("ease"),j=cs("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...T(),ht,dt],_=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],L=()=>[ht,dt,c],P=()=>[ih,"full","auto",...L()],B=()=>[jc,"none","subgrid",ht,dt],$=()=>["auto",{span:["full",jc,ht,dt]},jc,ht,dt],U=()=>[jc,"auto",ht,dt],te=()=>["auto","min","max","fr",ht,dt],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Q=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...L()],Y=()=>[ih,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],J=()=>[t,ht,dt],X=()=>[...T(),X9,G9,{position:[ht,dt]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ie=()=>["auto","cover","contain",Are,Tre,{size:[ht,dt]}],G=()=>[N4,Im,Mu],I=()=>["","none","full",d,ht,dt],V=()=>["",rn,Im,Mu],ee=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[rn,N4,X9,G9],se=()=>["","none",y,ht,dt],re=()=>["none",rn,ht,dt],oe=()=>["none",rn,ht,dt],Te=()=>[rn,ht,dt],We=()=>[ih,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xl],breakpoint:[xl],color:[kre],container:[xl],"drop-shadow":[xl],ease:["in","out","in-out"],font:[Cre],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xl],shadow:[xl],spacing:["px",rn],text:[xl],"text-shadow":[xl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ih,dt,ht,S]}],container:["container"],columns:[{columns:[rn,dt,ht,l]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[jc,"auto",ht,dt]}],basis:[{basis:[ih,"full","auto",l,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[rn,ih,"auto","initial","none",dt]}],grow:[{grow:["",rn,ht,dt]}],shrink:[{shrink:["",rn,ht,dt]}],order:[{order:[jc,"first","last","none",ht,dt]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...Q(),"normal"]}],"justify-self":[{"justify-self":["auto",...Q()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...Q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Q(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...Q(),"baseline"]}],"place-self":[{"place-self":["auto",...Q()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[l,"screen",...Y()]}],"min-w":[{"min-w":[l,"screen","none",...Y()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",n,Im,Mu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ht,C4]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",N4,dt]}],"font-family":[{font:[_re,dt,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,ht,dt]}],"line-clamp":[{"line-clamp":[rn,"none",ht,C4]}],leading:[{leading:[i,...L()]}],"list-image":[{"list-image":["none",ht,dt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ht,dt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[rn,"from-font","auto",ht,Mu]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[rn,"auto",ht,dt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ht,dt]}],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",ht,dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},jc,ht,dt],radial:["",ht,dt],conic:[jc,ht,dt]},Mre,Ere]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[rn,ht,dt]}],"outline-w":[{outline:["",rn,Im,Mu]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",h,Kx,Yx]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",m,Kx,Yx]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[rn,Mu]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",g,Kx,Yx]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[rn,ht,dt]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[rn]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[ht,dt]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[rn]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ht,dt]}],filter:[{filter:["","none",ht,dt]}],blur:[{blur:se()}],brightness:[{brightness:[rn,ht,dt]}],contrast:[{contrast:[rn,ht,dt]}],"drop-shadow":[{"drop-shadow":["","none",x,Kx,Yx]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",rn,ht,dt]}],"hue-rotate":[{"hue-rotate":[rn,ht,dt]}],invert:[{invert:["",rn,ht,dt]}],saturate:[{saturate:[rn,ht,dt]}],sepia:[{sepia:["",rn,ht,dt]}],"backdrop-filter":[{"backdrop-filter":["","none",ht,dt]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[rn,ht,dt]}],"backdrop-contrast":[{"backdrop-contrast":[rn,ht,dt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",rn,ht,dt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[rn,ht,dt]}],"backdrop-invert":[{"backdrop-invert":["",rn,ht,dt]}],"backdrop-opacity":[{"backdrop-opacity":[rn,ht,dt]}],"backdrop-saturate":[{"backdrop-saturate":[rn,ht,dt]}],"backdrop-sepia":[{"backdrop-sepia":["",rn,ht,dt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ht,dt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[rn,"initial",ht,dt]}],ease:[{ease:["linear","initial",k,ht,dt]}],delay:[{delay:[rn,ht,dt]}],animate:[{animate:["none",j,ht,dt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,ht,dt]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:Te()}],"skew-x":[{"skew-x":Te()}],"skew-y":[{"skew-y":Te()}],transform:[{transform:[ht,dt,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:We()}],"translate-x":[{"translate-x":We()}],"translate-y":[{"translate-y":We()}],"translate-z":[{"translate-z":We()}],"translate-none":["translate-none"],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ht,dt]}],"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":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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",ht,dt]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[rn,Im,Mu,C4]}],stroke:[{stroke:["none",...J()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},zre=pre(Pre);function xe(...t){return zre(Fz(t))}const qt=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("rounded-xl border bg-card text-card-foreground shadow",t),...e}));qt.displayName="Card";const Fn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-6",t),...e}));Fn.displayName="CardHeader";const qn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("font-semibold leading-none tracking-tight",t),...e}));qn.displayName="CardTitle";const ts=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("text-sm text-muted-foreground",t),...e}));ts.displayName="CardDescription";const Gn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("p-6 pt-0",t),...e}));Gn.displayName="CardContent";const lL=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",t),...e}));lL.displayName="CardFooter";var T4="rovingFocusGroup.onEntryFocus",Ire={bubbles:!1,cancelable:!0},Ip="RovingFocusGroup",[dk,cL,Lre]=By(Ip),[Bre,eb]=Ra(Ip,[Lre]),[Fre,qre]=Bre(Ip),uL=b.forwardRef((t,e)=>o.jsx(dk.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(dk.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx($re,{...t,ref:e})})}));uL.displayName=Ip;var $re=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:h=!1,...m}=t,g=b.useRef(null),x=Yn(e,g),y=Ep(i),[w,S]=Xl({prop:a,defaultProp:l??null,onChange:c,caller:Ip}),[k,j]=b.useState(!1),N=Rs(d),T=cL(n),E=b.useRef(!1),[_,A]=b.useState(0);return b.useEffect(()=>{const L=g.current;if(L)return L.addEventListener(T4,N),()=>L.removeEventListener(T4,N)},[N]),o.jsx(Fre,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:w,onItemFocus:b.useCallback(L=>S(L),[S]),onItemShiftTab:b.useCallback(()=>j(!0),[]),onFocusableItemAdd:b.useCallback(()=>A(L=>L+1),[]),onFocusableItemRemove:b.useCallback(()=>A(L=>L-1),[]),children:o.jsx(xn.div,{tabIndex:k||_===0?-1:0,"data-orientation":r,...m,ref:x,style:{outline:"none",...t.style},onMouseDown:nt(t.onMouseDown,()=>{E.current=!0}),onFocus:nt(t.onFocus,L=>{const P=!E.current;if(L.target===L.currentTarget&&P&&!k){const B=new CustomEvent(T4,Ire);if(L.currentTarget.dispatchEvent(B),!B.defaultPrevented){const $=T().filter(F=>F.focusable),U=$.find(F=>F.active),te=$.find(F=>F.id===w),Q=[U,te,...$].filter(Boolean).map(F=>F.ref.current);fL(Q,h)}}E.current=!1}),onBlur:nt(t.onBlur,()=>j(!1))})})}),dL="RovingFocusGroupItem",hL=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...l}=t,c=Ui(),d=i||c,h=qre(dL,n),m=h.currentTabStopId===d,g=cL(n),{onFocusableItemAdd:x,onFocusableItemRemove:y,currentTabStopId:w}=h;return b.useEffect(()=>{if(r)return x(),()=>y()},[r,x,y]),o.jsx(dk.ItemSlot,{scope:n,id:d,focusable:r,active:s,children:o.jsx(xn.span,{tabIndex:m?0:-1,"data-orientation":h.orientation,...l,ref:e,onMouseDown:nt(t.onMouseDown,S=>{r?h.onItemFocus(d):S.preventDefault()}),onFocus:nt(t.onFocus,()=>h.onItemFocus(d)),onKeyDown:nt(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){h.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const k=Vre(S,h.orientation,h.dir);if(k!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let N=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")N.reverse();else if(k==="prev"||k==="next"){k==="prev"&&N.reverse();const T=N.indexOf(S.currentTarget);N=h.loop?Ure(N,T+1):N.slice(T+1)}setTimeout(()=>fL(N))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:w!=null}):a})})});hL.displayName=dL;var Hre={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Qre(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Vre(t,e,n){const r=Qre(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Hre[r]}function fL(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Ure(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var mL=uL,pL=hL,tb="Tabs",[Wre]=Ra(tb,[eb]),gL=eb(),[Gre,Lj]=Wre(tb),xL=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:c="automatic",...d}=t,h=Ep(l),[m,g]=Xl({prop:r,onChange:s,defaultProp:i??"",caller:tb});return o.jsx(Gre,{scope:n,baseId:Ui(),value:m,onValueChange:g,orientation:a,dir:h,activationMode:c,children:o.jsx(xn.div,{dir:h,"data-orientation":a,...d,ref:e})})});xL.displayName=tb;var vL="TabsList",yL=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=Lj(vL,n),a=gL(n);return o.jsx(mL,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:o.jsx(xn.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});yL.displayName=vL;var bL="TabsTrigger",wL=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,a=Lj(bL,n),l=gL(n),c=OL(a.baseId,r),d=jL(a.baseId,r),h=r===a.value;return o.jsx(pL,{asChild:!0,...l,focusable:!s,active:h,children:o.jsx(xn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":d,"data-state":h?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:nt(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?a.onValueChange(r):m.preventDefault()}),onKeyDown:nt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&a.onValueChange(r)}),onFocus:nt(t.onFocus,()=>{const m=a.activationMode!=="manual";!h&&!s&&m&&a.onValueChange(r)})})})});wL.displayName=bL;var SL="TabsContent",kL=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...a}=t,l=Lj(SL,n),c=OL(l.baseId,r),d=jL(l.baseId,r),h=r===l.value,m=b.useRef(h);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),o.jsx(ii,{present:s||h,children:({present:g})=>o.jsx(xn.div,{"data-state":h?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:d,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});kL.displayName=SL;function OL(t,e){return`${t}-trigger-${e}`}function jL(t,e){return`${t}-content-${e}`}var Xre=xL,NL=yL,CL=wL,TL=kL;const ja=Xre,Wi=b.forwardRef(({className:t,...e},n)=>o.jsx(NL,{ref:n,className:xe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Wi.displayName=NL.displayName;const Lt=b.forwardRef(({className:t,...e},n)=>o.jsx(CL,{ref:n,className:xe("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}));Lt.displayName=CL.displayName;const un=b.forwardRef(({className:t,...e},n)=>o.jsx(TL,{ref:n,className:xe("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}));un.displayName=TL.displayName;function Yre(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var Bj="ScrollArea",[EL]=Ra(Bj),[Kre,Da]=EL(Bj),_L=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...a}=t,[l,c]=b.useState(null),[d,h]=b.useState(null),[m,g]=b.useState(null),[x,y]=b.useState(null),[w,S]=b.useState(null),[k,j]=b.useState(0),[N,T]=b.useState(0),[E,_]=b.useState(!1),[A,L]=b.useState(!1),P=Yn(e,$=>c($)),B=Ep(s);return o.jsx(Kre,{scope:n,type:r,dir:B,scrollHideDelay:i,scrollArea:l,viewport:d,onViewportChange:h,content:m,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:E,onScrollbarXEnabledChange:_,scrollbarY:w,onScrollbarYChange:S,scrollbarYEnabled:A,onScrollbarYEnabledChange:L,onCornerWidthChange:j,onCornerHeightChange:T,children:o.jsx(xn.div,{dir:B,...a,ref:P,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":N+"px",...t.style}})})});_L.displayName=Bj;var AL="ScrollAreaViewport",ML=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,a=Da(AL,n),l=b.useRef(null),c=Yn(e,l,a.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),o.jsx(xn.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:o.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});ML.displayName=AL;var Fo="ScrollAreaScrollbar",Fj=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Da(Fo,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=s,l=t.orientation==="horizontal";return b.useEffect(()=>(l?i(!0):a(!0),()=>{l?i(!1):a(!1)}),[l,i,a]),s.type==="hover"?o.jsx(Zre,{...r,ref:e,forceMount:n}):s.type==="scroll"?o.jsx(Jre,{...r,ref:e,forceMount:n}):s.type==="auto"?o.jsx(RL,{...r,ref:e,forceMount:n}):s.type==="always"?o.jsx(qj,{...r,ref:e}):null});Fj.displayName=Fo;var Zre=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Da(Fo,t.__scopeScrollArea),[i,a]=b.useState(!1);return b.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),a(!0)},h=()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",h),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",h)}}},[s.scrollArea,s.scrollHideDelay]),o.jsx(ii,{present:n||i,children:o.jsx(RL,{"data-state":i?"visible":"hidden",...r,ref:e})})}),Jre=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Da(Fo,t.__scopeScrollArea),i=t.orientation==="horizontal",a=rb(()=>c("SCROLL_END"),100),[l,c]=Yre("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return b.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,s.scrollHideDelay,c]),b.useEffect(()=>{const d=s.viewport,h=i?"scrollLeft":"scrollTop";if(d){let m=d[h];const g=()=>{const x=d[h];m!==x&&(c("SCROLL"),a()),m=x};return d.addEventListener("scroll",g),()=>d.removeEventListener("scroll",g)}},[s.viewport,i,c,a]),o.jsx(ii,{present:n||l!=="hidden",children:o.jsx(qj,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:nt(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:nt(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),RL=b.forwardRef((t,e)=>{const n=Da(Fo,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,a]=b.useState(!1),l=t.orientation==="horizontal",c=rb(()=>{if(n.viewport){const d=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=Da(Fo,t.__scopeScrollArea),i=b.useRef(null),a=b.useRef(0),[l,c]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=LL(l.viewport,l.content),h={...r,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:g=>a.current=g};function m(g,x){return ise(g,a.current,l,x)}return n==="horizontal"?o.jsx(ese,{...h,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollLeft,x=Y9(g,l,s.dir);i.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollLeft=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollLeft=m(g,s.dir))}}):n==="vertical"?o.jsx(tse,{...h,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollTop,x=Y9(g,l);i.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollTop=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollTop=m(g))}}):null}),ese=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Da(Fo,t.__scopeScrollArea),[a,l]=b.useState(),c=b.useRef(null),d=Yn(e,c,i.onScrollbarXChange);return b.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(PL,{"data-orientation":"horizontal",...s,ref:d,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":nb(n)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.x),onDragScroll:h=>t.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(i.viewport){const g=i.viewport.scrollLeft+h.deltaX;t.onWheelScroll(g),FL(g,m)&&h.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Bv(a.paddingLeft),paddingEnd:Bv(a.paddingRight)}})}})}),tse=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Da(Fo,t.__scopeScrollArea),[a,l]=b.useState(),c=b.useRef(null),d=Yn(e,c,i.onScrollbarYChange);return b.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(PL,{"data-orientation":"vertical",...s,ref:d,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":nb(n)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.y),onDragScroll:h=>t.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(i.viewport){const g=i.viewport.scrollTop+h.deltaY;t.onWheelScroll(g),FL(g,m)&&h.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Bv(a.paddingTop),paddingEnd:Bv(a.paddingBottom)}})}})}),[nse,DL]=EL(Fo),PL=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:h,onResize:m,...g}=t,x=Da(Fo,n),[y,w]=b.useState(null),S=Yn(e,P=>w(P)),k=b.useRef(null),j=b.useRef(""),N=x.viewport,T=r.content-r.viewport,E=Rs(h),_=Rs(c),A=rb(m,10);function L(P){if(k.current){const B=P.clientX-k.current.left,$=P.clientY-k.current.top;d({x:B,y:$})}}return b.useEffect(()=>{const P=B=>{const $=B.target;y?.contains($)&&E(B,T)};return document.addEventListener("wheel",P,{passive:!1}),()=>document.removeEventListener("wheel",P,{passive:!1})},[N,y,T,E]),b.useEffect(_,[r,_]),Yh(y,A),Yh(x.content,A),o.jsx(nse,{scope:n,scrollbar:y,hasThumb:s,onThumbChange:Rs(i),onThumbPointerUp:Rs(a),onThumbPositionChange:_,onThumbPointerDown:Rs(l),children:o.jsx(xn.div,{...g,ref:S,style:{position:"absolute",...g.style},onPointerDown:nt(t.onPointerDown,P=>{P.button===0&&(P.target.setPointerCapture(P.pointerId),k.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),L(P))}),onPointerMove:nt(t.onPointerMove,L),onPointerUp:nt(t.onPointerUp,P=>{const B=P.target;B.hasPointerCapture(P.pointerId)&&B.releasePointerCapture(P.pointerId),document.body.style.webkitUserSelect=j.current,x.viewport&&(x.viewport.style.scrollBehavior=""),k.current=null})})})}),Lv="ScrollAreaThumb",zL=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=DL(Lv,t.__scopeScrollArea);return o.jsx(ii,{present:n||s.hasThumb,children:o.jsx(rse,{ref:e,...r})})}),rse=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Da(Lv,n),a=DL(Lv,n),{onThumbPositionChange:l}=a,c=Yn(e,m=>a.onThumbChange(m)),d=b.useRef(void 0),h=rb(()=>{d.current&&(d.current(),d.current=void 0)},100);return b.useEffect(()=>{const m=i.viewport;if(m){const g=()=>{if(h(),!d.current){const x=ase(m,l);d.current=x,l()}};return l(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[i.viewport,h,l]),o.jsx(xn.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:nt(t.onPointerDownCapture,m=>{const x=m.target.getBoundingClientRect(),y=m.clientX-x.left,w=m.clientY-x.top;a.onThumbPointerDown({x:y,y:w})}),onPointerUp:nt(t.onPointerUp,a.onThumbPointerUp)})});zL.displayName=Lv;var $j="ScrollAreaCorner",IL=b.forwardRef((t,e)=>{const n=Da($j,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?o.jsx(sse,{...t,ref:e}):null});IL.displayName=$j;var sse=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Da($j,n),[i,a]=b.useState(0),[l,c]=b.useState(0),d=!!(i&&l);return Yh(s.scrollbarX,()=>{const h=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(h),c(h)}),Yh(s.scrollbarY,()=>{const h=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(h),a(h)}),d?o.jsx(xn.div,{...r,ref:e,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Bv(t){return t?parseInt(t,10):0}function LL(t,e){const n=t/e;return isNaN(n)?0:n}function nb(t){const e=LL(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function ise(t,e,n,r="ltr"){const s=nb(n),i=s/2,a=e||i,l=s-a,c=n.scrollbar.paddingStart+a,d=n.scrollbar.size-n.scrollbar.paddingEnd-l,h=n.content-n.viewport,m=r==="ltr"?[0,h]:[h*-1,0];return BL([c,d],m)(t)}function Y9(t,e,n="ltr"){const r=nb(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,a=e.content-e.viewport,l=i-r,c=n==="ltr"?[0,a]:[a*-1,0],d=Sj(t,c);return BL([0,a],[0,l])(d)}function BL(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 FL(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},a=n.left!==i.left,l=n.top!==i.top;(a||l)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function rb(t,e){const n=Rs(t),r=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),b.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Yh(t,e){const n=Rs(e);Uh(()=>{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 qL=_L,ose=ML,lse=IL;const gn=b.forwardRef(({className:t,children:e,viewportRef:n,...r},s)=>o.jsxs(qL,{ref:s,className:xe("relative overflow-hidden",t),...r,children:[o.jsx(ose,{ref:n,className:"h-full w-full rounded-[inherit]",children:e}),o.jsx(hk,{}),o.jsx(hk,{orientation:"horizontal"}),o.jsx(lse,{})]}));gn.displayName=qL.displayName;const hk=b.forwardRef(({className:t,orientation:e="vertical",...n},r)=>o.jsx(Fj,{ref:r,orientation:e,className:xe("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:o.jsx(zL,{className:"relative flex-1 rounded-full bg-border"})}));hk.displayName=Fj.displayName;function cse({className:t,...e}){return o.jsx("div",{className:xe("animate-pulse rounded-md bg-primary/10",t),...e})}function use(t,e=[]){let n=[];function r(i,a){const l=b.createContext(a);l.displayName=i+"Context";const c=n.length;n=[...n,a];const d=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[c]||l,S=b.useMemo(()=>y,Object.values(y));return o.jsx(w.Provider,{value:S,children:x})};d.displayName=i+"Provider";function h(m,g){const x=g?.[t]?.[c]||l,y=b.useContext(x);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[d,h]}const s=()=>{const i=n.map(a=>b.createContext(a));return function(l){const c=l?.[t]||i;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,dse(s,...e)]}function dse(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((l,{useScope:c,scopeName:d})=>{const m=c(i)[`__scope${d}`];return{...l,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var hse=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$L=hse.reduce((t,e)=>{const n=Fy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Hj="Progress",Qj=100,[fse]=use(Hj),[mse,pse]=fse(Hj),HL=b.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=gse,...a}=t;(s||s===0)&&!K9(s)&&console.error(xse(`${s}`,"Progress"));const l=K9(s)?s:Qj;r!==null&&!Z9(r,l)&&console.error(vse(`${r}`,"Progress"));const c=Z9(r,l)?r:null,d=Fv(c)?i(c,l):void 0;return o.jsx(mse,{scope:n,value:c,max:l,children:o.jsx($L.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Fv(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":UL(c,l),"data-value":c??void 0,"data-max":l,...a,ref:e})})});HL.displayName=Hj;var QL="ProgressIndicator",VL=b.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=pse(QL,n);return o.jsx($L.div,{"data-state":UL(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});VL.displayName=QL;function gse(t,e){return`${Math.round(t/e*100)}%`}function UL(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function Fv(t){return typeof t=="number"}function K9(t){return Fv(t)&&!isNaN(t)&&t>0}function Z9(t,e){return Fv(t)&&!isNaN(t)&&t<=e&&t>=0}function xse(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Qj}\`.`}function vse(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: +`+v.stack}}var jt=Object.prototype.hasOwnProperty,vt=t.unstable_scheduleCallback,$n=t.unstable_cancelCallback,qt=t.unstable_shouldYield,un=t.unstable_requestPaint,Mt=t.unstable_now,ct=t.unstable_getCurrentPriorityLevel,Ne=t.unstable_ImmediatePriority,ze=t.unstable_UserBlockingPriority,rt=t.unstable_NormalPriority,bt=t.unstable_LowPriority,zt=t.unstable_IdlePriority,Rt=t.log,Hn=t.unstable_setDisableYieldValue,We=null,ot=null;function dn(u){if(typeof Rt=="function"&&Hn(u),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(We,u)}catch{}}var Pt=Math.clz32?Math.clz32:rn,xn=Math.log,dt=Math.LN2;function rn(u){return u>>>=0,u===0?32:31-(xn(u)/dt|0)|0}var wt=256,Wt=262144,Gt=4194304;function lt(u){var f=u&42;if(f!==0)return f;switch(u&-u){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function ve(u,f,p){var v=u.pendingLanes;if(v===0)return 0;var O=0,C=u.suspendedLanes,F=u.pingedLanes;u=u.warmLanes;var Z=v&134217727;return Z!==0?(v=Z&~C,v!==0?O=lt(v):(F&=Z,F!==0?O=lt(F):p||(p=Z&~u,p!==0&&(O=lt(p))))):(Z=v&~C,Z!==0?O=lt(Z):F!==0?O=lt(F):p||(p=v&~u,p!==0&&(O=lt(p)))),O===0?0:f!==0&&f!==O&&(f&C)===0&&(C=O&-O,p=f&-f,C>=p||C===32&&(p&4194048)!==0)?f:O}function He(u,f){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&f)===0}function ht(u,f){switch(u){case 1:case 2:case 4:case 8:case 64:return f+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 f+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 vn(){var u=Gt;return Gt<<=1,(Gt&62914560)===0&&(Gt=4194304),u}function Qn(u){for(var f=[],p=0;31>p;p++)f.push(u);return f}function fr(u,f){u.pendingLanes|=f,f!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function ar(u,f,p,v,O,C){var F=u.pendingLanes;u.pendingLanes=p,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=p,u.entangledLanes&=p,u.errorRecoveryDisabledLanes&=p,u.shellSuspendCounter=0;var Z=u.entanglements,de=u.expirationTimes,Se=u.hiddenUpdates;for(p=F&~p;0"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var fK=/[\n"\\]/g;function ia(u){return u.replace(fK,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function gw(u,f,p,v,O,C,F,Z){u.name="",F!=null&&typeof F!="function"&&typeof F!="symbol"&&typeof F!="boolean"?u.type=F:u.removeAttribute("type"),f!=null?F==="number"?(f===0&&u.value===""||u.value!=f)&&(u.value=""+sa(f)):u.value!==""+sa(f)&&(u.value=""+sa(f)):F!=="submit"&&F!=="reset"||u.removeAttribute("value"),f!=null?xw(u,F,sa(f)):p!=null?xw(u,F,sa(p)):v!=null&&u.removeAttribute("value"),O==null&&C!=null&&(u.defaultChecked=!!C),O!=null&&(u.checked=O&&typeof O!="function"&&typeof O!="symbol"),Z!=null&&typeof Z!="function"&&typeof Z!="symbol"&&typeof Z!="boolean"?u.name=""+sa(Z):u.removeAttribute("name")}function F7(u,f,p,v,O,C,F,Z){if(C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(u.type=C),f!=null||p!=null){if(!(C!=="submit"&&C!=="reset"||f!=null)){pw(u);return}p=p!=null?""+sa(p):"",f=f!=null?""+sa(f):p,Z||f===u.value||(u.value=f),u.defaultValue=f}v=v??O,v=typeof v!="function"&&typeof v!="symbol"&&!!v,u.checked=Z?u.checked:!!v,u.defaultChecked=!!v,F!=null&&typeof F!="function"&&typeof F!="symbol"&&typeof F!="boolean"&&(u.name=F),pw(u)}function xw(u,f,p){f==="number"&&qg(u.ownerDocument)===u||u.defaultValue===""+p||(u.defaultValue=""+p)}function Td(u,f,p,v){if(u=u.options,f){f={};for(var O=0;O"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Sw=!1;if(sl)try{var Xf={};Object.defineProperty(Xf,"passive",{get:function(){Sw=!0}}),window.addEventListener("test",Xf,Xf),window.removeEventListener("test",Xf,Xf)}catch{Sw=!1}var ic=null,kw=null,Hg=null;function W7(){if(Hg)return Hg;var u,f=kw,p=f.length,v,O="value"in ic?ic.value:ic.textContent,C=O.length;for(u=0;u=Zf),J7=" ",eC=!1;function tC(u,f){switch(u){case"keyup":return qK.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nC(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Md=!1;function HK(u,f){switch(u){case"compositionend":return nC(f);case"keypress":return f.which!==32?null:(eC=!0,J7);case"textInput":return u=f.data,u===J7&&eC?null:u;default:return null}}function QK(u,f){if(Md)return u==="compositionend"||!Tw&&tC(u,f)?(u=W7(),Hg=kw=ic=null,Md=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1=f)return{node:p,offset:f-u};u=v}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=uC(p)}}function hC(u,f){return u&&f?u===f?!0:u&&u.nodeType===3?!1:f&&f.nodeType===3?hC(u,f.parentNode):"contains"in u?u.contains(f):u.compareDocumentPosition?!!(u.compareDocumentPosition(f)&16):!1:!1}function fC(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var f=qg(u.document);f instanceof u.HTMLIFrameElement;){try{var p=typeof f.contentWindow.location.href=="string"}catch{p=!1}if(p)u=f.contentWindow;else break;f=qg(u.document)}return f}function Aw(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f&&(f==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||f==="textarea"||u.contentEditable==="true")}var ZK=sl&&"documentMode"in document&&11>=document.documentMode,Rd=null,Mw=null,nm=null,Rw=!1;function mC(u,f,p){var v=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Rw||Rd==null||Rd!==qg(v)||(v=Rd,"selectionStart"in v&&Aw(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),nm&&tm(nm,v)||(nm=v,v=zx(Mw,"onSelect"),0>=F,O-=F,lo=1<<32-Pt(f)+O|p<Jt?(bn=yt,yt=null):bn=yt.sibling;var Un=ke(pe,yt,be[Jt],Ae);if(Un===null){yt===null&&(yt=bn);break}u&&yt&&Un.alternate===null&&f(pe,yt),fe=C(Un,fe,Jt),Vn===null?Ct=Un:Vn.sibling=Un,Vn=Un,yt=bn}if(Jt===be.length)return p(pe,yt),On&&al(pe,Jt),Ct;if(yt===null){for(;JtJt?(bn=yt,yt=null):bn=yt.sibling;var Cc=ke(pe,yt,Un.value,Ae);if(Cc===null){yt===null&&(yt=bn);break}u&&yt&&Cc.alternate===null&&f(pe,yt),fe=C(Cc,fe,Jt),Vn===null?Ct=Cc:Vn.sibling=Cc,Vn=Cc,yt=bn}if(Un.done)return p(pe,yt),On&&al(pe,Jt),Ct;if(yt===null){for(;!Un.done;Jt++,Un=be.next())Un=Re(pe,Un.value,Ae),Un!==null&&(fe=C(Un,fe,Jt),Vn===null?Ct=Un:Vn.sibling=Un,Vn=Un);return On&&al(pe,Jt),Ct}for(yt=v(yt);!Un.done;Jt++,Un=be.next())Un=Ce(yt,pe,Jt,Un.value,Ae),Un!==null&&(u&&Un.alternate!==null&&yt.delete(Un.key===null?Jt:Un.key),fe=C(Un,fe,Jt),Vn===null?Ct=Un:Vn.sibling=Un,Vn=Un);return u&&yt.forEach(function(vJ){return f(pe,vJ)}),On&&al(pe,Jt),Ct}function rr(pe,fe,be,Ae){if(typeof be=="object"&&be!==null&&be.type===w&&be.key===null&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case x:e:{for(var Ct=be.key;fe!==null;){if(fe.key===Ct){if(Ct=be.type,Ct===w){if(fe.tag===7){p(pe,fe.sibling),Ae=O(fe,be.props.children),Ae.return=pe,pe=Ae;break e}}else if(fe.elementType===Ct||typeof Ct=="object"&&Ct!==null&&Ct.$$typeof===D&&Tu(Ct)===fe.type){p(pe,fe.sibling),Ae=O(fe,be.props),lm(Ae,be),Ae.return=pe,pe=Ae;break e}p(pe,fe);break}else f(pe,fe);fe=fe.sibling}be.type===w?(Ae=ku(be.props.children,pe.mode,Ae,be.key),Ae.return=pe,pe=Ae):(Ae=Jg(be.type,be.key,be.props,null,pe.mode,Ae),lm(Ae,be),Ae.return=pe,pe=Ae)}return F(pe);case y:e:{for(Ct=be.key;fe!==null;){if(fe.key===Ct)if(fe.tag===4&&fe.stateNode.containerInfo===be.containerInfo&&fe.stateNode.implementation===be.implementation){p(pe,fe.sibling),Ae=O(fe,be.children||[]),Ae.return=pe,pe=Ae;break e}else{p(pe,fe);break}else f(pe,fe);fe=fe.sibling}Ae=Fw(be,pe.mode,Ae),Ae.return=pe,pe=Ae}return F(pe);case D:return be=Tu(be),rr(pe,fe,be,Ae)}if(V(be))return ut(pe,fe,be,Ae);if(W(be)){if(Ct=W(be),typeof Ct!="function")throw Error(r(150));return be=Ct.call(be),Dt(pe,fe,be,Ae)}if(typeof be.then=="function")return rr(pe,fe,ax(be),Ae);if(be.$$typeof===N)return rr(pe,fe,nx(pe,be),Ae);ox(pe,be)}return typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint"?(be=""+be,fe!==null&&fe.tag===6?(p(pe,fe.sibling),Ae=O(fe,be),Ae.return=pe,pe=Ae):(p(pe,fe),Ae=Bw(be,pe.mode,Ae),Ae.return=pe,pe=Ae),F(pe)):p(pe,fe)}return function(pe,fe,be,Ae){try{om=0;var Ct=rr(pe,fe,be,Ae);return Qd=null,Ct}catch(yt){if(yt===Hd||yt===sx)throw yt;var Vn=Di(29,yt,null,pe.mode);return Vn.lanes=Ae,Vn.return=pe,Vn}finally{}}}var _u=IC(!0),LC=IC(!1),uc=!1;function Zw(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Jw(u,f){u=u.updateQueue,f.updateQueue===u&&(f.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function dc(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function hc(u,f,p){var v=u.updateQueue;if(v===null)return null;if(v=v.shared,(Gn&2)!==0){var O=v.pending;return O===null?f.next=f:(f.next=O.next,O.next=f),v.pending=f,f=Zg(u),wC(u,null,p),f}return Kg(u,v,f,p),Zg(u)}function cm(u,f,p){if(f=f.updateQueue,f!==null&&(f=f.shared,(p&4194048)!==0)){var v=f.lanes;v&=u.pendingLanes,p|=v,f.lanes=p,vs(u,p)}}function e2(u,f){var p=u.updateQueue,v=u.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var O=null,C=null;if(p=p.firstBaseUpdate,p!==null){do{var F={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};C===null?O=C=F:C=C.next=F,p=p.next}while(p!==null);C===null?O=C=f:C=C.next=f}else O=C=f;p={baseState:v.baseState,firstBaseUpdate:O,lastBaseUpdate:C,shared:v.shared,callbacks:v.callbacks},u.updateQueue=p;return}u=p.lastBaseUpdate,u===null?p.firstBaseUpdate=f:u.next=f,p.lastBaseUpdate=f}var t2=!1;function um(){if(t2){var u=$d;if(u!==null)throw u}}function dm(u,f,p,v){t2=!1;var O=u.updateQueue;uc=!1;var C=O.firstBaseUpdate,F=O.lastBaseUpdate,Z=O.shared.pending;if(Z!==null){O.shared.pending=null;var de=Z,Se=de.next;de.next=null,F===null?C=Se:F.next=Se,F=de;var Te=u.alternate;Te!==null&&(Te=Te.updateQueue,Z=Te.lastBaseUpdate,Z!==F&&(Z===null?Te.firstBaseUpdate=Se:Z.next=Se,Te.lastBaseUpdate=de))}if(C!==null){var Re=O.baseState;F=0,Te=Se=de=null,Z=C;do{var ke=Z.lane&-536870913,Ce=ke!==Z.lane;if(Ce?(yn&ke)===ke:(v&ke)===ke){ke!==0&&ke===qd&&(t2=!0),Te!==null&&(Te=Te.next={lane:0,tag:Z.tag,payload:Z.payload,callback:null,next:null});e:{var ut=u,Dt=Z;ke=f;var rr=p;switch(Dt.tag){case 1:if(ut=Dt.payload,typeof ut=="function"){Re=ut.call(rr,Re,ke);break e}Re=ut;break e;case 3:ut.flags=ut.flags&-65537|128;case 0:if(ut=Dt.payload,ke=typeof ut=="function"?ut.call(rr,Re,ke):ut,ke==null)break e;Re=m({},Re,ke);break e;case 2:uc=!0}}ke=Z.callback,ke!==null&&(u.flags|=64,Ce&&(u.flags|=8192),Ce=O.callbacks,Ce===null?O.callbacks=[ke]:Ce.push(ke))}else Ce={lane:ke,tag:Z.tag,payload:Z.payload,callback:Z.callback,next:null},Te===null?(Se=Te=Ce,de=Re):Te=Te.next=Ce,F|=ke;if(Z=Z.next,Z===null){if(Z=O.shared.pending,Z===null)break;Ce=Z,Z=Ce.next,Ce.next=null,O.lastBaseUpdate=Ce,O.shared.pending=null}}while(!0);Te===null&&(de=Re),O.baseState=de,O.firstBaseUpdate=Se,O.lastBaseUpdate=Te,C===null&&(O.shared.lanes=0),xc|=F,u.lanes=F,u.memoizedState=Re}}function BC(u,f){if(typeof u!="function")throw Error(r(191,u));u.call(f)}function FC(u,f){var p=u.callbacks;if(p!==null)for(u.callbacks=null,u=0;uC?C:8;var F=L.T,Z={};L.T=Z,b2(u,!1,f,p);try{var de=O(),Se=L.S;if(Se!==null&&Se(Z,de),de!==null&&typeof de=="object"&&typeof de.then=="function"){var Te=oZ(de,v);mm(u,f,Te,Bi(u))}else mm(u,f,v,Bi(u))}catch(Re){mm(u,f,{then:function(){},status:"rejected",reason:Re},Bi())}finally{$.p=C,F!==null&&Z.types!==null&&(F.types=Z.types),L.T=F}}function fZ(){}function v2(u,f,p,v){if(u.tag!==5)throw Error(r(476));var O=v8(u).queue;x8(u,O,f,K,p===null?fZ:function(){return y8(u),p(v)})}function v8(u){var f=u.memoizedState;if(f!==null)return f;f={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ul,lastRenderedState:K},next:null};var p={};return f.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ul,lastRenderedState:p},next:null},u.memoizedState=f,u=u.alternate,u!==null&&(u.memoizedState=f),f}function y8(u){var f=v8(u);f.next===null&&(f=u.alternate.memoizedState),mm(u,f.next.queue,{},Bi())}function y2(){return Ts(Am)}function b8(){return Vr().memoizedState}function w8(){return Vr().memoizedState}function mZ(u){for(var f=u.return;f!==null;){switch(f.tag){case 24:case 3:var p=Bi();u=dc(p);var v=hc(f,u,p);v!==null&&(mi(v,f,p),cm(v,f,p)),f={cache:Gw()},u.payload=f;return}f=f.return}}function pZ(u,f,p){var v=Bi();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},xx(u)?k8(f,p):(p=Iw(u,f,p,v),p!==null&&(mi(p,u,v),O8(p,f,v)))}function S8(u,f,p){var v=Bi();mm(u,f,p,v)}function mm(u,f,p,v){var O={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(xx(u))k8(f,O);else{var C=u.alternate;if(u.lanes===0&&(C===null||C.lanes===0)&&(C=f.lastRenderedReducer,C!==null))try{var F=f.lastRenderedState,Z=C(F,p);if(O.hasEagerState=!0,O.eagerState=Z,Ri(Z,F))return Kg(u,f,O,0),or===null&&Yg(),!1}catch{}finally{}if(p=Iw(u,f,O,v),p!==null)return mi(p,u,v),O8(p,f,v),!0}return!1}function b2(u,f,p,v){if(v={lane:2,revertLane:Z2(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},xx(u)){if(f)throw Error(r(479))}else f=Iw(u,p,v,2),f!==null&&mi(f,u,2)}function xx(u){var f=u.alternate;return u===Kt||f!==null&&f===Kt}function k8(u,f){Ud=ux=!0;var p=u.pending;p===null?f.next=f:(f.next=p.next,p.next=f),u.pending=f}function O8(u,f,p){if((p&4194048)!==0){var v=f.lanes;v&=u.pendingLanes,p|=v,f.lanes=p,vs(u,p)}}var pm={readContext:Ts,use:fx,useCallback:Br,useContext:Br,useEffect:Br,useImperativeHandle:Br,useLayoutEffect:Br,useInsertionEffect:Br,useMemo:Br,useReducer:Br,useRef:Br,useState:Br,useDebugValue:Br,useDeferredValue:Br,useTransition:Br,useSyncExternalStore:Br,useId:Br,useHostTransitionStatus:Br,useFormState:Br,useActionState:Br,useOptimistic:Br,useMemoCache:Br,useCacheRefresh:Br};pm.useEffectEvent=Br;var j8={readContext:Ts,use:fx,useCallback:function(u,f){return Ks().memoizedState=[u,f===void 0?null:f],u},useContext:Ts,useEffect:l8,useImperativeHandle:function(u,f,p){p=p!=null?p.concat([u]):null,px(4194308,4,h8.bind(null,f,u),p)},useLayoutEffect:function(u,f){return px(4194308,4,u,f)},useInsertionEffect:function(u,f){px(4,2,u,f)},useMemo:function(u,f){var p=Ks();f=f===void 0?null:f;var v=u();if(Au){dn(!0);try{u()}finally{dn(!1)}}return p.memoizedState=[v,f],v},useReducer:function(u,f,p){var v=Ks();if(p!==void 0){var O=p(f);if(Au){dn(!0);try{p(f)}finally{dn(!1)}}}else O=f;return v.memoizedState=v.baseState=O,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:O},v.queue=u,u=u.dispatch=pZ.bind(null,Kt,u),[v.memoizedState,u]},useRef:function(u){var f=Ks();return u={current:u},f.memoizedState=u},useState:function(u){u=f2(u);var f=u.queue,p=S8.bind(null,Kt,f);return f.dispatch=p,[u.memoizedState,p]},useDebugValue:g2,useDeferredValue:function(u,f){var p=Ks();return x2(p,u,f)},useTransition:function(){var u=f2(!1);return u=x8.bind(null,Kt,u.queue,!0,!1),Ks().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,f,p){var v=Kt,O=Ks();if(On){if(p===void 0)throw Error(r(407));p=p()}else{if(p=f(),or===null)throw Error(r(349));(yn&127)!==0||UC(v,f,p)}O.memoizedState=p;var C={value:p,getSnapshot:f};return O.queue=C,l8(GC.bind(null,v,C,u),[u]),v.flags|=2048,Gd(9,{destroy:void 0},WC.bind(null,v,C,p,f),null),p},useId:function(){var u=Ks(),f=or.identifierPrefix;if(On){var p=co,v=lo;p=(v&~(1<<32-Pt(v)-1)).toString(32)+p,f="_"+f+"R_"+p,p=dx++,0<\/script>",C=C.removeChild(C.firstChild);break;case"select":C=typeof v.is=="string"?F.createElement("select",{is:v.is}):F.createElement("select"),v.multiple?C.multiple=!0:v.size&&(C.size=v.size);break;default:C=typeof v.is=="string"?F.createElement(O,{is:v.is}):F.createElement(O)}}C[Mr]=f,C[Rr]=v;e:for(F=f.child;F!==null;){if(F.tag===5||F.tag===6)C.appendChild(F.stateNode);else if(F.tag!==4&&F.tag!==27&&F.child!==null){F.child.return=F,F=F.child;continue}if(F===f)break e;for(;F.sibling===null;){if(F.return===null||F.return===f)break e;F=F.return}F.sibling.return=F.return,F=F.sibling}f.stateNode=C;e:switch(_s(C,O,v),O){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&hl(f)}}return vr(f),D2(f,f.type,u===null?null:u.memoizedProps,f.pendingProps,p),null;case 6:if(u&&f.stateNode!=null)u.memoizedProps!==v&&hl(f);else{if(typeof v!="string"&&f.stateNode===null)throw Error(r(166));if(u=ne.current,Bd(f)){if(u=f.stateNode,p=f.memoizedProps,v=null,O=Cs,O!==null)switch(O.tag){case 27:case 5:v=O.memoizedProps}u[Mr]=f,u=!!(u.nodeValue===p||v!==null&&v.suppressHydrationWarning===!0||QT(u.nodeValue,p)),u||lc(f,!0)}else u=Ix(u).createTextNode(v),u[Mr]=f,f.stateNode=u}return vr(f),null;case 31:if(p=f.memoizedState,u===null||u.memoizedState!==null){if(v=Bd(f),p!==null){if(u===null){if(!v)throw Error(r(318));if(u=f.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[Mr]=f}else Ou(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;vr(f),u=!1}else p=Qw(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=p),u=!0;if(!u)return f.flags&256?(zi(f),f):(zi(f),null);if((f.flags&128)!==0)throw Error(r(558))}return vr(f),null;case 13:if(v=f.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(O=Bd(f),v!==null&&v.dehydrated!==null){if(u===null){if(!O)throw Error(r(318));if(O=f.memoizedState,O=O!==null?O.dehydrated:null,!O)throw Error(r(317));O[Mr]=f}else Ou(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;vr(f),O=!1}else O=Qw(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=O),O=!0;if(!O)return f.flags&256?(zi(f),f):(zi(f),null)}return zi(f),(f.flags&128)!==0?(f.lanes=p,f):(p=v!==null,u=u!==null&&u.memoizedState!==null,p&&(v=f.child,O=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(O=v.alternate.memoizedState.cachePool.pool),C=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(C=v.memoizedState.cachePool.pool),C!==O&&(v.flags|=2048)),p!==u&&p&&(f.child.flags|=8192),Sx(f,f.updateQueue),vr(f),null);case 4:return re(),u===null&&n4(f.stateNode.containerInfo),vr(f),null;case 10:return ll(f.type),vr(f),null;case 19:if(X(Qr),v=f.memoizedState,v===null)return vr(f),null;if(O=(f.flags&128)!==0,C=v.rendering,C===null)if(O)xm(v,!1);else{if(Fr!==0||u!==null&&(u.flags&128)!==0)for(u=f.child;u!==null;){if(C=cx(u),C!==null){for(f.flags|=128,xm(v,!1),u=C.updateQueue,f.updateQueue=u,Sx(f,u),f.subtreeFlags=0,u=p,p=f.child;p!==null;)SC(p,u),p=p.sibling;return z(Qr,Qr.current&1|2),On&&al(f,v.treeForkCount),f.child}u=u.sibling}v.tail!==null&&Mt()>Cx&&(f.flags|=128,O=!0,xm(v,!1),f.lanes=4194304)}else{if(!O)if(u=cx(C),u!==null){if(f.flags|=128,O=!0,u=u.updateQueue,f.updateQueue=u,Sx(f,u),xm(v,!0),v.tail===null&&v.tailMode==="hidden"&&!C.alternate&&!On)return vr(f),null}else 2*Mt()-v.renderingStartTime>Cx&&p!==536870912&&(f.flags|=128,O=!0,xm(v,!1),f.lanes=4194304);v.isBackwards?(C.sibling=f.child,f.child=C):(u=v.last,u!==null?u.sibling=C:f.child=C,v.last=C)}return v.tail!==null?(u=v.tail,v.rendering=u,v.tail=u.sibling,v.renderingStartTime=Mt(),u.sibling=null,p=Qr.current,z(Qr,O?p&1|2:p&1),On&&al(f,v.treeForkCount),u):(vr(f),null);case 22:case 23:return zi(f),r2(),v=f.memoizedState!==null,u!==null?u.memoizedState!==null!==v&&(f.flags|=8192):v&&(f.flags|=8192),v?(p&536870912)!==0&&(f.flags&128)===0&&(vr(f),f.subtreeFlags&6&&(f.flags|=8192)):vr(f),p=f.updateQueue,p!==null&&Sx(f,p.retryQueue),p=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==p&&(f.flags|=2048),u!==null&&X(Cu),null;case 24:return p=null,u!==null&&(p=u.memoizedState.cache),f.memoizedState.cache!==p&&(f.flags|=2048),ll(Zr),vr(f),null;case 25:return null;case 30:return null}throw Error(r(156,f.tag))}function bZ(u,f){switch($w(f),f.tag){case 1:return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return ll(Zr),re(),u=f.flags,(u&65536)!==0&&(u&128)===0?(f.flags=u&-65537|128,f):null;case 26:case 27:case 5:return _e(f),null;case 31:if(f.memoizedState!==null){if(zi(f),f.alternate===null)throw Error(r(340));Ou()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 13:if(zi(f),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(r(340));Ou()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return X(Qr),null;case 4:return re(),null;case 10:return ll(f.type),null;case 22:case 23:return zi(f),r2(),u!==null&&X(Cu),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 24:return ll(Zr),null;case 25:return null;default:return null}}function X8(u,f){switch($w(f),f.tag){case 3:ll(Zr),re();break;case 26:case 27:case 5:_e(f);break;case 4:re();break;case 31:f.memoizedState!==null&&zi(f);break;case 13:zi(f);break;case 19:X(Qr);break;case 10:ll(f.type);break;case 22:case 23:zi(f),r2(),u!==null&&X(Cu);break;case 24:ll(Zr)}}function vm(u,f){try{var p=f.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var O=v.next;p=O;do{if((p.tag&u)===u){v=void 0;var C=p.create,F=p.inst;v=C(),F.destroy=v}p=p.next}while(p!==O)}}catch(Z){Zn(f,f.return,Z)}}function pc(u,f,p){try{var v=f.updateQueue,O=v!==null?v.lastEffect:null;if(O!==null){var C=O.next;v=C;do{if((v.tag&u)===u){var F=v.inst,Z=F.destroy;if(Z!==void 0){F.destroy=void 0,O=f;var de=p,Se=Z;try{Se()}catch(Te){Zn(O,de,Te)}}}v=v.next}while(v!==C)}}catch(Te){Zn(f,f.return,Te)}}function Y8(u){var f=u.updateQueue;if(f!==null){var p=u.stateNode;try{FC(f,p)}catch(v){Zn(u,u.return,v)}}}function K8(u,f,p){p.props=Mu(u.type,u.memoizedProps),p.state=u.memoizedState;try{p.componentWillUnmount()}catch(v){Zn(u,f,v)}}function ym(u,f){try{var p=u.ref;if(p!==null){switch(u.tag){case 26:case 27:case 5:var v=u.stateNode;break;case 30:v=u.stateNode;break;default:v=u.stateNode}typeof p=="function"?u.refCleanup=p(v):p.current=v}}catch(O){Zn(u,f,O)}}function uo(u,f){var p=u.ref,v=u.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(O){Zn(u,f,O)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(O){Zn(u,f,O)}else p.current=null}function Z8(u){var f=u.type,p=u.memoizedProps,v=u.stateNode;try{e:switch(f){case"button":case"input":case"select":case"textarea":p.autoFocus&&v.focus();break e;case"img":p.src?v.src=p.src:p.srcSet&&(v.srcset=p.srcSet)}}catch(O){Zn(u,u.return,O)}}function P2(u,f,p){try{var v=u.stateNode;$Z(v,u.type,p,f),v[Rr]=f}catch(O){Zn(u,u.return,O)}}function J8(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&Sc(u.type)||u.tag===4}function z2(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||J8(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&Sc(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function I2(u,f,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,f?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(u,f):(f=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,f.appendChild(u),p=p._reactRootContainer,p!=null||f.onclick!==null||(f.onclick=rl));else if(v!==4&&(v===27&&Sc(u.type)&&(p=u.stateNode,f=null),u=u.child,u!==null))for(I2(u,f,p),u=u.sibling;u!==null;)I2(u,f,p),u=u.sibling}function kx(u,f,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,f?p.insertBefore(u,f):p.appendChild(u);else if(v!==4&&(v===27&&Sc(u.type)&&(p=u.stateNode),u=u.child,u!==null))for(kx(u,f,p),u=u.sibling;u!==null;)kx(u,f,p),u=u.sibling}function eT(u){var f=u.stateNode,p=u.memoizedProps;try{for(var v=u.type,O=f.attributes;O.length;)f.removeAttributeNode(O[0]);_s(f,v,p),f[Mr]=u,f[Rr]=p}catch(C){Zn(u,u.return,C)}}var fl=!1,ts=!1,L2=!1,tT=typeof WeakSet=="function"?WeakSet:Set,ys=null;function wZ(u,f){if(u=u.containerInfo,i4=Qx,u=fC(u),Aw(u)){if("selectionStart"in u)var p={start:u.selectionStart,end:u.selectionEnd};else e:{p=(p=u.ownerDocument)&&p.defaultView||window;var v=p.getSelection&&p.getSelection();if(v&&v.rangeCount!==0){p=v.anchorNode;var O=v.anchorOffset,C=v.focusNode;v=v.focusOffset;try{p.nodeType,C.nodeType}catch{p=null;break e}var F=0,Z=-1,de=-1,Se=0,Te=0,Re=u,ke=null;t:for(;;){for(var Ce;Re!==p||O!==0&&Re.nodeType!==3||(Z=F+O),Re!==C||v!==0&&Re.nodeType!==3||(de=F+v),Re.nodeType===3&&(F+=Re.nodeValue.length),(Ce=Re.firstChild)!==null;)ke=Re,Re=Ce;for(;;){if(Re===u)break t;if(ke===p&&++Se===O&&(Z=F),ke===C&&++Te===v&&(de=F),(Ce=Re.nextSibling)!==null)break;Re=ke,ke=Re.parentNode}Re=Ce}p=Z===-1||de===-1?null:{start:Z,end:de}}else p=null}p=p||{start:0,end:0}}else p=null;for(a4={focusedElem:u,selectionRange:p},Qx=!1,ys=f;ys!==null;)if(f=ys,u=f.child,(f.subtreeFlags&1028)!==0&&u!==null)u.return=f,ys=u;else for(;ys!==null;){switch(f=ys,C=f.alternate,u=f.flags,f.tag){case 0:if((u&4)!==0&&(u=f.updateQueue,u=u!==null?u.events:null,u!==null))for(p=0;p title"))),_s(C,v,p),C[Mr]=u,Kr(C),v=C;break e;case"link":var F=o9("link","href",O).get(v+(p.href||""));if(F){for(var Z=0;Zrr&&(F=rr,rr=Dt,Dt=F);var pe=dC(Z,Dt),fe=dC(Z,rr);if(pe&&fe&&(Ce.rangeCount!==1||Ce.anchorNode!==pe.node||Ce.anchorOffset!==pe.offset||Ce.focusNode!==fe.node||Ce.focusOffset!==fe.offset)){var be=Re.createRange();be.setStart(pe.node,pe.offset),Ce.removeAllRanges(),Dt>rr?(Ce.addRange(be),Ce.extend(fe.node,fe.offset)):(be.setEnd(fe.node,fe.offset),Ce.addRange(be))}}}}for(Re=[],Ce=Z;Ce=Ce.parentNode;)Ce.nodeType===1&&Re.push({element:Ce,left:Ce.scrollLeft,top:Ce.scrollTop});for(typeof Z.focus=="function"&&Z.focus(),Z=0;Zp?32:p,L.T=null,p=V2,V2=null;var C=yc,F=vl;if(ls=0,Jd=yc=null,vl=0,(Gn&6)!==0)throw Error(r(331));var Z=Gn;if(Gn|=4,hT(C.current),cT(C,C.current,F,p),Gn=Z,jm(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(We,C)}catch{}return!0}finally{$.p=O,L.T=v,_T(u,f)}}function MT(u,f,p){f=oa(p,f),f=O2(u.stateNode,f,2),u=hc(u,f,2),u!==null&&(fr(u,2),ho(u))}function Zn(u,f,p){if(u.tag===3)MT(u,u,p);else for(;f!==null;){if(f.tag===3){MT(f,u,p);break}else if(f.tag===1){var v=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(vc===null||!vc.has(v))){u=oa(p,u),p=R8(2),v=hc(f,p,2),v!==null&&(D8(p,v,f,u),fr(v,2),ho(v));break}}f=f.return}}function X2(u,f,p){var v=u.pingCache;if(v===null){v=u.pingCache=new OZ;var O=new Set;v.set(f,O)}else O=v.get(f),O===void 0&&(O=new Set,v.set(f,O));O.has(p)||(q2=!0,O.add(p),u=EZ.bind(null,u,f,p),f.then(u,u))}function EZ(u,f,p){var v=u.pingCache;v!==null&&v.delete(f),u.pingedLanes|=u.suspendedLanes&p,u.warmLanes&=~p,or===u&&(yn&p)===p&&(Fr===4||Fr===3&&(yn&62914560)===yn&&300>Mt()-Nx?(Gn&2)===0&&eh(u,0):$2|=p,Zd===yn&&(Zd=0)),ho(u)}function RT(u,f){f===0&&(f=vn()),u=Su(u,f),u!==null&&(fr(u,f),ho(u))}function _Z(u){var f=u.memoizedState,p=0;f!==null&&(p=f.retryLane),RT(u,p)}function AZ(u,f){var p=0;switch(u.tag){case 31:case 13:var v=u.stateNode,O=u.memoizedState;O!==null&&(p=O.retryLane);break;case 19:v=u.stateNode;break;case 22:v=u.stateNode._retryCache;break;default:throw Error(r(314))}v!==null&&v.delete(f),RT(u,p)}function MZ(u,f){return vt(u,f)}var Rx=null,nh=null,Y2=!1,Dx=!1,K2=!1,wc=0;function ho(u){u!==nh&&u.next===null&&(nh===null?Rx=nh=u:nh=nh.next=u),Dx=!0,Y2||(Y2=!0,DZ())}function jm(u,f){if(!K2&&Dx){K2=!0;do for(var p=!1,v=Rx;v!==null;){if(u!==0){var O=v.pendingLanes;if(O===0)var C=0;else{var F=v.suspendedLanes,Z=v.pingedLanes;C=(1<<31-Pt(42|u)+1)-1,C&=O&~(F&~Z),C=C&201326741?C&201326741|1:C?C|2:0}C!==0&&(p=!0,IT(v,C))}else C=yn,C=ve(v,v===or?C:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(C&3)===0||He(v,C)||(p=!0,IT(v,C));v=v.next}while(p);K2=!1}}function RZ(){DT()}function DT(){Dx=Y2=!1;var u=0;wc!==0&&QZ()&&(u=wc);for(var f=Mt(),p=null,v=Rx;v!==null;){var O=v.next,C=PT(v,f);C===0?(v.next=null,p===null?Rx=O:p.next=O,O===null&&(nh=p)):(p=v,(u!==0||(C&3)!==0)&&(Dx=!0)),v=O}ls!==0&&ls!==5||jm(u),wc!==0&&(wc=0)}function PT(u,f){for(var p=u.suspendedLanes,v=u.pingedLanes,O=u.expirationTimes,C=u.pendingLanes&-62914561;0Z)break;var Te=de.transferSize,Re=de.initiatorType;Te&&VT(Re)&&(de=de.responseEnd,F+=Te*(de"u"?null:document;function r9(u,f,p){var v=rh;if(v&&typeof f=="string"&&f){var O=ia(f);O='link[rel="'+u+'"][href="'+O+'"]',typeof p=="string"&&(O+='[crossorigin="'+p+'"]'),n9.has(O)||(n9.add(O),u={rel:u,crossOrigin:p,href:f},v.querySelector(O)===null&&(f=v.createElement("link"),_s(f,"link",u),Kr(f),v.head.appendChild(f)))}}function JZ(u){yl.D(u),r9("dns-prefetch",u,null)}function eJ(u,f){yl.C(u,f),r9("preconnect",u,f)}function tJ(u,f,p){yl.L(u,f,p);var v=rh;if(v&&u&&f){var O='link[rel="preload"][as="'+ia(f)+'"]';f==="image"&&p&&p.imageSrcSet?(O+='[imagesrcset="'+ia(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(O+='[imagesizes="'+ia(p.imageSizes)+'"]')):O+='[href="'+ia(u)+'"]';var C=O;switch(f){case"style":C=sh(u);break;case"script":C=ih(u)}fa.has(C)||(u=m({rel:"preload",href:f==="image"&&p&&p.imageSrcSet?void 0:u,as:f},p),fa.set(C,u),v.querySelector(O)!==null||f==="style"&&v.querySelector(Em(C))||f==="script"&&v.querySelector(_m(C))||(f=v.createElement("link"),_s(f,"link",u),Kr(f),v.head.appendChild(f)))}}function nJ(u,f){yl.m(u,f);var p=rh;if(p&&u){var v=f&&typeof f.as=="string"?f.as:"script",O='link[rel="modulepreload"][as="'+ia(v)+'"][href="'+ia(u)+'"]',C=O;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":C=ih(u)}if(!fa.has(C)&&(u=m({rel:"modulepreload",href:u},f),fa.set(C,u),p.querySelector(O)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(_m(C)))return}v=p.createElement("link"),_s(v,"link",u),Kr(v),p.head.appendChild(v)}}}function rJ(u,f,p){yl.S(u,f,p);var v=rh;if(v&&u){var O=sc(v).hoistableStyles,C=sh(u);f=f||"default";var F=O.get(C);if(!F){var Z={loading:0,preload:null};if(F=v.querySelector(Em(C)))Z.loading=5;else{u=m({rel:"stylesheet",href:u,"data-precedence":f},p),(p=fa.get(C))&&f4(u,p);var de=F=v.createElement("link");Kr(de),_s(de,"link",u),de._p=new Promise(function(Se,Te){de.onload=Se,de.onerror=Te}),de.addEventListener("load",function(){Z.loading|=1}),de.addEventListener("error",function(){Z.loading|=2}),Z.loading|=4,Bx(F,f,v)}F={type:"stylesheet",instance:F,count:1,state:Z},O.set(C,F)}}}function sJ(u,f){yl.X(u,f);var p=rh;if(p&&u){var v=sc(p).hoistableScripts,O=ih(u),C=v.get(O);C||(C=p.querySelector(_m(O)),C||(u=m({src:u,async:!0},f),(f=fa.get(O))&&m4(u,f),C=p.createElement("script"),Kr(C),_s(C,"link",u),p.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},v.set(O,C))}}function iJ(u,f){yl.M(u,f);var p=rh;if(p&&u){var v=sc(p).hoistableScripts,O=ih(u),C=v.get(O);C||(C=p.querySelector(_m(O)),C||(u=m({src:u,async:!0,type:"module"},f),(f=fa.get(O))&&m4(u,f),C=p.createElement("script"),Kr(C),_s(C,"link",u),p.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},v.set(O,C))}}function s9(u,f,p,v){var O=(O=ne.current)?Lx(O):null;if(!O)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(f=sh(p.href),p=sc(O).hoistableStyles,v=p.get(f),v||(v={type:"style",instance:null,count:0,state:null},p.set(f,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){u=sh(p.href);var C=sc(O).hoistableStyles,F=C.get(u);if(F||(O=O.ownerDocument||O,F={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},C.set(u,F),(C=O.querySelector(Em(u)))&&!C._p&&(F.instance=C,F.state.loading=5),fa.has(u)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},fa.set(u,p),C||aJ(O,u,p,F.state))),f&&v===null)throw Error(r(528,""));return F}if(f&&v!==null)throw Error(r(529,""));return null;case"script":return f=p.async,p=p.src,typeof p=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?(f=ih(p),p=sc(O).hoistableScripts,v=p.get(f),v||(v={type:"script",instance:null,count:0,state:null},p.set(f,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,u))}}function sh(u){return'href="'+ia(u)+'"'}function Em(u){return'link[rel="stylesheet"]['+u+"]"}function i9(u){return m({},u,{"data-precedence":u.precedence,precedence:null})}function aJ(u,f,p,v){u.querySelector('link[rel="preload"][as="style"]['+f+"]")?v.loading=1:(f=u.createElement("link"),v.preload=f,f.addEventListener("load",function(){return v.loading|=1}),f.addEventListener("error",function(){return v.loading|=2}),_s(f,"link",p),Kr(f),u.head.appendChild(f))}function ih(u){return'[src="'+ia(u)+'"]'}function _m(u){return"script[async]"+u}function a9(u,f,p){if(f.count++,f.instance===null)switch(f.type){case"style":var v=u.querySelector('style[data-href~="'+ia(p.href)+'"]');if(v)return f.instance=v,Kr(v),v;var O=m({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return v=(u.ownerDocument||u).createElement("style"),Kr(v),_s(v,"style",O),Bx(v,p.precedence,u),f.instance=v;case"stylesheet":O=sh(p.href);var C=u.querySelector(Em(O));if(C)return f.state.loading|=4,f.instance=C,Kr(C),C;v=i9(p),(O=fa.get(O))&&f4(v,O),C=(u.ownerDocument||u).createElement("link"),Kr(C);var F=C;return F._p=new Promise(function(Z,de){F.onload=Z,F.onerror=de}),_s(C,"link",v),f.state.loading|=4,Bx(C,p.precedence,u),f.instance=C;case"script":return C=ih(p.src),(O=u.querySelector(_m(C)))?(f.instance=O,Kr(O),O):(v=p,(O=fa.get(C))&&(v=m({},p),m4(v,O)),u=u.ownerDocument||u,O=u.createElement("script"),Kr(O),_s(O,"link",v),u.head.appendChild(O),f.instance=O);case"void":return null;default:throw Error(r(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(v=f.instance,f.state.loading|=4,Bx(v,p.precedence,u));return f.instance}function Bx(u,f,p){for(var v=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),O=v.length?v[v.length-1]:null,C=O,F=0;F title"):null)}function oJ(u,f,p){if(p===1||f.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;switch(f.rel){case"stylesheet":return u=f.disabled,typeof f.precedence=="string"&&u==null;default:return!0}case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function c9(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function lJ(u,f,p,v){if(p.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var O=sh(v.href),C=f.querySelector(Em(O));if(C){f=C._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(u.count++,u=qx.bind(u),f.then(u,u)),p.state.loading|=4,p.instance=C,Kr(C);return}C=f.ownerDocument||f,v=i9(v),(O=fa.get(O))&&f4(v,O),C=C.createElement("link"),Kr(C);var F=C;F._p=new Promise(function(Z,de){F.onload=Z,F.onerror=de}),_s(C,"link",v),p.instance=C}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(p,f),(f=p.state.preload)&&(p.state.loading&3)===0&&(u.count++,p=qx.bind(u),f.addEventListener("load",p),f.addEventListener("error",p))}}var p4=0;function cJ(u,f){return u.stylesheets&&u.count===0&&Hx(u,u.stylesheets),0p4?50:800)+f);return u.unsuspend=p,function(){u.unsuspend=null,clearTimeout(v),clearTimeout(O)}}:null}function qx(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hx(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var $x=null;function Hx(u,f){u.stylesheets=null,u.unsuspend!==null&&(u.count++,$x=new Map,f.forEach(uJ,u),$x=null,qx.call(u))}function uJ(u,f){if(!(f.state.loading&4)){var p=$x.get(u);if(p)var v=p.get(null);else{p=new Map,$x.set(u,p);for(var O=u.querySelectorAll("link[data-precedence],style[data-precedence]"),C=0;C"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),O4.exports=yte(),O4.exports}var wte=bte();function _I(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ste}=Object.prototype,{getPrototypeOf:Bj}=Object,{iterator:Jy,toStringTag:AI}=Symbol,eb=(t=>e=>{const n=Ste.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),no=t=>(t=t.toLowerCase(),e=>eb(e)===t),tb=t=>e=>typeof e===t,{isArray:yf}=Array,Xh=tb("undefined");function Bp(t){return t!==null&&!Xh(t)&&t.constructor!==null&&!Xh(t.constructor)&&ki(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const MI=no("ArrayBuffer");function kte(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&MI(t.buffer),e}const Ote=tb("string"),ki=tb("function"),RI=tb("number"),Fp=t=>t!==null&&typeof t=="object",jte=t=>t===!0||t===!1,iv=t=>{if(eb(t)!=="object")return!1;const e=Bj(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(AI in t)&&!(Jy in t)},Nte=t=>{if(!Fp(t)||Bp(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Cte=no("Date"),Tte=no("File"),Ete=no("Blob"),_te=no("FileList"),Ate=t=>Fp(t)&&ki(t.pipe),Mte=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||ki(t.append)&&((e=eb(t))==="formdata"||e==="object"&&ki(t.toString)&&t.toString()==="[object FormData]"))},Rte=no("URLSearchParams"),[Dte,Pte,zte,Ite]=["ReadableStream","Request","Response","Headers"].map(no),Lte=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function qp(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),yf(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const Vu=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,PI=t=>!Xh(t)&&t!==Vu;function ck(){const{caseless:t,skipUndefined:e}=PI(this)&&this||{},n={},r=(s,i)=>{const a=t&&DI(n,i)||i;iv(n[a])&&iv(s)?n[a]=ck(n[a],s):iv(s)?n[a]=ck({},s):yf(s)?n[a]=s.slice():(!e||!Xh(s))&&(n[a]=s)};for(let s=0,i=arguments.length;s(qp(e,(s,i)=>{n&&ki(s)?t[i]=_I(s,n):t[i]=s},{allOwnKeys:r}),t),Fte=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),qte=(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)},$te=(t,e,n,r)=>{let s,i,a;const l={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)a=s[i],(!r||r(a,t,e))&&!l[a]&&(e[a]=t[a],l[a]=!0);t=n!==!1&&Bj(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Hte=(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},Qte=t=>{if(!t)return null;if(yf(t))return t;let e=t.length;if(!RI(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Vte=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Bj(Uint8Array)),Ute=(t,e)=>{const r=(t&&t[Jy]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},Wte=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Gte=no("HTMLFormElement"),Xte=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),P9=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Yte=no("RegExp"),zI=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};qp(n,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(r[i]=a||s)}),Object.defineProperties(t,r)},Kte=t=>{zI(t,(e,n)=>{if(ki(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(ki(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+"'")})}})},Zte=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return yf(t)?r(t):r(String(t).split(e)),n},Jte=()=>{},ene=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function tne(t){return!!(t&&ki(t.append)&&t[AI]==="FormData"&&t[Jy])}const nne=t=>{const e=new Array(10),n=(r,s)=>{if(Fp(r)){if(e.indexOf(r)>=0)return;if(Bp(r))return r;if(!("toJSON"in r)){e[s]=r;const i=yf(r)?[]:{};return qp(r,(a,l)=>{const c=n(a,s+1);!Xh(c)&&(i[l]=c)}),e[s]=void 0,i}}return r};return n(t,0)},rne=no("AsyncFunction"),sne=t=>t&&(Fp(t)||ki(t))&&ki(t.then)&&ki(t.catch),II=((t,e)=>t?setImmediate:e?((n,r)=>(Vu.addEventListener("message",({source:s,data:i})=>{s===Vu&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),Vu.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ki(Vu.postMessage)),ine=typeof queueMicrotask<"u"?queueMicrotask.bind(Vu):typeof process<"u"&&process.nextTick||II,ane=t=>t!=null&&ki(t[Jy]),je={isArray:yf,isArrayBuffer:MI,isBuffer:Bp,isFormData:Mte,isArrayBufferView:kte,isString:Ote,isNumber:RI,isBoolean:jte,isObject:Fp,isPlainObject:iv,isEmptyObject:Nte,isReadableStream:Dte,isRequest:Pte,isResponse:zte,isHeaders:Ite,isUndefined:Xh,isDate:Cte,isFile:Tte,isBlob:Ete,isRegExp:Yte,isFunction:ki,isStream:Ate,isURLSearchParams:Rte,isTypedArray:Vte,isFileList:_te,forEach:qp,merge:ck,extend:Bte,trim:Lte,stripBOM:Fte,inherits:qte,toFlatObject:$te,kindOf:eb,kindOfTest:no,endsWith:Hte,toArray:Qte,forEachEntry:Ute,matchAll:Wte,isHTMLForm:Gte,hasOwnProperty:P9,hasOwnProp:P9,reduceDescriptors:zI,freezeMethods:Kte,toObjectSet:Zte,toCamelCase:Xte,noop:Jte,toFiniteNumber:ene,findKey:DI,global:Vu,isContextDefined:PI,isSpecCompliantForm:tne,toJSONObject:nne,isAsyncFn:rne,isThenable:sne,setImmediate:II,asap:ine,isIterable:ane};function Zt(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}je.inherits(Zt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:je.toJSONObject(this.config),code:this.code,status:this.status}}});const LI=Zt.prototype,BI={};["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=>{BI[t]={value:t}});Object.defineProperties(Zt,BI);Object.defineProperty(LI,"isAxiosError",{value:!0});Zt.from=(t,e,n,r,s,i)=>{const a=Object.create(LI);je.toFlatObject(t,a,function(h){return h!==Error.prototype},d=>d!=="isAxiosError");const l=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return Zt.call(a,l,c,n,r,s),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",i&&Object.assign(a,i),a};const one=null;function uk(t){return je.isPlainObject(t)||je.isArray(t)}function FI(t){return je.endsWith(t,"[]")?t.slice(0,-2):t}function z9(t,e,n){return t?t.concat(e).map(function(s,i){return s=FI(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function lne(t){return je.isArray(t)&&!t.some(uk)}const cne=je.toFlatObject(je,{},null,function(e){return/^is[A-Z]/.test(e)});function nb(t,e,n){if(!je.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=je.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,S){return!je.isUndefined(S[w])});const r=n.metaTokens,s=n.visitor||h,i=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&je.isSpecCompliantForm(e);if(!je.isFunction(s))throw new TypeError("visitor must be a function");function d(y){if(y===null)return"";if(je.isDate(y))return y.toISOString();if(je.isBoolean(y))return y.toString();if(!c&&je.isBlob(y))throw new Zt("Blob is not supported. Use a Buffer instead.");return je.isArrayBuffer(y)||je.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function h(y,w,S){let k=y;if(y&&!S&&typeof y=="object"){if(je.endsWith(w,"{}"))w=r?w:w.slice(0,-2),y=JSON.stringify(y);else if(je.isArray(y)&&lne(y)||(je.isFileList(y)||je.endsWith(w,"[]"))&&(k=je.toArray(y)))return w=FI(w),k.forEach(function(N,T){!(je.isUndefined(N)||N===null)&&e.append(a===!0?z9([w],T,i):a===null?w:w+"[]",d(N))}),!1}return uk(y)?!0:(e.append(z9(S,w,i),d(y)),!1)}const m=[],g=Object.assign(cne,{defaultVisitor:h,convertValue:d,isVisitable:uk});function x(y,w){if(!je.isUndefined(y)){if(m.indexOf(y)!==-1)throw Error("Circular reference detected in "+w.join("."));m.push(y),je.forEach(y,function(k,j){(!(je.isUndefined(k)||k===null)&&s.call(e,k,je.isString(j)?j.trim():j,w,g))===!0&&x(k,w?w.concat(j):[j])}),m.pop()}}if(!je.isObject(t))throw new TypeError("data must be an object");return x(t),e}function I9(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Fj(t,e){this._pairs=[],t&&nb(t,this,e)}const qI=Fj.prototype;qI.append=function(e,n){this._pairs.push([e,n])};qI.toString=function(e){const n=e?function(r){return e.call(this,r,I9)}:I9;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function une(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function $I(t,e,n){if(!e)return t;const r=n&&n.encode||une;je.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=je.isURLSearchParams(e)?e.toString():new Fj(e,n).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class L9{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){je.forEach(this.handlers,function(r){r!==null&&e(r)})}}const HI={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},dne=typeof URLSearchParams<"u"?URLSearchParams:Fj,hne=typeof FormData<"u"?FormData:null,fne=typeof Blob<"u"?Blob:null,mne={isBrowser:!0,classes:{URLSearchParams:dne,FormData:hne,Blob:fne},protocols:["http","https","file","blob","url","data"]},qj=typeof window<"u"&&typeof document<"u",dk=typeof navigator=="object"&&navigator||void 0,pne=qj&&(!dk||["ReactNative","NativeScript","NS"].indexOf(dk.product)<0),gne=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",xne=qj&&window.location.href||"http://localhost",vne=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:qj,hasStandardBrowserEnv:pne,hasStandardBrowserWebWorkerEnv:gne,navigator:dk,origin:xne},Symbol.toStringTag,{value:"Module"})),$s={...vne,...mne};function yne(t,e){return nb(t,new $s.classes.URLSearchParams,{visitor:function(n,r,s,i){return $s.isNode&&je.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function bne(t){return je.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function wne(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return a=!a&&je.isArray(s)?s.length:a,c?(je.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!l):((!s[a]||!je.isObject(s[a]))&&(s[a]=[]),e(n,r,s[a],i)&&je.isArray(s[a])&&(s[a]=wne(s[a])),!l)}if(je.isFormData(t)&&je.isFunction(t.entries)){const n={};return je.forEachEntry(t,(r,s)=>{e(bne(r),s,n,0)}),n}return null}function Sne(t,e,n){if(je.isString(t))try{return(e||JSON.parse)(t),je.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const $p={transitional:HI,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=je.isObject(e);if(i&&je.isHTMLForm(e)&&(e=new FormData(e)),je.isFormData(e))return s?JSON.stringify(QI(e)):e;if(je.isArrayBuffer(e)||je.isBuffer(e)||je.isStream(e)||je.isFile(e)||je.isBlob(e)||je.isReadableStream(e))return e;if(je.isArrayBufferView(e))return e.buffer;if(je.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return yne(e,this.formSerializer).toString();if((l=je.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return nb(l?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Sne(e)):e}],transformResponse:[function(e){const n=this.transitional||$p.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(je.isResponse(e)||je.isReadableStream(e))return e;if(e&&je.isString(e)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?Zt.from(l,Zt.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$s.classes.FormData,Blob:$s.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};je.forEach(["delete","get","head","post","put","patch"],t=>{$p.headers[t]={}});const kne=je.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),One=t=>{const e={};let n,r,s;return t&&t.split(` +`).forEach(function(a){s=a.indexOf(":"),n=a.substring(0,s).trim().toLowerCase(),r=a.substring(s+1).trim(),!(!n||e[n]&&kne[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},B9=Symbol("internals");function Im(t){return t&&String(t).trim().toLowerCase()}function av(t){return t===!1||t==null?t:je.isArray(t)?t.map(av):String(t)}function jne(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 Nne=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function C4(t,e,n,r,s){if(je.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!je.isString(e)){if(je.isString(r))return e.indexOf(r)!==-1;if(je.isRegExp(r))return r.test(e)}}function Cne(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Tne(t,e){const n=je.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,a){return this[r].call(this,e,s,i,a)},configurable:!0})})}let Oi=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(l,c,d){const h=Im(c);if(!h)throw new Error("header name must be a non-empty string");const m=je.findKey(s,h);(!m||s[m]===void 0||d===!0||d===void 0&&s[m]!==!1)&&(s[m||c]=av(l))}const a=(l,c)=>je.forEach(l,(d,h)=>i(d,h,c));if(je.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(je.isString(e)&&(e=e.trim())&&!Nne(e))a(One(e),n);else if(je.isObject(e)&&je.isIterable(e)){let l={},c,d;for(const h of e){if(!je.isArray(h))throw TypeError("Object iterator must return a key-value pair");l[d=h[0]]=(c=l[d])?je.isArray(c)?[...c,h[1]]:[c,h[1]]:h[1]}a(l,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Im(e),e){const r=je.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return jne(s);if(je.isFunction(n))return n.call(this,s,r);if(je.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Im(e),e){const r=je.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||C4(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(a){if(a=Im(a),a){const l=je.findKey(r,a);l&&(!n||C4(r,r[l],l,n))&&(delete r[l],s=!0)}}return je.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||C4(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return je.forEach(this,(s,i)=>{const a=je.findKey(r,i);if(a){n[a]=av(s),delete n[i];return}const l=e?Cne(i):String(i).trim();l!==i&&delete n[i],n[l]=av(s),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return je.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&je.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[B9]=this[B9]={accessors:{}}).accessors,s=this.prototype;function i(a){const l=Im(a);r[l]||(Tne(s,a),r[l]=!0)}return je.isArray(e)?e.forEach(i):i(e),this}};Oi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);je.reduceDescriptors(Oi.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});je.freezeMethods(Oi);function T4(t,e){const n=this||$p,r=e||n,s=Oi.from(r.headers);let i=r.data;return je.forEach(t,function(l){i=l.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function VI(t){return!!(t&&t.__CANCEL__)}function bf(t,e,n){Zt.call(this,t??"canceled",Zt.ERR_CANCELED,e,n),this.name="CanceledError"}je.inherits(bf,Zt,{__CANCEL__:!0});function UI(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Zt("Request failed with status code "+n.status,[Zt.ERR_BAD_REQUEST,Zt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Ene(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function _ne(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,a;return e=e!==void 0?e:1e3,function(c){const d=Date.now(),h=r[i];a||(a=d),n[s]=c,r[s]=d;let m=i,g=0;for(;m!==s;)g+=n[m++],m=m%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),d-a{n=h,s=null,i&&(clearTimeout(i),i=null),t(...d)};return[(...d)=>{const h=Date.now(),m=h-n;m>=r?a(d,h):(s=d,i||(i=setTimeout(()=>{i=null,a(s)},r-m)))},()=>s&&a(s)]}const qv=(t,e,n=3)=>{let r=0;const s=_ne(50,250);return Ane(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,c=a-r,d=s(c),h=a<=l;r=a;const m={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:d||void 0,estimated:d&&l&&h?(l-a)/d:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(m)},n)},F9=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},q9=t=>(...e)=>je.asap(()=>t(...e)),Mne=$s.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,$s.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL($s.origin),$s.navigator&&/(msie|trident)/i.test($s.navigator.userAgent)):()=>!0,Rne=$s.hasStandardBrowserEnv?{write(t,e,n,r,s,i,a){if(typeof document>"u")return;const l=[`${t}=${encodeURIComponent(e)}`];je.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),je.isString(r)&&l.push(`path=${r}`),je.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),je.isString(a)&&l.push(`SameSite=${a}`),document.cookie=l.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Dne(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Pne(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function WI(t,e,n){let r=!Dne(e);return t&&(r||n==!1)?Pne(t,e):e}const $9=t=>t instanceof Oi?{...t}:t;function ad(t,e){e=e||{};const n={};function r(d,h,m,g){return je.isPlainObject(d)&&je.isPlainObject(h)?je.merge.call({caseless:g},d,h):je.isPlainObject(h)?je.merge({},h):je.isArray(h)?h.slice():h}function s(d,h,m,g){if(je.isUndefined(h)){if(!je.isUndefined(d))return r(void 0,d,m,g)}else return r(d,h,m,g)}function i(d,h){if(!je.isUndefined(h))return r(void 0,h)}function a(d,h){if(je.isUndefined(h)){if(!je.isUndefined(d))return r(void 0,d)}else return r(void 0,h)}function l(d,h,m){if(m in e)return r(d,h);if(m in t)return r(void 0,d)}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(d,h,m)=>s($9(d),$9(h),m,!0)};return je.forEach(Object.keys({...t,...e}),function(h){const m=c[h]||s,g=m(t[h],e[h],h);je.isUndefined(g)&&m!==l||(n[h]=g)}),n}const GI=t=>{const e=ad({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:l}=e;if(e.headers=a=Oi.from(a),e.url=$I(WI(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),je.isFormData(n)){if($s.hasStandardBrowserEnv||$s.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(je.isFunction(n.getHeaders)){const c=n.getHeaders(),d=["content-type","content-length"];Object.entries(c).forEach(([h,m])=>{d.includes(h.toLowerCase())&&a.set(h,m)})}}if($s.hasStandardBrowserEnv&&(r&&je.isFunction(r)&&(r=r(e)),r||r!==!1&&Mne(e.url))){const c=s&&i&&Rne.read(i);c&&a.set(s,c)}return e},zne=typeof XMLHttpRequest<"u",Ine=zne&&function(t){return new Promise(function(n,r){const s=GI(t);let i=s.data;const a=Oi.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:d}=s,h,m,g,x,y;function w(){x&&x(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(h),s.signal&&s.signal.removeEventListener("abort",h)}let S=new XMLHttpRequest;S.open(s.method.toUpperCase(),s.url,!0),S.timeout=s.timeout;function k(){if(!S)return;const N=Oi.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),E={data:!l||l==="text"||l==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:N,config:t,request:S};UI(function(A){n(A),w()},function(A){r(A),w()},E),S=null}"onloadend"in S?S.onloadend=k:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(k)},S.onabort=function(){S&&(r(new Zt("Request aborted",Zt.ECONNABORTED,t,S)),S=null)},S.onerror=function(T){const E=T&&T.message?T.message:"Network Error",_=new Zt(E,Zt.ERR_NETWORK,t,S);_.event=T||null,r(_),S=null},S.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||HI;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new Zt(T,E.clarifyTimeoutError?Zt.ETIMEDOUT:Zt.ECONNABORTED,t,S)),S=null},i===void 0&&a.setContentType(null),"setRequestHeader"in S&&je.forEach(a.toJSON(),function(T,E){S.setRequestHeader(E,T)}),je.isUndefined(s.withCredentials)||(S.withCredentials=!!s.withCredentials),l&&l!=="json"&&(S.responseType=s.responseType),d&&([g,y]=qv(d,!0),S.addEventListener("progress",g)),c&&S.upload&&([m,x]=qv(c),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",x)),(s.cancelToken||s.signal)&&(h=N=>{S&&(r(!N||N.type?new bf(null,t,S):N),S.abort(),S=null)},s.cancelToken&&s.cancelToken.subscribe(h),s.signal&&(s.signal.aborted?h():s.signal.addEventListener("abort",h)));const j=Ene(s.url);if(j&&$s.protocols.indexOf(j)===-1){r(new Zt("Unsupported protocol "+j+":",Zt.ERR_BAD_REQUEST,t));return}S.send(i||null)})},Lne=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(d){if(!s){s=!0,l();const h=d instanceof Error?d:this.reason;r.abort(h instanceof Zt?h:new bf(h instanceof Error?h.message:h))}};let a=e&&setTimeout(()=>{a=null,i(new Zt(`timeout ${e} of ms exceeded`,Zt.ETIMEDOUT))},e);const l=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),t=null)};t.forEach(d=>d.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>je.asap(l),c}},Bne=function*(t,e){let n=t.byteLength;if(n{const s=Fne(t,e);let i=0,a,l=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:d,value:h}=await s.next();if(d){l(),c.close();return}let m=h.byteLength;if(n){let g=i+=m;n(g)}c.enqueue(new Uint8Array(h))}catch(d){throw l(d),d}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},Q9=64*1024,{isFunction:e1}=je,$ne=(({Request:t,Response:e})=>({Request:t,Response:e}))(je.global),{ReadableStream:V9,TextEncoder:U9}=je.global,W9=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Hne=t=>{t=je.merge.call({skipUndefined:!0},$ne,t);const{fetch:e,Request:n,Response:r}=t,s=e?e1(e):typeof fetch=="function",i=e1(n),a=e1(r);if(!s)return!1;const l=s&&e1(V9),c=s&&(typeof U9=="function"?(y=>w=>y.encode(w))(new U9):async y=>new Uint8Array(await new n(y).arrayBuffer())),d=i&&l&&W9(()=>{let y=!1;const w=new n($s.origin,{body:new V9,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!w}),h=a&&l&&W9(()=>je.isReadableStream(new r("").body)),m={stream:h&&(y=>y.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!m[y]&&(m[y]=(w,S)=>{let k=w&&w[y];if(k)return k.call(w);throw new Zt(`Response type '${y}' is not supported`,Zt.ERR_NOT_SUPPORT,S)})});const g=async y=>{if(y==null)return 0;if(je.isBlob(y))return y.size;if(je.isSpecCompliantForm(y))return(await new n($s.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(je.isArrayBufferView(y)||je.isArrayBuffer(y))return y.byteLength;if(je.isURLSearchParams(y)&&(y=y+""),je.isString(y))return(await c(y)).byteLength},x=async(y,w)=>{const S=je.toFiniteNumber(y.getContentLength());return S??g(w)};return async y=>{let{url:w,method:S,data:k,signal:j,cancelToken:N,timeout:T,onDownloadProgress:E,onUploadProgress:_,responseType:A,headers:D,withCredentials:q="same-origin",fetchOptions:B}=GI(y),H=e||fetch;A=A?(A+"").toLowerCase():"text";let W=Lne([j,N&&N.toAbortSignal()],T),ee=null;const I=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let V;try{if(_&&d&&S!=="get"&&S!=="head"&&(V=await x(D,k))!==0){let ie=new n(w,{method:"POST",body:k,duplex:"half"}),X;if(je.isFormData(k)&&(X=ie.headers.get("content-type"))&&D.setContentType(X),ie.body){const[z,U]=F9(V,qv(q9(_)));k=H9(ie.body,Q9,z,U)}}je.isString(q)||(q=q?"include":"omit");const L=i&&"credentials"in n.prototype,$={...B,signal:W,method:S.toUpperCase(),headers:D.normalize().toJSON(),body:k,duplex:"half",credentials:L?q:void 0};ee=i&&new n(w,$);let K=await(i?H(ee,B):H(w,$));const Y=h&&(A==="stream"||A==="response");if(h&&(E||Y&&I)){const ie={};["status","statusText","headers"].forEach(te=>{ie[te]=K[te]});const X=je.toFiniteNumber(K.headers.get("content-length")),[z,U]=E&&F9(X,qv(q9(E),!0))||[];K=new r(H9(K.body,Q9,z,()=>{U&&U(),I&&I()}),ie)}A=A||"text";let R=await m[je.findKey(m,A)||"text"](K,y);return!Y&&I&&I(),await new Promise((ie,X)=>{UI(ie,X,{data:R,headers:Oi.from(K.headers),status:K.status,statusText:K.statusText,config:y,request:ee})})}catch(L){throw I&&I(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new Zt("Network Error",Zt.ERR_NETWORK,y,ee),{cause:L.cause||L}):Zt.from(L,L&&L.code,y,ee)}}},Qne=new Map,XI=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let a=i.length,l=a,c,d,h=Qne;for(;l--;)c=i[l],d=h.get(c),d===void 0&&h.set(c,d=l?new Map:Hne(e)),h=d;return d};XI();const $j={http:one,xhr:Ine,fetch:{get:XI}};je.forEach($j,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const G9=t=>`- ${t}`,Vne=t=>je.isFunction(t)||t===null||t===!1;function Une(t,e){t=je.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let a=0;a`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=n?a.length>1?`since : +`+a.map(G9).join(` +`):" "+G9(a[0]):"as no adapter specified";throw new Zt("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const YI={getAdapter:Une,adapters:$j};function E4(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new bf(null,t)}function X9(t){return E4(t),t.headers=Oi.from(t.headers),t.data=T4.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),YI.getAdapter(t.adapter||$p.adapter,t)(t).then(function(r){return E4(t),r.data=T4.call(t,t.transformResponse,r),r.headers=Oi.from(r.headers),r},function(r){return VI(r)||(E4(t),r&&r.response&&(r.response.data=T4.call(t,t.transformResponse,r.response),r.response.headers=Oi.from(r.response.headers))),Promise.reject(r)})}const KI="1.13.2",rb={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{rb[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const Y9={};rb.transitional=function(e,n,r){function s(i,a){return"[Axios v"+KI+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(e===!1)throw new Zt(s(a," has been removed"+(n?" in "+n:"")),Zt.ERR_DEPRECATED);return n&&!Y9[a]&&(Y9[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,a,l):!0}};rb.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function Wne(t,e,n){if(typeof t!="object")throw new Zt("options must be an object",Zt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],a=e[i];if(a){const l=t[i],c=l===void 0||a(l,i,t);if(c!==!0)throw new Zt("option "+i+" must be "+c,Zt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Zt("Unknown option "+i,Zt.ERR_BAD_OPTION)}}const ov={assertOptions:Wne,validators:rb},fo=ov.validators;let nd=class{constructor(e){this.defaults=e||{},this.interceptors={request:new L9,response:new L9}}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=ad(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ov.assertOptions(r,{silentJSONParsing:fo.transitional(fo.boolean),forcedJSONParsing:fo.transitional(fo.boolean),clarifyTimeoutError:fo.transitional(fo.boolean)},!1),s!=null&&(je.isFunction(s)?n.paramsSerializer={serialize:s}:ov.assertOptions(s,{encode:fo.function,serialize:fo.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ov.assertOptions(n,{baseUrl:fo.spelling("baseURL"),withXsrfToken:fo.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&je.merge(i.common,i[n.method]);i&&je.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=Oi.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(c=c&&w.synchronous,l.unshift(w.fulfilled,w.rejected))});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let h,m=0,g;if(!c){const y=[X9.bind(this),void 0];for(y.unshift(...l),y.push(...d),g=y.length,h=Promise.resolve(n);m{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(l=>{r.subscribe(l),i=l}).then(s);return a.cancel=function(){r.unsubscribe(i)},a},e(function(i,a,l){r.reason||(r.reason=new bf(i,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new ZI(function(s){e=s}),cancel:e}}};function Xne(t){return function(n){return t.apply(null,n)}}function Yne(t){return je.isObject(t)&&t.isAxiosError===!0}const hk={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(hk).forEach(([t,e])=>{hk[e]=t});function JI(t){const e=new nd(t),n=_I(nd.prototype.request,e);return je.extend(n,nd.prototype,e,{allOwnKeys:!0}),je.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return JI(ad(t,s))},n}const Cr=JI($p);Cr.Axios=nd;Cr.CanceledError=bf;Cr.CancelToken=Gne;Cr.isCancel=VI;Cr.VERSION=KI;Cr.toFormData=nb;Cr.AxiosError=Zt;Cr.Cancel=Cr.CanceledError;Cr.all=function(e){return Promise.all(e)};Cr.spread=Xne;Cr.isAxiosError=Yne;Cr.mergeConfig=ad;Cr.AxiosHeaders=Oi;Cr.formToJSON=t=>QI(je.isHTMLForm(t)?new FormData(t):t);Cr.getAdapter=YI.getAdapter;Cr.HttpStatusCode=hk;Cr.default=Cr;const{Axios:fPe,AxiosError:mPe,CanceledError:pPe,isCancel:gPe,CancelToken:xPe,VERSION:vPe,all:yPe,Cancel:bPe,isAxiosError:wPe,spread:SPe,toFormData:kPe,AxiosHeaders:OPe,HttpStatusCode:jPe,formToJSON:NPe,getAdapter:CPe,mergeConfig:TPe}=Cr,Kne=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),eL=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),$v="-",K9=[],Jne="arbitrary..",ere=t=>{const e=nre(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return tre(a);const l=a.split($v),c=l[0]===""&&l.length>1?1:0;return tL(l,c,e)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=r[a],d=n[a];return c?d?Kne(d,c):c:d||K9}return n[a]||K9}}},tL=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const d=tL(t,e+1,i);if(d)return d}const a=n.validators;if(a===null)return;const l=e===0?t.join($v):t.slice(e).join($v),c=a.length;for(let d=0;dt.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?Jne+r:void 0})(),nre=t=>{const{theme:e,classGroups:n}=t;return rre(n,e)},rre=(t,e)=>{const n=eL();for(const r in t){const s=t[r];Hj(s,n,r,e)}return n},Hj=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){ire(t,e,n);return}if(typeof t=="function"){are(t,e,n,r);return}ore(t,e,n,r)},ire=(t,e,n)=>{const r=t===""?e:nL(e,t);r.classGroupId=n},are=(t,e,n,r)=>{if(lre(t)){Hj(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(Zne(n,t))},ore=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let a=0;a{let n=t;const r=e.split($v),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,cre=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,a)=>{n[i]=a,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return s(i,a),a},set(i,a){i in n?n[i]=a:s(i,a)}}},fk="!",Z9=":",ure=[],J9=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),dre=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let a=0,l=0,c=0,d;const h=s.length;for(let w=0;wc?d-c:void 0;return J9(i,x,g,y)};if(e){const s=e+Z9,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):J9(ure,!1,a,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},hre=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},fre=t=>({cache:cre(t.cacheSize),parseClassName:dre(t),sortModifiers:hre(t),...ere(t)}),mre=/\s+/,pre=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,a=[],l=t.trim().split(mre);let c="";for(let d=l.length-1;d>=0;d-=1){const h=l[d],{isExternal:m,modifiers:g,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:w}=n(h);if(m){c=h+(c.length>0?" "+c:c);continue}let S=!!w,k=r(S?y.substring(0,w):y);if(!k){if(!S){c=h+(c.length>0?" "+c:c);continue}if(k=r(y),!k){c=h+(c.length>0?" "+c:c);continue}S=!1}const j=g.length===0?"":g.length===1?g[0]:i(g).join(":"),N=x?j+fk:j,T=N+k;if(a.indexOf(T)>-1)continue;a.push(T);const E=s(k,S);for(let _=0;_0?" "+c:c)}return c},gre=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const a=c=>{const d=e.reduce((h,m)=>m(h),t());return n=fre(d),r=n.cache.get,s=n.cache.set,i=l,l(c)},l=c=>{const d=r(c);if(d)return d;const h=pre(c,n);return s(c,h),h};return i=a,(...c)=>i(gre(...c))},vre=[],cs=t=>{const e=n=>n[t]||vre;return e.isThemeGetter=!0,e},sL=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,iL=/^\((?:(\w[\w-]*):)?(.+)\)$/i,yre=/^\d+\/\d+$/,bre=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,wre=/\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$/,Sre=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kre=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ore=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oh=t=>yre.test(t),sn=t=>!!t&&!Number.isNaN(Number(t)),Tc=t=>!!t&&Number.isInteger(Number(t)),_4=t=>t.endsWith("%")&&sn(t.slice(0,-1)),bl=t=>bre.test(t),jre=()=>!0,Nre=t=>wre.test(t)&&!Sre.test(t),aL=()=>!1,Cre=t=>kre.test(t),Tre=t=>Ore.test(t),Ere=t=>!ft(t)&&!mt(t),_re=t=>wf(t,cL,aL),ft=t=>sL.test(t),Pu=t=>wf(t,uL,Nre),A4=t=>wf(t,Pre,sn),eE=t=>wf(t,oL,aL),Are=t=>wf(t,lL,Tre),t1=t=>wf(t,dL,Cre),mt=t=>iL.test(t),Lm=t=>Sf(t,uL),Mre=t=>Sf(t,zre),tE=t=>Sf(t,oL),Rre=t=>Sf(t,cL),Dre=t=>Sf(t,lL),n1=t=>Sf(t,dL,!0),wf=(t,e,n)=>{const r=sL.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Sf=(t,e,n=!1)=>{const r=iL.exec(t);return r?r[1]?e(r[1]):n:!1},oL=t=>t==="position"||t==="percentage",lL=t=>t==="image"||t==="url",cL=t=>t==="length"||t==="size"||t==="bg-size",uL=t=>t==="length",Pre=t=>t==="number",zre=t=>t==="family-name",dL=t=>t==="shadow",Ire=()=>{const t=cs("color"),e=cs("font"),n=cs("text"),r=cs("font-weight"),s=cs("tracking"),i=cs("leading"),a=cs("breakpoint"),l=cs("container"),c=cs("spacing"),d=cs("radius"),h=cs("shadow"),m=cs("inset-shadow"),g=cs("text-shadow"),x=cs("drop-shadow"),y=cs("blur"),w=cs("perspective"),S=cs("aspect"),k=cs("ease"),j=cs("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...T(),mt,ft],_=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],D=()=>[mt,ft,c],q=()=>[oh,"full","auto",...D()],B=()=>[Tc,"none","subgrid",mt,ft],H=()=>["auto",{span:["full",Tc,mt,ft]},Tc,mt,ft],W=()=>[Tc,"auto",mt,ft],ee=()=>["auto","min","max","fr",mt,ft],I=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...D()],$=()=>[oh,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],K=()=>[t,mt,ft],Y=()=>[...T(),tE,eE,{position:[mt,ft]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ie=()=>["auto","cover","contain",Rre,_re,{size:[mt,ft]}],X=()=>[_4,Lm,Pu],z=()=>["","none","full",d,mt,ft],U=()=>["",sn,Lm,Pu],te=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[sn,_4,tE,eE],se=()=>["","none",y,mt,ft],re=()=>["none",sn,mt,ft],ae=()=>["none",sn,mt,ft],_e=()=>[sn,mt,ft],Be=()=>[oh,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[bl],breakpoint:[bl],color:[jre],container:[bl],"drop-shadow":[bl],ease:["in","out","in-out"],font:[Ere],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[bl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[bl],shadow:[bl],spacing:["px",sn],text:[bl],"text-shadow":[bl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",oh,ft,mt,S]}],container:["container"],columns:[{columns:[sn,ft,mt,l]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{start:q()}],end:[{end:q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[Tc,"auto",mt,ft]}],basis:[{basis:[oh,"full","auto",l,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[sn,oh,"auto","initial","none",ft]}],grow:[{grow:["",sn,mt,ft]}],shrink:[{shrink:["",sn,mt,ft]}],order:[{order:[Tc,"first","last","none",mt,ft]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...I(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...I()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":I()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],w:[{w:[l,"screen",...$()]}],"min-w":[{"min-w":[l,"screen","none",...$()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",n,Lm,Pu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,mt,A4]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_4,ft]}],"font-family":[{font:[Mre,ft,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,mt,ft]}],"line-clamp":[{"line-clamp":[sn,"none",mt,A4]}],leading:[{leading:[i,...D()]}],"list-image":[{"list-image":["none",mt,ft]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",mt,ft]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[sn,"from-font","auto",mt,Pu]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[sn,"auto",mt,ft]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mt,ft]}],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",mt,ft]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Tc,mt,ft],radial:["",mt,ft],conic:[Tc,mt,ft]},Dre,Are]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[sn,mt,ft]}],"outline-w":[{outline:["",sn,Lm,Pu]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",h,n1,t1]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",m,n1,t1]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[sn,Pu]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",g,n1,t1]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[sn,mt,ft]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[sn]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[mt,ft]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[sn]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",mt,ft]}],filter:[{filter:["","none",mt,ft]}],blur:[{blur:se()}],brightness:[{brightness:[sn,mt,ft]}],contrast:[{contrast:[sn,mt,ft]}],"drop-shadow":[{"drop-shadow":["","none",x,n1,t1]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",sn,mt,ft]}],"hue-rotate":[{"hue-rotate":[sn,mt,ft]}],invert:[{invert:["",sn,mt,ft]}],saturate:[{saturate:[sn,mt,ft]}],sepia:[{sepia:["",sn,mt,ft]}],"backdrop-filter":[{"backdrop-filter":["","none",mt,ft]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[sn,mt,ft]}],"backdrop-contrast":[{"backdrop-contrast":[sn,mt,ft]}],"backdrop-grayscale":[{"backdrop-grayscale":["",sn,mt,ft]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[sn,mt,ft]}],"backdrop-invert":[{"backdrop-invert":["",sn,mt,ft]}],"backdrop-opacity":[{"backdrop-opacity":[sn,mt,ft]}],"backdrop-saturate":[{"backdrop-saturate":[sn,mt,ft]}],"backdrop-sepia":[{"backdrop-sepia":["",sn,mt,ft]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",mt,ft]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[sn,"initial",mt,ft]}],ease:[{ease:["linear","initial",k,mt,ft]}],delay:[{delay:[sn,mt,ft]}],animate:[{animate:["none",j,mt,ft]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,mt,ft]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[mt,ft,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Be()}],"translate-x":[{"translate-x":Be()}],"translate-y":[{"translate-y":Be()}],"translate-z":[{"translate-z":Be()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"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",mt,ft]}],"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":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",mt,ft]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[sn,Lm,Pu,A4]}],stroke:[{stroke:["none",...K()]}],"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"]}},Lre=xre(Ire);function xe(...t){return Lre(Qz(t))}const Lt=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Lt.displayName="Card";const En=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-6",t),...e}));En.displayName="CardHeader";const _n=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("font-semibold leading-none tracking-tight",t),...e}));_n.displayName="CardTitle";const Wr=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("text-sm text-muted-foreground",t),...e}));Wr.displayName="CardDescription";const Xn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("p-6 pt-0",t),...e}));Xn.displayName="CardContent";const hL=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",t),...e}));hL.displayName="CardFooter";var M4="rovingFocusGroup.onEntryFocus",Bre={bubbles:!1,cancelable:!0},Hp="RovingFocusGroup",[mk,fL,Fre]=Qy(Hp),[qre,sb]=Da(Hp,[Fre]),[$re,Hre]=qre(Hp),mL=b.forwardRef((t,e)=>o.jsx(mk.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(mk.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(Qre,{...t,ref:e})})}));mL.displayName=Hp;var Qre=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:h=!1,...m}=t,g=b.useRef(null),x=er(e,g),y=Rp(i),[w,S]=Kl({prop:a,defaultProp:l??null,onChange:c,caller:Hp}),[k,j]=b.useState(!1),N=Rs(d),T=fL(n),E=b.useRef(!1),[_,A]=b.useState(0);return b.useEffect(()=>{const D=g.current;if(D)return D.addEventListener(M4,N),()=>D.removeEventListener(M4,N)},[N]),o.jsx($re,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:w,onItemFocus:b.useCallback(D=>S(D),[S]),onItemShiftTab:b.useCallback(()=>j(!0),[]),onFocusableItemAdd:b.useCallback(()=>A(D=>D+1),[]),onFocusableItemRemove:b.useCallback(()=>A(D=>D-1),[]),children:o.jsx(Sn.div,{tabIndex:k||_===0?-1:0,"data-orientation":r,...m,ref:x,style:{outline:"none",...t.style},onMouseDown:nt(t.onMouseDown,()=>{E.current=!0}),onFocus:nt(t.onFocus,D=>{const q=!E.current;if(D.target===D.currentTarget&&q&&!k){const B=new CustomEvent(M4,Bre);if(D.currentTarget.dispatchEvent(B),!B.defaultPrevented){const H=T().filter(L=>L.focusable),W=H.find(L=>L.active),ee=H.find(L=>L.id===w),V=[W,ee,...H].filter(Boolean).map(L=>L.ref.current);xL(V,h)}}E.current=!1}),onBlur:nt(t.onBlur,()=>j(!1))})})}),pL="RovingFocusGroupItem",gL=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...l}=t,c=Gi(),d=i||c,h=Hre(pL,n),m=h.currentTabStopId===d,g=fL(n),{onFocusableItemAdd:x,onFocusableItemRemove:y,currentTabStopId:w}=h;return b.useEffect(()=>{if(r)return x(),()=>y()},[r,x,y]),o.jsx(mk.ItemSlot,{scope:n,id:d,focusable:r,active:s,children:o.jsx(Sn.span,{tabIndex:m?0:-1,"data-orientation":h.orientation,...l,ref:e,onMouseDown:nt(t.onMouseDown,S=>{r?h.onItemFocus(d):S.preventDefault()}),onFocus:nt(t.onFocus,()=>h.onItemFocus(d)),onKeyDown:nt(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){h.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const k=Wre(S,h.orientation,h.dir);if(k!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let N=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")N.reverse();else if(k==="prev"||k==="next"){k==="prev"&&N.reverse();const T=N.indexOf(S.currentTarget);N=h.loop?Gre(N,T+1):N.slice(T+1)}setTimeout(()=>xL(N))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:w!=null}):a})})});gL.displayName=pL;var Vre={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ure(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Wre(t,e,n){const r=Ure(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Vre[r]}function xL(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Gre(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var vL=mL,yL=gL,ib="Tabs",[Xre]=Da(ib,[sb]),bL=sb(),[Yre,Qj]=Xre(ib),wL=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:c="automatic",...d}=t,h=Rp(l),[m,g]=Kl({prop:r,onChange:s,defaultProp:i??"",caller:ib});return o.jsx(Yre,{scope:n,baseId:Gi(),value:m,onValueChange:g,orientation:a,dir:h,activationMode:c,children:o.jsx(Sn.div,{dir:h,"data-orientation":a,...d,ref:e})})});wL.displayName=ib;var SL="TabsList",kL=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=Qj(SL,n),a=bL(n);return o.jsx(vL,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:o.jsx(Sn.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});kL.displayName=SL;var OL="TabsTrigger",jL=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,a=Qj(OL,n),l=bL(n),c=TL(a.baseId,r),d=EL(a.baseId,r),h=r===a.value;return o.jsx(yL,{asChild:!0,...l,focusable:!s,active:h,children:o.jsx(Sn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":d,"data-state":h?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:nt(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?a.onValueChange(r):m.preventDefault()}),onKeyDown:nt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&a.onValueChange(r)}),onFocus:nt(t.onFocus,()=>{const m=a.activationMode!=="manual";!h&&!s&&m&&a.onValueChange(r)})})})});jL.displayName=OL;var NL="TabsContent",CL=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...a}=t,l=Qj(NL,n),c=TL(l.baseId,r),d=EL(l.baseId,r),h=r===l.value,m=b.useRef(h);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),o.jsx(oi,{present:s||h,children:({present:g})=>o.jsx(Sn.div,{"data-state":h?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:d,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});CL.displayName=NL;function TL(t,e){return`${t}-trigger-${e}`}function EL(t,e){return`${t}-content-${e}`}var Kre=wL,_L=kL,AL=jL,ML=CL;const Yi=Kre,ji=b.forwardRef(({className:t,...e},n)=>o.jsx(_L,{ref:n,className:xe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ji.displayName=_L.displayName;const Bt=b.forwardRef(({className:t,...e},n)=>o.jsx(AL,{ref:n,className:xe("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}));Bt.displayName=AL.displayName;const ln=b.forwardRef(({className:t,...e},n)=>o.jsx(ML,{ref:n,className:xe("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}));ln.displayName=ML.displayName;function Zre(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var Vj="ScrollArea",[RL]=Da(Vj),[Jre,Pa]=RL(Vj),DL=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...a}=t,[l,c]=b.useState(null),[d,h]=b.useState(null),[m,g]=b.useState(null),[x,y]=b.useState(null),[w,S]=b.useState(null),[k,j]=b.useState(0),[N,T]=b.useState(0),[E,_]=b.useState(!1),[A,D]=b.useState(!1),q=er(e,H=>c(H)),B=Rp(s);return o.jsx(Jre,{scope:n,type:r,dir:B,scrollHideDelay:i,scrollArea:l,viewport:d,onViewportChange:h,content:m,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:E,onScrollbarXEnabledChange:_,scrollbarY:w,onScrollbarYChange:S,scrollbarYEnabled:A,onScrollbarYEnabledChange:D,onCornerWidthChange:j,onCornerHeightChange:T,children:o.jsx(Sn.div,{dir:B,...a,ref:q,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":N+"px",...t.style}})})});DL.displayName=Vj;var PL="ScrollAreaViewport",zL=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,a=Pa(PL,n),l=b.useRef(null),c=er(e,l,a.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),o.jsx(Sn.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:o.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});zL.displayName=PL;var Ho="ScrollAreaScrollbar",Uj=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Pa(Ho,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=s,l=t.orientation==="horizontal";return b.useEffect(()=>(l?i(!0):a(!0),()=>{l?i(!1):a(!1)}),[l,i,a]),s.type==="hover"?o.jsx(ese,{...r,ref:e,forceMount:n}):s.type==="scroll"?o.jsx(tse,{...r,ref:e,forceMount:n}):s.type==="auto"?o.jsx(IL,{...r,ref:e,forceMount:n}):s.type==="always"?o.jsx(Wj,{...r,ref:e}):null});Uj.displayName=Ho;var ese=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Pa(Ho,t.__scopeScrollArea),[i,a]=b.useState(!1);return b.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),a(!0)},h=()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",h),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",h)}}},[s.scrollArea,s.scrollHideDelay]),o.jsx(oi,{present:n||i,children:o.jsx(IL,{"data-state":i?"visible":"hidden",...r,ref:e})})}),tse=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Pa(Ho,t.__scopeScrollArea),i=t.orientation==="horizontal",a=ob(()=>c("SCROLL_END"),100),[l,c]=Zre("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return b.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,s.scrollHideDelay,c]),b.useEffect(()=>{const d=s.viewport,h=i?"scrollLeft":"scrollTop";if(d){let m=d[h];const g=()=>{const x=d[h];m!==x&&(c("SCROLL"),a()),m=x};return d.addEventListener("scroll",g),()=>d.removeEventListener("scroll",g)}},[s.viewport,i,c,a]),o.jsx(oi,{present:n||l!=="hidden",children:o.jsx(Wj,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:nt(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:nt(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),IL=b.forwardRef((t,e)=>{const n=Pa(Ho,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,a]=b.useState(!1),l=t.orientation==="horizontal",c=ob(()=>{if(n.viewport){const d=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=Pa(Ho,t.__scopeScrollArea),i=b.useRef(null),a=b.useRef(0),[l,c]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=$L(l.viewport,l.content),h={...r,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:g=>a.current=g};function m(g,x){return ose(g,a.current,l,x)}return n==="horizontal"?o.jsx(nse,{...h,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollLeft,x=nE(g,l,s.dir);i.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollLeft=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollLeft=m(g,s.dir))}}):n==="vertical"?o.jsx(rse,{...h,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollTop,x=nE(g,l);i.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollTop=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollTop=m(g))}}):null}),nse=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Pa(Ho,t.__scopeScrollArea),[a,l]=b.useState(),c=b.useRef(null),d=er(e,c,i.onScrollbarXChange);return b.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(BL,{"data-orientation":"horizontal",...s,ref:d,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":ab(n)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.x),onDragScroll:h=>t.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(i.viewport){const g=i.viewport.scrollLeft+h.deltaX;t.onWheelScroll(g),QL(g,m)&&h.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Qv(a.paddingLeft),paddingEnd:Qv(a.paddingRight)}})}})}),rse=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=Pa(Ho,t.__scopeScrollArea),[a,l]=b.useState(),c=b.useRef(null),d=er(e,c,i.onScrollbarYChange);return b.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(BL,{"data-orientation":"vertical",...s,ref:d,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":ab(n)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.y),onDragScroll:h=>t.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(i.viewport){const g=i.viewport.scrollTop+h.deltaY;t.onWheelScroll(g),QL(g,m)&&h.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Qv(a.paddingTop),paddingEnd:Qv(a.paddingBottom)}})}})}),[sse,LL]=RL(Ho),BL=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:h,onResize:m,...g}=t,x=Pa(Ho,n),[y,w]=b.useState(null),S=er(e,q=>w(q)),k=b.useRef(null),j=b.useRef(""),N=x.viewport,T=r.content-r.viewport,E=Rs(h),_=Rs(c),A=ob(m,10);function D(q){if(k.current){const B=q.clientX-k.current.left,H=q.clientY-k.current.top;d({x:B,y:H})}}return b.useEffect(()=>{const q=B=>{const H=B.target;y?.contains(H)&&E(B,T)};return document.addEventListener("wheel",q,{passive:!1}),()=>document.removeEventListener("wheel",q,{passive:!1})},[N,y,T,E]),b.useEffect(_,[r,_]),Yh(y,A),Yh(x.content,A),o.jsx(sse,{scope:n,scrollbar:y,hasThumb:s,onThumbChange:Rs(i),onThumbPointerUp:Rs(a),onThumbPositionChange:_,onThumbPointerDown:Rs(l),children:o.jsx(Sn.div,{...g,ref:S,style:{position:"absolute",...g.style},onPointerDown:nt(t.onPointerDown,q=>{q.button===0&&(q.target.setPointerCapture(q.pointerId),k.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),D(q))}),onPointerMove:nt(t.onPointerMove,D),onPointerUp:nt(t.onPointerUp,q=>{const B=q.target;B.hasPointerCapture(q.pointerId)&&B.releasePointerCapture(q.pointerId),document.body.style.webkitUserSelect=j.current,x.viewport&&(x.viewport.style.scrollBehavior=""),k.current=null})})})}),Hv="ScrollAreaThumb",FL=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=LL(Hv,t.__scopeScrollArea);return o.jsx(oi,{present:n||s.hasThumb,children:o.jsx(ise,{ref:e,...r})})}),ise=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=Pa(Hv,n),a=LL(Hv,n),{onThumbPositionChange:l}=a,c=er(e,m=>a.onThumbChange(m)),d=b.useRef(void 0),h=ob(()=>{d.current&&(d.current(),d.current=void 0)},100);return b.useEffect(()=>{const m=i.viewport;if(m){const g=()=>{if(h(),!d.current){const x=lse(m,l);d.current=x,l()}};return l(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[i.viewport,h,l]),o.jsx(Sn.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:nt(t.onPointerDownCapture,m=>{const x=m.target.getBoundingClientRect(),y=m.clientX-x.left,w=m.clientY-x.top;a.onThumbPointerDown({x:y,y:w})}),onPointerUp:nt(t.onPointerUp,a.onThumbPointerUp)})});FL.displayName=Hv;var Gj="ScrollAreaCorner",qL=b.forwardRef((t,e)=>{const n=Pa(Gj,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?o.jsx(ase,{...t,ref:e}):null});qL.displayName=Gj;var ase=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=Pa(Gj,n),[i,a]=b.useState(0),[l,c]=b.useState(0),d=!!(i&&l);return Yh(s.scrollbarX,()=>{const h=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(h),c(h)}),Yh(s.scrollbarY,()=>{const h=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(h),a(h)}),d?o.jsx(Sn.div,{...r,ref:e,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Qv(t){return t?parseInt(t,10):0}function $L(t,e){const n=t/e;return isNaN(n)?0:n}function ab(t){const e=$L(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function ose(t,e,n,r="ltr"){const s=ab(n),i=s/2,a=e||i,l=s-a,c=n.scrollbar.paddingStart+a,d=n.scrollbar.size-n.scrollbar.paddingEnd-l,h=n.content-n.viewport,m=r==="ltr"?[0,h]:[h*-1,0];return HL([c,d],m)(t)}function nE(t,e,n="ltr"){const r=ab(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,a=e.content-e.viewport,l=i-r,c=n==="ltr"?[0,a]:[a*-1,0],d=Tj(t,c);return HL([0,a],[0,l])(d)}function HL(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 QL(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},a=n.left!==i.left,l=n.top!==i.top;(a||l)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function ob(t,e){const n=Rs(t),r=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),b.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Yh(t,e){const n=Rs(e);Wh(()=>{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 VL=DL,cse=zL,use=qL;const pn=b.forwardRef(({className:t,children:e,viewportRef:n,...r},s)=>o.jsxs(VL,{ref:s,className:xe("relative overflow-hidden",t),...r,children:[o.jsx(cse,{ref:n,className:"h-full w-full rounded-[inherit]",children:e}),o.jsx(pk,{}),o.jsx(pk,{orientation:"horizontal"}),o.jsx(use,{})]}));pn.displayName=VL.displayName;const pk=b.forwardRef(({className:t,orientation:e="vertical",...n},r)=>o.jsx(Uj,{ref:r,orientation:e,className:xe("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:o.jsx(FL,{className:"relative flex-1 rounded-full bg-border"})}));pk.displayName=Uj.displayName;function dse({className:t,...e}){return o.jsx("div",{className:xe("animate-pulse rounded-md bg-primary/10",t),...e})}function hse(t,e=[]){let n=[];function r(i,a){const l=b.createContext(a);l.displayName=i+"Context";const c=n.length;n=[...n,a];const d=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[c]||l,S=b.useMemo(()=>y,Object.values(y));return o.jsx(w.Provider,{value:S,children:x})};d.displayName=i+"Provider";function h(m,g){const x=g?.[t]?.[c]||l,y=b.useContext(x);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[d,h]}const s=()=>{const i=n.map(a=>b.createContext(a));return function(l){const c=l?.[t]||i;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,fse(s,...e)]}function fse(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((l,{useScope:c,scopeName:d})=>{const m=c(i)[`__scope${d}`];return{...l,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var mse=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],UL=mse.reduce((t,e)=>{const n=Vy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Xj="Progress",Yj=100,[pse]=hse(Xj),[gse,xse]=pse(Xj),WL=b.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=vse,...a}=t;(s||s===0)&&!rE(s)&&console.error(yse(`${s}`,"Progress"));const l=rE(s)?s:Yj;r!==null&&!sE(r,l)&&console.error(bse(`${r}`,"Progress"));const c=sE(r,l)?r:null,d=Vv(c)?i(c,l):void 0;return o.jsx(gse,{scope:n,value:c,max:l,children:o.jsx(UL.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Vv(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":YL(c,l),"data-value":c??void 0,"data-max":l,...a,ref:e})})});WL.displayName=Xj;var GL="ProgressIndicator",XL=b.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=xse(GL,n);return o.jsx(UL.div,{"data-state":YL(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});XL.displayName=GL;function vse(t,e){return`${Math.round(t/e*100)}%`}function YL(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function Vv(t){return typeof t=="number"}function rE(t){return Vv(t)&&!isNaN(t)&&t>0}function sE(t,e){return Vv(t)&&!isNaN(t)&&t<=e&&t>=0}function yse(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Yj}\`.`}function bse(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 ${Qj} if no \`max\` prop is set) + - less than the value passed to \`max\` (or ${Yj} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. -Defaulting to \`null\`.`}var WL=HL,yse=VL;const Lp=b.forwardRef(({className:t,value:e,...n},r)=>o.jsx(WL,{ref:r,className:xe("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:o.jsx(yse,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Lp.displayName=WL.displayName;const bse={light:"",dark:".dark"},GL=b.createContext(null);function XL(){const t=b.useContext(GL);if(!t)throw new Error("useChart must be used within a ");return t}const gh=b.forwardRef(({id:t,className:e,children:n,config:r,...s},i)=>{const a=b.useId(),l=`chart-${t||a.replace(/:/g,"")}`;return o.jsx(GL.Provider,{value:{config:r},children:o.jsxs("div",{"data-chart":l,ref:i,className:xe("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...s,children:[o.jsx(wse,{id:l,config:r}),o.jsx(jJ,{children:n})]})})});gh.displayName="Chart";const wse=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?o.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(bse).map(([r,s])=>` +Defaulting to \`null\`.`}var KL=WL,wse=XL;const Qp=b.forwardRef(({className:t,value:e,...n},r)=>o.jsx(KL,{ref:r,className:xe("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:o.jsx(wse,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Qp.displayName=KL.displayName;const Sse={light:"",dark:".dark"},ZL=b.createContext(null);function JL(){const t=b.useContext(ZL);if(!t)throw new Error("useChart must be used within a ");return t}const vh=b.forwardRef(({id:t,className:e,children:n,config:r,...s},i)=>{const a=b.useId(),l=`chart-${t||a.replace(/:/g,"")}`;return o.jsx(ZL.Provider,{value:{config:r},children:o.jsxs("div",{"data-chart":l,ref:i,className:xe("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...s,children:[o.jsx(kse,{id:l,config:r}),o.jsx(TJ,{children:n})]})})});vh.displayName="Chart";const kse=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?o.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(Sse).map(([r,s])=>` ${s} [data-chart=${t}] { ${n.map(([i,a])=>{const l=a.theme?.[r]||a.color;return l?` --color-${i}: ${l};`:null}).join(` `)} } `).join(` -`)}}):null},Lm=NJ,xh=b.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:a,labelFormatter:l,labelClassName:c,formatter:d,color:h,nameKey:m,labelKey:g},x)=>{const{config:y}=XL(),w=b.useMemo(()=>{if(s||!e?.length)return null;const[k]=e,j=`${g||k?.dataKey||k?.name||"value"}`,N=fk(y,k,j),T=!g&&typeof a=="string"?y[a]?.label||a:N?.label;return l?o.jsx("div",{className:xe("font-medium",c),children:l(T,e)}):T?o.jsx("div",{className:xe("font-medium",c),children:T}):null},[a,l,e,s,c,y,g]);if(!t||!e?.length)return null;const S=e.length===1&&r!=="dot";return o.jsxs("div",{ref:x,className:xe("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[S?null:w,o.jsx("div",{className:"grid gap-1.5",children:e.filter(k=>k.type!=="none").map((k,j)=>{const N=`${m||k.name||k.dataKey||"value"}`,T=fk(y,k,N),E=h||k.payload.fill||k.color;return o.jsx("div",{className:xe("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:d&&k?.value!==void 0&&k.name?d(k.value,k.name,k,j,k.payload):o.jsxs(o.Fragment,{children:[T?.icon?o.jsx(T.icon,{}):!i&&o.jsx("div",{className:xe("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":S&&r==="dashed"}),style:{"--color-bg":E,"--color-border":E}}),o.jsxs("div",{className:xe("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[o.jsxs("div",{className:"grid gap-1.5",children:[S?w:null,o.jsx("span",{className:"text-muted-foreground",children:T?.label||k.name})]}),k.value&&o.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:k.value.toLocaleString()})]})]})},k.dataKey)})})]})});xh.displayName="ChartTooltip";const Sse=CJ,YL=b.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:a}=XL();return n?.length?o.jsx("div",{ref:i,className:xe("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(l=>l.type!=="none").map(l=>{const c=`${s||l.dataKey||"value"}`,d=fk(a,l,c);return o.jsxs("div",{className:xe("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[d?.icon&&!e?o.jsx(d.icon,{}):o.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:l.color}}),d?.label]},l.value)})}):null});YL.displayName="ChartLegend";function fk(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 J9=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,eE=Fz,kf=(t,e)=>n=>{var r;if(e?.variants==null)return eE(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(d=>{const h=n?.[d],m=i?.[d];if(h===null)return null;const g=J9(h)||J9(m);return s[d][g]}),l=n&&Object.entries(n).reduce((d,h)=>{let[m,g]=h;return g===void 0||(d[m]=g),d},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((d,h)=>{let{class:m,className:g,...x}=h;return Object.entries(x).every(y=>{let[w,S]=y;return Array.isArray(S)?S.includes({...i,...l}[w]):{...i,...l}[w]===S})?[...d,m,g]:d},[]);return eE(t,a,c,n?.class,n?.className)},I0=kf("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),de=b.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const a=r?Oee:"button";return o.jsx(a,{className:xe(I0({variant:e,size:n,className:t})),ref:i,...s})});de.displayName="Button";function kse(){const[t,e]=b.useState(null),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(24),[c,d]=b.useState(!0),[h,m]=b.useState(null),[g,x]=b.useState(!0),y=b.useCallback(async()=>{try{x(!0);const P=await Br.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");m({hitokoto:P.data.hitokoto,from:P.data.from||P.data.from_who||"未知"})}catch(P){console.error("获取一言失败:",P),m({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{x(!1)}},[]),w=b.useCallback(async()=>{try{const P=localStorage.getItem("access-token"),B=await Br.get(`/api/webui/statistics/dashboard?hours=${a}`,{headers:{Authorization:`Bearer ${P}`}});e(B.data),r(!1),i(100)}catch(P){console.error("Failed to fetch dashboard data:",P),r(!1),i(100)}},[a]);if(b.useEffect(()=>{if(!n)return;i(0);const P=setTimeout(()=>i(15),200),B=setTimeout(()=>i(30),800),$=setTimeout(()=>i(45),2e3),U=setTimeout(()=>i(60),4e3),te=setTimeout(()=>i(75),6500),z=setTimeout(()=>i(85),9e3),Q=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(P),clearTimeout(B),clearTimeout($),clearTimeout(U),clearTimeout(te),clearTimeout(z),clearTimeout(Q)}},[n]),b.useEffect(()=>{w(),y()},[w,y]),b.useEffect(()=>{if(!c)return;const P=setInterval(()=>{w()},3e4);return()=>clearInterval(P)},[c,w]),n||!t)return o.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:o.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[o.jsx(Ps,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Lp,{value:s,className:"h-2"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:S,model_stats:k,hourly_data:j,daily_data:N,recent_activity:T}=t,E=P=>{const B=Math.floor(P/3600),$=Math.floor(P%3600/60);return`${B}小时${$}分钟`},_=P=>new Date(P).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),A=k.slice(0,6).map(P=>({name:P.model_name,value:P.request_count,fill:`hsl(var(--chart-${k.indexOf(P)%5+1}))`})),L={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(ja,{value:a.toString(),onValueChange:P=>l(Number(P)),children:o.jsxs(Wi,{className:"grid grid-cols-3 w-full sm:w-auto",children:[o.jsx(Lt,{value:"24",children:"24小时"}),o.jsx(Lt,{value:"168",children:"7天"}),o.jsx(Lt,{value:"720",children:"30天"})]})}),o.jsxs(de,{variant:c?"default":"outline",size:"sm",onClick:()=>d(!c),className:"gap-2",children:[o.jsx(Ps,{className:`h-4 w-4 ${c?"animate-spin":""}`}),o.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:w,children:o.jsx(Ps,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[g?o.jsx(cse,{className:"h-5 flex-1"}):h?o.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',h.hitokoto,'" —— ',h.from]}):null,o.jsx(de,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:y,disabled:g,children:o.jsx(Ps,{className:`h-3.5 w-3.5 ${g?"animate-spin":""}`})})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"总请求数"}),o.jsx(Iee,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:S.total_requests.toLocaleString()}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",a<48?a+"小时":Math.floor(a/24)+"天"]})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"总花费"}),o.jsx(Lee,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:["¥",S.total_cost.toFixed(2)]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.cost_per_hour>0?`¥${S.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"Token消耗"}),o.jsx(ek,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[(S.total_tokens/1e3).toFixed(1),"K"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.tokens_per_hour>0?`${(S.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"平均响应"}),o.jsx(tk,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[S.avg_response_time.toFixed(2),"s"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"在线时长"}),o.jsx(_h,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsx(Gn,{children:o.jsx("div",{className:"text-xl font-bold",children:E(S.online_time)})})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"消息处理"}),o.jsx(Wh,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-xl font-bold",children:S.total_messages.toLocaleString()}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",S.total_replies.toLocaleString()," 条"]})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"成本效率"}),o.jsx(Bee,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-xl font-bold",children:S.total_messages>0?`¥${(S.total_cost/S.total_messages*100).toFixed(2)}`:"¥0.00"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),o.jsxs(ja,{defaultValue:"trends",className:"space-y-4",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[o.jsx(Lt,{value:"trends",children:"趋势"}),o.jsx(Lt,{value:"models",children:"模型"}),o.jsx(Lt,{value:"activity",children:"活动"}),o.jsx(Lt,{value:"daily",children:"日统计"})]}),o.jsxs(un,{value:"trends",className:"space-y-4",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"请求趋势"}),o.jsxs(ts,{children:["最近",a,"小时的请求量变化"]})]}),o.jsx(Gn,{children:o.jsx(gh,{config:L,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:o.jsxs(TJ,{data:j,children:[o.jsx(Ux,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Wx,{dataKey:"timestamp",tickFormatter:P=>_(P),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Dm,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Lm,{content:o.jsx(xh,{labelFormatter:P=>_(P)})}),o.jsx(EJ,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"花费趋势"}),o.jsx(ts,{children:"API调用成本变化"})]}),o.jsx(Gn,{children:o.jsx(gh,{config:L,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:o.jsxs(v4,{data:j,children:[o.jsx(Ux,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Wx,{dataKey:"timestamp",tickFormatter:P=>_(P),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Dm,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Lm,{content:o.jsx(xh,{labelFormatter:P=>_(P)})}),o.jsx(Gx,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"Token消耗"}),o.jsx(ts,{children:"Token使用量变化"})]}),o.jsx(Gn,{children:o.jsx(gh,{config:L,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:o.jsxs(v4,{data:j,children:[o.jsx(Ux,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Wx,{dataKey:"timestamp",tickFormatter:P=>_(P),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Dm,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Lm,{content:o.jsx(xh,{labelFormatter:P=>_(P)})}),o.jsx(Gx,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),o.jsx(un,{value:"models",className:"space-y-4",children:o.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"模型请求分布"}),o.jsx(ts,{children:"各模型使用占比"})]}),o.jsx(Gn,{children:o.jsx(gh,{config:Object.fromEntries(k.slice(0,6).map((P,B)=>[P.model_name,{label:P.model_name,color:`hsl(var(--chart-${B%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:o.jsxs(_J,{children:[o.jsx(Lm,{content:o.jsx(xh,{})}),o.jsx(AJ,{data:A,cx:"50%",cy:"50%",labelLine:!1,label:({name:P,percent:B})=>`${P} ${B?(B*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:A.map((P,B)=>o.jsx(MJ,{fill:P.fill},`cell-${B}`))})]})})})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"模型详细统计"}),o.jsx(ts,{children:"请求数、花费和性能"})]}),o.jsx(Gn,{children:o.jsx(gn,{className:"h-[300px] sm:h-[400px]",children:o.jsx("div",{className:"space-y-3",children:k.map((P,B)=>o.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:P.model_name}),o.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${B%5+1}))`}})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),o.jsx("span",{className:"ml-1 font-medium",children:P.request_count.toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"花费:"}),o.jsxs("span",{className:"ml-1 font-medium",children:["¥",P.total_cost.toFixed(2)]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),o.jsxs("span",{className:"ml-1 font-medium",children:[(P.total_tokens/1e3).toFixed(1),"K"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),o.jsxs("span",{className:"ml-1 font-medium",children:[P.avg_response_time.toFixed(2),"s"]})]})]})]},B))})})})]})]})}),o.jsx(un,{value:"activity",children:o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"最近活动"}),o.jsx(ts,{children:"最新的API调用记录"})]}),o.jsx(Gn,{children:o.jsx(gn,{className:"h-[400px] sm:h-[500px]",children:o.jsx("div",{className:"space-y-2",children:T.map((P,B)=>o.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium text-sm truncate",children:P.model}),o.jsx("div",{className:"text-xs text-muted-foreground",children:P.request_type})]}),o.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:_(P.timestamp)})]}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),o.jsx("span",{className:"ml-1",children:P.tokens})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"花费:"}),o.jsxs("span",{className:"ml-1",children:["¥",P.cost.toFixed(4)]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),o.jsxs("span",{className:"ml-1",children:[P.time_cost.toFixed(2),"s"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"状态:"}),o.jsx("span",{className:`ml-1 ${P.status==="success"?"text-green-600":"text-red-600"}`,children:P.status})]})]})]},B))})})})]})}),o.jsx(un,{value:"daily",children:o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"每日统计"}),o.jsx(ts,{children:"最近7天的数据汇总"})]}),o.jsx(Gn,{children:o.jsx(gh,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:o.jsxs(v4,{data:N,children:[o.jsx(Ux,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Wx,{dataKey:"timestamp",tickFormatter:P=>{const B=new Date(P);return`${B.getMonth()+1}/${B.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Dm,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Dm,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Lm,{content:o.jsx(xh,{labelFormatter:P=>new Date(P).toLocaleDateString("zh-CN")})}),o.jsx(Sse,{content:o.jsx(YL,{})}),o.jsx(Gx,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),o.jsx(Gx,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]})]})})}const Ose={theme:"system",setTheme:()=>null},KL=b.createContext(Ose),Vj=()=>{const t=b.useContext(KL);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},jse=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,a=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${a}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},ZL=b.createContext(void 0),JL=()=>{const t=b.useContext(ZL);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var sb="Switch",[Nse]=Ra(sb),[Cse,Tse]=Nse(sb),eB=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:a,disabled:l,value:c="on",onCheckedChange:d,form:h,...m}=t,[g,x]=b.useState(null),y=Yn(e,N=>x(N)),w=b.useRef(!1),S=g?h||!!g.closest("form"):!0,[k,j]=Xl({prop:s,defaultProp:i??!1,onChange:d,caller:sb});return o.jsxs(Cse,{scope:n,checked:k,disabled:l,children:[o.jsx(xn.button,{type:"button",role:"switch","aria-checked":k,"aria-required":a,"data-state":sB(k),"data-disabled":l?"":void 0,disabled:l,value:c,...m,ref:y,onClick:nt(t.onClick,N=>{j(T=>!T),S&&(w.current=N.isPropagationStopped(),w.current||N.stopPropagation())})}),S&&o.jsx(rB,{control:g,bubbles:!w.current,name:r,value:c,checked:k,required:a,disabled:l,form:h,style:{transform:"translateX(-100%)"}})]})});eB.displayName=sb;var tB="SwitchThumb",nB=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=Tse(tB,n);return o.jsx(xn.span,{"data-state":sB(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});nB.displayName=tB;var Ese="SwitchBubbleInput",rB=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const a=b.useRef(null),l=Yn(a,i),c=eI(n),d=tI(e);return b.useEffect(()=>{const h=a.current;if(!h)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==n&&x){const y=new Event("click",{bubbles:r});x.call(h,n),h.dispatchEvent(y)}},[c,n,r]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});rB.displayName=Ese;function sB(t){return t?"checked":"unchecked"}var iB=eB,_se=nB;const Bt=b.forwardRef(({className:t,...e},n)=>o.jsx(iB,{className:xe("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:o.jsx(_se,{className:xe("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")})}));Bt.displayName=iB.displayName;const Ase=kf("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),he=b.forwardRef(({className:t,...e},n)=>o.jsx(nI,{ref:n,className:xe(Ase(),t),...e}));he.displayName=nI.displayName;const ze=b.forwardRef(({className:t,type:e,...n},r)=>o.jsx("input",{type:e,className:xe("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}));ze.displayName="Input";const Mse=5,Rse=5e3;let E4=0;function Dse(){return E4=(E4+1)%Number.MAX_SAFE_INTEGER,E4.toString()}const _4=new Map,tE=t=>{if(_4.has(t))return;const e=setTimeout(()=>{_4.delete(t),y0({type:"REMOVE_TOAST",toastId:t})},Rse);_4.set(t,e)},Pse=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,Mse)};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?tE(n):t.toasts.forEach(r=>{tE(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)}}},rv=[];let sv={toasts:[]};function y0(t){sv=Pse(sv,t),rv.forEach(e=>{e(sv)})}function zse({...t}){const e=Dse(),n=s=>y0({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>y0({type:"DISMISS_TOAST",toastId:e});return y0({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function as(){const[t,e]=b.useState(sv);return b.useEffect(()=>(rv.push(e),()=>{const n=rv.indexOf(e);n>-1&&rv.splice(n,1)}),[t]),{...t,toast:zse,dismiss:n=>y0({type:"DISMISS_TOAST",toastId:n})}}const Ise=[{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 Lse(t){const e=Ise.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 Uj="0.11.6 Beta",Wj="MaiBot Dashboard",Bse=`${Wj} v${Uj}`,Fse=(t="v")=>`${t}${Uj}`,Dr=Nj,Of=rI,qse=kj,Gj=Hy,aB=b.forwardRef(({className:t,...e},n)=>o.jsx(qy,{ref:n,className:xe("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}));aB.displayName=qy.displayName;const Sr=b.forwardRef(({className:t,children:e,preventOutsideClose:n=!1,...r},s)=>o.jsxs(qse,{children:[o.jsx(aB,{}),o.jsxs($y,{ref:s,className:xe("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),onPointerDownOutside:n?i=>i.preventDefault():void 0,onInteractOutside:n?i=>i.preventDefault():void 0,...r,children:[e,o.jsxs(Hy,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(_p,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Sr.displayName=$y.displayName;const kr=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});kr.displayName="DialogHeader";const ws=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ws.displayName="DialogFooter";const Or=b.forwardRef(({className:t,...e},n)=>o.jsx(Oj,{ref:n,className:xe("text-lg font-semibold leading-none tracking-tight",t),...e}));Or.displayName=Oj.displayName;const ss=b.forwardRef(({className:t,...e},n)=>o.jsx(jj,{ref:n,className:xe("text-sm text-muted-foreground",t),...e}));ss.displayName=jj.displayName;var $se=Symbol("radix.slottable");function Hse(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=$se,e}var oB="AlertDialog",[Qse]=Ra(oB,[sI]),Yl=sI(),lB=t=>{const{__scopeAlertDialog:e,...n}=t,r=Yl(e);return o.jsx(Nj,{...r,...n,modal:!0})};lB.displayName=oB;var Vse="AlertDialogTrigger",cB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return o.jsx(rI,{...s,...r,ref:e})});cB.displayName=Vse;var Use="AlertDialogPortal",uB=t=>{const{__scopeAlertDialog:e,...n}=t,r=Yl(e);return o.jsx(kj,{...r,...n})};uB.displayName=Use;var Wse="AlertDialogOverlay",dB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return o.jsx(qy,{...s,...r,ref:e})});dB.displayName=Wse;var Mh="AlertDialogContent",[Gse,Xse]=Qse(Mh),Yse=Hse("AlertDialogContent"),hB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=Yl(n),a=b.useRef(null),l=Yn(e,a),c=b.useRef(null);return o.jsx(jee,{contentName:Mh,titleName:fB,docsSlug:"alert-dialog",children:o.jsx(Gse,{scope:n,cancelRef:c,children:o.jsxs($y,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:nt(s.onOpenAutoFocus,d=>{d.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[o.jsx(Yse,{children:r}),o.jsx(Zse,{contentRef:a})]})})})});hB.displayName=Mh;var fB="AlertDialogTitle",mB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return o.jsx(Oj,{...s,...r,ref:e})});mB.displayName=fB;var pB="AlertDialogDescription",gB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return o.jsx(jj,{...s,...r,ref:e})});gB.displayName=pB;var Kse="AlertDialogAction",xB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Yl(n);return o.jsx(Hy,{...s,...r,ref:e})});xB.displayName=Kse;var vB="AlertDialogCancel",yB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=Xse(vB,n),i=Yl(n),a=Yn(e,s);return o.jsx(Hy,{...i,...r,ref:a})});yB.displayName=vB;var Zse=({contentRef:t})=>{const e=`\`${Mh}\` requires a description for the component to be accessible for screen reader users. +`)}}):null},Bm=EJ,yh=b.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:a,labelFormatter:l,labelClassName:c,formatter:d,color:h,nameKey:m,labelKey:g},x)=>{const{config:y}=JL(),w=b.useMemo(()=>{if(s||!e?.length)return null;const[k]=e,j=`${g||k?.dataKey||k?.name||"value"}`,N=gk(y,k,j),T=!g&&typeof a=="string"?y[a]?.label||a:N?.label;return l?o.jsx("div",{className:xe("font-medium",c),children:l(T,e)}):T?o.jsx("div",{className:xe("font-medium",c),children:T}):null},[a,l,e,s,c,y,g]);if(!t||!e?.length)return null;const S=e.length===1&&r!=="dot";return o.jsxs("div",{ref:x,className:xe("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[S?null:w,o.jsx("div",{className:"grid gap-1.5",children:e.filter(k=>k.type!=="none").map((k,j)=>{const N=`${m||k.name||k.dataKey||"value"}`,T=gk(y,k,N),E=h||k.payload.fill||k.color;return o.jsx("div",{className:xe("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:d&&k?.value!==void 0&&k.name?d(k.value,k.name,k,j,k.payload):o.jsxs(o.Fragment,{children:[T?.icon?o.jsx(T.icon,{}):!i&&o.jsx("div",{className:xe("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":S&&r==="dashed"}),style:{"--color-bg":E,"--color-border":E}}),o.jsxs("div",{className:xe("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[o.jsxs("div",{className:"grid gap-1.5",children:[S?w:null,o.jsx("span",{className:"text-muted-foreground",children:T?.label||k.name})]}),k.value&&o.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:k.value.toLocaleString()})]})]})},k.dataKey)})})]})});yh.displayName="ChartTooltip";const Ose=_J,eB=b.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:a}=JL();return n?.length?o.jsx("div",{ref:i,className:xe("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(l=>l.type!=="none").map(l=>{const c=`${s||l.dataKey||"value"}`,d=gk(a,l,c);return o.jsxs("div",{className:xe("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[d?.icon&&!e?o.jsx(d.icon,{}):o.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:l.color}}),d?.label]},l.value)})}):null});eB.displayName="ChartLegend";function gk(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 iE=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,aE=Qz,kf=(t,e)=>n=>{var r;if(e?.variants==null)return aE(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(d=>{const h=n?.[d],m=i?.[d];if(h===null)return null;const g=iE(h)||iE(m);return s[d][g]}),l=n&&Object.entries(n).reduce((d,h)=>{let[m,g]=h;return g===void 0||(d[m]=g),d},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((d,h)=>{let{class:m,className:g,...x}=h;return Object.entries(x).every(y=>{let[w,S]=y;return Array.isArray(S)?S.includes({...i,...l}[w]):{...i,...l}[w]===S})?[...d,m,g]:d},[]);return aE(t,a,c,n?.class,n?.className)},q0=kf("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"}}),ue=b.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const a=r?Cee:"button";return o.jsx(a,{className:xe(q0({variant:e,size:n,className:t})),ref:i,...s})});ue.displayName="Button";const jse=kf("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 tn({className:t,variant:e,...n}){return o.jsx("div",{className:xe(jse({variant:e}),t),...n})}const Nse=5,Cse=5e3;let R4=0;function Tse(){return R4=(R4+1)%Number.MAX_SAFE_INTEGER,R4.toString()}const D4=new Map,oE=t=>{if(D4.has(t))return;const e=setTimeout(()=>{D4.delete(t),S0({type:"REMOVE_TOAST",toastId:t})},Cse);D4.set(t,e)},Ese=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,Nse)};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?oE(n):t.toasts.forEach(r=>{oE(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)}}},lv=[];let cv={toasts:[]};function S0(t){cv=Ese(cv,t),lv.forEach(e=>{e(cv)})}function _se({...t}){const e=Tse(),n=s=>S0({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>S0({type:"DISMISS_TOAST",toastId:e});return S0({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Lr(){const[t,e]=b.useState(cv);return b.useEffect(()=>(lv.push(e),()=>{const n=lv.indexOf(e);n>-1&&lv.splice(n,1)}),[t]),{...t,toast:_se,dismiss:n=>S0({type:"DISMISS_TOAST",toastId:n})}}const Ase=t=>{const e=[];for(let n=0;n{try{x(!0);const $=await Cr.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");m({hitokoto:$.data.hitokoto,from:$.data.from||$.data.from_who||"未知"})}catch($){console.error("获取一言失败:",$),m({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{x(!1)}},[]),T=b.useCallback(async()=>{try{const $=localStorage.getItem("access-token"),K=await Cr.get("/api/webui/system/status",{headers:{Authorization:`Bearer ${$}`}});w(K.data)}catch($){console.error("获取机器人状态失败:",$),w(null)}},[]),E=async()=>{if(!S)try{k(!0);const $=localStorage.getItem("access-token");await Cr.post("/api/webui/system/restart",{},{headers:{Authorization:`Bearer ${$}`}}),j({title:"重启中",description:"麦麦正在重启,请稍候..."}),setTimeout(()=>{T(),k(!1)},3e3)}catch($){console.error("重启失败:",$),j({title:"重启失败",description:"无法重启麦麦,请检查控制台",variant:"destructive"}),k(!1)}},_=b.useCallback(async()=>{try{const $=localStorage.getItem("access-token"),K=await Cr.get(`/api/webui/statistics/dashboard?hours=${a}`,{headers:{Authorization:`Bearer ${$}`}});e(K.data),r(!1),i(100)}catch($){console.error("Failed to fetch dashboard data:",$),r(!1),i(100)}},[a]);if(b.useEffect(()=>{if(!n)return;i(0);const $=setTimeout(()=>i(15),200),K=setTimeout(()=>i(30),800),Y=setTimeout(()=>i(45),2e3),R=setTimeout(()=>i(60),4e3),ie=setTimeout(()=>i(75),6500),X=setTimeout(()=>i(85),9e3),z=setTimeout(()=>i(92),11e3);return()=>{clearTimeout($),clearTimeout(K),clearTimeout(Y),clearTimeout(R),clearTimeout(ie),clearTimeout(X),clearTimeout(z)}},[n]),b.useEffect(()=>{_(),N(),T()},[_,N,T]),b.useEffect(()=>{if(!c)return;const $=setInterval(()=>{_(),T()},3e4);return()=>clearInterval($)},[c,_,T]),n||!t)return o.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:o.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[o.jsx(Qs,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Qp,{value:s,className:"h-2"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:A,model_stats:D,hourly_data:q,daily_data:B,recent_activity:H}=t,W=$=>{const K=Math.floor($/3600),Y=Math.floor($%3600/60);return`${K}小时${Y}分钟`},ee=$=>new Date($).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),I=Ase(D.length),V=D.map(($,K)=>({name:$.model_name,value:$.request_count,fill:I[K]})),L={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return o.jsx(pn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(Yi,{value:a.toString(),onValueChange:$=>l(Number($)),children:o.jsxs(ji,{className:"grid grid-cols-3 w-full sm:w-auto",children:[o.jsx(Bt,{value:"24",children:"24小时"}),o.jsx(Bt,{value:"168",children:"7天"}),o.jsx(Bt,{value:"720",children:"30天"})]})}),o.jsxs(ue,{variant:c?"default":"outline",size:"sm",onClick:()=>d(!c),className:"gap-2",children:[o.jsx(Qs,{className:`h-4 w-4 ${c?"animate-spin":""}`}),o.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),o.jsx(ue,{variant:"outline",size:"sm",onClick:_,children:o.jsx(Qs,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[g?o.jsx(dse,{className:"h-5 flex-1"}):h?o.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',h.hitokoto,'" —— ',h.from]}):null,o.jsx(ue,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:N,disabled:g,children:o.jsx(Qs,{className:`h-3.5 w-3.5 ${g?"animate-spin":""}`})})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[o.jsxs(Lt,{className:"lg:col-span-1",children:[o.jsx(En,{className:"pb-3",children:o.jsxs(_n,{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Dp,{className:"h-4 w-4"}),"麦麦状态"]})}),o.jsx(Xn,{children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"flex items-center gap-2",children:y?.running?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),o.jsxs(tn,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[o.jsx(Ya,{className:"h-3 w-3 mr-1"}),"运行中"]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-3 w-3 rounded-full bg-red-500"}),o.jsxs(tn,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[o.jsx(Lo,{className:"h-3 w-3 mr-1"}),"已停止"]})]})}),y&&o.jsxs("div",{className:"text-xs text-muted-foreground",children:[o.jsxs("span",{children:["v",y.version]}),o.jsx("span",{className:"mx-2",children:"|"}),o.jsxs("span",{children:["运行 ",W(y.uptime)]})]})]})})]}),o.jsxs(Lt,{className:"lg:col-span-2",children:[o.jsx(En,{className:"pb-3",children:o.jsxs(_n,{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Zu,{className:"h-4 w-4"}),"快速操作"]})}),o.jsx(Xn,{children:o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs(ue,{variant:"outline",size:"sm",onClick:E,disabled:S,className:"gap-2",children:[o.jsx(zj,{className:`h-4 w-4 ${S?"animate-spin":""}`}),S?"重启中...":"重启麦麦"]}),o.jsx(ue,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:o.jsxs(rv,{to:"/logs",children:[o.jsx(Po,{className:"h-4 w-4"}),"查看日志"]})}),o.jsx(ue,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:o.jsxs(rv,{to:"/plugins",children:[o.jsx(Fee,{className:"h-4 w-4"}),"插件管理"]})}),o.jsx(ue,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:o.jsxs(rv,{to:"/settings",children:[o.jsx(Vc,{className:"h-4 w-4"}),"系统设置"]})})]})})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[o.jsxs(Lt,{children:[o.jsxs(En,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(_n,{className:"text-sm font-medium",children:"总请求数"}),o.jsx(qee,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Xn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:A.total_requests.toLocaleString()}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",a<48?a+"小时":Math.floor(a/24)+"天"]})]})]}),o.jsxs(Lt,{children:[o.jsxs(En,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(_n,{className:"text-sm font-medium",children:"总花费"}),o.jsx($ee,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Xn,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:["¥",A.total_cost.toFixed(2)]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:A.cost_per_hour>0?`¥${A.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),o.jsxs(Lt,{children:[o.jsxs(En,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(_n,{className:"text-sm font-medium",children:"Token消耗"}),o.jsx(sk,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Xn,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[(A.total_tokens/1e3).toFixed(1),"K"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:A.tokens_per_hour>0?`${(A.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),o.jsxs(Lt,{children:[o.jsxs(En,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(_n,{className:"text-sm font-medium",children:"平均响应"}),o.jsx(Zu,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Xn,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[A.avg_response_time.toFixed(2),"s"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[o.jsxs(Lt,{children:[o.jsxs(En,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(_n,{className:"text-sm font-medium",children:"在线时长"}),o.jsx(Mh,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsx(Xn,{children:o.jsx("div",{className:"text-xl font-bold",children:W(A.online_time)})})]}),o.jsxs(Lt,{children:[o.jsxs(En,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(_n,{className:"text-sm font-medium",children:"消息处理"}),o.jsx(Gh,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Xn,{children:[o.jsx("div",{className:"text-xl font-bold",children:A.total_messages.toLocaleString()}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",A.total_replies.toLocaleString()," 条"]})]})]}),o.jsxs(Lt,{children:[o.jsxs(En,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(_n,{className:"text-sm font-medium",children:"成本效率"}),o.jsx(Hee,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Xn,{children:[o.jsx("div",{className:"text-xl font-bold",children:A.total_messages>0?`¥${(A.total_cost/A.total_messages*100).toFixed(2)}`:"¥0.00"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),o.jsxs(Yi,{defaultValue:"trends",className:"space-y-4",children:[o.jsxs(ji,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[o.jsx(Bt,{value:"trends",children:"趋势"}),o.jsx(Bt,{value:"models",children:"模型"}),o.jsx(Bt,{value:"activity",children:"活动"}),o.jsx(Bt,{value:"daily",children:"日统计"})]}),o.jsxs(ln,{value:"trends",className:"space-y-4",children:[o.jsxs(Lt,{children:[o.jsxs(En,{children:[o.jsx(_n,{children:"请求趋势"}),o.jsxs(Wr,{children:["最近",a,"小时的请求量变化"]})]}),o.jsx(Xn,{children:o.jsx(vh,{config:L,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:o.jsxs(AJ,{data:q,children:[o.jsx(Kx,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Zx,{dataKey:"timestamp",tickFormatter:$=>ee($),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Pm,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Bm,{content:o.jsx(yh,{labelFormatter:$=>ee($)})}),o.jsx(MJ,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[o.jsxs(Lt,{children:[o.jsxs(En,{children:[o.jsx(_n,{children:"花费趋势"}),o.jsx(Wr,{children:"API调用成本变化"})]}),o.jsx(Xn,{children:o.jsx(vh,{config:L,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:o.jsxs(S4,{data:q,children:[o.jsx(Kx,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Zx,{dataKey:"timestamp",tickFormatter:$=>ee($),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Pm,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Bm,{content:o.jsx(yh,{labelFormatter:$=>ee($)})}),o.jsx(Jx,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),o.jsxs(Lt,{children:[o.jsxs(En,{children:[o.jsx(_n,{children:"Token消耗"}),o.jsx(Wr,{children:"Token使用量变化"})]}),o.jsx(Xn,{children:o.jsx(vh,{config:L,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:o.jsxs(S4,{data:q,children:[o.jsx(Kx,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Zx,{dataKey:"timestamp",tickFormatter:$=>ee($),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Pm,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Bm,{content:o.jsx(yh,{labelFormatter:$=>ee($)})}),o.jsx(Jx,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),o.jsx(ln,{value:"models",className:"space-y-4",children:o.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[o.jsxs(Lt,{children:[o.jsxs(En,{children:[o.jsx(_n,{children:"模型请求分布"}),o.jsxs(Wr,{children:["各模型使用占比 (共 ",D.length," 个模型)"]})]}),o.jsx(Xn,{children:o.jsx(vh,{config:Object.fromEntries(D.map(($,K)=>[$.model_name,{label:$.model_name,color:I[K]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:o.jsxs(RJ,{children:[o.jsx(Bm,{content:o.jsx(yh,{})}),o.jsx(DJ,{data:V,cx:"50%",cy:"50%",labelLine:!1,label:({name:$,percent:K})=>K&&K<.05?"":`${$} ${K?(K*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:V.map(($,K)=>o.jsx(PJ,{fill:$.fill},`cell-${K}`))})]})})})]}),o.jsxs(Lt,{children:[o.jsxs(En,{children:[o.jsx(_n,{children:"模型详细统计"}),o.jsx(Wr,{children:"请求数、花费和性能"})]}),o.jsx(Xn,{children:o.jsx(pn,{className:"h-[300px] sm:h-[400px]",children:o.jsx("div",{className:"space-y-3",children:D.map(($,K)=>o.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:$.model_name}),o.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${K%5+1}))`}})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),o.jsx("span",{className:"ml-1 font-medium",children:$.request_count.toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"花费:"}),o.jsxs("span",{className:"ml-1 font-medium",children:["¥",$.total_cost.toFixed(2)]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),o.jsxs("span",{className:"ml-1 font-medium",children:[($.total_tokens/1e3).toFixed(1),"K"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),o.jsxs("span",{className:"ml-1 font-medium",children:[$.avg_response_time.toFixed(2),"s"]})]})]})]},K))})})})]})]})}),o.jsx(ln,{value:"activity",children:o.jsxs(Lt,{children:[o.jsxs(En,{children:[o.jsx(_n,{children:"最近活动"}),o.jsx(Wr,{children:"最新的API调用记录"})]}),o.jsx(Xn,{children:o.jsx(pn,{className:"h-[400px] sm:h-[500px]",children:o.jsx("div",{className:"space-y-2",children:H.map(($,K)=>o.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium text-sm truncate",children:$.model}),o.jsx("div",{className:"text-xs text-muted-foreground",children:$.request_type})]}),o.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:ee($.timestamp)})]}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),o.jsx("span",{className:"ml-1",children:$.tokens})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"花费:"}),o.jsxs("span",{className:"ml-1",children:["¥",$.cost.toFixed(4)]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),o.jsxs("span",{className:"ml-1",children:[$.time_cost.toFixed(2),"s"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"状态:"}),o.jsx("span",{className:`ml-1 ${$.status==="success"?"text-green-600":"text-red-600"}`,children:$.status})]})]})]},K))})})})]})}),o.jsx(ln,{value:"daily",children:o.jsxs(Lt,{children:[o.jsxs(En,{children:[o.jsx(_n,{children:"每日统计"}),o.jsx(Wr,{children:"最近7天的数据汇总"})]}),o.jsx(Xn,{children:o.jsx(vh,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:o.jsxs(S4,{data:B,children:[o.jsx(Kx,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(Zx,{dataKey:"timestamp",tickFormatter:$=>{const K=new Date($);return`${K.getMonth()+1}/${K.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Pm,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Pm,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Bm,{content:o.jsx(yh,{labelFormatter:$=>new Date($).toLocaleDateString("zh-CN")})}),o.jsx(Ose,{content:o.jsx(eB,{})}),o.jsx(Jx,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),o.jsx(Jx,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]})]})})}const Rse={theme:"system",setTheme:()=>null},tB=b.createContext(Rse),Kj=()=>{const t=b.useContext(tB);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},Dse=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,a=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${a}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},nB=b.createContext(void 0),rB=()=>{const t=b.useContext(nB);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var lb="Switch",[Pse]=Da(lb),[zse,Ise]=Pse(lb),sB=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:a,disabled:l,value:c="on",onCheckedChange:d,form:h,...m}=t,[g,x]=b.useState(null),y=er(e,N=>x(N)),w=b.useRef(!1),S=g?h||!!g.closest("form"):!0,[k,j]=Kl({prop:s,defaultProp:i??!1,onChange:d,caller:lb});return o.jsxs(zse,{scope:n,checked:k,disabled:l,children:[o.jsx(Sn.button,{type:"button",role:"switch","aria-checked":k,"aria-required":a,"data-state":lB(k),"data-disabled":l?"":void 0,disabled:l,value:c,...m,ref:y,onClick:nt(t.onClick,N=>{j(T=>!T),S&&(w.current=N.isPropagationStopped(),w.current||N.stopPropagation())})}),S&&o.jsx(oB,{control:g,bubbles:!w.current,name:r,value:c,checked:k,required:a,disabled:l,form:h,style:{transform:"translateX(-100%)"}})]})});sB.displayName=lb;var iB="SwitchThumb",aB=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=Ise(iB,n);return o.jsx(Sn.span,{"data-state":lB(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});aB.displayName=iB;var Lse="SwitchBubbleInput",oB=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const a=b.useRef(null),l=er(a,i),c=sI(n),d=iI(e);return b.useEffect(()=>{const h=a.current;if(!h)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==n&&x){const y=new Event("click",{bubbles:r});x.call(h,n),h.dispatchEvent(y)}},[c,n,r]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});oB.displayName=Lse;function lB(t){return t?"checked":"unchecked"}var cB=sB,Bse=aB;const Ft=b.forwardRef(({className:t,...e},n)=>o.jsx(cB,{className:xe("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:o.jsx(Bse,{className:xe("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")})}));Ft.displayName=cB.displayName;const Fse=kf("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),he=b.forwardRef(({className:t,...e},n)=>o.jsx(aI,{ref:n,className:xe(Fse(),t),...e}));he.displayName=aI.displayName;const Pe=b.forwardRef(({className:t,type:e,...n},r)=>o.jsx("input",{type:e,className:xe("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Pe.displayName="Input";const qse=[{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 $se(t){const e=qse.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 Zj="0.11.6 Beta",Jj="MaiBot Dashboard",Hse=`${Jj} v${Zj}`,Qse=(t="v")=>`${t}${Zj}`,Er=Mj,Of=oI,Vse=Ej,e6=Gy,uB=b.forwardRef(({className:t,...e},n)=>o.jsx(Uy,{ref:n,className:xe("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}));uB.displayName=Uy.displayName;const wr=b.forwardRef(({className:t,children:e,preventOutsideClose:n=!1,...r},s)=>o.jsxs(Vse,{children:[o.jsx(uB,{}),o.jsxs(Wy,{ref:s,className:xe("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),onPointerDownOutside:n?i=>i.preventDefault():void 0,onInteractOutside:n?i=>i.preventDefault():void 0,...r,children:[e,o.jsxs(Gy,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(Pp,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wr.displayName=Wy.displayName;const Sr=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Sr.displayName="DialogHeader";const fs=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});fs.displayName="DialogFooter";const kr=b.forwardRef(({className:t,...e},n)=>o.jsx(_j,{ref:n,className:xe("text-lg font-semibold leading-none tracking-tight",t),...e}));kr.displayName=_j.displayName;const Xr=b.forwardRef(({className:t,...e},n)=>o.jsx(Aj,{ref:n,className:xe("text-sm text-muted-foreground",t),...e}));Xr.displayName=Aj.displayName;var Use=Symbol("radix.slottable");function Wse(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Use,e}var dB="AlertDialog",[Gse]=Da(dB,[lI]),Jl=lI(),hB=t=>{const{__scopeAlertDialog:e,...n}=t,r=Jl(e);return o.jsx(Mj,{...r,...n,modal:!0})};hB.displayName=dB;var Xse="AlertDialogTrigger",fB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Jl(n);return o.jsx(oI,{...s,...r,ref:e})});fB.displayName=Xse;var Yse="AlertDialogPortal",mB=t=>{const{__scopeAlertDialog:e,...n}=t,r=Jl(e);return o.jsx(Ej,{...r,...n})};mB.displayName=Yse;var Kse="AlertDialogOverlay",pB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Jl(n);return o.jsx(Uy,{...s,...r,ref:e})});pB.displayName=Kse;var Rh="AlertDialogContent",[Zse,Jse]=Gse(Rh),eie=Wse("AlertDialogContent"),gB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=Jl(n),a=b.useRef(null),l=er(e,a),c=b.useRef(null);return o.jsx(Tee,{contentName:Rh,titleName:xB,docsSlug:"alert-dialog",children:o.jsx(Zse,{scope:n,cancelRef:c,children:o.jsxs(Wy,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:nt(s.onOpenAutoFocus,d=>{d.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[o.jsx(eie,{children:r}),o.jsx(nie,{contentRef:a})]})})})});gB.displayName=Rh;var xB="AlertDialogTitle",vB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Jl(n);return o.jsx(_j,{...s,...r,ref:e})});vB.displayName=xB;var yB="AlertDialogDescription",bB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Jl(n);return o.jsx(Aj,{...s,...r,ref:e})});bB.displayName=yB;var tie="AlertDialogAction",wB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Jl(n);return o.jsx(Gy,{...s,...r,ref:e})});wB.displayName=tie;var SB="AlertDialogCancel",kB=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=Jse(SB,n),i=Jl(n),a=er(e,s);return o.jsx(Gy,{...i,...r,ref:a})});kB.displayName=SB;var nie=({contentRef:t})=>{const e=`\`${Rh}\` requires a description for the component to be accessible for screen reader users. -You can add a description to the \`${Mh}\` by passing a \`${pB}\` component as a child, which also benefits sighted users by adding visible context to the dialog. +You can add a description to the \`${Rh}\` by passing a \`${yB}\` 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 \`${Mh}\`. 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. +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 \`${Rh}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return b.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Jse=lB,eie=cB,tie=uB,bB=dB,wB=hB,SB=xB,kB=yB,OB=mB,jB=gB;const Dn=Jse,rs=eie,nie=tie,NB=b.forwardRef(({className:t,...e},n)=>o.jsx(bB,{className:xe("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}));NB.displayName=bB.displayName;const Nn=b.forwardRef(({className:t,...e},n)=>o.jsxs(nie,{children:[o.jsx(NB,{}),o.jsx(wB,{ref:n,className:xe("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})]}));Nn.displayName=wB.displayName;const Cn=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col space-y-2 text-center sm:text-left",t),...e});Cn.displayName="AlertDialogHeader";const Tn=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Tn.displayName="AlertDialogFooter";const En=b.forwardRef(({className:t,...e},n)=>o.jsx(OB,{ref:n,className:xe("text-lg font-semibold",t),...e}));En.displayName=OB.displayName;const _n=b.forwardRef(({className:t,...e},n)=>o.jsx(jB,{ref:n,className:xe("text-sm text-muted-foreground",t),...e}));_n.displayName=jB.displayName;const An=b.forwardRef(({className:t,...e},n)=>o.jsx(SB,{ref:n,className:xe(I0(),t),...e}));An.displayName=SB.displayName;const Mn=b.forwardRef(({className:t,...e},n)=>o.jsx(kB,{ref:n,className:xe(I0({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Mn.displayName=kB.displayName;function rie(){return o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),o.jsxs(ja,{defaultValue:"appearance",className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[o.jsxs(Lt,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(yI,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"外观"})]}),o.jsxs(Lt,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(Fee,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"安全"})]}),o.jsxs(Lt,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(Xu,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"其他"})]}),o.jsxs(Lt,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(Oa,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"关于"})]})]}),o.jsxs(gn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[o.jsx(un,{value:"appearance",className:"mt-0",children:o.jsx(sie,{})}),o.jsx(un,{value:"security",className:"mt-0",children:o.jsx(iie,{})}),o.jsx(un,{value:"other",className:"mt-0",children:o.jsx(aie,{})}),o.jsx(un,{value:"about",className:"mt-0",children:o.jsx(oie,{})})]})]})]})}function nE(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const a=parseInt(i.substring(0,2),16)/255,l=parseInt(i.substring(2,4),16)/255,c=parseInt(i.substring(4,6),16)/255,d=Math.max(a,l,c),h=Math.min(a,l,c);let m=0,g=0;const x=(d+h)/2;if(d!==h){const y=d-h;switch(g=x>.5?y/(2-d-h):y/(d+h),d){case a:m=((l-c)/y+(llocalStorage.getItem("accent-color")||"blue");b.useEffect(()=>{const d=localStorage.getItem("accent-color")||"blue";nE(d)},[]);const c=d=>{l(d),localStorage.setItem("accent-color",d),nE(d)};return o.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[o.jsx(A4,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),o.jsx(A4,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),o.jsx(A4,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[o.jsx(ua,{value:"blue",current:a,onChange:c,label:"蓝色",colorClass:"bg-blue-500"}),o.jsx(ua,{value:"purple",current:a,onChange:c,label:"紫色",colorClass:"bg-purple-500"}),o.jsx(ua,{value:"green",current:a,onChange:c,label:"绿色",colorClass:"bg-green-500"}),o.jsx(ua,{value:"orange",current:a,onChange:c,label:"橙色",colorClass:"bg-orange-500"}),o.jsx(ua,{value:"pink",current:a,onChange:c,label:"粉色",colorClass:"bg-pink-500"}),o.jsx(ua,{value:"red",current:a,onChange:c,label:"红色",colorClass:"bg-red-500"})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[o.jsx(ua,{value:"gradient-sunset",current:a,onChange:c,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),o.jsx(ua,{value:"gradient-ocean",current:a,onChange:c,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),o.jsx(ua,{value:"gradient-forest",current:a,onChange:c,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),o.jsx(ua,{value:"gradient-aurora",current:a,onChange:c,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),o.jsx(ua,{value:"gradient-fire",current:a,onChange:c,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),o.jsx(ua,{value:"gradient-twilight",current:a,onChange:c,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[o.jsx("div",{className:"flex-1",children:o.jsx("input",{type:"color",value:a.startsWith("#")?a:"#3b82f6",onChange:d=>c(d.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),o.jsx("div",{className:"flex-1",children:o.jsx(ze,{type:"text",value:a,onChange:d=>c(d.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),o.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),o.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[o.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5 flex-1",children:[o.jsx(he,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),o.jsx(Bt,{id:"animations",checked:n,onCheckedChange:r})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5 flex-1",children:[o.jsx(he,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),o.jsx(Bt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function iie(){const t=Zi(),[e,n]=b.useState(""),[r,s]=b.useState(""),[i,a]=b.useState(!1),[l,c]=b.useState(!1),[d,h]=b.useState(!1),[m,g]=b.useState(!1),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[k,j]=b.useState(""),[N,T]=b.useState(!1),{toast:E}=as(),_=b.useMemo(()=>Lse(r),[r]),A=()=>localStorage.getItem("access-token")||"",L=async z=>{try{await navigator.clipboard.writeText(z),y(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},P=async()=>{if(!r.trim()){E({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!_.isValid){const z=_.rules.filter(Q=>!Q.passed).map(Q=>Q.label).join(", ");E({title:"格式错误",description:`Token 不符合要求: ${z}`,variant:"destructive"});return}h(!0);try{const z=A(),Q=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({new_token:r.trim()})}),F=await Q.json();Q.ok&&F.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),E({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):E({title:"更新失败",description:F.message||"无法更新 Token",variant:"destructive"})}catch(z){console.error("更新 Token 错误:",z),E({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{h(!1)}},B=async()=>{g(!0);try{const z=A(),Q=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}}),F=await Q.json();Q.ok&&F.success?(localStorage.setItem("access-token",F.token),n(F.token),j(F.token),S(!0),T(!1),E({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):E({title:"生成失败",description:F.message||"无法生成新 Token",variant:"destructive"})}catch(z){console.error("生成 Token 错误:",z),E({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{g(!1)}},$=async()=>{try{await navigator.clipboard.writeText(k),T(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},U=()=>{S(!1),setTimeout(()=>{j(""),T(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},te=z=>{z||U()};return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsx(Dr,{open:w,onOpenChange:te,children:o.jsxs(Sr,{className:"sm:max-w-md",children:[o.jsxs(kr,{children:[o.jsxs(Or,{className:"flex items-center gap-2",children:[o.jsx(Wa,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),o.jsx(ss,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[o.jsx(he,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),o.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:k})]}),o.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Wa,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),o.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[o.jsx("p",{className:"font-semibold",children:"重要提示"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[o.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),o.jsx("li",{children:"请立即复制并保存到安全的位置"}),o.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),o.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),o.jsxs(ws,{className:"gap-2 sm:gap-0",children:[o.jsx(de,{variant:"outline",onClick:$,className:"gap-2",children:N?o.jsxs(o.Fragment,{children:[o.jsx(Ro,{className:"h-4 w-4 text-green-500"}),"已复制"]}):o.jsxs(o.Fragment,{children:[o.jsx(Mv,{className:"h-4 w-4"}),"复制 Token"]})}),o.jsx(de,{onClick:U,children:"我已保存,关闭"})]})]})}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),o.jsx("div",{className:"space-y-3 sm:space-y-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(ze,{id:"current-token",type:i?"text":"password",value:e||A(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),o.jsx("button",{onClick:()=>{e||n(A()),a(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?o.jsx(Rv,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"})})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsx(de,{variant:"outline",size:"icon",onClick:()=>L(A()),title:"复制到剪贴板",className:"flex-shrink-0",children:x?o.jsx(Ro,{className:"h-4 w-4 text-green-500"}):o.jsx(Mv,{className:"h-4 w-4"})}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{variant:"outline",disabled:m,className:"gap-2 flex-1 sm:flex-none",children:[o.jsx(Ps,{className:xe("h-4 w-4",m&&"animate-spin")}),o.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),o.jsx("span",{className:"sm:hidden",children:"生成"})]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认重新生成 Token"}),o.jsx(_n,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:B,children:"确认生成"})]})]})]})]})]}),o.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),o.jsxs("div",{className:"relative",children:[o.jsx(ze,{id:"new-token",type:l?"text":"password",value:r,onChange:z=>s(z.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),o.jsx("button",{onClick:()=>c(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:l?"隐藏":"显示",children:l?o.jsx(Rv,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&o.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),o.jsx("div",{className:"space-y-1.5",children:_.rules.map(z=>o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[z.passed?o.jsx(Vc,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):o.jsx(qee,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:xe(z.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:z.label})]},z.id))}),_.isValid&&o.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[o.jsx(Ro,{className:"h-4 w-4"}),o.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),o.jsx(de,{onClick:P,disabled:d||!_.isValid||!r,className:"w-full sm:w-auto",children:d?"更新中...":"更新自定义 Token"})]})]}),o.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[o.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),o.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),o.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),o.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),o.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),o.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),o.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function aie(){const t=Zi(),{toast:e}=as(),[n,r]=b.useState(!1),[s,i]=b.useState(!1);if(s)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const a=async()=>{r(!0);try{const l=localStorage.getItem("access-token"),c=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${l}`}}),d=await c.json();c.ok&&d.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:d.message||"无法重置配置状态",variant:"destructive"})}catch(l){console.error("重置配置状态错误:",l),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsx("div",{className:"space-y-2",children:o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{variant:"outline",disabled:n,className:"gap-2",children:[o.jsx($ee,{className:xe("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认重新配置"}),o.jsx(_n,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:a,children:"确认重置"})]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[o.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[o.jsx(Wa,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsx("div",{className:"space-y-2",children:o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{variant:"destructive",className:"gap-2",children:[o.jsx(Wa,{className:"h-4 w-4"}),"触发测试错误"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认触发错误"}),o.jsx(_n,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>i(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function oie(){return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:o.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[o.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:o.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),o.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),o.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:xe("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[o.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",o.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",Wj]}),o.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[o.jsxs("p",{children:["版本: ",Uj]}),o.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),o.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",o.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"React 19.2.0"}),o.jsx("li",{children:"TypeScript 5.7.2"}),o.jsx("li",{children:"Vite 6.0.7"}),o.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"shadcn/ui"}),o.jsx("li",{children:"Radix UI"}),o.jsx("li",{children:"Tailwind CSS 3.4.17"}),o.jsx("li",{children:"Lucide Icons"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"后端"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"Python 3.12+"}),o.jsx("li",{children:"FastAPI"}),o.jsx("li",{children:"Uvicorn"}),o.jsx("li",{children:"WebSocket"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"Bun / npm"}),o.jsx("li",{children:"ESLint 9.17.0"}),o.jsx("li",{children:"PostCSS"})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),o.jsx(gn,{className:"h-[300px] sm:h-[400px]",children:o.jsxs("div",{className:"space-y-4 pr-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"React",description:"用户界面构建库",license:"MIT"}),o.jsx(Er,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),o.jsx(Er,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),o.jsx(Er,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),o.jsx(Er,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),o.jsx(Er,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),o.jsx(Er,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),o.jsx(Er,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),o.jsx(Er,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),o.jsx(Er,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),o.jsx(Er,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),o.jsx(Er,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),o.jsx(Er,{name:"Pydantic",description:"数据验证库",license:"MIT"}),o.jsx(Er,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Er,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),o.jsx(Er,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),o.jsx(Er,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),o.jsx(Er,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:o.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[o.jsx("div",{className:"flex-shrink-0 mt-0.5",children:o.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:o.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Er({name:t,description:e,license:n}){return o.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium text-foreground truncate",children:t}),o.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),o.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function A4({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return o.jsxs("button",{onClick:()=>n(t),className:xe("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&o.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),o.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),o.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function ua({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return o.jsxs("button",{onClick:()=>n(t),className:xe("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&o.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),o.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[o.jsx("div",{className:xe("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),o.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class lie{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),a=this.fade(n),l=this.perm[r]+s,c=this.perm[l],d=this.perm[l+1],h=this.perm[r+1]+s,m=this.perm[h],g=this.perm[h+1];return this.mix(this.mix(this.dot(this.grad3[c%12],e,n),this.dot(this.grad3[m%12],e-1,n),i),this.mix(this.dot(this.grad3[d%12],e,n-1),this.dot(this.grad3[g%12],e-1,n-1),i),a)}}function cie(){const t=b.useRef(null),e=b.useRef(null),n=b.useRef(void 0),r=b.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new lie(Math.random()),bounding:null});return b.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const a=r.current,l=()=>{const w=s.getBoundingClientRect();a.bounding=w,i.style.width=`${w.width}px`,i.style.height=`${w.height}px`},c=()=>{if(!a.bounding)return;const{width:w,height:S}=a.bounding;a.lines=[],a.paths.forEach(P=>P.remove()),a.paths=[];const k=10,j=32,N=w+200,T=S+30,E=Math.ceil(N/k),_=Math.ceil(T/j),A=(w-k*E)/2,L=(S-j*_)/2;for(let P=0;P<=E;P++){const B=[];for(let U=0;U<=_;U++){const te={x:A+k*P,y:L+j*U,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};B.push(te)}const $=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild($),a.paths.push($),a.lines.push(B)}},d=w=>{const{lines:S,mouse:k,noise:j}=a;S.forEach(N=>{N.forEach(T=>{const E=j.perlin2((T.x+w*.0125)*.002,(T.y+w*.005)*.0015)*12;T.wave.x=Math.cos(E)*32,T.wave.y=Math.sin(E)*16;const _=T.x-k.sx,A=T.y-k.sy,L=Math.hypot(_,A),P=Math.max(175,k.vs);if(L{const k={x:w.x+w.wave.x+(S?w.cursor.x:0),y:w.y+w.wave.y+(S?w.cursor.y:0)};return k.x=Math.round(k.x*10)/10,k.y=Math.round(k.y*10)/10,k},m=()=>{const{lines:w,paths:S}=a;w.forEach((k,j)=>{let N=h(k[0],!1),T=`M ${N.x} ${N.y}`;k.forEach((E,_)=>{const A=_===k.length-1;N=h(E,!A),T+=`L ${N.x} ${N.y}`}),S[j].setAttribute("d",T)})},g=w=>{const{mouse:S}=a;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const k=S.x-S.lx,j=S.y-S.ly,N=Math.hypot(k,j);S.v=N,S.vs+=(N-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(j,k),s&&(s.style.setProperty("--x",`${S.sx}px`),s.style.setProperty("--y",`${S.sy}px`)),d(w),m(),n.current=requestAnimationFrame(g)},x=w=>{if(!a.bounding)return;const{mouse:S}=a;S.x=w.pageX-a.bounding.left,S.y=w.pageY-a.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},y=()=>{l(),c()};return l(),c(),window.addEventListener("resize",y),window.addEventListener("mousemove",x),n.current=requestAnimationFrame(g),()=>{window.removeEventListener("resize",y),window.removeEventListener("mousemove",x),n.current&&cancelAnimationFrame(n.current)}},[]),o.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[o.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),o.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:o.jsx("style",{children:` +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return b.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},rie=hB,sie=fB,iie=mB,OB=pB,jB=gB,NB=wB,CB=kB,TB=vB,EB=bB;const Fn=rie,is=sie,aie=iie,_B=b.forwardRef(({className:t,...e},n)=>o.jsx(OB,{className:xe("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}));_B.displayName=OB.displayName;const Mn=b.forwardRef(({className:t,...e},n)=>o.jsxs(aie,{children:[o.jsx(_B,{}),o.jsx(jB,{ref:n,className:xe("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})]}));Mn.displayName=jB.displayName;const Rn=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col space-y-2 text-center sm:text-left",t),...e});Rn.displayName="AlertDialogHeader";const Dn=({className:t,...e})=>o.jsx("div",{className:xe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Dn.displayName="AlertDialogFooter";const Pn=b.forwardRef(({className:t,...e},n)=>o.jsx(TB,{ref:n,className:xe("text-lg font-semibold",t),...e}));Pn.displayName=TB.displayName;const zn=b.forwardRef(({className:t,...e},n)=>o.jsx(EB,{ref:n,className:xe("text-sm text-muted-foreground",t),...e}));zn.displayName=EB.displayName;const In=b.forwardRef(({className:t,...e},n)=>o.jsx(NB,{ref:n,className:xe(q0(),t),...e}));In.displayName=NB.displayName;const Ln=b.forwardRef(({className:t,...e},n)=>o.jsx(CB,{ref:n,className:xe(q0({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Ln.displayName=CB.displayName;function oie(){return o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),o.jsxs(Yi,{defaultValue:"appearance",className:"w-full",children:[o.jsxs(ji,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[o.jsxs(Bt,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(kI,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"外观"})]}),o.jsxs(Bt,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(Qee,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"安全"})]}),o.jsxs(Bt,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(Vc,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"其他"})]}),o.jsxs(Bt,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(Xi,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"关于"})]})]}),o.jsxs(pn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[o.jsx(ln,{value:"appearance",className:"mt-0",children:o.jsx(lie,{})}),o.jsx(ln,{value:"security",className:"mt-0",children:o.jsx(cie,{})}),o.jsx(ln,{value:"other",className:"mt-0",children:o.jsx(uie,{})}),o.jsx(ln,{value:"about",className:"mt-0",children:o.jsx(die,{})})]})]})]})}function lE(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const a=parseInt(i.substring(0,2),16)/255,l=parseInt(i.substring(2,4),16)/255,c=parseInt(i.substring(4,6),16)/255,d=Math.max(a,l,c),h=Math.min(a,l,c);let m=0,g=0;const x=(d+h)/2;if(d!==h){const y=d-h;switch(g=x>.5?y/(2-d-h):y/(d+h),d){case a:m=((l-c)/y+(llocalStorage.getItem("accent-color")||"blue");b.useEffect(()=>{const d=localStorage.getItem("accent-color")||"blue";lE(d)},[]);const c=d=>{l(d),localStorage.setItem("accent-color",d),lE(d)};return o.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[o.jsx(P4,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),o.jsx(P4,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),o.jsx(P4,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[o.jsx(ma,{value:"blue",current:a,onChange:c,label:"蓝色",colorClass:"bg-blue-500"}),o.jsx(ma,{value:"purple",current:a,onChange:c,label:"紫色",colorClass:"bg-purple-500"}),o.jsx(ma,{value:"green",current:a,onChange:c,label:"绿色",colorClass:"bg-green-500"}),o.jsx(ma,{value:"orange",current:a,onChange:c,label:"橙色",colorClass:"bg-orange-500"}),o.jsx(ma,{value:"pink",current:a,onChange:c,label:"粉色",colorClass:"bg-pink-500"}),o.jsx(ma,{value:"red",current:a,onChange:c,label:"红色",colorClass:"bg-red-500"})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[o.jsx(ma,{value:"gradient-sunset",current:a,onChange:c,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),o.jsx(ma,{value:"gradient-ocean",current:a,onChange:c,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),o.jsx(ma,{value:"gradient-forest",current:a,onChange:c,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),o.jsx(ma,{value:"gradient-aurora",current:a,onChange:c,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),o.jsx(ma,{value:"gradient-fire",current:a,onChange:c,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),o.jsx(ma,{value:"gradient-twilight",current:a,onChange:c,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[o.jsx("div",{className:"flex-1",children:o.jsx("input",{type:"color",value:a.startsWith("#")?a:"#3b82f6",onChange:d=>c(d.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),o.jsx("div",{className:"flex-1",children:o.jsx(Pe,{type:"text",value:a,onChange:d=>c(d.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),o.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),o.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[o.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5 flex-1",children:[o.jsx(he,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),o.jsx(Ft,{id:"animations",checked:n,onCheckedChange:r})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5 flex-1",children:[o.jsx(he,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),o.jsx(Ft,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function cie(){const t=na(),[e,n]=b.useState(""),[r,s]=b.useState(""),[i,a]=b.useState(!1),[l,c]=b.useState(!1),[d,h]=b.useState(!1),[m,g]=b.useState(!1),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[k,j]=b.useState(""),[N,T]=b.useState(!1),{toast:E}=Lr(),_=b.useMemo(()=>$se(r),[r]),A=()=>localStorage.getItem("access-token")||"",D=async I=>{try{await navigator.clipboard.writeText(I),y(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},q=async()=>{if(!r.trim()){E({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!_.isValid){const I=_.rules.filter(V=>!V.passed).map(V=>V.label).join(", ");E({title:"格式错误",description:`Token 不符合要求: ${I}`,variant:"destructive"});return}h(!0);try{const I=A(),V=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${I}`},body:JSON.stringify({new_token:r.trim()})}),L=await V.json();V.ok&&L.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),E({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):E({title:"更新失败",description:L.message||"无法更新 Token",variant:"destructive"})}catch(I){console.error("更新 Token 错误:",I),E({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{h(!1)}},B=async()=>{g(!0);try{const I=A(),V=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${I}`}}),L=await V.json();V.ok&&L.success?(localStorage.setItem("access-token",L.token),n(L.token),j(L.token),S(!0),T(!1),E({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):E({title:"生成失败",description:L.message||"无法生成新 Token",variant:"destructive"})}catch(I){console.error("生成 Token 错误:",I),E({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{g(!1)}},H=async()=>{try{await navigator.clipboard.writeText(k),T(!0),E({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{E({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},W=()=>{S(!1),setTimeout(()=>{j(""),T(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},ee=I=>{I||W()};return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsx(Er,{open:w,onOpenChange:ee,children:o.jsxs(wr,{className:"sm:max-w-md",children:[o.jsxs(Sr,{children:[o.jsxs(kr,{className:"flex items-center gap-2",children:[o.jsx(Ga,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),o.jsx(Xr,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[o.jsx(he,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),o.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:k})]}),o.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Ga,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),o.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[o.jsx("p",{className:"font-semibold",children:"重要提示"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[o.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),o.jsx("li",{children:"请立即复制并保存到安全的位置"}),o.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),o.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),o.jsxs(fs,{className:"gap-2 sm:gap-0",children:[o.jsx(ue,{variant:"outline",onClick:H,className:"gap-2",children:N?o.jsxs(o.Fragment,{children:[o.jsx(zo,{className:"h-4 w-4 text-green-500"}),"已复制"]}):o.jsxs(o.Fragment,{children:[o.jsx(Iv,{className:"h-4 w-4"}),"复制 Token"]})}),o.jsx(ue,{onClick:W,children:"我已保存,关闭"})]})]})}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),o.jsx("div",{className:"space-y-3 sm:space-y-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(Pe,{id:"current-token",type:i?"text":"password",value:e||A(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),o.jsx("button",{onClick:()=>{e||n(A()),a(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?o.jsx(I0,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(Ji,{className:"h-4 w-4 text-muted-foreground"})})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsx(ue,{variant:"outline",size:"icon",onClick:()=>D(A()),title:"复制到剪贴板",className:"flex-shrink-0",children:x?o.jsx(zo,{className:"h-4 w-4 text-green-500"}):o.jsx(Iv,{className:"h-4 w-4"})}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsxs(ue,{variant:"outline",disabled:m,className:"gap-2 flex-1 sm:flex-none",children:[o.jsx(Qs,{className:xe("h-4 w-4",m&&"animate-spin")}),o.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),o.jsx("span",{className:"sm:hidden",children:"生成"})]})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认重新生成 Token"}),o.jsx(zn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:B,children:"确认生成"})]})]})]})]})]}),o.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),o.jsxs("div",{className:"relative",children:[o.jsx(Pe,{id:"new-token",type:l?"text":"password",value:r,onChange:I=>s(I.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),o.jsx("button",{onClick:()=>c(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:l?"隐藏":"显示",children:l?o.jsx(I0,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(Ji,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&o.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),o.jsx("div",{className:"space-y-1.5",children:_.rules.map(I=>o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[I.passed?o.jsx(Ya,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):o.jsx(OI,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:xe(I.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:I.label})]},I.id))}),_.isValid&&o.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[o.jsx(zo,{className:"h-4 w-4"}),o.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),o.jsx(ue,{onClick:q,disabled:d||!_.isValid||!r,className:"w-full sm:w-auto",children:d?"更新中...":"更新自定义 Token"})]})]}),o.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[o.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),o.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),o.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),o.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),o.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),o.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),o.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function uie(){const t=na(),{toast:e}=Lr(),[n,r]=b.useState(!1),[s,i]=b.useState(!1);if(s)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const a=async()=>{r(!0);try{const l=localStorage.getItem("access-token"),c=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${l}`}}),d=await c.json();c.ok&&d.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:d.message||"无法重置配置状态",variant:"destructive"})}catch(l){console.error("重置配置状态错误:",l),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsx("div",{className:"space-y-2",children:o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsxs(ue,{variant:"outline",disabled:n,className:"gap-2",children:[o.jsx(zj,{className:xe("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认重新配置"}),o.jsx(zn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:a,children:"确认重置"})]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[o.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[o.jsx(Ga,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsx("div",{className:"space-y-2",children:o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsxs(ue,{variant:"destructive",className:"gap-2",children:[o.jsx(Ga,{className:"h-4 w-4"}),"触发测试错误"]})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认触发错误"}),o.jsx(zn,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>i(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function die(){return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:o.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[o.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:o.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),o.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),o.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:xe("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[o.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",o.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",Jj]}),o.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[o.jsxs("p",{children:["版本: ",Zj]}),o.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),o.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",o.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"React 19.2.0"}),o.jsx("li",{children:"TypeScript 5.7.2"}),o.jsx("li",{children:"Vite 6.0.7"}),o.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"shadcn/ui"}),o.jsx("li",{children:"Radix UI"}),o.jsx("li",{children:"Tailwind CSS 3.4.17"}),o.jsx("li",{children:"Lucide Icons"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"后端"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"Python 3.12+"}),o.jsx("li",{children:"FastAPI"}),o.jsx("li",{children:"Uvicorn"}),o.jsx("li",{children:"WebSocket"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"Bun / npm"}),o.jsx("li",{children:"ESLint 9.17.0"}),o.jsx("li",{children:"PostCSS"})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),o.jsx(pn,{className:"h-[300px] sm:h-[400px]",children:o.jsxs("div",{className:"space-y-4 pr-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Dr,{name:"React",description:"用户界面构建库",license:"MIT"}),o.jsx(Dr,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),o.jsx(Dr,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),o.jsx(Dr,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),o.jsx(Dr,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Dr,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),o.jsx(Dr,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Dr,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),o.jsx(Dr,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Dr,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),o.jsx(Dr,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),o.jsx(Dr,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),o.jsx(Dr,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Dr,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),o.jsx(Dr,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Dr,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),o.jsx(Dr,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),o.jsx(Dr,{name:"Pydantic",description:"数据验证库",license:"MIT"}),o.jsx(Dr,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(Dr,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),o.jsx(Dr,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),o.jsx(Dr,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),o.jsx(Dr,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:o.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[o.jsx("div",{className:"flex-shrink-0 mt-0.5",children:o.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:o.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Dr({name:t,description:e,license:n}){return o.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium text-foreground truncate",children:t}),o.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),o.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function P4({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return o.jsxs("button",{onClick:()=>n(t),className:xe("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&o.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),o.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),o.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function ma({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return o.jsxs("button",{onClick:()=>n(t),className:xe("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&o.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),o.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[o.jsx("div",{className:xe("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),o.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class hie{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),a=this.fade(n),l=this.perm[r]+s,c=this.perm[l],d=this.perm[l+1],h=this.perm[r+1]+s,m=this.perm[h],g=this.perm[h+1];return this.mix(this.mix(this.dot(this.grad3[c%12],e,n),this.dot(this.grad3[m%12],e-1,n),i),this.mix(this.dot(this.grad3[d%12],e,n-1),this.dot(this.grad3[g%12],e-1,n-1),i),a)}}function fie(){const t=b.useRef(null),e=b.useRef(null),n=b.useRef(void 0),r=b.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new hie(Math.random()),bounding:null});return b.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const a=r.current,l=()=>{const w=s.getBoundingClientRect();a.bounding=w,i.style.width=`${w.width}px`,i.style.height=`${w.height}px`},c=()=>{if(!a.bounding)return;const{width:w,height:S}=a.bounding;a.lines=[],a.paths.forEach(q=>q.remove()),a.paths=[];const k=10,j=32,N=w+200,T=S+30,E=Math.ceil(N/k),_=Math.ceil(T/j),A=(w-k*E)/2,D=(S-j*_)/2;for(let q=0;q<=E;q++){const B=[];for(let W=0;W<=_;W++){const ee={x:A+k*q,y:D+j*W,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};B.push(ee)}const H=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild(H),a.paths.push(H),a.lines.push(B)}},d=w=>{const{lines:S,mouse:k,noise:j}=a;S.forEach(N=>{N.forEach(T=>{const E=j.perlin2((T.x+w*.0125)*.002,(T.y+w*.005)*.0015)*12;T.wave.x=Math.cos(E)*32,T.wave.y=Math.sin(E)*16;const _=T.x-k.sx,A=T.y-k.sy,D=Math.hypot(_,A),q=Math.max(175,k.vs);if(D{const k={x:w.x+w.wave.x+(S?w.cursor.x:0),y:w.y+w.wave.y+(S?w.cursor.y:0)};return k.x=Math.round(k.x*10)/10,k.y=Math.round(k.y*10)/10,k},m=()=>{const{lines:w,paths:S}=a;w.forEach((k,j)=>{let N=h(k[0],!1),T=`M ${N.x} ${N.y}`;k.forEach((E,_)=>{const A=_===k.length-1;N=h(E,!A),T+=`L ${N.x} ${N.y}`}),S[j].setAttribute("d",T)})},g=w=>{const{mouse:S}=a;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const k=S.x-S.lx,j=S.y-S.ly,N=Math.hypot(k,j);S.v=N,S.vs+=(N-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(j,k),s&&(s.style.setProperty("--x",`${S.sx}px`),s.style.setProperty("--y",`${S.sy}px`)),d(w),m(),n.current=requestAnimationFrame(g)},x=w=>{if(!a.bounding)return;const{mouse:S}=a;S.x=w.pageX-a.bounding.left,S.y=w.pageY-a.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},y=()=>{l(),c()};return l(),c(),window.addEventListener("resize",y),window.addEventListener("mousemove",x),n.current=requestAnimationFrame(g),()=>{window.removeEventListener("resize",y),window.removeEventListener("mousemove",x),n.current&&cancelAnimationFrame(n.current)}},[]),o.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[o.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),o.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:o.jsx("style",{children:` path { fill: none; stroke: hsl(var(--primary) / 0.20); stroke-width: 1px; } - `})})]})}function uie(){const t=Zi();b.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function CB(){return!!localStorage.getItem("access-token")}function die(){const[t,e]=b.useState(""),[n,r]=b.useState(!1),[s,i]=b.useState(""),a=Zi(),{enableWavesBackground:l,setEnableWavesBackground:c}=JL(),{theme:d,setTheme:h}=Vj();b.useEffect(()=>{CB()&&a({to:"/"})},[a]);const g=d==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":d,x=()=>{h(g==="dark"?"light":"dark")},y=async w=>{if(w.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const S=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),k=await S.json();if(S.ok&&k.valid){localStorage.setItem("access-token",t.trim());const j=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),N=await j.json();j.ok&&N.is_first_setup?a({to:"/setup"}):a({to:"/"})}else i(k.message||"Token 验证失败,请检查后重试")}catch(S){console.error("Token 验证错误:",S),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return o.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[l&&o.jsx(cie,{}),o.jsxs(qt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[o.jsx("button",{onClick:x,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:g==="dark"?"切换到浅色模式":"切换到深色模式",children:g==="dark"?o.jsx(nk,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):o.jsx(rk,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),o.jsxs(Fn,{className:"space-y-4 text-center",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:o.jsx(y9,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(qn,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),o.jsx(ts,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),o.jsx(Gn,{children:o.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),o.jsxs("div",{className:"relative",children:[o.jsx(bI,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),o.jsx(ze,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:w=>e(w.target.value),className:xe("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&o.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[o.jsx(Uc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),o.jsx("span",{children:s})]}),o.jsx(de,{type:"submit",className:"w-full",disabled:n,children:n?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),o.jsxs(Dr,{children:[o.jsx(Of,{asChild:!0,children:o.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[o.jsx(Wy,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),o.jsxs(Sr,{className:"sm:max-w-md",children:[o.jsxs(kr,{children:[o.jsxs(Or,{className:"flex items-center gap-2",children:[o.jsx(y9,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),o.jsx(ss,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Hee,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),o.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[o.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),o.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(zl,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),o.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:o.jsx("code",{className:"text-primary",children:"data/webui.json"})}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",o.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),o.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Uc,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[o.jsx("p",{className:"font-semibold",children:"安全提示"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[o.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),o.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[o.jsx(tk,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsxs(En,{className:"flex items-center gap-2",children:[o.jsx(tk,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),o.jsx(_n,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>c(!1),children:"关闭动画"})]})]})]})]})})]}),o.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:o.jsx("p",{children:Bse})})]})}const Mr=b.forwardRef(({className:t,...e},n)=>o.jsx("textarea",{className:xe("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}));Mr.displayName="Textarea";var hie=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fie=hie.reduce((t,e)=>{const n=Fy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),mie="Separator",rE="horizontal",pie=["horizontal","vertical"],TB=b.forwardRef((t,e)=>{const{decorative:n,orientation:r=rE,...s}=t,i=gie(r)?r:rE,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return o.jsx(fie.div,{"data-orientation":i,...l,...s,ref:e})});TB.displayName=mie;function gie(t){return pie.includes(t)}var EB=TB;const L0=b.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>o.jsx(EB,{ref:s,decorative:n,orientation:e,className:xe("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));L0.displayName=EB.displayName;const xie=kf("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 Xn({className:t,variant:e,...n}){return o.jsx("div",{className:xe(xie({variant:e}),t),...n})}function vie({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,a)=>a!==s)})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"qq_account",children:"QQ账号 *"}),o.jsx(ze,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"nickname",children:"昵称 *"}),o.jsx(ze,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{children:"别名"}),o.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>o.jsxs(Xn,{variant:"secondary",className:"gap-1",children:[s,o.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:o.jsx(_p,{className:"h-3 w-3"})})]},i))}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),o.jsx(de,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function yie({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"personality",children:"人格特征 *"}),o.jsx(Mr,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"reply_style",children:"表达风格 *"}),o.jsx(Mr,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"interest",children:"兴趣 *"}),o.jsx(Mr,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),o.jsx(L0,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"plan_style",children:"群聊说话规则 *"}),o.jsx(Mr,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),o.jsx(Mr,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function bie({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{htmlFor:"emoji_chance",children:"表情包激活概率"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),o.jsx(ze,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"max_reg_num",children:"最大表情包数量"}),o.jsx(ze,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"do_replace",children:"达到最大数量时替换"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),o.jsx(Bt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),o.jsx(ze,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),o.jsx(L0,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"steal_emoji",children:"偷取表情包"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),o.jsx(Bt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"content_filtration",children:"启用表情包过滤"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),o.jsx(Bt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"filtration_prompt",children:"过滤要求"}),o.jsx(ze,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function wie({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"enable_tool",children:"启用工具系统"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),o.jsx(Bt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),o.jsx(L0,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"enable_mood",children:"启用情绪系统"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),o.jsx(Bt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&o.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),o.jsx(ze,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"emotion_style",children:"情感特征"}),o.jsx(Mr,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),o.jsx(L0,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"all_global",children:"启用全局黑话模式"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),o.jsx(Bt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}function Sie({config:t,onChange:e}){const[n,r]=b.useState(!1);return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"mt-0.5",children:o.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),o.jsxs("div",{className:"flex-1 text-sm",children:[o.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),o.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),o.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",o.jsx(Ah,{className:"h-3 w-3"})]})]})]})}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),o.jsxs("div",{className:"relative",children:[o.jsx(ze,{id:"siliconflow_api_key",type:n?"text":"password",placeholder:"sk-...",value:t.api_key,onChange:s=>e({api_key:s.target.value}),className:"font-mono pr-10"}),o.jsx(de,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>r(!n),children:n?o.jsx(Rv,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),o.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[o.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[o.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),o.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),o.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),o.jsx("li",{children:"SenseVoice - 语音识别"}),o.jsx("li",{children:"BGE-M3 - 文本嵌入"}),o.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),o.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:o.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[o.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function St(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 Dt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function kie(){const t=await St("/api/webui/config/bot",{method:"GET",headers:Dt()});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 Oie(){const t=await St("/api/webui/config/bot",{method:"GET",headers:Dt()});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 jie(){const t=await St("/api/webui/config/bot",{method:"GET",headers:Dt()});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 Nie(){const t=await St("/api/webui/config/bot",{method:"GET",headers:Dt()});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 Cie(){const t=await St("/api/webui/config/model",{method:"GET",headers:Dt()});if(!t.ok)throw new Error("读取模型配置失败");return{api_key:((await t.json()).config.api_providers||[]).find(i=>i.name==="SiliconFlow")?.api_key||""}}async function Tie(t){const e=await St("/api/webui/config/bot/section/bot",{method:"POST",headers:Dt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function Eie(t){const e=await St("/api/webui/config/bot/section/personality",{method:"POST",headers:Dt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function _ie(t){const e=await St("/api/webui/config/bot/section/emoji",{method:"POST",headers:Dt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function Aie(t){const e=[];e.push(St("/api/webui/config/bot/section/tool",{method:"POST",headers:Dt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(St("/api/webui/config/bot/section/jargon",{method:"POST",headers:Dt(),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(St("/api/webui/config/bot/section/mood",{method:"POST",headers:Dt(),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 Mie(t){const e=await St("/api/webui/config/model",{method:"GET",headers:Dt()});if(!e.ok)throw new Error("读取模型配置失败");const r=(await e.json()).config,s=r.api_providers||[],i=s.findIndex(c=>c.name==="SiliconFlow");i>=0?s[i]={...s[i],api_key:t.api_key}:s.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:t.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const a={...r,api_providers:s},l=await St("/api/webui/config/model",{method:"POST",headers:Dt(),body:JSON.stringify(a)});if(!l.ok){const c=await l.json();throw new Error(c.detail||"保存模型配置失败")}return await l.json()}async function sE(){const t=localStorage.getItem("access-token"),e=await St("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}async function ib(){const t=await St("/api/webui/system/restart",{method:"POST",headers:Dt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"重启失败")}return await t.json()}async function Rie(){const t=await St("/api/webui/system/status",{method:"GET",headers:Dt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取状态失败")}return await t.json()}function Die(){const t=Zi(),{toast:e}=as(),[n,r]=b.useState(0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!0),[h,m]=b.useState({qq_account:0,nickname:"",alias_names:[]}),[g,x]=b.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 + `})})]})}function mie(){const t=na();b.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function AB(){return!!localStorage.getItem("access-token")}function pie(){const[t,e]=b.useState(""),[n,r]=b.useState(!1),[s,i]=b.useState(""),a=na(),{enableWavesBackground:l,setEnableWavesBackground:c}=rB(),{theme:d,setTheme:h}=Kj();b.useEffect(()=>{AB()&&a({to:"/"})},[a]);const g=d==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":d,x=()=>{h(g==="dark"?"light":"dark")},y=async w=>{if(w.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const S=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),k=await S.json();if(S.ok&&k.valid){localStorage.setItem("access-token",t.trim());const j=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),N=await j.json();j.ok&&N.is_first_setup?a({to:"/setup"}):a({to:"/"})}else i(k.message||"Token 验证失败,请检查后重试")}catch(S){console.error("Token 验证错误:",S),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return o.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[l&&o.jsx(fie,{}),o.jsxs(Lt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[o.jsx("button",{onClick:x,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:g==="dark"?"切换到浅色模式":"切换到深色模式",children:g==="dark"?o.jsx(ik,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):o.jsx(ak,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),o.jsxs(En,{className:"space-y-4 text-center",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:o.jsx(j9,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(_n,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),o.jsx(Wr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),o.jsx(Xn,{children:o.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),o.jsxs("div",{className:"relative",children:[o.jsx(jI,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),o.jsx(Pe,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:w=>e(w.target.value),className:xe("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&o.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[o.jsx(Lo,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),o.jsx("span",{children:s})]}),o.jsx(ue,{type:"submit",className:"w-full",disabled:n,children:n?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),o.jsxs(Er,{children:[o.jsx(Of,{asChild:!0,children:o.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[o.jsx(Zy,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),o.jsxs(wr,{className:"sm:max-w-md",children:[o.jsxs(Sr,{children:[o.jsxs(kr,{className:"flex items-center gap-2",children:[o.jsx(j9,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),o.jsx(Xr,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Vee,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),o.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[o.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),o.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Po,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),o.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:o.jsx("code",{className:"text-primary",children:"data/webui.json"})}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",o.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),o.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Lo,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[o.jsx("p",{className:"font-semibold",children:"安全提示"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[o.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),o.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[o.jsx(Zu,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsxs(Pn,{className:"flex items-center gap-2",children:[o.jsx(Zu,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),o.jsx(zn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>c(!1),children:"关闭动画"})]})]})]})]})})]}),o.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:o.jsx("p",{children:Hse})})]})}const Nr=b.forwardRef(({className:t,...e},n)=>o.jsx("textarea",{className:xe("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));Nr.displayName="Textarea";var gie=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xie=gie.reduce((t,e)=>{const n=Vy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),vie="Separator",cE="horizontal",yie=["horizontal","vertical"],MB=b.forwardRef((t,e)=>{const{decorative:n,orientation:r=cE,...s}=t,i=bie(r)?r:cE,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return o.jsx(xie.div,{"data-orientation":i,...l,...s,ref:e})});MB.displayName=vie;function bie(t){return yie.includes(t)}var RB=MB;const $0=b.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>o.jsx(RB,{ref:s,decorative:n,orientation:e,className:xe("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));$0.displayName=RB.displayName;function wie({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,a)=>a!==s)})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"qq_account",children:"QQ账号 *"}),o.jsx(Pe,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"nickname",children:"昵称 *"}),o.jsx(Pe,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{children:"别名"}),o.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>o.jsxs(tn,{variant:"secondary",className:"gap-1",children:[s,o.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:o.jsx(Pp,{className:"h-3 w-3"})})]},i))}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),o.jsx(ue,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function Sie({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"personality",children:"人格特征 *"}),o.jsx(Nr,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"reply_style",children:"表达风格 *"}),o.jsx(Nr,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"interest",children:"兴趣 *"}),o.jsx(Nr,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),o.jsx($0,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"plan_style",children:"群聊说话规则 *"}),o.jsx(Nr,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),o.jsx(Nr,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function kie({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{htmlFor:"emoji_chance",children:"表情包激活概率"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),o.jsx(Pe,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"max_reg_num",children:"最大表情包数量"}),o.jsx(Pe,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"do_replace",children:"达到最大数量时替换"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),o.jsx(Ft,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),o.jsx(Pe,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),o.jsx($0,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"steal_emoji",children:"偷取表情包"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),o.jsx(Ft,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"content_filtration",children:"启用表情包过滤"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),o.jsx(Ft,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"filtration_prompt",children:"过滤要求"}),o.jsx(Pe,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function Oie({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"enable_tool",children:"启用工具系统"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),o.jsx(Ft,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),o.jsx($0,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"enable_mood",children:"启用情绪系统"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),o.jsx(Ft,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&o.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),o.jsx(Pe,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"emotion_style",children:"情感特征"}),o.jsx(Nr,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),o.jsx($0,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(he,{htmlFor:"all_global",children:"启用全局黑话模式"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),o.jsx(Ft,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}function jie({config:t,onChange:e}){const[n,r]=b.useState(!1);return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"mt-0.5",children:o.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),o.jsxs("div",{className:"flex-1 text-sm",children:[o.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),o.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),o.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",o.jsx(w0,{className:"h-3 w-3"})]})]})]})}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(he,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),o.jsxs("div",{className:"relative",children:[o.jsx(Pe,{id:"siliconflow_api_key",type:n?"text":"password",placeholder:"sk-...",value:t.api_key,onChange:s=>e({api_key:s.target.value}),className:"font-mono pr-10"}),o.jsx(ue,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>r(!n),children:n?o.jsx(I0,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(Ji,{className:"h-4 w-4 text-muted-foreground"})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),o.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[o.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[o.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),o.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),o.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),o.jsx("li",{children:"SenseVoice - 语音识别"}),o.jsx("li",{children:"BGE-M3 - 文本嵌入"}),o.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),o.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:o.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[o.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function gt(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 Tt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function Nie(){const t=await gt("/api/webui/config/bot",{method:"GET",headers:Tt()});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 Cie(){const t=await gt("/api/webui/config/bot",{method:"GET",headers:Tt()});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 Tie(){const t=await gt("/api/webui/config/bot",{method:"GET",headers:Tt()});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 Eie(){const t=await gt("/api/webui/config/bot",{method:"GET",headers:Tt()});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 _ie(){const t=await gt("/api/webui/config/model",{method:"GET",headers:Tt()});if(!t.ok)throw new Error("读取模型配置失败");return{api_key:((await t.json()).config.api_providers||[]).find(i=>i.name==="SiliconFlow")?.api_key||""}}async function Aie(t){const e=await gt("/api/webui/config/bot/section/bot",{method:"POST",headers:Tt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function Mie(t){const e=await gt("/api/webui/config/bot/section/personality",{method:"POST",headers:Tt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function Rie(t){const e=await gt("/api/webui/config/bot/section/emoji",{method:"POST",headers:Tt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function Die(t){const e=[];e.push(gt("/api/webui/config/bot/section/tool",{method:"POST",headers:Tt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(gt("/api/webui/config/bot/section/jargon",{method:"POST",headers:Tt(),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(gt("/api/webui/config/bot/section/mood",{method:"POST",headers:Tt(),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 Pie(t){const e=await gt("/api/webui/config/model",{method:"GET",headers:Tt()});if(!e.ok)throw new Error("读取模型配置失败");const r=(await e.json()).config,s=r.api_providers||[],i=s.findIndex(c=>c.name==="SiliconFlow");i>=0?s[i]={...s[i],api_key:t.api_key}:s.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:t.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const a={...r,api_providers:s},l=await gt("/api/webui/config/model",{method:"POST",headers:Tt(),body:JSON.stringify(a)});if(!l.ok){const c=await l.json();throw new Error(c.detail||"保存模型配置失败")}return await l.json()}async function uE(){const t=localStorage.getItem("access-token"),e=await gt("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}async function cb(){const t=await gt("/api/webui/system/restart",{method:"POST",headers:Tt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"重启失败")}return await t.json()}async function zie(){const t=await gt("/api/webui/system/status",{method:"GET",headers:Tt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取状态失败")}return await t.json()}function Iie(){const t=na(),{toast:e}=Lr(),[n,r]=b.useState(0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!0),[h,m]=b.useState({qq_account:0,nickname:"",alias_names:[]}),[g,x]=b.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.请控制你的发言频率,不要太过频繁的发言 4.如果有人对你感到厌烦,请减少回复 5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[y,w]=b.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,k]=b.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遇遇特定事件的时候起伏较大",all_global:!0}),[j,N]=b.useState({api_key:""}),[T,E]=b.useState(!1),[_,A]=b.useState(""),L=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:a0},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:Dv},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:_j},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Xu},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:bI}],P=(n+1)/L.length*100;b.useEffect(()=>{(async()=>{try{d(!0);const[Y,J,X,R,ie]=await Promise.all([kie(),Oie(),jie(),Nie(),Cie()]);m(Y),x(J),w(X),k(R),N(ie)}catch(Y){e({title:"加载配置失败",description:Y instanceof Error?Y.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{d(!1)}})()},[e]);const B=async()=>{l(!0);try{switch(n){case 0:await Tie(h);break;case 1:await Eie(g);break;case 2:await _ie(y);break;case 3:await Aie(S);break;case 4:await Mie(j);break}return e({title:"保存成功",description:`${L[n].title}配置已保存`}),!0}catch(F){return e({title:"保存失败",description:F instanceof Error?F.message:"未知错误",variant:"destructive"}),!1}finally{l(!1)}},$=async()=>{await B()&&n{n>0&&r(n-1)},te=async()=>{i(!0),E(!0);try{if(A("正在保存API配置..."),!await B()){i(!1),E(!1);return}A("正在完成初始化..."),await sE(),A("正在重启麦麦..."),await ib(),e({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),A("等待麦麦重启完成...");const Y=60;let J=0,X=!1;for(;JsetTimeout(R,1e3));try{(await Rie()).running&&(X=!0,A("重启成功!正在跳转..."))}catch{J++}}if(!X)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{t({to:"/"})},1e3)}catch(F){E(!1),e({title:"配置失败",description:F instanceof Error?F.message:"未知错误",variant:"destructive"})}finally{i(!1)}},z=async()=>{try{await sE(),t({to:"/"})}catch(F){e({title:"跳过失败",description:F instanceof Error?F.message:"未知错误",variant:"destructive"})}},Q=()=>{switch(n){case 0:return o.jsx(vie,{config:h,onChange:m});case 1:return o.jsx(yie,{config:g,onChange:x});case 2:return o.jsx(bie,{config:y,onChange:w});case 3:return o.jsx(wie,{config:S,onChange:k});case 4:return o.jsx(Sie,{config:j,onChange:N});default:return null}};return o.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[T&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:o.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[o.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:o.jsx(Po,{className:"h-10 w-10 animate-spin text-primary"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),o.jsx("p",{className:"text-muted-foreground",children:_})]}),o.jsx("div",{className:"w-full",children:o.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:o.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),o.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[o.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),o.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),c?o.jsxs("div",{className:"relative z-10 text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:o.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),o.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),o.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[o.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:o.jsx(Qee,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),o.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),o.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",Wj," 的初始配置"]})]}),o.jsxs("div",{className:"mb-6 md:mb-8",children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[o.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",L.length]}),o.jsxs("span",{className:"font-medium text-primary",children:[Math.round(P),"%"]})]}),o.jsx(Lp,{value:P,className:"h-2"})]}),o.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:L.map((F,Y)=>{const J=F.icon;return o.jsxs("div",{className:xe("flex flex-1 flex-col items-center gap-1 md:gap-2",Yt({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[o.jsx(D0,{className:"h-4 w-4"}),"返回首页"]}),o.jsxs(de,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[o.jsx(wI,{className:"h-4 w-4"}),"返回上一页"]})]}),o.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var AB=["PageUp","PageDown"],MB=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],RB={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},jf="Slider",[mk,Pie,zie]=By(jf),[DB]=Ra(jf,[zie]),[Iie,ab]=DB(jf),PB=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:a="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[r],value:h,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:y,...w}=t,S=b.useRef(new Set),k=b.useRef(0),N=a==="horizontal"?Lie:Bie,[T=[],E]=Xl({prop:h,defaultProp:d,onChange:$=>{[...S.current][k.current]?.focus(),m($)}}),_=b.useRef(T);function A($){const U=Qie(T,$);B($,U)}function L($){B($,k.current)}function P(){const $=_.current[k.current];T[k.current]!==$&&g(T)}function B($,U,{commit:te}={commit:!1}){const z=Gie(i),Q=Xie(Math.round(($-r)/i)*i+r,z),F=Sj(Q,[r,s]);E((Y=[])=>{const J=$ie(Y,F,U);if(Wie(J,c*i)){k.current=J.indexOf(F);const X=String(J)!==String(Y);return X&&te&&g(J),X?J:Y}else return Y})}return o.jsx(Iie,{scope:t.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:k,thumbs:S.current,values:T,orientation:a,form:y,children:o.jsx(mk.Provider,{scope:t.__scopeSlider,children:o.jsx(mk.Slot,{scope:t.__scopeSlider,children:o.jsx(N,{"aria-disabled":l,"data-disabled":l?"":void 0,...w,ref:e,onPointerDown:nt(w.onPointerDown,()=>{l||(_.current=T)}),min:r,max:s,inverted:x,onSlideStart:l?void 0:A,onSlideMove:l?void 0:L,onSlideEnd:l?void 0:P,onHomeKeyDown:()=>!l&&B(r,0,{commit:!0}),onEndKeyDown:()=>!l&&B(s,T.length-1,{commit:!0}),onStepKeyDown:({event:$,direction:U})=>{if(!l){const Q=AB.includes($.key)||$.shiftKey&&MB.includes($.key)?10:1,F=k.current,Y=T[F],J=i*Q*U;B(Y+J,F,{commit:!0})}}})})})})});PB.displayName=jf;var[zB,IB]=DB(jf,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Lie=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:a,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...h}=t,[m,g]=b.useState(null),x=Yn(e,N=>g(N)),y=b.useRef(void 0),w=Ep(s),S=w==="ltr",k=S&&!i||!S&&i;function j(N){const T=y.current||m.getBoundingClientRect(),E=[0,T.width],A=Xj(E,k?[n,r]:[r,n]);return y.current=T,A(N-T.left)}return o.jsx(zB,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:o.jsx(LB,{dir:w,"data-orientation":"horizontal",...h,ref:x,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:N=>{const T=j(N.clientX);a?.(T)},onSlideMove:N=>{const T=j(N.clientX);l?.(T)},onSlideEnd:()=>{y.current=void 0,c?.()},onStepKeyDown:N=>{const E=RB[k?"from-left":"from-right"].includes(N.key);d?.({event:N,direction:E?-1:1})}})})}),Bie=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:l,onStepKeyDown:c,...d}=t,h=b.useRef(null),m=Yn(e,h),g=b.useRef(void 0),x=!s;function y(w){const S=g.current||h.current.getBoundingClientRect(),k=[0,S.height],N=Xj(k,x?[r,n]:[n,r]);return g.current=S,N(w-S.top)}return o.jsx(zB,{scope:t.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:o.jsx(LB,{"data-orientation":"vertical",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const S=y(w.clientY);i?.(S)},onSlideMove:w=>{const S=y(w.clientY);a?.(S)},onSlideEnd:()=>{g.current=void 0,l?.()},onStepKeyDown:w=>{const k=RB[x?"from-bottom":"from-top"].includes(w.key);c?.({event:w,direction:k?-1:1})}})})}),LB=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:l,onStepKeyDown:c,...d}=t,h=ab(jf,n);return o.jsx(xn.span,{...d,ref:e,onKeyDown:nt(t.onKeyDown,m=>{m.key==="Home"?(a(m),m.preventDefault()):m.key==="End"?(l(m),m.preventDefault()):AB.concat(MB).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:nt(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),h.thumbs.has(g)?g.focus():r(m)}),onPointerMove:nt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:nt(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),BB="SliderTrack",FB=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=ab(BB,n);return o.jsx(xn.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});FB.displayName=BB;var pk="SliderRange",qB=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=ab(pk,n),i=IB(pk,n),a=b.useRef(null),l=Yn(e,a),c=s.values.length,d=s.values.map(g=>QB(g,s.min,s.max)),h=c>1?Math.min(...d):0,m=100-Math.max(...d);return o.jsx(xn.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...t.style,[i.startEdge]:h+"%",[i.endEdge]:m+"%"}})});qB.displayName=pk;var gk="SliderThumb",$B=b.forwardRef((t,e)=>{const n=Pie(t.__scopeSlider),[r,s]=b.useState(null),i=Yn(e,l=>s(l)),a=b.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return o.jsx(Fie,{...t,ref:i,index:a})}),Fie=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,a=ab(gk,n),l=IB(gk,n),[c,d]=b.useState(null),h=Yn(e,j=>d(j)),m=c?a.form||!!c.closest("form"):!0,g=tI(c),x=a.values[r],y=x===void 0?0:QB(x,a.min,a.max),w=Hie(r,a.values.length),S=g?.[l.size],k=S?Vie(S,y,l.direction):0;return b.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${y}% + ${k}px)`},children:[o.jsx(mk.ItemSlot,{scope:t.__scopeSlider,children:o.jsx(xn.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":a.min,"aria-valuenow":x,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:h,style:x===void 0?{display:"none"}:t.style,onFocus:nt(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),m&&o.jsx(HB,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:x},r)]})});$B.displayName=gk;var qie="RadioBubbleInput",HB=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),i=Yn(s,r),a=eI(e);return b.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==e&&h){const m=new Event("input",{bubbles:!0});h.call(l,e),l.dispatchEvent(m)}},[a,e]),o.jsx(xn.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});HB.displayName=qie;function $ie(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function QB(t,e,n){const i=100/(n-e)*(t-e);return Sj(i,[0,100])}function Hie(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Qie(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 Vie(t,e,n){const r=t/2,i=Xj([0,50],[0,r]);return(r-i(e)*n)*n}function Uie(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Wie(t,e){if(e>0){const n=Uie(t);return Math.min(...n)>=e}return!0}function Xj(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 Gie(t){return(String(t).split(".")[1]||"").length}function Xie(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var VB=PB,Yie=FB,Kie=qB,Zie=$B;const Bp=b.forwardRef(({className:t,...e},n)=>o.jsxs(VB,{ref:n,className:xe("relative flex w-full touch-none select-none items-center",t),...e,children:[o.jsx(Yie,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:o.jsx(Kie,{className:"absolute h-full bg-primary"})}),o.jsx(Zie,{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"})]}));Bp.displayName=VB.displayName;const Vt=Aee,Ut=Mee,$t=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(iI,{ref:r,className:xe("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,o.jsx(Nee,{asChild:!0,children:o.jsx(nd,{className:"h-4 w-4 opacity-50"})})]}));$t.displayName=iI.displayName;const UB=b.forwardRef(({className:t,...e},n)=>o.jsx(aI,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(P0,{className:"h-4 w-4"})}));UB.displayName=aI.displayName;const WB=b.forwardRef(({className:t,...e},n)=>o.jsx(oI,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(nd,{className:"h-4 w-4"})}));WB.displayName=oI.displayName;const Ht=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>o.jsx(Cee,{children:o.jsxs(lI,{ref:s,className:xe("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[o.jsx(UB,{}),o.jsx(Tee,{className:xe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),o.jsx(WB,{})]})}));Ht.displayName=lI.displayName;const Jie=b.forwardRef(({className:t,...e},n)=>o.jsx(cI,{ref:n,className:xe("px-2 py-1.5 text-sm font-semibold",t),...e}));Jie.displayName=cI.displayName;const De=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(uI,{ref:r,className:xe("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[o.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(Eee,{children:o.jsx(Ro,{className:"h-4 w-4"})})}),o.jsx(_ee,{children:e})]}));De.displayName=uI.displayName;const eae=b.forwardRef(({className:t,...e},n)=>o.jsx(dI,{ref:n,className:xe("-mx-1 my-1 h-px bg-muted",t),...e}));eae.displayName=dI.displayName;function tae(t){const e=nae(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,l=b.Children.toArray(i),c=l.find(sae);if(c){const d=c.props.children,h=l.map(m=>m===c?b.Children.count(d)>1?b.Children.only(null):b.isValidElement(d)?d.props.children:null:m);return o.jsx(e,{...a,ref:s,children:b.isValidElement(d)?b.cloneElement(d,void 0,h):null})}return o.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function nae(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=aae(s),l=iae(i,s.props);return s.type!==b.Fragment&&(l.ref=r?Qc(r,a):a),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var rae=Symbol("radix.slottable");function sae(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===rae}function iae(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function aae(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 ob="Popover",[GB]=Ra(ob,[vf]),Fp=vf(),[oae,iu]=GB(ob),XB=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=t,l=Fp(e),c=b.useRef(null),[d,h]=b.useState(!1),[m,g]=Xl({prop:r,defaultProp:s??!1,onChange:i,caller:ob});return o.jsx(Vy,{...l,children:o.jsx(oae,{scope:e,contentId:Ui(),triggerRef:c,open:m,onOpenChange:g,onOpenToggle:b.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:d,onCustomAnchorAdd:b.useCallback(()=>h(!0),[]),onCustomAnchorRemove:b.useCallback(()=>h(!1),[]),modal:a,children:n})})};XB.displayName=ob;var YB="PopoverAnchor",lae=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=iu(YB,n),i=Fp(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:l}=s;return b.useEffect(()=>(a(),()=>l()),[a,l]),o.jsx(Uy,{...i,...r,ref:e})});lae.displayName=YB;var KB="PopoverTrigger",ZB=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=iu(KB,n),i=Fp(n),a=Yn(e,s.triggerRef),l=o.jsx(xn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":rF(s.open),...r,ref:a,onClick:nt(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:o.jsx(Uy,{asChild:!0,...i,children:l})});ZB.displayName=KB;var Yj="PopoverPortal",[cae,uae]=GB(Yj,{forceMount:void 0}),JB=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=iu(Yj,e);return o.jsx(cae,{scope:e,forceMount:n,children:o.jsx(ii,{present:n||i.open,children:o.jsx(Qy,{asChild:!0,container:s,children:r})})})};JB.displayName=Yj;var Kh="PopoverContent",eF=b.forwardRef((t,e)=>{const n=uae(Kh,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=iu(Kh,t.__scopePopover);return o.jsx(ii,{present:r||i.open,children:i.modal?o.jsx(hae,{...s,ref:e}):o.jsx(fae,{...s,ref:e})})});eF.displayName=Kh;var dae=tae("PopoverContent.RemoveScroll"),hae=b.forwardRef((t,e)=>{const n=iu(Kh,t.__scopePopover),r=b.useRef(null),s=Yn(e,r),i=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return hI(a)},[]),o.jsx(fI,{as:dae,allowPinchZoom:!0,children:o.jsx(tF,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nt(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:nt(t.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:nt(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),fae=b.forwardRef((t,e)=>{const n=iu(Kh,t.__scopePopover),r=b.useRef(!1),s=b.useRef(!1);return o.jsx(tF,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;n.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),tF=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,...m}=t,g=iu(Kh,n),x=Fp(n);return mI(),o.jsx(pI,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:o.jsx(Cj,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>g.onOpenChange(!1),children:o.jsx(Tj,{"data-state":rF(g.open),role:"dialog",id:g.contentId,...x,...m,ref:e,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),nF="PopoverClose",mae=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=iu(nF,n);return o.jsx(xn.button,{type:"button",...r,ref:e,onClick:nt(t.onClick,()=>s.onOpenChange(!1))})});mae.displayName=nF;var pae="PopoverArrow",gae=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Fp(n);return o.jsx(Ej,{...s,...r,ref:e})});gae.displayName=pae;function rF(t){return t?"open":"closed"}var xae=XB,vae=ZB,yae=JB,sF=eF;const zo=xae,Io=vae,Xa=b.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>o.jsx(yae,{children:o.jsx(sF,{ref:s,align:e,sideOffset:n,className:xe("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})}));Xa.displayName=sF.displayName;const au="/api/webui/config";async function iE(){const e=await(await St(`${au}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Rh(){const e=await(await St(`${au}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function aE(t){const n=await(await St(`${au}/bot`,{method:"POST",headers:Dt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function bae(){const e=await(await St(`${au}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function wae(t){const n=await(await St(`${au}/bot/raw`,{method:"POST",headers:Dt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function qv(t){const n=await(await St(`${au}/model`,{method:"POST",headers:Dt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function Sae(t,e){const r=await(await St(`${au}/bot/section/${t}`,{method:"POST",headers:Dt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function xk(t,e){const r=await(await St(`${au}/model/section/${t}`,{method:"POST",headers:Dt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function kae(t,e="openai",n="/models"){const r=new URLSearchParams({provider_name:t,parser:e,endpoint:n}),s=await St(`/api/webui/models/list?${r}`);if(!s.ok){const a=await s.json().catch(()=>({}));throw new Error(a.detail||`获取模型列表失败 (${s.status})`)}const i=await s.json();if(!i.success)throw new Error("获取模型列表失败");return i.models}const Oae=kf("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"}}),ga=b.forwardRef(({className:t,variant:e,...n},r)=>o.jsx("div",{ref:r,role:"alert",className:xe(Oae({variant:e}),t),...n}));ga.displayName="Alert";const jae=b.forwardRef(({className:t,...e},n)=>o.jsx("h5",{ref:n,className:xe("mb-1 font-medium leading-none tracking-tight",t),...e}));jae.displayName="AlertTitle";const xa=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("text-sm [&_p]:leading-relaxed",t),...e}));xa.displayName="AlertDescription";function Kj({onRestartComplete:t,onRestartFailed:e}){const[n,r]=b.useState(0),[s,i]=b.useState("restarting"),[a,l]=b.useState(0),[c,d]=b.useState(0);b.useEffect(()=>{const g=setInterval(()=>{r(w=>w>=90?w:w+1)},200),x=setInterval(()=>{l(w=>w+1)},1e3),y=setTimeout(()=>{i("checking"),h()},3e3);return()=>{clearInterval(g),clearInterval(x),clearTimeout(y)}},[]);const h=()=>{const x=async()=>{try{if(d(w=>w+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{c<60?setTimeout(x,2e3):(i("failed"),e?.())}};x()},m=g=>{const x=Math.floor(g/60),y=g%60;return`${x}:${y.toString().padStart(2,"0")}`};return o.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:o.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[o.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&o.jsxs(o.Fragment,{children:[o.jsx(Po,{className:"h-16 w-16 text-primary animate-spin"}),o.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&o.jsxs(o.Fragment,{children:[o.jsx(Po,{className:"h-16 w-16 text-primary animate-spin"}),o.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),o.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",c,"/60)"]})]}),s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(Vc,{className:"h-16 w-16 text-green-500"}),o.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&o.jsxs(o.Fragment,{children:[o.jsx(Uc,{className:"h-16 w-16 text-destructive"}),o.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(Lp,{value:n,className:"h-2"}),o.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[o.jsxs("span",{children:[n,"%"]}),o.jsxs("span",{children:["已用时: ",m(a)]})]})]}),o.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),o.jsx("div",{className:"bg-yellow-500/10 border border-yellow-500/50 rounded-lg p-4",children:o.jsxs("p",{className:"text-sm text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"⚠️ 重要提示:"})," 由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})}),s==="failed"&&o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),o.jsx("button",{onClick:()=>{i("checking"),d(0),h()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let vk=[],iF=[];(()=>{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=iF[r])e=r+1;else return!0;if(e==n)return!1}}function oE(t){return t>=127462&&t<=127487}const lE=8205;function Cae(t,e,n=!0,r=!0){return(n?aF:Tae)(t,e,r)}function aF(t,e,n){if(e==t.length)return e;e&&oF(t.charCodeAt(e))&&lF(t.charCodeAt(e-1))&&e--;let r=M4(t,e);for(e+=cE(r);e=0&&oE(M4(t,a));)i++,a-=2;if(i%2==0)break;e+=2}else break}return e}function Tae(t,e,n){for(;e>0;){let r=aF(t,e-2,n);if(r=56320&&t<57344}function lF(t){return t>=55296&&t<56320}function cE(t){return t<65536?1:2}class jn{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]=Zh(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),iv.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]=Zh(this,e,n);let r=[];return this.decompose(e,n,r,0),iv.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 b0(this),i=new b0(e);for(let a=n,l=n;;){if(s.next(a),i.next(a),a=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(l+=s.value.length,s.done||l>=r)return!0}}iter(e=1){return new b0(this,e)}iterRange(e,n=this.length){return new cF(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 uF(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]?jn.empty:e.length<=32?new Hr(e):iv.from(Hr.split(e,[]))}}class Hr extends jn{constructor(e,n=Eae(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.text[i],l=s+a.length;if((n?r:l)>=e)return new _ae(s,l,r,a);s=l+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new Hr(uE(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let a=r.pop(),l=av(i.text,a.text.slice(),0,i.length);if(l.length<=32)r.push(new Hr(l,a.length+i.length));else{let c=l.length>>1;r.push(new Hr(l.slice(0,c)),new Hr(l.slice(c)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof Hr))return super.replace(e,n,r);[e,n]=Zh(this,e,n);let s=av(this.text,av(r.text,uE(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new Hr(s,i):iv.from(Hr.split(s,[]),i)}sliceString(e,n=this.length,r=` -`){[e,n]=Zh(this,e,n);let s="";for(let i=0,a=0;i<=n&&ae&&a&&(s+=r),ei&&(s+=l.slice(Math.max(0,e-i),n-i)),i=c+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new Hr(r,s)),r=[],s=-1);return s>-1&&n.push(new Hr(r,s)),n}}let iv=class vh extends jn{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.children[i],l=s+a.length,c=r+a.lines-1;if((n?c:l)>=e)return a.lineInner(e,n,r,s);s=l+1,r=c+1}}decompose(e,n,r,s){for(let i=0,a=0;a<=n&&i=a){let d=s&((a<=e?1:0)|(c>=n?2:0));a>=e&&c<=n&&!d?r.push(l):l.decompose(e-a,n-a,r,d)}a=c+1}}replace(e,n,r){if([e,n]=Zh(this,e,n),r.lines=i&&n<=l){let c=a.replace(e-i,n-i,r),d=this.lines-a.lines+c.lines;if(c.lines>4&&c.lines>d>>6){let h=this.children.slice();return h[s]=c,new vh(h,this.length-(n-e)+r.length)}return super.replace(i,l,c)}i=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` -`){[e,n]=Zh(this,e,n);let s="";for(let i=0,a=0;ie&&i&&(s+=r),ea&&(s+=l.sliceString(e-a,n-a,r)),a=c+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof vh))return 0;let r=0,[s,i,a,l]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==a||i==l)return r;let c=this.children[s],d=e.children[i];if(c!=d)return r+c.scanIdentical(d,n);r+=c.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let x of e)r+=x.lines;if(r<32){let x=[];for(let y of e)y.flatten(x);return new Hr(x,n)}let s=Math.max(32,r>>5),i=s<<1,a=s>>1,l=[],c=0,d=-1,h=[];function m(x){let y;if(x.lines>i&&x instanceof vh)for(let w of x.children)m(w);else x.lines>a&&(c>a||!c)?(g(),l.push(x)):x instanceof Hr&&c&&(y=h[h.length-1])instanceof Hr&&x.lines+y.lines<=32?(c+=x.lines,d+=x.length+1,h[h.length-1]=new Hr(y.text.concat(x.text),y.length+1+x.length)):(c+x.lines>s&&g(),c+=x.lines,d+=x.length+1,h.push(x))}function g(){c!=0&&(l.push(h.length==1?h[0]:vh.from(h,d)),d=-1,c=h.length=0)}for(let x of e)m(x);return g(),l.length==1?l[0]:new vh(l,n)}};jn.empty=new Hr([""],0);function Eae(t){let e=-1;for(let n of t)e+=n.length+1;return e}function av(t,e,n=0,r=1e9){for(let s=0,i=0,a=!0;i=n&&(c>r&&(l=l.slice(0,r-s)),s0?1:(e instanceof Hr?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],a=i>>1,l=s instanceof Hr?s.text.length:s.children.length;if(a==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(s instanceof Hr){let c=s.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,c.length>Math.max(0,e))return this.value=e==0?c:n>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=s.children[a+(n<0?-1:0)];e>c.length?(e-=c.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof Hr?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class cF{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new b0(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 uF{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"&&(jn.prototype[Symbol.iterator]=function(){return this.iter()},b0.prototype[Symbol.iterator]=cF.prototype[Symbol.iterator]=uF.prototype[Symbol.iterator]=function(){return this});class _ae{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 Zh(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function zs(t,e,n=!0,r=!0){return Cae(t,e,n,r)}function Aae(t){return t>=56320&&t<57344}function Mae(t){return t>=55296&&t<56320}function gi(t,e){let n=t.charCodeAt(e);if(!Mae(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Aae(r)?(n-55296<<10)+(r-56320)+65536:n}function Zj(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function wo(t){return t<65536?1:2}const yk=/\r\n?|\n/;var Ds=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Ds||(Ds={}));class Do{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=l}else{if(r!=Ds.Simple&&d>=e&&(r==Ds.TrackDel&&se||r==Ds.TrackBefore&&se))return null;if(d>e||d==e&&n<0&&!l)return e==s||n<0?i:i+c;i+=c}s=d}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&&l>=e)return sn?"cover":!0;s=l}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 Do(e)}static create(e){return new Do(e)}}class us extends Do{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 bk(this,(n,r,s,i,a)=>e=e.replace(s,s+(r-n),a),!1),e}mapDesc(e,n=!1){return wk(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=l,n[s+1]=a;let c=s>>1;for(;r.length0&&Bc(r,n,i.text),i.forward(h),l+=h}let d=e[a++];for(;l>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],a=0,l=null;function c(h=!1){if(!h&&!s.length)return;ag||m<0||g>n)throw new RangeError(`Invalid change range ${m} to ${g} (in doc of length ${n})`);let y=x?typeof x=="string"?jn.of(x.split(r||yk)):x:jn.empty,w=y.length;if(m==g&&w==0)return;ma&&$s(s,m-a,-1),$s(s,g-m,w),Bc(i,s,y),a=g}}return d(e),c(!l),l}static empty(e){return new us(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;sl&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function Bc(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||a==t.sections.length||t.sections[a+1]<0);)l=t.sections[a++],c=t.sections[a++];e(s,d,i,h,m),s=d,i=h}}}function wk(t,e,n,r=!1){let s=[],i=r?[]:null,a=new B0(t),l=new B0(e);for(let c=-1;;){if(a.done&&l.len||l.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&l.ins==-1){let d=Math.min(a.len,l.len);$s(s,d,-1),a.forward(d),l.forward(d)}else if(l.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(l.len=0&&c=0){let d=0,h=a.len;for(;h;)if(l.ins==-1){let m=Math.min(h,l.len);d+=m,h-=m,l.forward(m)}else if(l.ins==0&&l.lenc||a.ins>=0&&a.len>c)&&(l||r.length>d),i.forward2(c),a.forward(c)}}}}class B0{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?jn.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?jn.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 Hu{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 Hu(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Me.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Me.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Me.range(e.anchor,e.head)}static create(e,n,r){return new Hu(e,n,r)}}class Me{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Me.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Me(e.ranges.map(n=>Hu.fromJSON(n)),e.main)}static single(e,n=e){return new Me([Me.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Me.range(c,l):Me.range(l,c))}}return new Me(e,n)}}function hF(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Jj=0;class at{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=Jj++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new at(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:e6),!!e.static,e.enables)}of(e){return new ov([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ov(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ov(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function e6(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class ov{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=Jj++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,a=e[i]>>1,l=this.type==2,c=!1,d=!1,h=[];for(let m of this.dependencies)m=="doc"?c=!0:m=="selection"?d=!0:(((n=e[m.id])!==null&&n!==void 0?n:1)&1)==0&&h.push(e[m.id]);return{create(m){return m.values[a]=r(m),1},update(m,g){if(c&&g.docChanged||d&&(g.docChanged||g.selection)||Sk(m,h)){let x=r(m);if(l?!dE(x,m.values[a],s):!s(x,m.values[a]))return m.values[a]=x,1}return 0},reconfigure:(m,g)=>{let x,y=g.config.address[i];if(y!=null){let w=Hv(g,y);if(this.dependencies.every(S=>S instanceof at?g.facet(S)===m.facet(S):S instanceof Os?g.field(S,!1)==m.field(S,!1):!0)||(l?dE(x=r(m),w,s):s(x=r(m),w)))return m.values[a]=w,0}else x=r(m);return m.values[a]=x,1}}}}function dE(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[c.id]),s=n.map(c=>c.type),i=r.filter(c=>!(c&1)),a=t[e.id]>>1;function l(c){let d=[];for(let h=0;hr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Zx).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],a=this.updateF(i,s);return this.compareF(i,a)?0:(r.values[n]=a,1)},reconfigure:(r,s)=>{let i=r.facet(Zx),a=s.facet(Zx),l;return(l=i.find(c=>c.field==this))&&l!=a.find(c=>c.field==this)?(r.values[n]=l.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Zx.of({field:this,create:e})]}get extension(){return this}}const Fu={lowest:4,low:3,default:2,high:1,highest:0};function Bm(t){return e=>new fF(e,t)}const ou={highest:Bm(Fu.highest),high:Bm(Fu.high),default:Bm(Fu.default),low:Bm(Fu.low),lowest:Bm(Fu.lowest)};class fF{constructor(e,n){this.inner=e,this.prec=n}}class lb{of(e){return new kk(this,e)}reconfigure(e){return lb.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class kk{constructor(e,n){this.compartment=e,this.inner=n}}class $v{constructor(e,n,r,s,i,a){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),a=new Map;for(let g of Dae(e,n,a))g instanceof Os?s.push(g):(i[g.facet.id]||(i[g.facet.id]=[])).push(g);let l=Object.create(null),c=[],d=[];for(let g of s)l[g.id]=d.length<<1,d.push(x=>g.slot(x));let h=r?.config.facets;for(let g in i){let x=i[g],y=x[0].facet,w=h&&h[g]||[];if(x.every(S=>S.type==0))if(l[y.id]=c.length<<1|1,e6(w,x))c.push(r.facet(y));else{let S=y.combine(x.map(k=>k.value));c.push(r&&y.compare(S,r.facet(y))?r.facet(y):S)}else{for(let S of x)S.type==0?(l[S.id]=c.length<<1|1,c.push(S.value)):(l[S.id]=d.length<<1,d.push(k=>S.dynamicSlot(k)));l[y.id]=d.length<<1,d.push(S=>Rae(S,y,x))}}let m=d.map(g=>g(l));return new $v(e,a,m,l,c,i)}}function Dae(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(a,l){let c=s.get(a);if(c!=null){if(c<=l)return;let d=r[c].indexOf(a);d>-1&&r[c].splice(d,1),a instanceof kk&&n.delete(a.compartment)}if(s.set(a,l),Array.isArray(a))for(let d of a)i(d,l);else if(a instanceof kk){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;n.set(a.compartment,d),i(d,l)}else if(a instanceof fF)i(a.inner,a.prec);else if(a instanceof Os)r[l].push(a),a.provides&&i(a.provides,l);else if(a instanceof ov)r[l].push(a),a.facet.extensions&&i(a.facet.extensions,Fu.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(d,l)}}return i(t,Fu.default),r.reduce((a,l)=>a.concat(l))}function w0(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 Hv(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const mF=at.define(),Ok=at.define({combine:t=>t.some(e=>e),static:!0}),pF=at.define({combine:t=>t.length?t[0]:void 0,static:!0}),gF=at.define(),xF=at.define(),vF=at.define(),yF=at.define({combine:t=>t.length?t[0]:!1});class qo{constructor(e,n){this.type=e,this.value=n}static define(){return new Pae}}class Pae{of(e){return new qo(this,e)}}class zae{constructor(e){this.map=e}of(e){return new Ft(this,e)}}class Ft{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 Ft(this.type,n)}is(e){return this.type==e}static define(e={}){return new zae(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}}Ft.reconfigure=Ft.define();Ft.appendConfig=Ft.define();class ns{constructor(e,n,r,s,i,a){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=a,this._doc=null,this._state=null,r&&hF(r,n.newLength),i.some(l=>l.type==ns.time)||(this.annotations=i.concat(ns.time.of(Date.now())))}static create(e,n,r,s,i,a){return new ns(e,n,r,s,i,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(ns.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}ns.time=qo.define();ns.userEvent=qo.define();ns.addToHistory=qo.define();ns.remote=qo.define();function Iae(t,e){let n=[];for(let r=0,s=0;;){let i,a;if(r=t[r]))i=t[r++],a=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof ns?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof ns?t=i[0]:t=wF(e,Dh(i),!1)}return t}function Bae(t){let e=t.startState,n=e.facet(vF),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=bF(r,jk(e,i,t.changes.newLength),!0))}return r==t?t:ns.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const Fae=[];function Dh(t){return t==null?Fae:Array.isArray(t)?t:[t]}var wr=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(wr||(wr={}));const qae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Nk;try{Nk=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function $ae(t){if(Nk)return Nk.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||qae.test(n)))return!0}return!1}function Hae(t){return e=>{if(!/\S/.test(e))return wr.Space;if($ae(e))return wr.Word;for(let n=0;n-1)return wr.Word;return wr.Other}}class wn{constructor(e,n,r,s,i,a){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let l=0;ls.set(d,c)),n=null),s.set(l.value.compartment,l.value.extension)):l.is(Ft.reconfigure)?(n=null,r=l.value):l.is(Ft.appendConfig)&&(n=null,r=Dh(r).concat(l.value));let i;n?i=e.startState.values.slice():(n=$v.resolve(r,s,this),i=new wn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,d)=>d.reconfigure(c,this),null).values);let a=e.startState.facet(Ok)?e.newSelection:e.newSelection.asSingle();new wn(n,e.newDoc,a,i,(l,c)=>c.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Me.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],a=Dh(r.effects);for(let l=1;la.spec.fromJSON(l,c)))}}return wn.create({doc:e.doc,selection:Me.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=$v.resolve(e.extensions||[],new Map),r=e.doc instanceof jn?e.doc:jn.of((e.doc||"").split(n.staticFacet(wn.lineSeparator)||yk)),s=e.selection?e.selection instanceof Me?e.selection:Me.single(e.selection.anchor,e.selection.head):Me.single(0);return hF(s,r.length),n.staticFacet(Ok)||(s=s.asSingle()),new wn(n,r,s,n.dynamicSlots.map(()=>null),(i,a)=>a.create(i),null)}get tabSize(){return this.facet(wn.tabSize)}get lineBreak(){return this.facet(wn.lineSeparator)||` -`}get readOnly(){return this.facet(yF)}phrase(e,...n){for(let r of this.facet(wn.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(mF))for(let a of i(this,n,r))Object.prototype.hasOwnProperty.call(a,e)&&s.push(a[e]);return s}charCategorizer(e){return Hae(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-r,l=e-r;for(;a>0;){let c=zs(n,a,!1);if(i(n.slice(c,a))!=wr.Word)break;a=c}for(;lt.length?t[0]:4});wn.lineSeparator=pF;wn.readOnly=yF;wn.phrases=at.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});wn.languageData=mF;wn.changeFilter=gF;wn.transactionFilter=xF;wn.transactionExtender=vF;lb.reconfigure=Ft.define();function $o(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let a=s[i],l=r[i];if(l===void 0)r[i]=a;else if(!(l===a||a===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](l,a);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class sd{eq(e){return this==e}range(e,n=e){return Ck.create(e,n,this)}}sd.prototype.startSide=sd.prototype.endSide=0;sd.prototype.point=!1;sd.prototype.mapMode=Ds.TrackDel;let Ck=class SF{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new SF(e,n,r)}};function Tk(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class t6{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let a=s,l=i.length;;){if(a==l)return a;let c=a+l>>1,d=i[c]-e||(r?this.value[c].endSide:this.value[c].startSide)-n;if(c==a)return d>=0?a:l;d>=0?l=c:a=c+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,i);ix||g==x&&d.startSide>0&&d.endSide<=0)continue;(x-g||d.endSide-d.startSide)<0||(a<0&&(a=g),d.point&&(l=Math.max(l,x-g)),r.push(d),s.push(g-a),i.push(x-a))}return{mapped:r.length?new t6(s,i,r,l):null,pos:a}}}class Rn{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new Rn(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,a=e.filter;if(n.length==0&&!a)return this;if(r&&(n=n.slice().sort(Tk)),this.isEmpty)return n.length?Rn.of(n):this;let l=new kF(this,null,-1).goto(0),c=0,d=[],h=new ql;for(;l.value||c=0){let m=n[c++];h.addInner(m.from,m.to,m.value)||d.push(m)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||il.to||i=i&&e<=i+a.length&&a.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return F0.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return F0.from(e).goto(n)}static compare(e,n,r,s,i=-1){let a=e.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),l=n.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),c=hE(a,l,r),d=new Fm(a,c,i),h=new Fm(l,c,i);r.iterGaps((m,g,x)=>fE(d,m,h,g,x,s)),r.empty&&r.length==0&&fE(d,0,h,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(h=>!h.isEmpty&&n.indexOf(h)<0),a=n.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let l=hE(i,a),c=new Fm(i,l,0).goto(r),d=new Fm(a,l,0).goto(r);for(;;){if(c.to!=d.to||!Ek(c.active,d.active)||c.point&&(!d.point||!c.point.eq(d.point)))return!1;if(c.to>s)return!0;c.next(),d.next()}}static spans(e,n,r,s,i=-1){let a=new Fm(e,null,i).goto(n),l=n,c=a.openStart;for(;;){let d=Math.min(a.to,r);if(a.point){let h=a.activeForPoint(a.to),m=a.pointFroml&&(s.span(l,d,a.active,c),c=a.openEnd(d));if(a.to>r)return c+(a.point&&a.to>r?1:0);l=a.to,a.next()}}static of(e,n=!1){let r=new ql;for(let s of e instanceof Ck?[e]:n?Qae(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return Rn.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=Rn.empty;s=s.nextLayer)n=new Rn(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}Rn.empty=new Rn([],[],null,-1);function Qae(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(Tk);e=r}return t}Rn.empty.nextLayer=Rn.empty;class ql{finishChunk(e){this.chunks.push(new t6(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new ql)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Rn.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Rn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function hE(t,e,n){let r=new Map;for(let i of t)for(let a=0;a=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&s.push(new kF(a,n,r,i));return s.length==1?s[0]:new F0(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)R4(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)R4(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),R4(this.heap,0)}}}function R4(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Fm{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=F0.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Jx(this.active,e),Jx(this.activeTo,e),Jx(this.activeRank,e),this.minActive=mE(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n0;)n++;e1(this.active,n,r),e1(this.activeTo,n,s),e1(this.activeRank,n,i),e&&e1(e,n,this.cursor.from),this.minActive=mE(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Jx(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[s]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function fE(t,e,n,r,s,i){t.goto(e),n.goto(r);let a=r+s,l=r,c=r-e;for(;;){let d=t.to+c-n.to,h=d||t.endSide-n.endSide,m=h<0?t.to+c:n.to,g=Math.min(m,a);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&Ek(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(l,g,t.point,n.point):g>l&&!Ek(t.active,n.active)&&i.compareRange(l,g,t.active,n.active),m>a)break;(d||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(m),l=m,h<=0&&t.next(),h>=0&&n.next()}}function Ek(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function mE(t,e){let n=-1,r=1e9;for(let s=0;s=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=zs(t,s)}return r===!0?-1:t.length}const Ak="ͼ",pE=typeof Symbol>"u"?"__"+Ak:Symbol.for(Ak),Mk=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),gE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Wc{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function i(a,l,c,d){let h=[],m=/^@(\w+)\b/.exec(a[0]),g=m&&m[1]=="keyframes";if(m&&l==null)return c.push(a[0]+";");for(let x in l){let y=l[x];if(/&/.test(x))i(x.split(/,\s*/).map(w=>a.map(S=>w.replace(/&/,S))).reduce((w,S)=>w.concat(S)),y,c);else if(y&&typeof y=="object"){if(!m)throw new RangeError("The value of a property ("+x+") should be a primitive value.");i(s(x),y,h,g)}else y!=null&&h.push(x.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+y+";")}(h.length||g)&&c.push((r&&!m&&!d?a.map(r):a).join(", ")+" {"+h.join(" ")+"}")}for(let a in e)i(s(a),e[a],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=gE[pE]||1;return gE[pE]=e+1,Ak+e.toString(36)}static mount(e,n,r){let s=e[Mk],i=r&&r.nonce;s?i&&s.setNonce(i):s=new Vae(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let xE=new Map;class Vae{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=xE.get(r);if(i)return e[Mk]=i;this.sheet=new s.CSSStyleSheet,xE.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[Mk]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let a=0;a-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,l),r)for(let d=0;d",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Uae=typeof navigator<"u"&&/Mac/.test(navigator.platform),Wae=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ms=0;Ms<10;Ms++)Gc[48+Ms]=Gc[96+Ms]=String(Ms);for(var Ms=1;Ms<=24;Ms++)Gc[Ms+111]="F"+Ms;for(var Ms=65;Ms<=90;Ms++)Gc[Ms]=String.fromCharCode(Ms+32),q0[Ms]=String.fromCharCode(Ms);for(var D4 in Gc)q0.hasOwnProperty(D4)||(q0[D4]=Gc[D4]);function Gae(t){var e=Uae&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Wae&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?q0:Gc)[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 sr(){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 et={mac:yE||/Mac/.test(Zs.platform),windows:/Win/.test(Zs.platform),linux:/Linux|X11/.test(Zs.platform),ie:cb,ie_version:jF?Rk.documentMode||6:Pk?+Pk[1]:Dk?+Dk[1]:0,gecko:vE,gecko_version:vE?+(/Firefox\/(\d+)/.exec(Zs.userAgent)||[0,0])[1]:0,chrome:!!P4,chrome_version:P4?+P4[1]:0,ios:yE,android:/Android\b/.test(Zs.userAgent),webkit_version:Xae?+(/\bAppleWebKit\/(\d+)/.exec(Zs.userAgent)||[0,0])[1]:0,safari:zk,safari_version:zk?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Zs.userAgent)||[0,0])[1]:0,tabSize:Rk.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function $0(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Ik(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function lv(t,e){if(!e.anchorNode)return!1;try{return Ik(t,e.anchorNode)}catch{return!1}}function Jh(t){return t.nodeType==3?ad(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function S0(t,e,n,r){return n?bE(t,e,n,r,-1)||bE(t,e,n,r,1):!1}function id(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Qv(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function bE(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Lo(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=id(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?Lo(t):0}else return!1}}function Lo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qp(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function Yae(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 NF(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 Kae(t,e,n,r,s,i,a,l){let c=t.ownerDocument,d=c.defaultView||window;for(let h=t,m=!1;h&&!m;)if(h.nodeType==1){let g,x=h==c.body,y=1,w=1;if(x)g=Yae(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(m=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let j=h.getBoundingClientRect();({scaleX:y,scaleY:w}=NF(h,j)),g={left:j.left,right:j.left+h.clientWidth*y,top:j.top,bottom:j.top+h.clientHeight*w}}let S=0,k=0;if(s=="nearest")e.top0&&e.bottom>g.bottom+k&&(k=e.bottom-g.bottom+a)):e.bottom>g.bottom&&(k=e.bottom-g.bottom+a,n<0&&e.top-k0&&e.right>g.right+S&&(S=e.right-g.right+i)):e.right>g.right&&(S=e.right-g.right+i,n<0&&e.leftg.bottom||e.leftg.right)&&(e={left:Math.max(e.left,g.left),right:Math.min(e.right,g.right),top:Math.max(e.top,g.top),bottom:Math.min(e.bottom,g.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function Zae(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 Jae{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?Lo(n):0),r,Math.min(e.focusOffset,r?Lo(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let Iu=null;et.safari&&et.safari_version>=26&&(Iu=!1);function CF(t){if(t.setActive)return t.setActive();if(Iu)return t.focus(Iu);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Iu==null?{get preventScroll(){return Iu={preventScroll:!0},!0}}:void 0),!Iu){Iu=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function _F(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=Lo(n)}else if(n.parentNode&&!Qv(n))r=id(n),n=n.parentNode;else return null}}function AF(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return m.domBoundsAround(e,n,d);if(g>=e&&s==-1&&(s=c,i=d),d>n&&m.dom.parentNode==this.dom){a=c,l=h;break}h=g,d=g+m.breakAfter}return{from:i,to:l<0?r+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a=0?this.children[a].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=n6){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 RF(t,e,n,r,s,i,a,l,c){let{children:d}=t,h=d.length?d[e]:null,m=i.length?i[i.length-1]:null,g=m?m.breakAfter:a;if(!(e==r&&h&&!a&&!g&&i.length<2&&h.merge(n,s,i.length?m:null,n==0,l,c))){if(r0&&(!a&&i.length&&h.merge(n,h.length,i[0],!1,l,0)?h.breakAfter=i.shift().breakAfter:(nnoe||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 Ya(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 Qs(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 roe(this.dom,e,n)}}class $l extends er{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(TF(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,a){return r&&(!(r instanceof $l&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=c,i++}let a=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new $l(this.mark,n,a)}domAtPos(e){return PF(this,e)}coordsAt(e,n){return IF(this,e,n)}}function roe(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,a=0;e==0&&n<0||e==r&&n>=0?et.chrome||et.gecko||(e?(s--,a=1):i=0)?0:l.length-1];return et.safari&&!a&&c.width==0&&(c=Array.prototype.find.call(l,d=>d.width)||c),a?qp(c,a<0):c||null}class Al extends er{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,a){return r&&(!(r instanceof Al)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?Qs.before(this.dom):Qs.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let a=this.side?this.side<0:e>0;for(let l=a?s.length-1:0;i=s[l],!(e>0?l==0:l==s.length-1||i.top0?Qs.before(this.dom):Qs.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return jn.empty}get isHidden(){return!0}}Ya.prototype.children=Al.prototype.children=ef.prototype.children=n6;function PF(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let a=r[i-1];if(a.dom.parentNode==n)return a.domAtPos(a.length)}for(let i=s;i0&&e instanceof $l&&s.length&&(r=s[s.length-1])instanceof $l&&r.mark.eq(e.mark)?zF(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function IF(t,e,n){let r=null,s=-1,i=null,a=-1;function l(d,h){for(let m=0,g=0;m=h&&(x.children.length?l(x,h-g):(!i||i.isHidden&&(n>0||ioe(i,x)))&&(y>h||g==y&&x.getSide()>0)?(i=x,a=h-g):(g-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function Bk(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 aoe(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new Xc(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:a}=LF(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(a?n?2e8:1:-6e8)+1}return new Xc(e,r,s,n,e.widget||null,!0)}static line(e){return new Hp(e)}static set(e,n=!1){return Rn.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}kt.none=Rn.empty;class $p extends kt{constructor(e){let{start:n,end:r}=LF(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 $p&&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))&&Vv(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)}}$p.prototype.point=!1;class Hp extends kt{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Hp&&this.spec.class==e.spec.class&&Vv(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)}}Hp.prototype.mapMode=Ds.TrackBefore;Hp.prototype.point=!0;class Xc extends kt{constructor(e,n,r,s,i,a){super(n,r,i,e),this.block=s,this.isReplace=a,this.mapMode=s?n<=0?Ds.TrackBefore:Ds.TrackAfter:Ds.TrackDel}get type(){return this.startSide!=this.endSide?ni.WidgetRange:this.startSide<=0?ni.WidgetBefore:ni.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Xc&&ooe(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)}}Xc.prototype.point=!0;function LF(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 ooe(t,e){return t==e||!!(t&&e&&t.compare(e))}function cv(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 es extends er{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,a){if(r){if(!(r instanceof es))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),DF(this,e,n,r?r.children.slice():[],i,a),!0}split(e){let n=new es;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){Vv(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){zF(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=Lk(n,this.attrs||{})),r&&(this.attrs=Lk({class:r},this.attrs||{}))}domAtPos(e){return PF(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(TF(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&&(Bk(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&&er.get(s)instanceof $l;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=er.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!et.ios||!this.children.some(i=>i instanceof Ya))){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 Ya)||/[^ -~]/.test(r.text))return null;let s=Jh(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=IF(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 es)return i;if(a>n)break}s=a+i.breakAfter}return null}}class Il extends er{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,a){return r&&(!(r instanceof Il)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class Fk extends Ho{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 k0{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 Il&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new es),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(t1(new ef(-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 Il)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:a,lineBreak:l,done:c}=this.cursor.next(this.skip);if(this.skip=0,c)throw new Error("Ran out of text content when drawing inline views");if(l){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=a,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(t1(new Ya(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,a){if(this.disallowBlockEffectsFor[a]&&r instanceof Xc){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=n-e;if(r instanceof Xc)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Il(r.widget||tf.block,l,r));else{let c=Al.create(r.widget||tf.inline,l,l?0:r.startSide),d=this.atCursorPos&&!c.isEditable&&i<=s.length&&(e0),h=!c.isEditable&&(es.length||r.startSide<=0),m=this.getLine();this.pendingBuffer==2&&!d&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),d&&(m.append(t1(new ef(1),s),i),i=s.length+Math.max(0,i-s.length)),m.append(t1(c,s),i),this.atCursorPos=h,this.pendingBuffer=h?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let a=new k0(e,n,r,i);return a.openEnd=Rn.spans(s,n,r,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function t1(t,e){for(let n of e)t=new $l(n,[t],t.length);return t}class tf extends Ho{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}}tf.inline=new tf("span");tf.block=new tf("div");var gr=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(gr||(gr={}));const od=gr.LTR,r6=gr.RTL;function BF(t){let e=[];for(let n=0;n=n){if(l.level==r)return a;(i<0||(s!=0?s<0?l.fromn:e[i].level>l.level))&&(i=a)}}if(i<0)throw new RangeError("Index out of range");return i}}function qF(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;w-=3)if(ho[w+1]==-x){let S=ho[w+2],k=S&2?s:S&4?S&1?i:s:0;k&&(ir[m]=ir[ho[w]]=k),l=w;break}}else{if(ho.length==189)break;ho[l++]=m,ho[l++]=g,ho[l++]=c}else if((y=ir[m])==2||y==1){let w=y==s;c=w?0:1;for(let S=l-3;S>=0;S-=3){let k=ho[S+2];if(k&2)break;if(w)ho[S+2]|=2;else{if(k&4)break;ho[S+2]|=4}}}}}function foe(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let a=s?n[s-1].to:t,l=sc;)y==S&&(y=n[--w].from,S=w?n[w-1].to:t),ir[--y]=x;c=h}else i=d,c++}}}function $k(t,e,n,r,s,i,a){let l=r%2?2:1;if(r%2==s%2)for(let c=e,d=0;cc&&a.push(new Fc(c,w.from,x));let S=w.direction==od!=!(x%2);Hk(t,S?r+1:r,s,w.inner,w.from,w.to,a),c=w.to}y=w.to}else{if(y==n||(h?ir[y]!=l:ir[y]==l))break;y++}g?$k(t,c,y,r+1,s,g,a):ce;){let h=!0,m=!1;if(!d||c>i[d-1].to){let w=ir[c-1];w!=l&&(h=!1,m=w==16)}let g=!h&&l==1?[]:null,x=h?r:r+1,y=c;e:for(;;)if(d&&y==i[d-1].to){if(m)break e;let w=i[--d];if(!h)for(let S=w.from,k=d;;){if(S==e)break e;if(k&&i[k-1].to==S)S=i[--k].from;else{if(ir[S-1]==l)break e;break}}if(g)g.push(w);else{w.toir.length;)ir[ir.length]=256;let r=[],s=e==od?0:1;return Hk(t,s,s,n,0,t.length,r),r}function $F(t){return[new Fc(0,t,0)]}let HF="";function poe(t,e,n,r,s){var i;let a=r.head-t.from,l=Fc.find(e,a,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),c=e[l],d=c.side(s,n);if(a==d){let g=l+=s?1:-1;if(g<0||g>=e.length)return null;c=e[l=g],a=c.side(!s,n),d=c.side(s,n)}let h=zs(t.text,a,c.forward(s,n));(hc.to)&&(h=d),HF=t.text.slice(Math.min(a,h),Math.max(a,h));let m=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return m&&h==d&&m.level+(s?0:1)t.some(e=>e)}),KF=at.define({combine:t=>t.some(e=>e)}),ZF=at.define();class zh{constructor(e,n="nearest",r="nearest",s=5,i=5,a=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=a}map(e){return e.empty?this:new zh(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 zh(Me.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const n1=Ft.define({map:(t,e)=>t.map(e)}),JF=Ft.define();function vi(t,e,n){let r=t.facet(WF);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const El=at.define({combine:t=>t.length?t[0]:!0});let xoe=0;const Nh=at.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let c=[];return a&&c.push(H0.of(d=>{let h=d.plugin(l);return h?a(h):kt.none})),i&&c.push(i(l)),c})}static fromClass(e,n){return Vr.define((r,s)=>new e(r,s),n)}}class z4{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(vi(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){vi(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){vi(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const eq=at.define(),a6=at.define(),H0=at.define(),tq=at.define(),Qp=at.define(),nq=at.define();function OE(t,e){let n=t.state.facet(nq);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return Rn.spans(r,e.from,e.to,{point(){},span(i,a,l,c){let d=i-e.from,h=a-e.from,m=s;for(let g=l.length-1;g>=0;g--,c--){let x=l[g].spec.bidiIsolate,y;if(x==null&&(x=goe(e.text,d,h)),c>0&&m.length&&(y=m[m.length-1]).to==d&&y.direction==x)y.to=h,m=y.inner;else{let w={from:d,to:h,direction:x,inner:[]};m.push(w),m=w.inner}}}}),s}const rq=at.define();function o6(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(rq)){let a=i(t);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(n=Math.max(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(s=Math.max(s,a.bottom)))}return{left:e,right:n,top:r,bottom:s}}const o0=at.define();class Na{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new Na(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.toAh)break;i+=2}if(!c)return r;new Na(c.fromA,c.toA,c.fromB,c.toB).addToSet(r),a=c.toA,l=c.toB}}}class Uv{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=us.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,a,l,c)=>s.push(new Na(i,a,l,c))),this.changedRanges=s}static create(e,n,r){return new Uv(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 jE extends er{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=kt.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 es],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Na(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:d,toA:h})=>hthis.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:!Ooe(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?yoe(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:d,to:h}=this.hasComposition;r=new Na(d,h,e.changes.mapPos(d,-1),e.changes.mapPos(h,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(et.ie||et.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,l=this.updateDeco(),c=Soe(a,l,e.changes);return r=Na.extendWithRanges(r,c),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=et.chrome||et.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||s.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[a]:null;if(!l)break;let{fromA:c,toA:d,fromB:h,toB:m}=l,g,x,y,w;if(r&&r.range.fromBh){let T=k0.build(this.view.state.doc,h,r.range.fromB,this.decorations,this.dynamicDecorationMap),E=k0.build(this.view.state.doc,r.range.toB,m,this.decorations,this.dynamicDecorationMap);x=T.breakAtStart,y=T.openStart,w=E.openEnd;let _=this.compositionView(r);E.breakAtStart?_.breakAfter=1:E.content.length&&_.merge(_.length,_.length,E.content[0],!1,E.openStart,0)&&(_.breakAfter=E.content[0].breakAfter,E.content.shift()),T.content.length&&_.merge(0,0,T.content[T.content.length-1],!0,0,T.openEnd)&&T.content.pop(),g=T.content.concat(_).concat(E.content)}else({content:g,breakAtStart:x,openStart:y,openEnd:w}=k0.build(this.view.state.doc,h,m,this.decorations,this.dynamicDecorationMap));let{i:S,off:k}=i.findPos(d,1),{i:j,off:N}=i.findPos(c,-1);RF(this,j,N,S,k,g,x,y,w)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(JF)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new Ya(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new $l(s,[n],n.length);let r=new es;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,a)=>{a.flags|=8|(a.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(a);let l=er.get(i);l&&l!=a&&(l.dom=null),a.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(El)||this.dom.tabIndex>-1)&&lv(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(l.anchor)),d=l.empty?c:this.moveToLine(this.domAtPos(l.head));if(et.gecko&&l.empty&&!this.hasComposition&&voe(c)){let m=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(m,c.node.childNodes[c.offset]||null)),c=d=new Qs(m,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!S0(c.node,c.offset,h.anchorNode,h.anchorOffset)||!S0(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{et.android&&et.chrome&&this.dom.contains(h.focusNode)&&koe(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let m=$0(this.view.root);if(m)if(l.empty){if(et.gecko){let g=boe(c.node,c.offset);if(g&&g!=3){let x=(g==1?_F:AF)(c.node,c.offset);x&&(c=new Qs(x.node,x.offset))}}m.collapse(c.node,c.offset),l.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=l.bidiLevel)}else if(m.extend){m.collapse(c.node,c.offset);try{m.extend(d.node,d.offset)}catch{}}else{let g=document.createRange();l.anchor>l.head&&([c,d]=[d,c]),g.setEnd(d.node,d.offset),g.setStart(c.node,c.offset),m.removeAllRanges(),m.addRange(g)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,d)),this.impreciseAnchor=c.precise?null:new Qs(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Qs(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&S0(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=$0(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=es.find(this,n.head);if(!a)return;let l=a.posAtStart;if(n.head==l||n.head==l+a.length)return;let c=this.coordsAt(n.head,-1),d=this.coordsAt(n.head,1);if(!c||!d||c.bottom>d.top)return;let h=this.domAtPos(n.head+n.assoc);r.collapse(h.node,h.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let m=e.observer.selectionRange;e.docView.posFromDOM(m.anchorNode,m.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=er.get(n.childNodes[s]);i instanceof es&&(r=i.domAtPos(i.length))}return r?new Qs(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=er.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;a--){let l=this.children[a],c=i-l.breakAfter,d=c-l.length;if(ce||l.covers(1))&&(!r||l instanceof es&&!(r instanceof es&&n>=0)))r=l,s=d;else if(r&&d==e&&c==e&&l instanceof Il&&Math.abs(n)<2){if(l.deco.startSide<0)break;a&&(r=null)}i=d}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 es))return null;for(;s.children.length;){let{i:l,off:c}=s.childPos(r,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}r=c}if(!(s instanceof Ya))return null;let i=zs(s.text,r);if(i==r)return null;let a=ad(s.dom,r,i).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,c=this.view.textDirection==gr.LTR;for(let d=0,h=0;hs)break;if(d>=r){let x=m.dom.getBoundingClientRect();if(n.push(x.height),a){let y=m.dom.lastChild,w=y?Jh(y):[];if(w.length){let S=w[w.length-1],k=c?S.right-x.left:x.right-S.left;k>l&&(l=k,this.minWidth=i,this.minWidthFrom=d,this.minWidthTo=g)}}}d=g+m.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?gr.RTL:gr.LTR}measureTextSize(){for(let i of this.children)if(i instanceof es){let a=i.measureTextSize();if(a)return a}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=Jh(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 MF(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],a=i?i.from-1:this.length;if(a>r){let l=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(kt.replace({widget:new Fk(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!i)break;r=i.to+1}return kt.set(e)}updateDeco(){let e=1,n=this.view.state.facet(H0).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(tq).map((i,a)=>{let l=typeof i=="function";return l&&(r=!0),l?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(Rn.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=o6(this.view),a={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;Kae(this.view.scrollDOM,a,n.heads instanceof Al||s.children.some(r);return r(this.children[n])}}function voe(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 sq(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=_F(n.focusNode,n.focusOffset),s=AF(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let l=er.get(s.node);if(!l||l instanceof Ya&&l.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let c=er.get(r.node);!c||c instanceof Ya&&c.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let a=e-i.offset;return{from:a,to:a+i.node.nodeValue.length,node:i.node}}function yoe(t,e,n){let r=sq(t,n);if(!r)return null;let{node:s,from:i,to:a}=r,l=s.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(r.from,r.to)!=l)return null;let c=e.invertedDesc,d=new Na(c.mapPos(i),c.mapPos(a),i,a),h=[];for(let m=s.parentNode;;m=m.parentNode){let g=er.get(m);if(g instanceof $l)h.push({node:m,deco:g.mark});else{if(g instanceof es||m.nodeName=="DIV"&&m.parentNode==t.contentDOM)return{range:d,text:s,marks:h,line:m};if(m!=t.contentDOM)h.push({node:m,deco:new $p({inclusive:!0,attributes:aoe(m),tagName:m.tagName.toLowerCase()})});else return null}}}function boe(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function joe(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Me.cursor(e);i==0?n=1:i==s.length&&(n=-1);let a=i,l=i;n<0?a=zs(s.text,i,!1):l=zs(s.text,i);let c=r(s.text.slice(a,l));for(;a>0;){let d=zs(s.text,a,!1);if(r(s.text.slice(d,a))!=c)break;a=d}for(;lt?e.left-t:Math.max(0,t-e.right)}function Coe(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function I4(t,e){return t.tope.top+1}function NE(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function Vk(t,e,n){let r,s,i,a,l=!1,c,d,h,m;for(let y=t.firstChild;y;y=y.nextSibling){let w=Jh(y);for(let S=0;SN||a==N&&i>j)&&(r=y,s=k,i=j,a=N,l=j?e0:Sk.bottom&&(!h||h.bottomk.top)&&(d=y,m=k):h&&I4(h,k)?h=CE(h,k.bottom):m&&I4(m,k)&&(m=NE(m,k.top))}}if(h&&h.bottom>=n?(r=c,s=h):m&&m.top<=n&&(r=d,s=m),!r)return{node:t,offset:0};let g=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return TE(r,g,n);if(l&&r.contentEditable!="false")return Vk(r,g,n);let x=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:x}}function TE(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,a=0;for(let l=0;ln?h.top-n:n-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&m=(h.left+h.right)/2,x=g;if(et.chrome||et.gecko){let y=ad(t,l).getBoundingClientRect();Math.abs(y.left-h.right)<.1&&(x=!g)}if(m<=0)return{node:t,offset:l+(x?1:0)};s=l+(x?1:0),i=m}}}return{node:t,offset:s>-1?s:a>0?t.nodeValue.length:0}}function iq(t,e,n,r=-1){var s,i;let a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,c,{docHeight:d}=t.viewState,{x:h,y:m}=e,g=m-l;if(g<0)return 0;if(g>d)return t.state.doc.length;for(let T=t.viewState.heightOracle.textHeight/2,E=!1;c=t.elementAtHeight(g),c.type!=ni.Text;)for(;g=r>0?c.bottom+T:c.top-T,!(g>=0&&g<=d);){if(E)return n?null:0;E=!0,r=-r}m=l+g;let x=c.from;if(xt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:EE(t,a,c,h,m);let y=t.dom.ownerDocument,w=t.root.elementFromPoint?t.root:y,S=w.elementFromPoint(h,m);S&&!t.contentDOM.contains(S)&&(S=null),S||(h=Math.max(a.left+1,Math.min(a.right-1,h)),S=w.elementFromPoint(h,m),S&&!t.contentDOM.contains(S)&&(S=null));let k,j=-1;if(S&&((s=t.docView.nearest(S))===null||s===void 0?void 0:s.isEditable)!=!1){if(y.caretPositionFromPoint){let T=y.caretPositionFromPoint(h,m);T&&({offsetNode:k,offset:j}=T)}else if(y.caretRangeFromPoint){let T=y.caretRangeFromPoint(h,m);T&&({startContainer:k,startOffset:j}=T)}k&&(!t.contentDOM.contains(k)||et.safari&&Toe(k,j,h)||et.chrome&&Eoe(k,j,h))&&(k=void 0),k&&(j=Math.min(Lo(k),j))}if(!k||!t.docView.dom.contains(k)){let T=es.find(t.docView,x);if(!T)return g>c.top+c.height/2?c.to:c.from;({node:k,offset:j}=Vk(T.dom,h,m))}let N=t.docView.nearest(k);if(!N)return null;if(N.isWidget&&((i=N.dom)===null||i===void 0?void 0:i.nodeType)==1){let T=N.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,c=Math.floor((s-n.top-(t.defaultLineHeight-l)*.5)/l);i+=c*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(n.from,n.to);return n.from+_k(a,i,t.state.tabSize)}function aq(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let a=s.parentNode;if(!a||a.nodeName=="DIV")break;s=a}}return ad(t,r-1,r).getBoundingClientRect().right>n}function Toe(t,e,n){return aq(t,e,n)}function Eoe(t,e,n){if(e!=0)return aq(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():ad(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function Uk(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==ni.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function _oe(t,e,n,r){let s=Uk(t,e.head,e.assoc||-1),i=!r||s.type!=ni.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let a=t.dom.getBoundingClientRect(),l=t.textDirectionAt(s.from),c=t.posAtCoords({x:n==(l==gr.LTR)?a.right-1:a.left+1,y:(i.top+i.bottom)/2});if(c!=null)return Me.cursor(c,n?-1:1)}return Me.cursor(n?s.to:s.from,n?-1:1)}function _E(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),a=t.textDirectionAt(s.from);for(let l=e,c=null;;){let d=poe(s,i,a,l,n),h=HF;if(!d){if(s.number==(n?t.state.doc.lines:1))return l;h=` -`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),d=t.visualLineSide(s,!n)}if(c){if(!c(h))return l}else{if(!r)return d;c=r(h)}l=d}}function Aoe(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let a=r(i);return s==wr.Space&&(s=a),s==a}}function Moe(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Me.cursor(s,e.assoc);let a=e.goalColumn,l,c=t.contentDOM.getBoundingClientRect(),d=t.coordsAtPos(s,e.assoc||-1),h=t.documentTop;if(d)a==null&&(a=d.left-c.left),l=i<0?d.top:d.bottom;else{let x=t.viewState.lineBlockAt(s);a==null&&(a=Math.min(c.right-c.left,t.defaultCharacterWidth*(s-x.from))),l=(i<0?x.top:x.bottom)+h}let m=c.left+a,g=r??t.viewState.heightOracle.textHeight>>1;for(let x=0;;x+=10){let y=l+(g+x)*i,w=iq(t,{x:m,y},!1,i);if(yc.bottom||(i<0?ws)){let S=t.docView.coordsForChar(w),k=!S||y{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Me.cursor(r,ri)&&!Poe(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,l;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(l=s.exec(n))&&(i=l.index,a=l[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=a-1);r=i+a}}readNode(e){if(e.cmIgnore)return;let n=er.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+(Doe(e,r.node,r.offset)?n:0))}}function Doe(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let l=i||a?[]:Loe(e),c=new Roe(l,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Boe(l,this.bounds.from)}else{let l=e.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!Ik(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),d=a&&a.node==l.anchorNode&&a.offset==l.anchorOffset||!Ik(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),h=e.viewport;if((et.ios||et.chrome)&&e.state.selection.main.empty&&c!=d&&(h.from>0||h.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Me.range(d,c)):this.newSel=Me.single(d,c)}}}function lq(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:l}=e.bounds,c=s.from,d=null;(i===8||et.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)}:et.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` - `&&t.lineWrapping&&(r&&(r=Me.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:jn.of([" "])}),n)return l6(t,n,r,i);if(r&&!r.main.eq(s)){let a=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=oq(t.state.facet(Qp).map(c=>c(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function l6(t,e,n,r=-1){if(et.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(et.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&&Ph(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&Ph(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Ph(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,l=()=>a||(a=Ioe(t,e,n));return t.state.facet(GF).some(c=>c(t,e.from,e.to,i,l))||t.dispatch(l()),!0}function Ioe(t,e,n){let r,s=t.state,i=s.selection.main,a=-1;if(e.from==e.to&&e.fromi.to){let c=e.fromm(t)),d,c);e.from==h&&(a=h)}if(a>-1)r={changes:e,selection:Me.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let c=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(c+e.insert.sliceString(0,void 0,t.state.lineBreak)+d))}else{let c=s.changes(e),d=n&&n.main.to<=c.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let h=t.state.sliceDoc(e.from,e.to),m,g=n&&sq(t,n.main.head);if(g){let y=e.insert.length-(e.to-e.from);m={from:g.from,to:g.to-y}}else m=t.state.doc.lineAt(i.head);let x=i.to-e.to;r=s.changeByRange(y=>{if(y.from==i.from&&y.to==i.to)return{changes:c,range:d||y.map(c)};let w=y.to-x,S=w-h.length;if(t.state.sliceDoc(S,w)!=h||w>=m.from&&S<=m.to)return{range:y};let k=s.changes({from:S,to:w,insert:e.insert}),j=y.to-i.to;return{changes:k,range:d?Me.range(Math.max(0,d.anchor+j),Math.max(0,d.head+j)):y.map(k)}})}else r={changes:c,selection:d&&s.selection.replaceRange(d)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:l,scrollIntoView:!0})}function cq(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&l>0&&t.charCodeAt(a-1)==e.charCodeAt(l-1);)a--,l--;if(r=="end"){let c=Math.max(0,i-Math.min(a,l));n-=a+c-i}if(a=a?i-n:0;i-=c,l=i+(l-a),a=i}else if(l=l?i-n:0;i-=c,a=i+(a-l),l=i}return{from:i,toA:a,toB:l}}function Loe(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 AE(n,r)),(s!=n||i!=r)&&e.push(new AE(s,i))),e}function Boe(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Me.single(n+e,r+e):null}class Foe{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,et.safari&&e.contentDOM.addEventListener("input",()=>null),et.gecko&&nle(e.contentDOM.ownerDocument)}handleEvent(e){!Goe(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=qoe(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let a=!n[i].handlers.length,l=r[i];l&&a!=!l.handlers.length&&(s.removeEventListener(i,this.handleEvent),l=null),l||s.addEventListener(i,this.handleEvent,{passive:a})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&dq.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),et.android&&et.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return et.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=uq.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||$oe.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:et.safari&&!et.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 ME(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){vi(n.state,s)}}}function qoe(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,a=s&&s.plugin.domEventObservers;if(i)for(let l in i){let c=i[l];c&&n(l).handlers.push(ME(r.value,c))}if(a)for(let l in a){let c=a[l];c&&n(l).observers.push(ME(r.value,c))}}for(let r in Ka)n(r).handlers.push(Ka[r]);for(let r in _a)n(r).observers.push(_a[r]);return e}const uq=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],$oe="dthko",dq=[16,17,18,20,91,92,224,225],r1=6;function s1(t){return Math.max(0,t)*.7+8}function Hoe(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class Qoe{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=Zae(e.contentDOM),this.atoms=e.state.facet(Qp).map(a=>a(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(wn.allowMultipleSelections)&&Voe(e,n),this.dragging=Woe(e,n)&&mq(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&&Hoe(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=o6(this.view);e.clientX-c.left<=s+r1?n=-s1(s-e.clientX):e.clientX+c.right>=a-r1&&(n=s1(e.clientX-a)),e.clientY-c.top<=i+r1?r=-s1(i-e.clientY):e.clientY+c.bottom>=l-r1&&(r=s1(e.clientY-l)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=oq(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 Voe(t,e){let n=t.state.facet(QF);return n.length?n[0](e):et.mac?e.metaKey:e.ctrlKey}function Uoe(t,e){let n=t.state.facet(VF);return n.length?n[0](e):et.mac?!e.altKey:!e.ctrlKey}function Woe(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=$0(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Goe(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=er.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ka=Object.create(null),_a=Object.create(null),hq=et.ie&&et.ie_version<15||et.ios&&et.webkit_version<604;function Xoe(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(),fq(t,n.value)},50)}function ub(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function fq(t,e){e=ub(t.state,s6,e);let{state:n}=t,r,s=1,i=n.toText(e),a=i.lines==n.selection.ranges.length;if(Wk!=null&&n.selection.ranges.every(c=>c.empty)&&Wk==i.toString()){let c=-1;r=n.changeByRange(d=>{let h=n.doc.lineAt(d.from);if(h.from==c)return{range:d};c=h.from;let m=n.toText((a?i.line(s++).text:e)+n.lineBreak);return{changes:{from:h.from,insert:m},range:Me.cursor(d.from+m.length)}})}else a?r=n.changeByRange(c=>{let d=i.line(s++);return{changes:{from:c.from,to:c.to,insert:d.text},range:Me.cursor(c.from+d.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}_a.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ka.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);_a.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};_a.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ka.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(UF))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=Zoe(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new Qoe(t,e,n,r)),r&&t.observer.ignore(()=>{CF(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 RE(t,e,n,r){if(r==1)return Me.cursor(e,n);if(r==2)return joe(t.state,e,n);{let s=es.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),a=s?s.posAtStart:i.from,l=s?s.posAtEnd:i.to;return le>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function Yoe(t,e,n,r){let s=es.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let a=s.coordsAt(i,-1);if(a&&DE(n,r,a))return-1;let l=s.coordsAt(i,1);return l&&DE(n,r,l)?1:a&&a.bottom>=r?-1:1}function PE(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Yoe(t,n,e.clientX,e.clientY)}}const Koe=et.ie&&et.ie_version<=11;let zE=null,IE=0,LE=0;function mq(t){if(!Koe)return t.detail;let e=zE,n=LE;return zE=t,LE=Date.now(),IE=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(IE+1)%3:1}function Zoe(t,e){let n=PE(t,e),r=mq(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,a,l){let c=PE(t,i),d,h=RE(t,c.pos,c.bias,r);if(n.pos!=c.pos&&!a){let m=RE(t,n.pos,n.bias,r),g=Math.min(m.from,h.from),x=Math.max(m.to,h.to);h=g1&&(d=Joe(s,c.pos))?d:l?s.addRange(h):Me.create([h])}}}function Joe(t,e){for(let n=0;n=e)return Me.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Ka.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,a=i+s.length;(i>=n.to||a<=n.from)&&(n=Me.range(i,a))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",ub(t.state,i6,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ka.dragend=t=>(t.inputState.draggedContent=null,!1);function BE(t,e,n,r){if(n=ub(t.state,s6,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,a=r&&i&&Uoe(t,e)?{from:i.from,to:i.to}:null,l={from:s,insert:n},c=t.state.changes(a?[a,l]:l);t.focus(),t.dispatch({changes:c,selection:{anchor:c.mapPos(s,-1),head:c.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ka.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&&BE(t,e,r.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[a]=l.result),i()},l.readAsText(n[a])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return BE(t,e,r,!0),!0}return!1};Ka.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=hq?null:e.clipboardData;return n?(fq(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Xoe(t),!1)};function ele(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 tle(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let a=t.doc.lineAt(i);a.number>s&&(e.push(a.text),n.push({from:a.from,to:Math.min(t.doc.length,a.to+1)})),s=a.number}r=!0}return{text:ub(t,i6,e.join(t.lineBreak)),ranges:n,linewise:r}}let Wk=null;Ka.copy=Ka.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=tle(t.state);if(!n&&!s)return!1;Wk=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=hq?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(ele(t,n),!1)};const pq=qo.define();function gq(t,e){let n=[];for(let r of t.facet(XF)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:pq.of(!0)}):null}function xq(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=gq(t.state,e);n?t.dispatch(n):t.update([])}},10)}_a.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),xq(t)};_a.blur=t=>{t.observer.clearSelectionRange(),xq(t)};_a.compositionstart=_a.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};_a.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,et.chrome&&et.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};_a.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ka.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),a=e.getTargetRanges();if(i&&a.length){let l=a[0],c=t.posAtDOM(l.startContainer,l.startOffset),d=t.posAtDOM(l.endContainer,l.endOffset);return l6(t,{from:c,to:d,insert:t.state.toText(i)},null),!0}}let s;if(et.chrome&&et.android&&(s=uq.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return et.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),et.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>_a.compositionend(t,e),20),!1};const FE=new Set;function nle(t){FE.has(t)||(FE.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const qE=["pre-wrap","normal","pre-line","break-spaces"];let nf=!1;function $E(){nf=!1}class rle{constructor(e){this.lineWrapping=e,this.doc=jn.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 qE.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,c=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,c){this.heightSamples={};for(let d=0;d0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>uv&&(nf=!0),this.height=e)}replace(e,n,r){return ri.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,a=r.doc;for(let l=s.length-1;l>=0;l--){let{fromA:c,toA:d,fromB:h,toB:m}=s[l],g=i.lineAt(c,pr.ByPosNoHeight,r.setDoc(n),0,0),x=g.to>=d?g:i.lineAt(d,pr.ByPosNoHeight,r,0,0);for(m+=x.to-d,d=x.to;l>0&&g.from<=s[l-1].toA;)c=s[l-1].fromA,h=s[l-1].fromB,l--,ci*2){let l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),r+=1+l.break,s-=l.size}else if(i>s*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,i-=l.size}else break;else if(s=i&&a(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class $i extends vq{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new So(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof $i||s instanceof As&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof As?s=new $i(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ri.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 As extends ri{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,a,l=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*i);a=c/i,this.length>i+1&&(l=(this.height-c)/(this.length-i-1))}else a=this.height/i;return{firstLine:r,lastLine:s,perLine:a,perChar:l}}blockAt(e,n,r,s){let{firstLine:i,lastLine:a,perLine:l,perChar:c}=this.heightMetrics(n,s);if(n.lineWrapping){let d=s+(e0){let i=r[r.length-1];i instanceof As?r[r.length-1]=new As(i.length+s):r.push(null,new As(s-1))}if(e>0){let i=r[0];i instanceof As?r[0]=new As(e+i.length):r.unshift(new As(e-1),null)}return ri.of(r)}decomposeLeft(e,n){n.push(new As(e-1),null)}decomposeRight(e,n){n.push(null,new As(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let a=[],l=Math.max(n,s.from),c=-1;for(s.from>n&&a.push(new As(s.from-n-1).updateHeight(e,n));l<=i&&s.more;){let h=e.doc.lineAt(l).length;a.length&&a.push(null);let m=s.heights[s.index++];c==-1?c=m:Math.abs(m-c)>=uv&&(c=-2);let g=new $i(h,m);g.outdated=!1,a.push(g),l+=h+1}l<=i&&a.push(null,new As(i-l).updateHeight(e,l));let d=ri.of(a);return(c<0||Math.abs(d.height-this.height)>=uv||Math.abs(c-this.heightMetrics(e,n).perLine)>=uv)&&(nf=!0),Wv(this,d)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class ile extends ri{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 el))return d;let h=n==pr.ByPosNoHeight?pr.ByPosNoHeight:pr.ByPos;return c?d.join(this.right.lineAt(l,h,r,a,l)):this.left.lineAt(l,h,r,s,i).join(d)}forEachLine(e,n,r,s,i,a){let l=s+this.left.height,c=i+this.left.length+this.break;if(this.break)e=c&&this.right.forEachLine(e,n,r,l,c,a);else{let d=this.lineAt(c,pr.ByPos,r,s,i);e=e&&d.from<=n&&a(d),n>d.to&&this.right.forEachLine(d.to+1,n,r,l,c,a)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let l of r)i.push(l);if(e>0&&HE(i,a-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?ri.of(this.break?[e,null,n]:[e,n]):(this.left=Wv(this.left,e),this.right=Wv(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:a}=this,l=n+i.length+this.break,c=null;return s&&s.from<=n+i.length&&s.more?c=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=l+a.length&&s.more?c=a=a.updateHeight(e,l,r,s):a.updateHeight(e,l,r),c?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function HE(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof As&&(r=t[e+1])instanceof As&&t.splice(e-1,3,new As(n.length+1+r.length))}const ale=5;class c6{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof $i?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new $i(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=ale)&&this.addLineDeco(s,i,a)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new $i(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new As(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 $i)return e;let n=new $i(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 $i)&&!this.isCovered?this.nodes.push(new $i(0,-1)):(this.writtenToh.clientHeight||h.scrollWidth>h.clientWidth)&&m.overflow!="visible"){let g=h.getBoundingClientRect();i=Math.max(i,g.left),a=Math.min(a,g.right),l=Math.max(l,g.top),c=Math.min(d==t.parentNode?s.innerHeight:c,g.bottom)}d=m.position=="absolute"||m.position=="fixed"?h.offsetParent:h.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:i-n.left,right:Math.max(i,a)-n.left,top:l-(n.top+e),bottom:Math.max(l,c)-(n.top+e)}}function ule(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function dle(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class B4{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 rle(n),this.stateDeco=e.facet(H0).filter(r=>typeof r!="function"),this.heightMap=ri.empty().applyChanges(this.stateDeco,jn.empty,this.heightOracle.setDoc(e.doc),[new Na(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=kt.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:a})=>s>=i&&s<=a)){let{from:i,to:a}=this.lineBlockAt(s);e.push(new i1(i,a))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?VE:new u6(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(c0(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(H0).filter(h=>typeof h!="function");let s=e.changedRanges,i=Na.extendWithRanges(s,ole(r,this.stateDeco,e?e.changes:us.empty(this.state.doc.length))),a=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);$E(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||nf)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let c=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let d=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(d||!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(KF)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?gr.RTL:gr.LTR;let a=this.heightOracle.mustRefreshForWrapping(i),l=n.getBoundingClientRect(),c=a||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let d=0,h=0;if(l.width&&l.height){let{scaleX:T,scaleY:E}=NF(n,l);(T>.005&&Math.abs(this.scaleX-T)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=T,this.scaleY=E,d|=16,a=c=!0)}let m=(parseInt(r.paddingTop)||0)*this.scaleY,g=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=m||this.paddingBottom!=g)&&(this.paddingTop=m,this.paddingBottom=g,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let x=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=x&&(this.scrollAnchorHeight=-1,this.scrollTop=x),this.scrolledToBottom=EF(e.scrollDOM);let y=(this.printing?dle:cle)(n,this.paddingTop),w=y.top-this.pixelViewport.top,S=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let k=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(k!=this.inView&&(this.inView=k,k&&(c=!0)),!this.inView&&!this.scrollTarget&&!ule(e.dom))return 0;let j=l.width;if((this.contentDOMWidth!=j||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),c){let T=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(a=!0),a||s.lineWrapping&&Math.abs(j-this.contentDOMWidth)>s.charWidth){let{lineHeight:E,charWidth:_,textHeight:A}=e.docView.measureTextSize();a=E>0&&s.refresh(i,E,_,A,Math.max(5,j/_),T),a&&(e.docView.minWidth=0,d|=16)}w>0&&S>0?h=Math.max(w,S):w<0&&S<0&&(h=Math.min(w,S)),$E();for(let E of this.viewports){let _=E.from==this.viewport.from?T:e.docView.measureVisibleLineHeights(E);this.heightMap=(a?ri.empty().applyChanges(this.stateDeco,jn.empty,this.heightOracle,[new Na(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new sle(E.from,_))}nf&&(d|=2)}let N=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return N&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),d|=this.updateForViewport()),(d&2||N)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:l}=this,c=new i1(s.lineAt(a-r*1e3,pr.ByHeight,i,0,0).from,s.lineAt(l+(1-r)*1e3,pr.ByHeight,i,0,0).to);if(n){let{head:d}=n.range;if(dc.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),m=s.lineAt(d,pr.ByPos,i,0,0),g;n.y=="center"?g=(m.top+m.bottom)/2-h/2:n.y=="start"||n.y=="nearest"&&d=l+Math.max(10,Math.min(r,250)))&&s>a-2*1e3&&i>1,a=s<<1;if(this.defaultTextDirection!=gr.LTR&&!r)return[];let l=[],c=(h,m,g,x)=>{if(m-hh&&kk.from>=g.from&&k.to<=g.to&&Math.abs(k.from-h)k.fromj));if(!S){if(mN.from<=m&&N.to>=m)){let N=n.moveToLineBoundary(Me.cursor(m),!1,!0).head;N>h&&(m=N)}let k=this.gapSize(g,h,m,x),j=r||k<2e6?k:2e6;S=new B4(h,m,k,j)}l.push(S)},d=h=>{if(h.length2e6)for(let _ of e)_.from>=h.from&&_.fromh.from&&c(h.from,x,h,m),yn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Rn.spans(n,this.viewport.from,this.viewport.to,{span(i,a){r.push({from:i,to:a})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||c0(this.heightMap.lineAt(e,pr.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)||c0(this.heightMap.lineAt(this.scaler.fromDOM(e),pr.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 c0(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 i1=class{constructor(e,n){this.from=e,this.to=n}};function fle(t,e,n){let r=[],s=t,i=0;return Rn.spans(n,t,e,{span(){},point(a,l){a>s&&(r.push({from:s,to:a}),i+=a-s),s=l}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:a}=e[s],l=a-i;if(r<=l)return i+r;r-=l}}function o1(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 mle(t,e){for(let n of t)if(e(n))return n}const VE={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class u6{constructor(e,n,r){let s=0,i=0,a=0;this.viewports=r.map(({from:l,to:c})=>{let d=n.lineAt(l,pr.ByPos,e,0,0).top,h=n.lineAt(c,pr.ByPos,e,0,0).bottom;return s+=h-d,{from:l,to:c,top:d,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let l of this.viewports)l.domTop=a+(l.top-i)*this.scale,a=l.domBottom=l.domTop+(l.bottom-l.top),i=l.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function c0(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new So(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>c0(s,e)):t._content)}const l1=at.define({combine:t=>t.join(" ")}),Gk=at.define({combine:t=>t.indexOf(!0)>-1}),Xk=Wc.newName(),yq=Wc.newName(),bq=Wc.newName(),wq={"&light":"."+yq,"&dark":"."+bq};function Yk(t,e,n){return new Wc(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 ple=Yk("."+Xk,{"&":{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"}},wq),gle={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},F4=et.ie&&et.ie_version<=11;class xle{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Jae,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);(et.ie&&et.ie_version<=11||et.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&&et.android&&e.constructor.EDIT_CONTEXT!==!1&&!(et.chrome&&et.chrome_version<126)&&(this.editContext=new yle(e),e.state.facet(El)&&(e.contentDOM.editContext=this.editContext.editContext)),F4&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(El)?r.root.activeElement!=this.dom:!lv(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(et.ie&&et.ie_version<=11||et.android&&et.chrome)&&!r.state.selection.main.empty&&s.focusNode&&S0(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=$0(e.root);if(!n)return!1;let r=et.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&vle(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=lv(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&&Ph(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let a=this.readMutation(i);a&&(a.typeOver&&(s=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&lv(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 zoe(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=lq(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=UE(n,e.previousSibling||e.target.previousSibling,-1),s=UE(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(El)!=e.state.facet(El)&&(e.view.contentDOM.editContext=e.state.facet(El)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function UE(t,e,n){for(;e;){let r=er.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 WE(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return S0(a.node,a.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function vle(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return WE(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?WE(t,n):null}class yle{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:a}=s,l=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let d=c-l>r.text.length;l==this.from&&ithis.to&&(c=i);let h=cq(e.state.sliceDoc(l,c),r.text,(d?s.from:s.to)-l,d?"end":null);if(!h){let g=Me.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));g.main.eq(s)||e.dispatch({selection:g,userEvent:"select"});return}let m={from:h.from+l,to:h.toA+l,insert:jn.of(r.text.slice(h.from,h.toB).split(` -`))};if((et.mac||et.android)&&m.from==a-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(m={from:l,to:c,insert:jn.of([r.text.replace("."," ")])}),this.pendingContextChange=m,!e.state.readOnly){let g=this.to-this.from+(m.to-m.from+m.insert.length);l6(e,m,Me.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),m.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let a=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);a{let s=[];for(let i of r.getTextFormats()){let a=i.underlineStyle,l=i.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(l)){let c=this.toEditorPos(i.rangeStart),d=this.toEditorPos(i.rangeEnd);if(c{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=$0(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,a,l,c,d)=>{if(r)return;let h=d.length-(a-i);if(s&&a>=s.to)if(s.from==i&&s.to==a&&s.insert.eq(d)){s=this.pendingContextChange=null,n+=h,this.to+=h;return}else s=null,this.revertPending(e.state);if(i+=n,a+=n,a<=this.from)this.from+=h,this.to+=h;else if(ithis.to||this.to-this.from+d.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),d.toString()),this.to+=h}n+=h}),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 Ze{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||eoe(e.parent)||document,this.viewState=new QE(e.state||wn.create(e)),e.scrollTo&&e.scrollTo.is(n1)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Nh).map(s=>new z4(s));for(let s of this.plugins)s.update(this);this.observer=new xle(this),this.inputState=new Foe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new jE(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 ns?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let g of e){if(g.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=g.state}if(this.destroyed){this.viewState.state=i;return}let a=this.hasFocus,l=0,c=null;e.some(g=>g.annotation(pq))?(this.inputState.notifiedFocused=a,l=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=gq(i,a),c||(l=1));let d=this.observer.delayedAndroidKey,h=null;if(d?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(h=null)):this.observer.clear(),i.facet(wn.phrases)!=this.state.facet(wn.phrases))return this.setState(i);s=Uv.create(this,i,e),s.flags|=l;let m=this.viewState.scrollTarget;try{this.updateState=2;for(let g of e){if(m&&(m=m.map(g.changes)),g.scrollIntoView){let{main:x}=g.state.selection;m=new zh(x.empty?x:Me.cursor(x.head,x.head>x.anchor?-1:1))}for(let x of g.effects)x.is(n1)&&(m=x.value.clip(this.state))}this.viewState.update(s,m),this.bidiCache=Gv.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(o0)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(l1)!=s.state.facet(l1)&&(this.viewState.mustMeasureContent=!0),(n||r||m||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let g of this.state.facet(Qk))try{g(s)}catch(x){vi(this.state,x,"update listener")}(c||h)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),h&&!lq(this,h)&&d.force&&Ph(this.contentDOM,d.key,d.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 QE(e),this.plugins=e.facet(Nh).map(r=>new z4(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new jE(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(Nh),r=e.state.facet(Nh);if(n!=r){let s=[];for(let i of r){let a=n.indexOf(i);if(a<0)s.push(new z4(i));else{let l=this.plugins[a];l.mustUpdate=e,s.push(l)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:a}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(a<0)if(EF(r))i=-1,a=this.viewState.heightMap.height;else{let x=this.viewState.scrollAnchorAt(s);i=x.from,a=x.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];c&4||([this.measureRequests,d]=[d,this.measureRequests]);let h=d.map(x=>{try{return x.read(this)}catch(y){return vi(this.state,y),GE}}),m=Uv.create(this,this.state,[]),g=!1;m.flags|=c,n?n.flags|=c:n=m,this.updateState=2,m.empty||(this.updatePlugins(m),this.inputState.update(m),this.updateAttrs(),g=this.docView.update(m),g&&this.docViewUpdate());for(let x=0;x1||y<-1){s=s+y,r.scrollTop=s/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(Qk))l(n)}get themeClasses(){return Xk+" "+(this.state.facet(Gk)?bq:yq)+" "+this.state.facet(l1)}updateAttrs(){let e=XE(this,eq,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(El)?"true":"false",class:"cm-content",style:`${et.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),XE(this,a6,n);let r=this.observer.ignore(()=>{let s=Bk(this.contentDOM,this.contentAttrs,n),i=Bk(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(Ze.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(o0);let e=this.state.facet(Ze.cspNonce);Wc.mount(this.root,this.styleModules.concat(ple).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 L4(this,e,_E(this,e,n,r))}moveByGroup(e,n){return L4(this,e,_E(this,e,n,r=>Aoe(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Me.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return _oe(this,e,n,r)}moveVertically(e,n,r){return L4(this,e,Moe(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(),iq(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),a=i[Fc.find(i,e-s.from,-1,n)];return qp(r,a.dir==gr.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(YF)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>ble)return $F(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||qF(i.isolates,r=OE(this,e))))return i.order;r||(r=OE(this,e));let s=moe(e.text,n,r);return this.bidiCache.push(new Gv(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||et.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{CF(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 n1.of(new zh(typeof e=="number"?Me.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return n1.of(new zh(Me.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Vr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Vr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Wc.newName(),s=[l1.of(r),o0.of(Yk(`.${r}`,e))];return n&&n.dark&&s.push(Gk.of(!0)),s}static baseTheme(e){return ou.lowest(o0.of(Yk("."+Xk,e,wq)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&er.get(r)||er.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}Ze.styleModule=o0;Ze.inputHandler=GF;Ze.clipboardInputFilter=s6;Ze.clipboardOutputFilter=i6;Ze.scrollHandler=ZF;Ze.focusChangeEffect=XF;Ze.perLineTextDirection=YF;Ze.exceptionSink=WF;Ze.updateListener=Qk;Ze.editable=El;Ze.mouseSelectionStyle=UF;Ze.dragMovesSelection=VF;Ze.clickAddsSelectionRange=QF;Ze.decorations=H0;Ze.outerDecorations=tq;Ze.atomicRanges=Qp;Ze.bidiIsolatedRanges=nq;Ze.scrollMargins=rq;Ze.darkTheme=Gk;Ze.cspNonce=at.define({combine:t=>t.length?t[0]:""});Ze.contentAttributes=a6;Ze.editorAttributes=eq;Ze.lineWrapping=Ze.contentAttributes.of({class:"cm-lineWrapping"});Ze.announce=Ft.define();const ble=4096,GE={};class Gv{constructor(e,n,r,s,i,a){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=a}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:gr.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],a=typeof i=="function"?i(t):i;a&&Lk(a,n)}return n}const wle=et.mac?"mac":et.windows?"win":et.linux?"linux":"key";function Sle(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,a,l;for(let c=0;cr.concat(s),[]))),n}function Ole(t,e,n){return kq(Sq(t.state),e,t,n)}let zc=null;const jle=4e3;function Nle(t,e=wle){let n=Object.create(null),r=Object.create(null),s=(a,l)=>{let c=r[a];if(c==null)r[a]=l;else if(c!=l)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},i=(a,l,c,d,h)=>{var m,g;let x=n[a]||(n[a]=Object.create(null)),y=l.split(/ (?!$)/).map(k=>Sle(k,e));for(let k=1;k{let T=zc={view:N,prefix:j,scope:a};return setTimeout(()=>{zc==T&&(zc=null)},jle),!0}]})}let w=y.join(" ");s(w,!1);let S=x[w]||(x[w]={preventDefault:!1,stopPropagation:!1,run:((g=(m=x._any)===null||m===void 0?void 0:m.run)===null||g===void 0?void 0:g.slice())||[]});c&&S.run.push(c),d&&(S.preventDefault=!0),h&&(S.stopPropagation=!0)};for(let a of t){let l=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of l){let h=n[d]||(n[d]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:m}=a;for(let g in h)h[g].run.push(x=>m(x,Kk))}let c=a[e]||a.key;if(c)for(let d of l)i(d,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&i(d,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return n}let Kk=null;function kq(t,e,n,r){Kk=e;let s=Gae(e),i=gi(s,0),a=wo(i)==s.length&&s!=" ",l="",c=!1,d=!1,h=!1;zc&&zc.view==n&&zc.scope==r&&(l=zc.prefix+" ",dq.indexOf(e.keyCode)<0&&(d=!0,zc=null));let m=new Set,g=S=>{if(S){for(let k of S.run)if(!m.has(k)&&(m.add(k),k(n)))return S.stopPropagation&&(h=!0),!0;S.preventDefault&&(S.stopPropagation&&(h=!0),d=!0)}return!1},x=t[r],y,w;return x&&(g(x[l+c1(s,e,!a)])?c=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(et.windows&&e.ctrlKey&&e.altKey)&&!(et.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(y=Gc[e.keyCode])&&y!=s?(g(x[l+c1(y,e,!0)])||e.shiftKey&&(w=q0[e.keyCode])!=s&&w!=y&&g(x[l+c1(w,e,!1)]))&&(c=!0):a&&e.shiftKey&&g(x[l+c1(s,e,!0)])&&(c=!0),!c&&g(x._any)&&(c=!0)),d&&(c=!0),c&&h&&e.stopPropagation(),Kk=null,c}class Up{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=Oq(e);return[new Up(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return Cle(e,n,r)}}function Oq(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==gr.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function KE(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),a=(s.top+s.bottom)/2,l=t.posAtCoords({x:i.left+1,y:a}),c=t.posAtCoords({x:i.right-1,y:a});return l==null||c==null?r:{from:Math.max(r.from,Math.min(l,c)),to:Math.min(r.to,Math.max(l,c))}}function Cle(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==gr.LTR,a=t.contentDOM,l=a.getBoundingClientRect(),c=Oq(t),d=a.querySelector(".cm-line"),h=d&&window.getComputedStyle(d),m=l.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),g=l.right-(h?parseInt(h.paddingRight):0),x=Uk(t,r,1),y=Uk(t,s,-1),w=x.type==ni.Text?x:null,S=y.type==ni.Text?y:null;if(w&&(t.lineWrapping||x.widgetLineBreaks)&&(w=KE(t,r,1,w)),S&&(t.lineWrapping||y.widgetLineBreaks)&&(S=KE(t,s,-1,S)),w&&S&&w.from==S.from&&w.to==S.to)return j(N(n.from,n.to,w));{let E=w?N(n.from,null,w):T(x,!1),_=S?N(null,n.to,S):T(y,!0),A=[];return(w||x).to<(S||y).from-(w&&S?1:0)||x.widgetLineBreaks>1&&E.bottom+t.defaultLineHeight/2<_.top?A.push(k(m,E.bottom,g,_.top)):E.bottom<_.top&&t.elementAtHeight((E.bottom+_.top)/2).type==ni.Text&&(E.bottom=_.top=(E.bottom+_.top)/2),j(E).concat(A).concat(j(_))}function k(E,_,A,L){return new Up(e,E-c.left,_-c.top,A-E,L-_)}function j({top:E,bottom:_,horizontal:A}){let L=[];for(let P=0;PU&&z.from=F)break;R>Q&&$(Math.max(X,Q),E==null&&X<=U,Math.min(R,F),_==null&&R>=te,J.dir)}if(Q=Y.to+1,Q>=F)break}return B.length==0&&$(U,E==null,te,_==null,t.textDirection),{top:L,bottom:P,horizontal:B}}function T(E,_){let A=l.top+(_?E.top:E.bottom);return{top:A,bottom:A,horizontal:[]}}}function Tle(t,e){return t.constructor==e.constructor&&t.eq(e)}class Ele{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(dv)!=e.state.facet(dv)&&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(dv);for(;n!Tle(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,et.safari&&et.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 dv=at.define();function jq(t){return[Vr.define(e=>new Ele(e,t)),dv.of(t)]}const Q0=at.define({combine(t){return $o(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function _le(t={}){return[Q0.of(t),Ale,Mle,Rle,KF.of(!0)]}function Nq(t){return t.startState.facet(Q0)!=t.state.facet(Q0)}const Ale=jq({above:!0,markers(t){let{state:e}=t,n=e.facet(Q0),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let a=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:Me.cursor(s.head,s.head>s.anchor?-1:1);for(let c of Up.forRange(t,a,l))r.push(c)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=Nq(t);return n&&ZE(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){ZE(e.state,t)},class:"cm-cursorLayer"});function ZE(t,e){e.style.animationDuration=t.facet(Q0).cursorBlinkRate+"ms"}const Mle=jq({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Up.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||Nq(t)},class:"cm-selectionLayer"}),Rle=ou.highest(Ze.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"}}}})),Cq=Ft.define({map(t,e){return t==null?null:e.mapPos(t)}}),u0=Os.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(Cq)?r.value:n,t)}}),Dle=Vr.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(u0);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(u0)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(u0),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(u0)!=t&&this.view.dispatch({effects:Cq.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 Ple(){return[u0,Dle]}function JE(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),a=n,l;!i.next().done;a+=i.value.length)if(!i.lineBreak)for(;l=e.exec(i.value);)s(a+l.index,l)}function zle(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 Ile{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:a=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(l,c,d,h)=>s(h,d,d+l[0].length,l,c);else if(typeof r=="function")this.addMatch=(l,c,d,h)=>{let m=r(l,c,d);m&&h(d,d+l[0].length,m)};else if(r)this.addMatch=(l,c,d,h)=>h(d,d+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=a}createDeco(e){let n=new ql,r=n.add.bind(n);for(let{from:s,to:i}of zle(e,this.maxLength))JE(e.state.doc,this.regexp,s,i,(a,l)=>this.addMatch(l,e,a,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,a,l,c)=>{c>=e.view.viewport.from&&l<=e.view.viewport.to&&(r=Math.min(l,r),s=Math.max(c,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let a=Math.max(i.from,r),l=Math.min(i.to,s);if(l>=a){let c=e.state.doc.lineAt(a),d=c.toc.from;a--)if(this.boundary.test(c.text[a-1-c.from])){h=a;break}for(;lg.push(k.range(w,S));if(c==d)for(this.regexp.lastIndex=h-c.from;(x=this.regexp.exec(c.text))&&x.indexthis.addMatch(S,e,w,y));n=n.update({filterFrom:h,filterTo:m,filter:(w,S)=>wm,add:g})}}return n}}const Zk=/x/.unicode!=null?"gu":"g",Lle=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Zk),Ble={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 q4=null;function Fle(){var t;if(q4==null&&typeof document<"u"&&document.body){let e=document.body.style;q4=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return q4||!1}const hv=at.define({combine(t){let e=$o(t,{render:null,specialChars:Lle,addSpecialChars:null});return(e.replaceTabs=!Fle())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Zk)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Zk)),e}});function qle(t={}){return[hv.of(t),$le()]}let e_=null;function $le(){return e_||(e_=Vr.fromClass(class{constructor(t){this.view=t,this.decorations=kt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(hv)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Ile({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=gi(e[0],0);if(i==9){let a=s.lineAt(r),l=n.state.tabSize,c=Nf(a.text,l,r-a.from);return kt.replace({widget:new Ule((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=kt.replace({widget:new Vle(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(hv);t.startState.facet(hv)!=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 Hle="•";function Qle(t){return t>=32?Hle:t==10?"␤":String.fromCharCode(9216+t)}class Vle extends Ho{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=Qle(this.code),r=e.state.phrase("Control character")+" "+(Ble[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 Ule extends Ho{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 Wle(){return Xle}const Gle=kt.line({class:"cm-activeLine"}),Xle=Vr.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(Gle.range(s.from)),e=s.from)}return kt.set(n)}},{decorations:t=>t.decorations});class Yle extends Ho{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?Jh(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=qp(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 Kle(t){let e=Vr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?kt.set([kt.widget({widget:new Yle(t),side:1}).range(0)]):kt.none}get decorations(){return this.view.state.doc.length?kt.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,Ze.contentAttributes.of({"aria-placeholder":t})]:e}const Jk=2e3;function Zle(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>Jk||n.off>Jk||e.col<0||n.col<0){let a=Math.min(e.off,n.off),l=Math.max(e.off,n.off);for(let c=r;c<=s;c++){let d=t.doc.line(c);d.length<=l&&i.push(Me.range(d.from+a,d.to+l))}}else{let a=Math.min(e.col,n.col),l=Math.max(e.col,n.col);for(let c=r;c<=s;c++){let d=t.doc.line(c),h=_k(d.text,a,t.tabSize,!0);if(h<0)i.push(Me.cursor(d.to));else{let m=_k(d.text,l,t.tabSize);i.push(Me.range(d.from+h,d.from+m))}}}return i}function Jle(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function t_(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>Jk?-1:s==r.length?Jle(t,e.clientX):Nf(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function ece(t,e){let n=t_(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),a=s.state.doc.lineAt(i);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},r=r.map(s.changes)}},get(s,i,a){let l=t_(t,s);if(!l)return r;let c=Zle(t.state,n,l);return c.length?a?Me.create(c.concat(r.ranges)):Me.create(c):r}}:null}function tce(t){let e=(n=>n.altKey&&n.button==0);return Ze.mouseSelectionStyle.of((n,r)=>e(r)?ece(n,r):null)}const nce={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},rce={style:"cursor: crosshair"};function sce(t={}){let[e,n]=nce[t.key||"Alt"],r=Vr.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,Ze.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?rce:null})]}const u1="-10000px";class Tq{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(a=>a);let i=null;this.tooltipViews=this.tooltips.map(a=>i=r(a,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(c=>c);if(s===this.input){for(let c of this.tooltipViews)c.update&&c.update(e);return!1}let a=[],l=n?[]:null;for(let c=0;cn[d]=c),n.length=l.length),this.input=s,this.tooltips=i,this.tooltipViews=a,!0}}function ice(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const $4=at.define({combine:t=>{var e,n,r;return{position:et.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)||ice}}}),n_=new WeakMap,d6=Vr.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($4);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 Tq(t,h6,(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($4);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=u1,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(et.safari){let a=i.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=o6(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,a)=>{let l=this.manager.tooltipViews[a];return l.getCoords?l.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet($4).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,a=[];for(let l=0;l=Math.min(n.bottom,r.bottom)||m.rightMath.min(n.right,r.right)+.1)){h.style.top=u1;continue}let x=c.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,y=x?7:0,w=g.right-g.left,S=(e=n_.get(d))!==null&&e!==void 0?e:g.bottom-g.top,k=d.offset||oce,j=this.view.textDirection==gr.LTR,N=g.width>r.right-r.left?j?r.left:r.right-g.width:j?Math.max(r.left,Math.min(m.left-(x?14:0)+k.x,r.right-w)):Math.min(Math.max(r.left,m.left-w+(x?14:0)-k.x),r.right-w),T=this.above[l];!c.strictSide&&(T?m.top-S-y-k.yr.bottom)&&T==r.bottom-m.bottom>m.top-r.top&&(T=this.above[l]=!T);let E=(T?m.top-r.top:r.bottom-m.bottom)-y;if(EN&&L.top<_+S&&L.bottom>_&&(_=T?L.top-S-2-y:L.bottom+y+2);if(this.position=="absolute"?(h.style.top=(_-t.parent.top)/i+"px",r_(h,(N-t.parent.left)/s)):(h.style.top=_/i+"px",r_(h,N/s)),x){let L=m.left+(j?k.x:-k.x)-(N+14-7);x.style.left=L/s+"px"}d.overlap!==!0&&a.push({left:N,top:_,right:A,bottom:_+S}),h.classList.toggle("cm-tooltip-above",T),h.classList.toggle("cm-tooltip-below",!T),d.positioned&&d.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=u1}},{eventObservers:{scroll(){this.maybeMeasure()}}});function r_(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const ace=Ze.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"}}}),oce={x:0,y:0},h6=at.define({enables:[d6,ace]}),Xv=at.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class db{static create(e){return new db(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Tq(e,Xv,(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 lce=h6.compute([Xv],t=>{let e=t.facet(Xv);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:db.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class cce{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;el.bottom||n.xl.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(s)).find(h=>h.from<=s&&h.to>=s),d=c&&c.dir==gr.RTL?-1:1;i=n.x{this.pending==l&&(this.pending=null,c&&!(Array.isArray(c)&&!c.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(c)?c:[c])}))},c=>vi(e.state,c,"hover tooltip"))}else a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(d6),n=e?e.manager.tooltips.findIndex(r=>r.create==db.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&&!uce(i.dom,e)||this.pending){let{pos:a}=s[0]||this.pending,l=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==l?this.view.posAtCoords(this.lastMove)!=a:!dce(this.view,a,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const d1=4;function uce(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let l=a.getBoundingClientRect();s=Math.min(l.top,s),i=Math.max(l.bottom,i)}return e.clientX>=n-d1&&e.clientX<=r+d1&&e.clientY>=s-d1&&e.clientY<=i+d1}function dce(t,e,n,r,s,i){let a=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>r||a.rights||Math.min(a.bottom,l)=e&&c<=n}function hce(t,e={}){let n=Ft.define(),r=Os.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(a=>!e.hideOn(i,a))),i.docChanged)){let a=[];for(let l of s){let c=i.changes.mapPos(l.pos,-1,Ds.TrackDel);if(c!=null){let d=Object.assign(Object.create(null),l);d.pos=c,d.end!=null&&(d.end=i.changes.mapPos(d.end)),a.push(d)}}s=a}for(let a of i.effects)a.is(n)&&(s=a.value),a.is(fce)&&(s=[]);return s},provide:s=>Xv.from(s)});return{active:r,extension:[r,Vr.define(s=>new cce(s,t,r,n,e.hoverTime||300)),lce]}}function Eq(t,e){let n=t.plugin(d6);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const fce=Ft.define(),s_=at.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 V0(t,e){let n=t.plugin(_q),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const _q=Vr.fromClass(class{constructor(t){this.input=t.state.facet(U0),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(s_);this.top=new h1(t,!0,e.topContainer),this.bottom=new h1(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(s_);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new h1(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new h1(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(U0);if(n!=this.input){let r=n.filter(c=>c),s=[],i=[],a=[],l=[];for(let c of r){let d=this.specs.indexOf(c),h;d<0?(h=c(t.view),l.push(h)):(h=this.panels[d],h.update&&h.update(t)),s.push(h),(h.top?i:a).push(h)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(a);for(let c of l)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Ze.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class h1{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=i_(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=i_(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 i_(t){let e=t.nextSibling;return t.remove(),e}const U0=at.define({enables:_q});class Hl extends sd{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Hl.prototype.elementClass="";Hl.prototype.toDOM=void 0;Hl.prototype.mapMode=Ds.TrackBefore;Hl.prototype.startSide=Hl.prototype.endSide=-1;Hl.prototype.point=!0;const fv=at.define(),mce=at.define(),pce={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Rn.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},j0=at.define();function gce(t){return[Aq(),j0.of({...pce,...t})]}const a_=at.define({combine:t=>t.some(e=>e)});function Aq(t){return[xce]}const xce=Vr.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(j0).map(e=>new l_(t,e)),this.fixed=!t.state.facet(a_);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(a_)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Rn.iter(this.view.state.facet(fv),this.view.viewport.from),r=[],s=this.gutters.map(i=>new vce(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let a=!0;for(let l of i.type)if(l.type==ni.Text&&a){eO(n,r,l.from);for(let c of s)c.line(this.view,l,r);a=!1}else if(l.widget)for(let c of s)c.widget(this.view,l)}else if(i.type==ni.Text){eO(n,r,i.from);for(let a of s)a.line(this.view,i,r)}else if(i.widget)for(let a of s)a.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(j0),n=t.state.facet(j0),r=t.docChanged||t.heightChanged||t.viewportChanged||!Rn.eq(t.startState.facet(fv),t.state.facet(fv),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let a=e.indexOf(i);a<0?s.push(new l_(this.view,i)):(this.gutters[a].update(t),s.push(this.gutters[a]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>Ze.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==gr.LTR?{left:r,right:s}:{right:r,left:s}})});function o_(t){return Array.isArray(t)?t:[t]}function eO(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class vce{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Rn.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,a=n.height/e.scaleY;if(this.i==s.elements.length){let l=new Mq(e,a,i,r);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,a,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];eO(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let a=this.gutter;s.length==0&&!a.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(mce)){let a=i(e,n.widget,n);a&&(s||(s=[])).push(a)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class l_{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let c=i.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=s.clientY;let l=e.lineBlockAtHeight(a-e.documentTop);n.domEventHandlers[r](e,l,s)&&s.preventDefault()});this.markers=o_(n.markers(e)),n.initialSpacer&&(this.spacer=new Mq(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=o_(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!Rn.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Mq{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":""),yce(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,a=0;;){let l=a,c=ii(l,c,d)||a(l,c,d):a}return r}})}});class H4 extends Hl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Q4(t,e){return t.state.facet(Ch).formatNumber(e,t.state)}const Sce=j0.compute([Ch],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(bce)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new H4(Q4(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(wce)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Ch)!=e.state.facet(Ch),initialSpacer(e){return new H4(Q4(e,c_(e.state.doc.lines)))},updateSpacer(e,n){let r=Q4(n.view,c_(n.view.state.doc.lines));return r==e.number?e:new H4(r)},domEventHandlers:t.facet(Ch).domEventHandlers,side:"before"}));function kce(t={}){return[Ch.of(t),Aq(),Sce]}function c_(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(Oce.range(s)))}return Rn.of(e)});function Nce(){return jce}const Rq=1024;let Cce=0;class V4{constructor(e,n){this.from=e,this.to=n}}class sn{constructor(e={}){this.id=Cce++,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=si.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}sn.closedBy=new sn({deserialize:t=>t.split(" ")});sn.openedBy=new sn({deserialize:t=>t.split(" ")});sn.group=new sn({deserialize:t=>t.split(" ")});sn.isolate=new sn({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});sn.contextHash=new sn({perNode:!0});sn.lookAhead=new sn({perNode:!0});sn.mounted=new sn({perNode:!0});class Yv{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[sn.mounted.id]}}const Tce=Object.create(null);class si{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):Tce,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new si(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(sn.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(sn.group),i=-1;i<(s?s.length:0);i++){let a=n[i<0?r.name:s[i]];if(a)return a}}}}si.none=new si("",Object.create(null),0,8);class hb{constructor(e){this.types=e;for(let n=0;n0;for(let c=this.cursor(a|hs.IncludeAnonymous);;){let d=!1;if(c.from<=i&&c.to>=s&&(!l&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;d=!0}for(;d&&r&&(l||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;d=!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:p6(si.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new ar(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new ar(si.none,n,r,s)))}static build(e){return Mce(e)}}ar.empty=new ar(si.none,[],[],0);class f6{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 f6(this.buffer,this.index)}}class Yc{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return si.none}toString(){let e=[];for(let n=0;n0));c=a[c+3]);return l}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),a=0;for(let l=e,c=0;l=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function W0(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?l.length:-1;e!=d;e+=n){let h=l[e],m=c[e]+a.from;if(Dq(s,r,m,m+h.length)){if(h instanceof Yc){if(i&hs.ExcludeBuffers)continue;let g=h.findChild(0,h.buffer.length,n,r-m,s);if(g>-1)return new jo(new Ece(a,h,e,m),null,g)}else if(i&hs.IncludeAnonymous||!h.type.isAnonymous||m6(h)){let g;if(!(i&hs.IgnoreMounts)&&(g=Yv.get(h))&&!g.overlay)return new ki(g.tree,m,e,a);let x=new ki(h,m,e,a);return i&hs.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(n<0?h.children.length-1:0,n,r,s)}}}if(i&hs.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&hs.IgnoreOverlays)&&(s=Yv.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:a,to:l}of s.overlay)if((n>0?a<=i:a=i:l>i))return new ki(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 d_(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let a=!1;!a;)if(a=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function tO(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 Ece{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class jo extends Pq{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 jo(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&hs.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 jo(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 jo(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 jo(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let a=r.buffer[this.index+1];e.push(r.slice(s,i,a)),n.push(0)}return new ar(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function zq(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||a.to=e){let l=new ki(a.tree,a.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(W0(l,e,n,!1))}}return s?zq(s):r}class nO{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 ki)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 ki?(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&hs.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&hs.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&hs.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,a=e<0?-1:r._tree.children.length;i!=a;i+=e){let l=r._tree.children[i];if(this.mode&hs.IncludeAnonymous||l instanceof Yc||!l.type.isAnonymous||m6(l))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let a=e;a;a=a._parent)if(a.index==s){if(s==this.index)return a;n=a,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return tO(this._tree,e,s);let a=r[n.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[s]&&e[s]!=a.name)return!1;s--}}return!0}}function m6(t){return t.children.some(e=>e instanceof Yc||!e.type.isAnonymous||m6(e))}function Mce(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=Rq,reused:i=[],minRepeatType:a=r.types.length}=t,l=Array.isArray(n)?new f6(n,n.length):n,c=r.types,d=0,h=0;function m(E,_,A,L,P,B){let{id:$,start:U,end:te,size:z}=l,Q=h,F=d;if(z<0)if(l.next(),z==-1){let ie=i[$];A.push(ie),L.push(U-E);return}else if(z==-3){d=$;return}else if(z==-4){h=$;return}else throw new RangeError(`Unrecognized record size: ${z}`);let Y=c[$],J,X,R=U-E;if(te-U<=s&&(X=S(l.pos-_,P))){let ie=new Uint16Array(X.size-X.skip),G=l.pos-X.size,I=ie.length;for(;l.pos>G;)I=k(X.start,ie,I);J=new Yc(ie,te-X.start,r),R=X.start-E}else{let ie=l.pos-z;l.next();let G=[],I=[],V=$>=a?$:-1,ee=0,ne=te;for(;l.pos>ie;)V>=0&&l.id==V&&l.size>=0?(l.end<=ne-s&&(y(G,I,U,ee,l.end,ne,V,Q,F),ee=G.length,ne=l.end),l.next()):B>2500?g(U,ie,G,I):m(U,ie,G,I,V,B+1);if(V>=0&&ee>0&&ee-1&&ee>0){let W=x(Y,F);J=p6(Y,G,I,0,G.length,0,te-U,W,W)}else J=w(Y,G,I,te-U,Q-te,F)}A.push(J),L.push(R)}function g(E,_,A,L){let P=[],B=0,$=-1;for(;l.pos>_;){let{id:U,start:te,end:z,size:Q}=l;if(Q>4)l.next();else{if($>-1&&te<$)break;$<0&&($=z-s),P.push(U,te,z),B++,l.next()}}if(B){let U=new Uint16Array(B*4),te=P[P.length-2];for(let z=P.length-3,Q=0;z>=0;z-=3)U[Q++]=P[z],U[Q++]=P[z+1]-te,U[Q++]=P[z+2]-te,U[Q++]=Q;A.push(new Yc(U,P[2]-te,r)),L.push(te-E)}}function x(E,_){return(A,L,P)=>{let B=0,$=A.length-1,U,te;if($>=0&&(U=A[$])instanceof ar){if(!$&&U.type==E&&U.length==P)return U;(te=U.prop(sn.lookAhead))&&(B=L[$]+U.length+te)}return w(E,A,L,P,B,_)}}function y(E,_,A,L,P,B,$,U,te){let z=[],Q=[];for(;E.length>L;)z.push(E.pop()),Q.push(_.pop()+A-P);E.push(w(r.types[$],z,Q,B-P,U-B,te)),_.push(P-A)}function w(E,_,A,L,P,B,$){if(B){let U=[sn.contextHash,B];$=$?[U].concat($):[U]}if(P>25){let U=[sn.lookAhead,P];$=$?[U].concat($):[U]}return new ar(E,_,A,L,$)}function S(E,_){let A=l.fork(),L=0,P=0,B=0,$=A.end-s,U={size:0,start:0,skip:0};e:for(let te=A.pos-E;A.pos>te;){let z=A.size;if(A.id==_&&z>=0){U.size=L,U.start=P,U.skip=B,B+=4,L+=4,A.next();continue}let Q=A.pos-z;if(z<0||Q=a?4:0,Y=A.start;for(A.next();A.pos>Q;){if(A.size<0)if(A.size==-3)F+=4;else break e;else A.id>=a&&(F+=4);A.next()}P=Y,L+=z,B+=F}return(_<0||L==E)&&(U.size=L,U.start=P,U.skip=B),U.size>4?U:void 0}function k(E,_,A){let{id:L,start:P,end:B,size:$}=l;if(l.next(),$>=0&&L4){let te=l.pos-($-4);for(;l.pos>te;)A=k(E,_,A)}_[--A]=U,_[--A]=B-E,_[--A]=P-E,_[--A]=L}else $==-3?d=L:$==-4&&(h=L);return A}let j=[],N=[];for(;l.pos>0;)m(t.start||0,t.bufferStart||0,j,N,-1,0);let T=(e=t.length)!==null&&e!==void 0?e:j.length?N[0]+j[0].length:0;return new ar(c[t.topID],j.reverse(),N.reverse(),T)}const h_=new WeakMap;function mv(t,e){if(!t.isAnonymous||e instanceof Yc||e.type!=t)return 1;let n=h_.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof ar)){n=1;break}n+=mv(t,r)}h_.set(e,n)}return n}function p6(t,e,n,r,s,i,a,l,c){let d=0;for(let y=r;y=h)break;_+=A}if(N==T+1){if(_>h){let A=y[T];x(A.children,A.positions,0,A.children.length,w[T]+j);continue}m.push(y[T])}else{let A=w[N-1]+y[N-1].length-E;m.push(p6(t,y,w,T,N,E,A,null,c))}g.push(E+j-i)}}return x(e,n,r,s,0),(l||c)(m,g,a)}class Rce{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 jo?this.setBuffer(e.context.buffer,e.index,n):e instanceof ki&&this.map.set(e.tree,n)}get(e){return e instanceof jo?this.getBuffer(e.context.buffer,e.index):e instanceof ki?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 Ju{constructor(e,n,r,s,i=!1,a=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new Ju(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,a=e.length?e[0]:null;for(let l=0,c=0,d=0;;l++){let h=l=r)for(;a&&a.from=g.from||m<=g.to||d){let x=Math.max(g.from,c)-d,y=Math.min(g.to,m)-d;g=x>=y?null:new Ju(x,y,g.tree,g.offset+d,l>0,!!h)}if(g&&s.push(g),a.to>m)break;a=inew V4(s.from,s.to)):[new V4(0,0)]:[new V4(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 Dce{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 sn({perNode:!0});let Pce=0;class ha{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=Pce++}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 ha&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new ha(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 Kv(e);return r=>r.modified.indexOf(n)>-1?r:Kv.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let zce=0;class Kv{constructor(e){this.name=e,this.instances=[],this.id=zce++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&Ice(n,l.modified));if(r)return r;let s=[],i=new ha(e.name,s,e,n);for(let l of n)l.instances.push(i);let a=Lce(n);for(let l of e.set)if(!l.modified.length)for(let c of a)s.push(Kv.get(l,c));return i}}function Ice(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function Lce(t){let e=[[]];for(let n=0;nr.length-n.length)}function x6(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],a=2,l=s;for(let m=0;;){if(l=="..."&&m>0&&m+3==s.length){a=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!g)throw new RangeError("Invalid path: "+s);if(i.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),m+=g[0].length,m==s.length)break;let x=s[m++];if(m==s.length&&x=="!"){a=0;break}if(x!="/")throw new RangeError("Invalid path: "+s);l=s.slice(m)}let c=i.length-1,d=i[c];if(!d)throw new RangeError("Invalid path: "+s);let h=new G0(r,a,c>0?i.slice(0,c):null);e[d]=h.sort(e[d])}}return Iq.add(e)}const Iq=new sn({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 G0(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class G0{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let a=s;for(let l of i)for(let c of l.set){let d=n[c.id];if(d){a=a?a+" "+d:d;break}}return a},scope:r}}function Bce(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function Fce(t,e,n,r=0,s=t.length){let i=new qce(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class qce{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:a,from:l,to:c}=e;if(l>=r||c<=n)return;a.isTop&&(i=this.highlighters.filter(x=>!x.scope||x.scope(a)));let d=s,h=$ce(e)||G0.empty,m=Bce(i,h.tags);if(m&&(d&&(d+=" "),d+=m,h.mode==1&&(s+=(s?" ":"")+m)),this.startSpan(Math.max(n,l),d),h.opaque)return;let g=e.tree&&e.tree.prop(sn.mounted);if(g&&g.overlay){let x=e.node.enter(g.overlay[0].from+l,1),y=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),w=e.firstChild();for(let S=0,k=l;;S++){let j=S=N||!e.nextSibling())););if(!j||N>r)break;k=j.to+l,k>n&&(this.highlightRange(x.cursor(),Math.max(n,j.from+l),Math.min(r,k),"",y),this.startSpan(Math.min(r,k),d))}w&&e.parent()}else if(e.firstChild()){g&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),d)}while(e.nextSibling());e.parent()}}}function $ce(t){let e=t.type.prop(Iq);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ke=ha.define,m1=Ke(),Mc=Ke(),f_=Ke(Mc),m_=Ke(Mc),Rc=Ke(),p1=Ke(Rc),U4=Ke(Rc),po=Ke(),Ru=Ke(po),fo=Ke(),mo=Ke(),rO=Ke(),qm=Ke(rO),g1=Ke(),ve={comment:m1,lineComment:Ke(m1),blockComment:Ke(m1),docComment:Ke(m1),name:Mc,variableName:Ke(Mc),typeName:f_,tagName:Ke(f_),propertyName:m_,attributeName:Ke(m_),className:Ke(Mc),labelName:Ke(Mc),namespace:Ke(Mc),macroName:Ke(Mc),literal:Rc,string:p1,docString:Ke(p1),character:Ke(p1),attributeValue:Ke(p1),number:U4,integer:Ke(U4),float:Ke(U4),bool:Ke(Rc),regexp:Ke(Rc),escape:Ke(Rc),color:Ke(Rc),url:Ke(Rc),keyword:fo,self:Ke(fo),null:Ke(fo),atom:Ke(fo),unit:Ke(fo),modifier:Ke(fo),operatorKeyword:Ke(fo),controlKeyword:Ke(fo),definitionKeyword:Ke(fo),moduleKeyword:Ke(fo),operator:mo,derefOperator:Ke(mo),arithmeticOperator:Ke(mo),logicOperator:Ke(mo),bitwiseOperator:Ke(mo),compareOperator:Ke(mo),updateOperator:Ke(mo),definitionOperator:Ke(mo),typeOperator:Ke(mo),controlOperator:Ke(mo),punctuation:rO,separator:Ke(rO),bracket:qm,angleBracket:Ke(qm),squareBracket:Ke(qm),paren:Ke(qm),brace:Ke(qm),content:po,heading:Ru,heading1:Ke(Ru),heading2:Ke(Ru),heading3:Ke(Ru),heading4:Ke(Ru),heading5:Ke(Ru),heading6:Ke(Ru),contentSeparator:Ke(po),list:Ke(po),quote:Ke(po),emphasis:Ke(po),strong:Ke(po),link:Ke(po),monospace:Ke(po),strikethrough:Ke(po),inserted:Ke(),deleted:Ke(),changed:Ke(),invalid:Ke(),meta:g1,documentMeta:Ke(g1),annotation:Ke(g1),processingInstruction:Ke(g1),definition:ha.defineModifier("definition"),constant:ha.defineModifier("constant"),function:ha.defineModifier("function"),standard:ha.defineModifier("standard"),local:ha.defineModifier("local"),special:ha.defineModifier("special")};for(let t in ve){let e=ve[t];e instanceof ha&&(e.name=t)}Lq([{tag:ve.link,class:"tok-link"},{tag:ve.heading,class:"tok-heading"},{tag:ve.emphasis,class:"tok-emphasis"},{tag:ve.strong,class:"tok-strong"},{tag:ve.keyword,class:"tok-keyword"},{tag:ve.atom,class:"tok-atom"},{tag:ve.bool,class:"tok-bool"},{tag:ve.url,class:"tok-url"},{tag:ve.labelName,class:"tok-labelName"},{tag:ve.inserted,class:"tok-inserted"},{tag:ve.deleted,class:"tok-deleted"},{tag:ve.literal,class:"tok-literal"},{tag:ve.string,class:"tok-string"},{tag:ve.number,class:"tok-number"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],class:"tok-string2"},{tag:ve.variableName,class:"tok-variableName"},{tag:ve.local(ve.variableName),class:"tok-variableName tok-local"},{tag:ve.definition(ve.variableName),class:"tok-variableName tok-definition"},{tag:ve.special(ve.variableName),class:"tok-variableName2"},{tag:ve.definition(ve.propertyName),class:"tok-propertyName tok-definition"},{tag:ve.typeName,class:"tok-typeName"},{tag:ve.namespace,class:"tok-namespace"},{tag:ve.className,class:"tok-className"},{tag:ve.macroName,class:"tok-macroName"},{tag:ve.propertyName,class:"tok-propertyName"},{tag:ve.operator,class:"tok-operator"},{tag:ve.comment,class:"tok-comment"},{tag:ve.meta,class:"tok-meta"},{tag:ve.invalid,class:"tok-invalid"},{tag:ve.punctuation,class:"tok-punctuation"}]);var W4;const Qu=new sn;function Bq(t){return at.define({combine:t?e=>e.concat(t):void 0})}const Hce=new sn;class va{constructor(e,n,r=[],s=""){this.data=e,this.name=s,wn.prototype.hasOwnProperty("tree")||Object.defineProperty(wn.prototype,"tree",{get(){return Ss(this)}}),this.parser=n,this.extension=[Kc.of(this),wn.languageData.of((i,a,l)=>{let c=p_(i,a,l),d=c.type.prop(Qu);if(!d)return[];let h=i.facet(d),m=c.type.prop(Hce);if(m){let g=c.resolve(a-c.from,l);for(let x of m)if(x.test(g,i)){let y=i.facet(x.facet);return x.type=="replace"?y:y.concat(h)}}return h})].concat(r)}isActiveAt(e,n,r=-1){return p_(e,n,r).type.prop(Qu)==this.data}findRegions(e){let n=e.facet(Kc);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,a)=>{if(i.prop(Qu)==this.data){r.push({from:a,to:a+i.length});return}let l=i.prop(sn.mounted);if(l){if(l.tree.prop(Qu)==this.data){if(l.overlay)for(let c of l.overlay)r.push({from:c.from+a,to:c.to+a});else r.push({from:a,to:a+i.length});return}else if(l.overlay){let c=r.length;if(s(l.tree,l.overlay[0].from+a),r.length>c)return}}for(let c=0;cr.isTop?n:void 0)]}),e.name)}configure(e,n){return new X0(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ss(t){let e=t.field(va.state,!1);return e?e.tree:ar.empty}class Qce{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 $m=null;class rf{constructor(e,n,r=[],s,i,a,l,c){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=a,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new rf(e,n,[],ar.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Qce(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ar.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(Ju.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=$m;$m=this;try{return e()}finally{$m=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=g_(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:a,skipped:l}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((d,h,m,g)=>c.push({fromA:d,toA:h,fromB:m,toB:g})),r=Ju.applyChanges(r,c),s=ar.empty,i=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){l=[];for(let d of this.skipped){let h=e.mapPos(d.from,1),m=e.mapPos(d.to,-1);he.from&&(this.fragments=g_(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 g6{createParse(n,r,s){let i=s[0].from,a=s[s.length-1].to;return{parsedPos:i,advance(){let c=$m;if(c){for(let d of s)c.tempSkipped.push(d);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=a,new ar(si.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return $m}}function g_(t,e,n){return Ju.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class sf{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 sf(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=rf.create(e.facet(Kc).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new sf(r)}}va.state=Os.define({create:sf.init,update(t,e){for(let n of e.effects)if(n.is(va.setState))return n.value;return e.startState.facet(Kc)!=e.state.facet(Kc)?sf.init(e.state):t.apply(e)}});let Fq=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Fq=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const G4=typeof navigator<"u"&&(!((W4=navigator.scheduling)===null||W4===void 0)&&W4.isInputPending)?()=>navigator.scheduling.isInputPending():null,Vce=Vr.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(va.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(va.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=Fq(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,c=i.context.work(()=>G4&&G4()||Date.now()>a,s+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:va.setState.of(new sf(i.context))})),this.chunkBudget>0&&!(c&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>vi(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()}}}),Kc=at.define({combine(t){return t.length?t[0]:null},enables:t=>[va.state,Vce,Ze.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class qq{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const Uce=at.define(),Wp=at.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 ld(t){let e=t.facet(Wp);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Y0(t,e){let n="",r=t.tabSize,s=t.facet(Wp)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?Wce(t,n,e):null}class fb{constructor(e,n={}){this.state=e,this.options=n,this.unit=ld(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=a-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Nf(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let a=i(s);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const mb=new sn;function Wce(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let a=s;a&&!(a.fromr.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)i.push(a);for(let a=i.length-1;a>=0;a--)r={node:i[a],next:r}}return $q(r,t,n)}function $q(t,e,n){for(let r=t;r;r=r.next){let s=Xce(r.node);if(s)return s(y6.create(e,n,r))}return 0}function Gce(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Xce(t){let e=t.type.prop(mb);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(sn.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return a=>Hq(a,!0,1,void 0,i&&!Gce(a)?s.from:void 0)}return t.parent==null?Yce:null}function Yce(){return 0}class y6 extends fb{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 y6(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(Kce(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return $q(this.context.next,this.base,this.pos)}}function Kce(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function Zce(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),a=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let l=n.to;;){let c=e.childAfter(l);if(!c||c==r)return null;if(!c.type.isSkipped){if(c.from>=a)return null;let d=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+d}}l=c.to}}function X4({closing:t,align:e=!0,units:n=1}){return r=>Hq(r,e,n,t)}function Hq(t,e,n,r,s){let i=t.textAfter,a=i.match(/^\s*/)[0].length,l=r&&i.slice(a,a+r.length)==r||s==t.pos+a,c=e?Zce(t):null;return c?l?t.column(c.from):t.column(c.to):t.baseIndent+(l?0:t.unit*n)}function x_({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const Jce=200;function eue(){return wn.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+Jce)return t;let i=n.sliceString(s.from,r);if(!e.some(d=>d.test(i)))return t;let{state:a}=t,l=-1,c=[];for(let{head:d}of a.selection.ranges){let h=a.doc.lineAt(d);if(h.from==l)continue;l=h.from;let m=v6(a,h.from);if(m==null)continue;let g=/^\s*/.exec(h.text)[0],x=Y0(a,m);g!=x&&c.push({from:h.from,to:h.from+g.length,insert:x})}return c.length?[t,{changes:c,sequential:!0}]:t})}const tue=at.define(),b6=new sn;function Qq(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&l.from=e&&d.to>n&&(i=d)}}return i}function rue(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Zv(t,e,n){for(let r of t.facet(tue)){let s=r(t,e,n);if(s)return s}return nue(t,e,n)}function Vq(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 pb=Ft.define({map:Vq}),Gp=Ft.define({map:Vq});function Uq(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 cd=Os.define({create(){return kt.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=v_(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(pb)&&!sue(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(Xq),s=r?kt.replace({widget:new due(r(e.state,n.value))}):y_;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(Gp)&&(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=v_(t,e.selection.main.head)),t},provide:t=>Ze.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 Jv(t,e,n){var r;let s=null;return(r=t.field(cd,!1))===null||r===void 0||r.between(e,n,(i,a)=>{(!s||s.from>i)&&(s={from:i,to:a})}),s}function sue(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function Wq(t,e){return t.field(cd,!1)?e:e.concat(Ft.appendConfig.of(Yq()))}const iue=t=>{for(let e of Uq(t)){let n=Zv(t.state,e.from,e.to);if(n)return t.dispatch({effects:Wq(t.state,[pb.of(n),Gq(t,n)])}),!0}return!1},aue=t=>{if(!t.state.field(cd,!1))return!1;let e=[];for(let n of Uq(t)){let r=Jv(t.state,n.from,n.to);r&&e.push(Gp.of(r),Gq(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function Gq(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return Ze.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const oue=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(cd,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(Gp.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},cue=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:iue},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:aue},{key:"Ctrl-Alt-[",run:oue},{key:"Ctrl-Alt-]",run:lue}],uue={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Xq=at.define({combine(t){return $o(t,uue)}});function Yq(t){return[cd,mue]}function Kq(t,e){let{state:n}=t,r=n.facet(Xq),s=a=>{let l=t.lineBlockAt(t.posAtDOM(a.target)),c=Jv(t.state,l.from,l.to);c&&t.dispatch({effects:Gp.of(c)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const y_=kt.replace({widget:new class extends Ho{toDOM(t){return Kq(t,null)}}});class due extends Ho{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Kq(e,this.value)}}const hue={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Y4 extends Hl{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function fue(t={}){let e={...hue,...t},n=new Y4(e,!0),r=new Y4(e,!1),s=Vr.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(Kc)!=a.state.facet(Kc)||a.startState.field(cd,!1)!=a.state.field(cd,!1)||Ss(a.startState)!=Ss(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let l=new ql;for(let c of a.viewportLineBlocks){let d=Jv(a.state,c.from,c.to)?r:Zv(a.state,c.from,c.to)?n:null;d&&l.add(c.from,c.from,d)}return l.finish()}}),{domEventHandlers:i}=e;return[s,gce({class:"cm-foldGutter",markers(a){var l;return((l=a.plugin(s))===null||l===void 0?void 0:l.markers)||Rn.empty},initialSpacer(){return new Y4(e,!1)},domEventHandlers:{...i,click:(a,l,c)=>{if(i.click&&i.click(a,l,c))return!0;let d=Jv(a.state,l.from,l.to);if(d)return a.dispatch({effects:Gp.of(d)}),!0;let h=Zv(a.state,l.from,l.to);return h?(a.dispatch({effects:pb.of(h)}),!0):!1}}}),Yq()]}const mue=Ze.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 Xp{constructor(e,n){this.specs=e;let r;function s(l){let c=Wc.newName();return(r||(r=Object.create(null)))["."+c]=l,c}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,a=n.scope;this.scope=a instanceof va?l=>l.prop(Qu)==a.data:a?l=>l==a:void 0,this.style=Lq(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:i}).style,this.module=r?new Wc(r):null,this.themeType=n.themeType}static define(e,n){return new Xp(e,n||{})}}const sO=at.define(),Zq=at.define({combine(t){return t.length?[t[0]]:null}});function K4(t){let e=t.facet(sO);return e.length?e:t.facet(Zq)}function Jq(t,e){let n=[gue],r;return t instanceof Xp&&(t.module&&n.push(Ze.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(Zq.of(t)):r?n.push(sO.computeN([Ze.darkTheme],s=>s.facet(Ze.darkTheme)==(r=="dark")?[t]:[])):n.push(sO.of(t)),n}class pue{constructor(e){this.markCache=Object.create(null),this.tree=Ss(e.state),this.decorations=this.buildDeco(e,K4(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Ss(e.state),r=K4(e.state),s=r!=K4(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return kt.none;let r=new ql;for(let{from:s,to:i}of e.visibleRanges)Fce(this.tree,n,(a,l,c)=>{r.add(a,l,this.markCache[c]||(this.markCache[c]=kt.mark({class:c})))},s,i);return r.finish()}}const gue=ou.high(Vr.fromClass(pue,{decorations:t=>t.decorations})),xue=Xp.define([{tag:ve.meta,color:"#404740"},{tag:ve.link,textDecoration:"underline"},{tag:ve.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strong,fontWeight:"bold"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.keyword,color:"#708"},{tag:[ve.atom,ve.bool,ve.url,ve.contentSeparator,ve.labelName],color:"#219"},{tag:[ve.literal,ve.inserted],color:"#164"},{tag:[ve.string,ve.deleted],color:"#a11"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],color:"#e40"},{tag:ve.definition(ve.variableName),color:"#00f"},{tag:ve.local(ve.variableName),color:"#30a"},{tag:[ve.typeName,ve.namespace],color:"#085"},{tag:ve.className,color:"#167"},{tag:[ve.special(ve.variableName),ve.macroName],color:"#256"},{tag:ve.definition(ve.propertyName),color:"#00c"},{tag:ve.comment,color:"#940"},{tag:ve.invalid,color:"#f00"}]),vue=Ze.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),e$=1e4,t$="()[]{}",n$=at.define({combine(t){return $o(t,{afterCursor:!0,brackets:t$,maxScanDistance:e$,renderMatch:wue})}}),yue=kt.mark({class:"cm-matchingBracket"}),bue=kt.mark({class:"cm-nonmatchingBracket"});function wue(t){let e=[],n=t.matched?yue:bue;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 Sue=Os.define({create(){return kt.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(n$);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=No(e.state,s.head,-1,r)||s.head>0&&No(e.state,s.head-1,1,r)||r.afterCursor&&(No(e.state,s.head,1,r)||s.headZe.decorations.from(t)}),kue=[Sue,vue];function Oue(t={}){return[n$.of(t),kue]}const jue=new sn;function iO(t,e,n){let r=t.prop(e<0?sn.openedBy:sn.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 aO(t){let e=t.type.prop(jue);return e?e(t.node):t}function No(t,e,n,r={}){let s=r.maxScanDistance||e$,i=r.brackets||t$,a=Ss(t),l=a.resolveInner(e,n);for(let c=l;c;c=c.parent){let d=iO(c.type,n,i);if(d&&c.from0?e>=h.from&&eh.from&&e<=h.to))return Nue(t,e,n,c,h,d,i)}}return Cue(t,e,n,a,l.type,s,i)}function Nue(t,e,n,r,s,i,a){let l=r.parent,c={from:s.from,to:s.to},d=0,h=l?.cursor();if(h&&(n<0?h.childBefore(r.from):h.childAfter(r.to)))do if(n<0?h.to<=r.from:h.from>=r.to){if(d==0&&i.indexOf(h.type.name)>-1&&h.from0)return null;let d={from:n<0?e-1:e,to:n>0?e+1:e},h=t.doc.iterRange(e,n>0?t.doc.length:0),m=0;for(let g=0;!h.next().done&&g<=i;){let x=h.value;n<0&&(g+=x.length);let y=e+g*n;for(let w=n>0?0:x.length-1,S=n>0?x.length:-1;w!=S;w+=n){let k=a.indexOf(x[w]);if(!(k<0||r.resolveInner(y+w,1).type!=s))if(k%2==0==n>0)m++;else{if(m==1)return{start:d,end:{from:y+w,to:y+w+1},matched:k>>1==c>>1};m--}}n>0&&(g+=x.length)}return h.done?{start:d,matched:!1}:null}function b_(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let a=r;a=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?a.toLowerCase():a,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function Tue(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||Eue,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||k6,mergeTokens:t.mergeTokens!==!1}}function Eue(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 w_=new WeakMap;class w6 extends va{constructor(e){let n=Bq(e.languageData),r=Tue(e),s,i=new class extends g6{createParse(a,l,c){return new Aue(s,a,l,c)}};super(n,i,[],e.name),this.topNode=Due(n,this),s=this,this.streamParser=r,this.stateAfter=new sn({perNode:!0}),this.tokenTable=e.tokenTable?new o$(r.tokenTable):Rue}static define(e){return new w6(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=w_.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let a=e.children.length-1;a>=0;a--){let l=e.children[a],c=n+e.positions[a],d=l instanceof ar&&c=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let a=e.positions[i],l=e.children[i],c;if(an&&S6(t,i.tree,0-i.offset,n,l),d;if(c&&c.pos<=r&&(d=s$(t,i.tree,n+i.offset,c.pos+i.offset,!1)))return{state:c.state,tree:d}}return{state:t.streamParser.startState(s?ld(s):4),tree:ar.empty}}let Aue=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=rf.get(),a=s[0].from,{state:l,tree:c}=_ue(e,r,a,this.to,i?.state);this.state=l,this.parsedPos=this.chunkStart=a+c.length;for(let d=0;dd.from<=i.viewport.from&&d.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(ld(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=rf.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==` +3.某句话如果已经被回复过,不要重复回复`}),[y,w]=b.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,k]=b.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遇遇特定事件的时候起伏较大",all_global:!0}),[j,N]=b.useState({api_key:""}),[T,E]=b.useState(!1),[_,A]=b.useState(""),D=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:o0},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:Lv},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Ij},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Vc},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:jI}],q=(n+1)/D.length*100;b.useEffect(()=>{(async()=>{try{d(!0);const[$,K,Y,R,ie]=await Promise.all([Nie(),Cie(),Tie(),Eie(),_ie()]);m($),x(K),w(Y),k(R),N(ie)}catch($){e({title:"加载配置失败",description:$ instanceof Error?$.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{d(!1)}})()},[e]);const B=async()=>{l(!0);try{switch(n){case 0:await Aie(h);break;case 1:await Mie(g);break;case 2:await Rie(y);break;case 3:await Die(S);break;case 4:await Pie(j);break}return e({title:"保存成功",description:`${D[n].title}配置已保存`}),!0}catch(L){return e({title:"保存失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"}),!1}finally{l(!1)}},H=async()=>{await B()&&n{n>0&&r(n-1)},ee=async()=>{i(!0),E(!0);try{if(A("正在保存API配置..."),!await B()){i(!1),E(!1);return}A("正在完成初始化..."),await uE(),A("正在重启麦麦..."),await cb(),e({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),A("等待麦麦重启完成...");const $=60;let K=0,Y=!1;for(;K<$&&!Y;){await new Promise(R=>setTimeout(R,1e3));try{(await zie()).running&&(Y=!0,A("重启成功!正在跳转..."))}catch{K++}}if(!Y)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{t({to:"/"})},1e3)}catch(L){E(!1),e({title:"配置失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}finally{i(!1)}},I=async()=>{try{await uE(),t({to:"/"})}catch(L){e({title:"跳过失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},V=()=>{switch(n){case 0:return o.jsx(wie,{config:h,onChange:m});case 1:return o.jsx(Sie,{config:g,onChange:x});case 2:return o.jsx(kie,{config:y,onChange:w});case 3:return o.jsx(Oie,{config:S,onChange:k});case 4:return o.jsx(jie,{config:j,onChange:N});default:return null}};return o.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[T&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:o.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[o.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:o.jsx(Us,{className:"h-10 w-10 animate-spin text-primary"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),o.jsx("p",{className:"text-muted-foreground",children:_})]}),o.jsx("div",{className:"w-full",children:o.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:o.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),o.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[o.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),o.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),c?o.jsxs("div",{className:"relative z-10 text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:o.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),o.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),o.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[o.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:o.jsx(Uee,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),o.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),o.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",Jj," 的初始配置"]})]}),o.jsxs("div",{className:"mb-6 md:mb-8",children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[o.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",D.length]}),o.jsxs("span",{className:"font-medium text-primary",children:[Math.round(q),"%"]})]}),o.jsx(Qp,{value:q,className:"h-2"})]}),o.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:D.map((L,$)=>{const K=L.icon;return o.jsxs("div",{className:xe("flex flex-1 flex-col items-center gap-1 md:gap-2",$t({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[o.jsx(L0,{className:"h-4 w-4"}),"返回首页"]}),o.jsxs(ue,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[o.jsx(Bv,{className:"h-4 w-4"}),"返回上一页"]})]}),o.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var PB=["PageUp","PageDown"],zB=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],IB={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},jf="Slider",[xk,Lie,Bie]=Qy(jf),[LB]=Da(jf,[Bie]),[Fie,ub]=LB(jf),BB=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:a="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[r],value:h,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:y,...w}=t,S=b.useRef(new Set),k=b.useRef(0),N=a==="horizontal"?qie:$ie,[T=[],E]=Kl({prop:h,defaultProp:d,onChange:H=>{[...S.current][k.current]?.focus(),m(H)}}),_=b.useRef(T);function A(H){const W=Wie(T,H);B(H,W)}function D(H){B(H,k.current)}function q(){const H=_.current[k.current];T[k.current]!==H&&g(T)}function B(H,W,{commit:ee}={commit:!1}){const I=Kie(i),V=Zie(Math.round((H-r)/i)*i+r,I),L=Tj(V,[r,s]);E(($=[])=>{const K=Vie($,L,W);if(Yie(K,c*i)){k.current=K.indexOf(L);const Y=String(K)!==String($);return Y&&ee&&g(K),Y?K:$}else return $})}return o.jsx(Fie,{scope:t.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:k,thumbs:S.current,values:T,orientation:a,form:y,children:o.jsx(xk.Provider,{scope:t.__scopeSlider,children:o.jsx(xk.Slot,{scope:t.__scopeSlider,children:o.jsx(N,{"aria-disabled":l,"data-disabled":l?"":void 0,...w,ref:e,onPointerDown:nt(w.onPointerDown,()=>{l||(_.current=T)}),min:r,max:s,inverted:x,onSlideStart:l?void 0:A,onSlideMove:l?void 0:D,onSlideEnd:l?void 0:q,onHomeKeyDown:()=>!l&&B(r,0,{commit:!0}),onEndKeyDown:()=>!l&&B(s,T.length-1,{commit:!0}),onStepKeyDown:({event:H,direction:W})=>{if(!l){const V=PB.includes(H.key)||H.shiftKey&&zB.includes(H.key)?10:1,L=k.current,$=T[L],K=i*V*W;B($+K,L,{commit:!0})}}})})})})});BB.displayName=jf;var[FB,qB]=LB(jf,{startEdge:"left",endEdge:"right",size:"width",direction:1}),qie=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:a,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...h}=t,[m,g]=b.useState(null),x=er(e,N=>g(N)),y=b.useRef(void 0),w=Rp(s),S=w==="ltr",k=S&&!i||!S&&i;function j(N){const T=y.current||m.getBoundingClientRect(),E=[0,T.width],A=t6(E,k?[n,r]:[r,n]);return y.current=T,A(N-T.left)}return o.jsx(FB,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:o.jsx($B,{dir:w,"data-orientation":"horizontal",...h,ref:x,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:N=>{const T=j(N.clientX);a?.(T)},onSlideMove:N=>{const T=j(N.clientX);l?.(T)},onSlideEnd:()=>{y.current=void 0,c?.()},onStepKeyDown:N=>{const E=IB[k?"from-left":"from-right"].includes(N.key);d?.({event:N,direction:E?-1:1})}})})}),$ie=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:l,onStepKeyDown:c,...d}=t,h=b.useRef(null),m=er(e,h),g=b.useRef(void 0),x=!s;function y(w){const S=g.current||h.current.getBoundingClientRect(),k=[0,S.height],N=t6(k,x?[r,n]:[n,r]);return g.current=S,N(w-S.top)}return o.jsx(FB,{scope:t.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:o.jsx($B,{"data-orientation":"vertical",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const S=y(w.clientY);i?.(S)},onSlideMove:w=>{const S=y(w.clientY);a?.(S)},onSlideEnd:()=>{g.current=void 0,l?.()},onStepKeyDown:w=>{const k=IB[x?"from-bottom":"from-top"].includes(w.key);c?.({event:w,direction:k?-1:1})}})})}),$B=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:l,onStepKeyDown:c,...d}=t,h=ub(jf,n);return o.jsx(Sn.span,{...d,ref:e,onKeyDown:nt(t.onKeyDown,m=>{m.key==="Home"?(a(m),m.preventDefault()):m.key==="End"?(l(m),m.preventDefault()):PB.concat(zB).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:nt(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),h.thumbs.has(g)?g.focus():r(m)}),onPointerMove:nt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:nt(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),HB="SliderTrack",QB=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=ub(HB,n);return o.jsx(Sn.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});QB.displayName=HB;var vk="SliderRange",VB=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=ub(vk,n),i=qB(vk,n),a=b.useRef(null),l=er(e,a),c=s.values.length,d=s.values.map(g=>GB(g,s.min,s.max)),h=c>1?Math.min(...d):0,m=100-Math.max(...d);return o.jsx(Sn.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...t.style,[i.startEdge]:h+"%",[i.endEdge]:m+"%"}})});VB.displayName=vk;var yk="SliderThumb",UB=b.forwardRef((t,e)=>{const n=Lie(t.__scopeSlider),[r,s]=b.useState(null),i=er(e,l=>s(l)),a=b.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return o.jsx(Hie,{...t,ref:i,index:a})}),Hie=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,a=ub(yk,n),l=qB(yk,n),[c,d]=b.useState(null),h=er(e,j=>d(j)),m=c?a.form||!!c.closest("form"):!0,g=iI(c),x=a.values[r],y=x===void 0?0:GB(x,a.min,a.max),w=Uie(r,a.values.length),S=g?.[l.size],k=S?Gie(S,y,l.direction):0;return b.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${y}% + ${k}px)`},children:[o.jsx(xk.ItemSlot,{scope:t.__scopeSlider,children:o.jsx(Sn.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":a.min,"aria-valuenow":x,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:h,style:x===void 0?{display:"none"}:t.style,onFocus:nt(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),m&&o.jsx(WB,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:x},r)]})});UB.displayName=yk;var Qie="RadioBubbleInput",WB=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),i=er(s,r),a=sI(e);return b.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==e&&h){const m=new Event("input",{bubbles:!0});h.call(l,e),l.dispatchEvent(m)}},[a,e]),o.jsx(Sn.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});WB.displayName=Qie;function Vie(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function GB(t,e,n){const i=100/(n-e)*(t-e);return Tj(i,[0,100])}function Uie(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Wie(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 Gie(t,e,n){const r=t/2,i=t6([0,50],[0,r]);return(r-i(e)*n)*n}function Xie(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Yie(t,e){if(e>0){const n=Xie(t);return Math.min(...n)>=e}return!0}function t6(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 Kie(t){return(String(t).split(".")[1]||"").length}function Zie(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var XB=BB,Jie=QB,eae=VB,tae=UB;const Nf=b.forwardRef(({className:t,...e},n)=>o.jsxs(XB,{ref:n,className:xe("relative flex w-full touch-none select-none items-center",t),...e,children:[o.jsx(Jie,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:o.jsx(eae,{className:"absolute h-full bg-primary"})}),o.jsx(tae,{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"})]}));Nf.displayName=XB.displayName;const Vt=Dee,Ut=Pee,$t=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(cI,{ref:r,className:xe("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,o.jsx(Eee,{asChild:!0,children:o.jsx(Xc,{className:"h-4 w-4 opacity-50"})})]}));$t.displayName=cI.displayName;const YB=b.forwardRef(({className:t,...e},n)=>o.jsx(uI,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(B0,{className:"h-4 w-4"})}));YB.displayName=uI.displayName;const KB=b.forwardRef(({className:t,...e},n)=>o.jsx(dI,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(Xc,{className:"h-4 w-4"})}));KB.displayName=dI.displayName;const Ht=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>o.jsx(_ee,{children:o.jsxs(hI,{ref:s,className:xe("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[o.jsx(YB,{}),o.jsx(Aee,{className:xe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),o.jsx(KB,{})]})}));Ht.displayName=hI.displayName;const nae=b.forwardRef(({className:t,...e},n)=>o.jsx(fI,{ref:n,className:xe("px-2 py-1.5 text-sm font-semibold",t),...e}));nae.displayName=fI.displayName;const De=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(mI,{ref:r,className:xe("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[o.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(Mee,{children:o.jsx(zo,{className:"h-4 w-4"})})}),o.jsx(Ree,{children:e})]}));De.displayName=mI.displayName;const rae=b.forwardRef(({className:t,...e},n)=>o.jsx(pI,{ref:n,className:xe("-mx-1 my-1 h-px bg-muted",t),...e}));rae.displayName=pI.displayName;function sae(t){const e=iae(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,l=b.Children.toArray(i),c=l.find(oae);if(c){const d=c.props.children,h=l.map(m=>m===c?b.Children.count(d)>1?b.Children.only(null):b.isValidElement(d)?d.props.children:null:m);return o.jsx(e,{...a,ref:s,children:b.isValidElement(d)?b.cloneElement(d,void 0,h):null})}return o.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function iae(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=cae(s),l=lae(i,s.props);return s.type!==b.Fragment&&(l.ref=r?Gc(r,a):a),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var aae=Symbol("radix.slottable");function oae(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===aae}function lae(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function cae(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 db="Popover",[ZB]=Da(db,[vf]),Vp=vf(),[uae,lu]=ZB(db),JB=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=t,l=Vp(e),c=b.useRef(null),[d,h]=b.useState(!1),[m,g]=Kl({prop:r,defaultProp:s??!1,onChange:i,caller:db});return o.jsx(Yy,{...l,children:o.jsx(uae,{scope:e,contentId:Gi(),triggerRef:c,open:m,onOpenChange:g,onOpenToggle:b.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:d,onCustomAnchorAdd:b.useCallback(()=>h(!0),[]),onCustomAnchorRemove:b.useCallback(()=>h(!1),[]),modal:a,children:n})})};JB.displayName=db;var eF="PopoverAnchor",dae=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=lu(eF,n),i=Vp(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:l}=s;return b.useEffect(()=>(a(),()=>l()),[a,l]),o.jsx(Ky,{...i,...r,ref:e})});dae.displayName=eF;var tF="PopoverTrigger",nF=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=lu(tF,n),i=Vp(n),a=er(e,s.triggerRef),l=o.jsx(Sn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":oF(s.open),...r,ref:a,onClick:nt(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:o.jsx(Ky,{asChild:!0,...i,children:l})});nF.displayName=tF;var n6="PopoverPortal",[hae,fae]=ZB(n6,{forceMount:void 0}),rF=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=lu(n6,e);return o.jsx(hae,{scope:e,forceMount:n,children:o.jsx(oi,{present:n||i.open,children:o.jsx(Xy,{asChild:!0,container:s,children:r})})})};rF.displayName=n6;var Kh="PopoverContent",sF=b.forwardRef((t,e)=>{const n=fae(Kh,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=lu(Kh,t.__scopePopover);return o.jsx(oi,{present:r||i.open,children:i.modal?o.jsx(pae,{...s,ref:e}):o.jsx(gae,{...s,ref:e})})});sF.displayName=Kh;var mae=sae("PopoverContent.RemoveScroll"),pae=b.forwardRef((t,e)=>{const n=lu(Kh,t.__scopePopover),r=b.useRef(null),s=er(e,r),i=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return gI(a)},[]),o.jsx(xI,{as:mae,allowPinchZoom:!0,children:o.jsx(iF,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nt(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:nt(t.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:nt(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),gae=b.forwardRef((t,e)=>{const n=lu(Kh,t.__scopePopover),r=b.useRef(!1),s=b.useRef(!1);return o.jsx(iF,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;n.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),iF=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,...m}=t,g=lu(Kh,n),x=Vp(n);return vI(),o.jsx(yI,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:o.jsx(Rj,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>g.onOpenChange(!1),children:o.jsx(Dj,{"data-state":oF(g.open),role:"dialog",id:g.contentId,...x,...m,ref:e,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),aF="PopoverClose",xae=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=lu(aF,n);return o.jsx(Sn.button,{type:"button",...r,ref:e,onClick:nt(t.onClick,()=>s.onOpenChange(!1))})});xae.displayName=aF;var vae="PopoverArrow",yae=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Vp(n);return o.jsx(Pj,{...s,...r,ref:e})});yae.displayName=vae;function oF(t){return t?"open":"closed"}var bae=JB,wae=nF,Sae=rF,lF=sF;const Bo=bae,Fo=wae,Ka=b.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>o.jsx(Sae,{children:o.jsx(lF,{ref:s,align:e,sideOffset:n,className:xe("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})}));Ka.displayName=lF.displayName;const cu="/api/webui/config";async function dE(){const e=await(await gt(`${cu}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Dh(){const e=await(await gt(`${cu}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function hE(t){const n=await(await gt(`${cu}/bot`,{method:"POST",headers:Tt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function kae(){const e=await(await gt(`${cu}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function Oae(t){const n=await(await gt(`${cu}/bot/raw`,{method:"POST",headers:Tt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function Uv(t){const n=await(await gt(`${cu}/model`,{method:"POST",headers:Tt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function jae(t,e){const r=await(await gt(`${cu}/bot/section/${t}`,{method:"POST",headers:Tt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function bk(t,e){const r=await(await gt(`${cu}/model/section/${t}`,{method:"POST",headers:Tt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function Nae(t,e="openai",n="/models"){const r=new URLSearchParams({provider_name:t,parser:e,endpoint:n}),s=await gt(`/api/webui/models/list?${r}`);if(!s.ok){const a=await s.json().catch(()=>({}));throw new Error(a.detail||`获取模型列表失败 (${s.status})`)}const i=await s.json();if(!i.success)throw new Error("获取模型列表失败");return i.models}async function Cae(t){const e=new URLSearchParams({provider_name:t}),n=await gt(`/api/webui/models/test-connection-by-name?${e}`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.detail||`测试连接失败 (${n.status})`)}return await n.json()}const Tae=kf("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"}}),ba=b.forwardRef(({className:t,variant:e,...n},r)=>o.jsx("div",{ref:r,role:"alert",className:xe(Tae({variant:e}),t),...n}));ba.displayName="Alert";const Eae=b.forwardRef(({className:t,...e},n)=>o.jsx("h5",{ref:n,className:xe("mb-1 font-medium leading-none tracking-tight",t),...e}));Eae.displayName="AlertTitle";const wa=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:xe("text-sm [&_p]:leading-relaxed",t),...e}));wa.displayName="AlertDescription";function r6({onRestartComplete:t,onRestartFailed:e}){const[n,r]=b.useState(0),[s,i]=b.useState("restarting"),[a,l]=b.useState(0),[c,d]=b.useState(0);b.useEffect(()=>{const g=setInterval(()=>{r(w=>w>=90?w:w+1)},200),x=setInterval(()=>{l(w=>w+1)},1e3),y=setTimeout(()=>{i("checking"),h()},3e3);return()=>{clearInterval(g),clearInterval(x),clearTimeout(y)}},[]);const h=()=>{const x=async()=>{try{if(d(w=>w+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{c<60?setTimeout(x,2e3):(i("failed"),e?.())}};x()},m=g=>{const x=Math.floor(g/60),y=g%60;return`${x}:${y.toString().padStart(2,"0")}`};return o.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:o.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[o.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&o.jsxs(o.Fragment,{children:[o.jsx(Us,{className:"h-16 w-16 text-primary animate-spin"}),o.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&o.jsxs(o.Fragment,{children:[o.jsx(Us,{className:"h-16 w-16 text-primary animate-spin"}),o.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),o.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",c,"/60)"]})]}),s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(Ya,{className:"h-16 w-16 text-green-500"}),o.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&o.jsxs(o.Fragment,{children:[o.jsx(Lo,{className:"h-16 w-16 text-destructive"}),o.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(Qp,{value:n,className:"h-2"}),o.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[o.jsxs("span",{children:[n,"%"]}),o.jsxs("span",{children:["已用时: ",m(a)]})]})]}),o.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),o.jsx("div",{className:"bg-yellow-500/10 border border-yellow-500/50 rounded-lg p-4",children:o.jsxs("p",{className:"text-sm text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"⚠️ 重要提示:"})," 由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})}),s==="failed"&&o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),o.jsx("button",{onClick:()=>{i("checking"),d(0),h()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let wk=[],cF=[];(()=>{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=cF[r])e=r+1;else return!0;if(e==n)return!1}}function fE(t){return t>=127462&&t<=127487}const mE=8205;function Aae(t,e,n=!0,r=!0){return(n?uF:Mae)(t,e,r)}function uF(t,e,n){if(e==t.length)return e;e&&dF(t.charCodeAt(e))&&hF(t.charCodeAt(e-1))&&e--;let r=z4(t,e);for(e+=pE(r);e=0&&fE(z4(t,a));)i++,a-=2;if(i%2==0)break;e+=2}else break}return e}function Mae(t,e,n){for(;e>0;){let r=uF(t,e-2,n);if(r=56320&&t<57344}function hF(t){return t>=55296&&t<56320}function pE(t){return t<65536?1:2}class An{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Zh(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),uv.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]=Zh(this,e,n);let r=[];return this.decompose(e,n,r,0),uv.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 k0(this),i=new k0(e);for(let a=n,l=n;;){if(s.next(a),i.next(a),a=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(l+=s.value.length,s.done||l>=r)return!0}}iter(e=1){return new k0(this,e)}iterRange(e,n=this.length){return new fF(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 mF(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?An.empty:e.length<=32?new Ur(e):uv.from(Ur.split(e,[]))}}class Ur extends An{constructor(e,n=Rae(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.text[i],l=s+a.length;if((n?r:l)>=e)return new Dae(s,l,r,a);s=l+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new Ur(gE(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let a=r.pop(),l=dv(i.text,a.text.slice(),0,i.length);if(l.length<=32)r.push(new Ur(l,a.length+i.length));else{let c=l.length>>1;r.push(new Ur(l.slice(0,c)),new Ur(l.slice(c)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof Ur))return super.replace(e,n,r);[e,n]=Zh(this,e,n);let s=dv(this.text,dv(r.text,gE(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new Ur(s,i):uv.from(Ur.split(s,[]),i)}sliceString(e,n=this.length,r=` +`){[e,n]=Zh(this,e,n);let s="";for(let i=0,a=0;i<=n&&ae&&a&&(s+=r),ei&&(s+=l.slice(Math.max(0,e-i),n-i)),i=c+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new Ur(r,s)),r=[],s=-1);return s>-1&&n.push(new Ur(r,s)),n}}let uv=class bh extends An{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.children[i],l=s+a.length,c=r+a.lines-1;if((n?c:l)>=e)return a.lineInner(e,n,r,s);s=l+1,r=c+1}}decompose(e,n,r,s){for(let i=0,a=0;a<=n&&i=a){let d=s&((a<=e?1:0)|(c>=n?2:0));a>=e&&c<=n&&!d?r.push(l):l.decompose(e-a,n-a,r,d)}a=c+1}}replace(e,n,r){if([e,n]=Zh(this,e,n),r.lines=i&&n<=l){let c=a.replace(e-i,n-i,r),d=this.lines-a.lines+c.lines;if(c.lines>4&&c.lines>d>>6){let h=this.children.slice();return h[s]=c,new bh(h,this.length-(n-e)+r.length)}return super.replace(i,l,c)}i=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` +`){[e,n]=Zh(this,e,n);let s="";for(let i=0,a=0;ie&&i&&(s+=r),ea&&(s+=l.sliceString(e-a,n-a,r)),a=c+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof bh))return 0;let r=0,[s,i,a,l]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==a||i==l)return r;let c=this.children[s],d=e.children[i];if(c!=d)return r+c.scanIdentical(d,n);r+=c.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let x of e)r+=x.lines;if(r<32){let x=[];for(let y of e)y.flatten(x);return new Ur(x,n)}let s=Math.max(32,r>>5),i=s<<1,a=s>>1,l=[],c=0,d=-1,h=[];function m(x){let y;if(x.lines>i&&x instanceof bh)for(let w of x.children)m(w);else x.lines>a&&(c>a||!c)?(g(),l.push(x)):x instanceof Ur&&c&&(y=h[h.length-1])instanceof Ur&&x.lines+y.lines<=32?(c+=x.lines,d+=x.length+1,h[h.length-1]=new Ur(y.text.concat(x.text),y.length+1+x.length)):(c+x.lines>s&&g(),c+=x.lines,d+=x.length+1,h.push(x))}function g(){c!=0&&(l.push(h.length==1?h[0]:bh.from(h,d)),d=-1,c=h.length=0)}for(let x of e)m(x);return g(),l.length==1?l[0]:new bh(l,n)}};An.empty=new Ur([""],0);function Rae(t){let e=-1;for(let n of t)e+=n.length+1;return e}function dv(t,e,n=0,r=1e9){for(let s=0,i=0,a=!0;i=n&&(c>r&&(l=l.slice(0,r-s)),s0?1:(e instanceof Ur?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],a=i>>1,l=s instanceof Ur?s.text.length:s.children.length;if(a==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof Ur){let c=s.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,c.length>Math.max(0,e))return this.value=e==0?c:n>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=s.children[a+(n<0?-1:0)];e>c.length?(e-=c.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof Ur?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class fF{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new k0(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 mF{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(An.prototype[Symbol.iterator]=function(){return this.iter()},k0.prototype[Symbol.iterator]=fF.prototype[Symbol.iterator]=mF.prototype[Symbol.iterator]=function(){return this});class Dae{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 Zh(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Ps(t,e,n=!0,r=!0){return Aae(t,e,n,r)}function Pae(t){return t>=56320&&t<57344}function zae(t){return t>=55296&&t<56320}function vi(t,e){let n=t.charCodeAt(e);if(!zae(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Pae(r)?(n-55296<<10)+(r-56320)+65536:n}function s6(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function ko(t){return t<65536?1:2}const Sk=/\r\n?|\n/;var Ds=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Ds||(Ds={}));class Io{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=l}else{if(r!=Ds.Simple&&d>=e&&(r==Ds.TrackDel&&se||r==Ds.TrackBefore&&se))return null;if(d>e||d==e&&n<0&&!l)return e==s||n<0?i:i+c;i+=c}s=d}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&&l>=e)return sn?"cover":!0;s=l}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 Io(e)}static create(e){return new Io(e)}}class us extends Io{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 kk(this,(n,r,s,i,a)=>e=e.replace(s,s+(r-n),a),!1),e}mapDesc(e,n=!1){return Ok(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=l,n[s+1]=a;let c=s>>1;for(;r.length0&&$c(r,n,i.text),i.forward(h),l+=h}let d=e[a++];for(;l>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],a=0,l=null;function c(h=!1){if(!h&&!s.length)return;ag||m<0||g>n)throw new RangeError(`Invalid change range ${m} to ${g} (in doc of length ${n})`);let y=x?typeof x=="string"?An.of(x.split(r||Sk)):x:An.empty,w=y.length;if(m==g&&w==0)return;ma&&qs(s,m-a,-1),qs(s,g-m,w),$c(i,s,y),a=g}}return d(e),c(!l),l}static empty(e){return new us(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;sl&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function $c(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||a==t.sections.length||t.sections[a+1]<0);)l=t.sections[a++],c=t.sections[a++];e(s,d,i,h,m),s=d,i=h}}}function Ok(t,e,n,r=!1){let s=[],i=r?[]:null,a=new H0(t),l=new H0(e);for(let c=-1;;){if(a.done&&l.len||l.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&l.ins==-1){let d=Math.min(a.len,l.len);qs(s,d,-1),a.forward(d),l.forward(d)}else if(l.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(l.len=0&&c=0){let d=0,h=a.len;for(;h;)if(l.ins==-1){let m=Math.min(h,l.len);d+=m,h-=m,l.forward(m)}else if(l.ins==0&&l.lenc||a.ins>=0&&a.len>c)&&(l||r.length>d),i.forward2(c),a.forward(c)}}}}class H0{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?An.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?An.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Uu{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 Uu(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Me.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Me.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Me.range(e.anchor,e.head)}static create(e,n,r){return new Uu(e,n,r)}}class Me{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Me.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Me(e.ranges.map(n=>Uu.fromJSON(n)),e.main)}static single(e,n=e){return new Me([Me.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Me.range(c,l):Me.range(l,c))}}return new Me(e,n)}}function gF(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let i6=0;class st{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=i6++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new st(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:a6),!!e.static,e.enables)}of(e){return new hv([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new hv(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new hv(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function a6(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class hv{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=i6++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,a=e[i]>>1,l=this.type==2,c=!1,d=!1,h=[];for(let m of this.dependencies)m=="doc"?c=!0:m=="selection"?d=!0:(((n=e[m.id])!==null&&n!==void 0?n:1)&1)==0&&h.push(e[m.id]);return{create(m){return m.values[a]=r(m),1},update(m,g){if(c&&g.docChanged||d&&(g.docChanged||g.selection)||jk(m,h)){let x=r(m);if(l?!xE(x,m.values[a],s):!s(x,m.values[a]))return m.values[a]=x,1}return 0},reconfigure:(m,g)=>{let x,y=g.config.address[i];if(y!=null){let w=Gv(g,y);if(this.dependencies.every(S=>S instanceof st?g.facet(S)===m.facet(S):S instanceof Os?g.field(S,!1)==m.field(S,!1):!0)||(l?xE(x=r(m),w,s):s(x=r(m),w)))return m.values[a]=w,0}else x=r(m);return m.values[a]=x,1}}}}function xE(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[c.id]),s=n.map(c=>c.type),i=r.filter(c=>!(c&1)),a=t[e.id]>>1;function l(c){let d=[];for(let h=0;hr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(r1).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],a=this.updateF(i,s);return this.compareF(i,a)?0:(r.values[n]=a,1)},reconfigure:(r,s)=>{let i=r.facet(r1),a=s.facet(r1),l;return(l=i.find(c=>c.field==this))&&l!=a.find(c=>c.field==this)?(r.values[n]=l.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,r1.of({field:this,create:e})]}get extension(){return this}}const Hu={lowest:4,low:3,default:2,high:1,highest:0};function Fm(t){return e=>new xF(e,t)}const uu={highest:Fm(Hu.highest),high:Fm(Hu.high),default:Fm(Hu.default),low:Fm(Hu.low),lowest:Fm(Hu.lowest)};class xF{constructor(e,n){this.inner=e,this.prec=n}}class hb{of(e){return new Nk(this,e)}reconfigure(e){return hb.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Nk{constructor(e,n){this.compartment=e,this.inner=n}}class Wv{constructor(e,n,r,s,i,a){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),a=new Map;for(let g of Lae(e,n,a))g instanceof Os?s.push(g):(i[g.facet.id]||(i[g.facet.id]=[])).push(g);let l=Object.create(null),c=[],d=[];for(let g of s)l[g.id]=d.length<<1,d.push(x=>g.slot(x));let h=r?.config.facets;for(let g in i){let x=i[g],y=x[0].facet,w=h&&h[g]||[];if(x.every(S=>S.type==0))if(l[y.id]=c.length<<1|1,a6(w,x))c.push(r.facet(y));else{let S=y.combine(x.map(k=>k.value));c.push(r&&y.compare(S,r.facet(y))?r.facet(y):S)}else{for(let S of x)S.type==0?(l[S.id]=c.length<<1|1,c.push(S.value)):(l[S.id]=d.length<<1,d.push(k=>S.dynamicSlot(k)));l[y.id]=d.length<<1,d.push(S=>Iae(S,y,x))}}let m=d.map(g=>g(l));return new Wv(e,a,m,l,c,i)}}function Lae(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(a,l){let c=s.get(a);if(c!=null){if(c<=l)return;let d=r[c].indexOf(a);d>-1&&r[c].splice(d,1),a instanceof Nk&&n.delete(a.compartment)}if(s.set(a,l),Array.isArray(a))for(let d of a)i(d,l);else if(a instanceof Nk){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;n.set(a.compartment,d),i(d,l)}else if(a instanceof xF)i(a.inner,a.prec);else if(a instanceof Os)r[l].push(a),a.provides&&i(a.provides,l);else if(a instanceof hv)r[l].push(a),a.facet.extensions&&i(a.facet.extensions,Hu.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(d,l)}}return i(t,Hu.default),r.reduce((a,l)=>a.concat(l))}function O0(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 Gv(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const vF=st.define(),Ck=st.define({combine:t=>t.some(e=>e),static:!0}),yF=st.define({combine:t=>t.length?t[0]:void 0,static:!0}),bF=st.define(),wF=st.define(),SF=st.define(),kF=st.define({combine:t=>t.length?t[0]:!1});class Qo{constructor(e,n){this.type=e,this.value=n}static define(){return new Bae}}class Bae{of(e){return new Qo(this,e)}}class Fae{constructor(e){this.map=e}of(e){return new Qt(this,e)}}class Qt{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 Qt(this.type,n)}is(e){return this.type==e}static define(e={}){return new Fae(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}}Qt.reconfigure=Qt.define();Qt.appendConfig=Qt.define();class ss{constructor(e,n,r,s,i,a){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=a,this._doc=null,this._state=null,r&&gF(r,n.newLength),i.some(l=>l.type==ss.time)||(this.annotations=i.concat(ss.time.of(Date.now())))}static create(e,n,r,s,i,a){return new ss(e,n,r,s,i,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(ss.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}ss.time=Qo.define();ss.userEvent=Qo.define();ss.addToHistory=Qo.define();ss.remote=Qo.define();function qae(t,e){let n=[];for(let r=0,s=0;;){let i,a;if(r=t[r]))i=t[r++],a=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof ss?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof ss?t=i[0]:t=jF(e,Ph(i),!1)}return t}function Hae(t){let e=t.startState,n=e.facet(SF),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=OF(r,Tk(e,i,t.changes.newLength),!0))}return r==t?t:ss.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const Qae=[];function Ph(t){return t==null?Qae:Array.isArray(t)?t:[t]}var Tr=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Tr||(Tr={}));const Vae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Ek;try{Ek=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Uae(t){if(Ek)return Ek.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||Vae.test(n)))return!0}return!1}function Wae(t){return e=>{if(!/\S/.test(e))return Tr.Space;if(Uae(e))return Tr.Word;for(let n=0;n-1)return Tr.Word;return Tr.Other}}class Nn{constructor(e,n,r,s,i,a){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let l=0;ls.set(d,c)),n=null),s.set(l.value.compartment,l.value.extension)):l.is(Qt.reconfigure)?(n=null,r=l.value):l.is(Qt.appendConfig)&&(n=null,r=Ph(r).concat(l.value));let i;n?i=e.startState.values.slice():(n=Wv.resolve(r,s,this),i=new Nn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,d)=>d.reconfigure(c,this),null).values);let a=e.startState.facet(Ck)?e.newSelection:e.newSelection.asSingle();new Nn(n,e.newDoc,a,i,(l,c)=>c.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Me.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],a=Ph(r.effects);for(let l=1;la.spec.fromJSON(l,c)))}}return Nn.create({doc:e.doc,selection:Me.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=Wv.resolve(e.extensions||[],new Map),r=e.doc instanceof An?e.doc:An.of((e.doc||"").split(n.staticFacet(Nn.lineSeparator)||Sk)),s=e.selection?e.selection instanceof Me?e.selection:Me.single(e.selection.anchor,e.selection.head):Me.single(0);return gF(s,r.length),n.staticFacet(Ck)||(s=s.asSingle()),new Nn(n,r,s,n.dynamicSlots.map(()=>null),(i,a)=>a.create(i),null)}get tabSize(){return this.facet(Nn.tabSize)}get lineBreak(){return this.facet(Nn.lineSeparator)||` +`}get readOnly(){return this.facet(kF)}phrase(e,...n){for(let r of this.facet(Nn.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(vF))for(let a of i(this,n,r))Object.prototype.hasOwnProperty.call(a,e)&&s.push(a[e]);return s}charCategorizer(e){return Wae(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-r,l=e-r;for(;a>0;){let c=Ps(n,a,!1);if(i(n.slice(c,a))!=Tr.Word)break;a=c}for(;lt.length?t[0]:4});Nn.lineSeparator=yF;Nn.readOnly=kF;Nn.phrases=st.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});Nn.languageData=vF;Nn.changeFilter=bF;Nn.transactionFilter=wF;Nn.transactionExtender=SF;hb.reconfigure=Qt.define();function Vo(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let a=s[i],l=r[i];if(l===void 0)r[i]=a;else if(!(l===a||a===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](l,a);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class od{eq(e){return this==e}range(e,n=e){return _k.create(e,n,this)}}od.prototype.startSide=od.prototype.endSide=0;od.prototype.point=!1;od.prototype.mapMode=Ds.TrackDel;let _k=class NF{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new NF(e,n,r)}};function Ak(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class o6{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let a=s,l=i.length;;){if(a==l)return a;let c=a+l>>1,d=i[c]-e||(r?this.value[c].endSide:this.value[c].startSide)-n;if(c==a)return d>=0?a:l;d>=0?l=c:a=c+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,i);ix||g==x&&d.startSide>0&&d.endSide<=0)continue;(x-g||d.endSide-d.startSide)<0||(a<0&&(a=g),d.point&&(l=Math.max(l,x-g)),r.push(d),s.push(g-a),i.push(x-a))}return{mapped:r.length?new o6(s,i,r,l):null,pos:a}}}class Bn{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new Bn(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,a=e.filter;if(n.length==0&&!a)return this;if(r&&(n=n.slice().sort(Ak)),this.isEmpty)return n.length?Bn.of(n):this;let l=new CF(this,null,-1).goto(0),c=0,d=[],h=new Hl;for(;l.value||c=0){let m=n[c++];h.addInner(m.from,m.to,m.value)||d.push(m)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||il.to||i=i&&e<=i+a.length&&a.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Q0.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Q0.from(e).goto(n)}static compare(e,n,r,s,i=-1){let a=e.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),l=n.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),c=vE(a,l,r),d=new qm(a,c,i),h=new qm(l,c,i);r.iterGaps((m,g,x)=>yE(d,m,h,g,x,s)),r.empty&&r.length==0&&yE(d,0,h,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(h=>!h.isEmpty&&n.indexOf(h)<0),a=n.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let l=vE(i,a),c=new qm(i,l,0).goto(r),d=new qm(a,l,0).goto(r);for(;;){if(c.to!=d.to||!Mk(c.active,d.active)||c.point&&(!d.point||!c.point.eq(d.point)))return!1;if(c.to>s)return!0;c.next(),d.next()}}static spans(e,n,r,s,i=-1){let a=new qm(e,null,i).goto(n),l=n,c=a.openStart;for(;;){let d=Math.min(a.to,r);if(a.point){let h=a.activeForPoint(a.to),m=a.pointFroml&&(s.span(l,d,a.active,c),c=a.openEnd(d));if(a.to>r)return c+(a.point&&a.to>r?1:0);l=a.to,a.next()}}static of(e,n=!1){let r=new Hl;for(let s of e instanceof _k?[e]:n?Gae(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return Bn.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=Bn.empty;s=s.nextLayer)n=new Bn(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}Bn.empty=new Bn([],[],null,-1);function Gae(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(Ak);e=r}return t}Bn.empty.nextLayer=Bn.empty;class Hl{finishChunk(e){this.chunks.push(new o6(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new Hl)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Bn.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Bn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function vE(t,e,n){let r=new Map;for(let i of t)for(let a=0;a=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&s.push(new CF(a,n,r,i));return s.length==1?s[0]:new Q0(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)I4(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)I4(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),I4(this.heap,0)}}}function I4(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class qm{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Q0.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){s1(this.active,e),s1(this.activeTo,e),s1(this.activeRank,e),this.minActive=bE(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n0;)n++;i1(this.active,n,r),i1(this.activeTo,n,s),i1(this.activeRank,n,i),e&&i1(e,n,this.cursor.from),this.minActive=bE(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&s1(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[s]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function yE(t,e,n,r,s,i){t.goto(e),n.goto(r);let a=r+s,l=r,c=r-e;for(;;){let d=t.to+c-n.to,h=d||t.endSide-n.endSide,m=h<0?t.to+c:n.to,g=Math.min(m,a);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&Mk(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(l,g,t.point,n.point):g>l&&!Mk(t.active,n.active)&&i.compareRange(l,g,t.active,n.active),m>a)break;(d||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(m),l=m,h<=0&&t.next(),h>=0&&n.next()}}function Mk(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function bE(t,e){let n=-1,r=1e9;for(let s=0;s=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=Ps(t,s)}return r===!0?-1:t.length}const Dk="ͼ",wE=typeof Symbol>"u"?"__"+Dk:Symbol.for(Dk),Pk=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),SE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Yc{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function i(a,l,c,d){let h=[],m=/^@(\w+)\b/.exec(a[0]),g=m&&m[1]=="keyframes";if(m&&l==null)return c.push(a[0]+";");for(let x in l){let y=l[x];if(/&/.test(x))i(x.split(/,\s*/).map(w=>a.map(S=>w.replace(/&/,S))).reduce((w,S)=>w.concat(S)),y,c);else if(y&&typeof y=="object"){if(!m)throw new RangeError("The value of a property ("+x+") should be a primitive value.");i(s(x),y,h,g)}else y!=null&&h.push(x.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+y+";")}(h.length||g)&&c.push((r&&!m&&!d?a.map(r):a).join(", ")+" {"+h.join(" ")+"}")}for(let a in e)i(s(a),e[a],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=SE[wE]||1;return SE[wE]=e+1,Dk+e.toString(36)}static mount(e,n,r){let s=e[Pk],i=r&&r.nonce;s?i&&s.setNonce(i):s=new Xae(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let kE=new Map;class Xae{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=kE.get(r);if(i)return e[Pk]=i;this.sheet=new s.CSSStyleSheet,kE.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[Pk]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let a=0;a-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,l),r)for(let d=0;d",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Yae=typeof navigator<"u"&&/Mac/.test(navigator.platform),Kae=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ms=0;Ms<10;Ms++)Kc[48+Ms]=Kc[96+Ms]=String(Ms);for(var Ms=1;Ms<=24;Ms++)Kc[Ms+111]="F"+Ms;for(var Ms=65;Ms<=90;Ms++)Kc[Ms]=String.fromCharCode(Ms+32),V0[Ms]=String.fromCharCode(Ms);for(var L4 in Kc)V0.hasOwnProperty(L4)||(V0[L4]=Kc[L4]);function Zae(t){var e=Yae&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Kae&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?V0:Kc)[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 lr(){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 et={mac:jE||/Mac/.test(Js.platform),windows:/Win/.test(Js.platform),linux:/Linux|X11/.test(Js.platform),ie:fb,ie_version:EF?zk.documentMode||6:Lk?+Lk[1]:Ik?+Ik[1]:0,gecko:OE,gecko_version:OE?+(/Firefox\/(\d+)/.exec(Js.userAgent)||[0,0])[1]:0,chrome:!!B4,chrome_version:B4?+B4[1]:0,ios:jE,android:/Android\b/.test(Js.userAgent),webkit_version:Jae?+(/\bAppleWebKit\/(\d+)/.exec(Js.userAgent)||[0,0])[1]:0,safari:Bk,safari_version:Bk?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Js.userAgent)||[0,0])[1]:0,tabSize:zk.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function U0(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Fk(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function fv(t,e){if(!e.anchorNode)return!1;try{return Fk(t,e.anchorNode)}catch{return!1}}function Jh(t){return t.nodeType==3?cd(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function j0(t,e,n,r){return n?NE(t,e,n,r,-1)||NE(t,e,n,r,1):!1}function ld(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Xv(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function NE(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:qo(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=ld(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?qo(t):0}else return!1}}function qo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Up(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function eoe(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 _F(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 toe(t,e,n,r,s,i,a,l){let c=t.ownerDocument,d=c.defaultView||window;for(let h=t,m=!1;h&&!m;)if(h.nodeType==1){let g,x=h==c.body,y=1,w=1;if(x)g=eoe(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(m=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let j=h.getBoundingClientRect();({scaleX:y,scaleY:w}=_F(h,j)),g={left:j.left,right:j.left+h.clientWidth*y,top:j.top,bottom:j.top+h.clientHeight*w}}let S=0,k=0;if(s=="nearest")e.top0&&e.bottom>g.bottom+k&&(k=e.bottom-g.bottom+a)):e.bottom>g.bottom&&(k=e.bottom-g.bottom+a,n<0&&e.top-k0&&e.right>g.right+S&&(S=e.right-g.right+i)):e.right>g.right&&(S=e.right-g.right+i,n<0&&e.leftg.bottom||e.leftg.right)&&(e={left:Math.max(e.left,g.left),right:Math.min(e.right,g.right),top:Math.max(e.top,g.top),bottom:Math.min(e.bottom,g.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function noe(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 roe{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?qo(n):0),r,Math.min(e.focusOffset,r?qo(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let Fu=null;et.safari&&et.safari_version>=26&&(Fu=!1);function AF(t){if(t.setActive)return t.setActive();if(Fu)return t.focus(Fu);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Fu==null?{get preventScroll(){return Fu={preventScroll:!0},!0}}:void 0),!Fu){Fu=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function DF(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=qo(n)}else if(n.parentNode&&!Xv(n))r=ld(n),n=n.parentNode;else return null}}function PF(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return m.domBoundsAround(e,n,d);if(g>=e&&s==-1&&(s=c,i=d),d>n&&m.dom.parentNode==this.dom){a=c,l=h;break}h=g,d=g+m.breakAfter}return{from:i,to:l<0?r+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a=0?this.children[a].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=l6){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 IF(t,e,n,r,s,i,a,l,c){let{children:d}=t,h=d.length?d[e]:null,m=i.length?i[i.length-1]:null,g=m?m.breakAfter:a;if(!(e==r&&h&&!a&&!g&&i.length<2&&h.merge(n,s,i.length?m:null,n==0,l,c))){if(r0&&(!a&&i.length&&h.merge(n,h.length,i[0],!1,l,0)?h.breakAfter=i.shift().breakAfter:(naoe||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 Za(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new Hs(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return ooe(this.dom,e,n)}}class Ql extends sr{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(MF(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,a){return r&&(!(r instanceof Ql&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=c,i++}let a=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new Ql(this.mark,n,a)}domAtPos(e){return BF(this,e)}coordsAt(e,n){return qF(this,e,n)}}function ooe(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,a=0;e==0&&n<0||e==r&&n>=0?et.chrome||et.gecko||(e?(s--,a=1):i=0)?0:l.length-1];return et.safari&&!a&&c.width==0&&(c=Array.prototype.find.call(l,d=>d.width)||c),a?Up(c,a<0):c||null}class Dl extends sr{static create(e,n,r){return new Dl(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=Dl.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,s,i,a){return r&&(!(r instanceof Dl)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?Hs.before(this.dom):Hs.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let a=this.side?this.side<0:e>0;for(let l=a?s.length-1:0;i=s[l],!(e>0?l==0:l==s.length-1||i.top0?Hs.before(this.dom):Hs.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return An.empty}get isHidden(){return!0}}Za.prototype.children=Dl.prototype.children=ef.prototype.children=l6;function BF(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let a=r[i-1];if(a.dom.parentNode==n)return a.domAtPos(a.length)}for(let i=s;i0&&e instanceof Ql&&s.length&&(r=s[s.length-1])instanceof Ql&&r.mark.eq(e.mark)?FF(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function qF(t,e,n){let r=null,s=-1,i=null,a=-1;function l(d,h){for(let m=0,g=0;m=h&&(x.children.length?l(x,h-g):(!i||i.isHidden&&(n>0||coe(i,x)))&&(y>h||g==y&&x.getSide()>0)?(i=x,a=h-g):(g-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function $k(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 uoe(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new Zc(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:a}=$F(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(a?n?2e8:1:-6e8)+1}return new Zc(e,r,s,n,e.widget||null,!0)}static line(e){return new Gp(e)}static set(e,n=!1){return Bn.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ot.none=Bn.empty;class Wp extends Ot{constructor(e){let{start:n,end:r}=$F(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 Wp&&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))&&Yv(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)}}Wp.prototype.point=!1;class Gp extends Ot{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Gp&&this.spec.class==e.spec.class&&Yv(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)}}Gp.prototype.mapMode=Ds.TrackBefore;Gp.prototype.point=!0;class Zc extends Ot{constructor(e,n,r,s,i,a){super(n,r,i,e),this.block=s,this.isReplace=a,this.mapMode=s?n<=0?Ds.TrackBefore:Ds.TrackAfter:Ds.TrackDel}get type(){return this.startSide!=this.endSide?ri.WidgetRange:this.startSide<=0?ri.WidgetBefore:ri.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Zc&&doe(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)}}Zc.prototype.point=!0;function $F(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 doe(t,e){return t==e||!!(t&&e&&t.compare(e))}function mv(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 rs extends sr{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,a){if(r){if(!(r instanceof rs))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),LF(this,e,n,r?r.children.slice():[],i,a),!0}split(e){let n=new rs;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){Yv(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){FF(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=qk(n,this.attrs||{})),r&&(this.attrs=qk({class:r},this.attrs||{}))}domAtPos(e){return BF(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(MF(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&&($k(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&&sr.get(s)instanceof Ql;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=sr.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!et.ios||!this.children.some(i=>i instanceof Za))){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 Za)||/[^ -~]/.test(r.text))return null;let s=Jh(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=qF(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 rs)return i;if(a>n)break}s=a+i.breakAfter}return null}}class Bl extends sr{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,a){return r&&(!(r instanceof Bl)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class Hk extends Uo{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class N0{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 Bl&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new rs),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(a1(new ef(-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 Bl)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:a,lineBreak:l,done:c}=this.cursor.next(this.skip);if(this.skip=0,c)throw new Error("Ran out of text content when drawing inline views");if(l){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=a,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(a1(new Za(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,a){if(this.disallowBlockEffectsFor[a]&&r instanceof Zc){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=n-e;if(r instanceof Zc)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Bl(r.widget||tf.block,l,r));else{let c=Dl.create(r.widget||tf.inline,l,l?0:r.startSide),d=this.atCursorPos&&!c.isEditable&&i<=s.length&&(e0),h=!c.isEditable&&(es.length||r.startSide<=0),m=this.getLine();this.pendingBuffer==2&&!d&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),d&&(m.append(a1(new ef(1),s),i),i=s.length+Math.max(0,i-s.length)),m.append(a1(c,s),i),this.atCursorPos=h,this.pendingBuffer=h?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let a=new N0(e,n,r,i);return a.openEnd=Bn.spans(s,n,r,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function a1(t,e){for(let n of e)t=new Ql(n,[t],t.length);return t}class tf extends Uo{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}tf.inline=new tf("span");tf.block=new tf("div");var br=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(br||(br={}));const ud=br.LTR,c6=br.RTL;function HF(t){let e=[];for(let n=0;n=n){if(l.level==r)return a;(i<0||(s!=0?s<0?l.fromn:e[i].level>l.level))&&(i=a)}}if(i<0)throw new RangeError("Index out of range");return i}}function VF(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;w-=3)if(mo[w+1]==-x){let S=mo[w+2],k=S&2?s:S&4?S&1?i:s:0;k&&(cr[m]=cr[mo[w]]=k),l=w;break}}else{if(mo.length==189)break;mo[l++]=m,mo[l++]=g,mo[l++]=c}else if((y=cr[m])==2||y==1){let w=y==s;c=w?0:1;for(let S=l-3;S>=0;S-=3){let k=mo[S+2];if(k&2)break;if(w)mo[S+2]|=2;else{if(k&4)break;mo[S+2]|=4}}}}}function xoe(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let a=s?n[s-1].to:t,l=sc;)y==S&&(y=n[--w].from,S=w?n[w-1].to:t),cr[--y]=x;c=h}else i=d,c++}}}function Vk(t,e,n,r,s,i,a){let l=r%2?2:1;if(r%2==s%2)for(let c=e,d=0;cc&&a.push(new Hc(c,w.from,x));let S=w.direction==ud!=!(x%2);Uk(t,S?r+1:r,s,w.inner,w.from,w.to,a),c=w.to}y=w.to}else{if(y==n||(h?cr[y]!=l:cr[y]==l))break;y++}g?Vk(t,c,y,r+1,s,g,a):ce;){let h=!0,m=!1;if(!d||c>i[d-1].to){let w=cr[c-1];w!=l&&(h=!1,m=w==16)}let g=!h&&l==1?[]:null,x=h?r:r+1,y=c;e:for(;;)if(d&&y==i[d-1].to){if(m)break e;let w=i[--d];if(!h)for(let S=w.from,k=d;;){if(S==e)break e;if(k&&i[k-1].to==S)S=i[--k].from;else{if(cr[S-1]==l)break e;break}}if(g)g.push(w);else{w.tocr.length;)cr[cr.length]=256;let r=[],s=e==ud?0:1;return Uk(t,s,s,n,0,t.length,r),r}function UF(t){return[new Hc(0,t,0)]}let WF="";function yoe(t,e,n,r,s){var i;let a=r.head-t.from,l=Hc.find(e,a,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),c=e[l],d=c.side(s,n);if(a==d){let g=l+=s?1:-1;if(g<0||g>=e.length)return null;c=e[l=g],a=c.side(!s,n),d=c.side(s,n)}let h=Ps(t.text,a,c.forward(s,n));(hc.to)&&(h=d),WF=t.text.slice(Math.min(a,h),Math.max(a,h));let m=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return m&&h==d&&m.level+(s?0:1)t.some(e=>e)}),tq=st.define({combine:t=>t.some(e=>e)}),nq=st.define();class Ih{constructor(e,n="nearest",r="nearest",s=5,i=5,a=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=a}map(e){return e.empty?this:new Ih(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 Ih(Me.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const o1=Qt.define({map:(t,e)=>t.map(e)}),rq=Qt.define();function bi(t,e,n){let r=t.facet(KF);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 Ml=st.define({combine:t=>t.length?t[0]:!0});let woe=0;const Th=st.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let c=[];return a&&c.push(W0.of(d=>{let h=d.plugin(l);return h?a(h):Ot.none})),i&&c.push(i(l)),c})}static fromClass(e,n){return Yr.define((r,s)=>new e(r,s),n)}}class F4{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(bi(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){bi(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){bi(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const sq=st.define(),h6=st.define(),W0=st.define(),iq=st.define(),Xp=st.define(),aq=st.define();function _E(t,e){let n=t.state.facet(aq);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return Bn.spans(r,e.from,e.to,{point(){},span(i,a,l,c){let d=i-e.from,h=a-e.from,m=s;for(let g=l.length-1;g>=0;g--,c--){let x=l[g].spec.bidiIsolate,y;if(x==null&&(x=boe(e.text,d,h)),c>0&&m.length&&(y=m[m.length-1]).to==d&&y.direction==x)y.to=h,m=y.inner;else{let w={from:d,to:h,direction:x,inner:[]};m.push(w),m=w.inner}}}}),s}const oq=st.define();function f6(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(oq)){let a=i(t);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(n=Math.max(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(s=Math.max(s,a.bottom)))}return{left:e,right:n,top:r,bottom:s}}const l0=st.define();class Ta{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new Ta(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toAh)break;i+=2}if(!c)return r;new Ta(c.fromA,c.toA,c.fromB,c.toB).addToSet(r),a=c.toA,l=c.toB}}}class Kv{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=us.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,a,l,c)=>s.push(new Ta(i,a,l,c))),this.changedRanges=s}static create(e,n,r){return new Kv(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 AE extends sr{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Ot.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new rs],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ta(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:d,toA:h})=>hthis.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:!Toe(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?koe(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:d,to:h}=this.hasComposition;r=new Ta(d,h,e.changes.mapPos(d,-1),e.changes.mapPos(h,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(et.ie||et.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,l=this.updateDeco(),c=Noe(a,l,e.changes);return r=Ta.extendWithRanges(r,c),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=et.chrome||et.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||s.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[a]:null;if(!l)break;let{fromA:c,toA:d,fromB:h,toB:m}=l,g,x,y,w;if(r&&r.range.fromBh){let T=N0.build(this.view.state.doc,h,r.range.fromB,this.decorations,this.dynamicDecorationMap),E=N0.build(this.view.state.doc,r.range.toB,m,this.decorations,this.dynamicDecorationMap);x=T.breakAtStart,y=T.openStart,w=E.openEnd;let _=this.compositionView(r);E.breakAtStart?_.breakAfter=1:E.content.length&&_.merge(_.length,_.length,E.content[0],!1,E.openStart,0)&&(_.breakAfter=E.content[0].breakAfter,E.content.shift()),T.content.length&&_.merge(0,0,T.content[T.content.length-1],!0,0,T.openEnd)&&T.content.pop(),g=T.content.concat(_).concat(E.content)}else({content:g,breakAtStart:x,openStart:y,openEnd:w}=N0.build(this.view.state.doc,h,m,this.decorations,this.dynamicDecorationMap));let{i:S,off:k}=i.findPos(d,1),{i:j,off:N}=i.findPos(c,-1);IF(this,j,N,S,k,g,x,y,w)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(rq)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new Za(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new Ql(s,[n],n.length);let r=new rs;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,a)=>{a.flags|=8|(a.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(a);let l=sr.get(i);l&&l!=a&&(l.dom=null),a.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(Ml)||this.dom.tabIndex>-1)&&fv(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(l.anchor)),d=l.empty?c:this.moveToLine(this.domAtPos(l.head));if(et.gecko&&l.empty&&!this.hasComposition&&Soe(c)){let m=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(m,c.node.childNodes[c.offset]||null)),c=d=new Hs(m,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!j0(c.node,c.offset,h.anchorNode,h.anchorOffset)||!j0(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{et.android&&et.chrome&&this.dom.contains(h.focusNode)&&Coe(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let m=U0(this.view.root);if(m)if(l.empty){if(et.gecko){let g=Ooe(c.node,c.offset);if(g&&g!=3){let x=(g==1?DF:PF)(c.node,c.offset);x&&(c=new Hs(x.node,x.offset))}}m.collapse(c.node,c.offset),l.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=l.bidiLevel)}else if(m.extend){m.collapse(c.node,c.offset);try{m.extend(d.node,d.offset)}catch{}}else{let g=document.createRange();l.anchor>l.head&&([c,d]=[d,c]),g.setEnd(d.node,d.offset),g.setStart(c.node,c.offset),m.removeAllRanges(),m.addRange(g)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,d)),this.impreciseAnchor=c.precise?null:new Hs(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Hs(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&j0(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=U0(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=rs.find(this,n.head);if(!a)return;let l=a.posAtStart;if(n.head==l||n.head==l+a.length)return;let c=this.coordsAt(n.head,-1),d=this.coordsAt(n.head,1);if(!c||!d||c.bottom>d.top)return;let h=this.domAtPos(n.head+n.assoc);r.collapse(h.node,h.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let m=e.observer.selectionRange;e.docView.posFromDOM(m.anchorNode,m.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=sr.get(n.childNodes[s]);i instanceof rs&&(r=i.domAtPos(i.length))}return r?new Hs(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=sr.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;a--){let l=this.children[a],c=i-l.breakAfter,d=c-l.length;if(ce||l.covers(1))&&(!r||l instanceof rs&&!(r instanceof rs&&n>=0)))r=l,s=d;else if(r&&d==e&&c==e&&l instanceof Bl&&Math.abs(n)<2){if(l.deco.startSide<0)break;a&&(r=null)}i=d}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 rs))return null;for(;s.children.length;){let{i:l,off:c}=s.childPos(r,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}r=c}if(!(s instanceof Za))return null;let i=Ps(s.text,r);if(i==r)return null;let a=cd(s.dom,r,i).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,c=this.view.textDirection==br.LTR;for(let d=0,h=0;hs)break;if(d>=r){let x=m.dom.getBoundingClientRect();if(n.push(x.height),a){let y=m.dom.lastChild,w=y?Jh(y):[];if(w.length){let S=w[w.length-1],k=c?S.right-x.left:x.right-S.left;k>l&&(l=k,this.minWidth=i,this.minWidthFrom=d,this.minWidthTo=g)}}}d=g+m.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?br.RTL:br.LTR}measureTextSize(){for(let i of this.children)if(i instanceof rs){let a=i.measureTextSize();if(a)return a}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=Jh(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 zF(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],a=i?i.from-1:this.length;if(a>r){let l=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(Ot.replace({widget:new Hk(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!i)break;r=i.to+1}return Ot.set(e)}updateDeco(){let e=1,n=this.view.state.facet(W0).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(iq).map((i,a)=>{let l=typeof i=="function";return l&&(r=!0),l?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(Bn.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=f6(this.view),a={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;toe(this.view.scrollDOM,a,n.heads instanceof Dl||s.children.some(r);return r(this.children[n])}}function Soe(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 lq(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=DF(n.focusNode,n.focusOffset),s=PF(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let l=sr.get(s.node);if(!l||l instanceof Za&&l.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let c=sr.get(r.node);!c||c instanceof Za&&c.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let a=e-i.offset;return{from:a,to:a+i.node.nodeValue.length,node:i.node}}function koe(t,e,n){let r=lq(t,n);if(!r)return null;let{node:s,from:i,to:a}=r,l=s.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(r.from,r.to)!=l)return null;let c=e.invertedDesc,d=new Ta(c.mapPos(i),c.mapPos(a),i,a),h=[];for(let m=s.parentNode;;m=m.parentNode){let g=sr.get(m);if(g instanceof Ql)h.push({node:m,deco:g.mark});else{if(g instanceof rs||m.nodeName=="DIV"&&m.parentNode==t.contentDOM)return{range:d,text:s,marks:h,line:m};if(m!=t.contentDOM)h.push({node:m,deco:new Wp({inclusive:!0,attributes:uoe(m),tagName:m.tagName.toLowerCase()})});else return null}}}function Ooe(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function Eoe(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Me.cursor(e);i==0?n=1:i==s.length&&(n=-1);let a=i,l=i;n<0?a=Ps(s.text,i,!1):l=Ps(s.text,i);let c=r(s.text.slice(a,l));for(;a>0;){let d=Ps(s.text,a,!1);if(r(s.text.slice(d,a))!=c)break;a=d}for(;lt?e.left-t:Math.max(0,t-e.right)}function Aoe(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function q4(t,e){return t.tope.top+1}function ME(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function Gk(t,e,n){let r,s,i,a,l=!1,c,d,h,m;for(let y=t.firstChild;y;y=y.nextSibling){let w=Jh(y);for(let S=0;SN||a==N&&i>j)&&(r=y,s=k,i=j,a=N,l=j?e0:Sk.bottom&&(!h||h.bottomk.top)&&(d=y,m=k):h&&q4(h,k)?h=RE(h,k.bottom):m&&q4(m,k)&&(m=ME(m,k.top))}}if(h&&h.bottom>=n?(r=c,s=h):m&&m.top<=n&&(r=d,s=m),!r)return{node:t,offset:0};let g=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return DE(r,g,n);if(l&&r.contentEditable!="false")return Gk(r,g,n);let x=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:x}}function DE(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,a=0;for(let l=0;ln?h.top-n:n-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&m=(h.left+h.right)/2,x=g;if(et.chrome||et.gecko){let y=cd(t,l).getBoundingClientRect();Math.abs(y.left-h.right)<.1&&(x=!g)}if(m<=0)return{node:t,offset:l+(x?1:0)};s=l+(x?1:0),i=m}}}return{node:t,offset:s>-1?s:a>0?t.nodeValue.length:0}}function cq(t,e,n,r=-1){var s,i;let a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,c,{docHeight:d}=t.viewState,{x:h,y:m}=e,g=m-l;if(g<0)return 0;if(g>d)return t.state.doc.length;for(let T=t.viewState.heightOracle.textHeight/2,E=!1;c=t.elementAtHeight(g),c.type!=ri.Text;)for(;g=r>0?c.bottom+T:c.top-T,!(g>=0&&g<=d);){if(E)return n?null:0;E=!0,r=-r}m=l+g;let x=c.from;if(xt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:PE(t,a,c,h,m);let y=t.dom.ownerDocument,w=t.root.elementFromPoint?t.root:y,S=w.elementFromPoint(h,m);S&&!t.contentDOM.contains(S)&&(S=null),S||(h=Math.max(a.left+1,Math.min(a.right-1,h)),S=w.elementFromPoint(h,m),S&&!t.contentDOM.contains(S)&&(S=null));let k,j=-1;if(S&&((s=t.docView.nearest(S))===null||s===void 0?void 0:s.isEditable)!=!1){if(y.caretPositionFromPoint){let T=y.caretPositionFromPoint(h,m);T&&({offsetNode:k,offset:j}=T)}else if(y.caretRangeFromPoint){let T=y.caretRangeFromPoint(h,m);T&&({startContainer:k,startOffset:j}=T)}k&&(!t.contentDOM.contains(k)||et.safari&&Moe(k,j,h)||et.chrome&&Roe(k,j,h))&&(k=void 0),k&&(j=Math.min(qo(k),j))}if(!k||!t.docView.dom.contains(k)){let T=rs.find(t.docView,x);if(!T)return g>c.top+c.height/2?c.to:c.from;({node:k,offset:j}=Gk(T.dom,h,m))}let N=t.docView.nearest(k);if(!N)return null;if(N.isWidget&&((i=N.dom)===null||i===void 0?void 0:i.nodeType)==1){let T=N.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,c=Math.floor((s-n.top-(t.defaultLineHeight-l)*.5)/l);i+=c*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(n.from,n.to);return n.from+Rk(a,i,t.state.tabSize)}function uq(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let a=s.parentNode;if(!a||a.nodeName=="DIV")break;s=a}}return cd(t,r-1,r).getBoundingClientRect().right>n}function Moe(t,e,n){return uq(t,e,n)}function Roe(t,e,n){if(e!=0)return uq(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():cd(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function Xk(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==ri.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function Doe(t,e,n,r){let s=Xk(t,e.head,e.assoc||-1),i=!r||s.type!=ri.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let a=t.dom.getBoundingClientRect(),l=t.textDirectionAt(s.from),c=t.posAtCoords({x:n==(l==br.LTR)?a.right-1:a.left+1,y:(i.top+i.bottom)/2});if(c!=null)return Me.cursor(c,n?-1:1)}return Me.cursor(n?s.to:s.from,n?-1:1)}function zE(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),a=t.textDirectionAt(s.from);for(let l=e,c=null;;){let d=yoe(s,i,a,l,n),h=WF;if(!d){if(s.number==(n?t.state.doc.lines:1))return l;h=` +`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),d=t.visualLineSide(s,!n)}if(c){if(!c(h))return l}else{if(!r)return d;c=r(h)}l=d}}function Poe(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let a=r(i);return s==Tr.Space&&(s=a),s==a}}function zoe(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Me.cursor(s,e.assoc);let a=e.goalColumn,l,c=t.contentDOM.getBoundingClientRect(),d=t.coordsAtPos(s,e.assoc||-1),h=t.documentTop;if(d)a==null&&(a=d.left-c.left),l=i<0?d.top:d.bottom;else{let x=t.viewState.lineBlockAt(s);a==null&&(a=Math.min(c.right-c.left,t.defaultCharacterWidth*(s-x.from))),l=(i<0?x.top:x.bottom)+h}let m=c.left+a,g=r??t.viewState.heightOracle.textHeight>>1;for(let x=0;;x+=10){let y=l+(g+x)*i,w=cq(t,{x:m,y},!1,i);if(yc.bottom||(i<0?ws)){let S=t.docView.coordsForChar(w),k=!S||y{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Me.cursor(r,ri)&&!Boe(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,l;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(l=s.exec(n))&&(i=l.index,a=l[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=a-1);r=i+a}}readNode(e){if(e.cmIgnore)return;let n=sr.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+(Loe(e,r.node,r.offset)?n:0))}}function Loe(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let l=i||a?[]:$oe(e),c=new Ioe(l,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Hoe(l,this.bounds.from)}else{let l=e.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!Fk(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),d=a&&a.node==l.anchorNode&&a.offset==l.anchorOffset||!Fk(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),h=e.viewport;if((et.ios||et.chrome)&&e.state.selection.main.empty&&c!=d&&(h.from>0||h.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Me.range(d,c)):this.newSel=Me.single(d,c)}}}function hq(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:l}=e.bounds,c=s.from,d=null;(i===8||et.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)}:et.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` + `&&t.lineWrapping&&(r&&(r=Me.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:An.of([" "])}),n)return m6(t,n,r,i);if(r&&!r.main.eq(s)){let a=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=dq(t.state.facet(Xp).map(c=>c(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function m6(t,e,n,r=-1){if(et.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(et.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&&zh(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&zh(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&zh(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,l=()=>a||(a=qoe(t,e,n));return t.state.facet(ZF).some(c=>c(t,e.from,e.to,i,l))||t.dispatch(l()),!0}function qoe(t,e,n){let r,s=t.state,i=s.selection.main,a=-1;if(e.from==e.to&&e.fromi.to){let c=e.fromm(t)),d,c);e.from==h&&(a=h)}if(a>-1)r={changes:e,selection:Me.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let c=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(c+e.insert.sliceString(0,void 0,t.state.lineBreak)+d))}else{let c=s.changes(e),d=n&&n.main.to<=c.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let h=t.state.sliceDoc(e.from,e.to),m,g=n&&lq(t,n.main.head);if(g){let y=e.insert.length-(e.to-e.from);m={from:g.from,to:g.to-y}}else m=t.state.doc.lineAt(i.head);let x=i.to-e.to;r=s.changeByRange(y=>{if(y.from==i.from&&y.to==i.to)return{changes:c,range:d||y.map(c)};let w=y.to-x,S=w-h.length;if(t.state.sliceDoc(S,w)!=h||w>=m.from&&S<=m.to)return{range:y};let k=s.changes({from:S,to:w,insert:e.insert}),j=y.to-i.to;return{changes:k,range:d?Me.range(Math.max(0,d.anchor+j),Math.max(0,d.head+j)):y.map(k)}})}else r={changes:c,selection:d&&s.selection.replaceRange(d)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:l,scrollIntoView:!0})}function fq(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&l>0&&t.charCodeAt(a-1)==e.charCodeAt(l-1);)a--,l--;if(r=="end"){let c=Math.max(0,i-Math.min(a,l));n-=a+c-i}if(a=a?i-n:0;i-=c,l=i+(l-a),a=i}else if(l=l?i-n:0;i-=c,a=i+(a-l),l=i}return{from:i,toA:a,toB:l}}function $oe(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 IE(n,r)),(s!=n||i!=r)&&e.push(new IE(s,i))),e}function Hoe(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Me.single(n+e,r+e):null}class Qoe{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,et.safari&&e.contentDOM.addEventListener("input",()=>null),et.gecko&&ale(e.contentDOM.ownerDocument)}handleEvent(e){!Zoe(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=Voe(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let a=!n[i].handlers.length,l=r[i];l&&a!=!l.handlers.length&&(s.removeEventListener(i,this.handleEvent),l=null),l||s.addEventListener(i,this.handleEvent,{passive:a})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&pq.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),et.android&&et.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return et.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=mq.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||Uoe.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:et.safari&&!et.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 LE(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){bi(n.state,s)}}}function Voe(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,a=s&&s.plugin.domEventObservers;if(i)for(let l in i){let c=i[l];c&&n(l).handlers.push(LE(r.value,c))}if(a)for(let l in a){let c=a[l];c&&n(l).observers.push(LE(r.value,c))}}for(let r in Ja)n(r).handlers.push(Ja[r]);for(let r in Aa)n(r).observers.push(Aa[r]);return e}const mq=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Uoe="dthko",pq=[16,17,18,20,91,92,224,225],l1=6;function c1(t){return Math.max(0,t)*.7+8}function Woe(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class Goe{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=noe(e.contentDOM),this.atoms=e.state.facet(Xp).map(a=>a(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Nn.allowMultipleSelections)&&Xoe(e,n),this.dragging=Koe(e,n)&&vq(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&&Woe(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=f6(this.view);e.clientX-c.left<=s+l1?n=-c1(s-e.clientX):e.clientX+c.right>=a-l1&&(n=c1(e.clientX-a)),e.clientY-c.top<=i+l1?r=-c1(i-e.clientY):e.clientY+c.bottom>=l-l1&&(r=c1(e.clientY-l)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=dq(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 Xoe(t,e){let n=t.state.facet(GF);return n.length?n[0](e):et.mac?e.metaKey:e.ctrlKey}function Yoe(t,e){let n=t.state.facet(XF);return n.length?n[0](e):et.mac?!e.altKey:!e.ctrlKey}function Koe(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=U0(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Zoe(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=sr.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ja=Object.create(null),Aa=Object.create(null),gq=et.ie&&et.ie_version<15||et.ios&&et.webkit_version<604;function Joe(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(),xq(t,n.value)},50)}function mb(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function xq(t,e){e=mb(t.state,u6,e);let{state:n}=t,r,s=1,i=n.toText(e),a=i.lines==n.selection.ranges.length;if(Yk!=null&&n.selection.ranges.every(c=>c.empty)&&Yk==i.toString()){let c=-1;r=n.changeByRange(d=>{let h=n.doc.lineAt(d.from);if(h.from==c)return{range:d};c=h.from;let m=n.toText((a?i.line(s++).text:e)+n.lineBreak);return{changes:{from:h.from,insert:m},range:Me.cursor(d.from+m.length)}})}else a?r=n.changeByRange(c=>{let d=i.line(s++);return{changes:{from:c.from,to:c.to,insert:d.text},range:Me.cursor(c.from+d.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Aa.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ja.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Aa.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Aa.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ja.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(YF))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=nle(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new Goe(t,e,n,r)),r&&t.observer.ignore(()=>{AF(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 BE(t,e,n,r){if(r==1)return Me.cursor(e,n);if(r==2)return Eoe(t.state,e,n);{let s=rs.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),a=s?s.posAtStart:i.from,l=s?s.posAtEnd:i.to;return le>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function ele(t,e,n,r){let s=rs.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let a=s.coordsAt(i,-1);if(a&&FE(n,r,a))return-1;let l=s.coordsAt(i,1);return l&&FE(n,r,l)?1:a&&a.bottom>=r?-1:1}function qE(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:ele(t,n,e.clientX,e.clientY)}}const tle=et.ie&&et.ie_version<=11;let $E=null,HE=0,QE=0;function vq(t){if(!tle)return t.detail;let e=$E,n=QE;return $E=t,QE=Date.now(),HE=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(HE+1)%3:1}function nle(t,e){let n=qE(t,e),r=vq(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,a,l){let c=qE(t,i),d,h=BE(t,c.pos,c.bias,r);if(n.pos!=c.pos&&!a){let m=BE(t,n.pos,n.bias,r),g=Math.min(m.from,h.from),x=Math.max(m.to,h.to);h=g1&&(d=rle(s,c.pos))?d:l?s.addRange(h):Me.create([h])}}}function rle(t,e){for(let n=0;n=e)return Me.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Ja.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,a=i+s.length;(i>=n.to||a<=n.from)&&(n=Me.range(i,a))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",mb(t.state,d6,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ja.dragend=t=>(t.inputState.draggedContent=null,!1);function VE(t,e,n,r){if(n=mb(t.state,u6,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,a=r&&i&&Yoe(t,e)?{from:i.from,to:i.to}:null,l={from:s,insert:n},c=t.state.changes(a?[a,l]:l);t.focus(),t.dispatch({changes:c,selection:{anchor:c.mapPos(s,-1),head:c.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ja.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&&VE(t,e,r.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[a]=l.result),i()},l.readAsText(n[a])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return VE(t,e,r,!0),!0}return!1};Ja.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=gq?null:e.clipboardData;return n?(xq(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Joe(t),!1)};function sle(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 ile(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let a=t.doc.lineAt(i);a.number>s&&(e.push(a.text),n.push({from:a.from,to:Math.min(t.doc.length,a.to+1)})),s=a.number}r=!0}return{text:mb(t,d6,e.join(t.lineBreak)),ranges:n,linewise:r}}let Yk=null;Ja.copy=Ja.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=ile(t.state);if(!n&&!s)return!1;Yk=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=gq?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(sle(t,n),!1)};const yq=Qo.define();function bq(t,e){let n=[];for(let r of t.facet(JF)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:yq.of(!0)}):null}function wq(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=bq(t.state,e);n?t.dispatch(n):t.update([])}},10)}Aa.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),wq(t)};Aa.blur=t=>{t.observer.clearSelectionRange(),wq(t)};Aa.compositionstart=Aa.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Aa.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,et.chrome&&et.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Aa.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ja.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),a=e.getTargetRanges();if(i&&a.length){let l=a[0],c=t.posAtDOM(l.startContainer,l.startOffset),d=t.posAtDOM(l.endContainer,l.endOffset);return m6(t,{from:c,to:d,insert:t.state.toText(i)},null),!0}}let s;if(et.chrome&&et.android&&(s=mq.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return et.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),et.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Aa.compositionend(t,e),20),!1};const UE=new Set;function ale(t){UE.has(t)||(UE.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const WE=["pre-wrap","normal","pre-line","break-spaces"];let nf=!1;function GE(){nf=!1}class ole{constructor(e){this.lineWrapping=e,this.doc=An.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return WE.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,c=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,c){this.heightSamples={};for(let d=0;d0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>pv&&(nf=!0),this.height=e)}replace(e,n,r){return si.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,a=r.doc;for(let l=s.length-1;l>=0;l--){let{fromA:c,toA:d,fromB:h,toB:m}=s[l],g=i.lineAt(c,yr.ByPosNoHeight,r.setDoc(n),0,0),x=g.to>=d?g:i.lineAt(d,yr.ByPosNoHeight,r,0,0);for(m+=x.to-d,d=x.to;l>0&&g.from<=s[l-1].toA;)c=s[l-1].fromA,h=s[l-1].fromB,l--,ci*2){let l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),r+=1+l.break,s-=l.size}else if(i>s*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,i-=l.size}else break;else if(s=i&&a(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Qi extends Sq{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new Oo(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof Qi||s instanceof As&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof As?s=new Qi(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):si.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 As extends si{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,a,l=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*i);a=c/i,this.length>i+1&&(l=(this.height-c)/(this.length-i-1))}else a=this.height/i;return{firstLine:r,lastLine:s,perLine:a,perChar:l}}blockAt(e,n,r,s){let{firstLine:i,lastLine:a,perLine:l,perChar:c}=this.heightMetrics(n,s);if(n.lineWrapping){let d=s+(e0){let i=r[r.length-1];i instanceof As?r[r.length-1]=new As(i.length+s):r.push(null,new As(s-1))}if(e>0){let i=r[0];i instanceof As?r[0]=new As(e+i.length):r.unshift(new As(e-1),null)}return si.of(r)}decomposeLeft(e,n){n.push(new As(e-1),null)}decomposeRight(e,n){n.push(null,new As(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let a=[],l=Math.max(n,s.from),c=-1;for(s.from>n&&a.push(new As(s.from-n-1).updateHeight(e,n));l<=i&&s.more;){let h=e.doc.lineAt(l).length;a.length&&a.push(null);let m=s.heights[s.index++];c==-1?c=m:Math.abs(m-c)>=pv&&(c=-2);let g=new Qi(h,m);g.outdated=!1,a.push(g),l+=h+1}l<=i&&a.push(null,new As(i-l).updateHeight(e,l));let d=si.of(a);return(c<0||Math.abs(d.height-this.height)>=pv||Math.abs(c-this.heightMetrics(e,n).perLine)>=pv)&&(nf=!0),Zv(this,d)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class cle extends si{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 el))return d;let h=n==yr.ByPosNoHeight?yr.ByPosNoHeight:yr.ByPos;return c?d.join(this.right.lineAt(l,h,r,a,l)):this.left.lineAt(l,h,r,s,i).join(d)}forEachLine(e,n,r,s,i,a){let l=s+this.left.height,c=i+this.left.length+this.break;if(this.break)e=c&&this.right.forEachLine(e,n,r,l,c,a);else{let d=this.lineAt(c,yr.ByPos,r,s,i);e=e&&d.from<=n&&a(d),n>d.to&&this.right.forEachLine(d.to+1,n,r,l,c,a)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let l of r)i.push(l);if(e>0&&XE(i,a-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?si.of(this.break?[e,null,n]:[e,n]):(this.left=Zv(this.left,e),this.right=Zv(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:a}=this,l=n+i.length+this.break,c=null;return s&&s.from<=n+i.length&&s.more?c=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=l+a.length&&s.more?c=a=a.updateHeight(e,l,r,s):a.updateHeight(e,l,r),c?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function XE(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof As&&(r=t[e+1])instanceof As&&t.splice(e-1,3,new As(n.length+1+r.length))}const ule=5;class p6{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 Qi?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Qi(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=ule)&&this.addLineDeco(s,i,a)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new Qi(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new As(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 Qi)return e;let n=new Qi(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 Qi)&&!this.isCovered?this.nodes.push(new Qi(0,-1)):(this.writtenToh.clientHeight||h.scrollWidth>h.clientWidth)&&m.overflow!="visible"){let g=h.getBoundingClientRect();i=Math.max(i,g.left),a=Math.min(a,g.right),l=Math.max(l,g.top),c=Math.min(d==t.parentNode?s.innerHeight:c,g.bottom)}d=m.position=="absolute"||m.position=="fixed"?h.offsetParent:h.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:i-n.left,right:Math.max(i,a)-n.left,top:l-(n.top+e),bottom:Math.max(l,c)-(n.top+e)}}function mle(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function ple(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class H4{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 ole(n),this.stateDeco=e.facet(W0).filter(r=>typeof r!="function"),this.heightMap=si.empty().applyChanges(this.stateDeco,An.empty,this.heightOracle.setDoc(e.doc),[new Ta(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ot.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:a})=>s>=i&&s<=a)){let{from:i,to:a}=this.lineBlockAt(s);e.push(new u1(i,a))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?KE:new g6(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(u0(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(W0).filter(h=>typeof h!="function");let s=e.changedRanges,i=Ta.extendWithRanges(s,dle(r,this.stateDeco,e?e.changes:us.empty(this.state.doc.length))),a=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);GE(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||nf)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let c=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let d=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(d||!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(tq)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?br.RTL:br.LTR;let a=this.heightOracle.mustRefreshForWrapping(i),l=n.getBoundingClientRect(),c=a||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let d=0,h=0;if(l.width&&l.height){let{scaleX:T,scaleY:E}=_F(n,l);(T>.005&&Math.abs(this.scaleX-T)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=T,this.scaleY=E,d|=16,a=c=!0)}let m=(parseInt(r.paddingTop)||0)*this.scaleY,g=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=m||this.paddingBottom!=g)&&(this.paddingTop=m,this.paddingBottom=g,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let x=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=x&&(this.scrollAnchorHeight=-1,this.scrollTop=x),this.scrolledToBottom=RF(e.scrollDOM);let y=(this.printing?ple:fle)(n,this.paddingTop),w=y.top-this.pixelViewport.top,S=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let k=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(k!=this.inView&&(this.inView=k,k&&(c=!0)),!this.inView&&!this.scrollTarget&&!mle(e.dom))return 0;let j=l.width;if((this.contentDOMWidth!=j||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),c){let T=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(a=!0),a||s.lineWrapping&&Math.abs(j-this.contentDOMWidth)>s.charWidth){let{lineHeight:E,charWidth:_,textHeight:A}=e.docView.measureTextSize();a=E>0&&s.refresh(i,E,_,A,Math.max(5,j/_),T),a&&(e.docView.minWidth=0,d|=16)}w>0&&S>0?h=Math.max(w,S):w<0&&S<0&&(h=Math.min(w,S)),GE();for(let E of this.viewports){let _=E.from==this.viewport.from?T:e.docView.measureVisibleLineHeights(E);this.heightMap=(a?si.empty().applyChanges(this.stateDeco,An.empty,this.heightOracle,[new Ta(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new lle(E.from,_))}nf&&(d|=2)}let N=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return N&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),d|=this.updateForViewport()),(d&2||N)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:l}=this,c=new u1(s.lineAt(a-r*1e3,yr.ByHeight,i,0,0).from,s.lineAt(l+(1-r)*1e3,yr.ByHeight,i,0,0).to);if(n){let{head:d}=n.range;if(dc.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),m=s.lineAt(d,yr.ByPos,i,0,0),g;n.y=="center"?g=(m.top+m.bottom)/2-h/2:n.y=="start"||n.y=="nearest"&&d=l+Math.max(10,Math.min(r,250)))&&s>a-2*1e3&&i>1,a=s<<1;if(this.defaultTextDirection!=br.LTR&&!r)return[];let l=[],c=(h,m,g,x)=>{if(m-hh&&kk.from>=g.from&&k.to<=g.to&&Math.abs(k.from-h)k.fromj));if(!S){if(mN.from<=m&&N.to>=m)){let N=n.moveToLineBoundary(Me.cursor(m),!1,!0).head;N>h&&(m=N)}let k=this.gapSize(g,h,m,x),j=r||k<2e6?k:2e6;S=new H4(h,m,k,j)}l.push(S)},d=h=>{if(h.length2e6)for(let _ of e)_.from>=h.from&&_.fromh.from&&c(h.from,x,h,m),yn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Bn.spans(n,this.viewport.from,this.viewport.to,{span(i,a){r.push({from:i,to:a})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||u0(this.heightMap.lineAt(e,yr.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)||u0(this.heightMap.lineAt(this.scaler.fromDOM(e),yr.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 u0(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 u1=class{constructor(e,n){this.from=e,this.to=n}};function xle(t,e,n){let r=[],s=t,i=0;return Bn.spans(n,t,e,{span(){},point(a,l){a>s&&(r.push({from:s,to:a}),i+=a-s),s=l}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:a}=e[s],l=a-i;if(r<=l)return i+r;r-=l}}function h1(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 vle(t,e){for(let n of t)if(e(n))return n}const KE={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class g6{constructor(e,n,r){let s=0,i=0,a=0;this.viewports=r.map(({from:l,to:c})=>{let d=n.lineAt(l,yr.ByPos,e,0,0).top,h=n.lineAt(c,yr.ByPos,e,0,0).bottom;return s+=h-d,{from:l,to:c,top:d,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let l of this.viewports)l.domTop=a+(l.top-i)*this.scale,a=l.domBottom=l.domTop+(l.bottom-l.top),i=l.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function u0(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Oo(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>u0(s,e)):t._content)}const f1=st.define({combine:t=>t.join(" ")}),Kk=st.define({combine:t=>t.indexOf(!0)>-1}),Zk=Yc.newName(),kq=Yc.newName(),Oq=Yc.newName(),jq={"&light":"."+kq,"&dark":"."+Oq};function Jk(t,e,n){return new Yc(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 yle=Jk("."+Zk,{"&":{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"}},jq),ble={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Q4=et.ie&&et.ie_version<=11;class wle{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new roe,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);(et.ie&&et.ie_version<=11||et.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&&et.android&&e.constructor.EDIT_CONTEXT!==!1&&!(et.chrome&&et.chrome_version<126)&&(this.editContext=new kle(e),e.state.facet(Ml)&&(e.contentDOM.editContext=this.editContext.editContext)),Q4&&(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(Ml)?r.root.activeElement!=this.dom:!fv(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(et.ie&&et.ie_version<=11||et.android&&et.chrome)&&!r.state.selection.main.empty&&s.focusNode&&j0(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=U0(e.root);if(!n)return!1;let r=et.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Sle(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=fv(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&&zh(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let a=this.readMutation(i);a&&(a.typeOver&&(s=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&fv(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 Foe(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=hq(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=ZE(n,e.previousSibling||e.target.previousSibling,-1),s=ZE(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(Ml)!=e.state.facet(Ml)&&(e.view.contentDOM.editContext=e.state.facet(Ml)?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 ZE(t,e,n){for(;e;){let r=sr.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 JE(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return j0(a.node,a.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function Sle(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return JE(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?JE(t,n):null}class kle{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:a}=s,l=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let d=c-l>r.text.length;l==this.from&&ithis.to&&(c=i);let h=fq(e.state.sliceDoc(l,c),r.text,(d?s.from:s.to)-l,d?"end":null);if(!h){let g=Me.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));g.main.eq(s)||e.dispatch({selection:g,userEvent:"select"});return}let m={from:h.from+l,to:h.toA+l,insert:An.of(r.text.slice(h.from,h.toB).split(` +`))};if((et.mac||et.android)&&m.from==a-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(m={from:l,to:c,insert:An.of([r.text.replace("."," ")])}),this.pendingContextChange=m,!e.state.readOnly){let g=this.to-this.from+(m.to-m.from+m.insert.length);m6(e,m,Me.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),m.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let a=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);a{let s=[];for(let i of r.getTextFormats()){let a=i.underlineStyle,l=i.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(l)){let c=this.toEditorPos(i.rangeStart),d=this.toEditorPos(i.rangeEnd);if(c{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=U0(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,a,l,c,d)=>{if(r)return;let h=d.length-(a-i);if(s&&a>=s.to)if(s.from==i&&s.to==a&&s.insert.eq(d)){s=this.pendingContextChange=null,n+=h,this.to+=h;return}else s=null,this.revertPending(e.state);if(i+=n,a+=n,a<=this.from)this.from+=h,this.to+=h;else if(ithis.to||this.to-this.from+d.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),d.toString()),this.to+=h}n+=h}),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 Ze{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||soe(e.parent)||document,this.viewState=new YE(e.state||Nn.create(e)),e.scrollTo&&e.scrollTo.is(o1)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Th).map(s=>new F4(s));for(let s of this.plugins)s.update(this);this.observer=new wle(this),this.inputState=new Qoe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new AE(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 ss?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let g of e){if(g.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=g.state}if(this.destroyed){this.viewState.state=i;return}let a=this.hasFocus,l=0,c=null;e.some(g=>g.annotation(yq))?(this.inputState.notifiedFocused=a,l=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=bq(i,a),c||(l=1));let d=this.observer.delayedAndroidKey,h=null;if(d?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(h=null)):this.observer.clear(),i.facet(Nn.phrases)!=this.state.facet(Nn.phrases))return this.setState(i);s=Kv.create(this,i,e),s.flags|=l;let m=this.viewState.scrollTarget;try{this.updateState=2;for(let g of e){if(m&&(m=m.map(g.changes)),g.scrollIntoView){let{main:x}=g.state.selection;m=new Ih(x.empty?x:Me.cursor(x.head,x.head>x.anchor?-1:1))}for(let x of g.effects)x.is(o1)&&(m=x.value.clip(this.state))}this.viewState.update(s,m),this.bidiCache=Jv.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(l0)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(f1)!=s.state.facet(f1)&&(this.viewState.mustMeasureContent=!0),(n||r||m||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let g of this.state.facet(Wk))try{g(s)}catch(x){bi(this.state,x,"update listener")}(c||h)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),h&&!hq(this,h)&&d.force&&zh(this.contentDOM,d.key,d.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 YE(e),this.plugins=e.facet(Th).map(r=>new F4(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new AE(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(Th),r=e.state.facet(Th);if(n!=r){let s=[];for(let i of r){let a=n.indexOf(i);if(a<0)s.push(new F4(i));else{let l=this.plugins[a];l.mustUpdate=e,s.push(l)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:a}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(a<0)if(RF(r))i=-1,a=this.viewState.heightMap.height;else{let x=this.viewState.scrollAnchorAt(s);i=x.from,a=x.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];c&4||([this.measureRequests,d]=[d,this.measureRequests]);let h=d.map(x=>{try{return x.read(this)}catch(y){return bi(this.state,y),e_}}),m=Kv.create(this,this.state,[]),g=!1;m.flags|=c,n?n.flags|=c:n=m,this.updateState=2,m.empty||(this.updatePlugins(m),this.inputState.update(m),this.updateAttrs(),g=this.docView.update(m),g&&this.docViewUpdate());for(let x=0;x1||y<-1){s=s+y,r.scrollTop=s/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(Wk))l(n)}get themeClasses(){return Zk+" "+(this.state.facet(Kk)?Oq:kq)+" "+this.state.facet(f1)}updateAttrs(){let e=t_(this,sq,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ml)?"true":"false",class:"cm-content",style:`${et.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),t_(this,h6,n);let r=this.observer.ignore(()=>{let s=$k(this.contentDOM,this.contentAttrs,n),i=$k(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(Ze.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(l0);let e=this.state.facet(Ze.cspNonce);Yc.mount(this.root,this.styleModules.concat(yle).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 $4(this,e,zE(this,e,n,r))}moveByGroup(e,n){return $4(this,e,zE(this,e,n,r=>Poe(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Me.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return Doe(this,e,n,r)}moveVertically(e,n,r){return $4(this,e,zoe(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(),cq(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),a=i[Hc.find(i,e-s.from,-1,n)];return Up(r,a.dir==br.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(eq)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Ole)return UF(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||VF(i.isolates,r=_E(this,e))))return i.order;r||(r=_E(this,e));let s=voe(e.text,n,r);return this.bidiCache.push(new Jv(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||et.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{AF(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 o1.of(new Ih(typeof e=="number"?Me.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return o1.of(new Ih(Me.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Yr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Yr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Yc.newName(),s=[f1.of(r),l0.of(Jk(`.${r}`,e))];return n&&n.dark&&s.push(Kk.of(!0)),s}static baseTheme(e){return uu.lowest(l0.of(Jk("."+Zk,e,jq)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&sr.get(r)||sr.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}Ze.styleModule=l0;Ze.inputHandler=ZF;Ze.clipboardInputFilter=u6;Ze.clipboardOutputFilter=d6;Ze.scrollHandler=nq;Ze.focusChangeEffect=JF;Ze.perLineTextDirection=eq;Ze.exceptionSink=KF;Ze.updateListener=Wk;Ze.editable=Ml;Ze.mouseSelectionStyle=YF;Ze.dragMovesSelection=XF;Ze.clickAddsSelectionRange=GF;Ze.decorations=W0;Ze.outerDecorations=iq;Ze.atomicRanges=Xp;Ze.bidiIsolatedRanges=aq;Ze.scrollMargins=oq;Ze.darkTheme=Kk;Ze.cspNonce=st.define({combine:t=>t.length?t[0]:""});Ze.contentAttributes=h6;Ze.editorAttributes=sq;Ze.lineWrapping=Ze.contentAttributes.of({class:"cm-lineWrapping"});Ze.announce=Qt.define();const Ole=4096,e_={};class Jv{constructor(e,n,r,s,i,a){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=a}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:br.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],a=typeof i=="function"?i(t):i;a&&qk(a,n)}return n}const jle=et.mac?"mac":et.windows?"win":et.linux?"linux":"key";function Nle(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,a,l;for(let c=0;cr.concat(s),[]))),n}function Tle(t,e,n){return Cq(Nq(t.state),e,t,n)}let Bc=null;const Ele=4e3;function _le(t,e=jle){let n=Object.create(null),r=Object.create(null),s=(a,l)=>{let c=r[a];if(c==null)r[a]=l;else if(c!=l)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},i=(a,l,c,d,h)=>{var m,g;let x=n[a]||(n[a]=Object.create(null)),y=l.split(/ (?!$)/).map(k=>Nle(k,e));for(let k=1;k{let T=Bc={view:N,prefix:j,scope:a};return setTimeout(()=>{Bc==T&&(Bc=null)},Ele),!0}]})}let w=y.join(" ");s(w,!1);let S=x[w]||(x[w]={preventDefault:!1,stopPropagation:!1,run:((g=(m=x._any)===null||m===void 0?void 0:m.run)===null||g===void 0?void 0:g.slice())||[]});c&&S.run.push(c),d&&(S.preventDefault=!0),h&&(S.stopPropagation=!0)};for(let a of t){let l=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of l){let h=n[d]||(n[d]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:m}=a;for(let g in h)h[g].run.push(x=>m(x,eO))}let c=a[e]||a.key;if(c)for(let d of l)i(d,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&i(d,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return n}let eO=null;function Cq(t,e,n,r){eO=e;let s=Zae(e),i=vi(s,0),a=ko(i)==s.length&&s!=" ",l="",c=!1,d=!1,h=!1;Bc&&Bc.view==n&&Bc.scope==r&&(l=Bc.prefix+" ",pq.indexOf(e.keyCode)<0&&(d=!0,Bc=null));let m=new Set,g=S=>{if(S){for(let k of S.run)if(!m.has(k)&&(m.add(k),k(n)))return S.stopPropagation&&(h=!0),!0;S.preventDefault&&(S.stopPropagation&&(h=!0),d=!0)}return!1},x=t[r],y,w;return x&&(g(x[l+m1(s,e,!a)])?c=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(et.windows&&e.ctrlKey&&e.altKey)&&!(et.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(y=Kc[e.keyCode])&&y!=s?(g(x[l+m1(y,e,!0)])||e.shiftKey&&(w=V0[e.keyCode])!=s&&w!=y&&g(x[l+m1(w,e,!1)]))&&(c=!0):a&&e.shiftKey&&g(x[l+m1(s,e,!0)])&&(c=!0),!c&&g(x._any)&&(c=!0)),d&&(c=!0),c&&h&&e.stopPropagation(),eO=null,c}class Kp{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=Tq(e);return[new Kp(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return Ale(e,n,r)}}function Tq(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==br.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function r_(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),a=(s.top+s.bottom)/2,l=t.posAtCoords({x:i.left+1,y:a}),c=t.posAtCoords({x:i.right-1,y:a});return l==null||c==null?r:{from:Math.max(r.from,Math.min(l,c)),to:Math.min(r.to,Math.max(l,c))}}function Ale(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==br.LTR,a=t.contentDOM,l=a.getBoundingClientRect(),c=Tq(t),d=a.querySelector(".cm-line"),h=d&&window.getComputedStyle(d),m=l.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),g=l.right-(h?parseInt(h.paddingRight):0),x=Xk(t,r,1),y=Xk(t,s,-1),w=x.type==ri.Text?x:null,S=y.type==ri.Text?y:null;if(w&&(t.lineWrapping||x.widgetLineBreaks)&&(w=r_(t,r,1,w)),S&&(t.lineWrapping||y.widgetLineBreaks)&&(S=r_(t,s,-1,S)),w&&S&&w.from==S.from&&w.to==S.to)return j(N(n.from,n.to,w));{let E=w?N(n.from,null,w):T(x,!1),_=S?N(null,n.to,S):T(y,!0),A=[];return(w||x).to<(S||y).from-(w&&S?1:0)||x.widgetLineBreaks>1&&E.bottom+t.defaultLineHeight/2<_.top?A.push(k(m,E.bottom,g,_.top)):E.bottom<_.top&&t.elementAtHeight((E.bottom+_.top)/2).type==ri.Text&&(E.bottom=_.top=(E.bottom+_.top)/2),j(E).concat(A).concat(j(_))}function k(E,_,A,D){return new Kp(e,E-c.left,_-c.top,A-E,D-_)}function j({top:E,bottom:_,horizontal:A}){let D=[];for(let q=0;qW&&I.from=L)break;R>V&&H(Math.max(Y,V),E==null&&Y<=W,Math.min(R,L),_==null&&R>=ee,K.dir)}if(V=$.to+1,V>=L)break}return B.length==0&&H(W,E==null,ee,_==null,t.textDirection),{top:D,bottom:q,horizontal:B}}function T(E,_){let A=l.top+(_?E.top:E.bottom);return{top:A,bottom:A,horizontal:[]}}}function Mle(t,e){return t.constructor==e.constructor&&t.eq(e)}class Rle{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(gv)!=e.state.facet(gv)&&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(gv);for(;n!Mle(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,et.safari&&et.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 gv=st.define();function Eq(t){return[Yr.define(e=>new Rle(e,t)),gv.of(t)]}const G0=st.define({combine(t){return Vo(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Dle(t={}){return[G0.of(t),Ple,zle,Ile,tq.of(!0)]}function _q(t){return t.startState.facet(G0)!=t.state.facet(G0)}const Ple=Eq({above:!0,markers(t){let{state:e}=t,n=e.facet(G0),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let a=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:Me.cursor(s.head,s.head>s.anchor?-1:1);for(let c of Kp.forRange(t,a,l))r.push(c)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=_q(t);return n&&s_(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){s_(e.state,t)},class:"cm-cursorLayer"});function s_(t,e){e.style.animationDuration=t.facet(G0).cursorBlinkRate+"ms"}const zle=Eq({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Kp.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||_q(t)},class:"cm-selectionLayer"}),Ile=uu.highest(Ze.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"}}}})),Aq=Qt.define({map(t,e){return t==null?null:e.mapPos(t)}}),d0=Os.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(Aq)?r.value:n,t)}}),Lle=Yr.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(d0);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(d0)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(d0),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(d0)!=t&&this.view.dispatch({effects:Aq.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 Ble(){return[d0,Lle]}function i_(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),a=n,l;!i.next().done;a+=i.value.length)if(!i.lineBreak)for(;l=e.exec(i.value);)s(a+l.index,l)}function Fle(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 qle{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:a=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(l,c,d,h)=>s(h,d,d+l[0].length,l,c);else if(typeof r=="function")this.addMatch=(l,c,d,h)=>{let m=r(l,c,d);m&&h(d,d+l[0].length,m)};else if(r)this.addMatch=(l,c,d,h)=>h(d,d+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=a}createDeco(e){let n=new Hl,r=n.add.bind(n);for(let{from:s,to:i}of Fle(e,this.maxLength))i_(e.state.doc,this.regexp,s,i,(a,l)=>this.addMatch(l,e,a,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,a,l,c)=>{c>=e.view.viewport.from&&l<=e.view.viewport.to&&(r=Math.min(l,r),s=Math.max(c,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let a=Math.max(i.from,r),l=Math.min(i.to,s);if(l>=a){let c=e.state.doc.lineAt(a),d=c.toc.from;a--)if(this.boundary.test(c.text[a-1-c.from])){h=a;break}for(;lg.push(k.range(w,S));if(c==d)for(this.regexp.lastIndex=h-c.from;(x=this.regexp.exec(c.text))&&x.indexthis.addMatch(S,e,w,y));n=n.update({filterFrom:h,filterTo:m,filter:(w,S)=>wm,add:g})}}return n}}const tO=/x/.unicode!=null?"gu":"g",$le=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,tO),Hle={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 V4=null;function Qle(){var t;if(V4==null&&typeof document<"u"&&document.body){let e=document.body.style;V4=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return V4||!1}const xv=st.define({combine(t){let e=Vo(t,{render:null,specialChars:$le,addSpecialChars:null});return(e.replaceTabs=!Qle())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,tO)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,tO)),e}});function Vle(t={}){return[xv.of(t),Ule()]}let a_=null;function Ule(){return a_||(a_=Yr.fromClass(class{constructor(t){this.view=t,this.decorations=Ot.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(xv)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new qle({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=vi(e[0],0);if(i==9){let a=s.lineAt(r),l=n.state.tabSize,c=Cf(a.text,l,r-a.from);return Ot.replace({widget:new Yle((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Ot.replace({widget:new Xle(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(xv);t.startState.facet(xv)!=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 Wle="•";function Gle(t){return t>=32?Wle:t==10?"␤":String.fromCharCode(9216+t)}class Xle extends Uo{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=Gle(this.code),r=e.state.phrase("Control character")+" "+(Hle[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 Yle extends Uo{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function Kle(){return Jle}const Zle=Ot.line({class:"cm-activeLine"}),Jle=Yr.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(Zle.range(s.from)),e=s.from)}return Ot.set(n)}},{decorations:t=>t.decorations});class ece extends Uo{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?Jh(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=Up(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 tce(t){let e=Yr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?Ot.set([Ot.widget({widget:new ece(t),side:1}).range(0)]):Ot.none}get decorations(){return this.view.state.doc.length?Ot.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,Ze.contentAttributes.of({"aria-placeholder":t})]:e}const nO=2e3;function nce(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>nO||n.off>nO||e.col<0||n.col<0){let a=Math.min(e.off,n.off),l=Math.max(e.off,n.off);for(let c=r;c<=s;c++){let d=t.doc.line(c);d.length<=l&&i.push(Me.range(d.from+a,d.to+l))}}else{let a=Math.min(e.col,n.col),l=Math.max(e.col,n.col);for(let c=r;c<=s;c++){let d=t.doc.line(c),h=Rk(d.text,a,t.tabSize,!0);if(h<0)i.push(Me.cursor(d.to));else{let m=Rk(d.text,l,t.tabSize);i.push(Me.range(d.from+h,d.from+m))}}}return i}function rce(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function o_(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>nO?-1:s==r.length?rce(t,e.clientX):Cf(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function sce(t,e){let n=o_(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),a=s.state.doc.lineAt(i);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},r=r.map(s.changes)}},get(s,i,a){let l=o_(t,s);if(!l)return r;let c=nce(t.state,n,l);return c.length?a?Me.create(c.concat(r.ranges)):Me.create(c):r}}:null}function ice(t){let e=(n=>n.altKey&&n.button==0);return Ze.mouseSelectionStyle.of((n,r)=>e(r)?sce(n,r):null)}const ace={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},oce={style:"cursor: crosshair"};function lce(t={}){let[e,n]=ace[t.key||"Alt"],r=Yr.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,Ze.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?oce:null})]}const p1="-10000px";class Mq{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(a=>a);let i=null;this.tooltipViews=this.tooltips.map(a=>i=r(a,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(c=>c);if(s===this.input){for(let c of this.tooltipViews)c.update&&c.update(e);return!1}let a=[],l=n?[]:null;for(let c=0;cn[d]=c),n.length=l.length),this.input=s,this.tooltips=i,this.tooltipViews=a,!0}}function cce(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const U4=st.define({combine:t=>{var e,n,r;return{position:et.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)||cce}}}),l_=new WeakMap,x6=Yr.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(U4);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 Mq(t,v6,(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(U4);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=p1,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(et.safari){let a=i.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=f6(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,a)=>{let l=this.manager.tooltipViews[a];return l.getCoords?l.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(U4).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,a=[];for(let l=0;l=Math.min(n.bottom,r.bottom)||m.rightMath.min(n.right,r.right)+.1)){h.style.top=p1;continue}let x=c.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,y=x?7:0,w=g.right-g.left,S=(e=l_.get(d))!==null&&e!==void 0?e:g.bottom-g.top,k=d.offset||dce,j=this.view.textDirection==br.LTR,N=g.width>r.right-r.left?j?r.left:r.right-g.width:j?Math.max(r.left,Math.min(m.left-(x?14:0)+k.x,r.right-w)):Math.min(Math.max(r.left,m.left-w+(x?14:0)-k.x),r.right-w),T=this.above[l];!c.strictSide&&(T?m.top-S-y-k.yr.bottom)&&T==r.bottom-m.bottom>m.top-r.top&&(T=this.above[l]=!T);let E=(T?m.top-r.top:r.bottom-m.bottom)-y;if(EN&&D.top<_+S&&D.bottom>_&&(_=T?D.top-S-2-y:D.bottom+y+2);if(this.position=="absolute"?(h.style.top=(_-t.parent.top)/i+"px",c_(h,(N-t.parent.left)/s)):(h.style.top=_/i+"px",c_(h,N/s)),x){let D=m.left+(j?k.x:-k.x)-(N+14-7);x.style.left=D/s+"px"}d.overlap!==!0&&a.push({left:N,top:_,right:A,bottom:_+S}),h.classList.toggle("cm-tooltip-above",T),h.classList.toggle("cm-tooltip-below",!T),d.positioned&&d.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=p1}},{eventObservers:{scroll(){this.maybeMeasure()}}});function c_(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const uce=Ze.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"}}}),dce={x:0,y:0},v6=st.define({enables:[x6,uce]}),ey=st.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class pb{static create(e){return new pb(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Mq(e,ey,(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 hce=v6.compute([ey],t=>{let e=t.facet(ey);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:pb.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class fce{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;el.bottom||n.xl.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(s)).find(h=>h.from<=s&&h.to>=s),d=c&&c.dir==br.RTL?-1:1;i=n.x{this.pending==l&&(this.pending=null,c&&!(Array.isArray(c)&&!c.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(c)?c:[c])}))},c=>bi(e.state,c,"hover tooltip"))}else a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(x6),n=e?e.manager.tooltips.findIndex(r=>r.create==pb.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&&!mce(i.dom,e)||this.pending){let{pos:a}=s[0]||this.pending,l=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==l?this.view.posAtCoords(this.lastMove)!=a:!pce(this.view,a,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const g1=4;function mce(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let l=a.getBoundingClientRect();s=Math.min(l.top,s),i=Math.max(l.bottom,i)}return e.clientX>=n-g1&&e.clientX<=r+g1&&e.clientY>=s-g1&&e.clientY<=i+g1}function pce(t,e,n,r,s,i){let a=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>r||a.rights||Math.min(a.bottom,l)=e&&c<=n}function gce(t,e={}){let n=Qt.define(),r=Os.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(a=>!e.hideOn(i,a))),i.docChanged)){let a=[];for(let l of s){let c=i.changes.mapPos(l.pos,-1,Ds.TrackDel);if(c!=null){let d=Object.assign(Object.create(null),l);d.pos=c,d.end!=null&&(d.end=i.changes.mapPos(d.end)),a.push(d)}}s=a}for(let a of i.effects)a.is(n)&&(s=a.value),a.is(xce)&&(s=[]);return s},provide:s=>ey.from(s)});return{active:r,extension:[r,Yr.define(s=>new fce(s,t,r,n,e.hoverTime||300)),hce]}}function Rq(t,e){let n=t.plugin(x6);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const xce=Qt.define(),u_=st.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 X0(t,e){let n=t.plugin(Dq),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const Dq=Yr.fromClass(class{constructor(t){this.input=t.state.facet(Y0),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(u_);this.top=new x1(t,!0,e.topContainer),this.bottom=new x1(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(u_);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new x1(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new x1(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Y0);if(n!=this.input){let r=n.filter(c=>c),s=[],i=[],a=[],l=[];for(let c of r){let d=this.specs.indexOf(c),h;d<0?(h=c(t.view),l.push(h)):(h=this.panels[d],h.update&&h.update(t)),s.push(h),(h.top?i:a).push(h)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(a);for(let c of l)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Ze.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class x1{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=d_(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=d_(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 d_(t){let e=t.nextSibling;return t.remove(),e}const Y0=st.define({enables:Dq});class Vl extends od{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Vl.prototype.elementClass="";Vl.prototype.toDOM=void 0;Vl.prototype.mapMode=Ds.TrackBefore;Vl.prototype.startSide=Vl.prototype.endSide=-1;Vl.prototype.point=!0;const vv=st.define(),vce=st.define(),yce={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Bn.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},T0=st.define();function bce(t){return[Pq(),T0.of({...yce,...t})]}const h_=st.define({combine:t=>t.some(e=>e)});function Pq(t){return[wce]}const wce=Yr.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(T0).map(e=>new m_(t,e)),this.fixed=!t.state.facet(h_);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(h_)!=!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=Bn.iter(this.view.state.facet(vv),this.view.viewport.from),r=[],s=this.gutters.map(i=>new Sce(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let a=!0;for(let l of i.type)if(l.type==ri.Text&&a){rO(n,r,l.from);for(let c of s)c.line(this.view,l,r);a=!1}else if(l.widget)for(let c of s)c.widget(this.view,l)}else if(i.type==ri.Text){rO(n,r,i.from);for(let a of s)a.line(this.view,i,r)}else if(i.widget)for(let a of s)a.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(T0),n=t.state.facet(T0),r=t.docChanged||t.heightChanged||t.viewportChanged||!Bn.eq(t.startState.facet(vv),t.state.facet(vv),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let a=e.indexOf(i);a<0?s.push(new m_(this.view,i)):(this.gutters[a].update(t),s.push(this.gutters[a]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>Ze.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==br.LTR?{left:r,right:s}:{right:r,left:s}})});function f_(t){return Array.isArray(t)?t:[t]}function rO(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class Sce{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=Bn.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,a=n.height/e.scaleY;if(this.i==s.elements.length){let l=new zq(e,a,i,r);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,a,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];rO(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let a=this.gutter;s.length==0&&!a.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(vce)){let a=i(e,n.widget,n);a&&(s||(s=[])).push(a)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class m_{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let c=i.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=s.clientY;let l=e.lineBlockAtHeight(a-e.documentTop);n.domEventHandlers[r](e,l,s)&&s.preventDefault()});this.markers=f_(n.markers(e)),n.initialSpacer&&(this.spacer=new zq(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=f_(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!Bn.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 zq{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":""),kce(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,a=0;;){let l=a,c=ii(l,c,d)||a(l,c,d):a}return r}})}});class W4 extends Vl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function G4(t,e){return t.state.facet(Eh).formatNumber(e,t.state)}const Nce=T0.compute([Eh],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Oce)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new W4(G4(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(jce)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Eh)!=e.state.facet(Eh),initialSpacer(e){return new W4(G4(e,p_(e.state.doc.lines)))},updateSpacer(e,n){let r=G4(n.view,p_(n.view.state.doc.lines));return r==e.number?e:new W4(r)},domEventHandlers:t.facet(Eh).domEventHandlers,side:"before"}));function Cce(t={}){return[Eh.of(t),Pq(),Nce]}function p_(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(Tce.range(s)))}return Bn.of(e)});function _ce(){return Ece}const Iq=1024;let Ace=0;class X4{constructor(e,n){this.from=e,this.to=n}}class an{constructor(e={}){this.id=Ace++,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=ai.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}an.closedBy=new an({deserialize:t=>t.split(" ")});an.openedBy=new an({deserialize:t=>t.split(" ")});an.group=new an({deserialize:t=>t.split(" ")});an.isolate=new an({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});an.contextHash=new an({perNode:!0});an.lookAhead=new an({perNode:!0});an.mounted=new an({perNode:!0});class ty{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[an.mounted.id]}}const Mce=Object.create(null);class ai{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):Mce,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new ai(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(an.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(an.group),i=-1;i<(s?s.length:0);i++){let a=n[i<0?r.name:s[i]];if(a)return a}}}}ai.none=new ai("",Object.create(null),0,8);class gb{constructor(e){this.types=e;for(let n=0;n0;for(let c=this.cursor(a|hs.IncludeAnonymous);;){let d=!1;if(c.from<=i&&c.to>=s&&(!l&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;d=!0}for(;d&&r&&(l||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;d=!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:w6(ai.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new ur(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new ur(ai.none,n,r,s)))}static build(e){return zce(e)}}ur.empty=new ur(ai.none,[],[],0);class y6{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 y6(this.buffer,this.index)}}class Jc{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return ai.none}toString(){let e=[];for(let n=0;n0));c=a[c+3]);return l}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),a=0;for(let l=e,c=0;l=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function K0(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?l.length:-1;e!=d;e+=n){let h=l[e],m=c[e]+a.from;if(Lq(s,r,m,m+h.length)){if(h instanceof Jc){if(i&hs.ExcludeBuffers)continue;let g=h.findChild(0,h.buffer.length,n,r-m,s);if(g>-1)return new Co(new Rce(a,h,e,m),null,g)}else if(i&hs.IncludeAnonymous||!h.type.isAnonymous||b6(h)){let g;if(!(i&hs.IgnoreMounts)&&(g=ty.get(h))&&!g.overlay)return new Ni(g.tree,m,e,a);let x=new Ni(h,m,e,a);return i&hs.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(n<0?h.children.length-1:0,n,r,s)}}}if(i&hs.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&hs.IgnoreOverlays)&&(s=ty.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:a,to:l}of s.overlay)if((n>0?a<=i:a=i:l>i))return new Ni(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function x_(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let a=!1;!a;)if(a=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function sO(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 Rce{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class Co extends Bq{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 Co(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&hs.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 Co(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 Co(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 Co(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let a=r.buffer[this.index+1];e.push(r.slice(s,i,a)),n.push(0)}return new ur(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Fq(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||a.to=e){let l=new Ni(a.tree,a.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(K0(l,e,n,!1))}}return s?Fq(s):r}class iO{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ni)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof Ni?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&hs.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&hs.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&hs.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,a=e<0?-1:r._tree.children.length;i!=a;i+=e){let l=r._tree.children[i];if(this.mode&hs.IncludeAnonymous||l instanceof Jc||!l.type.isAnonymous||b6(l))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let a=e;a;a=a._parent)if(a.index==s){if(s==this.index)return a;n=a,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return sO(this._tree,e,s);let a=r[n.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[s]&&e[s]!=a.name)return!1;s--}}return!0}}function b6(t){return t.children.some(e=>e instanceof Jc||!e.type.isAnonymous||b6(e))}function zce(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=Iq,reused:i=[],minRepeatType:a=r.types.length}=t,l=Array.isArray(n)?new y6(n,n.length):n,c=r.types,d=0,h=0;function m(E,_,A,D,q,B){let{id:H,start:W,end:ee,size:I}=l,V=h,L=d;if(I<0)if(l.next(),I==-1){let ie=i[H];A.push(ie),D.push(W-E);return}else if(I==-3){d=H;return}else if(I==-4){h=H;return}else throw new RangeError(`Unrecognized record size: ${I}`);let $=c[H],K,Y,R=W-E;if(ee-W<=s&&(Y=S(l.pos-_,q))){let ie=new Uint16Array(Y.size-Y.skip),X=l.pos-Y.size,z=ie.length;for(;l.pos>X;)z=k(Y.start,ie,z);K=new Jc(ie,ee-Y.start,r),R=Y.start-E}else{let ie=l.pos-I;l.next();let X=[],z=[],U=H>=a?H:-1,te=0,ne=ee;for(;l.pos>ie;)U>=0&&l.id==U&&l.size>=0?(l.end<=ne-s&&(y(X,z,W,te,l.end,ne,U,V,L),te=X.length,ne=l.end),l.next()):B>2500?g(W,ie,X,z):m(W,ie,X,z,U,B+1);if(U>=0&&te>0&&te-1&&te>0){let G=x($,L);K=w6($,X,z,0,X.length,0,ee-W,G,G)}else K=w($,X,z,ee-W,V-ee,L)}A.push(K),D.push(R)}function g(E,_,A,D){let q=[],B=0,H=-1;for(;l.pos>_;){let{id:W,start:ee,end:I,size:V}=l;if(V>4)l.next();else{if(H>-1&&ee=0;I-=3)W[V++]=q[I],W[V++]=q[I+1]-ee,W[V++]=q[I+2]-ee,W[V++]=V;A.push(new Jc(W,q[2]-ee,r)),D.push(ee-E)}}function x(E,_){return(A,D,q)=>{let B=0,H=A.length-1,W,ee;if(H>=0&&(W=A[H])instanceof ur){if(!H&&W.type==E&&W.length==q)return W;(ee=W.prop(an.lookAhead))&&(B=D[H]+W.length+ee)}return w(E,A,D,q,B,_)}}function y(E,_,A,D,q,B,H,W,ee){let I=[],V=[];for(;E.length>D;)I.push(E.pop()),V.push(_.pop()+A-q);E.push(w(r.types[H],I,V,B-q,W-B,ee)),_.push(q-A)}function w(E,_,A,D,q,B,H){if(B){let W=[an.contextHash,B];H=H?[W].concat(H):[W]}if(q>25){let W=[an.lookAhead,q];H=H?[W].concat(H):[W]}return new ur(E,_,A,D,H)}function S(E,_){let A=l.fork(),D=0,q=0,B=0,H=A.end-s,W={size:0,start:0,skip:0};e:for(let ee=A.pos-E;A.pos>ee;){let I=A.size;if(A.id==_&&I>=0){W.size=D,W.start=q,W.skip=B,B+=4,D+=4,A.next();continue}let V=A.pos-I;if(I<0||V=a?4:0,$=A.start;for(A.next();A.pos>V;){if(A.size<0)if(A.size==-3)L+=4;else break e;else A.id>=a&&(L+=4);A.next()}q=$,D+=I,B+=L}return(_<0||D==E)&&(W.size=D,W.start=q,W.skip=B),W.size>4?W:void 0}function k(E,_,A){let{id:D,start:q,end:B,size:H}=l;if(l.next(),H>=0&&D4){let ee=l.pos-(H-4);for(;l.pos>ee;)A=k(E,_,A)}_[--A]=W,_[--A]=B-E,_[--A]=q-E,_[--A]=D}else H==-3?d=D:H==-4&&(h=D);return A}let j=[],N=[];for(;l.pos>0;)m(t.start||0,t.bufferStart||0,j,N,-1,0);let T=(e=t.length)!==null&&e!==void 0?e:j.length?N[0]+j[0].length:0;return new ur(c[t.topID],j.reverse(),N.reverse(),T)}const v_=new WeakMap;function yv(t,e){if(!t.isAnonymous||e instanceof Jc||e.type!=t)return 1;let n=v_.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof ur)){n=1;break}n+=yv(t,r)}v_.set(e,n)}return n}function w6(t,e,n,r,s,i,a,l,c){let d=0;for(let y=r;y=h)break;_+=A}if(N==T+1){if(_>h){let A=y[T];x(A.children,A.positions,0,A.children.length,w[T]+j);continue}m.push(y[T])}else{let A=w[N-1]+y[N-1].length-E;m.push(w6(t,y,w,T,N,E,A,null,c))}g.push(E+j-i)}}return x(e,n,r,s,0),(l||c)(m,g,a)}class Ice{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 Co?this.setBuffer(e.context.buffer,e.index,n):e instanceof Ni&&this.map.set(e.tree,n)}get(e){return e instanceof Co?this.getBuffer(e.context.buffer,e.index):e instanceof Ni?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class rd{constructor(e,n,r,s,i=!1,a=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new rd(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,a=e.length?e[0]:null;for(let l=0,c=0,d=0;;l++){let h=l=r)for(;a&&a.from=g.from||m<=g.to||d){let x=Math.max(g.from,c)-d,y=Math.min(g.to,m)-d;g=x>=y?null:new rd(x,y,g.tree,g.offset+d,l>0,!!h)}if(g&&s.push(g),a.to>m)break;a=inew X4(s.from,s.to)):[new X4(0,0)]:[new X4(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 Lce{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 an({perNode:!0});let Bce=0;class ga{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=Bce++}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 ga&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new ga(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 ny(e);return r=>r.modified.indexOf(n)>-1?r:ny.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let Fce=0;class ny{constructor(e){this.name=e,this.instances=[],this.id=Fce++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&qce(n,l.modified));if(r)return r;let s=[],i=new ga(e.name,s,e,n);for(let l of n)l.instances.push(i);let a=$ce(n);for(let l of e.set)if(!l.modified.length)for(let c of a)s.push(ny.get(l,c));return i}}function qce(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function $ce(t){let e=[[]];for(let n=0;nr.length-n.length)}function k6(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],a=2,l=s;for(let m=0;;){if(l=="..."&&m>0&&m+3==s.length){a=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!g)throw new RangeError("Invalid path: "+s);if(i.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),m+=g[0].length,m==s.length)break;let x=s[m++];if(m==s.length&&x=="!"){a=0;break}if(x!="/")throw new RangeError("Invalid path: "+s);l=s.slice(m)}let c=i.length-1,d=i[c];if(!d)throw new RangeError("Invalid path: "+s);let h=new Z0(r,a,c>0?i.slice(0,c):null);e[d]=h.sort(e[d])}}return qq.add(e)}const qq=new an({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 Z0(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Z0{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let a=s;for(let l of i)for(let c of l.set){let d=n[c.id];if(d){a=a?a+" "+d:d;break}}return a},scope:r}}function Hce(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function Qce(t,e,n,r=0,s=t.length){let i=new Vce(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class Vce{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:a,from:l,to:c}=e;if(l>=r||c<=n)return;a.isTop&&(i=this.highlighters.filter(x=>!x.scope||x.scope(a)));let d=s,h=Uce(e)||Z0.empty,m=Hce(i,h.tags);if(m&&(d&&(d+=" "),d+=m,h.mode==1&&(s+=(s?" ":"")+m)),this.startSpan(Math.max(n,l),d),h.opaque)return;let g=e.tree&&e.tree.prop(an.mounted);if(g&&g.overlay){let x=e.node.enter(g.overlay[0].from+l,1),y=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),w=e.firstChild();for(let S=0,k=l;;S++){let j=S=N||!e.nextSibling())););if(!j||N>r)break;k=j.to+l,k>n&&(this.highlightRange(x.cursor(),Math.max(n,j.from+l),Math.min(r,k),"",y),this.startSpan(Math.min(r,k),d))}w&&e.parent()}else if(e.firstChild()){g&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),d)}while(e.nextSibling());e.parent()}}}function Uce(t){let e=t.type.prop(qq);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ke=ga.define,y1=Ke(),Pc=Ke(),y_=Ke(Pc),b_=Ke(Pc),zc=Ke(),b1=Ke(zc),Y4=Ke(zc),xo=Ke(),zu=Ke(xo),po=Ke(),go=Ke(),aO=Ke(),$m=Ke(aO),w1=Ke(),ye={comment:y1,lineComment:Ke(y1),blockComment:Ke(y1),docComment:Ke(y1),name:Pc,variableName:Ke(Pc),typeName:y_,tagName:Ke(y_),propertyName:b_,attributeName:Ke(b_),className:Ke(Pc),labelName:Ke(Pc),namespace:Ke(Pc),macroName:Ke(Pc),literal:zc,string:b1,docString:Ke(b1),character:Ke(b1),attributeValue:Ke(b1),number:Y4,integer:Ke(Y4),float:Ke(Y4),bool:Ke(zc),regexp:Ke(zc),escape:Ke(zc),color:Ke(zc),url:Ke(zc),keyword:po,self:Ke(po),null:Ke(po),atom:Ke(po),unit:Ke(po),modifier:Ke(po),operatorKeyword:Ke(po),controlKeyword:Ke(po),definitionKeyword:Ke(po),moduleKeyword:Ke(po),operator:go,derefOperator:Ke(go),arithmeticOperator:Ke(go),logicOperator:Ke(go),bitwiseOperator:Ke(go),compareOperator:Ke(go),updateOperator:Ke(go),definitionOperator:Ke(go),typeOperator:Ke(go),controlOperator:Ke(go),punctuation:aO,separator:Ke(aO),bracket:$m,angleBracket:Ke($m),squareBracket:Ke($m),paren:Ke($m),brace:Ke($m),content:xo,heading:zu,heading1:Ke(zu),heading2:Ke(zu),heading3:Ke(zu),heading4:Ke(zu),heading5:Ke(zu),heading6:Ke(zu),contentSeparator:Ke(xo),list:Ke(xo),quote:Ke(xo),emphasis:Ke(xo),strong:Ke(xo),link:Ke(xo),monospace:Ke(xo),strikethrough:Ke(xo),inserted:Ke(),deleted:Ke(),changed:Ke(),invalid:Ke(),meta:w1,documentMeta:Ke(w1),annotation:Ke(w1),processingInstruction:Ke(w1),definition:ga.defineModifier("definition"),constant:ga.defineModifier("constant"),function:ga.defineModifier("function"),standard:ga.defineModifier("standard"),local:ga.defineModifier("local"),special:ga.defineModifier("special")};for(let t in ye){let e=ye[t];e instanceof ga&&(e.name=t)}$q([{tag:ye.link,class:"tok-link"},{tag:ye.heading,class:"tok-heading"},{tag:ye.emphasis,class:"tok-emphasis"},{tag:ye.strong,class:"tok-strong"},{tag:ye.keyword,class:"tok-keyword"},{tag:ye.atom,class:"tok-atom"},{tag:ye.bool,class:"tok-bool"},{tag:ye.url,class:"tok-url"},{tag:ye.labelName,class:"tok-labelName"},{tag:ye.inserted,class:"tok-inserted"},{tag:ye.deleted,class:"tok-deleted"},{tag:ye.literal,class:"tok-literal"},{tag:ye.string,class:"tok-string"},{tag:ye.number,class:"tok-number"},{tag:[ye.regexp,ye.escape,ye.special(ye.string)],class:"tok-string2"},{tag:ye.variableName,class:"tok-variableName"},{tag:ye.local(ye.variableName),class:"tok-variableName tok-local"},{tag:ye.definition(ye.variableName),class:"tok-variableName tok-definition"},{tag:ye.special(ye.variableName),class:"tok-variableName2"},{tag:ye.definition(ye.propertyName),class:"tok-propertyName tok-definition"},{tag:ye.typeName,class:"tok-typeName"},{tag:ye.namespace,class:"tok-namespace"},{tag:ye.className,class:"tok-className"},{tag:ye.macroName,class:"tok-macroName"},{tag:ye.propertyName,class:"tok-propertyName"},{tag:ye.operator,class:"tok-operator"},{tag:ye.comment,class:"tok-comment"},{tag:ye.meta,class:"tok-meta"},{tag:ye.invalid,class:"tok-invalid"},{tag:ye.punctuation,class:"tok-punctuation"}]);var K4;const Wu=new an;function Hq(t){return st.define({combine:t?e=>e.concat(t):void 0})}const Wce=new an;class Sa{constructor(e,n,r=[],s=""){this.data=e,this.name=s,Nn.prototype.hasOwnProperty("tree")||Object.defineProperty(Nn.prototype,"tree",{get(){return Ss(this)}}),this.parser=n,this.extension=[eu.of(this),Nn.languageData.of((i,a,l)=>{let c=w_(i,a,l),d=c.type.prop(Wu);if(!d)return[];let h=i.facet(d),m=c.type.prop(Wce);if(m){let g=c.resolve(a-c.from,l);for(let x of m)if(x.test(g,i)){let y=i.facet(x.facet);return x.type=="replace"?y:y.concat(h)}}return h})].concat(r)}isActiveAt(e,n,r=-1){return w_(e,n,r).type.prop(Wu)==this.data}findRegions(e){let n=e.facet(eu);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,a)=>{if(i.prop(Wu)==this.data){r.push({from:a,to:a+i.length});return}let l=i.prop(an.mounted);if(l){if(l.tree.prop(Wu)==this.data){if(l.overlay)for(let c of l.overlay)r.push({from:c.from+a,to:c.to+a});else r.push({from:a,to:a+i.length});return}else if(l.overlay){let c=r.length;if(s(l.tree,l.overlay[0].from+a),r.length>c)return}}for(let c=0;cr.isTop?n:void 0)]}),e.name)}configure(e,n){return new J0(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ss(t){let e=t.field(Sa.state,!1);return e?e.tree:ur.empty}class Gce{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 Hm=null;class rf{constructor(e,n,r=[],s,i,a,l,c){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=a,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new rf(e,n,[],ur.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Gce(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ur.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(rd.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Hm;Hm=this;try{return e()}finally{Hm=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=S_(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:a,skipped:l}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((d,h,m,g)=>c.push({fromA:d,toA:h,fromB:m,toB:g})),r=rd.applyChanges(r,c),s=ur.empty,i=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){l=[];for(let d of this.skipped){let h=e.mapPos(d.from,1),m=e.mapPos(d.to,-1);he.from&&(this.fragments=S_(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 S6{createParse(n,r,s){let i=s[0].from,a=s[s.length-1].to;return{parsedPos:i,advance(){let c=Hm;if(c){for(let d of s)c.tempSkipped.push(d);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=a,new ur(ai.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Hm}}function S_(t,e,n){return rd.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class sf{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 sf(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=rf.create(e.facet(eu).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new sf(r)}}Sa.state=Os.define({create:sf.init,update(t,e){for(let n of e.effects)if(n.is(Sa.setState))return n.value;return e.startState.facet(eu)!=e.state.facet(eu)?sf.init(e.state):t.apply(e)}});let Qq=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Qq=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Z4=typeof navigator<"u"&&(!((K4=navigator.scheduling)===null||K4===void 0)&&K4.isInputPending)?()=>navigator.scheduling.isInputPending():null,Xce=Yr.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(Sa.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(Sa.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=Qq(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,c=i.context.work(()=>Z4&&Z4()||Date.now()>a,s+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Sa.setState.of(new sf(i.context))})),this.chunkBudget>0&&!(c&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>bi(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()}}}),eu=st.define({combine(t){return t.length?t[0]:null},enables:t=>[Sa.state,Xce,Ze.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class Vq{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const Yce=st.define(),Zp=st.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 dd(t){let e=t.facet(Zp);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function ep(t,e){let n="",r=t.tabSize,s=t.facet(Zp)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?Kce(t,n,e):null}class xb{constructor(e,n={}){this.state=e,this.options=n,this.unit=dd(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=a-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Cf(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let a=i(s);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const vb=new an;function Kce(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let a=s;a&&!(a.fromr.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)i.push(a);for(let a=i.length-1;a>=0;a--)r={node:i[a],next:r}}return Uq(r,t,n)}function Uq(t,e,n){for(let r=t;r;r=r.next){let s=Jce(r.node);if(s)return s(j6.create(e,n,r))}return 0}function Zce(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Jce(t){let e=t.type.prop(vb);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(an.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return a=>Wq(a,!0,1,void 0,i&&!Zce(a)?s.from:void 0)}return t.parent==null?eue:null}function eue(){return 0}class j6 extends xb{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 j6(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(tue(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return Uq(this.context.next,this.base,this.pos)}}function tue(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function nue(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),a=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let l=n.to;;){let c=e.childAfter(l);if(!c||c==r)return null;if(!c.type.isSkipped){if(c.from>=a)return null;let d=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+d}}l=c.to}}function J4({closing:t,align:e=!0,units:n=1}){return r=>Wq(r,e,n,t)}function Wq(t,e,n,r,s){let i=t.textAfter,a=i.match(/^\s*/)[0].length,l=r&&i.slice(a,a+r.length)==r||s==t.pos+a,c=e?nue(t):null;return c?l?t.column(c.from):t.column(c.to):t.baseIndent+(l?0:t.unit*n)}function k_({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const rue=200;function sue(){return Nn.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+rue)return t;let i=n.sliceString(s.from,r);if(!e.some(d=>d.test(i)))return t;let{state:a}=t,l=-1,c=[];for(let{head:d}of a.selection.ranges){let h=a.doc.lineAt(d);if(h.from==l)continue;l=h.from;let m=O6(a,h.from);if(m==null)continue;let g=/^\s*/.exec(h.text)[0],x=ep(a,m);g!=x&&c.push({from:h.from,to:h.from+g.length,insert:x})}return c.length?[t,{changes:c,sequential:!0}]:t})}const iue=st.define(),N6=new an;function Gq(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&l.from=e&&d.to>n&&(i=d)}}return i}function oue(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function ry(t,e,n){for(let r of t.facet(iue)){let s=r(t,e,n);if(s)return s}return aue(t,e,n)}function Xq(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 yb=Qt.define({map:Xq}),Jp=Qt.define({map:Xq});function Yq(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 hd=Os.define({create(){return Ot.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=O_(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(yb)&&!lue(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(Jq),s=r?Ot.replace({widget:new pue(r(e.state,n.value))}):j_;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(Jp)&&(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=O_(t,e.selection.main.head)),t},provide:t=>Ze.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 sy(t,e,n){var r;let s=null;return(r=t.field(hd,!1))===null||r===void 0||r.between(e,n,(i,a)=>{(!s||s.from>i)&&(s={from:i,to:a})}),s}function lue(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function Kq(t,e){return t.field(hd,!1)?e:e.concat(Qt.appendConfig.of(e$()))}const cue=t=>{for(let e of Yq(t)){let n=ry(t.state,e.from,e.to);if(n)return t.dispatch({effects:Kq(t.state,[yb.of(n),Zq(t,n)])}),!0}return!1},uue=t=>{if(!t.state.field(hd,!1))return!1;let e=[];for(let n of Yq(t)){let r=sy(t.state,n.from,n.to);r&&e.push(Jp.of(r),Zq(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function Zq(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return Ze.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const due=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(hd,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(Jp.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},fue=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:cue},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:uue},{key:"Ctrl-Alt-[",run:due},{key:"Ctrl-Alt-]",run:hue}],mue={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Jq=st.define({combine(t){return Vo(t,mue)}});function e$(t){return[hd,vue]}function t$(t,e){let{state:n}=t,r=n.facet(Jq),s=a=>{let l=t.lineBlockAt(t.posAtDOM(a.target)),c=sy(t.state,l.from,l.to);c&&t.dispatch({effects:Jp.of(c)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const j_=Ot.replace({widget:new class extends Uo{toDOM(t){return t$(t,null)}}});class pue extends Uo{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return t$(e,this.value)}}const gue={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class eS extends Vl{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 xue(t={}){let e={...gue,...t},n=new eS(e,!0),r=new eS(e,!1),s=Yr.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(eu)!=a.state.facet(eu)||a.startState.field(hd,!1)!=a.state.field(hd,!1)||Ss(a.startState)!=Ss(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let l=new Hl;for(let c of a.viewportLineBlocks){let d=sy(a.state,c.from,c.to)?r:ry(a.state,c.from,c.to)?n:null;d&&l.add(c.from,c.from,d)}return l.finish()}}),{domEventHandlers:i}=e;return[s,bce({class:"cm-foldGutter",markers(a){var l;return((l=a.plugin(s))===null||l===void 0?void 0:l.markers)||Bn.empty},initialSpacer(){return new eS(e,!1)},domEventHandlers:{...i,click:(a,l,c)=>{if(i.click&&i.click(a,l,c))return!0;let d=sy(a.state,l.from,l.to);if(d)return a.dispatch({effects:Jp.of(d)}),!0;let h=ry(a.state,l.from,l.to);return h?(a.dispatch({effects:yb.of(h)}),!0):!1}}}),e$()]}const vue=Ze.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 eg{constructor(e,n){this.specs=e;let r;function s(l){let c=Yc.newName();return(r||(r=Object.create(null)))["."+c]=l,c}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,a=n.scope;this.scope=a instanceof Sa?l=>l.prop(Wu)==a.data:a?l=>l==a:void 0,this.style=$q(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:i}).style,this.module=r?new Yc(r):null,this.themeType=n.themeType}static define(e,n){return new eg(e,n||{})}}const oO=st.define(),n$=st.define({combine(t){return t.length?[t[0]]:null}});function tS(t){let e=t.facet(oO);return e.length?e:t.facet(n$)}function r$(t,e){let n=[bue],r;return t instanceof eg&&(t.module&&n.push(Ze.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(n$.of(t)):r?n.push(oO.computeN([Ze.darkTheme],s=>s.facet(Ze.darkTheme)==(r=="dark")?[t]:[])):n.push(oO.of(t)),n}class yue{constructor(e){this.markCache=Object.create(null),this.tree=Ss(e.state),this.decorations=this.buildDeco(e,tS(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=Ss(e.state),r=tS(e.state),s=r!=tS(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return Ot.none;let r=new Hl;for(let{from:s,to:i}of e.visibleRanges)Qce(this.tree,n,(a,l,c)=>{r.add(a,l,this.markCache[c]||(this.markCache[c]=Ot.mark({class:c})))},s,i);return r.finish()}}const bue=uu.high(Yr.fromClass(yue,{decorations:t=>t.decorations})),wue=eg.define([{tag:ye.meta,color:"#404740"},{tag:ye.link,textDecoration:"underline"},{tag:ye.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ye.emphasis,fontStyle:"italic"},{tag:ye.strong,fontWeight:"bold"},{tag:ye.strikethrough,textDecoration:"line-through"},{tag:ye.keyword,color:"#708"},{tag:[ye.atom,ye.bool,ye.url,ye.contentSeparator,ye.labelName],color:"#219"},{tag:[ye.literal,ye.inserted],color:"#164"},{tag:[ye.string,ye.deleted],color:"#a11"},{tag:[ye.regexp,ye.escape,ye.special(ye.string)],color:"#e40"},{tag:ye.definition(ye.variableName),color:"#00f"},{tag:ye.local(ye.variableName),color:"#30a"},{tag:[ye.typeName,ye.namespace],color:"#085"},{tag:ye.className,color:"#167"},{tag:[ye.special(ye.variableName),ye.macroName],color:"#256"},{tag:ye.definition(ye.propertyName),color:"#00c"},{tag:ye.comment,color:"#940"},{tag:ye.invalid,color:"#f00"}]),Sue=Ze.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),s$=1e4,i$="()[]{}",a$=st.define({combine(t){return Vo(t,{afterCursor:!0,brackets:i$,maxScanDistance:s$,renderMatch:jue})}}),kue=Ot.mark({class:"cm-matchingBracket"}),Oue=Ot.mark({class:"cm-nonmatchingBracket"});function jue(t){let e=[],n=t.matched?kue:Oue;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 Nue=Os.define({create(){return Ot.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(a$);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=To(e.state,s.head,-1,r)||s.head>0&&To(e.state,s.head-1,1,r)||r.afterCursor&&(To(e.state,s.head,1,r)||s.headZe.decorations.from(t)}),Cue=[Nue,Sue];function Tue(t={}){return[a$.of(t),Cue]}const Eue=new an;function lO(t,e,n){let r=t.prop(e<0?an.openedBy:an.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 cO(t){let e=t.type.prop(Eue);return e?e(t.node):t}function To(t,e,n,r={}){let s=r.maxScanDistance||s$,i=r.brackets||i$,a=Ss(t),l=a.resolveInner(e,n);for(let c=l;c;c=c.parent){let d=lO(c.type,n,i);if(d&&c.from0?e>=h.from&&eh.from&&e<=h.to))return _ue(t,e,n,c,h,d,i)}}return Aue(t,e,n,a,l.type,s,i)}function _ue(t,e,n,r,s,i,a){let l=r.parent,c={from:s.from,to:s.to},d=0,h=l?.cursor();if(h&&(n<0?h.childBefore(r.from):h.childAfter(r.to)))do if(n<0?h.to<=r.from:h.from>=r.to){if(d==0&&i.indexOf(h.type.name)>-1&&h.from0)return null;let d={from:n<0?e-1:e,to:n>0?e+1:e},h=t.doc.iterRange(e,n>0?t.doc.length:0),m=0;for(let g=0;!h.next().done&&g<=i;){let x=h.value;n<0&&(g+=x.length);let y=e+g*n;for(let w=n>0?0:x.length-1,S=n>0?x.length:-1;w!=S;w+=n){let k=a.indexOf(x[w]);if(!(k<0||r.resolveInner(y+w,1).type!=s))if(k%2==0==n>0)m++;else{if(m==1)return{start:d,end:{from:y+w,to:y+w+1},matched:k>>1==c>>1};m--}}n>0&&(g+=x.length)}return h.done?{start:d,matched:!1}:null}function N_(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let a=r;a=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?a.toLowerCase():a,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function Mue(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||Rue,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||E6,mergeTokens:t.mergeTokens!==!1}}function Rue(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 C_=new WeakMap;class C6 extends Sa{constructor(e){let n=Hq(e.languageData),r=Mue(e),s,i=new class extends S6{createParse(a,l,c){return new Pue(s,a,l,c)}};super(n,i,[],e.name),this.topNode=Lue(n,this),s=this,this.streamParser=r,this.stateAfter=new an({perNode:!0}),this.tokenTable=e.tokenTable?new d$(r.tokenTable):Iue}static define(e){return new C6(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=C_.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let a=e.children.length-1;a>=0;a--){let l=e.children[a],c=n+e.positions[a],d=l instanceof ur&&c=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let a=e.positions[i],l=e.children[i],c;if(an&&T6(t,i.tree,0-i.offset,n,l),d;if(c&&c.pos<=r&&(d=l$(t,i.tree,n+i.offset,c.pos+i.offset,!1)))return{state:c.state,tree:d}}return{state:t.streamParser.startState(s?dd(s):4),tree:ur.empty}}let Pue=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=rf.get(),a=s[0].from,{state:l,tree:c}=Due(e,r,a,this.to,i?.state);this.state=l,this.parsedPos=this.chunkStart=a+c.length;for(let d=0;dd.from<=i.viewport.from&&d.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(dd(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=rf.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` `&&(n="");else{let r=n.indexOf(` -`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let a=this.ranges[s].from,l=this.lineAfter(a);n+=l,r=a+l.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let a=this.ranges[++this.rangeIndex].from;n+=a-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let l=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-l}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&a>=0&&this.chunk[a]==e&&this.chunk[a+2]==n?this.chunk[a+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,a=new r$(n,e?e.state.tabSize:4,e?ld(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let l=i$(i.token,a,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+a.start,this.parsedPos+a.pos,s)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const k6=Object.create(null),K0=[si.none],Mue=new hb(K0),S_=[],k_=Object.create(null),a$=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"]])a$[t]=l$(k6,e);class o${constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),a$)}resolve(e){return e?this.table[e]||(this.table[e]=l$(this.extra,e)):0}}const Rue=new o$(k6);function Z4(t,e){S_.indexOf(t)>-1||(S_.push(t),console.warn(e))}function l$(t,e){let n=[];for(let l of e.split(" ")){let c=[];for(let d of l.split(".")){let h=t[d]||ve[d];h?typeof h=="function"?c.length?c=c.map(h):Z4(d,`Modifier ${d} used at start of tag`):c.length?Z4(d,`Tag ${d} used as modifier`):c=Array.isArray(h)?h:[h]:Z4(d,`Unknown highlighting tag ${d}`)}for(let d of c)n.push(d)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(l=>l.id),i=k_[s];if(i)return i.id;let a=k_[s]=si.define({id:K0.length,name:r,props:[x6({[r]:n})]});return K0.push(a),a.id}function Due(t,e){let n=si.define({id:K0.length,name:"Document",props:[Qu.add(()=>t),mb.add(()=>r=>e.getIndent(r))],top:!0});return K0.push(n),n}gr.RTL,gr.LTR;const Pue=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=j6(t.state,n.from);return r.line?zue(t):r.block?Lue(t):!1};function O6(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 zue=O6(que,0),Iue=O6(c$,0),Lue=O6((t,e)=>c$(t,e,Fue(e)),0);function j6(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Hm=50;function Bue(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-Hm,r),a=t.sliceDoc(s,s+Hm),l=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(a)[0].length,d=i.length-l;if(i.slice(d-e.length,d)==e&&a.slice(c,c+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:s+c,margin:c&&1}};let h,m;s-r<=2*Hm?h=m=t.sliceDoc(r,s):(h=t.sliceDoc(r,r+Hm),m=t.sliceDoc(s-Hm,s));let g=/^\s*/.exec(h)[0].length,x=/\s*$/.exec(m)[0].length,y=m.length-x-n.length;return h.slice(g,g+e.length)==e&&m.slice(y,y+n.length)==n?{open:{pos:r+g+e.length,margin:/\s/.test(h.charAt(g+e.length))?1:0},close:{pos:s-x-n.length,margin:/\s/.test(m.charAt(y-1))?1:0}}:null}function Fue(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 c$(t,e,n=e.selection.ranges){let r=n.map(i=>j6(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,a)=>Bue(e,r[a],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,a)=>s[a]?[]:[{from:i.from,insert:r[a].open+" "},{from:i.to,insert:" "+r[a].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let a=0,l;as&&(i==a||a>m.from)){s=m.from;let g=/^\s*/.exec(m.text)[0].length,x=g==m.length,y=m.text.slice(g,g+d.length)==d?g:-1;gi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:l,token:c,indent:d,empty:h,single:m}of r)(m||!h)&&i.push({from:l.from+d,insert:c+" "});let a=e.changes(i);return{changes:a,selection:e.selection.map(a,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:a,comment:l,token:c}of r)if(l>=0){let d=a.from+l,h=d+c.length;a.text[h-a.from]==" "&&h++,i.push({from:d,to:h})}return{changes:i}}return null}const oO=qo.define(),$ue=qo.define(),Hue=at.define(),u$=at.define({combine(t){return $o(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)})}}),d$=Os.define({create(){return Co.empty},update(t,e){let n=e.state.facet(u$),r=e.annotation(oO);if(r){let c=yi.fromTransaction(e,r.selection),d=r.side,h=d==0?t.undone:t.done;return c?h=ey(h,h.length,n.minDepth,c):h=m$(h,e.startState.selection),new Co(d==0?r.rest:h,d==0?h:r.rest)}let s=e.annotation($ue);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(ns.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=yi.fromTransaction(e),a=e.annotation(ns.time),l=e.annotation(ns.userEvent);return i?t=t.addChanges(i,a,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,a,l,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Co(t.done.map(yi.fromJSON),t.undone.map(yi.fromJSON))}});function Que(t={}){return[d$,u$.of(t),Ze.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?h$:e.inputType=="historyRedo"?lO:null;return r?(e.preventDefault(),r(n)):!1}})]}function gb(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(d$,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const h$=gb(0,!1),lO=gb(1,!1),Vue=gb(0,!0),Uue=gb(1,!0);class yi{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 yi(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 yi(e.changes&&us.fromJSON(e.changes),[],e.mapped&&Do.fromJSON(e.mapped),e.startSelection&&Me.fromJSON(e.startSelection),e.selectionsAfter.map(Me.fromJSON))}static fromTransaction(e,n){let r=ya;for(let s of e.startState.facet(Hue)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new yi(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,ya)}static selection(e){return new yi(void 0,ya,void 0,void 0,e)}}function ey(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 Wue(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,a,l)=>{for(let c=0;c=d&&a<=h&&(r=!0)}}),r}function Gue(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function f$(t,e){return t.length?e.length?t.concat(e):t:e}const ya=[],Xue=200;function m$(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Xue));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),ey(t,t.length-1,1e9,n.setSelAfter(r)))}else return[yi.selection([e])]}function Yue(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 J4(t,e){if(!t.length)return t;let n=t.length,r=ya;for(;n;){let s=Kue(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?[yi.selection(r)]:ya}function Kue(t,e,n){let r=f$(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):ya,n);if(!t.changes)return yi.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(i):i;return new yi(s,Ft.mapEffects(t.effects,e),a,t.startSelection.map(i),r)}const Zue=/^(input\.type|delete)($|\.)/;class Co{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 Co(this.done,this.undone):this}addChanges(e,n,r,s,i){let a=this.done,l=a[a.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||Zue.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):xb(n,e))}function Us(t){return t.textDirectionAt(t.state.selection.main.head)==gr.LTR}const g$=t=>p$(t,!Us(t)),x$=t=>p$(t,Us(t));function v$(t,e){return no(t,n=>n.empty?t.moveByGroup(n,e):xb(n,e))}const ede=t=>v$(t,!Us(t)),tde=t=>v$(t,Us(t));function nde(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 vb(t,e,n){let r=Ss(t).resolveInner(e.head),s=n?sn.closedBy:sn.openedBy;for(let c=e.head;;){let d=n?r.childAfter(c):r.childBefore(c);if(!d)break;nde(t,d,s)?r=d:c=n?d.to:d.from}let i=r.type.prop(s),a,l;return i&&(a=n?No(t,r.from,1):No(t,r.to,-1))&&a.matched?l=n?a.end.to:a.end.from:l=n?r.to:r.from,Me.cursor(l,n?-1:1)}const rde=t=>no(t,e=>vb(t.state,e,!Us(t))),sde=t=>no(t,e=>vb(t.state,e,Us(t)));function y$(t,e){return no(t,n=>{if(!n.empty)return xb(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const b$=t=>y$(t,!1),w$=t=>y$(t,!0);function S$(t){let e=t.scrollDOM.clientHeighta.empty?t.moveVertically(a,e,n.height):xb(a,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let a=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,d=l.bottom-n.marginBottom;a&&a.top>c&&a.bottomk$(t,!1),cO=t=>k$(t,!0);function lu(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Me.cursor(r.from+i))}return s}const ide=t=>no(t,e=>lu(t,e,!0)),ade=t=>no(t,e=>lu(t,e,!1)),ode=t=>no(t,e=>lu(t,e,!Us(t))),lde=t=>no(t,e=>lu(t,e,Us(t))),cde=t=>no(t,e=>Me.cursor(t.lineBlockAt(e.head).from,1)),ude=t=>no(t,e=>Me.cursor(t.lineBlockAt(e.head).to,-1));function dde(t,e,n){let r=!1,s=Cf(t.selection,i=>{let a=No(t,i.head,-1)||No(t,i.head,1)||i.head>0&&No(t,i.head-1,1)||i.headdde(t,e);function Pa(t,e){let n=Cf(t.state.selection,r=>{let s=e(r);return Me.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(to(t.state,n)),!0)}function O$(t,e){return Pa(t,n=>t.moveByChar(n,e))}const j$=t=>O$(t,!Us(t)),N$=t=>O$(t,Us(t));function C$(t,e){return Pa(t,n=>t.moveByGroup(n,e))}const fde=t=>C$(t,!Us(t)),mde=t=>C$(t,Us(t)),pde=t=>Pa(t,e=>vb(t.state,e,!Us(t))),gde=t=>Pa(t,e=>vb(t.state,e,Us(t)));function T$(t,e){return Pa(t,n=>t.moveVertically(n,e))}const E$=t=>T$(t,!1),_$=t=>T$(t,!0);function A$(t,e){return Pa(t,n=>t.moveVertically(n,e,S$(t).height))}const j_=t=>A$(t,!1),N_=t=>A$(t,!0),xde=t=>Pa(t,e=>lu(t,e,!0)),vde=t=>Pa(t,e=>lu(t,e,!1)),yde=t=>Pa(t,e=>lu(t,e,!Us(t))),bde=t=>Pa(t,e=>lu(t,e,Us(t))),wde=t=>Pa(t,e=>Me.cursor(t.lineBlockAt(e.head).from)),Sde=t=>Pa(t,e=>Me.cursor(t.lineBlockAt(e.head).to)),C_=({state:t,dispatch:e})=>(e(to(t,{anchor:0})),!0),T_=({state:t,dispatch:e})=>(e(to(t,{anchor:t.doc.length})),!0),E_=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:0})),!0),__=({state:t,dispatch:e})=>(e(to(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),kde=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Ode=({state:t,dispatch:e})=>{let n=yb(t).map(({from:r,to:s})=>Me.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Me.create(n),userEvent:"select"})),!0},jde=({state:t,dispatch:e})=>{let n=Cf(t.selection,r=>{let s=Ss(t),i=s.resolveStack(r.from,1);if(r.empty){let a=s.resolveStack(r.from,-1);a.node.from>=i.node.from&&a.node.to<=i.node.to&&(i=a)}for(let a=i;a;a=a.next){let{node:l}=a;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&a.next)return Me.range(l.to,l.from)}return r});return n.eq(t.selection)?!1:(e(to(t,n)),!0)};function M$(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let a=n.doc.lineAt(i.head);if(e?a.to0)for(let l=i;;){let c=t.moveVertically(l,e);if(c.heada.to){s.some(d=>d.head==c.head)||s.push(c);break}else{if(c.head==l.head)break;l=c}}}return s.length==r.ranges.length?!1:(t.dispatch(to(n,Me.create(s,s.length-1))),!0)}const Nde=t=>M$(t,!1),Cde=t=>M$(t,!0),Tde=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Me.create([n.main]):n.main.empty||(r=Me.create([Me.cursor(n.main.head)])),r?(e(to(t,r)),!0):!1};function Yp(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:a,to:l}=i;if(a==l){let c=e(i);ca&&(n="delete.forward",c=x1(t,c,!0)),a=Math.min(a,c),l=Math.max(l,c)}else a=x1(t,a,!1),l=x1(t,l,!0);return a==l?{range:i}:{changes:{from:a,to:l},range:Me.cursor(a,as(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const R$=(t,e,n)=>Yp(t,r=>{let s=r.from,{state:i}=t,a=i.doc.lineAt(s),l,c;if(n&&!e&&s>a.from&&sR$(t,!1,!0),D$=t=>R$(t,!0,!1),P$=(t,e)=>Yp(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),a=s.charCategorizer(r);for(let l=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let c=zs(i.text,r-i.from,e)+i.from,d=i.text.slice(Math.min(r,c)-i.from,Math.max(r,c)-i.from),h=a(d);if(l!=null&&h!=l)break;(d!=" "||r!=n.head)&&(l=h),r=c}return r}),z$=t=>P$(t,!1),Ede=t=>P$(t,!0),_de=t=>Yp(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headYp(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),Mde=t=>Yp(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:jn.of(["",""])},range:Me.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Dde=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),a=s==i.from?s-1:zs(i.text,s-i.from,!1)+i.from,l=s==i.to?s+1:zs(i.text,s-i.from,!0)+i.from;return{changes:{from:a,to:l,insert:t.doc.slice(s,l).append(t.doc.slice(a,s))},range:Me.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function yb(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let a=e[e.length-1];a.to=i.to,a.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function I$(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of yb(t)){if(n?i.to==t.doc.length:i.from==0)continue;let a=t.doc.lineAt(n?i.to+1:i.from-1),l=a.length+1;if(n){r.push({from:i.to,to:a.to},{from:i.from,insert:a.text+t.lineBreak});for(let c of i.ranges)s.push(Me.range(Math.min(t.doc.length,c.anchor+l),Math.min(t.doc.length,c.head+l)))}else{r.push({from:a.from,to:i.from},{from:i.to,insert:t.lineBreak+a.text});for(let c of i.ranges)s.push(Me.range(c.anchor-l,c.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Me.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Pde=({state:t,dispatch:e})=>I$(t,e,!1),zde=({state:t,dispatch:e})=>I$(t,e,!0);function L$(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of yb(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 Ide=({state:t,dispatch:e})=>L$(t,e,!1),Lde=({state:t,dispatch:e})=>L$(t,e,!0),Bde=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(yb(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let a=t.lineBlockAt(s.head),l=t.coordsAtPos(s.head,s.assoc||1);l&&(i=a.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Fde(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Ss(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(sn.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 A_=B$(!1),qde=B$(!0);function B$(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:a}=s,l=e.doc.lineAt(i),c=!t&&i==a&&Fde(e,i);t&&(i=a=(a<=l.to?l:e.doc.lineAt(a)).to);let d=new fb(e,{simulateBreak:i,simulateDoubleBreak:!!c}),h=v6(d,i);for(h==null&&(h=Nf(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));al.from&&i{let s=[];for(let a=r.from;a<=r.to;){let l=t.doc.lineAt(a);l.number>n&&(r.empty||r.to>l.from)&&(e(l,s,r),n=l.number),a=l.to+1}let i=t.changes(s);return{changes:s,range:Me.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const $de=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new fb(t,{overrideIndentation:i=>{let a=n[i];return a??-1}}),s=N6(t,(i,a,l)=>{let c=v6(r,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let d=/^\s*/.exec(i.text)[0],h=Y0(t,c);(d!=h||l.fromt.readOnly?!1:(e(t.update(N6(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Wp)})}),{userEvent:"input.indent"})),!0),q$=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(N6(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Nf(s,t.tabSize),a=0,l=Y0(t,Math.max(0,i-ld(t)));for(;a(t.setTabFocusMode(),!0),Qde=[{key:"Ctrl-b",run:g$,shift:j$,preventDefault:!0},{key:"Ctrl-f",run:x$,shift:N$},{key:"Ctrl-p",run:b$,shift:E$},{key:"Ctrl-n",run:w$,shift:_$},{key:"Ctrl-a",run:cde,shift:wde},{key:"Ctrl-e",run:ude,shift:Sde},{key:"Ctrl-d",run:D$},{key:"Ctrl-h",run:uO},{key:"Ctrl-k",run:_de},{key:"Ctrl-Alt-h",run:z$},{key:"Ctrl-o",run:Rde},{key:"Ctrl-t",run:Dde},{key:"Ctrl-v",run:cO}],Vde=[{key:"ArrowLeft",run:g$,shift:j$,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ede,shift:fde,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:ode,shift:yde,preventDefault:!0},{key:"ArrowRight",run:x$,shift:N$,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:tde,shift:mde,preventDefault:!0},{mac:"Cmd-ArrowRight",run:lde,shift:bde,preventDefault:!0},{key:"ArrowUp",run:b$,shift:E$,preventDefault:!0},{mac:"Cmd-ArrowUp",run:C_,shift:E_},{mac:"Ctrl-ArrowUp",run:O_,shift:j_},{key:"ArrowDown",run:w$,shift:_$,preventDefault:!0},{mac:"Cmd-ArrowDown",run:T_,shift:__},{mac:"Ctrl-ArrowDown",run:cO,shift:N_},{key:"PageUp",run:O_,shift:j_},{key:"PageDown",run:cO,shift:N_},{key:"Home",run:ade,shift:vde,preventDefault:!0},{key:"Mod-Home",run:C_,shift:E_},{key:"End",run:ide,shift:xde,preventDefault:!0},{key:"Mod-End",run:T_,shift:__},{key:"Enter",run:A_,shift:A_},{key:"Mod-a",run:kde},{key:"Backspace",run:uO,shift:uO,preventDefault:!0},{key:"Delete",run:D$,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:z$,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Ede,preventDefault:!0},{mac:"Mod-Backspace",run:Ade,preventDefault:!0},{mac:"Mod-Delete",run:Mde,preventDefault:!0}].concat(Qde.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Ude=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:rde,shift:pde},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:sde,shift:gde},{key:"Alt-ArrowUp",run:Pde},{key:"Shift-Alt-ArrowUp",run:Ide},{key:"Alt-ArrowDown",run:zde},{key:"Shift-Alt-ArrowDown",run:Lde},{key:"Mod-Alt-ArrowUp",run:Nde},{key:"Mod-Alt-ArrowDown",run:Cde},{key:"Escape",run:Tde},{key:"Mod-Enter",run:qde},{key:"Alt-l",mac:"Ctrl-l",run:Ode},{key:"Mod-i",run:jde,preventDefault:!0},{key:"Mod-[",run:q$},{key:"Mod-]",run:F$},{key:"Mod-Alt-\\",run:$de},{key:"Shift-Mod-k",run:Bde},{key:"Shift-Mod-\\",run:hde},{key:"Mod-/",run:Pue},{key:"Alt-A",run:Iue},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Hde}].concat(Vde),Wde={key:"Tab",run:F$,shift:q$},M_=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class af{constructor(e,n,r=0,s=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?l=>i(M_(l)):M_,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 gi(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=Zj(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=wo(e);let s=this.normalize(n);if(s.length)for(let i=0,a=r;;i++){let l=s.charCodeAt(i),c=this.match(l,a,this.bufferPos+this.bufferStart);if(i==s.length-1){if(c)return this.value=c,this;break}a==r&&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=ty(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 l=new Ih(n,e.sliceString(n,r));return eS.set(e,l),l}if(s.from==n&&s.to==r)return s;let{text:i,from:a}=s;return a>n&&(i=e.sliceString(n,a)+i,a=n),s.to=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=ty(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ih.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(H$.prototype[Symbol.iterator]=Q$.prototype[Symbol.iterator]=function(){return this});function Gde(t){try{return new RegExp(t,C6),!0}catch{return!1}}function ty(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function dO(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=sr("input",{class:"cm-textfield",name:"line",value:e}),r=sr("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:N0.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},sr("label",t.state.phrase("Go to line"),": ",n)," ",sr("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),sr("button",{name:"close",onclick:()=>{t.dispatch({effects:N0.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:a}=t,l=a.doc.lineAt(a.selection.main.head),[,c,d,h,m]=i,g=h?+h.slice(1):0,x=d?+d:l.number;if(d&&m){let S=x/100;c&&(S=S*(c=="-"?-1:1)+l.number/a.doc.lines),x=Math.round(a.doc.lines*S)}else d&&c&&(x=x*(c=="-"?-1:1)+l.number);let y=a.doc.line(Math.max(1,Math.min(a.doc.lines,x))),w=Me.cursor(y.from+Math.max(0,Math.min(g,y.length)));t.dispatch({effects:[N0.of(!1),Ze.scrollIntoView(w.from,{y:"center"})],selection:w}),t.focus()}return{dom:r}}const N0=Ft.define(),R_=Os.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(N0)&&(t=n.value);return t},provide:t=>U0.from(t,e=>e?dO:null)}),Xde=t=>{let e=V0(t,dO);if(!e){let n=[N0.of(!0)];t.state.field(R_,!1)==null&&n.push(Ft.appendConfig.of([R_,Yde])),t.dispatch({effects:n}),e=V0(t,dO)}return e&&e.dom.querySelector("input").select(),!0},Yde=Ze.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"}}}),Kde={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Zde=at.define({combine(t){return $o(t,Kde,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Jde(t){return[she,rhe]}const ehe=kt.mark({class:"cm-selectionMatch"}),the=kt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function D_(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=wr.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=wr.Word)}function nhe(t,e,n,r){return t(e.sliceDoc(n,n+1))==wr.Word&&t(e.sliceDoc(r-1,r))==wr.Word}const rhe=Vr.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(Zde),{state:n}=t,r=n.selection;if(r.ranges.length>1)return kt.none;let s=r.main,i,a=null;if(s.empty){if(!e.highlightWordAroundCursor)return kt.none;let c=n.wordAt(s.head);if(!c)return kt.none;a=n.charCategorizer(s.head),i=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c200)return kt.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),a=n.charCategorizer(s.head),!(D_(a,n,s.from,s.to)&&nhe(a,n,s.from,s.to)))return kt.none}else if(i=n.sliceDoc(s.from,s.to),!i)return kt.none}let l=[];for(let c of t.visibleRanges){let d=new af(n.doc,i,c.from,c.to);for(;!d.next().done;){let{from:h,to:m}=d.value;if((!a||D_(a,n,h,m))&&(s.empty&&h<=s.from&&m>=s.to?l.push(the.range(h,m)):(h>=s.to||m<=s.from)&&l.push(ehe.range(h,m)),l.length>e.maxMatches))return kt.none}}return kt.set(l)}},{decorations:t=>t.decorations}),she=Ze.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ihe=({state:t,dispatch:e})=>{let{selection:n}=t,r=Me.create(n.ranges.map(s=>t.wordAt(s.head)||Me.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function ahe(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let a=!1,l=new af(t.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(a)return null;l=new af(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(c=>c.from==l.value.from))continue;if(i){let c=t.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const ohe=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return ihe({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=ahe(t,r);return s?(e(t.update({selection:t.selection.addRange(Me.range(s.from,s.to),!1),effects:Ze.scrollIntoView(s.to)})),!0):!1},Tf=at.define({combine(t){return $o(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new yhe(e),scrollToMatch:e=>Ze.scrollIntoView(e)})}});class V${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||Gde(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 dhe(this):new che(this)}getCursor(e,n=0,r){let s=e.doc?e:wn.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?bh(this,s,n,r):yh(this,s,n,r)}}class U${constructor(e){this.spec=e}}function yh(t,e,n,r){return new af(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?lhe(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function lhe(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=yh(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 bh(t,e,n,r){return new H$(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?uhe(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function ny(t,e){return t.slice(zs(t,e,!1),e)}function ry(t,e){return t.slice(e,zs(t,e))}function uhe(t){return(e,n,r)=>!r[0].length||(t(ny(r.input,r.index))!=wr.Word||t(ry(r.input,r.index))!=wr.Word)&&(t(ry(r.input,r.index+r[0].length))!=wr.Word||t(ny(r.input,r.index+r[0].length))!=wr.Word)}class dhe extends U${nextMatch(e,n,r){let s=bh(this.spec,e,r,e.doc.length).next();return s.done&&(s=bh(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),a=bh(this.spec,e,i,r),l=null;for(;!a.next().done;)l=a.value;if(l&&(i==n||l.from>i+10))return l;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=bh(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 Z0=Ft.define(),T6=Ft.define(),$c=Os.define({create(t){return new tS(hO(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Z0)?t=new tS(n.value.create(),t.panel):n.is(T6)&&(t=new tS(t.query,n.value?E6:null));return t},provide:t=>U0.from(t,e=>e.panel)});class tS{constructor(e,n){this.query=e,this.panel=n}}const hhe=kt.mark({class:"cm-searchMatch"}),fhe=kt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),mhe=Vr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field($c))}update(t){let e=t.state.field($c);(e!=t.startState.field($c)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return kt.none;let{view:n}=this,r=new ql;for(let s=0,i=n.visibleRanges,a=i.length;si[s+1].from-500;)c=i[++s].to;t.highlight(n.state,l,c,(d,h)=>{let m=n.state.selection.ranges.some(g=>g.from==d&&g.to==h);r.add(d,h,m?fhe:hhe)})}return r.finish()}},{decorations:t=>t.decorations});function Kp(t){return e=>{let n=e.state.field($c,!1);return n&&n.query.spec.valid?t(e,n):X$(e)}}const sy=Kp((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Me.single(r.from,r.to),i=t.state.facet(Tf);return t.dispatch({selection:s,effects:[_6(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),G$(t),!0}),iy=Kp((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Me.single(s.from,s.to),a=t.state.facet(Tf);return t.dispatch({selection:i,effects:[_6(t,s),a.scrollToMatch(i.main,t)],userEvent:"select.search"}),G$(t),!0}),phe=Kp((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Me.create(n.map(r=>Me.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),ghe=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],a=0;for(let l=new af(t.doc,t.sliceDoc(r,s));!l.next().done;){if(i.length>1e3)return!1;l.value.from==r&&(a=i.length),i.push(Me.range(l.value.from,l.value.to))}return e(t.update({selection:Me.create(i,a),userEvent:"select.search.matches"})),!0},P_=Kp((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let a=i,l=[],c,d,h=[];a.from==r&&a.to==s&&(d=n.toText(e.getReplacement(a)),l.push({from:a.from,to:a.to,insert:d}),a=e.nextMatch(n,a.from,a.to),h.push(Ze.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let m=t.state.changes(l);return a&&(c=Me.single(a.from,a.to).map(m),h.push(_6(t,a)),h.push(n.facet(Tf).scrollToMatch(c.main,t))),t.dispatch({changes:m,selection:c,effects:h,userEvent:"input.replace"}),!0}),xhe=Kp((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:a}=s;return{from:i,to:a,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:Ze.announce.of(r),userEvent:"input.replace.all"}),!0});function E6(t){return t.state.facet(Tf).createPanel(t)}function hO(t,e){var n,r,s,i,a;let l=t.selection.main,c=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!c)return e;let d=t.facet(Tf);return new V$({search:((n=e?.literal)!==null&&n!==void 0?n:d.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:d.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:d.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:d.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:d.wholeWord})}function W$(t){let e=V0(t,E6);return e&&e.dom.querySelector("[main-field]")}function G$(t){let e=W$(t);e&&e==t.root.activeElement&&e.select()}const X$=t=>{let e=t.state.field($c,!1);if(e&&e.panel){let n=W$(t);if(n&&n!=t.root.activeElement){let r=hO(t.state,e.query.spec);r.valid&&t.dispatch({effects:Z0.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[T6.of(!0),e?Z0.of(hO(t.state,e.query.spec)):Ft.appendConfig.of(whe)]});return!0},Y$=t=>{let e=t.state.field($c,!1);if(!e||!e.panel)return!1;let n=V0(t,E6);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:T6.of(!1)}),!0},vhe=[{key:"Mod-f",run:X$,scope:"editor search-panel"},{key:"F3",run:sy,shift:iy,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:sy,shift:iy,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Y$,scope:"editor search-panel"},{key:"Mod-Shift-l",run:ghe},{key:"Mod-Alt-g",run:Xde},{key:"Mod-d",run:ohe,preventDefault:!0}];class yhe{constructor(e){this.view=e;let n=this.query=e.state.field($c).query.spec;this.commit=this.commit.bind(this),this.searchField=sr("input",{value:n.search,placeholder:Li(e,"Find"),"aria-label":Li(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=sr("input",{value:n.replace,placeholder:Li(e,"Replace"),"aria-label":Li(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=sr("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=sr("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=sr("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,a){return sr("button",{class:"cm-button",name:s,onclick:i,type:"button"},a)}this.dom=sr("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>sy(e),[Li(e,"next")]),r("prev",()=>iy(e),[Li(e,"previous")]),r("select",()=>phe(e),[Li(e,"all")]),sr("label",null,[this.caseField,Li(e,"match case")]),sr("label",null,[this.reField,Li(e,"regexp")]),sr("label",null,[this.wordField,Li(e,"by word")]),...e.state.readOnly?[]:[sr("br"),this.replaceField,r("replace",()=>P_(e),[Li(e,"replace")]),r("replaceAll",()=>xhe(e),[Li(e,"replace all")])],sr("button",{name:"close",onclick:()=>Y$(e),"aria-label":Li(e,"close"),type:"button"},["×"])])}commit(){let e=new V$({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:Z0.of(e)}))}keydown(e){Ole(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?iy:sy)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),P_(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Z0)&&!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(Tf).top}}function Li(t,e){return t.state.phrase(e)}const v1=30,y1=/[\s\.,:;?!]/;function _6(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-v1),a=Math.min(s,n+v1),l=t.state.sliceDoc(i,a);if(i!=r.from){for(let c=0;cl.length-v1;c--)if(!y1.test(l[c-1])&&y1.test(l[c])){l=l.slice(0,c);break}}return Ze.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${r.number}.`)}const bhe=Ze.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"}}),whe=[$c,ou.low(mhe),bhe];class K${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=Ss(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(J$(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 z_(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 She(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+$/]:She(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function khe(t,e){return n=>{for(let r=Ss(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 I_=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function ed(t){return t.selection.main.from}function J$(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 A6=qo.define();function Ohe(t,e,n,r){let{main:s}=t.selection,i=n-s.from,a=r-s.from;return{...t.changeByRange(l=>{if(l!=s&&n!=r&&t.sliceDoc(l.from+i,l.from+a)!=t.sliceDoc(n,r))return{range:l};let c=t.toText(e);return{changes:{from:l.from+i,to:r==s.from?l.to:l.from+a,insert:c},range:Me.cursor(l.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const L_=new WeakMap;function jhe(t){if(!Array.isArray(t))return t;let e=L_.get(t);return e||L_.set(t,e=Z$(t)),e}const ay=Ft.define(),J0=Ft.define();class Nhe{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&E<=57||E>=97&&E<=122?2:E>=65&&E<=90?1:0:(_=Zj(E))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!j||A==1&&S||T==0&&A!=0)&&(n[m]==E||r[m]==E&&(g=!0)?a[m++]=j:a.length&&(k=!1)),T=A,j+=wo(E)}return m==c&&a[0]==0&&k?this.result(-100+(g?-200:0),a,e):x==c&&y==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):x==c?this.ret(-900-e.length,[y,w]):m==c?this.result(-100+(g?-200:0)+-700+(k?0:-1100),a,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let a of n){let l=a+(this.astral?wo(gi(r,a)):1);i&&s[i-1]==a?s[i-1]=l:(s[i++]=a,s[i++]=l)}return this.ret(e-r.length,s)}}class Che{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:The,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=>B_(e(r),n(r)),optionClass:(e,n)=>r=>B_(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function B_(t,e){return t?e?t+" "+e:t:e}function The(t,e,n,r,s,i){let a=t.textDirection==gr.RTL,l=a,c=!1,d="top",h,m,g=e.left-s.left,x=s.right-e.right,y=r.right-r.left,w=r.bottom-r.top;if(l&&g=w||j>e.top?h=n.bottom-e.top:(d="bottom",h=e.bottom-n.top)}let S=(e.bottom-e.top)/i.offsetHeight,k=(e.right-e.left)/i.offsetWidth;return{style:`${d}: ${h/S}px; max-width: ${m/k}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":l?"left":"right")}}function Ehe(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let a=document.createElement("span");a.className="cm-completionLabel";let l=n.displayLabel||n.label,c=0;for(let d=0;dc&&a.appendChild(document.createTextNode(l.slice(c,h)));let g=a.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(l.slice(h,m))),g.className="cm-completionMatchedText",c=m}return cn.position-r.position).map(n=>n.render)}function nS(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 _he{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:a}=s.open,l=e.state.facet(bs);this.optionContent=Ehe(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=nS(i.length,a,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",c=>{let{options:d}=e.state.field(n).open;for(let h=c.target,m;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(m=/-(\d+)$/.exec(h.id))&&+m[1]{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(bs).closeOnBlur&&c.relatedTarget!=e.contentDOM&&e.dispatch({effects:J0.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:a,disabled:l}=r.open;(!s.open||s.open.options!=i)&&(this.range=nS(i.length,a,e.state.facet(bs).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),l!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=nS(n.options.length,n.selected,this.view.state.facet(bs).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let a=typeof i=="string"?document.createTextNode(i):i(s);if(!a)return;"then"in a?a.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>vi(this.view.state,l,"completion info")):(this.addInfoPane(a,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&Mhe(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let a=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{a.target==s&&a.preventDefault()});let i=null;for(let a=r.from;ar.from||r.from==0))if(i=g,typeof d!="string"&&d.header)s.appendChild(d.header(d));else{let x=s.appendChild(document.createElement("completion-section"));x.textContent=g}}const h=s.appendChild(document.createElement("li"));h.id=n+"-"+a,h.setAttribute("role","option");let m=this.optionClass(l);m&&(h.className=m);for(let g of this.optionContent){let x=g(l,this.view.state,this.view,c);x&&h.appendChild(x)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew _he(n,t,e)}function Mhe(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 F_(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Rhe(t,e){let n=[],r=null,s=null,i=h=>{n.push(h);let{section:m}=h.completion;if(m){r||(r=[]);let g=typeof m=="string"?m:m.name;r.some(x=>x.name==g)||r.push(typeof m=="string"?{name:g}:m)}},a=e.facet(bs);for(let h of t)if(h.hasResult()){let m=h.result.getMatch;if(h.result.filter===!1)for(let g of h.result.options)i(new I_(g,h.source,m?m(g):[],1e9-n.length));else{let g=e.sliceDoc(h.from,h.to),x,y=a.filterStrict?new Che(g):new Nhe(g);for(let w of h.result.options)if(x=y.match(w.label)){let S=w.displayLabel?m?m(w,x.matched):[]:x.matched,k=x.score+(w.boost||0);if(i(new I_(w,h.source,S,k)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:j}=w.section;s||(s=Object.create(null)),s[j]=Math.max(k,s[j]||-1e9)}}}}if(r){let h=Object.create(null),m=0,g=(x,y)=>(x.rank==="dynamic"&&y.rank==="dynamic"?s[y.name]-s[x.name]:0)||(typeof x.rank=="number"?x.rank:1e9)-(typeof y.rank=="number"?y.rank:1e9)||(x.nameg.score-m.score||d(m.completion,g.completion))){let m=h.completion;!c||c.label!=m.label||c.detail!=m.detail||c.type!=null&&m.type!=null&&c.type!=m.type||c.apply!=m.apply||c.boost!=m.boost?l.push(h):F_(h.completion)>F_(c)&&(l[l.length-1]=h),c=h.completion}return l}class Th{constructor(e,n,r,s,i,a){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=a}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Th(this.options,q_(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,a){if(s&&!a&&e.some(d=>d.isPending))return s.setDisabled();let l=Rhe(e,n);if(!l.length)return s&&e.some(d=>d.isPending)?s.setDisabled():null;let c=n.facet(bs).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let d=s.options[s.selected].completion;for(let h=0;hh.hasResult()?Math.min(d,h.from):d,1e8),create:Bhe,above:i.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(e){return new Th(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Th(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class oy{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new oy(Ihe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(bs),i=(r.override||n.languageDataAt("autocomplete",ed(n)).map(jhe)).map(c=>(this.active.find(h=>h.source==c)||new ba(c,this.active.some(h=>h.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((c,d)=>c==this.active[d])&&(i=this.active);let a=this.open,l=e.effects.some(c=>c.is(M6));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||i.some(c=>c.hasResult()&&e.changes.touchesRange(c.from,c.to))||!Dhe(i,this.active)||l?a=Th.build(i,n,this.id,a,r,l):a&&a.disabled&&!i.some(c=>c.isPending)&&(a=null),!a&&i.every(c=>!c.isPending)&&i.some(c=>c.hasResult())&&(i=i.map(c=>c.hasResult()?new ba(c.source,0):c));for(let c of e.effects)c.is(tH)&&(a=a&&a.setSelected(c.value,this.id));return i==this.active&&a==this.open?this:new oy(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Phe:zhe}}function Dhe(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const Ihe=[];function eH(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(A6);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 ba{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=eH(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new ba(s.source,0)),r&4&&s.state==0&&(s=new ba(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(ay))s=new ba(s.source,1,i.value);else if(i.is(J0))s=new ba(s.source,0);else if(i.is(M6))for(let a of i.value)a.source==s.source&&(s=a);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(ed(e.state))}}class Lh extends ba{constructor(e,n,r,s,i,a){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=a}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),l=ed(e.state);if(l>a||!s||n&2&&(ed(e.startState)==this.from||ln.map(e))}}),tH=Ft.define(),xi=Os.define({create(){return oy.start()},update(t,e){return t.update(e)},provide:t=>[h6.from(t,e=>e.tooltip),Ze.contentAttributes.from(t,e=>e.attrs)]});function R6(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(xi).active.find(s=>s.source==e.source);return r instanceof Lh?(typeof n=="string"?t.dispatch({...Ohe(t.state,n,r.from,r.to),annotations:A6.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const Bhe=Ahe(xi,R6);function b1(t,e="option"){return n=>{let r=n.state.field(xi,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:a-1;return l<0?l=e=="page"?0:a-1:l>=a&&(l=e=="page"?a-1:0),n.dispatch({effects:tH.of(l)}),!0}}const Fhe=t=>{let e=t.state.field(xi,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(xi,!1)?(t.dispatch({effects:ay.of(!0)}),!0):!1,qhe=t=>{let e=t.state.field(xi,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:J0.of(null)}),!0)};class $he{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Hhe=50,Qhe=1e3,Vhe=Vr.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(xi).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(xi),n=t.state.facet(bs);if(!t.selectionSet&&!t.docChanged&&t.startState.field(xi)==e)return;let r=t.transactions.some(i=>{let a=eH(i,n);return a&8||(i.selection||i.docChanged)&&!(a&3)});for(let i=0;iHhe&&Date.now()-a.time>Qhe){for(let l of a.context.abortListeners)try{l()}catch(c){vi(this.view.state,c)}a.context.abortListeners=null,this.running.splice(i--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(a=>a.is(ay)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(a=>a.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(xi);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(bs).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=ed(e),r=new K$(e,n,t.explicit,this.view),s=new $he(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:J0.of(null)}),vi(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(bs).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(bs),r=this.view.state.field(xi);for(let s=0;sl.source==i.active.source);if(a&&a.isPending)if(i.done==null){let l=new ba(i.active.source,0);for(let c of i.updates)l=l.update(c,n);l.isPending||e.push(l)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:M6.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(xi,!1);if(e&&e.tooltip&&this.view.state.facet(bs).closeOnBlur){let n=e.open&&Eq(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:J0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:ay.of(!1)}),20),this.composing=0}}}),Uhe=typeof navigator=="object"&&/Win/.test(navigator.platform),Whe=ou.highest(Ze.domEventHandlers({keydown(t,e){let n=e.state.field(xi,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Uhe&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(a=>a.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&R6(e,r),!1}})),nH=Ze.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 Ghe{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class D6{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ds.TrackDel),r=e.mapPos(this.to,1,Ds.TrackDel);return n==null||r==null?null:new D6(this.field,n,r)}}class P6{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),a=/^\s*/.exec(i.text)[0];for(let c of this.lines){if(r.length){let d=a,h=/^\t*/.exec(c)[0].length;for(let m=0;mnew D6(c.field,s[c.line]+c.from,s[c.line]+c.to));return{text:r,ranges:l}}static parse(e){let n=[],r=[],s=[],i;for(let a of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let l=i[1]?+i[1]:null,c=i[2]||i[3]||"",d=-1,h=c.replace(/\\[{}]/g,m=>m[1]);for(let m=0;m=d&&g.field++}for(let m of s)if(m.line==r.length&&m.from>i.index){let g=i[2]?3+(i[1]||"").length:2;m.from-=g,m.to-=g}s.push(new Ghe(d,r.length,i.index,i.index+h.length)),a=a.slice(0,i.index)+c+a.slice(i.index+i[0].length)}a=a.replace(/\\([{}])/g,(l,c,d)=>{for(let h of s)h.line==r.length&&h.from>d&&(h.from--,h.to--);return c}),r.push(a)}return new P6(r,s)}}let Xhe=kt.widget({widget:new class extends Ho{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Yhe=kt.mark({class:"cm-snippetField"});class Ef{constructor(e,n){this.ranges=e,this.active=n,this.deco=kt.set(e.map(r=>(r.from==r.to?Xhe:Yhe).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 Ef(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 Zp=Ft.define({map(t,e){return t&&t.map(e)}}),Khe=Ft.define(),ep=Os.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(Zp))return n.value;if(n.is(Khe)&&t)return new Ef(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=>Ze.decorations.from(t,e=>e?e.deco:kt.none)});function z6(t,e){return Me.create(t.filter(n=>n.field==e).map(n=>Me.range(n.from,n.to)))}function Zhe(t){let e=P6.parse(t);return(n,r,s,i)=>{let{text:a,ranges:l}=e.instantiate(n.state,s),{main:c}=n.state.selection,d={changes:{from:s,to:i==c.from?c.to:i,insert:jn.of(a)},scrollIntoView:!0,annotations:r?[A6.of(r),ns.userEvent.of("input.complete")]:void 0};if(l.length&&(d.selection=z6(l,0)),l.some(h=>h.field>0)){let h=new Ef(l,0),m=d.effects=[Zp.of(h)];n.state.field(ep,!1)===void 0&&m.push(Ft.appendConfig.of([ep,rfe,sfe,nH]))}n.dispatch(n.state.update(d))}}function rH(t){return({state:e,dispatch:n})=>{let r=e.field(ep,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(a=>a.field==s+t);return n(e.update({selection:z6(r.ranges,s),effects:Zp.of(i?null:new Ef(r.ranges,s)),scrollIntoView:!0})),!0}}const Jhe=({state:t,dispatch:e})=>t.field(ep,!1)?(e(t.update({effects:Zp.of(null)})),!0):!1,efe=rH(1),tfe=rH(-1),nfe=[{key:"Tab",run:efe,shift:tfe},{key:"Escape",run:Jhe}],$_=at.define({combine(t){return t.length?t[0]:nfe}}),rfe=ou.highest(Vp.compute([$_],t=>t.facet($_)));function vl(t,e){return{...e,apply:Zhe(t)}}const sfe=Ze.domEventHandlers({mousedown(t,e){let n=e.state.field(ep,!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:z6(n.ranges,s.field),effects:Zp.of(n.ranges.some(i=>i.field>s.field)?new Ef(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),tp={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Vu=Ft.define({map(t,e){let n=e.mapPos(t,-1,Ds.TrackAfter);return n??void 0}}),I6=new class extends sd{};I6.startSide=1;I6.endSide=-1;const sH=Os.define({create(){return Rn.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Vu)&&(t=t.update({add:[I6.range(n.value,n.value+1)]}));return t}});function ife(){return[ofe,sH]}const sS="()[]{}<>«»»«[]{}";function iH(t){for(let e=0;e{if((afe?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&wo(gi(r,0))==1||e!=s.from||n!=s.to)return!1;let i=ufe(t.state,r);return i?(t.dispatch(i),!0):!1}),lfe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=aH(t,t.selection.main.head).brackets||tp.brackets,s=null,i=t.changeByRange(a=>{if(a.empty){let l=dfe(t.doc,a.head);for(let c of r)if(c==l&&bb(t.doc,a.head)==iH(gi(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:Me.cursor(a.head-c.length)}}return{range:s=a}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},cfe=[{key:"Backspace",run:lfe}];function ufe(t,e){let n=aH(t,t.selection.main.head),r=n.brackets||tp.brackets;for(let s of r){let i=iH(gi(s,0));if(e==s)return i==s?mfe(t,s,r.indexOf(s+s+s)>-1,n):hfe(t,s,i,n.before||tp.before);if(e==i&&oH(t,t.selection.main.from))return ffe(t,s,i)}return null}function oH(t,e){let n=!1;return t.field(sH).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function bb(t,e){let n=t.sliceString(e,e+2);return n.slice(0,wo(gi(n,0)))}function dfe(t,e){let n=t.sliceString(e-2,e);return wo(gi(n,0))==n.length?n:n.slice(1)}function hfe(t,e,n,r){let s=null,i=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:n,from:a.to}],effects:Vu.of(a.to+e.length),range:Me.range(a.anchor+e.length,a.head+e.length)};let l=bb(t.doc,a.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:a.head},effects:Vu.of(a.head+e.length),range:Me.cursor(a.head+e.length)}:{range:s=a}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function ffe(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&bb(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Me.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function mfe(t,e,n,r){let s=r.stringPrefixes||tp.stringPrefixes,i=null,a=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Vu.of(l.to+e.length),range:Me.range(l.anchor+e.length,l.head+e.length)};let c=l.head,d=bb(t.doc,c),h;if(d==e){if(H_(t,c))return{changes:{insert:e+e,from:c},effects:Vu.of(c+e.length),range:Me.cursor(c+e.length)};if(oH(t,c)){let g=n&&t.sliceDoc(c,c+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:c,to:c+g.length,insert:g},range:Me.cursor(c+g.length)}}}else{if(n&&t.sliceDoc(c-2*e.length,c)==e+e&&(h=Q_(t,c-2*e.length,s))>-1&&H_(t,h))return{changes:{insert:e+e+e+e,from:c},effects:Vu.of(c+e.length),range:Me.cursor(c+e.length)};if(t.charCategorizer(c)(d)!=wr.Word&&Q_(t,c,s)>-1&&!pfe(t,c,e,s))return{changes:{insert:e+e,from:c},effects:Vu.of(c+e.length),range:Me.cursor(c+e.length)}}return{range:i=l}});return i?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function H_(t,e){let n=Ss(t).resolveInner(e+1);return n.parent&&n.from==e}function pfe(t,e,n,r){let s=Ss(t).resolveInner(e,-1),i=r.reduce((a,l)=>Math.max(a,l.length),0);for(let a=0;a<5;a++){let l=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),c=l.indexOf(n);if(!c||c>-1&&r.indexOf(l.slice(0,c))>-1){let h=s.firstChild;for(;h&&h.from==s.from&&h.to-h.from>n.length+c;){if(t.sliceDoc(h.to-n.length,h.to)==n)return!1;h=h.firstChild}return!0}let d=s.to==e&&s.parent;if(!d)break;s=d}return!1}function Q_(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=wr.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))!=wr.Word)return i}return-1}function gfe(t={}){return[Whe,xi,bs.of(t),Vhe,xfe,nH]}const lH=[{key:"Ctrl-Space",run:rS},{mac:"Alt-`",run:rS},{mac:"Alt-i",run:rS},{key:"Escape",run:qhe},{key:"ArrowDown",run:b1(!0)},{key:"ArrowUp",run:b1(!1)},{key:"PageDown",run:b1(!0,"page")},{key:"PageUp",run:b1(!1,"page")},{key:"Enter",run:Fhe}],xfe=ou.highest(Vp.computeN([bs],t=>t.facet(bs).defaultKeymap?[lH]:[]));class V_{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class qu{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(np).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((x,y)=>x.from-y.from||x.to-y.to),a=new ql,l=[],c=0,d=r.doc.iter(),h=0,m=r.doc.length;for(let x=0;;){let y=x==i.length?null:i[x];if(!y&&!l.length)break;let w,S;if(l.length)w=c,S=l.reduce((N,T)=>Math.min(N,T.to),y&&y.from>w?y.from:1e8);else{if(w=y.from,w>m)break;S=y.to,l.push(y),x++}for(;xN.from||N.to==w))l.push(N),x++,S=Math.min(N.to,S);else{S=Math.min(N.from,S);break}}S=Math.min(S,m);let k=!1;if(l.some(N=>N.from==w&&(N.to==S||S==m))&&(k=w==S,!k&&S-w<10)){let N=w-(h+d.value.length);N>0&&(d.next(N),h=w);for(let T=w;;){if(T>=S){k=!0;break}if(!d.lineBreak&&h+d.value.length>T)break;T=h+d.value.length,h+=d.value.length,d.next()}}let j=_fe(l);if(k)a.add(w,w,kt.widget({widget:new Nfe(j),diagnostics:l.slice()}));else{let N=l.reduce((T,E)=>E.markClass?T+" "+E.markClass:T,"");a.add(w,S,kt.mark({class:"cm-lintRange cm-lintRange-"+j+N,diagnostics:l.slice(),inclusiveEnd:l.some(T=>T.to>S)}))}if(c=S,c==m)break;for(let N=0;N{if(!(e&&a.diagnostics.indexOf(e)<0))if(!r)r=new V_(s,i,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new V_(r.from,i,r.diagnostic)}}),r}function vfe(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(np).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is(cH))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function yfe(t,e){return t.field(Vi,!1)?e:e.concat(Ft.appendConfig.of(Afe))}const cH=Ft.define(),L6=Ft.define(),uH=Ft.define(),Vi=Os.define({create(){return new qu(kt.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=of(n,t.selected.diagnostic,i)||of(n,null,i)}!n.size&&s&&e.state.facet(np).autoPanel&&(s=null),t=new qu(n,s,r)}for(let n of e.effects)if(n.is(cH)){let r=e.state.facet(np).autoPanel?n.value.length?rp.open:null:t.panel;t=qu.init(n.value,r,e.state)}else n.is(L6)?t=new qu(t.diagnostics,n.value?rp.open:null,t.selected):n.is(uH)&&(t=new qu(t.diagnostics,t.panel,n.value));return t},provide:t=>[U0.from(t,e=>e.panel),Ze.decorations.from(t,e=>e.diagnostics)]}),bfe=kt.mark({class:"cm-lintRange cm-lintRange-active"});function wfe(t,e,n){let{diagnostics:r}=t.state.field(Vi),s,i=-1,a=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(c,d,{spec:h})=>{if(e>=c&&e<=d&&(c==d||(e>c||n>0)&&(ehH(t,n,!1)))}const kfe=t=>{let e=t.state.field(Vi,!1);(!e||!e.panel)&&t.dispatch({effects:yfe(t.state,[L6.of(!0)])});let n=V0(t,rp.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},U_=t=>{let e=t.state.field(Vi,!1);return!e||!e.panel?!1:(t.dispatch({effects:L6.of(!1)}),!0)},Ofe=t=>{let e=t.state.field(Vi,!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)},jfe=[{key:"Mod-Shift-m",run:kfe,preventDefault:!0},{key:"F8",run:Ofe}],np=at.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...$o(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:W_,tooltipFilter:W_,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 W_(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function dH(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 hH(t,e,n){var r;let s=n?dH(e.actions):[];return sr("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},sr("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,a)=>{let l=!1,c=x=>{if(x.preventDefault(),l)return;l=!0;let y=of(t.state.field(Vi).diagnostics,e);y&&i.apply(t,y.from,y.to)},{name:d}=i,h=s[a]?d.indexOf(s[a]):-1,m=h<0?d:[d.slice(0,h),sr("u",d.slice(h,h+1)),d.slice(h+1)],g=i.markClass?" "+i.markClass:"";return sr("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:c,onmousedown:c,"aria-label":` Action: ${d}${h<0?"":` (access key "${s[a]})"`}.`},m)}),e.source&&sr("div",{class:"cm-diagnosticSource"},e.source))}class Nfe extends Ho{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return sr("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class G_{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=hH(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class rp{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)U_(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],a=dH(i.actions);for(let l=0;l{for(let i=0;iU_(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Vi).selected;if(!e)return-1;for(let n=0;n{for(let h of d.diagnostics){if(a.has(h))continue;a.add(h);let m=-1,g;for(let x=r;xr&&(this.items.splice(r,m-r),s=!0)),n&&g.diagnostic==n.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),i=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let d=c.height/this.list.offsetHeight;l.topc.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/d)}})):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(Vi),r=of(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:uH.of(r)})}static open(e){return new rp(e)}}function Cfe(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function w1(t){return Cfe(``,'width="6" height="3"')}const Tfe=Ze.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:w1("#d11")},".cm-lintRange-warning":{backgroundImage:w1("orange")},".cm-lintRange-info":{backgroundImage:w1("#999")},".cm-lintRange-hint":{backgroundImage:w1("#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 Efe(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function _fe(t){let e="hint",n=1;for(let r of t){let s=Efe(r.severity);s>n&&(n=s,e=r.severity)}return e}const Afe=[Vi,Ze.decorations.compute([Vi],t=>{let{selected:e,panel:n}=t.field(Vi);return!e||!n||e.from==e.to?kt.none:kt.set([bfe.range(e.from,e.to)])}),hce(wfe,{hideOn:vfe}),Tfe];var X_=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(cfe)),e.defaultKeymap!==!1&&(r=r.concat(Ude)),e.searchKeymap!==!1&&(r=r.concat(vhe)),e.historyKeymap!==!1&&(r=r.concat(Jue)),e.foldKeymap!==!1&&(r=r.concat(cue)),e.completionKeymap!==!1&&(r=r.concat(lH)),e.lintKeymap!==!1&&(r=r.concat(jfe));var s=[];return e.lineNumbers!==!1&&s.push(kce()),e.highlightActiveLineGutter!==!1&&s.push(Nce()),e.highlightSpecialChars!==!1&&s.push(qle()),e.history!==!1&&s.push(Que()),e.foldGutter!==!1&&s.push(fue()),e.drawSelection!==!1&&s.push(_le()),e.dropCursor!==!1&&s.push(Ple()),e.allowMultipleSelections!==!1&&s.push(wn.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(eue()),e.syntaxHighlighting!==!1&&s.push(Jq(xue,{fallback:!0})),e.bracketMatching!==!1&&s.push(Oue()),e.closeBrackets!==!1&&s.push(ife()),e.autocompletion!==!1&&s.push(gfe()),e.rectangularSelection!==!1&&s.push(tce()),n!==!1&&s.push(sce()),e.highlightActiveLine!==!1&&s.push(Wle()),e.highlightSelectionMatches!==!1&&s.push(Jde()),e.tabSize&&typeof e.tabSize=="number"&&s.push(Wp.of(" ".repeat(e.tabSize))),s.concat([Vp.of(r.flat())]).filter(Boolean)};const Mfe="#e5c07b",Y_="#e06c75",Rfe="#56b6c2",Dfe="#ffffff",pv="#abb2bf",fO="#7d8799",Pfe="#61afef",zfe="#98c379",K_="#d19a66",Ife="#c678dd",Lfe="#21252b",Z_="#2c313a",J_="#282c34",iS="#353a42",Bfe="#3E4451",eA="#528bff",Ffe=Ze.theme({"&":{color:pv,backgroundColor:J_},".cm-content":{caretColor:eA},".cm-cursor, .cm-dropCursor":{borderLeftColor:eA},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Bfe},".cm-panels":{backgroundColor:Lfe,color:pv},".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:J_,color:fO,border:"none"},".cm-activeLineGutter":{backgroundColor:Z_},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:iS},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:iS,borderBottomColor:iS},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Z_,color:pv}}},{dark:!0}),qfe=Xp.define([{tag:ve.keyword,color:Ife},{tag:[ve.name,ve.deleted,ve.character,ve.propertyName,ve.macroName],color:Y_},{tag:[ve.function(ve.variableName),ve.labelName],color:Pfe},{tag:[ve.color,ve.constant(ve.name),ve.standard(ve.name)],color:K_},{tag:[ve.definition(ve.name),ve.separator],color:pv},{tag:[ve.typeName,ve.className,ve.number,ve.changed,ve.annotation,ve.modifier,ve.self,ve.namespace],color:Mfe},{tag:[ve.operator,ve.operatorKeyword,ve.url,ve.escape,ve.regexp,ve.link,ve.special(ve.string)],color:Rfe},{tag:[ve.meta,ve.comment],color:fO},{tag:ve.strong,fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.link,color:fO,textDecoration:"underline"},{tag:ve.heading,fontWeight:"bold",color:Y_},{tag:[ve.atom,ve.bool,ve.special(ve.variableName)],color:K_},{tag:[ve.processingInstruction,ve.string,ve.inserted],color:zfe},{tag:ve.invalid,color:Dfe}]),fH=[Ffe,Jq(qfe)];var $fe=Ze.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Hfe=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:a="",basicSetup:l=!0}=e,c=[];switch(n&&c.unshift(Vp.of([Wde])),l&&(typeof l=="boolean"?c.unshift(X_()):c.unshift(X_(l))),a&&c.unshift(Kle(a)),i){case"light":c.push($fe);break;case"dark":c.push(fH);break;case"none":break;default:c.push(i);break}return r===!1&&c.push(Ze.editable.of(!1)),s&&c.push(wn.readOnly.of(!0)),[...c]},Qfe=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 Vfe{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 tA{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 aS=null,Ufe=()=>typeof window>"u"?new tA:(aS||(aS=new tA),aS),nA=qo.define(),Wfe=200,Gfe=[];function Xfe(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:a,extensions:l=Gfe,autoFocus:c,theme:d="light",height:h=null,minHeight:m=null,maxHeight:g=null,width:x=null,minWidth:y=null,maxWidth:w=null,placeholder:S="",editable:k=!0,readOnly:j=!1,indentWithTab:N=!0,basicSetup:T=!0,root:E,initialState:_}=t,[A,L]=b.useState(),[P,B]=b.useState(),[$,U]=b.useState(),te=b.useState(()=>({current:null}))[0],z=b.useState(()=>({current:null}))[0],Q=Ze.theme({"&":{height:h,minHeight:m,maxHeight:g,width:x,minWidth:y,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),F=Ze.updateListener.of(X=>{if(X.docChanged&&typeof r=="function"&&!X.transactions.some(G=>G.annotation(nA))){te.current?te.current.reset():(te.current=new Vfe(()=>{if(z.current){var G=z.current;z.current=null,G()}te.current=null},Wfe),Ufe().add(te.current));var R=X.state.doc,ie=R.toString();r(ie,X)}s&&s(Qfe(X))}),Y=Hfe({theme:d,editable:k,readOnly:j,placeholder:S,indentWithTab:N,basicSetup:T}),J=[F,Q,...Y];return a&&typeof a=="function"&&J.push(Ze.updateListener.of(a)),J=J.concat(l),b.useLayoutEffect(()=>{if(A&&!$){var X={doc:e,selection:n,extensions:J},R=_?wn.fromJSON(_.json,X,_.fields):wn.create(X);if(U(R),!P){var ie=new Ze({state:R,parent:A,root:E});B(ie),i&&i(ie,R)}}return()=>{P&&(U(void 0),B(void 0))}},[A,$]),b.useEffect(()=>{t.container&&L(t.container)},[t.container]),b.useEffect(()=>()=>{P&&(P.destroy(),B(void 0)),te.current&&(te.current.cancel(),te.current=null)},[P]),b.useEffect(()=>{c&&P&&P.focus()},[c,P]),b.useEffect(()=>{P&&P.dispatch({effects:Ft.reconfigure.of(J)})},[d,l,h,m,g,x,y,w,S,k,j,N,T,r,a]),b.useEffect(()=>{if(e!==void 0){var X=P?P.state.doc.toString():"";if(P&&e!==X){var R=te.current&&!te.current.isDone,ie=()=>{P&&e!==P.state.doc.toString()&&P.dispatch({changes:{from:0,to:P.state.doc.toString().length,insert:e||""},annotations:[nA.of(!0)]})};R?z.current=ie:ie()}}},[e,P]),{state:$,setState:U,view:P,setView:B,container:A,setContainer:L}}var Yfe=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],mH=b.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:a,onStatistics:l,onCreateEditor:c,onUpdate:d,autoFocus:h,theme:m="light",height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:j,placeholder:N,indentWithTab:T,editable:E,readOnly:_,root:A,initialState:L}=t,P=RJ(t,Yfe),B=b.useRef(null),{state:$,view:U,container:te,setContainer:z}=Xfe({root:A,value:r,autoFocus:h,theme:m,height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:j,placeholder:N,indentWithTab:T,editable:E,readOnly:_,selection:s,onChange:a,onStatistics:l,onCreateEditor:c,onUpdate:d,extensions:i,initialState:L});b.useImperativeHandle(e,()=>({editor:B.current,state:$,view:U}),[B,te,$,U]);var Q=b.useCallback(Y=>{B.current=Y,z(Y)},[z]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var F=typeof m=="string"?"cm-theme-"+m:"cm-theme";return o.jsx("div",DJ({ref:Q,className:""+F+(n?" "+n:"")},P))});mH.displayName="CodeMirror";var rA={};class ly{constructor(e,n,r,s,i,a,l,c,d,h=0,m){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=a,this.buffer=l,this.bufferBase=c,this.curContext=d,this.lookAhead=h,this.parent=m}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new ly(e,[],n,r,r,0,[],0,s?new sA(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,a=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSizec;)this.stack.pop();this.reduceContext(s,d)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&a.buffer[l-4]==0&&a.buffer[l-1]>-1){if(n==r)return;if(a.buffer[l-2]>=n){a.buffer[l-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let l=!1;for(let c=a;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){l=!0;break}if(l)for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,s>4&&(s-=4)}this.buffer[a]=e,this.buffer[a+1]=n,this.buffer[a+2]=r,this.buffer[a+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:a}=this.p;(s>this.pos||n<=a.maxNode)&&(this.pos=s,a.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=a.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new ly(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 Kfe(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,a;ic&1&&l==a)||s.push(n[i],a)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;n=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,a=>{if(!(a&393216))if(a&65536){let l=(a>>19)-i;if(l>1){let c=a&65535,d=this.stack.length-l*3;if(d>=0&&e.getGoto(this.stack[d],c,!1)>=0)return l<<19|65536|c}}else{let l=r(a,i+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class sA{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Kfe{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 cy{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 cy(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 cy(this.stack,this.pos,this.index)}}function S1(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&a--,a>=34&&a--;let c=a-32;if(c>=46&&(c-=46,l=!0),i+=c,l)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class gv{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const iA=new gv;class Zfe{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=iA,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let a=this.ranges[++s];i+=a.from-r.to,r=a}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.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=iA,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 Bh{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Jfe(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Bh.prototype.contextual=Bh.prototype.fallback=Bh.prototype.extend=!1;Bh.prototype.fallback=Bh.prototype.extend=!1;class wb{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Jfe(t,e,n,r,s,i){let a=0,l=1<0){let y=t[x];if(c.allows(y)&&(e.token.value==-1||e.token.value==y||eme(y,e.token.value,s,i))){e.acceptToken(y);break}}let h=e.next,m=0,g=t[a+2];if(e.next<0&&g>m&&t[d+g*3-3]==65535){a=t[d+g*3-1];continue e}for(;m>1,y=d+x+(x<<1),w=t[y],S=t[y+1]||65536;if(h=S)m=x+1;else{a=t[y+2],e.advance();continue e}}break}}function aA(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function eme(t,e,n,r){let s=aA(n,r,e);return s<0||aA(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 tme{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?oA(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?oA(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(i instanceof ar){if(a==e){if(a=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+i.length}}}class nme{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new gv)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,a=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,c=0;for(let d=0;dm.end+25&&(c=Math.max(m.lookAhead,c)),m.value!=0)){let g=n;if(m.extended>-1&&(n=this.addActions(e,m.extended,m.end,n)),n=this.addActions(e,m.value,m.end,n),!h.extend&&(r=m,n>g))break}}for(;this.actions.length>n;)this.actions.pop();return c&&e.setLookAhead(c),!r&&e.pos==this.stream.end&&(r=new gv,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 gv,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let a=0;a=0&&r.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new tme(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)r.push(l);else{if(this.advanceStack(l,r,e))continue;{s||(s=[],i=[]),s.push(l);let c=this.tokens.getMainToken(l);i.push(c.value,c.end)}}break}}if(!r.length){let a=s&&ame(s);if(a)return Bi&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Bi&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let a=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(a)return Bi&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(r.length>a)for(r.sort((l,c)=>c.score-l.score);r.length>a;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a500&&d.buffer.length>500)if((l.score-d.score||l.buffer.length-d.buffer.length)>0)r.splice(c--,1);else{r.splice(a--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let a=1;a ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,h=d?e.curContext.hash:0;for(let m=this.fragments.nodeAt(s);m;){let g=this.parser.nodeSet.types[m.type.id]==m.type?i.getGoto(e.state,m.type.id):-1;if(g>-1&&m.length&&(!d||(m.prop(sn.contextHash)||0)==h))return e.useNode(m,g),Bi&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(m.type.id)})`),!0;if(!(m instanceof ar)||m.children.length==0||m.positions[0]>0)break;let x=m.children[0];if(x instanceof ar&&m.positions[0]==0)m=x;else break}}let l=i.stateSlot(e.state,4);if(l>0)return e.reduce(l),Bi&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let d=0;ds?n.push(y):r.push(y)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return lA(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let a=0;a ":"";if(l.deadEnd&&(i||(i=!0,l.restart(),Bi&&console.log(h+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let m=l.split(),g=h;for(let x=0;x<10&&m.forceReduce()&&(Bi&&console.log(g+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,r));x++)Bi&&(g=this.stackID(m)+" -> ");for(let x of l.recoverByInsert(c))Bi&&console.log(h+this.stackID(x)+" (via recover-insert)"),this.advanceFully(x,r);this.stream.end>l.pos?(d==l.pos&&(d++,c=0),l.recoverByDelete(c,d),Bi&&console.log(h+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),lA(l,r)):(!s||s.scoret;class ime{constructor(e){this.start=e.start,this.shift=e.shift||lS,this.reduce=e.reduce||lS,this.reuse=e.reuse||lS,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class sp extends g6{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let l=0;le.topRules[l][1]),s=[];for(let l=0;l=0)i(h,c,l[d++]);else{let m=l[d+-h];for(let g=-h;g>0;g--)i(l[d++],c,m);d++}}}this.nodeSet=new hb(n.map((l,c)=>si.define({name:c>=this.minRepeatTerm?void 0:l,id:c,props:s[c],top:r.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Rq;let a=S1(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Bh(a,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new rme(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let a=s[i++],l=a&1,c=s[i++];if(l&&r)return c;for(let d=i+(a>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Cl(this.data,i+2);else break;s=n(Cl(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Cl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,a)=>a&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(sp.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(l=>l.from==r.external);if(!i)return r;let a=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=cA(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let a=n.indexOf(i);a>=0&&(r[a]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const ome=1,pH=194,gH=195,lme=196,uA=197,cme=198,ume=199,dme=200,hme=2,xH=3,dA=201,fme=24,mme=25,pme=49,gme=50,xme=55,vme=56,yme=57,bme=59,wme=60,Sme=61,kme=62,Ome=63,jme=65,Nme=238,Cme=71,Tme=241,Eme=242,_me=243,Ame=244,Mme=245,Rme=246,Dme=247,Pme=248,vH=72,zme=249,Ime=250,Lme=251,Bme=252,Fme=253,qme=254,$me=255,Hme=256,Qme=73,Vme=77,Ume=263,Wme=112,Gme=130,Xme=151,Yme=152,Kme=155,ud=10,ip=13,B6=32,Sb=9,F6=35,Zme=40,Jme=46,mO=123,hA=125,yH=39,bH=34,fA=92,e0e=111,t0e=120,n0e=78,r0e=117,s0e=85,i0e=new Set([mme,pme,gme,Ume,jme,Gme,vme,yme,Nme,kme,Ome,vH,Qme,Vme,wme,Sme,Xme,Yme,Kme,Wme]);function cS(t){return t==ud||t==ip}function uS(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const a0e=new wb((t,e)=>{let n;if(t.next<0)t.acceptToken(ume);else if(e.context.flags&xv)cS(t.next)&&t.acceptToken(cme,1);else if(((n=t.peek(-1))<0||cS(n))&&e.canShift(uA)){let r=0;for(;t.next==B6||t.next==Sb;)t.advance(),r++;(t.next==ud||t.next==ip||t.next==F6)&&t.acceptToken(uA,-r)}else cS(t.next)&&t.acceptToken(lme,1)},{contextual:!0}),o0e=new wb((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==ud||r==ip){let s=0,i=0;for(;;){if(t.next==B6)s++;else if(t.next==Sb)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=ud&&t.next!=ip&&t.next!=F6&&(s[t,e|wH])),u0e=new ime({start:l0e,reduce(t,e,n,r){return t.flags&xv&&i0e.has(e)||(e==Cme||e==vH)&&t.flags&wH?t.parent:t},shift(t,e,n,r){return e==pH?new vv(t,c0e(r.read(r.pos,n.pos)),0):e==gH?t.parent:e==fme||e==xme||e==bme||e==xH?new vv(t,0,xv):mA.has(e)?new vv(t,0,mA.get(e)|t.flags&xv):t},hash(t){return t.hash}}),d0e=new wb(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==B6||n==Sb)){n!=Zme&&n!=Jme&&n!=ud&&n!=ip&&n!=F6&&t.acceptToken(ome);return}}}),h0e=new wb((t,e)=>{let{flags:n}=e.context,r=n&Sl?bH:yH,s=(n&kl)>0,i=!(n&Ol),a=(n&jl)>0,l=t.pos;for(;!(t.next<0);)if(a&&t.next==mO)if(t.peek(1)==mO)t.advance(2);else{if(t.pos==l){t.acceptToken(xH,1);return}break}else if(i&&t.next==fA){if(t.pos==l){t.advance();let c=t.next;c>=0&&(t.advance(),f0e(t,c)),t.acceptToken(hme);return}break}else if(t.next==fA&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==l){t.acceptToken(dA,s?3:1);return}break}else if(t.next==ud){if(s)t.advance();else if(t.pos==l){t.acceptToken(dA);return}break}else t.advance();t.pos>l&&t.acceptToken(dme)});function f0e(t,e){if(e==e0e)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==t0e)for(let n=0;n<2&&uS(t.next);n++)t.advance();else if(e==r0e)for(let n=0;n<4&&uS(t.next);n++)t.advance();else if(e==s0e)for(let n=0;n<8&&uS(t.next);n++)t.advance();else if(e==n0e&&t.next==mO){for(t.advance();t.next>=0&&t.next!=hA&&t.next!=yH&&t.next!=bH&&t.next!=ud;)t.advance();t.next==hA&&t.advance()}}const m0e=x6({'async "*" "**" FormatConversion FormatSpec':ve.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":ve.controlKeyword,"in not and or is del":ve.operatorKeyword,"from def class global nonlocal lambda":ve.definitionKeyword,import:ve.moduleKeyword,"with as print":ve.keyword,Boolean:ve.bool,None:ve.null,VariableName:ve.variableName,"CallExpression/VariableName":ve.function(ve.variableName),"FunctionDefinition/VariableName":ve.function(ve.definition(ve.variableName)),"ClassDefinition/VariableName":ve.definition(ve.className),PropertyName:ve.propertyName,"CallExpression/MemberExpression/PropertyName":ve.function(ve.propertyName),Comment:ve.lineComment,Number:ve.number,String:ve.string,FormatString:ve.special(ve.string),Escape:ve.escape,UpdateOp:ve.updateOperator,"ArithOp!":ve.arithmeticOperator,BitOp:ve.bitwiseOperator,CompareOp:ve.compareOperator,AssignOp:ve.definitionOperator,Ellipsis:ve.punctuation,At:ve.meta,"( )":ve.paren,"[ ]":ve.squareBracket,"{ }":ve.brace,".":ve.derefOperator,", ;":ve.separator}),p0e={__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},g0e=sp.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:[d0e,o0e,a0e,h0e,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>p0e[t]||-1}],tokenPrec:7668}),pA=new Rce,SH=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function k1(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const x0e={FunctionDefinition:k1("function"),ClassDefinition:k1("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let a=s.getChild("import");a;a=a.nextSibling)a.name=="VariableName"&&((r=a.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(a,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:k1("variable"),AsPattern:k1("variable"),__proto__:null};function kH(t,e){let n=pA.get(e);if(n)return n;let r=[],s=!0;function i(a,l){let c=t.sliceString(a.from,a.to);r.push({label:c,type:l})}return e.cursor(hs.IncludeAnonymous).iterate(a=>{if(a.name){let l=x0e[a.name];if(l&&l(a,i,s)||!s&&SH.has(a.name))return!1;s=!1}else if(a.to-a.from>8192){for(let l of kH(t,a.node))r.push(l);return!1}}),pA.set(e,r),r}const gA=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,OH=["String","FormatString","Comment","PropertyName"];function v0e(t){let e=Ss(t.state).resolveInner(t.pos,-1);if(OH.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&gA.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)SH.has(s.name)&&(r=r.concat(kH(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:gA}}const y0e=["__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"}))),b0e=[vl("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),vl("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),vl("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),vl("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),vl(`if \${}: +`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let a=this.ranges[s].from,l=this.lineAfter(a);n+=l,r=a+l.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let a=this.ranges[++this.rangeIndex].from;n+=a-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let l=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-l}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&a>=0&&this.chunk[a]==e&&this.chunk[a+2]==n?this.chunk[a+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,a=new o$(n,e?e.state.tabSize:4,e?dd(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let l=c$(i.token,a,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+a.start,this.parsedPos+a.pos,s)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const E6=Object.create(null),tp=[ai.none],zue=new gb(tp),T_=[],E_=Object.create(null),u$=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"]])u$[t]=h$(E6,e);class d${constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),u$)}resolve(e){return e?this.table[e]||(this.table[e]=h$(this.extra,e)):0}}const Iue=new d$(E6);function nS(t,e){T_.indexOf(t)>-1||(T_.push(t),console.warn(e))}function h$(t,e){let n=[];for(let l of e.split(" ")){let c=[];for(let d of l.split(".")){let h=t[d]||ye[d];h?typeof h=="function"?c.length?c=c.map(h):nS(d,`Modifier ${d} used at start of tag`):c.length?nS(d,`Tag ${d} used as modifier`):c=Array.isArray(h)?h:[h]:nS(d,`Unknown highlighting tag ${d}`)}for(let d of c)n.push(d)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(l=>l.id),i=E_[s];if(i)return i.id;let a=E_[s]=ai.define({id:tp.length,name:r,props:[k6({[r]:n})]});return tp.push(a),a.id}function Lue(t,e){let n=ai.define({id:tp.length,name:"Document",props:[Wu.add(()=>t),vb.add(()=>r=>e.getIndent(r))],top:!0});return tp.push(n),n}br.RTL,br.LTR;const Bue=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=A6(t.state,n.from);return r.line?Fue(t):r.block?$ue(t):!1};function _6(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const Fue=_6(Vue,0),que=_6(f$,0),$ue=_6((t,e)=>f$(t,e,Que(e)),0);function A6(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Qm=50;function Hue(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-Qm,r),a=t.sliceDoc(s,s+Qm),l=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(a)[0].length,d=i.length-l;if(i.slice(d-e.length,d)==e&&a.slice(c,c+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:s+c,margin:c&&1}};let h,m;s-r<=2*Qm?h=m=t.sliceDoc(r,s):(h=t.sliceDoc(r,r+Qm),m=t.sliceDoc(s-Qm,s));let g=/^\s*/.exec(h)[0].length,x=/\s*$/.exec(m)[0].length,y=m.length-x-n.length;return h.slice(g,g+e.length)==e&&m.slice(y,y+n.length)==n?{open:{pos:r+g+e.length,margin:/\s/.test(h.charAt(g+e.length))?1:0},close:{pos:s-x-n.length,margin:/\s/.test(m.charAt(y-1))?1:0}}:null}function Que(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 f$(t,e,n=e.selection.ranges){let r=n.map(i=>A6(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,a)=>Hue(e,r[a],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,a)=>s[a]?[]:[{from:i.from,insert:r[a].open+" "},{from:i.to,insert:" "+r[a].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let a=0,l;as&&(i==a||a>m.from)){s=m.from;let g=/^\s*/.exec(m.text)[0].length,x=g==m.length,y=m.text.slice(g,g+d.length)==d?g:-1;gi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:l,token:c,indent:d,empty:h,single:m}of r)(m||!h)&&i.push({from:l.from+d,insert:c+" "});let a=e.changes(i);return{changes:a,selection:e.selection.map(a,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:a,comment:l,token:c}of r)if(l>=0){let d=a.from+l,h=d+c.length;a.text[h-a.from]==" "&&h++,i.push({from:d,to:h})}return{changes:i}}return null}const uO=Qo.define(),Uue=Qo.define(),Wue=st.define(),m$=st.define({combine(t){return Vo(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)})}}),p$=Os.define({create(){return Eo.empty},update(t,e){let n=e.state.facet(m$),r=e.annotation(uO);if(r){let c=wi.fromTransaction(e,r.selection),d=r.side,h=d==0?t.undone:t.done;return c?h=iy(h,h.length,n.minDepth,c):h=v$(h,e.startState.selection),new Eo(d==0?r.rest:h,d==0?h:r.rest)}let s=e.annotation(Uue);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(ss.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=wi.fromTransaction(e),a=e.annotation(ss.time),l=e.annotation(ss.userEvent);return i?t=t.addChanges(i,a,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,a,l,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Eo(t.done.map(wi.fromJSON),t.undone.map(wi.fromJSON))}});function Gue(t={}){return[p$,m$.of(t),Ze.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?g$:e.inputType=="historyRedo"?dO:null;return r?(e.preventDefault(),r(n)):!1}})]}function bb(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(p$,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const g$=bb(0,!1),dO=bb(1,!1),Xue=bb(0,!0),Yue=bb(1,!0);class wi{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 wi(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 wi(e.changes&&us.fromJSON(e.changes),[],e.mapped&&Io.fromJSON(e.mapped),e.startSelection&&Me.fromJSON(e.startSelection),e.selectionsAfter.map(Me.fromJSON))}static fromTransaction(e,n){let r=ka;for(let s of e.startState.facet(Wue)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new wi(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,ka)}static selection(e){return new wi(void 0,ka,void 0,void 0,e)}}function iy(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 Kue(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,a,l)=>{for(let c=0;c=d&&a<=h&&(r=!0)}}),r}function Zue(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function x$(t,e){return t.length?e.length?t.concat(e):t:e}const ka=[],Jue=200;function v$(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Jue));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),iy(t,t.length-1,1e9,n.setSelAfter(r)))}else return[wi.selection([e])]}function ede(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 rS(t,e){if(!t.length)return t;let n=t.length,r=ka;for(;n;){let s=tde(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?[wi.selection(r)]:ka}function tde(t,e,n){let r=x$(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):ka,n);if(!t.changes)return wi.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(i):i;return new wi(s,Qt.mapEffects(t.effects,e),a,t.startSelection.map(i),r)}const nde=/^(input\.type|delete)($|\.)/;class Eo{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 Eo(this.done,this.undone):this}addChanges(e,n,r,s,i){let a=this.done,l=a[a.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||nde.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):wb(n,e))}function Ws(t){return t.textDirectionAt(t.state.selection.main.head)==br.LTR}const b$=t=>y$(t,!Ws(t)),w$=t=>y$(t,Ws(t));function S$(t,e){return so(t,n=>n.empty?t.moveByGroup(n,e):wb(n,e))}const sde=t=>S$(t,!Ws(t)),ide=t=>S$(t,Ws(t));function ade(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 Sb(t,e,n){let r=Ss(t).resolveInner(e.head),s=n?an.closedBy:an.openedBy;for(let c=e.head;;){let d=n?r.childAfter(c):r.childBefore(c);if(!d)break;ade(t,d,s)?r=d:c=n?d.to:d.from}let i=r.type.prop(s),a,l;return i&&(a=n?To(t,r.from,1):To(t,r.to,-1))&&a.matched?l=n?a.end.to:a.end.from:l=n?r.to:r.from,Me.cursor(l,n?-1:1)}const ode=t=>so(t,e=>Sb(t.state,e,!Ws(t))),lde=t=>so(t,e=>Sb(t.state,e,Ws(t)));function k$(t,e){return so(t,n=>{if(!n.empty)return wb(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const O$=t=>k$(t,!1),j$=t=>k$(t,!0);function N$(t){let e=t.scrollDOM.clientHeighta.empty?t.moveVertically(a,e,n.height):wb(a,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let a=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,d=l.bottom-n.marginBottom;a&&a.top>c&&a.bottomC$(t,!1),hO=t=>C$(t,!0);function du(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Me.cursor(r.from+i))}return s}const cde=t=>so(t,e=>du(t,e,!0)),ude=t=>so(t,e=>du(t,e,!1)),dde=t=>so(t,e=>du(t,e,!Ws(t))),hde=t=>so(t,e=>du(t,e,Ws(t))),fde=t=>so(t,e=>Me.cursor(t.lineBlockAt(e.head).from,1)),mde=t=>so(t,e=>Me.cursor(t.lineBlockAt(e.head).to,-1));function pde(t,e,n){let r=!1,s=Tf(t.selection,i=>{let a=To(t,i.head,-1)||To(t,i.head,1)||i.head>0&&To(t,i.head-1,1)||i.headpde(t,e);function za(t,e){let n=Tf(t.state.selection,r=>{let s=e(r);return Me.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(ro(t.state,n)),!0)}function T$(t,e){return za(t,n=>t.moveByChar(n,e))}const E$=t=>T$(t,!Ws(t)),_$=t=>T$(t,Ws(t));function A$(t,e){return za(t,n=>t.moveByGroup(n,e))}const xde=t=>A$(t,!Ws(t)),vde=t=>A$(t,Ws(t)),yde=t=>za(t,e=>Sb(t.state,e,!Ws(t))),bde=t=>za(t,e=>Sb(t.state,e,Ws(t)));function M$(t,e){return za(t,n=>t.moveVertically(n,e))}const R$=t=>M$(t,!1),D$=t=>M$(t,!0);function P$(t,e){return za(t,n=>t.moveVertically(n,e,N$(t).height))}const A_=t=>P$(t,!1),M_=t=>P$(t,!0),wde=t=>za(t,e=>du(t,e,!0)),Sde=t=>za(t,e=>du(t,e,!1)),kde=t=>za(t,e=>du(t,e,!Ws(t))),Ode=t=>za(t,e=>du(t,e,Ws(t))),jde=t=>za(t,e=>Me.cursor(t.lineBlockAt(e.head).from)),Nde=t=>za(t,e=>Me.cursor(t.lineBlockAt(e.head).to)),R_=({state:t,dispatch:e})=>(e(ro(t,{anchor:0})),!0),D_=({state:t,dispatch:e})=>(e(ro(t,{anchor:t.doc.length})),!0),P_=({state:t,dispatch:e})=>(e(ro(t,{anchor:t.selection.main.anchor,head:0})),!0),z_=({state:t,dispatch:e})=>(e(ro(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Cde=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Tde=({state:t,dispatch:e})=>{let n=kb(t).map(({from:r,to:s})=>Me.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Me.create(n),userEvent:"select"})),!0},Ede=({state:t,dispatch:e})=>{let n=Tf(t.selection,r=>{let s=Ss(t),i=s.resolveStack(r.from,1);if(r.empty){let a=s.resolveStack(r.from,-1);a.node.from>=i.node.from&&a.node.to<=i.node.to&&(i=a)}for(let a=i;a;a=a.next){let{node:l}=a;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&a.next)return Me.range(l.to,l.from)}return r});return n.eq(t.selection)?!1:(e(ro(t,n)),!0)};function z$(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let a=n.doc.lineAt(i.head);if(e?a.to0)for(let l=i;;){let c=t.moveVertically(l,e);if(c.heada.to){s.some(d=>d.head==c.head)||s.push(c);break}else{if(c.head==l.head)break;l=c}}}return s.length==r.ranges.length?!1:(t.dispatch(ro(n,Me.create(s,s.length-1))),!0)}const _de=t=>z$(t,!1),Ade=t=>z$(t,!0),Mde=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Me.create([n.main]):n.main.empty||(r=Me.create([Me.cursor(n.main.head)])),r?(e(ro(t,r)),!0):!1};function tg(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:a,to:l}=i;if(a==l){let c=e(i);ca&&(n="delete.forward",c=S1(t,c,!0)),a=Math.min(a,c),l=Math.max(l,c)}else a=S1(t,a,!1),l=S1(t,l,!0);return a==l?{range:i}:{changes:{from:a,to:l},range:Me.cursor(a,as(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const I$=(t,e,n)=>tg(t,r=>{let s=r.from,{state:i}=t,a=i.doc.lineAt(s),l,c;if(n&&!e&&s>a.from&&sI$(t,!1,!0),L$=t=>I$(t,!0,!1),B$=(t,e)=>tg(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),a=s.charCategorizer(r);for(let l=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let c=Ps(i.text,r-i.from,e)+i.from,d=i.text.slice(Math.min(r,c)-i.from,Math.max(r,c)-i.from),h=a(d);if(l!=null&&h!=l)break;(d!=" "||r!=n.head)&&(l=h),r=c}return r}),F$=t=>B$(t,!1),Rde=t=>B$(t,!0),Dde=t=>tg(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headtg(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),zde=t=>tg(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:An.of(["",""])},range:Me.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Lde=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),a=s==i.from?s-1:Ps(i.text,s-i.from,!1)+i.from,l=s==i.to?s+1:Ps(i.text,s-i.from,!0)+i.from;return{changes:{from:a,to:l,insert:t.doc.slice(s,l).append(t.doc.slice(a,s))},range:Me.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function kb(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let a=e[e.length-1];a.to=i.to,a.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function q$(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of kb(t)){if(n?i.to==t.doc.length:i.from==0)continue;let a=t.doc.lineAt(n?i.to+1:i.from-1),l=a.length+1;if(n){r.push({from:i.to,to:a.to},{from:i.from,insert:a.text+t.lineBreak});for(let c of i.ranges)s.push(Me.range(Math.min(t.doc.length,c.anchor+l),Math.min(t.doc.length,c.head+l)))}else{r.push({from:a.from,to:i.from},{from:i.to,insert:t.lineBreak+a.text});for(let c of i.ranges)s.push(Me.range(c.anchor-l,c.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Me.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Bde=({state:t,dispatch:e})=>q$(t,e,!1),Fde=({state:t,dispatch:e})=>q$(t,e,!0);function $$(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of kb(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 qde=({state:t,dispatch:e})=>$$(t,e,!1),$de=({state:t,dispatch:e})=>$$(t,e,!0),Hde=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(kb(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let a=t.lineBlockAt(s.head),l=t.coordsAtPos(s.head,s.assoc||1);l&&(i=a.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Qde(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Ss(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(an.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 I_=H$(!1),Vde=H$(!0);function H$(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:a}=s,l=e.doc.lineAt(i),c=!t&&i==a&&Qde(e,i);t&&(i=a=(a<=l.to?l:e.doc.lineAt(a)).to);let d=new xb(e,{simulateBreak:i,simulateDoubleBreak:!!c}),h=O6(d,i);for(h==null&&(h=Cf(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));al.from&&i{let s=[];for(let a=r.from;a<=r.to;){let l=t.doc.lineAt(a);l.number>n&&(r.empty||r.to>l.from)&&(e(l,s,r),n=l.number),a=l.to+1}let i=t.changes(s);return{changes:s,range:Me.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const Ude=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new xb(t,{overrideIndentation:i=>{let a=n[i];return a??-1}}),s=M6(t,(i,a,l)=>{let c=O6(r,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let d=/^\s*/.exec(i.text)[0],h=ep(t,c);(d!=h||l.fromt.readOnly?!1:(e(t.update(M6(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Zp)})}),{userEvent:"input.indent"})),!0),V$=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(M6(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Cf(s,t.tabSize),a=0,l=ep(t,Math.max(0,i-dd(t)));for(;a(t.setTabFocusMode(),!0),Gde=[{key:"Ctrl-b",run:b$,shift:E$,preventDefault:!0},{key:"Ctrl-f",run:w$,shift:_$},{key:"Ctrl-p",run:O$,shift:R$},{key:"Ctrl-n",run:j$,shift:D$},{key:"Ctrl-a",run:fde,shift:jde},{key:"Ctrl-e",run:mde,shift:Nde},{key:"Ctrl-d",run:L$},{key:"Ctrl-h",run:fO},{key:"Ctrl-k",run:Dde},{key:"Ctrl-Alt-h",run:F$},{key:"Ctrl-o",run:Ide},{key:"Ctrl-t",run:Lde},{key:"Ctrl-v",run:hO}],Xde=[{key:"ArrowLeft",run:b$,shift:E$,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:sde,shift:xde,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:dde,shift:kde,preventDefault:!0},{key:"ArrowRight",run:w$,shift:_$,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ide,shift:vde,preventDefault:!0},{mac:"Cmd-ArrowRight",run:hde,shift:Ode,preventDefault:!0},{key:"ArrowUp",run:O$,shift:R$,preventDefault:!0},{mac:"Cmd-ArrowUp",run:R_,shift:P_},{mac:"Ctrl-ArrowUp",run:__,shift:A_},{key:"ArrowDown",run:j$,shift:D$,preventDefault:!0},{mac:"Cmd-ArrowDown",run:D_,shift:z_},{mac:"Ctrl-ArrowDown",run:hO,shift:M_},{key:"PageUp",run:__,shift:A_},{key:"PageDown",run:hO,shift:M_},{key:"Home",run:ude,shift:Sde,preventDefault:!0},{key:"Mod-Home",run:R_,shift:P_},{key:"End",run:cde,shift:wde,preventDefault:!0},{key:"Mod-End",run:D_,shift:z_},{key:"Enter",run:I_,shift:I_},{key:"Mod-a",run:Cde},{key:"Backspace",run:fO,shift:fO,preventDefault:!0},{key:"Delete",run:L$,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:F$,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Rde,preventDefault:!0},{mac:"Mod-Backspace",run:Pde,preventDefault:!0},{mac:"Mod-Delete",run:zde,preventDefault:!0}].concat(Gde.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Yde=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:ode,shift:yde},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:lde,shift:bde},{key:"Alt-ArrowUp",run:Bde},{key:"Shift-Alt-ArrowUp",run:qde},{key:"Alt-ArrowDown",run:Fde},{key:"Shift-Alt-ArrowDown",run:$de},{key:"Mod-Alt-ArrowUp",run:_de},{key:"Mod-Alt-ArrowDown",run:Ade},{key:"Escape",run:Mde},{key:"Mod-Enter",run:Vde},{key:"Alt-l",mac:"Ctrl-l",run:Tde},{key:"Mod-i",run:Ede,preventDefault:!0},{key:"Mod-[",run:V$},{key:"Mod-]",run:Q$},{key:"Mod-Alt-\\",run:Ude},{key:"Shift-Mod-k",run:Hde},{key:"Shift-Mod-\\",run:gde},{key:"Mod-/",run:Bue},{key:"Alt-A",run:que},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Wde}].concat(Xde),Kde={key:"Tab",run:Q$,shift:V$},L_=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class af{constructor(e,n,r=0,s=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?l=>i(L_(l)):L_,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 vi(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=s6(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=ko(e);let s=this.normalize(n);if(s.length)for(let i=0,a=r;;i++){let l=s.charCodeAt(i),c=this.match(l,a,this.bufferPos+this.bufferStart);if(i==s.length-1){if(c)return this.value=c,this;break}a==r&&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=ay(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 l=new Lh(n,e.sliceString(n,r));return sS.set(e,l),l}if(s.from==n&&s.to==r)return s;let{text:i,from:a}=s;return a>n&&(i=e.sliceString(n,a)+i,a=n),s.to=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=ay(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Lh.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(W$.prototype[Symbol.iterator]=G$.prototype[Symbol.iterator]=function(){return this});function Zde(t){try{return new RegExp(t,R6),!0}catch{return!1}}function ay(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function mO(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=lr("input",{class:"cm-textfield",name:"line",value:e}),r=lr("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:E0.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},lr("label",t.state.phrase("Go to line"),": ",n)," ",lr("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),lr("button",{name:"close",onclick:()=>{t.dispatch({effects:E0.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:a}=t,l=a.doc.lineAt(a.selection.main.head),[,c,d,h,m]=i,g=h?+h.slice(1):0,x=d?+d:l.number;if(d&&m){let S=x/100;c&&(S=S*(c=="-"?-1:1)+l.number/a.doc.lines),x=Math.round(a.doc.lines*S)}else d&&c&&(x=x*(c=="-"?-1:1)+l.number);let y=a.doc.line(Math.max(1,Math.min(a.doc.lines,x))),w=Me.cursor(y.from+Math.max(0,Math.min(g,y.length)));t.dispatch({effects:[E0.of(!1),Ze.scrollIntoView(w.from,{y:"center"})],selection:w}),t.focus()}return{dom:r}}const E0=Qt.define(),B_=Os.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(E0)&&(t=n.value);return t},provide:t=>Y0.from(t,e=>e?mO:null)}),Jde=t=>{let e=X0(t,mO);if(!e){let n=[E0.of(!0)];t.state.field(B_,!1)==null&&n.push(Qt.appendConfig.of([B_,ehe])),t.dispatch({effects:n}),e=X0(t,mO)}return e&&e.dom.querySelector("input").select(),!0},ehe=Ze.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"}}}),the={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},nhe=st.define({combine(t){return Vo(t,the,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function rhe(t){return[lhe,ohe]}const she=Ot.mark({class:"cm-selectionMatch"}),ihe=Ot.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function F_(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Tr.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Tr.Word)}function ahe(t,e,n,r){return t(e.sliceDoc(n,n+1))==Tr.Word&&t(e.sliceDoc(r-1,r))==Tr.Word}const ohe=Yr.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(nhe),{state:n}=t,r=n.selection;if(r.ranges.length>1)return Ot.none;let s=r.main,i,a=null;if(s.empty){if(!e.highlightWordAroundCursor)return Ot.none;let c=n.wordAt(s.head);if(!c)return Ot.none;a=n.charCategorizer(s.head),i=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c200)return Ot.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),a=n.charCategorizer(s.head),!(F_(a,n,s.from,s.to)&&ahe(a,n,s.from,s.to)))return Ot.none}else if(i=n.sliceDoc(s.from,s.to),!i)return Ot.none}let l=[];for(let c of t.visibleRanges){let d=new af(n.doc,i,c.from,c.to);for(;!d.next().done;){let{from:h,to:m}=d.value;if((!a||F_(a,n,h,m))&&(s.empty&&h<=s.from&&m>=s.to?l.push(ihe.range(h,m)):(h>=s.to||m<=s.from)&&l.push(she.range(h,m)),l.length>e.maxMatches))return Ot.none}}return Ot.set(l)}},{decorations:t=>t.decorations}),lhe=Ze.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),che=({state:t,dispatch:e})=>{let{selection:n}=t,r=Me.create(n.ranges.map(s=>t.wordAt(s.head)||Me.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function uhe(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let a=!1,l=new af(t.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(a)return null;l=new af(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(c=>c.from==l.value.from))continue;if(i){let c=t.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const dhe=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return che({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=uhe(t,r);return s?(e(t.update({selection:t.selection.addRange(Me.range(s.from,s.to),!1),effects:Ze.scrollIntoView(s.to)})),!0):!1},Ef=st.define({combine(t){return Vo(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new khe(e),scrollToMatch:e=>Ze.scrollIntoView(e)})}});class X${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||Zde(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 phe(this):new fhe(this)}getCursor(e,n=0,r){let s=e.doc?e:Nn.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?Sh(this,s,n,r):wh(this,s,n,r)}}class Y${constructor(e){this.spec=e}}function wh(t,e,n,r){return new af(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?hhe(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function hhe(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=wh(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 Sh(t,e,n,r){return new W$(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?mhe(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function oy(t,e){return t.slice(Ps(t,e,!1),e)}function ly(t,e){return t.slice(e,Ps(t,e))}function mhe(t){return(e,n,r)=>!r[0].length||(t(oy(r.input,r.index))!=Tr.Word||t(ly(r.input,r.index))!=Tr.Word)&&(t(ly(r.input,r.index+r[0].length))!=Tr.Word||t(oy(r.input,r.index+r[0].length))!=Tr.Word)}class phe extends Y${nextMatch(e,n,r){let s=Sh(this.spec,e,r,e.doc.length).next();return s.done&&(s=Sh(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),a=Sh(this.spec,e,i,r),l=null;for(;!a.next().done;)l=a.value;if(l&&(i==n||l.from>i+10))return l;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Sh(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 np=Qt.define(),D6=Qt.define(),Uc=Os.define({create(t){return new iS(pO(t).create(),null)},update(t,e){for(let n of e.effects)n.is(np)?t=new iS(n.value.create(),t.panel):n.is(D6)&&(t=new iS(t.query,n.value?P6:null));return t},provide:t=>Y0.from(t,e=>e.panel)});class iS{constructor(e,n){this.query=e,this.panel=n}}const ghe=Ot.mark({class:"cm-searchMatch"}),xhe=Ot.mark({class:"cm-searchMatch cm-searchMatch-selected"}),vhe=Yr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Uc))}update(t){let e=t.state.field(Uc);(e!=t.startState.field(Uc)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Ot.none;let{view:n}=this,r=new Hl;for(let s=0,i=n.visibleRanges,a=i.length;si[s+1].from-500;)c=i[++s].to;t.highlight(n.state,l,c,(d,h)=>{let m=n.state.selection.ranges.some(g=>g.from==d&&g.to==h);r.add(d,h,m?xhe:ghe)})}return r.finish()}},{decorations:t=>t.decorations});function ng(t){return e=>{let n=e.state.field(Uc,!1);return n&&n.query.spec.valid?t(e,n):J$(e)}}const cy=ng((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Me.single(r.from,r.to),i=t.state.facet(Ef);return t.dispatch({selection:s,effects:[z6(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),Z$(t),!0}),uy=ng((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Me.single(s.from,s.to),a=t.state.facet(Ef);return t.dispatch({selection:i,effects:[z6(t,s),a.scrollToMatch(i.main,t)],userEvent:"select.search"}),Z$(t),!0}),yhe=ng((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Me.create(n.map(r=>Me.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),bhe=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],a=0;for(let l=new af(t.doc,t.sliceDoc(r,s));!l.next().done;){if(i.length>1e3)return!1;l.value.from==r&&(a=i.length),i.push(Me.range(l.value.from,l.value.to))}return e(t.update({selection:Me.create(i,a),userEvent:"select.search.matches"})),!0},q_=ng((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let a=i,l=[],c,d,h=[];a.from==r&&a.to==s&&(d=n.toText(e.getReplacement(a)),l.push({from:a.from,to:a.to,insert:d}),a=e.nextMatch(n,a.from,a.to),h.push(Ze.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let m=t.state.changes(l);return a&&(c=Me.single(a.from,a.to).map(m),h.push(z6(t,a)),h.push(n.facet(Ef).scrollToMatch(c.main,t))),t.dispatch({changes:m,selection:c,effects:h,userEvent:"input.replace"}),!0}),whe=ng((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:a}=s;return{from:i,to:a,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:Ze.announce.of(r),userEvent:"input.replace.all"}),!0});function P6(t){return t.state.facet(Ef).createPanel(t)}function pO(t,e){var n,r,s,i,a;let l=t.selection.main,c=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!c)return e;let d=t.facet(Ef);return new X$({search:((n=e?.literal)!==null&&n!==void 0?n:d.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:d.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:d.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:d.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:d.wholeWord})}function K$(t){let e=X0(t,P6);return e&&e.dom.querySelector("[main-field]")}function Z$(t){let e=K$(t);e&&e==t.root.activeElement&&e.select()}const J$=t=>{let e=t.state.field(Uc,!1);if(e&&e.panel){let n=K$(t);if(n&&n!=t.root.activeElement){let r=pO(t.state,e.query.spec);r.valid&&t.dispatch({effects:np.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[D6.of(!0),e?np.of(pO(t.state,e.query.spec)):Qt.appendConfig.of(jhe)]});return!0},eH=t=>{let e=t.state.field(Uc,!1);if(!e||!e.panel)return!1;let n=X0(t,P6);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:D6.of(!1)}),!0},She=[{key:"Mod-f",run:J$,scope:"editor search-panel"},{key:"F3",run:cy,shift:uy,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:cy,shift:uy,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:eH,scope:"editor search-panel"},{key:"Mod-Shift-l",run:bhe},{key:"Mod-Alt-g",run:Jde},{key:"Mod-d",run:dhe,preventDefault:!0}];class khe{constructor(e){this.view=e;let n=this.query=e.state.field(Uc).query.spec;this.commit=this.commit.bind(this),this.searchField=lr("input",{value:n.search,placeholder:Fi(e,"Find"),"aria-label":Fi(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=lr("input",{value:n.replace,placeholder:Fi(e,"Replace"),"aria-label":Fi(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=lr("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=lr("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=lr("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,a){return lr("button",{class:"cm-button",name:s,onclick:i,type:"button"},a)}this.dom=lr("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>cy(e),[Fi(e,"next")]),r("prev",()=>uy(e),[Fi(e,"previous")]),r("select",()=>yhe(e),[Fi(e,"all")]),lr("label",null,[this.caseField,Fi(e,"match case")]),lr("label",null,[this.reField,Fi(e,"regexp")]),lr("label",null,[this.wordField,Fi(e,"by word")]),...e.state.readOnly?[]:[lr("br"),this.replaceField,r("replace",()=>q_(e),[Fi(e,"replace")]),r("replaceAll",()=>whe(e),[Fi(e,"replace all")])],lr("button",{name:"close",onclick:()=>eH(e),"aria-label":Fi(e,"close"),type:"button"},["×"])])}commit(){let e=new X$({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:np.of(e)}))}keydown(e){Tle(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?uy:cy)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),q_(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(np)&&!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(Ef).top}}function Fi(t,e){return t.state.phrase(e)}const k1=30,O1=/[\s\.,:;?!]/;function z6(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-k1),a=Math.min(s,n+k1),l=t.state.sliceDoc(i,a);if(i!=r.from){for(let c=0;cl.length-k1;c--)if(!O1.test(l[c-1])&&O1.test(l[c])){l=l.slice(0,c);break}}return Ze.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${r.number}.`)}const Ohe=Ze.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"}}),jhe=[Uc,uu.low(vhe),Ohe];class tH{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=Ss(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(rH(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 $_(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 Nhe(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+$/]:Nhe(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function Che(t,e){return n=>{for(let r=Ss(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 H_=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function sd(t){return t.selection.main.from}function rH(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const I6=Qo.define();function The(t,e,n,r){let{main:s}=t.selection,i=n-s.from,a=r-s.from;return{...t.changeByRange(l=>{if(l!=s&&n!=r&&t.sliceDoc(l.from+i,l.from+a)!=t.sliceDoc(n,r))return{range:l};let c=t.toText(e);return{changes:{from:l.from+i,to:r==s.from?l.to:l.from+a,insert:c},range:Me.cursor(l.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Q_=new WeakMap;function Ehe(t){if(!Array.isArray(t))return t;let e=Q_.get(t);return e||Q_.set(t,e=nH(t)),e}const dy=Qt.define(),rp=Qt.define();class _he{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&E<=57||E>=97&&E<=122?2:E>=65&&E<=90?1:0:(_=s6(E))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!j||A==1&&S||T==0&&A!=0)&&(n[m]==E||r[m]==E&&(g=!0)?a[m++]=j:a.length&&(k=!1)),T=A,j+=ko(E)}return m==c&&a[0]==0&&k?this.result(-100+(g?-200:0),a,e):x==c&&y==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):x==c?this.ret(-900-e.length,[y,w]):m==c?this.result(-100+(g?-200:0)+-700+(k?0:-1100),a,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let a of n){let l=a+(this.astral?ko(vi(r,a)):1);i&&s[i-1]==a?s[i-1]=l:(s[i++]=a,s[i++]=l)}return this.ret(e-r.length,s)}}class Ahe{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:Mhe,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=>V_(e(r),n(r)),optionClass:(e,n)=>r=>V_(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function V_(t,e){return t?e?t+" "+e:t:e}function Mhe(t,e,n,r,s,i){let a=t.textDirection==br.RTL,l=a,c=!1,d="top",h,m,g=e.left-s.left,x=s.right-e.right,y=r.right-r.left,w=r.bottom-r.top;if(l&&g=w||j>e.top?h=n.bottom-e.top:(d="bottom",h=e.bottom-n.top)}let S=(e.bottom-e.top)/i.offsetHeight,k=(e.right-e.left)/i.offsetWidth;return{style:`${d}: ${h/S}px; max-width: ${m/k}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":l?"left":"right")}}function Rhe(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let a=document.createElement("span");a.className="cm-completionLabel";let l=n.displayLabel||n.label,c=0;for(let d=0;dc&&a.appendChild(document.createTextNode(l.slice(c,h)));let g=a.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(l.slice(h,m))),g.className="cm-completionMatchedText",c=m}return cn.position-r.position).map(n=>n.render)}function aS(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 Dhe{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:a}=s.open,l=e.state.facet(ws);this.optionContent=Rhe(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=aS(i.length,a,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",c=>{let{options:d}=e.state.field(n).open;for(let h=c.target,m;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(m=/-(\d+)$/.exec(h.id))&&+m[1]{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(ws).closeOnBlur&&c.relatedTarget!=e.contentDOM&&e.dispatch({effects:rp.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:a,disabled:l}=r.open;(!s.open||s.open.options!=i)&&(this.range=aS(i.length,a,e.state.facet(ws).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),l!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=aS(n.options.length,n.selected,this.view.state.facet(ws).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let a=typeof i=="string"?document.createTextNode(i):i(s);if(!a)return;"then"in a?a.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>bi(this.view.state,l,"completion info")):(this.addInfoPane(a,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&zhe(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let a=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{a.target==s&&a.preventDefault()});let i=null;for(let a=r.from;ar.from||r.from==0))if(i=g,typeof d!="string"&&d.header)s.appendChild(d.header(d));else{let x=s.appendChild(document.createElement("completion-section"));x.textContent=g}}const h=s.appendChild(document.createElement("li"));h.id=n+"-"+a,h.setAttribute("role","option");let m=this.optionClass(l);m&&(h.className=m);for(let g of this.optionContent){let x=g(l,this.view.state,this.view,c);x&&h.appendChild(x)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew Dhe(n,t,e)}function zhe(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 U_(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Ihe(t,e){let n=[],r=null,s=null,i=h=>{n.push(h);let{section:m}=h.completion;if(m){r||(r=[]);let g=typeof m=="string"?m:m.name;r.some(x=>x.name==g)||r.push(typeof m=="string"?{name:g}:m)}},a=e.facet(ws);for(let h of t)if(h.hasResult()){let m=h.result.getMatch;if(h.result.filter===!1)for(let g of h.result.options)i(new H_(g,h.source,m?m(g):[],1e9-n.length));else{let g=e.sliceDoc(h.from,h.to),x,y=a.filterStrict?new Ahe(g):new _he(g);for(let w of h.result.options)if(x=y.match(w.label)){let S=w.displayLabel?m?m(w,x.matched):[]:x.matched,k=x.score+(w.boost||0);if(i(new H_(w,h.source,S,k)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:j}=w.section;s||(s=Object.create(null)),s[j]=Math.max(k,s[j]||-1e9)}}}}if(r){let h=Object.create(null),m=0,g=(x,y)=>(x.rank==="dynamic"&&y.rank==="dynamic"?s[y.name]-s[x.name]:0)||(typeof x.rank=="number"?x.rank:1e9)-(typeof y.rank=="number"?y.rank:1e9)||(x.nameg.score-m.score||d(m.completion,g.completion))){let m=h.completion;!c||c.label!=m.label||c.detail!=m.detail||c.type!=null&&m.type!=null&&c.type!=m.type||c.apply!=m.apply||c.boost!=m.boost?l.push(h):U_(h.completion)>U_(c)&&(l[l.length-1]=h),c=h.completion}return l}class _h{constructor(e,n,r,s,i,a){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=a}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new _h(this.options,W_(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,a){if(s&&!a&&e.some(d=>d.isPending))return s.setDisabled();let l=Ihe(e,n);if(!l.length)return s&&e.some(d=>d.isPending)?s.setDisabled():null;let c=n.facet(ws).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let d=s.options[s.selected].completion;for(let h=0;hh.hasResult()?Math.min(d,h.from):d,1e8),create:Hhe,above:i.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(e){return new _h(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new _h(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class hy{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new hy(qhe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(ws),i=(r.override||n.languageDataAt("autocomplete",sd(n)).map(Ehe)).map(c=>(this.active.find(h=>h.source==c)||new Oa(c,this.active.some(h=>h.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((c,d)=>c==this.active[d])&&(i=this.active);let a=this.open,l=e.effects.some(c=>c.is(L6));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||i.some(c=>c.hasResult()&&e.changes.touchesRange(c.from,c.to))||!Lhe(i,this.active)||l?a=_h.build(i,n,this.id,a,r,l):a&&a.disabled&&!i.some(c=>c.isPending)&&(a=null),!a&&i.every(c=>!c.isPending)&&i.some(c=>c.hasResult())&&(i=i.map(c=>c.hasResult()?new Oa(c.source,0):c));for(let c of e.effects)c.is(iH)&&(a=a&&a.setSelected(c.value,this.id));return i==this.active&&a==this.open?this:new hy(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Bhe:Fhe}}function Lhe(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const qhe=[];function sH(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(I6);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Oa{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=sH(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new Oa(s.source,0)),r&4&&s.state==0&&(s=new Oa(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(dy))s=new Oa(s.source,1,i.value);else if(i.is(rp))s=new Oa(s.source,0);else if(i.is(L6))for(let a of i.value)a.source==s.source&&(s=a);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(sd(e.state))}}class Bh extends Oa{constructor(e,n,r,s,i,a){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=a}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),l=sd(e.state);if(l>a||!s||n&2&&(sd(e.startState)==this.from||ln.map(e))}}),iH=Qt.define(),yi=Os.define({create(){return hy.start()},update(t,e){return t.update(e)},provide:t=>[v6.from(t,e=>e.tooltip),Ze.contentAttributes.from(t,e=>e.attrs)]});function B6(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(yi).active.find(s=>s.source==e.source);return r instanceof Bh?(typeof n=="string"?t.dispatch({...The(t.state,n,r.from,r.to),annotations:I6.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const Hhe=Phe(yi,B6);function j1(t,e="option"){return n=>{let r=n.state.field(yi,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:a-1;return l<0?l=e=="page"?0:a-1:l>=a&&(l=e=="page"?a-1:0),n.dispatch({effects:iH.of(l)}),!0}}const Qhe=t=>{let e=t.state.field(yi,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(yi,!1)?(t.dispatch({effects:dy.of(!0)}),!0):!1,Vhe=t=>{let e=t.state.field(yi,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:rp.of(null)}),!0)};class Uhe{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Whe=50,Ghe=1e3,Xhe=Yr.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(yi).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(yi),n=t.state.facet(ws);if(!t.selectionSet&&!t.docChanged&&t.startState.field(yi)==e)return;let r=t.transactions.some(i=>{let a=sH(i,n);return a&8||(i.selection||i.docChanged)&&!(a&3)});for(let i=0;iWhe&&Date.now()-a.time>Ghe){for(let l of a.context.abortListeners)try{l()}catch(c){bi(this.view.state,c)}a.context.abortListeners=null,this.running.splice(i--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(a=>a.is(dy)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(a=>a.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(yi);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(ws).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=sd(e),r=new tH(e,n,t.explicit,this.view),s=new Uhe(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:rp.of(null)}),bi(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(ws).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(ws),r=this.view.state.field(yi);for(let s=0;sl.source==i.active.source);if(a&&a.isPending)if(i.done==null){let l=new Oa(i.active.source,0);for(let c of i.updates)l=l.update(c,n);l.isPending||e.push(l)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:L6.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yi,!1);if(e&&e.tooltip&&this.view.state.facet(ws).closeOnBlur){let n=e.open&&Rq(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:rp.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:dy.of(!1)}),20),this.composing=0}}}),Yhe=typeof navigator=="object"&&/Win/.test(navigator.platform),Khe=uu.highest(Ze.domEventHandlers({keydown(t,e){let n=e.state.field(yi,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Yhe&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(a=>a.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&B6(e,r),!1}})),aH=Ze.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 Zhe{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class F6{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Ds.TrackDel),r=e.mapPos(this.to,1,Ds.TrackDel);return n==null||r==null?null:new F6(this.field,n,r)}}class q6{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),a=/^\s*/.exec(i.text)[0];for(let c of this.lines){if(r.length){let d=a,h=/^\t*/.exec(c)[0].length;for(let m=0;mnew F6(c.field,s[c.line]+c.from,s[c.line]+c.to));return{text:r,ranges:l}}static parse(e){let n=[],r=[],s=[],i;for(let a of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let l=i[1]?+i[1]:null,c=i[2]||i[3]||"",d=-1,h=c.replace(/\\[{}]/g,m=>m[1]);for(let m=0;m=d&&g.field++}for(let m of s)if(m.line==r.length&&m.from>i.index){let g=i[2]?3+(i[1]||"").length:2;m.from-=g,m.to-=g}s.push(new Zhe(d,r.length,i.index,i.index+h.length)),a=a.slice(0,i.index)+c+a.slice(i.index+i[0].length)}a=a.replace(/\\([{}])/g,(l,c,d)=>{for(let h of s)h.line==r.length&&h.from>d&&(h.from--,h.to--);return c}),r.push(a)}return new q6(r,s)}}let Jhe=Ot.widget({widget:new class extends Uo{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),efe=Ot.mark({class:"cm-snippetField"});class _f{constructor(e,n){this.ranges=e,this.active=n,this.deco=Ot.set(e.map(r=>(r.from==r.to?Jhe:efe).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 _f(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 rg=Qt.define({map(t,e){return t&&t.map(e)}}),tfe=Qt.define(),sp=Os.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(rg))return n.value;if(n.is(tfe)&&t)return new _f(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=>Ze.decorations.from(t,e=>e?e.deco:Ot.none)});function $6(t,e){return Me.create(t.filter(n=>n.field==e).map(n=>Me.range(n.from,n.to)))}function nfe(t){let e=q6.parse(t);return(n,r,s,i)=>{let{text:a,ranges:l}=e.instantiate(n.state,s),{main:c}=n.state.selection,d={changes:{from:s,to:i==c.from?c.to:i,insert:An.of(a)},scrollIntoView:!0,annotations:r?[I6.of(r),ss.userEvent.of("input.complete")]:void 0};if(l.length&&(d.selection=$6(l,0)),l.some(h=>h.field>0)){let h=new _f(l,0),m=d.effects=[rg.of(h)];n.state.field(sp,!1)===void 0&&m.push(Qt.appendConfig.of([sp,ofe,lfe,aH]))}n.dispatch(n.state.update(d))}}function oH(t){return({state:e,dispatch:n})=>{let r=e.field(sp,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(a=>a.field==s+t);return n(e.update({selection:$6(r.ranges,s),effects:rg.of(i?null:new _f(r.ranges,s)),scrollIntoView:!0})),!0}}const rfe=({state:t,dispatch:e})=>t.field(sp,!1)?(e(t.update({effects:rg.of(null)})),!0):!1,sfe=oH(1),ife=oH(-1),afe=[{key:"Tab",run:sfe,shift:ife},{key:"Escape",run:rfe}],G_=st.define({combine(t){return t.length?t[0]:afe}}),ofe=uu.highest(Yp.compute([G_],t=>t.facet(G_)));function wl(t,e){return{...e,apply:nfe(t)}}const lfe=Ze.domEventHandlers({mousedown(t,e){let n=e.state.field(sp,!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:$6(n.ranges,s.field),effects:rg.of(n.ranges.some(i=>i.field>s.field)?new _f(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),ip={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Gu=Qt.define({map(t,e){let n=e.mapPos(t,-1,Ds.TrackAfter);return n??void 0}}),H6=new class extends od{};H6.startSide=1;H6.endSide=-1;const lH=Os.define({create(){return Bn.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(Gu)&&(t=t.update({add:[H6.range(n.value,n.value+1)]}));return t}});function cfe(){return[dfe,lH]}const lS="()[]{}<>«»»«[]{}";function cH(t){for(let e=0;e{if((ufe?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&ko(vi(r,0))==1||e!=s.from||n!=s.to)return!1;let i=mfe(t.state,r);return i?(t.dispatch(i),!0):!1}),hfe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=uH(t,t.selection.main.head).brackets||ip.brackets,s=null,i=t.changeByRange(a=>{if(a.empty){let l=pfe(t.doc,a.head);for(let c of r)if(c==l&&Ob(t.doc,a.head)==cH(vi(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:Me.cursor(a.head-c.length)}}return{range:s=a}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},ffe=[{key:"Backspace",run:hfe}];function mfe(t,e){let n=uH(t,t.selection.main.head),r=n.brackets||ip.brackets;for(let s of r){let i=cH(vi(s,0));if(e==s)return i==s?vfe(t,s,r.indexOf(s+s+s)>-1,n):gfe(t,s,i,n.before||ip.before);if(e==i&&dH(t,t.selection.main.from))return xfe(t,s,i)}return null}function dH(t,e){let n=!1;return t.field(lH).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Ob(t,e){let n=t.sliceString(e,e+2);return n.slice(0,ko(vi(n,0)))}function pfe(t,e){let n=t.sliceString(e-2,e);return ko(vi(n,0))==n.length?n:n.slice(1)}function gfe(t,e,n,r){let s=null,i=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:n,from:a.to}],effects:Gu.of(a.to+e.length),range:Me.range(a.anchor+e.length,a.head+e.length)};let l=Ob(t.doc,a.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:a.head},effects:Gu.of(a.head+e.length),range:Me.cursor(a.head+e.length)}:{range:s=a}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function xfe(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&Ob(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Me.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function vfe(t,e,n,r){let s=r.stringPrefixes||ip.stringPrefixes,i=null,a=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Gu.of(l.to+e.length),range:Me.range(l.anchor+e.length,l.head+e.length)};let c=l.head,d=Ob(t.doc,c),h;if(d==e){if(X_(t,c))return{changes:{insert:e+e,from:c},effects:Gu.of(c+e.length),range:Me.cursor(c+e.length)};if(dH(t,c)){let g=n&&t.sliceDoc(c,c+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:c,to:c+g.length,insert:g},range:Me.cursor(c+g.length)}}}else{if(n&&t.sliceDoc(c-2*e.length,c)==e+e&&(h=Y_(t,c-2*e.length,s))>-1&&X_(t,h))return{changes:{insert:e+e+e+e,from:c},effects:Gu.of(c+e.length),range:Me.cursor(c+e.length)};if(t.charCategorizer(c)(d)!=Tr.Word&&Y_(t,c,s)>-1&&!yfe(t,c,e,s))return{changes:{insert:e+e,from:c},effects:Gu.of(c+e.length),range:Me.cursor(c+e.length)}}return{range:i=l}});return i?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function X_(t,e){let n=Ss(t).resolveInner(e+1);return n.parent&&n.from==e}function yfe(t,e,n,r){let s=Ss(t).resolveInner(e,-1),i=r.reduce((a,l)=>Math.max(a,l.length),0);for(let a=0;a<5;a++){let l=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),c=l.indexOf(n);if(!c||c>-1&&r.indexOf(l.slice(0,c))>-1){let h=s.firstChild;for(;h&&h.from==s.from&&h.to-h.from>n.length+c;){if(t.sliceDoc(h.to-n.length,h.to)==n)return!1;h=h.firstChild}return!0}let d=s.to==e&&s.parent;if(!d)break;s=d}return!1}function Y_(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Tr.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))!=Tr.Word)return i}return-1}function bfe(t={}){return[Khe,yi,ws.of(t),Xhe,wfe,aH]}const hH=[{key:"Ctrl-Space",run:oS},{mac:"Alt-`",run:oS},{mac:"Alt-i",run:oS},{key:"Escape",run:Vhe},{key:"ArrowDown",run:j1(!0)},{key:"ArrowUp",run:j1(!1)},{key:"PageDown",run:j1(!0,"page")},{key:"PageUp",run:j1(!1,"page")},{key:"Enter",run:Qhe}],wfe=uu.highest(Yp.computeN([ws],t=>t.facet(ws).defaultKeymap?[hH]:[]));class K_{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Qu{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(ap).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((x,y)=>x.from-y.from||x.to-y.to),a=new Hl,l=[],c=0,d=r.doc.iter(),h=0,m=r.doc.length;for(let x=0;;){let y=x==i.length?null:i[x];if(!y&&!l.length)break;let w,S;if(l.length)w=c,S=l.reduce((N,T)=>Math.min(N,T.to),y&&y.from>w?y.from:1e8);else{if(w=y.from,w>m)break;S=y.to,l.push(y),x++}for(;xN.from||N.to==w))l.push(N),x++,S=Math.min(N.to,S);else{S=Math.min(N.from,S);break}}S=Math.min(S,m);let k=!1;if(l.some(N=>N.from==w&&(N.to==S||S==m))&&(k=w==S,!k&&S-w<10)){let N=w-(h+d.value.length);N>0&&(d.next(N),h=w);for(let T=w;;){if(T>=S){k=!0;break}if(!d.lineBreak&&h+d.value.length>T)break;T=h+d.value.length,h+=d.value.length,d.next()}}let j=Dfe(l);if(k)a.add(w,w,Ot.widget({widget:new _fe(j),diagnostics:l.slice()}));else{let N=l.reduce((T,E)=>E.markClass?T+" "+E.markClass:T,"");a.add(w,S,Ot.mark({class:"cm-lintRange cm-lintRange-"+j+N,diagnostics:l.slice(),inclusiveEnd:l.some(T=>T.to>S)}))}if(c=S,c==m)break;for(let N=0;N{if(!(e&&a.diagnostics.indexOf(e)<0))if(!r)r=new K_(s,i,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new K_(r.from,i,r.diagnostic)}}),r}function Sfe(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(ap).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is(fH))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function kfe(t,e){return t.field(Wi,!1)?e:e.concat(Qt.appendConfig.of(Pfe))}const fH=Qt.define(),Q6=Qt.define(),mH=Qt.define(),Wi=Os.define({create(){return new Qu(Ot.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=of(n,t.selected.diagnostic,i)||of(n,null,i)}!n.size&&s&&e.state.facet(ap).autoPanel&&(s=null),t=new Qu(n,s,r)}for(let n of e.effects)if(n.is(fH)){let r=e.state.facet(ap).autoPanel?n.value.length?op.open:null:t.panel;t=Qu.init(n.value,r,e.state)}else n.is(Q6)?t=new Qu(t.diagnostics,n.value?op.open:null,t.selected):n.is(mH)&&(t=new Qu(t.diagnostics,t.panel,n.value));return t},provide:t=>[Y0.from(t,e=>e.panel),Ze.decorations.from(t,e=>e.diagnostics)]}),Ofe=Ot.mark({class:"cm-lintRange cm-lintRange-active"});function jfe(t,e,n){let{diagnostics:r}=t.state.field(Wi),s,i=-1,a=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(c,d,{spec:h})=>{if(e>=c&&e<=d&&(c==d||(e>c||n>0)&&(egH(t,n,!1)))}const Cfe=t=>{let e=t.state.field(Wi,!1);(!e||!e.panel)&&t.dispatch({effects:kfe(t.state,[Q6.of(!0)])});let n=X0(t,op.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Z_=t=>{let e=t.state.field(Wi,!1);return!e||!e.panel?!1:(t.dispatch({effects:Q6.of(!1)}),!0)},Tfe=t=>{let e=t.state.field(Wi,!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)},Efe=[{key:"Mod-Shift-m",run:Cfe,preventDefault:!0},{key:"F8",run:Tfe}],ap=st.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Vo(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:J_,tooltipFilter:J_,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 J_(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function pH(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 gH(t,e,n){var r;let s=n?pH(e.actions):[];return lr("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},lr("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,a)=>{let l=!1,c=x=>{if(x.preventDefault(),l)return;l=!0;let y=of(t.state.field(Wi).diagnostics,e);y&&i.apply(t,y.from,y.to)},{name:d}=i,h=s[a]?d.indexOf(s[a]):-1,m=h<0?d:[d.slice(0,h),lr("u",d.slice(h,h+1)),d.slice(h+1)],g=i.markClass?" "+i.markClass:"";return lr("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:c,onmousedown:c,"aria-label":` Action: ${d}${h<0?"":` (access key "${s[a]})"`}.`},m)}),e.source&&lr("div",{class:"cm-diagnosticSource"},e.source))}class _fe extends Uo{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return lr("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class eA{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=gH(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class op{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)Z_(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],a=pH(i.actions);for(let l=0;l{for(let i=0;iZ_(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Wi).selected;if(!e)return-1;for(let n=0;n{for(let h of d.diagnostics){if(a.has(h))continue;a.add(h);let m=-1,g;for(let x=r;xr&&(this.items.splice(r,m-r),s=!0)),n&&g.diagnostic==n.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),i=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let d=c.height/this.list.offsetHeight;l.topc.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/d)}})):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(Wi),r=of(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:mH.of(r)})}static open(e){return new op(e)}}function Afe(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function N1(t){return Afe(``,'width="6" height="3"')}const Mfe=Ze.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:N1("#d11")},".cm-lintRange-warning":{backgroundImage:N1("orange")},".cm-lintRange-info":{backgroundImage:N1("#999")},".cm-lintRange-hint":{backgroundImage:N1("#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 Rfe(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function Dfe(t){let e="hint",n=1;for(let r of t){let s=Rfe(r.severity);s>n&&(n=s,e=r.severity)}return e}const Pfe=[Wi,Ze.decorations.compute([Wi],t=>{let{selected:e,panel:n}=t.field(Wi);return!e||!n||e.from==e.to?Ot.none:Ot.set([Ofe.range(e.from,e.to)])}),gce(jfe,{hideOn:Sfe}),Mfe];var tA=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(ffe)),e.defaultKeymap!==!1&&(r=r.concat(Yde)),e.searchKeymap!==!1&&(r=r.concat(She)),e.historyKeymap!==!1&&(r=r.concat(rde)),e.foldKeymap!==!1&&(r=r.concat(fue)),e.completionKeymap!==!1&&(r=r.concat(hH)),e.lintKeymap!==!1&&(r=r.concat(Efe));var s=[];return e.lineNumbers!==!1&&s.push(Cce()),e.highlightActiveLineGutter!==!1&&s.push(_ce()),e.highlightSpecialChars!==!1&&s.push(Vle()),e.history!==!1&&s.push(Gue()),e.foldGutter!==!1&&s.push(xue()),e.drawSelection!==!1&&s.push(Dle()),e.dropCursor!==!1&&s.push(Ble()),e.allowMultipleSelections!==!1&&s.push(Nn.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(sue()),e.syntaxHighlighting!==!1&&s.push(r$(wue,{fallback:!0})),e.bracketMatching!==!1&&s.push(Tue()),e.closeBrackets!==!1&&s.push(cfe()),e.autocompletion!==!1&&s.push(bfe()),e.rectangularSelection!==!1&&s.push(ice()),n!==!1&&s.push(lce()),e.highlightActiveLine!==!1&&s.push(Kle()),e.highlightSelectionMatches!==!1&&s.push(rhe()),e.tabSize&&typeof e.tabSize=="number"&&s.push(Zp.of(" ".repeat(e.tabSize))),s.concat([Yp.of(r.flat())]).filter(Boolean)};const zfe="#e5c07b",nA="#e06c75",Ife="#56b6c2",Lfe="#ffffff",bv="#abb2bf",gO="#7d8799",Bfe="#61afef",Ffe="#98c379",rA="#d19a66",qfe="#c678dd",$fe="#21252b",sA="#2c313a",iA="#282c34",cS="#353a42",Hfe="#3E4451",aA="#528bff",Qfe=Ze.theme({"&":{color:bv,backgroundColor:iA},".cm-content":{caretColor:aA},".cm-cursor, .cm-dropCursor":{borderLeftColor:aA},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Hfe},".cm-panels":{backgroundColor:$fe,color:bv},".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:iA,color:gO,border:"none"},".cm-activeLineGutter":{backgroundColor:sA},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:cS},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:cS,borderBottomColor:cS},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:sA,color:bv}}},{dark:!0}),Vfe=eg.define([{tag:ye.keyword,color:qfe},{tag:[ye.name,ye.deleted,ye.character,ye.propertyName,ye.macroName],color:nA},{tag:[ye.function(ye.variableName),ye.labelName],color:Bfe},{tag:[ye.color,ye.constant(ye.name),ye.standard(ye.name)],color:rA},{tag:[ye.definition(ye.name),ye.separator],color:bv},{tag:[ye.typeName,ye.className,ye.number,ye.changed,ye.annotation,ye.modifier,ye.self,ye.namespace],color:zfe},{tag:[ye.operator,ye.operatorKeyword,ye.url,ye.escape,ye.regexp,ye.link,ye.special(ye.string)],color:Ife},{tag:[ye.meta,ye.comment],color:gO},{tag:ye.strong,fontWeight:"bold"},{tag:ye.emphasis,fontStyle:"italic"},{tag:ye.strikethrough,textDecoration:"line-through"},{tag:ye.link,color:gO,textDecoration:"underline"},{tag:ye.heading,fontWeight:"bold",color:nA},{tag:[ye.atom,ye.bool,ye.special(ye.variableName)],color:rA},{tag:[ye.processingInstruction,ye.string,ye.inserted],color:Ffe},{tag:ye.invalid,color:Lfe}]),xH=[Qfe,r$(Vfe)];var Ufe=Ze.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Wfe=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:a="",basicSetup:l=!0}=e,c=[];switch(n&&c.unshift(Yp.of([Kde])),l&&(typeof l=="boolean"?c.unshift(tA()):c.unshift(tA(l))),a&&c.unshift(tce(a)),i){case"light":c.push(Ufe);break;case"dark":c.push(xH);break;case"none":break;default:c.push(i);break}return r===!1&&c.push(Ze.editable.of(!1)),s&&c.push(Nn.readOnly.of(!0)),[...c]},Gfe=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 Xfe{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 oA{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 uS=null,Yfe=()=>typeof window>"u"?new oA:(uS||(uS=new oA),uS),lA=Qo.define(),Kfe=200,Zfe=[];function Jfe(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:a,extensions:l=Zfe,autoFocus:c,theme:d="light",height:h=null,minHeight:m=null,maxHeight:g=null,width:x=null,minWidth:y=null,maxWidth:w=null,placeholder:S="",editable:k=!0,readOnly:j=!1,indentWithTab:N=!0,basicSetup:T=!0,root:E,initialState:_}=t,[A,D]=b.useState(),[q,B]=b.useState(),[H,W]=b.useState(),ee=b.useState(()=>({current:null}))[0],I=b.useState(()=>({current:null}))[0],V=Ze.theme({"&":{height:h,minHeight:m,maxHeight:g,width:x,minWidth:y,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),L=Ze.updateListener.of(Y=>{if(Y.docChanged&&typeof r=="function"&&!Y.transactions.some(X=>X.annotation(lA))){ee.current?ee.current.reset():(ee.current=new Xfe(()=>{if(I.current){var X=I.current;I.current=null,X()}ee.current=null},Kfe),Yfe().add(ee.current));var R=Y.state.doc,ie=R.toString();r(ie,Y)}s&&s(Gfe(Y))}),$=Wfe({theme:d,editable:k,readOnly:j,placeholder:S,indentWithTab:N,basicSetup:T}),K=[L,V,...$];return a&&typeof a=="function"&&K.push(Ze.updateListener.of(a)),K=K.concat(l),b.useLayoutEffect(()=>{if(A&&!H){var Y={doc:e,selection:n,extensions:K},R=_?Nn.fromJSON(_.json,Y,_.fields):Nn.create(Y);if(W(R),!q){var ie=new Ze({state:R,parent:A,root:E});B(ie),i&&i(ie,R)}}return()=>{q&&(W(void 0),B(void 0))}},[A,H]),b.useEffect(()=>{t.container&&D(t.container)},[t.container]),b.useEffect(()=>()=>{q&&(q.destroy(),B(void 0)),ee.current&&(ee.current.cancel(),ee.current=null)},[q]),b.useEffect(()=>{c&&q&&q.focus()},[c,q]),b.useEffect(()=>{q&&q.dispatch({effects:Qt.reconfigure.of(K)})},[d,l,h,m,g,x,y,w,S,k,j,N,T,r,a]),b.useEffect(()=>{if(e!==void 0){var Y=q?q.state.doc.toString():"";if(q&&e!==Y){var R=ee.current&&!ee.current.isDone,ie=()=>{q&&e!==q.state.doc.toString()&&q.dispatch({changes:{from:0,to:q.state.doc.toString().length,insert:e||""},annotations:[lA.of(!0)]})};R?I.current=ie:ie()}}},[e,q]),{state:H,setState:W,view:q,setView:B,container:A,setContainer:D}}var eme=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],vH=b.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:a,onStatistics:l,onCreateEditor:c,onUpdate:d,autoFocus:h,theme:m="light",height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:j,placeholder:N,indentWithTab:T,editable:E,readOnly:_,root:A,initialState:D}=t,q=zJ(t,eme),B=b.useRef(null),{state:H,view:W,container:ee,setContainer:I}=Jfe({root:A,value:r,autoFocus:h,theme:m,height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:j,placeholder:N,indentWithTab:T,editable:E,readOnly:_,selection:s,onChange:a,onStatistics:l,onCreateEditor:c,onUpdate:d,extensions:i,initialState:D});b.useImperativeHandle(e,()=>({editor:B.current,state:H,view:W}),[B,ee,H,W]);var V=b.useCallback($=>{B.current=$,I($)},[I]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var L=typeof m=="string"?"cm-theme-"+m:"cm-theme";return o.jsx("div",IJ({ref:V,className:""+L+(n?" "+n:"")},q))});vH.displayName="CodeMirror";var cA={};class fy{constructor(e,n,r,s,i,a,l,c,d,h=0,m){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=a,this.buffer=l,this.bufferBase=c,this.curContext=d,this.lookAhead=h,this.parent=m}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new fy(e,[],n,r,r,0,[],0,s?new uA(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,a=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSizec;)this.stack.pop();this.reduceContext(s,d)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&a.buffer[l-4]==0&&a.buffer[l-1]>-1){if(n==r)return;if(a.buffer[l-2]>=n){a.buffer[l-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let l=!1;for(let c=a;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){l=!0;break}if(l)for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,s>4&&(s-=4)}this.buffer[a]=e,this.buffer[a+1]=n,this.buffer[a+2]=r,this.buffer[a+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:a}=this.p;(s>this.pos||n<=a.maxNode)&&(this.pos=s,a.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=a.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new fy(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 tme(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,a;ic&1&&l==a)||s.push(n[i],a)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;n=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,a=>{if(!(a&393216))if(a&65536){let l=(a>>19)-i;if(l>1){let c=a&65535,d=this.stack.length-l*3;if(d>=0&&e.getGoto(this.stack[d],c,!1)>=0)return l<<19|65536|c}}else{let l=r(a,i+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class uA{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class tme{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 my{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 my(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 my(this.stack,this.pos,this.index)}}function C1(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&a--,a>=34&&a--;let c=a-32;if(c>=46&&(c-=46,l=!0),i+=c,l)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class wv{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const dA=new wv;class nme{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=dA,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let a=this.ranges[++s];i+=a.from-r.to,r=a}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.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=dA,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 Fh{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;rme(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Fh.prototype.contextual=Fh.prototype.fallback=Fh.prototype.extend=!1;Fh.prototype.fallback=Fh.prototype.extend=!1;class jb{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function rme(t,e,n,r,s,i){let a=0,l=1<0){let y=t[x];if(c.allows(y)&&(e.token.value==-1||e.token.value==y||sme(y,e.token.value,s,i))){e.acceptToken(y);break}}let h=e.next,m=0,g=t[a+2];if(e.next<0&&g>m&&t[d+g*3-3]==65535){a=t[d+g*3-1];continue e}for(;m>1,y=d+x+(x<<1),w=t[y],S=t[y+1]||65536;if(h=S)m=x+1;else{a=t[y+2],e.advance();continue e}}break}}function hA(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function sme(t,e,n,r){let s=hA(n,r,e);return s<0||hA(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 ime{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?fA(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?fA(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(i instanceof ur){if(a==e){if(a=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+i.length}}}class ame{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new wv)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,a=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,c=0;for(let d=0;dm.end+25&&(c=Math.max(m.lookAhead,c)),m.value!=0)){let g=n;if(m.extended>-1&&(n=this.addActions(e,m.extended,m.end,n)),n=this.addActions(e,m.value,m.end,n),!h.extend&&(r=m,n>g))break}}for(;this.actions.length>n;)this.actions.pop();return c&&e.setLookAhead(c),!r&&e.pos==this.stream.end&&(r=new wv,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 wv,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let a=0;a=0&&r.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new ime(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)r.push(l);else{if(this.advanceStack(l,r,e))continue;{s||(s=[],i=[]),s.push(l);let c=this.tokens.getMainToken(l);i.push(c.value,c.end)}}break}}if(!r.length){let a=s&&ume(s);if(a)return qi&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw qi&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let a=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(a)return qi&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(r.length>a)for(r.sort((l,c)=>c.score-l.score);r.length>a;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a500&&d.buffer.length>500)if((l.score-d.score||l.buffer.length-d.buffer.length)>0)r.splice(c--,1);else{r.splice(a--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let a=1;a ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,h=d?e.curContext.hash:0;for(let m=this.fragments.nodeAt(s);m;){let g=this.parser.nodeSet.types[m.type.id]==m.type?i.getGoto(e.state,m.type.id):-1;if(g>-1&&m.length&&(!d||(m.prop(an.contextHash)||0)==h))return e.useNode(m,g),qi&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(m.type.id)})`),!0;if(!(m instanceof ur)||m.children.length==0||m.positions[0]>0)break;let x=m.children[0];if(x instanceof ur&&m.positions[0]==0)m=x;else break}}let l=i.stateSlot(e.state,4);if(l>0)return e.reduce(l),qi&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let d=0;ds?n.push(y):r.push(y)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return mA(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let a=0;a ":"";if(l.deadEnd&&(i||(i=!0,l.restart(),qi&&console.log(h+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let m=l.split(),g=h;for(let x=0;x<10&&m.forceReduce()&&(qi&&console.log(g+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,r));x++)qi&&(g=this.stackID(m)+" -> ");for(let x of l.recoverByInsert(c))qi&&console.log(h+this.stackID(x)+" (via recover-insert)"),this.advanceFully(x,r);this.stream.end>l.pos?(d==l.pos&&(d++,c=0),l.recoverByDelete(c,d),qi&&console.log(h+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),mA(l,r)):(!s||s.scoret;class cme{constructor(e){this.start=e.start,this.shift=e.shift||hS,this.reduce=e.reduce||hS,this.reuse=e.reuse||hS,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class lp extends S6{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let l=0;le.topRules[l][1]),s=[];for(let l=0;l=0)i(h,c,l[d++]);else{let m=l[d+-h];for(let g=-h;g>0;g--)i(l[d++],c,m);d++}}}this.nodeSet=new gb(n.map((l,c)=>ai.define({name:c>=this.minRepeatTerm?void 0:l,id:c,props:s[c],top:r.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Iq;let a=C1(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Fh(a,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new ome(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let a=s[i++],l=a&1,c=s[i++];if(l&&r)return c;for(let d=i+(a>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=_l(this.data,i+2);else break;s=n(_l(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=_l(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,a)=>a&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(lp.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(l=>l.from==r.external);if(!i)return r;let a=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=pA(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let a=n.indexOf(i);a>=0&&(r[a]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const dme=1,yH=194,bH=195,hme=196,gA=197,fme=198,mme=199,pme=200,gme=2,wH=3,xA=201,xme=24,vme=25,yme=49,bme=50,wme=55,Sme=56,kme=57,Ome=59,jme=60,Nme=61,Cme=62,Tme=63,Eme=65,_me=238,Ame=71,Mme=241,Rme=242,Dme=243,Pme=244,zme=245,Ime=246,Lme=247,Bme=248,SH=72,Fme=249,qme=250,$me=251,Hme=252,Qme=253,Vme=254,Ume=255,Wme=256,Gme=73,Xme=77,Yme=263,Kme=112,Zme=130,Jme=151,e0e=152,t0e=155,fd=10,cp=13,V6=32,Nb=9,U6=35,n0e=40,r0e=46,xO=123,vA=125,kH=39,OH=34,yA=92,s0e=111,i0e=120,a0e=78,o0e=117,l0e=85,c0e=new Set([vme,yme,bme,Yme,Eme,Zme,Sme,kme,_me,Cme,Tme,SH,Gme,Xme,jme,Nme,Jme,e0e,t0e,Kme]);function fS(t){return t==fd||t==cp}function mS(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const u0e=new jb((t,e)=>{let n;if(t.next<0)t.acceptToken(mme);else if(e.context.flags&Sv)fS(t.next)&&t.acceptToken(fme,1);else if(((n=t.peek(-1))<0||fS(n))&&e.canShift(gA)){let r=0;for(;t.next==V6||t.next==Nb;)t.advance(),r++;(t.next==fd||t.next==cp||t.next==U6)&&t.acceptToken(gA,-r)}else fS(t.next)&&t.acceptToken(hme,1)},{contextual:!0}),d0e=new jb((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==fd||r==cp){let s=0,i=0;for(;;){if(t.next==V6)s++;else if(t.next==Nb)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=fd&&t.next!=cp&&t.next!=U6&&(s[t,e|jH])),m0e=new cme({start:h0e,reduce(t,e,n,r){return t.flags&Sv&&c0e.has(e)||(e==Ame||e==SH)&&t.flags&jH?t.parent:t},shift(t,e,n,r){return e==yH?new kv(t,f0e(r.read(r.pos,n.pos)),0):e==bH?t.parent:e==xme||e==wme||e==Ome||e==wH?new kv(t,0,Sv):bA.has(e)?new kv(t,0,bA.get(e)|t.flags&Sv):t},hash(t){return t.hash}}),p0e=new jb(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==V6||n==Nb)){n!=n0e&&n!=r0e&&n!=fd&&n!=cp&&n!=U6&&t.acceptToken(dme);return}}}),g0e=new jb((t,e)=>{let{flags:n}=e.context,r=n&jl?OH:kH,s=(n&Nl)>0,i=!(n&Cl),a=(n&Tl)>0,l=t.pos;for(;!(t.next<0);)if(a&&t.next==xO)if(t.peek(1)==xO)t.advance(2);else{if(t.pos==l){t.acceptToken(wH,1);return}break}else if(i&&t.next==yA){if(t.pos==l){t.advance();let c=t.next;c>=0&&(t.advance(),x0e(t,c)),t.acceptToken(gme);return}break}else if(t.next==yA&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==l){t.acceptToken(xA,s?3:1);return}break}else if(t.next==fd){if(s)t.advance();else if(t.pos==l){t.acceptToken(xA);return}break}else t.advance();t.pos>l&&t.acceptToken(pme)});function x0e(t,e){if(e==s0e)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==i0e)for(let n=0;n<2&&mS(t.next);n++)t.advance();else if(e==o0e)for(let n=0;n<4&&mS(t.next);n++)t.advance();else if(e==l0e)for(let n=0;n<8&&mS(t.next);n++)t.advance();else if(e==a0e&&t.next==xO){for(t.advance();t.next>=0&&t.next!=vA&&t.next!=kH&&t.next!=OH&&t.next!=fd;)t.advance();t.next==vA&&t.advance()}}const v0e=k6({'async "*" "**" FormatConversion FormatSpec':ye.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":ye.controlKeyword,"in not and or is del":ye.operatorKeyword,"from def class global nonlocal lambda":ye.definitionKeyword,import:ye.moduleKeyword,"with as print":ye.keyword,Boolean:ye.bool,None:ye.null,VariableName:ye.variableName,"CallExpression/VariableName":ye.function(ye.variableName),"FunctionDefinition/VariableName":ye.function(ye.definition(ye.variableName)),"ClassDefinition/VariableName":ye.definition(ye.className),PropertyName:ye.propertyName,"CallExpression/MemberExpression/PropertyName":ye.function(ye.propertyName),Comment:ye.lineComment,Number:ye.number,String:ye.string,FormatString:ye.special(ye.string),Escape:ye.escape,UpdateOp:ye.updateOperator,"ArithOp!":ye.arithmeticOperator,BitOp:ye.bitwiseOperator,CompareOp:ye.compareOperator,AssignOp:ye.definitionOperator,Ellipsis:ye.punctuation,At:ye.meta,"( )":ye.paren,"[ ]":ye.squareBracket,"{ }":ye.brace,".":ye.derefOperator,", ;":ye.separator}),y0e={__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},b0e=lp.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:[p0e,d0e,u0e,g0e,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>y0e[t]||-1}],tokenPrec:7668}),wA=new Ice,NH=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function T1(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const w0e={FunctionDefinition:T1("function"),ClassDefinition:T1("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let a=s.getChild("import");a;a=a.nextSibling)a.name=="VariableName"&&((r=a.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(a,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:T1("variable"),AsPattern:T1("variable"),__proto__:null};function CH(t,e){let n=wA.get(e);if(n)return n;let r=[],s=!0;function i(a,l){let c=t.sliceString(a.from,a.to);r.push({label:c,type:l})}return e.cursor(hs.IncludeAnonymous).iterate(a=>{if(a.name){let l=w0e[a.name];if(l&&l(a,i,s)||!s&&NH.has(a.name))return!1;s=!1}else if(a.to-a.from>8192){for(let l of CH(t,a.node))r.push(l);return!1}}),wA.set(e,r),r}const SA=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,TH=["String","FormatString","Comment","PropertyName"];function S0e(t){let e=Ss(t.state).resolveInner(t.pos,-1);if(TH.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&SA.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)NH.has(s.name)&&(r=r.concat(CH(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:SA}}const k0e=["__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"}))),O0e=[wl("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),wl("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),wl("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),wl("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),wl(`if \${}: -`,{label:"if",detail:"block",type:"keyword"}),vl("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),vl("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),vl("import ${module}",{label:"import",detail:"statement",type:"keyword"}),vl("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],w0e=khe(OH,Z$(y0e.concat(b0e)));function dS(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 hS(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 fS=X0.define({name:"python",parser:g0e.configure({props:[mb.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&dS(t)||t.node;return(e=hS(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=dS(t);return(e=hS(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":X4({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":X4({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":X4({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=dS(t);return(e=n&&hS(t,n))!==null&&e!==void 0?e:t.continue()}}),b6.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":Qq,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 S0e(){return new qq(fS,[fS.data.of({autocomplete:v0e}),fS.data.of({autocomplete:w0e})])}const k0e=x6({String:ve.string,Number:ve.number,"True False":ve.bool,PropertyName:ve.propertyName,Null:ve.null,", :":ve.separator,"[ ]":ve.squareBracket,"{ }":ve.brace}),O0e=sp.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:[k0e],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}),j0e=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=N0e(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function N0e(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 C0e=X0.define({name:"json",parser:O0e.configure({props:[mb.add({Object:x_({except:/^\s*\}/}),Array:x_({except:/^\s*\]/})}),b6.add({"Object Array":Qq})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function T0e(){return new qq(C0e)}const E0e={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:"#"}}},_0e={python:[S0e()],json:[T0e(),j0e()],toml:[w6.define(E0e)],text:[]};function A0e({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:a,placeholder:l,theme:c="dark",className:d=""}){const[h,m]=b.useState(!1);if(b.useEffect(()=>{m(!0)},[]),!h)return o.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${d}`,style:{height:s,minHeight:i,maxHeight:a}});const g=[..._0e[n]||[],Ze.lineWrapping];return r&&g.push(Ze.editable.of(!1)),o.jsx("div",{className:`rounded-md overflow-hidden border ${d}`,children:o.jsx(mH,{value:t,height:s,minHeight:i,maxHeight:a,theme:c==="dark"?fH:void 0,extensions:g,onChange:e,placeholder:l,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function M0e(){const[t,e]=b.useState(!0),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!1),[g,x]=b.useState("visual"),[y,w]=b.useState(""),[S,k]=b.useState(!1),{toast:j}=as(),[N,T]=b.useState(null),[E,_]=b.useState(null),[A,L]=b.useState(null),[P,B]=b.useState(null),[$,U]=b.useState(null),[te,z]=b.useState(null),[Q,F]=b.useState(null),[Y,J]=b.useState(null),[X,R]=b.useState(null),[ie,G]=b.useState(null),[I,V]=b.useState(null),[ee,ne]=b.useState(null),[W,se]=b.useState(null),[re,oe]=b.useState(null),[Te,We]=b.useState(null),[Ye,Je]=b.useState(null),[Oe,Ve]=b.useState(null),[Ue,He]=b.useState(null),Ot=b.useRef(null),xt=b.useRef(!0),kn=b.useRef({}),It=b.useCallback(async()=>{try{const Fe=await bae();w(Fe),k(!1)}catch(Fe){j({variant:"destructive",title:"加载失败",description:Fe instanceof Error?Fe.message:"加载源代码失败"})}},[j]),Yt=b.useCallback(async()=>{try{e(!0);const Fe=await iE();kn.current=Fe,T(Fe.bot),_(Fe.personality);const rt=Fe.chat;rt.talk_value_rules||(rt.talk_value_rules=[]),L(rt),B(Fe.expression),U(Fe.emoji),z(Fe.memory),F(Fe.tool),J(Fe.mood),R(Fe.voice),G(Fe.lpmm_knowledge),V(Fe.keyword_reaction),ne(Fe.response_post_process),se(Fe.chinese_typo),oe(Fe.response_splitter),We(Fe.log),Je(Fe.debug),Ve(Fe.maim_message),He(Fe.telemetry),l(!1),xt.current=!1,await It()}catch(Fe){console.error("加载配置失败:",Fe),j({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[j,It]);b.useEffect(()=>{Yt()},[Yt]);const _t=b.useCallback(async(Fe,rt)=>{if(!xt.current)try{i(!0),await Sae(Fe,rt),l(!1)}catch(tn){console.error(`自动保存 ${Fe} 失败:`,tn),l(!0)}finally{i(!1)}},[]),mt=b.useCallback((Fe,rt)=>{xt.current||(l(!0),Ot.current&&clearTimeout(Ot.current),Ot.current=setTimeout(()=>{_t(Fe,rt)},2e3))},[_t]);b.useEffect(()=>{N&&!xt.current&&mt("bot",N)},[N,mt]),b.useEffect(()=>{E&&!xt.current&&mt("personality",E)},[E,mt]),b.useEffect(()=>{A&&!xt.current&&mt("chat",A)},[A,mt]),b.useEffect(()=>{P&&!xt.current&&mt("expression",P)},[P,mt]),b.useEffect(()=>{$&&!xt.current&&mt("emoji",$)},[$,mt]),b.useEffect(()=>{te&&!xt.current&&mt("memory",te)},[te,mt]),b.useEffect(()=>{Q&&!xt.current&&mt("tool",Q)},[Q,mt]),b.useEffect(()=>{Y&&!xt.current&&mt("mood",Y)},[Y,mt]),b.useEffect(()=>{X&&!xt.current&&mt("voice",X)},[X,mt]),b.useEffect(()=>{ie&&!xt.current&&mt("lpmm_knowledge",ie)},[ie,mt]),b.useEffect(()=>{I&&!xt.current&&mt("keyword_reaction",I)},[I,mt]),b.useEffect(()=>{ee&&!xt.current&&mt("response_post_process",ee)},[ee,mt]),b.useEffect(()=>{W&&!xt.current&&mt("chinese_typo",W)},[W,mt]),b.useEffect(()=>{re&&!xt.current&&mt("response_splitter",re)},[re,mt]),b.useEffect(()=>{Te&&!xt.current&&mt("log",Te)},[Te,mt]),b.useEffect(()=>{Ye&&!xt.current&&mt("debug",Ye)},[Ye,mt]),b.useEffect(()=>{Oe&&!xt.current&&mt("maim_message",Oe)},[Oe,mt]),b.useEffect(()=>{Ue&&!xt.current&&mt("telemetry",Ue)},[Ue,mt]);const Ne=async()=>{try{r(!0),await wae(y),l(!1),k(!1),j({title:"保存成功",description:"配置已保存"}),await Yt()}catch(Fe){k(!0),j({variant:"destructive",title:"保存失败",description:Fe instanceof Error?Fe.message:"保存配置失败"})}finally{r(!1)}},Ie=async Fe=>{if(a){j({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(x(Fe),Fe==="source")await It();else try{const rt=await iE();kn.current=rt,T(rt.bot),_(rt.personality);const tn=rt.chat;tn.talk_value_rules||(tn.talk_value_rules=[]),L(tn),B(rt.expression),U(rt.emoji),z(rt.memory),F(rt.tool),J(rt.mood),R(rt.voice),G(rt.lpmm_knowledge),V(rt.keyword_reaction),ne(rt.response_post_process),se(rt.chinese_typo),oe(rt.response_splitter),We(rt.log),Je(rt.debug),Ve(rt.maim_message),He(rt.telemetry),l(!1)}catch(rt){console.error("加载配置失败:",rt),j({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},st=async()=>{try{r(!0),Ot.current&&clearTimeout(Ot.current);const Fe={...kn.current,bot:N,personality:E,chat:A,expression:P,emoji:$,memory:te,tool:Q,mood:Y,voice:X,lpmm_knowledge:ie,keyword_reaction:I,response_post_process:ee,chinese_typo:W,response_splitter:re,log:Te,debug:Ye,maim_message:Oe,telemetry:Ue};await aE(Fe),l(!1),j({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(Fe){console.error("保存配置失败:",Fe),j({title:"保存失败",description:Fe.message,variant:"destructive"})}finally{r(!1)}},yt=async()=>{try{d(!0),ib().catch(()=>{}),m(!0)}catch(Fe){console.error("重启失败:",Fe),m(!1),j({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),d(!1)}},Pt=async()=>{try{r(!0),Ot.current&&clearTimeout(Ot.current);const Fe={...kn.current,bot:N,personality:E,chat:A,expression:P,emoji:$,memory:te,tool:Q,mood:Y,voice:X,lpmm_knowledge:ie,keyword_reaction:I,response_post_process:ee,chinese_typo:W,response_splitter:re,log:Te,debug:Ye,maim_message:Oe,telemetry:Ue};await aE(Fe),l(!1),j({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(rt=>setTimeout(rt,500)),await yt()}catch(Fe){console.error("保存失败:",Fe),j({title:"保存失败",description:Fe.message,variant:"destructive"})}finally{r(!1)}},Mt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},zn=()=>{m(!1),d(!1),j({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?o.jsx(gn,{className:"h-full",children:o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[o.jsx(ja,{value:g,onValueChange:Fe=>Ie(Fe),className:"w-auto",children:o.jsxs(Wi,{className:"h-9",children:[o.jsxs(Lt,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[o.jsx(Wee,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),o.jsxs(Lt,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[o.jsx(Gee,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),o.jsxs(de,{onClick:g==="visual"?st:Ne,disabled:n||s||!a||c,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[o.jsx(Gy,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":a?"保存配置":"已保存"]}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{disabled:n||s||c,size:"sm",className:"flex-1 sm:flex-none",children:[o.jsx(Aj,{className:"mr-2 h-4 w-4"}),c?"重启中...":a?"保存并重启":"重启麦麦"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认重启麦麦?"}),o.jsx(_n,{className:"space-y-3",asChild:!0,children:o.jsxs("div",{children:[o.jsx("p",{children:a?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(ga,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(xa,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",o.jsxs(Dr,{children:[o.jsx(Of,{asChild:!0,children:o.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[o.jsx(Wy,{className:"h-3 w-3"}),"如何结束程序?"]})}),o.jsxs(Sr,{className:"max-w-2xl",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"如何结束使用重启功能后的麦麦程序"}),o.jsx(ss,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),o.jsxs(ja,{defaultValue:"windows",className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-3",children:[o.jsx(Lt,{value:"windows",children:"Windows"}),o.jsx(Lt,{value:"macos",children:"macOS"}),o.jsx(Lt,{value:"linux",children:"Linux"})]}),o.jsxs(un,{value:"windows",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),o.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),o.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),o.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),o.jsxs(un,{value:"macos",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight,搜索"活动监视器"']}),o.jsxs("li",{children:["在进程列表中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),o.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]})]}),o.jsxs(un,{value:"linux",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),o.jsx("p",{children:'pkill -9 -f "bot.py"'}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["在终端输入 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),o.jsx(ws,{children:o.jsx(Gj,{asChild:!0,children:o.jsx(de,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:a?Pt:yt,children:a?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(ga,{children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsxs(xa,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),g==="source"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs(ga,{children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsxs(xa,{children:[o.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",S&&o.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),o.jsx(A0e,{value:y,onChange:Fe=>{w(Fe),l(!0),S&&k(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),g==="visual"&&o.jsx(o.Fragment,{children:o.jsxs(ja,{defaultValue:"bot",className:"w-full",children:[o.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:o.jsxs(Wi,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[o.jsx(Lt,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),o.jsx(Lt,{value:"personality",className:"flex-shrink-0",children:"人格"}),o.jsx(Lt,{value:"chat",className:"flex-shrink-0",children:"聊天"}),o.jsx(Lt,{value:"expression",className:"flex-shrink-0",children:"表达"}),o.jsx(Lt,{value:"features",className:"flex-shrink-0",children:"功能"}),o.jsx(Lt,{value:"processing",className:"flex-shrink-0",children:"处理"}),o.jsx(Lt,{value:"mood",className:"flex-shrink-0",children:"情绪"}),o.jsx(Lt,{value:"voice",className:"flex-shrink-0",children:"语音"}),o.jsx(Lt,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),o.jsx(Lt,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),o.jsx(un,{value:"bot",className:"space-y-4",children:N&&o.jsx(R0e,{config:N,onChange:T})}),o.jsx(un,{value:"personality",className:"space-y-4",children:E&&o.jsx(D0e,{config:E,onChange:_})}),o.jsx(un,{value:"chat",className:"space-y-4",children:A&&o.jsx(P0e,{config:A,onChange:L})}),o.jsx(un,{value:"expression",className:"space-y-4",children:P&&o.jsx(I0e,{config:P,onChange:B})}),o.jsx(un,{value:"features",className:"space-y-4",children:$&&te&&Q&&o.jsx(L0e,{emojiConfig:$,memoryConfig:te,toolConfig:Q,onEmojiChange:U,onMemoryChange:z,onToolChange:F})}),o.jsx(un,{value:"processing",className:"space-y-4",children:I&&ee&&W&&re&&o.jsx(B0e,{keywordReactionConfig:I,responsePostProcessConfig:ee,chineseTypoConfig:W,responseSplitterConfig:re,onKeywordReactionChange:V,onResponsePostProcessChange:ne,onChineseTypoChange:se,onResponseSplitterChange:oe})}),o.jsx(un,{value:"mood",className:"space-y-4",children:Y&&o.jsx(F0e,{config:Y,onChange:J})}),o.jsx(un,{value:"voice",className:"space-y-4",children:X&&o.jsx(q0e,{config:X,onChange:R})}),o.jsx(un,{value:"lpmm",className:"space-y-4",children:ie&&o.jsx($0e,{config:ie,onChange:G})}),o.jsxs(un,{value:"other",className:"space-y-4",children:[Te&&o.jsx(H0e,{config:Te,onChange:We}),Ye&&o.jsx(Q0e,{config:Ye,onChange:Je}),Oe&&o.jsx(V0e,{config:Oe,onChange:Ve}),Ue&&o.jsx(U0e,{config:Ue,onChange:He})]})]})}),h&&o.jsx(Kj,{onRestartComplete:Mt,onRestartFailed:zn})]})})}function R0e({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=c=>{e({...t,platforms:t.platforms.filter((d,h)=>h!==c)})},s=(c,d)=>{const h=[...t.platforms];h[c]=d,e({...t,platforms:h})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},a=c=>{e({...t,alias_names:t.alias_names.filter((d,h)=>h!==c)})},l=(c,d)=>{const h=[...t.alias_names];h[c]=d,e({...t,alias_names:h})};return o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"platform",children:"平台"}),o.jsx(ze,{id:"platform",value:t.platform,onChange:c=>e({...t,platform:c.target.value}),placeholder:"qq"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"qq_account",children:"QQ账号"}),o.jsx(ze,{id:"qq_account",value:t.qq_account,onChange:c=>e({...t,qq_account:c.target.value}),placeholder:"123456789"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"nickname",children:"昵称"}),o.jsx(ze,{id:"nickname",value:t.nickname,onChange:c=>e({...t,nickname:c.target.value}),placeholder:"麦麦"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"其他平台账号"}),o.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加"]})]}),o.jsxs("div",{className:"space-y-2",children:[t.platforms.map((c,d)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{value:c,onChange:h=>s(d,h.target.value),placeholder:"wx:114514"}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除平台账号 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r(d),children:"删除"})]})]})]})]},d)),t.platforms.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"别名"}),o.jsxs(de,{onClick:i,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加"]})]}),o.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((c,d)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{value:c,onChange:h=>l(d,h.target.value),placeholder:"小麦"}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除别名 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>a(d),children:"删除"})]})]})]})]},d)),t.alias_names.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function D0e({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((a,l)=>l!==i)})},s=(i,a)=>{const l=[...t.states];l[i]=a,e({...t,states:l})};return o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"personality",children:"人格特质"}),o.jsx(Mr,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"reply_style",children:"表达风格"}),o.jsx(Mr,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"interest",children:"兴趣"}),o.jsx(Mr,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"plan_style",children:"说话规则与行为风格"}),o.jsx(Mr,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"visual_style",children:"识图规则"}),o.jsx(Mr,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"private_plan_style",children:"私聊规则"}),o.jsx(Mr,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"状态列表(人格多样性)"}),o.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),o.jsx("div",{className:"space-y-2",children:t.states.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Mr,{value:i,onChange:l=>s(a,l.target.value),placeholder:"描述一个人格状态",rows:2}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsx(_n,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r(a),children:"删除"})]})]})]})]},a))})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"state_probability",children:"状态替换概率"}),o.jsx(ze,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function P0e({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=l=>{e({...t,talk_value_rules:t.talk_value_rules.filter((c,d)=>d!==l)})},s=(l,c,d)=>{const h=[...t.talk_value_rules];h[l]={...h[l],[c]:d},e({...t,talk_value_rules:h})},i=({value:l,onChange:c})=>{const[d,h]=b.useState("00"),[m,g]=b.useState("00"),[x,y]=b.useState("23"),[w,S]=b.useState("59");b.useEffect(()=>{const j=l.split("-");if(j.length===2){const[N,T]=j,[E,_]=N.split(":"),[A,L]=T.split(":");E&&h(E.padStart(2,"0")),_&&g(_.padStart(2,"0")),A&&y(A.padStart(2,"0")),L&&S(L.padStart(2,"0"))}},[l]);const k=(j,N,T,E)=>{const _=`${j}:${N}-${T}:${E}`;c(_)};return o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[o.jsx(_h,{className:"h-4 w-4 mr-2"}),l||"选择时间段"]})}),o.jsx(Xa,{className:"w-80",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"小时"}),o.jsxs(Vt,{value:d,onValueChange:j=>{h(j),k(j,m,x,w)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:24},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"分钟"}),o.jsxs(Vt,{value:m,onValueChange:j=>{g(j),k(d,j,x,w)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:60},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"小时"}),o.jsxs(Vt,{value:x,onValueChange:j=>{y(j),k(d,m,j,w)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:24},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"分钟"}),o.jsxs(Vt,{value:w,onValueChange:j=>{S(j),k(d,m,x,j)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:60},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]})]})]})]})})]})},a=({rule:l})=>{const c=`{ target = "${l.target}", time = "${l.time}", value = ${l.value.toFixed(1)} }`;return o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Ea,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Xa,{className:"w-96",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:c}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),o.jsx(ze,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:l=>e({...t,talk_value:parseFloat(l.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"mentioned_bot_reply",checked:t.mentioned_bot_reply,onCheckedChange:l=>e({...t,mentioned_bot_reply:l})}),o.jsx(he,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_context_size",children:"上下文长度"}),o.jsx(ze,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:l=>e({...t,max_context_size:parseInt(l.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"planner_smooth",children:"规划器平滑"}),o.jsx(ze,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:l=>e({...t,planner_smooth:parseFloat(l.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:l=>e({...t,enable_talk_value_rules:l})}),o.jsx(he,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:l=>e({...t,include_planner_reasoning:l})}),o.jsx(he,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&o.jsxs("div",{className:"border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),o.jsxs(de,{onClick:n,size:"sm",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?o.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((l,c)=>o.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",c+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(a,{rule:l}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{variant:"ghost",size:"sm",children:o.jsx(Sn,{className:"h-4 w-4 text-destructive"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除规则 #",c+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r(c),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"配置类型"}),o.jsxs(Vt,{value:l.target===""?"global":"specific",onValueChange:d=>{d==="global"?s(c,"target",""):s(c,"target","qq::group")},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"global",children:"全局配置"}),o.jsx(De,{value:"specific",children:"详细配置"})]})]})]}),l.target!==""&&(()=>{const d=l.target.split(":"),h=d[0]||"qq",m=d[1]||"",g=d[2]||"group";return o.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"平台"}),o.jsxs(Vt,{value:h,onValueChange:x=>{s(c,"target",`${x}:${m}:${g}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"qq",children:"QQ"}),o.jsx(De,{value:"wx",children:"微信"})]})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"群 ID"}),o.jsx(ze,{value:m,onChange:x=>{s(c,"target",`${h}:${x.target.value}:${g}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"类型"}),o.jsxs(Vt,{value:g,onValueChange:x=>{s(c,"target",`${h}:${m}:${x}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"group",children:"群组(group)"}),o.jsx(De,{value:"private",children:"私聊(private)"})]})]})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",l.target||"(未设置)"]})]})})(),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"时间段 (Time)"}),o.jsx(i,{value:l.time,onChange:d=>s(c,"time",d)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{htmlFor:`rule-value-${c}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),o.jsx(ze,{id:`rule-value-${c}`,type:"number",step:"0.01",min:"0.01",max:"1",value:l.value,onChange:d=>{const h=parseFloat(d.target.value);isNaN(h)||s(c,"value",Math.max(.01,Math.min(1,h)))},className:"w-20 h-8 text-xs"})]}),o.jsx(Bp,{value:[l.value],onValueChange:d=>s(c,"value",d[0]),min:.01,max:1,step:.01,className:"w-full"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"0.01 (极少发言)"}),o.jsx("span",{children:"0.5"}),o.jsx("span",{children:"1.0 (正常)"})]})]})]})]},c))}):o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:o.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),o.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[o.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),o.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[o.jsxs("li",{children:["• ",o.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function z0e({member:t,groupIndex:e,memberIndex:n,availableChatIds:r,onUpdate:s,onRemove:i}){const a=r.includes(t)||t==="*",[l,c]=b.useState(!a);return o.jsxs("div",{className:"flex gap-2",children:[o.jsx("div",{className:"flex-1 flex gap-2",children:l?o.jsxs(o.Fragment,{children:[o.jsx(ze,{value:t,onChange:d=>s(e,n,d.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),r.length>0&&o.jsx(de,{size:"sm",variant:"outline",onClick:()=>c(!1),title:"切换到下拉选择",children:"下拉"})]}):o.jsxs(o.Fragment,{children:[o.jsxs(Vt,{value:t,onValueChange:d=>s(e,n,d),children:[o.jsx($t,{className:"flex-1",children:o.jsx(Ut,{placeholder:"选择聊天流"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"*",children:"* (全局共享)"}),r.map((d,h)=>o.jsx(De,{value:d,children:d},h))]})]}),o.jsx(de,{size:"sm",variant:"outline",onClick:()=>c(!0),title:"切换到手动输入",children:"输入"})]})}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除组成员 "',t||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>i(e,n),children:"删除"})]})]})]})]})}function I0e({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=m=>{e({...t,learning_list:t.learning_list.filter((g,x)=>x!==m)})},s=(m,g,x)=>{const y=[...t.learning_list];y[m][g]=x,e({...t,learning_list:y})},i=({rule:m})=>{const g=`["${m[0]}", "${m[1]}", "${m[2]}", "${m[3]}"]`;return o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Ea,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Xa,{className:"w-96",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:g}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},a=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},l=m=>{e({...t,expression_groups:t.expression_groups.filter((g,x)=>x!==m)})},c=m=>{const g=[...t.expression_groups];g[m]=[...g[m],""],e({...t,expression_groups:g})},d=(m,g)=>{const x=[...t.expression_groups];x[m]=x[m].filter((y,w)=>w!==g),e({...t,expression_groups:x})},h=(m,g,x)=>{const y=[...t.expression_groups];y[m][g]=x,e({...t,expression_groups:y})};return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),o.jsxs(de,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),o.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((m,g)=>{const x=t.learning_list.some((N,T)=>T!==g&&N[0]===""),y=m[0]==="",w=m[0].split(":"),S=w[0]||"qq",k=w[1]||"",j=w[2]||"group";return o.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["规则 ",g+1," ",y&&"(全局配置)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(i,{rule:m}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"sm",variant:"ghost",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除学习规则 ",g+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r(g),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"配置类型"}),o.jsxs(Vt,{value:y?"global":"specific",onValueChange:N=>{N==="global"?s(g,0,""):s(g,0,"qq::group")},disabled:x&&!y,children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"global",children:"全局配置"}),o.jsx(De,{value:"specific",disabled:x&&!y,children:"详细配置"})]})]}),x&&!y&&o.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!y&&o.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"平台"}),o.jsxs(Vt,{value:S,onValueChange:N=>{s(g,0,`${N}:${k}:${j}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"qq",children:"QQ"}),o.jsx(De,{value:"wx",children:"微信"})]})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"群 ID"}),o.jsx(ze,{value:k,onChange:N=>{s(g,0,`${S}:${N.target.value}:${j}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"类型"}),o.jsxs(Vt,{value:j,onValueChange:N=>{s(g,0,`${S}:${k}:${N}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"group",children:"群组(group)"}),o.jsx(De,{value:"private",children:"私聊(private)"})]})]})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",m[0]||"(未设置)"]})]}),o.jsx("div",{className:"grid gap-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs font-medium",children:"使用学到的表达"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),o.jsx(Bt,{checked:m[1]==="enable",onCheckedChange:N=>s(g,1,N?"enable":"disable")})]})}),o.jsx("div",{className:"grid gap-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs font-medium",children:"学习表达"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),o.jsx(Bt,{checked:m[2]==="enable",onCheckedChange:N=>s(g,2,N?"enable":"disable")})]})}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{className:"text-xs font-medium",children:"学习强度"}),o.jsx(ze,{type:"number",step:"0.1",min:"0",max:"5",value:m[3],onChange:N=>{const T=parseFloat(N.target.value);isNaN(T)||s(g,3,Math.max(0,Math.min(5,T)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),o.jsx(Bp,{value:[parseFloat(m[3])||1],onValueChange:N=>s(g,3,N[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"0 (不学习)"}),o.jsx("span",{children:"2.5"}),o.jsx("span",{children:"5.0 (快速学习)"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},g)}),t.learning_list.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),o.jsxs(de,{onClick:a,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),o.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((m,g)=>{const x=t.learning_list.map(y=>y[0]).filter(y=>y!=="");return o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",g+1,m.length===1&&m[0]==="*"&&"(全局共享)"]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(de,{onClick:()=>c(g),size:"sm",variant:"outline",children:o.jsx(Ls,{className:"h-4 w-4"})}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"sm",variant:"ghost",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除共享组 ",g+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>l(g),children:"删除"})]})]})]})]})]}),o.jsx("div",{className:"space-y-2",children:m.map((y,w)=>o.jsx(z0e,{member:y,groupIndex:g,memberIndex:w,availableChatIds:x,onUpdate:h,onRemove:d},`${g}-${w}`))}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},g)}),t.expression_groups.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function L0e({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:a=>i({...n,enable_tool:a})}),o.jsx(he,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),o.jsx(ze,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:a=>s({...e,max_agent_iterations:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"emoji_chance",children:"表情包激活概率"}),o.jsx(ze,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:a=>r({...t,emoji_chance:parseFloat(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_reg_num",children:"最大注册数量"}),o.jsx(ze,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:a=>r({...t,max_reg_num:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),o.jsx(ze,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:a=>r({...t,check_interval:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"do_replace",checked:t.do_replace,onCheckedChange:a=>r({...t,do_replace:a})}),o.jsx(he,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:a=>r({...t,steal_emoji:a})}),o.jsx(he,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),o.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:a=>r({...t,content_filtration:a})}),o.jsx(he,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&o.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[o.jsx(he,{htmlFor:"filtration_prompt",children:"过滤要求"}),o.jsx(ze,{id:"filtration_prompt",value:t.filtration_prompt,onChange:a=>r({...t,filtration_prompt:a.target.value}),placeholder:"符合公序良俗"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function B0e({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:a,onResponseSplitterChange:l}){const c=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},d=T=>{s({...t,regex_rules:t.regex_rules.filter((E,_)=>_!==T)})},h=(T,E,_)=>{const A=[...t.regex_rules];E==="regex"&&typeof _=="string"?A[T]={...A[T],regex:[_]}:E==="reaction"&&typeof _=="string"&&(A[T]={...A[T],reaction:_}),s({...t,regex_rules:A})},m=({regex:T,reaction:E,onRegexChange:_,onReactionChange:A})=>{const[L,P]=b.useState(!1),[B,$]=b.useState(""),[U,te]=b.useState(null),[z,Q]=b.useState(""),[F,Y]=b.useState({}),[J,X]=b.useState(""),R=b.useRef(null),[ie,G]=b.useState("build"),I=W=>W.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),V=(W,se=0)=>{const re=R.current;if(!re)return;const oe=re.selectionStart||0,Te=re.selectionEnd||0,We=T.substring(0,oe)+W+T.substring(Te);_(We),setTimeout(()=>{const Ye=oe+W.length+se;re.setSelectionRange(Ye,Ye),re.focus()},0)};b.useEffect(()=>{if(!T||!B){te(null),Y({}),X(E),Q("");return}try{const W=I(T),se=new RegExp(W,"g"),re=B.match(se);te(re),Q("");const Te=new RegExp(W).exec(B);if(Te&&Te.groups){Y(Te.groups);let We=E;Object.entries(Te.groups).forEach(([Ye,Je])=>{We=We.replace(new RegExp(`\\[${Ye}\\]`,"g"),Je||"")}),X(We)}else Y({}),X(E)}catch(W){Q(W.message),te(null),Y({}),X(E)}},[T,B,E]);const ee=()=>{if(!B||!U||U.length===0)return o.jsx("span",{className:"text-muted-foreground",children:B||"请输入测试文本"});try{const W=I(T),se=new RegExp(W,"g");let re=0;const oe=[];let Te;for(;(Te=se.exec(B))!==null;)Te.index>re&&oe.push(o.jsx("span",{children:B.substring(re,Te.index)},`text-${re}`)),oe.push(o.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:Te[0]},`match-${Te.index}`)),re=Te.index+Te[0].length;return re)",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 o.jsxs(Dr,{open:L,onOpenChange:P,children:[o.jsx(Of,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Pv,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"正则表达式编辑器"}),o.jsx(ss,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),o.jsx(gn,{className:"max-h-[calc(90vh-120px)]",children:o.jsxs(ja,{value:ie,onValueChange:W=>G(W),className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-2",children:[o.jsx(Lt,{value:"build",children:"🔧 构建器"}),o.jsx(Lt,{value:"test",children:"🧪 测试器"})]}),o.jsxs(un,{value:"build",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"正则表达式"}),o.jsx(ze,{ref:R,value:T,onChange:W=>_(W.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"Reaction 内容"}),o.jsx(Mr,{value:E,onChange:W=>A(W.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),o.jsxs("div",{className:"space-y-4 border-t pt-4",children:[ne.map(W=>o.jsxs("div",{className:"space-y-2",children:[o.jsx("h5",{className:"text-xs font-semibold text-primary",children:W.category}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:W.items.map(se=>o.jsx(de,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>V(se.pattern,se.moveCursor||0),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[o.jsx("span",{className:"text-xs font-medium",children:se.label}),o.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:se.pattern})]}),o.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:se.desc})]})},se.label))})]},W.category)),o.jsxs("div",{className:"space-y-2 border-t pt-4",children:[o.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("^(?P\\S{1,20})是这样的$"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),o.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),o.jsx(de,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("(?P.+?)(?:是|为什么|怎么)"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),o.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[o.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),o.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),o.jsxs("li",{children:["命名捕获组格式:",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),o.jsxs("li",{children:["在 reaction 中使用 ",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),o.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),o.jsxs(un,{value:"test",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"当前正则表达式"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:T||"(未设置)"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),o.jsx(Mr,{id:"test-text",value:B,onChange:W=>$(W.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),z&&o.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[o.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),o.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:z})]}),!z&&B&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"flex items-center gap-2",children:U&&U.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),o.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",U.length," 处)"]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"匹配高亮"}),o.jsx(gn,{className:"h-40 rounded-md bg-muted p-3",children:o.jsx("div",{className:"text-sm break-words",children:ee()})})]}),Object.keys(F).length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"命名捕获组"}),o.jsx(gn,{className:"h-32 rounded-md border p-3",children:o.jsx("div",{className:"space-y-2",children:Object.entries(F).map(([W,se])=>o.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[o.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",W,"]"]}),o.jsx("span",{className:"text-muted-foreground",children:"="}),o.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:se})]},W))})})]}),Object.keys(F).length>0&&E&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"Reaction 替换预览"}),o.jsx(gn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:o.jsx("div",{className:"text-sm break-words",children:J})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),o.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[o.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),o.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),o.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),o.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),o.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},g=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},x=T=>{s({...t,keyword_rules:t.keyword_rules.filter((E,_)=>_!==T)})},y=(T,E,_)=>{const A=[...t.keyword_rules];typeof _=="string"&&(A[T]={...A[T],reaction:_}),s({...t,keyword_rules:A})},w=T=>{const E=[...t.keyword_rules];E[T]={...E[T],keywords:[...E[T].keywords||[],""]},s({...t,keyword_rules:E})},S=(T,E)=>{const _=[...t.keyword_rules];_[T]={..._[T],keywords:(_[T].keywords||[]).filter((A,L)=>L!==E)},s({...t,keyword_rules:_})},k=(T,E,_)=>{const A=[...t.keyword_rules],L=[...A[T].keywords||[]];L[E]=_,A[T]={...A[T],keywords:L},s({...t,keyword_rules:A})},j=({rule:T})=>{const E=`{ regex = [${(T.regex||[]).map(_=>`"${_}"`).join(", ")}], reaction = "${T.reaction}" }`;return o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Ea,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Xa,{className:"w-[95vw] sm:w-[500px]",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx(gn,{className:"h-60 rounded-md bg-muted p-3",children:o.jsx("pre",{className:"font-mono text-xs break-all",children:E})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},N=({rule:T})=>{const E=`[[keyword_reaction.keyword_rules]] +`,{label:"if",detail:"block",type:"keyword"}),wl("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),wl("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),wl("import ${module}",{label:"import",detail:"statement",type:"keyword"}),wl("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],j0e=Che(TH,nH(k0e.concat(O0e)));function pS(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 gS(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 xS=J0.define({name:"python",parser:b0e.configure({props:[vb.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&pS(t)||t.node;return(e=gS(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=pS(t);return(e=gS(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":J4({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":J4({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":J4({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=pS(t);return(e=n&&gS(t,n))!==null&&e!==void 0?e:t.continue()}}),N6.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":Gq,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 N0e(){return new Vq(xS,[xS.data.of({autocomplete:S0e}),xS.data.of({autocomplete:j0e})])}const C0e=k6({String:ye.string,Number:ye.number,"True False":ye.bool,PropertyName:ye.propertyName,Null:ye.null,", :":ye.separator,"[ ]":ye.squareBracket,"{ }":ye.brace}),T0e=lp.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:[C0e],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}),E0e=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=_0e(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function _0e(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 A0e=J0.define({name:"json",parser:T0e.configure({props:[vb.add({Object:k_({except:/^\s*\}/}),Array:k_({except:/^\s*\]/})}),N6.add({"Object Array":Gq})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function M0e(){return new Vq(A0e)}const R0e={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:"#"}}},D0e={python:[N0e()],json:[M0e(),E0e()],toml:[C6.define(R0e)],text:[]};function P0e({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:a,placeholder:l,theme:c="dark",className:d=""}){const[h,m]=b.useState(!1);if(b.useEffect(()=>{m(!0)},[]),!h)return o.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${d}`,style:{height:s,minHeight:i,maxHeight:a}});const g=[...D0e[n]||[],Ze.lineWrapping];return r&&g.push(Ze.editable.of(!1)),o.jsx("div",{className:`rounded-md overflow-hidden border ${d}`,children:o.jsx(vH,{value:t,height:s,minHeight:i,maxHeight:a,theme:c==="dark"?xH:void 0,extensions:g,onChange:e,placeholder:l,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function z0e(){const[t,e]=b.useState(!0),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!1),[g,x]=b.useState("visual"),[y,w]=b.useState(""),[S,k]=b.useState(!1),{toast:j}=Lr(),[N,T]=b.useState(null),[E,_]=b.useState(null),[A,D]=b.useState(null),[q,B]=b.useState(null),[H,W]=b.useState(null),[ee,I]=b.useState(null),[V,L]=b.useState(null),[$,K]=b.useState(null),[Y,R]=b.useState(null),[ie,X]=b.useState(null),[z,U]=b.useState(null),[te,ne]=b.useState(null),[G,se]=b.useState(null),[re,ae]=b.useState(null),[_e,Be]=b.useState(null),[Ye,Je]=b.useState(null),[Oe,Ve]=b.useState(null),[Ue,$e]=b.useState(null),jt=b.useRef(null),vt=b.useRef(!0),$n=b.useRef({}),qt=b.useCallback(async()=>{try{const We=await kae();w(We),k(!1)}catch(We){j({variant:"destructive",title:"加载失败",description:We instanceof Error?We.message:"加载源代码失败"})}},[j]),un=b.useCallback(async()=>{try{e(!0);const We=await dE();$n.current=We,T(We.bot),_(We.personality);const ot=We.chat;ot.talk_value_rules||(ot.talk_value_rules=[]),D(ot),B(We.expression),W(We.emoji),I(We.memory),L(We.tool),K(We.mood),R(We.voice),X(We.lpmm_knowledge),U(We.keyword_reaction),ne(We.response_post_process),se(We.chinese_typo),ae(We.response_splitter),Be(We.log),Je(We.debug),Ve(We.maim_message),$e(We.telemetry),l(!1),vt.current=!1,await qt()}catch(We){console.error("加载配置失败:",We),j({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[j,qt]);b.useEffect(()=>{un()},[un]);const Mt=b.useCallback(async(We,ot)=>{if(!vt.current)try{i(!0),await jae(We,ot),l(!1)}catch(dn){console.error(`自动保存 ${We} 失败:`,dn),l(!0)}finally{i(!1)}},[]),ct=b.useCallback((We,ot)=>{vt.current||(l(!0),jt.current&&clearTimeout(jt.current),jt.current=setTimeout(()=>{Mt(We,ot)},2e3))},[Mt]);b.useEffect(()=>{N&&!vt.current&&ct("bot",N)},[N,ct]),b.useEffect(()=>{E&&!vt.current&&ct("personality",E)},[E,ct]),b.useEffect(()=>{A&&!vt.current&&ct("chat",A)},[A,ct]),b.useEffect(()=>{q&&!vt.current&&ct("expression",q)},[q,ct]),b.useEffect(()=>{H&&!vt.current&&ct("emoji",H)},[H,ct]),b.useEffect(()=>{ee&&!vt.current&&ct("memory",ee)},[ee,ct]),b.useEffect(()=>{V&&!vt.current&&ct("tool",V)},[V,ct]),b.useEffect(()=>{$&&!vt.current&&ct("mood",$)},[$,ct]),b.useEffect(()=>{Y&&!vt.current&&ct("voice",Y)},[Y,ct]),b.useEffect(()=>{ie&&!vt.current&&ct("lpmm_knowledge",ie)},[ie,ct]),b.useEffect(()=>{z&&!vt.current&&ct("keyword_reaction",z)},[z,ct]),b.useEffect(()=>{te&&!vt.current&&ct("response_post_process",te)},[te,ct]),b.useEffect(()=>{G&&!vt.current&&ct("chinese_typo",G)},[G,ct]),b.useEffect(()=>{re&&!vt.current&&ct("response_splitter",re)},[re,ct]),b.useEffect(()=>{_e&&!vt.current&&ct("log",_e)},[_e,ct]),b.useEffect(()=>{Ye&&!vt.current&&ct("debug",Ye)},[Ye,ct]),b.useEffect(()=>{Oe&&!vt.current&&ct("maim_message",Oe)},[Oe,ct]),b.useEffect(()=>{Ue&&!vt.current&&ct("telemetry",Ue)},[Ue,ct]);const Ne=async()=>{try{r(!0),await Oae(y),l(!1),k(!1),j({title:"保存成功",description:"配置已保存"}),await un()}catch(We){k(!0),j({variant:"destructive",title:"保存失败",description:We instanceof Error?We.message:"保存配置失败"})}finally{r(!1)}},ze=async We=>{if(a){j({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(x(We),We==="source")await qt();else try{const ot=await dE();$n.current=ot,T(ot.bot),_(ot.personality);const dn=ot.chat;dn.talk_value_rules||(dn.talk_value_rules=[]),D(dn),B(ot.expression),W(ot.emoji),I(ot.memory),L(ot.tool),K(ot.mood),R(ot.voice),X(ot.lpmm_knowledge),U(ot.keyword_reaction),ne(ot.response_post_process),se(ot.chinese_typo),ae(ot.response_splitter),Be(ot.log),Je(ot.debug),Ve(ot.maim_message),$e(ot.telemetry),l(!1)}catch(ot){console.error("加载配置失败:",ot),j({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},rt=async()=>{try{r(!0),jt.current&&clearTimeout(jt.current);const We={...$n.current,bot:N,personality:E,chat:A,expression:q,emoji:H,memory:ee,tool:V,mood:$,voice:Y,lpmm_knowledge:ie,keyword_reaction:z,response_post_process:te,chinese_typo:G,response_splitter:re,log:_e,debug:Ye,maim_message:Oe,telemetry:Ue};await hE(We),l(!1),j({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(We){console.error("保存配置失败:",We),j({title:"保存失败",description:We.message,variant:"destructive"})}finally{r(!1)}},bt=async()=>{try{d(!0),cb().catch(()=>{}),m(!0)}catch(We){console.error("重启失败:",We),m(!1),j({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),d(!1)}},zt=async()=>{try{r(!0),jt.current&&clearTimeout(jt.current);const We={...$n.current,bot:N,personality:E,chat:A,expression:q,emoji:H,memory:ee,tool:V,mood:$,voice:Y,lpmm_knowledge:ie,keyword_reaction:z,response_post_process:te,chinese_typo:G,response_splitter:re,log:_e,debug:Ye,maim_message:Oe,telemetry:Ue};await hE(We),l(!1),j({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(ot=>setTimeout(ot,500)),await bt()}catch(We){console.error("保存失败:",We),j({title:"保存失败",description:We.message,variant:"destructive"})}finally{r(!1)}},Rt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Hn=()=>{m(!1),d(!1),j({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?o.jsx(pn,{className:"h-full",children:o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):o.jsx(pn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[o.jsx(Yi,{value:g,onValueChange:We=>ze(We),className:"w-auto",children:o.jsxs(ji,{className:"h-9",children:[o.jsxs(Bt,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[o.jsx(Xee,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),o.jsxs(Bt,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[o.jsx(Yee,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),o.jsxs(ue,{onClick:g==="visual"?rt:Ne,disabled:n||s||!a||c,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[o.jsx(zp,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":a?"保存配置":"已保存"]}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsxs(ue,{disabled:n||s||c,size:"sm",className:"flex-1 sm:flex-none",children:[o.jsx(Dp,{className:"mr-2 h-4 w-4"}),c?"重启中...":a?"保存并重启":"重启麦麦"]})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认重启麦麦?"}),o.jsx(zn,{className:"space-y-3",asChild:!0,children:o.jsxs("div",{children:[o.jsx("p",{children:a?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(ba,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(Xi,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(wa,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",o.jsxs(Er,{children:[o.jsx(Of,{asChild:!0,children:o.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[o.jsx(Zy,{className:"h-3 w-3"}),"如何结束程序?"]})}),o.jsxs(wr,{className:"max-w-2xl",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"如何结束使用重启功能后的麦麦程序"}),o.jsx(Xr,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),o.jsxs(Yi,{defaultValue:"windows",className:"w-full",children:[o.jsxs(ji,{className:"grid w-full grid-cols-3",children:[o.jsx(Bt,{value:"windows",children:"Windows"}),o.jsx(Bt,{value:"macos",children:"macOS"}),o.jsx(Bt,{value:"linux",children:"Linux"})]}),o.jsxs(ln,{value:"windows",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),o.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),o.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),o.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),o.jsxs(ln,{value:"macos",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight,搜索"活动监视器"']}),o.jsxs("li",{children:["在进程列表中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),o.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]})]}),o.jsxs(ln,{value:"linux",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),o.jsx("p",{children:'pkill -9 -f "bot.py"'}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["在终端输入 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),o.jsx(fs,{children:o.jsx(e6,{asChild:!0,children:o.jsx(ue,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:a?zt:bt,children:a?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(ba,{children:[o.jsx(Xi,{className:"h-4 w-4"}),o.jsxs(wa,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),g==="source"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs(ba,{children:[o.jsx(Xi,{className:"h-4 w-4"}),o.jsxs(wa,{children:[o.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",S&&o.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),o.jsx(P0e,{value:y,onChange:We=>{w(We),l(!0),S&&k(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),g==="visual"&&o.jsx(o.Fragment,{children:o.jsxs(Yi,{defaultValue:"bot",className:"w-full",children:[o.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:o.jsxs(ji,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[o.jsx(Bt,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),o.jsx(Bt,{value:"personality",className:"flex-shrink-0",children:"人格"}),o.jsx(Bt,{value:"chat",className:"flex-shrink-0",children:"聊天"}),o.jsx(Bt,{value:"expression",className:"flex-shrink-0",children:"表达"}),o.jsx(Bt,{value:"features",className:"flex-shrink-0",children:"功能"}),o.jsx(Bt,{value:"processing",className:"flex-shrink-0",children:"处理"}),o.jsx(Bt,{value:"mood",className:"flex-shrink-0",children:"情绪"}),o.jsx(Bt,{value:"voice",className:"flex-shrink-0",children:"语音"}),o.jsx(Bt,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),o.jsx(Bt,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),o.jsx(ln,{value:"bot",className:"space-y-4",children:N&&o.jsx(I0e,{config:N,onChange:T})}),o.jsx(ln,{value:"personality",className:"space-y-4",children:E&&o.jsx(L0e,{config:E,onChange:_})}),o.jsx(ln,{value:"chat",className:"space-y-4",children:A&&o.jsx(B0e,{config:A,onChange:D})}),o.jsx(ln,{value:"expression",className:"space-y-4",children:q&&o.jsx(q0e,{config:q,onChange:B})}),o.jsx(ln,{value:"features",className:"space-y-4",children:H&&ee&&V&&o.jsx($0e,{emojiConfig:H,memoryConfig:ee,toolConfig:V,onEmojiChange:W,onMemoryChange:I,onToolChange:L})}),o.jsx(ln,{value:"processing",className:"space-y-4",children:z&&te&&G&&re&&o.jsx(H0e,{keywordReactionConfig:z,responsePostProcessConfig:te,chineseTypoConfig:G,responseSplitterConfig:re,onKeywordReactionChange:U,onResponsePostProcessChange:ne,onChineseTypoChange:se,onResponseSplitterChange:ae})}),o.jsx(ln,{value:"mood",className:"space-y-4",children:$&&o.jsx(Q0e,{config:$,onChange:K})}),o.jsx(ln,{value:"voice",className:"space-y-4",children:Y&&o.jsx(V0e,{config:Y,onChange:R})}),o.jsx(ln,{value:"lpmm",className:"space-y-4",children:ie&&o.jsx(U0e,{config:ie,onChange:X})}),o.jsxs(ln,{value:"other",className:"space-y-4",children:[_e&&o.jsx(W0e,{config:_e,onChange:Be}),Ye&&o.jsx(G0e,{config:Ye,onChange:Je}),Oe&&o.jsx(X0e,{config:Oe,onChange:Ve}),Ue&&o.jsx(Y0e,{config:Ue,onChange:$e})]})]})}),h&&o.jsx(r6,{onRestartComplete:Rt,onRestartFailed:Hn})]})})}function I0e({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=c=>{e({...t,platforms:t.platforms.filter((d,h)=>h!==c)})},s=(c,d)=>{const h=[...t.platforms];h[c]=d,e({...t,platforms:h})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},a=c=>{e({...t,alias_names:t.alias_names.filter((d,h)=>h!==c)})},l=(c,d)=>{const h=[...t.alias_names];h[c]=d,e({...t,alias_names:h})};return o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"platform",children:"平台"}),o.jsx(Pe,{id:"platform",value:t.platform,onChange:c=>e({...t,platform:c.target.value}),placeholder:"qq"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"qq_account",children:"QQ账号"}),o.jsx(Pe,{id:"qq_account",value:t.qq_account,onChange:c=>e({...t,qq_account:c.target.value}),placeholder:"123456789"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"nickname",children:"昵称"}),o.jsx(Pe,{id:"nickname",value:t.nickname,onChange:c=>e({...t,nickname:c.target.value}),placeholder:"麦麦"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"其他平台账号"}),o.jsxs(ue,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(Is,{className:"h-4 w-4 mr-1"}),"添加"]})]}),o.jsxs("div",{className:"space-y-2",children:[t.platforms.map((c,d)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{value:c,onChange:h=>s(d,h.target.value),placeholder:"wx:114514"}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{size:"icon",variant:"outline",children:o.jsx(Cn,{className:"h-4 w-4"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:['确定要删除平台账号 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>r(d),children:"删除"})]})]})]})]},d)),t.platforms.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"别名"}),o.jsxs(ue,{onClick:i,size:"sm",variant:"outline",children:[o.jsx(Is,{className:"h-4 w-4 mr-1"}),"添加"]})]}),o.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((c,d)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{value:c,onChange:h=>l(d,h.target.value),placeholder:"小麦"}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{size:"icon",variant:"outline",children:o.jsx(Cn,{className:"h-4 w-4"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:['确定要删除别名 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>a(d),children:"删除"})]})]})]})]},d)),t.alias_names.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function L0e({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((a,l)=>l!==i)})},s=(i,a)=>{const l=[...t.states];l[i]=a,e({...t,states:l})};return o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"personality",children:"人格特质"}),o.jsx(Nr,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"reply_style",children:"表达风格"}),o.jsx(Nr,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"interest",children:"兴趣"}),o.jsx(Nr,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"plan_style",children:"说话规则与行为风格"}),o.jsx(Nr,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"visual_style",children:"识图规则"}),o.jsx(Nr,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"private_plan_style",children:"私聊规则"}),o.jsx(Nr,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"状态列表(人格多样性)"}),o.jsxs(ue,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(Is,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),o.jsx("div",{className:"space-y-2",children:t.states.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Nr,{value:i,onChange:l=>s(a,l.target.value),placeholder:"描述一个人格状态",rows:2}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{size:"icon",variant:"outline",children:o.jsx(Cn,{className:"h-4 w-4"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsx(zn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>r(a),children:"删除"})]})]})]})]},a))})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"state_probability",children:"状态替换概率"}),o.jsx(Pe,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function B0e({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=l=>{e({...t,talk_value_rules:t.talk_value_rules.filter((c,d)=>d!==l)})},s=(l,c,d)=>{const h=[...t.talk_value_rules];h[l]={...h[l],[c]:d},e({...t,talk_value_rules:h})},i=({value:l,onChange:c})=>{const[d,h]=b.useState("00"),[m,g]=b.useState("00"),[x,y]=b.useState("23"),[w,S]=b.useState("59");b.useEffect(()=>{const j=l.split("-");if(j.length===2){const[N,T]=j,[E,_]=N.split(":"),[A,D]=T.split(":");E&&h(E.padStart(2,"0")),_&&g(_.padStart(2,"0")),A&&y(A.padStart(2,"0")),D&&S(D.padStart(2,"0"))}},[l]);const k=(j,N,T,E)=>{const _=`${j}:${N}-${T}:${E}`;c(_)};return o.jsxs(Bo,{children:[o.jsx(Fo,{asChild:!0,children:o.jsxs(ue,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[o.jsx(Mh,{className:"h-4 w-4 mr-2"}),l||"选择时间段"]})}),o.jsx(Ka,{className:"w-80",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"小时"}),o.jsxs(Vt,{value:d,onValueChange:j=>{h(j),k(j,m,x,w)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:24},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"分钟"}),o.jsxs(Vt,{value:m,onValueChange:j=>{g(j),k(d,j,x,w)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:60},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"小时"}),o.jsxs(Vt,{value:x,onValueChange:j=>{y(j),k(d,m,j,w)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:24},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-xs",children:"分钟"}),o.jsxs(Vt,{value:w,onValueChange:j=>{S(j),k(d,m,x,j)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:Array.from({length:60},(j,N)=>N).map(j=>o.jsx(De,{value:j.toString().padStart(2,"0"),children:j.toString().padStart(2,"0")},j))})]})]})]})]})]})})]})},a=({rule:l})=>{const c=`{ target = "${l.target}", time = "${l.time}", value = ${l.value.toFixed(1)} }`;return o.jsxs(Bo,{children:[o.jsx(Fo,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",children:[o.jsx(Ji,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Ka,{className:"w-96",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:c}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),o.jsx(Pe,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:l=>e({...t,talk_value:parseFloat(l.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"mentioned_bot_reply",checked:t.mentioned_bot_reply,onCheckedChange:l=>e({...t,mentioned_bot_reply:l})}),o.jsx(he,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_context_size",children:"上下文长度"}),o.jsx(Pe,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:l=>e({...t,max_context_size:parseInt(l.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"planner_smooth",children:"规划器平滑"}),o.jsx(Pe,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:l=>e({...t,planner_smooth:parseFloat(l.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:l=>e({...t,enable_talk_value_rules:l})}),o.jsx(he,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:l=>e({...t,include_planner_reasoning:l})}),o.jsx(he,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&o.jsxs("div",{className:"border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),o.jsxs(ue,{onClick:n,size:"sm",children:[o.jsx(Is,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?o.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((l,c)=>o.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",c+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(a,{rule:l}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{variant:"ghost",size:"sm",children:o.jsx(Cn,{className:"h-4 w-4 text-destructive"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:["确定要删除规则 #",c+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>r(c),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"配置类型"}),o.jsxs(Vt,{value:l.target===""?"global":"specific",onValueChange:d=>{d==="global"?s(c,"target",""):s(c,"target","qq::group")},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"global",children:"全局配置"}),o.jsx(De,{value:"specific",children:"详细配置"})]})]})]}),l.target!==""&&(()=>{const d=l.target.split(":"),h=d[0]||"qq",m=d[1]||"",g=d[2]||"group";return o.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"平台"}),o.jsxs(Vt,{value:h,onValueChange:x=>{s(c,"target",`${x}:${m}:${g}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"qq",children:"QQ"}),o.jsx(De,{value:"wx",children:"微信"})]})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"群 ID"}),o.jsx(Pe,{value:m,onChange:x=>{s(c,"target",`${h}:${x.target.value}:${g}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"类型"}),o.jsxs(Vt,{value:g,onValueChange:x=>{s(c,"target",`${h}:${m}:${x}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"group",children:"群组(group)"}),o.jsx(De,{value:"private",children:"私聊(private)"})]})]})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",l.target||"(未设置)"]})]})})(),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"时间段 (Time)"}),o.jsx(i,{value:l.time,onChange:d=>s(c,"time",d)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{htmlFor:`rule-value-${c}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),o.jsx(Pe,{id:`rule-value-${c}`,type:"number",step:"0.01",min:"0.01",max:"1",value:l.value,onChange:d=>{const h=parseFloat(d.target.value);isNaN(h)||s(c,"value",Math.max(.01,Math.min(1,h)))},className:"w-20 h-8 text-xs"})]}),o.jsx(Nf,{value:[l.value],onValueChange:d=>s(c,"value",d[0]),min:.01,max:1,step:.01,className:"w-full"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"0.01 (极少发言)"}),o.jsx("span",{children:"0.5"}),o.jsx("span",{children:"1.0 (正常)"})]})]})]})]},c))}):o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:o.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),o.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[o.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),o.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[o.jsxs("li",{children:["• ",o.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function F0e({member:t,groupIndex:e,memberIndex:n,availableChatIds:r,onUpdate:s,onRemove:i}){const a=r.includes(t)||t==="*",[l,c]=b.useState(!a);return o.jsxs("div",{className:"flex gap-2",children:[o.jsx("div",{className:"flex-1 flex gap-2",children:l?o.jsxs(o.Fragment,{children:[o.jsx(Pe,{value:t,onChange:d=>s(e,n,d.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),r.length>0&&o.jsx(ue,{size:"sm",variant:"outline",onClick:()=>c(!1),title:"切换到下拉选择",children:"下拉"})]}):o.jsxs(o.Fragment,{children:[o.jsxs(Vt,{value:t,onValueChange:d=>s(e,n,d),children:[o.jsx($t,{className:"flex-1",children:o.jsx(Ut,{placeholder:"选择聊天流"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"*",children:"* (全局共享)"}),r.map((d,h)=>o.jsx(De,{value:d,children:d},h))]})]}),o.jsx(ue,{size:"sm",variant:"outline",onClick:()=>c(!0),title:"切换到手动输入",children:"输入"})]})}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{size:"icon",variant:"outline",children:o.jsx(Cn,{className:"h-4 w-4"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:['确定要删除组成员 "',t||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>i(e,n),children:"删除"})]})]})]})]})}function q0e({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=m=>{e({...t,learning_list:t.learning_list.filter((g,x)=>x!==m)})},s=(m,g,x)=>{const y=[...t.learning_list];y[m][g]=x,e({...t,learning_list:y})},i=({rule:m})=>{const g=`["${m[0]}", "${m[1]}", "${m[2]}", "${m[3]}"]`;return o.jsxs(Bo,{children:[o.jsx(Fo,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",children:[o.jsx(Ji,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Ka,{className:"w-96",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:g}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},a=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},l=m=>{e({...t,expression_groups:t.expression_groups.filter((g,x)=>x!==m)})},c=m=>{const g=[...t.expression_groups];g[m]=[...g[m],""],e({...t,expression_groups:g})},d=(m,g)=>{const x=[...t.expression_groups];x[m]=x[m].filter((y,w)=>w!==g),e({...t,expression_groups:x})},h=(m,g,x)=>{const y=[...t.expression_groups];y[m][g]=x,e({...t,expression_groups:y})};return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),o.jsxs(ue,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(Is,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),o.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((m,g)=>{const x=t.learning_list.some((N,T)=>T!==g&&N[0]===""),y=m[0]==="",w=m[0].split(":"),S=w[0]||"qq",k=w[1]||"",j=w[2]||"group";return o.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["规则 ",g+1," ",y&&"(全局配置)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(i,{rule:m}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{size:"sm",variant:"ghost",children:o.jsx(Cn,{className:"h-4 w-4"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:["确定要删除学习规则 ",g+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>r(g),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"配置类型"}),o.jsxs(Vt,{value:y?"global":"specific",onValueChange:N=>{N==="global"?s(g,0,""):s(g,0,"qq::group")},disabled:x&&!y,children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"global",children:"全局配置"}),o.jsx(De,{value:"specific",disabled:x&&!y,children:"详细配置"})]})]}),x&&!y&&o.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!y&&o.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"平台"}),o.jsxs(Vt,{value:S,onValueChange:N=>{s(g,0,`${N}:${k}:${j}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"qq",children:"QQ"}),o.jsx(De,{value:"wx",children:"微信"})]})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"群 ID"}),o.jsx(Pe,{value:k,onChange:N=>{s(g,0,`${S}:${N.target.value}:${j}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"类型"}),o.jsxs(Vt,{value:j,onValueChange:N=>{s(g,0,`${S}:${k}:${N}`)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"group",children:"群组(group)"}),o.jsx(De,{value:"private",children:"私聊(private)"})]})]})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",m[0]||"(未设置)"]})]}),o.jsx("div",{className:"grid gap-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs font-medium",children:"使用学到的表达"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),o.jsx(Ft,{checked:m[1]==="enable",onCheckedChange:N=>s(g,1,N?"enable":"disable")})]})}),o.jsx("div",{className:"grid gap-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-xs font-medium",children:"学习表达"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),o.jsx(Ft,{checked:m[2]==="enable",onCheckedChange:N=>s(g,2,N?"enable":"disable")})]})}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{className:"text-xs font-medium",children:"学习强度"}),o.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"5",value:m[3],onChange:N=>{const T=parseFloat(N.target.value);isNaN(T)||s(g,3,Math.max(0,Math.min(5,T)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),o.jsx(Nf,{value:[parseFloat(m[3])||1],onValueChange:N=>s(g,3,N[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"0 (不学习)"}),o.jsx("span",{children:"2.5"}),o.jsx("span",{children:"5.0 (快速学习)"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},g)}),t.learning_list.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),o.jsxs(ue,{onClick:a,size:"sm",variant:"outline",children:[o.jsx(Is,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),o.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((m,g)=>{const x=t.learning_list.map(y=>y[0]).filter(y=>y!=="");return o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",g+1,m.length===1&&m[0]==="*"&&"(全局共享)"]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ue,{onClick:()=>c(g),size:"sm",variant:"outline",children:o.jsx(Is,{className:"h-4 w-4"})}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{size:"sm",variant:"ghost",children:o.jsx(Cn,{className:"h-4 w-4"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:["确定要删除共享组 ",g+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>l(g),children:"删除"})]})]})]})]})]}),o.jsx("div",{className:"space-y-2",children:m.map((y,w)=>o.jsx(F0e,{member:y,groupIndex:g,memberIndex:w,availableChatIds:x,onUpdate:h,onRemove:d},`${g}-${w}`))}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},g)}),t.expression_groups.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function $0e({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:a=>i({...n,enable_tool:a})}),o.jsx(he,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),o.jsx(Pe,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:a=>s({...e,max_agent_iterations:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"emoji_chance",children:"表情包激活概率"}),o.jsx(Pe,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:a=>r({...t,emoji_chance:parseFloat(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_reg_num",children:"最大注册数量"}),o.jsx(Pe,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:a=>r({...t,max_reg_num:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),o.jsx(Pe,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:a=>r({...t,check_interval:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"do_replace",checked:t.do_replace,onCheckedChange:a=>r({...t,do_replace:a})}),o.jsx(he,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:a=>r({...t,steal_emoji:a})}),o.jsx(he,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),o.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:a=>r({...t,content_filtration:a})}),o.jsx(he,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&o.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[o.jsx(he,{htmlFor:"filtration_prompt",children:"过滤要求"}),o.jsx(Pe,{id:"filtration_prompt",value:t.filtration_prompt,onChange:a=>r({...t,filtration_prompt:a.target.value}),placeholder:"符合公序良俗"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function H0e({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:a,onResponseSplitterChange:l}){const c=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},d=T=>{s({...t,regex_rules:t.regex_rules.filter((E,_)=>_!==T)})},h=(T,E,_)=>{const A=[...t.regex_rules];E==="regex"&&typeof _=="string"?A[T]={...A[T],regex:[_]}:E==="reaction"&&typeof _=="string"&&(A[T]={...A[T],reaction:_}),s({...t,regex_rules:A})},m=({regex:T,reaction:E,onRegexChange:_,onReactionChange:A})=>{const[D,q]=b.useState(!1),[B,H]=b.useState(""),[W,ee]=b.useState(null),[I,V]=b.useState(""),[L,$]=b.useState({}),[K,Y]=b.useState(""),R=b.useRef(null),[ie,X]=b.useState("build"),z=G=>G.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),U=(G,se=0)=>{const re=R.current;if(!re)return;const ae=re.selectionStart||0,_e=re.selectionEnd||0,Be=T.substring(0,ae)+G+T.substring(_e);_(Be),setTimeout(()=>{const Ye=ae+G.length+se;re.setSelectionRange(Ye,Ye),re.focus()},0)};b.useEffect(()=>{if(!T||!B){ee(null),$({}),Y(E),V("");return}try{const G=z(T),se=new RegExp(G,"g"),re=B.match(se);ee(re),V("");const _e=new RegExp(G).exec(B);if(_e&&_e.groups){$(_e.groups);let Be=E;Object.entries(_e.groups).forEach(([Ye,Je])=>{Be=Be.replace(new RegExp(`\\[${Ye}\\]`,"g"),Je||"")}),Y(Be)}else $({}),Y(E)}catch(G){V(G.message),ee(null),$({}),Y(E)}},[T,B,E]);const te=()=>{if(!B||!W||W.length===0)return o.jsx("span",{className:"text-muted-foreground",children:B||"请输入测试文本"});try{const G=z(T),se=new RegExp(G,"g");let re=0;const ae=[];let _e;for(;(_e=se.exec(B))!==null;)_e.index>re&&ae.push(o.jsx("span",{children:B.substring(re,_e.index)},`text-${re}`)),ae.push(o.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:_e[0]},`match-${_e.index}`)),re=_e.index+_e[0].length;return re)",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 o.jsxs(Er,{open:D,onOpenChange:q,children:[o.jsx(Of,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",children:[o.jsx(Fv,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),o.jsxs(wr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"正则表达式编辑器"}),o.jsx(Xr,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),o.jsx(pn,{className:"max-h-[calc(90vh-120px)]",children:o.jsxs(Yi,{value:ie,onValueChange:G=>X(G),className:"w-full",children:[o.jsxs(ji,{className:"grid w-full grid-cols-2",children:[o.jsx(Bt,{value:"build",children:"🔧 构建器"}),o.jsx(Bt,{value:"test",children:"🧪 测试器"})]}),o.jsxs(ln,{value:"build",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"正则表达式"}),o.jsx(Pe,{ref:R,value:T,onChange:G=>_(G.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"Reaction 内容"}),o.jsx(Nr,{value:E,onChange:G=>A(G.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),o.jsxs("div",{className:"space-y-4 border-t pt-4",children:[ne.map(G=>o.jsxs("div",{className:"space-y-2",children:[o.jsx("h5",{className:"text-xs font-semibold text-primary",children:G.category}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:G.items.map(se=>o.jsx(ue,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>U(se.pattern,se.moveCursor||0),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[o.jsx("span",{className:"text-xs font-medium",children:se.label}),o.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:se.pattern})]}),o.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:se.desc})]})},se.label))})]},G.category)),o.jsxs("div",{className:"space-y-2 border-t pt-4",children:[o.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ue,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("^(?P\\S{1,20})是这样的$"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),o.jsx(ue,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),o.jsx(ue,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>_("(?P.+?)(?:是|为什么|怎么)"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),o.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[o.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),o.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),o.jsxs("li",{children:["命名捕获组格式:",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),o.jsxs("li",{children:["在 reaction 中使用 ",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),o.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),o.jsxs(ln,{value:"test",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"当前正则表达式"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:T||"(未设置)"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),o.jsx(Nr,{id:"test-text",value:B,onChange:G=>H(G.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),I&&o.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[o.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),o.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:I})]}),!I&&B&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"flex items-center gap-2",children:W&&W.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),o.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",W.length," 处)"]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"匹配高亮"}),o.jsx(pn,{className:"h-40 rounded-md bg-muted p-3",children:o.jsx("div",{className:"text-sm break-words",children:te()})})]}),Object.keys(L).length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"命名捕获组"}),o.jsx(pn,{className:"h-32 rounded-md border p-3",children:o.jsx("div",{className:"space-y-2",children:Object.entries(L).map(([G,se])=>o.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[o.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",G,"]"]}),o.jsx("span",{className:"text-muted-foreground",children:"="}),o.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:se})]},G))})})]}),Object.keys(L).length>0&&E&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{className:"text-sm font-medium",children:"Reaction 替换预览"}),o.jsx(pn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:o.jsx("div",{className:"text-sm break-words",children:K})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),o.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[o.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),o.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),o.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),o.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),o.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},g=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},x=T=>{s({...t,keyword_rules:t.keyword_rules.filter((E,_)=>_!==T)})},y=(T,E,_)=>{const A=[...t.keyword_rules];typeof _=="string"&&(A[T]={...A[T],reaction:_}),s({...t,keyword_rules:A})},w=T=>{const E=[...t.keyword_rules];E[T]={...E[T],keywords:[...E[T].keywords||[],""]},s({...t,keyword_rules:E})},S=(T,E)=>{const _=[...t.keyword_rules];_[T]={..._[T],keywords:(_[T].keywords||[]).filter((A,D)=>D!==E)},s({...t,keyword_rules:_})},k=(T,E,_)=>{const A=[...t.keyword_rules],D=[...A[T].keywords||[]];D[E]=_,A[T]={...A[T],keywords:D},s({...t,keyword_rules:A})},j=({rule:T})=>{const E=`{ regex = [${(T.regex||[]).map(_=>`"${_}"`).join(", ")}], reaction = "${T.reaction}" }`;return o.jsxs(Bo,{children:[o.jsx(Fo,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",children:[o.jsx(Ji,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Ka,{className:"w-[95vw] sm:w-[500px]",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx(pn,{className:"h-60 rounded-md bg-muted p-3",children:o.jsx("pre",{className:"font-mono text-xs break-all",children:E})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},N=({rule:T})=>{const E=`[[keyword_reaction.keyword_rules]] keywords = [${(T.keywords||[]).map(_=>`"${_}"`).join(", ")}] -reaction = "${T.reaction}"`;return o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Ea,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Xa,{className:"w-[95vw] sm:w-[500px]",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx(gn,{className:"h-60 rounded-md bg-muted p-3",children:o.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:E})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),o.jsxs(de,{onClick:c,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),o.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((T,E)=>o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",E+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(m,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:_=>h(E,"regex",_),onReactionChange:_=>h(E,"reaction",_)}),o.jsx(j,{rule:T}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"sm",variant:"ghost",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除正则规则 ",E+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>d(E),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),o.jsx(ze,{value:T.regex&&T.regex[0]||"",onChange:_=>h(E,"regex",_.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"反应内容"}),o.jsx(Mr,{value:T.reaction,onChange:_=>h(E,"reaction",_.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},E)),t.regex_rules.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),o.jsxs("div",{className:"space-y-4 border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),o.jsxs(de,{onClick:g,size:"sm",variant:"outline",children:[o.jsx(Ls,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),o.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((T,E)=>o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",E+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(N,{rule:T}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"sm",variant:"ghost",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除关键词规则 ",E+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>x(E),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{className:"text-xs font-medium",children:"关键词列表"}),o.jsxs(de,{onClick:()=>w(E),size:"sm",variant:"ghost",children:[o.jsx(Ls,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),o.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((_,A)=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{value:_,onChange:L=>k(E,A,L.target.value),placeholder:"关键词",className:"flex-1"}),o.jsx(de,{onClick:()=>S(E,A),size:"sm",variant:"ghost",children:o.jsx(Sn,{className:"h-4 w-4"})})]},A)),(!T.keywords||T.keywords.length===0)&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"反应内容"}),o.jsx(Mr,{value:T.reaction,onChange:_=>y(E,"reaction",_.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},E)),t.keyword_rules.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:T=>i({...e,enable_response_post_process:T})}),o.jsx(he,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t pt-6 space-y-4",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[o.jsx(Bt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:T=>a({...n,enable:T})}),o.jsx(he,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&o.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),o.jsx(ze,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:T=>a({...n,error_rate:parseFloat(T.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),o.jsx(ze,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:T=>a({...n,min_freq:parseInt(T.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),o.jsx(ze,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:T=>a({...n,tone_error_rate:parseFloat(T.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),o.jsx(ze,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:T=>a({...n,word_replace_rate:parseFloat(T.target.value)})})]})]})]})}),o.jsx("div",{className:"border-t pt-6 space-y-4",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[o.jsx(Bt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:T=>l({...r,enable:T})}),o.jsx(he,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&o.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),o.jsx(ze,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:T=>l({...r,max_length:parseInt(T.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),o.jsx(ze,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:T=>l({...r,max_sentence_num:parseInt(T.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:T=>l({...r,enable_kaomoji_protection:T})}),o.jsx(he,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:T=>l({...r,enable_overflow_return_all:T})}),o.jsx(he,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),o.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function F0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),o.jsx(he,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"情绪更新阈值"}),o.jsx(ze,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"情感特征"}),o.jsx(Mr,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function q0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),o.jsx(he,{className:"cursor-pointer",children:"启用语音识别"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function $0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),o.jsx(he,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"LPMM 模式"}),o.jsxs(Vt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[o.jsx($t,{children:o.jsx(Ut,{placeholder:"选择 LPMM 模式"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"classic",children:"经典模式"}),o.jsx(De,{value:"agent",children:"Agent 模式"})]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"同义词搜索 TopK"}),o.jsx(ze,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"同义词阈值"}),o.jsx(ze,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"实体提取线程数"}),o.jsx(ze,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"嵌入向量维度"}),o.jsx(ze,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function H0e({config:t,onChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState("WARNING"),a=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},l=x=>{e({...t,suppress_libraries:t.suppress_libraries.filter(y=>y!==x)})},c=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},d=x=>{const y={...t.library_log_levels};delete y[x],e({...t,library_log_levels:y})},h=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],m=["FULL","compact","lite"],g=["none","title","full"];return o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"日期格式"}),o.jsx(ze,{value:t.date_style,onChange:x=>e({...t,date_style:x.target.value}),placeholder:"例如: m-d H:i:s"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"日志级别样式"}),o.jsxs(Vt,{value:t.log_level_style,onValueChange:x=>e({...t,log_level_style:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:m.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"日志文本颜色"}),o.jsxs(Vt,{value:t.color_text,onValueChange:x=>e({...t,color_text:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:g.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"全局日志级别"}),o.jsxs(Vt,{value:t.log_level,onValueChange:x=>e({...t,log_level:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"控制台日志级别"}),o.jsxs(Vt,{value:t.console_log_level,onValueChange:x=>e({...t,console_log_level:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"文件日志级别"}),o.jsxs(Vt,{value:t.file_log_level,onValueChange:x=>e({...t,file_log_level:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]})]})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"mb-2 block",children:"完全屏蔽的库"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(ze,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),a())}}),o.jsx(de,{onClick:a,size:"sm",className:"flex-shrink-0",children:o.jsx(Ls,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(x=>o.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[o.jsx("span",{className:"text-sm",children:x}),o.jsx(de,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>l(x),children:o.jsx(Sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},x))})]}),o.jsxs("div",{children:[o.jsx(he,{className:"mb-2 block",children:"特定库的日志级别"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(ze,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1"}),o.jsxs(Vt,{value:s,onValueChange:i,children:[o.jsx($t,{className:"w-32",children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]}),o.jsx(de,{onClick:c,size:"sm",children:o.jsx(Ls,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([x,y])=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[o.jsx("span",{className:"text-sm font-medium",children:x}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:y}),o.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>d(x),children:o.jsx(Sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},x))})]})]})}function Q0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),o.jsx(Bt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示回复器 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),o.jsx(Bt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示回复器推理"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),o.jsx(Bt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 Jargon Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),o.jsx(Bt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示记忆检索 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),o.jsx(Bt,{checked:t.show_memory_prompt,onCheckedChange:n=>e({...t,show_memory_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 Planner Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),o.jsx(Bt,{checked:t.show_planner_prompt,onCheckedChange:n=>e({...t,show_planner_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 LPMM 相关文段"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),o.jsx(Bt,{checked:t.show_lpmm_paragraph,onCheckedChange:n=>e({...t,show_lpmm_paragraph:n})})]})]})]})}function V0e({config:t,onChange:e}){const[n,r]=b.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=a=>{e({...t,auth_token:t.auth_token.filter((l,c)=>c!==a)})};return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"启用自定义服务器"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),o.jsx(Bt,{checked:t.use_custom,onCheckedChange:a=>e({...t,use_custom:a})})]}),t.use_custom&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"主机地址"}),o.jsx(ze,{value:t.host,onChange:a=>e({...t,host:a.target.value}),placeholder:"127.0.0.1"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"端口号"}),o.jsx(ze,{type:"number",value:t.port,onChange:a=>e({...t,port:parseInt(a.target.value)}),placeholder:"8090"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"连接模式"}),o.jsxs(Vt,{value:t.mode,onValueChange:a=>e({...t,mode:a}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"ws",children:"WebSocket (ws)"}),o.jsx(De,{value:"tcp",children:"TCP"})]})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{checked:t.use_wss,onCheckedChange:a=>e({...t,use_wss:a}),disabled:t.mode!=="ws"}),o.jsx(he,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"SSL 证书文件路径"}),o.jsx(ze,{value:t.cert_file,onChange:a=>e({...t,cert_file:a.target.value}),placeholder:"cert.pem"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"SSL 密钥文件路径"}),o.jsx(ze,{value:t.key_file,onChange:a=>e({...t,key_file:a.target.value}),placeholder:"key.pem"})]})]})]})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"mb-2 block",children:"认证令牌"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(ze,{value:n,onChange:a=>r(a.target.value),placeholder:"输入认证令牌",onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),s())}}),o.jsx(de,{onClick:s,size:"sm",children:o.jsx(Ls,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"space-y-2",children:t.auth_token.map((a,l)=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[o.jsx("span",{className:"text-sm font-mono",children:a}),o.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(l),children:o.jsx(Sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},l))})]})]})}function U0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"启用统计信息发送"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),o.jsx(Bt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const _f=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{className:"relative w-full overflow-auto",children:o.jsx("table",{ref:n,className:xe("w-full caption-bottom text-sm",t),...e})}));_f.displayName="Table";const Af=b.forwardRef(({className:t,...e},n)=>o.jsx("thead",{ref:n,className:xe("[&_tr]:border-b",t),...e}));Af.displayName="TableHeader";const Mf=b.forwardRef(({className:t,...e},n)=>o.jsx("tbody",{ref:n,className:xe("[&_tr:last-child]:border-0",t),...e}));Mf.displayName="TableBody";const W0e=b.forwardRef(({className:t,...e},n)=>o.jsx("tfoot",{ref:n,className:xe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));W0e.displayName="TableFooter";const Is=b.forwardRef(({className:t,...e},n)=>o.jsx("tr",{ref:n,className:xe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));Is.displayName="TableRow";const pn=b.forwardRef(({className:t,...e},n)=>o.jsx("th",{ref:n,className:xe("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}));pn.displayName="TableHead";const Gt=b.forwardRef(({className:t,...e},n)=>o.jsx("td",{ref:n,className:xe("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));Gt.displayName="TableCell";const G0e=b.forwardRef(({className:t,...e},n)=>o.jsx("caption",{ref:n,className:xe("mt-4 text-sm text-muted-foreground",t),...e}));G0e.displayName="TableCaption";var xA=1,X0e=.9,Y0e=.8,K0e=.17,mS=.1,pS=.999,Z0e=.9999,J0e=.99,epe=/[\\\/_+.#"@\[\(\{&]/,tpe=/[\\\/_+.#"@\[\(\{&]/g,npe=/[\s-]/,jH=/[\s-]/g;function pO(t,e,n,r,s,i,a){if(i===e.length)return s===t.length?xA:J0e;var l=`${s},${i}`;if(a[l]!==void 0)return a[l];for(var c=r.charAt(i),d=n.indexOf(c,s),h=0,m,g,x,y;d>=0;)m=pO(t,e,n,r,d+1,i+1,a),m>h&&(d===s?m*=xA:epe.test(t.charAt(d-1))?(m*=Y0e,x=t.slice(s,d-1).match(tpe),x&&s>0&&(m*=Math.pow(pS,x.length))):npe.test(t.charAt(d-1))?(m*=X0e,y=t.slice(s,d-1).match(jH),y&&s>0&&(m*=Math.pow(pS,y.length))):(m*=K0e,s>0&&(m*=Math.pow(pS,d-s))),t.charAt(d)!==e.charAt(i)&&(m*=Z0e)),(mm&&(m=g*mS)),m>h&&(h=m),d=n.indexOf(c,d+1);return a[l]=h,h}function vA(t){return t.toLowerCase().replace(jH," ")}function rpe(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,pO(t,e,vA(t),vA(e),0,0,{})}var spe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],cu=spe.reduce((t,e)=>{const n=Fy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Qm='[cmdk-group=""]',gS='[cmdk-group-items=""]',ipe='[cmdk-group-heading=""]',NH='[cmdk-item=""]',yA=`${NH}:not([aria-disabled="true"])`,gO="cmdk-item-select",wh="data-value",ape=(t,e,n)=>rpe(t,e,n),CH=b.createContext(void 0),Jp=()=>b.useContext(CH),TH=b.createContext(void 0),q6=()=>b.useContext(TH),EH=b.createContext(void 0),_H=b.forwardRef((t,e)=>{let n=Sh(()=>{var G,I;return{search:"",value:(I=(G=t.value)!=null?G:t.defaultValue)!=null?I:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Sh(()=>new Set),s=Sh(()=>new Map),i=Sh(()=>new Map),a=Sh(()=>new Set),l=AH(t),{label:c,children:d,value:h,onValueChange:m,filter:g,shouldFilter:x,loop:y,disablePointerSelection:w=!1,vimBindings:S=!0,...k}=t,j=Ui(),N=Ui(),T=Ui(),E=b.useRef(null),_=xpe();dd(()=>{if(h!==void 0){let G=h.trim();n.current.value=G,A.emit()}},[h]),dd(()=>{_(6,te)},[]);let A=b.useMemo(()=>({subscribe:G=>(a.current.add(G),()=>a.current.delete(G)),snapshot:()=>n.current,setState:(G,I,V)=>{var ee,ne,W,se;if(!Object.is(n.current[G],I)){if(n.current[G]=I,G==="search")U(),B(),_(1,$);else if(G==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(T);re?re.focus():(ee=document.getElementById(j))==null||ee.focus()}if(_(7,()=>{var re;n.current.selectedItemId=(re=z())==null?void 0:re.id,A.emit()}),V||_(5,te),((ne=l.current)==null?void 0:ne.value)!==void 0){let re=I??"";(se=(W=l.current).onValueChange)==null||se.call(W,re);return}}A.emit()}},emit:()=>{a.current.forEach(G=>G())}}),[]),L=b.useMemo(()=>({value:(G,I,V)=>{var ee;I!==((ee=i.current.get(G))==null?void 0:ee.value)&&(i.current.set(G,{value:I,keywords:V}),n.current.filtered.items.set(G,P(I,V)),_(2,()=>{B(),A.emit()}))},item:(G,I)=>(r.current.add(G),I&&(s.current.has(I)?s.current.get(I).add(G):s.current.set(I,new Set([G]))),_(3,()=>{U(),B(),n.current.value||$(),A.emit()}),()=>{i.current.delete(G),r.current.delete(G),n.current.filtered.items.delete(G);let V=z();_(4,()=>{U(),V?.getAttribute("id")===G&&$(),A.emit()})}),group:G=>(s.current.has(G)||s.current.set(G,new Set),()=>{i.current.delete(G),s.current.delete(G)}),filter:()=>l.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:j,inputId:T,labelId:N,listInnerRef:E}),[]);function P(G,I){var V,ee;let ne=(ee=(V=l.current)==null?void 0:V.filter)!=null?ee:ape;return G?ne(G,n.current.search,I):0}function B(){if(!n.current.search||l.current.shouldFilter===!1)return;let G=n.current.filtered.items,I=[];n.current.filtered.groups.forEach(ee=>{let ne=s.current.get(ee),W=0;ne.forEach(se=>{let re=G.get(se);W=Math.max(re,W)}),I.push([ee,W])});let V=E.current;Q().sort((ee,ne)=>{var W,se;let re=ee.getAttribute("id"),oe=ne.getAttribute("id");return((W=G.get(oe))!=null?W:0)-((se=G.get(re))!=null?se:0)}).forEach(ee=>{let ne=ee.closest(gS);ne?ne.appendChild(ee.parentElement===ne?ee:ee.closest(`${gS} > *`)):V.appendChild(ee.parentElement===V?ee:ee.closest(`${gS} > *`))}),I.sort((ee,ne)=>ne[1]-ee[1]).forEach(ee=>{var ne;let W=(ne=E.current)==null?void 0:ne.querySelector(`${Qm}[${wh}="${encodeURIComponent(ee[0])}"]`);W?.parentElement.appendChild(W)})}function $(){let G=Q().find(V=>V.getAttribute("aria-disabled")!=="true"),I=G?.getAttribute(wh);A.setState("value",I||void 0)}function U(){var G,I,V,ee;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let W of r.current){let se=(I=(G=i.current.get(W))==null?void 0:G.value)!=null?I:"",re=(ee=(V=i.current.get(W))==null?void 0:V.keywords)!=null?ee:[],oe=P(se,re);n.current.filtered.items.set(W,oe),oe>0&&ne++}for(let[W,se]of s.current)for(let re of se)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(W);break}n.current.filtered.count=ne}function te(){var G,I,V;let ee=z();ee&&(((G=ee.parentElement)==null?void 0:G.firstChild)===ee&&((V=(I=ee.closest(Qm))==null?void 0:I.querySelector(ipe))==null||V.scrollIntoView({block:"nearest"})),ee.scrollIntoView({block:"nearest"}))}function z(){var G;return(G=E.current)==null?void 0:G.querySelector(`${NH}[aria-selected="true"]`)}function Q(){var G;return Array.from(((G=E.current)==null?void 0:G.querySelectorAll(yA))||[])}function F(G){let I=Q()[G];I&&A.setState("value",I.getAttribute(wh))}function Y(G){var I;let V=z(),ee=Q(),ne=ee.findIndex(se=>se===V),W=ee[ne+G];(I=l.current)!=null&&I.loop&&(W=ne+G<0?ee[ee.length-1]:ne+G===ee.length?ee[0]:ee[ne+G]),W&&A.setState("value",W.getAttribute(wh))}function J(G){let I=z(),V=I?.closest(Qm),ee;for(;V&&!ee;)V=G>0?ppe(V,Qm):gpe(V,Qm),ee=V?.querySelector(yA);ee?A.setState("value",ee.getAttribute(wh)):Y(G)}let X=()=>F(Q().length-1),R=G=>{G.preventDefault(),G.metaKey?X():G.altKey?J(1):Y(1)},ie=G=>{G.preventDefault(),G.metaKey?F(0):G.altKey?J(-1):Y(-1)};return b.createElement(cu.div,{ref:e,tabIndex:-1,...k,"cmdk-root":"",onKeyDown:G=>{var I;(I=k.onKeyDown)==null||I.call(k,G);let V=G.nativeEvent.isComposing||G.keyCode===229;if(!(G.defaultPrevented||V))switch(G.key){case"n":case"j":{S&&G.ctrlKey&&R(G);break}case"ArrowDown":{R(G);break}case"p":case"k":{S&&G.ctrlKey&&ie(G);break}case"ArrowUp":{ie(G);break}case"Home":{G.preventDefault(),F(0);break}case"End":{G.preventDefault(),X();break}case"Enter":{G.preventDefault();let ee=z();if(ee){let ne=new Event(gO);ee.dispatchEvent(ne)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:L.inputId,id:L.labelId,style:ype},c),kb(t,G=>b.createElement(TH.Provider,{value:A},b.createElement(CH.Provider,{value:L},G))))}),ope=b.forwardRef((t,e)=>{var n,r;let s=Ui(),i=b.useRef(null),a=b.useContext(EH),l=Jp(),c=AH(t),d=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;dd(()=>{if(!d)return l.item(s,a?.id)},[d]);let h=MH(s,i,[t.value,t.children,i],t.keywords),m=q6(),g=Zc(_=>_.value&&_.value===h.current),x=Zc(_=>d||l.filter()===!1?!0:_.search?_.filtered.items.get(s)>0:!0);b.useEffect(()=>{let _=i.current;if(!(!_||t.disabled))return _.addEventListener(gO,y),()=>_.removeEventListener(gO,y)},[x,t.onSelect,t.disabled]);function y(){var _,A;w(),(A=(_=c.current).onSelect)==null||A.call(_,h.current)}function w(){m.setState("value",h.current,!0)}if(!x)return null;let{disabled:S,value:k,onSelect:j,forceMount:N,keywords:T,...E}=t;return b.createElement(cu.div,{ref:Qc(i,e),...E,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||l.getDisablePointerSelection()?void 0:w,onClick:S?void 0:y},t.children)}),lpe=b.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,a=Ui(),l=b.useRef(null),c=b.useRef(null),d=Ui(),h=Jp(),m=Zc(x=>s||h.filter()===!1?!0:x.search?x.filtered.groups.has(a):!0);dd(()=>h.group(a),[]),MH(a,l,[t.value,t.heading,c]);let g=b.useMemo(()=>({id:a,forceMount:s}),[s]);return b.createElement(cu.div,{ref:Qc(l,e),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),kb(t,x=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},b.createElement(EH.Provider,{value:g},x))))}),cpe=b.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=b.useRef(null),i=Zc(a=>!a.search);return!n&&!i?null:b.createElement(cu.div,{ref:Qc(s,e),...r,"cmdk-separator":"",role:"separator"})}),upe=b.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=q6(),a=Zc(d=>d.search),l=Zc(d=>d.selectedItemId),c=Jp();return b.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),b.createElement(cu.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?t.value:a,onChange:d=>{s||i.setState("search",d.target.value),n?.(d.target.value)}})}),dpe=b.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=b.useRef(null),a=b.useRef(null),l=Zc(d=>d.selectedItemId),c=Jp();return b.useEffect(()=>{if(a.current&&i.current){let d=a.current,h=i.current,m,g=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let x=d.offsetHeight;h.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return g.observe(d),()=>{cancelAnimationFrame(m),g.unobserve(d)}}},[]),b.createElement(cu.div,{ref:Qc(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},kb(t,d=>b.createElement("div",{ref:Qc(a,c.listInnerRef),"cmdk-list-sizer":""},d)))}),hpe=b.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:a,...l}=t;return b.createElement(Nj,{open:n,onOpenChange:r},b.createElement(kj,{container:a},b.createElement(qy,{"cmdk-overlay":"",className:s}),b.createElement($y,{"aria-label":t.label,"cmdk-dialog":"",className:i},b.createElement(_H,{ref:e,...l}))))}),fpe=b.forwardRef((t,e)=>Zc(n=>n.filtered.count===0)?b.createElement(cu.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),mpe=b.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return b.createElement(cu.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},kb(t,a=>b.createElement("div",{"aria-hidden":!0},a)))}),Ci=Object.assign(_H,{List:dpe,Item:ope,Input:upe,Group:lpe,Separator:cpe,Dialog:hpe,Empty:fpe,Loading:mpe});function ppe(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function gpe(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function AH(t){let e=b.useRef(t);return dd(()=>{e.current=t}),e}var dd=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Sh(t){let e=b.useRef();return e.current===void 0&&(e.current=t()),e}function Zc(t){let e=q6(),n=()=>t(e.snapshot());return b.useSyncExternalStore(e.subscribe,n,n)}function MH(t,e,n,r=[]){let s=b.useRef(),i=Jp();return dd(()=>{var a;let l=(()=>{var d;for(let h of n){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(d=h.current.textContent)==null?void 0:d.trim():s.current}})(),c=r.map(d=>d.trim());i.value(t,l,c),(a=e.current)==null||a.setAttribute(wh,l),s.current=l}),s}var xpe=()=>{let[t,e]=b.useState(),n=Sh(()=>new Map);return dd(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function vpe(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function kb({asChild:t,children:e},n){return t&&b.isValidElement(e)?b.cloneElement(vpe(e),{ref:e.ref},n(e.props.children)):n(e)}var ype={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ob=b.forwardRef(({className:t,...e},n)=>o.jsx(Ci,{ref:n,className:xe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));Ob.displayName=Ci.displayName;const jb=b.forwardRef(({className:t,...e},n)=>o.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[o.jsx(Ni,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),o.jsx(Ci.Input,{ref:n,className:xe("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})]}));jb.displayName=Ci.Input.displayName;const Nb=b.forwardRef(({className:t,...e},n)=>o.jsx(Ci.List,{ref:n,className:xe("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));Nb.displayName=Ci.List.displayName;const Cb=b.forwardRef((t,e)=>o.jsx(Ci.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));Cb.displayName=Ci.Empty.displayName;const ap=b.forwardRef(({className:t,...e},n)=>o.jsx(Ci.Group,{ref:n,className:xe("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}));ap.displayName=Ci.Group.displayName;const bpe=b.forwardRef(({className:t,...e},n)=>o.jsx(Ci.Separator,{ref:n,className:xe("-mx-1 h-px bg-border",t),...e}));bpe.displayName=Ci.Separator.displayName;const op=b.forwardRef(({className:t,...e},n)=>o.jsx(Ci.Item,{ref:n,className:xe("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}));op.displayName=Ci.Item.displayName;const Oi=b.forwardRef(({className:t,...e},n)=>o.jsx(gI,{ref:n,className:xe("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:o.jsx(Ree,{className:xe("grid place-content-center text-current"),children:o.jsx(Ro,{className:"h-4 w-4"})})}));Oi.displayName=gI.displayName;const RH=b.createContext(null),DH="maibot-completed-tours";function wpe(){try{const t=localStorage.getItem(DH);return t?new Set(JSON.parse(t)):new Set}catch{return new Set}}function bA(t){localStorage.setItem(DH,JSON.stringify([...t]))}function Spe({children:t}){const[e,n]=b.useState({activeTourId:null,stepIndex:0,isRunning:!1}),r=b.useRef(new Map),[,s]=b.useState(0),[i,a]=b.useState(wpe),l=b.useCallback((N,T)=>{r.current.set(N,T),s(E=>E+1)},[]),c=b.useCallback(N=>{r.current.delete(N),n(T=>T.activeTourId===N?{...T,activeTourId:null,isRunning:!1,stepIndex:0}:T)},[]),d=b.useCallback((N,T=0)=>{r.current.has(N)&&n({activeTourId:N,stepIndex:T,isRunning:!0})},[]),h=b.useCallback(()=>{n(N=>({...N,isRunning:!1}))},[]),m=b.useCallback(N=>{n(T=>({...T,stepIndex:N}))},[]),g=b.useCallback(()=>{n(N=>({...N,stepIndex:N.stepIndex+1}))},[]),x=b.useCallback(()=>{n(N=>({...N,stepIndex:Math.max(0,N.stepIndex-1)}))},[]),y=b.useCallback(()=>e.activeTourId?r.current.get(e.activeTourId)||[]:[],[e.activeTourId]),w=b.useCallback(N=>{a(T=>{const E=new Set(T);return E.add(N),bA(E),E})},[]),S=b.useCallback(N=>{const{action:T,index:E,status:_,type:A}=N,L=["finished","skipped"];if(T==="close"){n(P=>({...P,isRunning:!1,stepIndex:0}));return}L.includes(_)?n(P=>(_==="finished"&&P.activeTourId&&setTimeout(()=>w(P.activeTourId),0),{...P,isRunning:!1,stepIndex:0})):A==="step:after"&&(T==="next"?n(P=>({...P,stepIndex:E+1})):T==="prev"&&n(P=>({...P,stepIndex:E-1})))},[w]),k=b.useCallback(N=>i.has(N),[i]),j=b.useCallback(N=>{a(T=>{const E=new Set(T);return E.delete(N),bA(E),E})},[]);return o.jsx(RH.Provider,{value:{state:e,tours:r.current,registerTour:l,unregisterTour:c,startTour:d,stopTour:h,goToStep:m,nextStep:g,prevStep:x,getCurrentSteps:y,handleJoyrideCallback:S,isTourCompleted:k,markTourCompleted:w,resetTourCompleted:j},children:t})}function PH(t){return e=>typeof e===t}var kpe=PH("function"),Ope=t=>t===null,wA=t=>Object.prototype.toString.call(t).slice(8,-1)==="RegExp",SA=t=>!jpe(t)&&!Ope(t)&&(kpe(t)||typeof t=="object"),jpe=PH("undefined");function Npe(t,e){const{length:n}=t;if(n!==e.length)return!1;for(let r=n;r--!==0;)if(!ei(t[r],e[r]))return!1;return!0}function Cpe(t,e){if(t.byteLength!==e.byteLength)return!1;const n=new DataView(t.buffer),r=new DataView(e.buffer);let s=t.byteLength;for(;s--;)if(n.getUint8(s)!==r.getUint8(s))return!1;return!0}function Tpe(t,e){if(t.size!==e.size)return!1;for(const n of t.entries())if(!e.has(n[0]))return!1;for(const n of t.entries())if(!ei(n[1],e.get(n[0])))return!1;return!0}function Epe(t,e){if(t.size!==e.size)return!1;for(const n of t.entries())if(!e.has(n[0]))return!1;return!0}function ei(t,e){if(t===e)return!0;if(t&&SA(t)&&e&&SA(e)){if(t.constructor!==e.constructor)return!1;if(Array.isArray(t)&&Array.isArray(e))return Npe(t,e);if(t instanceof Map&&e instanceof Map)return Tpe(t,e);if(t instanceof Set&&e instanceof Set)return Epe(t,e);if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return Cpe(t,e);if(wA(t)&&wA(e))return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let s=n.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,n[s]))return!1;for(let s=n.length;s--!==0;){const i=n[s];if(!(i==="_owner"&&t.$$typeof)&&!ei(t[i],e[i]))return!1}return!0}return Number.isNaN(t)&&Number.isNaN(e)?!0:t===e}var _pe=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Ape=["bigint","boolean","null","number","string","symbol","undefined"];function Tb(t){const e=Object.prototype.toString.call(t).slice(8,-1);if(/HTML\w+Element/.test(e))return"HTMLElement";if(Mpe(e))return e}function ro(t){return e=>Tb(e)===t}function Mpe(t){return _pe.includes(t)}function Rf(t){return e=>typeof e===t}function Rpe(t){return Ape.includes(t)}var Dpe=["innerHTML","ownerDocument","style","attributes","nodeValue"];function ct(t){if(t===null)return"null";switch(typeof t){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(ct.array(t))return"Array";if(ct.plainFunction(t))return"Function";const e=Tb(t);return e||"Object"}ct.array=Array.isArray;ct.arrayOf=(t,e)=>!ct.array(t)&&!ct.function(e)?!1:t.every(n=>e(n));ct.asyncGeneratorFunction=t=>Tb(t)==="AsyncGeneratorFunction";ct.asyncFunction=ro("AsyncFunction");ct.bigint=Rf("bigint");ct.boolean=t=>t===!0||t===!1;ct.date=ro("Date");ct.defined=t=>!ct.undefined(t);ct.domElement=t=>ct.object(t)&&!ct.plainObject(t)&&t.nodeType===1&&ct.string(t.nodeName)&&Dpe.every(e=>e in t);ct.empty=t=>ct.string(t)&&t.length===0||ct.array(t)&&t.length===0||ct.object(t)&&!ct.map(t)&&!ct.set(t)&&Object.keys(t).length===0||ct.set(t)&&t.size===0||ct.map(t)&&t.size===0;ct.error=ro("Error");ct.function=Rf("function");ct.generator=t=>ct.iterable(t)&&ct.function(t.next)&&ct.function(t.throw);ct.generatorFunction=ro("GeneratorFunction");ct.instanceOf=(t,e)=>!t||!e?!1:Object.getPrototypeOf(t)===e.prototype;ct.iterable=t=>!ct.nullOrUndefined(t)&&ct.function(t[Symbol.iterator]);ct.map=ro("Map");ct.nan=t=>Number.isNaN(t);ct.null=t=>t===null;ct.nullOrUndefined=t=>ct.null(t)||ct.undefined(t);ct.number=t=>Rf("number")(t)&&!ct.nan(t);ct.numericString=t=>ct.string(t)&&t.length>0&&!Number.isNaN(Number(t));ct.object=t=>!ct.nullOrUndefined(t)&&(ct.function(t)||typeof t=="object");ct.oneOf=(t,e)=>ct.array(t)?t.indexOf(e)>-1:!1;ct.plainFunction=ro("Function");ct.plainObject=t=>{if(Tb(t)!=="Object")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.getPrototypeOf({})};ct.primitive=t=>ct.null(t)||Rpe(typeof t);ct.promise=ro("Promise");ct.propertyOf=(t,e,n)=>{if(!ct.object(t)||!e)return!1;const r=t[e];return ct.function(n)?n(r):ct.defined(r)};ct.regexp=ro("RegExp");ct.set=ro("Set");ct.string=Rf("string");ct.symbol=Rf("symbol");ct.undefined=Rf("undefined");ct.weakMap=ro("WeakMap");ct.weakSet=ro("WeakSet");var ft=ct;function Ppe(...t){return t.every(e=>ft.string(e)||ft.array(e)||ft.plainObject(e))}function zpe(t,e,n){return zH(t,e)?[t,e].every(ft.array)?!t.some(CA(n))&&e.some(CA(n)):[t,e].every(ft.plainObject)?!Object.entries(t).some(NA(n))&&Object.entries(e).some(NA(n)):e===n:!1}function kA(t,e,n){const{actual:r,key:s,previous:i,type:a}=n,l=To(t,s),c=To(e,s);let d=[l,c].every(ft.number)&&(a==="increased"?lc);return ft.undefined(r)||(d=d&&c===r),ft.undefined(i)||(d=d&&l===i),d}function OA(t,e,n){const{key:r,type:s,value:i}=n,a=To(t,r),l=To(e,r),c=s==="added"?a:l,d=s==="added"?l:a;if(!ft.nullOrUndefined(i)){if(ft.defined(c)){if(ft.array(c)||ft.plainObject(c))return zpe(c,d,i)}else return ei(d,i);return!1}return[a,l].every(ft.array)?!d.every($6(c)):[a,l].every(ft.plainObject)?Ipe(Object.keys(c),Object.keys(d)):![a,l].every(h=>ft.primitive(h)&&ft.defined(h))&&(s==="added"?!ft.defined(a)&&ft.defined(l):ft.defined(a)&&!ft.defined(l))}function jA(t,e,{key:n}={}){let r=To(t,n),s=To(e,n);if(!zH(r,s))throw new TypeError("Inputs have different types");if(!Ppe(r,s))throw new TypeError("Inputs don't have length");return[r,s].every(ft.plainObject)&&(r=Object.keys(r),s=Object.keys(s)),[r,s]}function NA(t){return([e,n])=>ft.array(t)?ei(t,n)||t.some(r=>ei(r,n)||ft.array(n)&&$6(n)(r)):ft.plainObject(t)&&t[e]?!!t[e]&&ei(t[e],n):ei(t,n)}function Ipe(t,e){return e.some(n=>!t.includes(n))}function CA(t){return e=>ft.array(t)?t.some(n=>ei(n,e)||ft.array(e)&&$6(e)(n)):ei(t,e)}function Vm(t,e){return ft.array(t)?t.some(n=>ei(n,e)):ei(t,e)}function $6(t){return e=>t.some(n=>ei(n,e))}function zH(...t){return t.every(ft.array)||t.every(ft.number)||t.every(ft.plainObject)||t.every(ft.string)}function To(t,e){return ft.plainObject(t)||ft.array(t)?ft.string(e)?e.split(".").reduce((r,s)=>r&&r[s],t):ft.number(e)?t[e]:t:t}function uy(t,e){if([t,e].some(ft.nullOrUndefined))throw new Error("Missing required parameters");if(![t,e].every(h=>ft.plainObject(h)||ft.array(h)))throw new Error("Expected plain objects or array");return{added:(h,m)=>{try{return OA(t,e,{key:h,type:"added",value:m})}catch{return!1}},changed:(h,m,g)=>{try{const x=To(t,h),y=To(e,h),w=ft.defined(m),S=ft.defined(g);if(w||S){const k=S?Vm(g,x):!Vm(m,x),j=Vm(m,y);return k&&j}return[x,y].every(ft.array)||[x,y].every(ft.plainObject)?!ei(x,y):x!==y}catch{return!1}},changedFrom:(h,m,g)=>{if(!ft.defined(h))return!1;try{const x=To(t,h),y=To(e,h),w=ft.defined(g);return Vm(m,x)&&(w?Vm(g,y):!w)}catch{return!1}},decreased:(h,m,g)=>{if(!ft.defined(h))return!1;try{return kA(t,e,{key:h,actual:m,previous:g,type:"decreased"})}catch{return!1}},emptied:h=>{try{const[m,g]=jA(t,e,{key:h});return!!m.length&&!g.length}catch{return!1}},filled:h=>{try{const[m,g]=jA(t,e,{key:h});return!m.length&&!!g.length}catch{return!1}},increased:(h,m,g)=>{if(!ft.defined(h))return!1;try{return kA(t,e,{key:h,actual:m,previous:g,type:"increased"})}catch{return!1}},removed:(h,m)=>{try{return OA(t,e,{key:h,type:"removed",value:m})}catch{return!1}}}}var xS,TA;function Lpe(){if(TA)return xS;TA=1;var t=new Error("Element already at target scroll position"),e=new Error("Scroll cancelled"),n=Math.min,r=Date.now;xS={left:s("scrollLeft"),top:s("scrollTop")};function s(l){return function(d,h,m,g){m=m||{},typeof m=="function"&&(g=m,m={}),typeof g!="function"&&(g=a);var x=r(),y=d[l],w=m.ease||i,S=isNaN(m.duration)?350:+m.duration,k=!1;return y===h?g(t,d[l]):requestAnimationFrame(N),j;function j(){k=!0}function N(T){if(k)return g(e,d[l]);var E=r(),_=n(1,(E-x)/S),A=w(_);d[l]=A*(h-y)+y,_<1?requestAnimationFrame(N):requestAnimationFrame(function(){g(null,d[l])})}}}function i(l){return .5*(1-Math.cos(Math.PI*l))}function a(){}return xS}var Bpe=Lpe();const Fpe=gd(Bpe);var yv={exports:{}},qpe=yv.exports,EA;function $pe(){return EA||(EA=1,(function(t){(function(e,n){t.exports?t.exports=n():e.Scrollparent=n()})(qpe,function(){function e(r){var s=getComputedStyle(r,null).getPropertyValue("overflow");return s.indexOf("scroll")>-1||s.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var s=r.parentNode;s.parentNode;){if(e(s))return s;s=s.parentNode}return document.scrollingElement||document.documentElement}}return n})})(yv)),yv.exports}var Hpe=$pe();const IH=gd(Hpe);var vS,_A;function Qpe(){if(_A)return vS;_A=1;var t=function(r){return Object.prototype.hasOwnProperty.call(r,"props")},e=function(r,s){return r+n(s)},n=function(r){return r===null||typeof r=="boolean"||typeof r>"u"?"":typeof r=="number"?r.toString():typeof r=="string"?r:Array.isArray(r)?r.reduce(e,""):t(r)&&Object.prototype.hasOwnProperty.call(r.props,"children")?n(r.props.children):""};return n.default=n,vS=n,vS}var Vpe=Qpe();const AA=gd(Vpe);var yS,MA;function Upe(){if(MA)return yS;MA=1;var t=function(j){return e(j)&&!n(j)};function e(k){return!!k&&typeof k=="object"}function n(k){var j=Object.prototype.toString.call(k);return j==="[object RegExp]"||j==="[object Date]"||i(k)}var r=typeof Symbol=="function"&&Symbol.for,s=r?Symbol.for("react.element"):60103;function i(k){return k.$$typeof===s}function a(k){return Array.isArray(k)?[]:{}}function l(k,j){return j.clone!==!1&&j.isMergeableObject(k)?w(a(k),k,j):k}function c(k,j,N){return k.concat(j).map(function(T){return l(T,N)})}function d(k,j){if(!j.customMerge)return w;var N=j.customMerge(k);return typeof N=="function"?N:w}function h(k){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(k).filter(function(j){return Object.propertyIsEnumerable.call(k,j)}):[]}function m(k){return Object.keys(k).concat(h(k))}function g(k,j){try{return j in k}catch{return!1}}function x(k,j){return g(k,j)&&!(Object.hasOwnProperty.call(k,j)&&Object.propertyIsEnumerable.call(k,j))}function y(k,j,N){var T={};return N.isMergeableObject(k)&&m(k).forEach(function(E){T[E]=l(k[E],N)}),m(j).forEach(function(E){x(k,E)||(g(k,E)&&N.isMergeableObject(j[E])?T[E]=d(E,N)(k[E],j[E],N):T[E]=l(j[E],N))}),T}function w(k,j,N){N=N||{},N.arrayMerge=N.arrayMerge||c,N.isMergeableObject=N.isMergeableObject||t,N.cloneUnlessOtherwiseSpecified=l;var T=Array.isArray(j),E=Array.isArray(k),_=T===E;return _?T?N.arrayMerge(k,j,N):y(k,j,N):l(j,N)}w.all=function(j,N){if(!Array.isArray(j))throw new Error("first argument should be an array");return j.reduce(function(T,E){return w(T,E,N)},{})};var S=w;return yS=S,yS}var Wpe=Upe();const Va=gd(Wpe);var eg=typeof window<"u"&&typeof document<"u"&&typeof navigator<"u",Gpe=(function(){for(var t=["Edge","Trident","Firefox"],e=0;e=0)return 1;return 0})();function Xpe(t){var e=!1;return function(){e||(e=!0,window.Promise.resolve().then(function(){e=!1,t()}))}}function Ype(t){var e=!1;return function(){e||(e=!0,setTimeout(function(){e=!1,t()},Gpe))}}var Kpe=eg&&window.Promise,Zpe=Kpe?Xpe:Ype;function LH(t){var e={};return t&&e.toString.call(t)==="[object Function]"}function bd(t,e){if(t.nodeType!==1)return[];var n=t.ownerDocument.defaultView,r=n.getComputedStyle(t,null);return e?r[e]:r}function H6(t){return t.nodeName==="HTML"?t:t.parentNode||t.host}function tg(t){if(!t)return document.body;switch(t.nodeName){case"HTML":case"BODY":return t.ownerDocument.body;case"#document":return t.body}var e=bd(t),n=e.overflow,r=e.overflowX,s=e.overflowY;return/(auto|scroll|overlay)/.test(n+s+r)?t:tg(H6(t))}function BH(t){return t&&t.referenceNode?t.referenceNode:t}var RA=eg&&!!(window.MSInputMethodContext&&document.documentMode),DA=eg&&/MSIE 10/.test(navigator.userAgent);function Df(t){return t===11?RA:t===10?DA:RA||DA}function lf(t){if(!t)return document.documentElement;for(var e=Df(10)?document.body:null,n=t.offsetParent||null;n===e&&t.nextElementSibling;)n=(t=t.nextElementSibling).offsetParent;var r=n&&n.nodeName;return!r||r==="BODY"||r==="HTML"?t?t.ownerDocument.documentElement:document.documentElement:["TH","TD","TABLE"].indexOf(n.nodeName)!==-1&&bd(n,"position")==="static"?lf(n):n}function Jpe(t){var e=t.nodeName;return e==="BODY"?!1:e==="HTML"||lf(t.firstElementChild)===t}function xO(t){return t.parentNode!==null?xO(t.parentNode):t}function dy(t,e){if(!t||!t.nodeType||!e||!e.nodeType)return document.documentElement;var n=t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?t:e,s=n?e:t,i=document.createRange();i.setStart(r,0),i.setEnd(s,0);var a=i.commonAncestorContainer;if(t!==a&&e!==a||r.contains(s))return Jpe(a)?a:lf(a);var l=xO(t);return l.host?dy(l.host,e):dy(t,xO(e).host)}function cf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"top",n=e==="top"?"scrollTop":"scrollLeft",r=t.nodeName;if(r==="BODY"||r==="HTML"){var s=t.ownerDocument.documentElement,i=t.ownerDocument.scrollingElement||s;return i[n]}return t[n]}function ege(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=cf(e,"top"),s=cf(e,"left"),i=n?-1:1;return t.top+=r*i,t.bottom+=r*i,t.left+=s*i,t.right+=s*i,t}function PA(t,e){var n=e==="x"?"Left":"Top",r=n==="Left"?"Right":"Bottom";return parseFloat(t["border"+n+"Width"])+parseFloat(t["border"+r+"Width"])}function zA(t,e,n,r){return Math.max(e["offset"+t],e["scroll"+t],n["client"+t],n["offset"+t],n["scroll"+t],Df(10)?parseInt(n["offset"+t])+parseInt(r["margin"+(t==="Height"?"Top":"Left")])+parseInt(r["margin"+(t==="Height"?"Bottom":"Right")]):0)}function FH(t){var e=t.body,n=t.documentElement,r=Df(10)&&getComputedStyle(n);return{height:zA("Height",e,n,r),width:zA("Width",e,n,r)}}var tge=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},nge=(function(){function t(e,n){for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,r=Df(10),s=e.nodeName==="HTML",i=vO(t),a=vO(e),l=tg(t),c=bd(e),d=parseFloat(c.borderTopWidth),h=parseFloat(c.borderLeftWidth);n&&s&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var m=Jc({top:i.top-a.top-d,left:i.left-a.left-h,width:i.width,height:i.height});if(m.marginTop=0,m.marginLeft=0,!r&&s){var g=parseFloat(c.marginTop),x=parseFloat(c.marginLeft);m.top-=d-g,m.bottom-=d-g,m.left-=h-x,m.right-=h-x,m.marginTop=g,m.marginLeft=x}return(r&&!n?e.contains(l):e===l&&l.nodeName!=="BODY")&&(m=ege(m,e)),m}function rge(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=t.ownerDocument.documentElement,r=Q6(t,n),s=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),a=e?0:cf(n),l=e?0:cf(n,"left"),c={top:a-r.top+r.marginTop,left:l-r.left+r.marginLeft,width:s,height:i};return Jc(c)}function qH(t){var e=t.nodeName;if(e==="BODY"||e==="HTML")return!1;if(bd(t,"position")==="fixed")return!0;var n=H6(t);return n?qH(n):!1}function $H(t){if(!t||!t.parentElement||Df())return document.documentElement;for(var e=t.parentElement;e&&bd(e,"transform")==="none";)e=e.parentElement;return e||document.documentElement}function V6(t,e,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,i={top:0,left:0},a=s?$H(t):dy(t,BH(e));if(r==="viewport")i=rge(a,s);else{var l=void 0;r==="scrollParent"?(l=tg(H6(e)),l.nodeName==="BODY"&&(l=t.ownerDocument.documentElement)):r==="window"?l=t.ownerDocument.documentElement:l=r;var c=Q6(l,a,s);if(l.nodeName==="HTML"&&!qH(a)){var d=FH(t.ownerDocument),h=d.height,m=d.width;i.top+=c.top-c.marginTop,i.bottom=h+c.top,i.left+=c.left-c.marginLeft,i.right=m+c.left}else i=c}n=n||0;var g=typeof n=="number";return i.left+=g?n:n.left||0,i.top+=g?n:n.top||0,i.right-=g?n:n.right||0,i.bottom-=g?n:n.bottom||0,i}function sge(t){var e=t.width,n=t.height;return e*n}function HH(t,e,n,r,s){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(t.indexOf("auto")===-1)return t;var a=V6(n,r,i,s),l={top:{width:a.width,height:e.top-a.top},right:{width:a.right-e.right,height:a.height},bottom:{width:a.width,height:a.bottom-e.bottom},left:{width:e.left-a.left,height:a.height}},c=Object.keys(l).map(function(g){return wa({key:g},l[g],{area:sge(l[g])})}).sort(function(g,x){return x.area-g.area}),d=c.filter(function(g){var x=g.width,y=g.height;return x>=n.clientWidth&&y>=n.clientHeight}),h=d.length>0?d[0].key:c[0].key,m=t.split("-")[1];return h+(m?"-"+m:"")}function QH(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,s=r?$H(e):dy(e,BH(n));return Q6(n,s,r)}function VH(t){var e=t.ownerDocument.defaultView,n=e.getComputedStyle(t),r=parseFloat(n.marginTop||0)+parseFloat(n.marginBottom||0),s=parseFloat(n.marginLeft||0)+parseFloat(n.marginRight||0),i={width:t.offsetWidth+s,height:t.offsetHeight+r};return i}function hy(t){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return t.replace(/left|right|bottom|top/g,function(n){return e[n]})}function UH(t,e,n){n=n.split("-")[0];var r=VH(t),s={width:r.width,height:r.height},i=["right","left"].indexOf(n)!==-1,a=i?"top":"left",l=i?"left":"top",c=i?"height":"width",d=i?"width":"height";return s[a]=e[a]+e[c]/2-r[c]/2,n===l?s[l]=e[l]-r[d]:s[l]=e[hy(l)],s}function ng(t,e){return Array.prototype.find?t.find(e):t.filter(e)[0]}function ige(t,e,n){if(Array.prototype.findIndex)return t.findIndex(function(s){return s[e]===n});var r=ng(t,function(s){return s[e]===n});return t.indexOf(r)}function WH(t,e,n){var r=n===void 0?t:t.slice(0,ige(t,"name",n));return r.forEach(function(s){s.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var i=s.function||s.fn;s.enabled&&LH(i)&&(e.offsets.popper=Jc(e.offsets.popper),e.offsets.reference=Jc(e.offsets.reference),e=i(e,s))}),e}function age(){if(!this.state.isDestroyed){var t={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};t.offsets.reference=QH(this.state,this.popper,this.reference,this.options.positionFixed),t.placement=HH(this.options.placement,t.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),t.originalPlacement=t.placement,t.positionFixed=this.options.positionFixed,t.offsets.popper=UH(this.popper,t.offsets.reference,t.placement),t.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",t=WH(this.modifiers,t),this.state.isCreated?this.options.onUpdate(t):(this.state.isCreated=!0,this.options.onCreate(t))}}function GH(t,e){return t.some(function(n){var r=n.name,s=n.enabled;return s&&r===e})}function U6(t){for(var e=[!1,"ms","Webkit","Moz","O"],n=t.charAt(0).toUpperCase()+t.slice(1),r=0;ra[x]&&(t.offsets.popper[m]+=l[m]+y-a[x]),t.offsets.popper=Jc(t.offsets.popper);var w=l[m]+l[d]/2-y/2,S=bd(t.instance.popper),k=parseFloat(S["margin"+h]),j=parseFloat(S["border"+h+"Width"]),N=w-t.offsets.popper[m]-k-j;return N=Math.max(Math.min(a[d]-y,N),0),t.arrowElement=r,t.offsets.arrow=(n={},uf(n,m,Math.round(N)),uf(n,g,""),n),t}function yge(t){return t==="end"?"start":t==="start"?"end":t}var ZH=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],bS=ZH.slice(3);function IA(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=bS.indexOf(t),r=bS.slice(n+1).concat(bS.slice(0,n));return e?r.reverse():r}var wS={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"};function bge(t,e){if(GH(t.instance.modifiers,"inner")||t.flipped&&t.placement===t.originalPlacement)return t;var n=V6(t.instance.popper,t.instance.reference,e.padding,e.boundariesElement,t.positionFixed),r=t.placement.split("-")[0],s=hy(r),i=t.placement.split("-")[1]||"",a=[];switch(e.behavior){case wS.FLIP:a=[r,s];break;case wS.CLOCKWISE:a=IA(r);break;case wS.COUNTERCLOCKWISE:a=IA(r,!0);break;default:a=e.behavior}return a.forEach(function(l,c){if(r!==l||a.length===c+1)return t;r=t.placement.split("-")[0],s=hy(r);var d=t.offsets.popper,h=t.offsets.reference,m=Math.floor,g=r==="left"&&m(d.right)>m(h.left)||r==="right"&&m(d.left)m(h.top)||r==="bottom"&&m(d.top)m(n.right),w=m(d.top)m(n.bottom),k=r==="left"&&x||r==="right"&&y||r==="top"&&w||r==="bottom"&&S,j=["top","bottom"].indexOf(r)!==-1,N=!!e.flipVariations&&(j&&i==="start"&&x||j&&i==="end"&&y||!j&&i==="start"&&w||!j&&i==="end"&&S),T=!!e.flipVariationsByContent&&(j&&i==="start"&&y||j&&i==="end"&&x||!j&&i==="start"&&S||!j&&i==="end"&&w),E=N||T;(g||k||E)&&(t.flipped=!0,(g||k)&&(r=a[c+1]),E&&(i=yge(i)),t.placement=r+(i?"-"+i:""),t.offsets.popper=wa({},t.offsets.popper,UH(t.instance.popper,t.offsets.reference,t.placement)),t=WH(t.instance.modifiers,t,"flip"))}),t}function wge(t){var e=t.offsets,n=e.popper,r=e.reference,s=t.placement.split("-")[0],i=Math.floor,a=["top","bottom"].indexOf(s)!==-1,l=a?"right":"bottom",c=a?"left":"top",d=a?"width":"height";return n[l]i(r[l])&&(t.offsets.popper[c]=i(r[l])),t}function Sge(t,e,n,r){var s=t.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+s[1],a=s[2];if(!i)return t;if(a.indexOf("%")===0){var l=void 0;switch(a){case"%p":l=n;break;case"%":case"%r":default:l=r}var c=Jc(l);return c[e]/100*i}else if(a==="vh"||a==="vw"){var d=void 0;return a==="vh"?d=Math.max(document.documentElement.clientHeight,window.innerHeight||0):d=Math.max(document.documentElement.clientWidth,window.innerWidth||0),d/100*i}else return i}function kge(t,e,n,r){var s=[0,0],i=["right","left"].indexOf(r)!==-1,a=t.split(/(\+|\-)/).map(function(h){return h.trim()}),l=a.indexOf(ng(a,function(h){return h.search(/,|\s/)!==-1}));a[l]&&a[l].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var c=/\s*,\s*|\s+/,d=l!==-1?[a.slice(0,l).concat([a[l].split(c)[0]]),[a[l].split(c)[1]].concat(a.slice(l+1))]:[a];return d=d.map(function(h,m){var g=(m===1?!i:i)?"height":"width",x=!1;return h.reduce(function(y,w){return y[y.length-1]===""&&["+","-"].indexOf(w)!==-1?(y[y.length-1]=w,x=!0,y):x?(y[y.length-1]+=w,x=!1,y):y.concat(w)},[]).map(function(y){return Sge(y,g,e,n)})}),d.forEach(function(h,m){h.forEach(function(g,x){W6(g)&&(s[m]+=g*(h[x-1]==="-"?-1:1))})}),s}function Oge(t,e){var n=e.offset,r=t.placement,s=t.offsets,i=s.popper,a=s.reference,l=r.split("-")[0],c=void 0;return W6(+n)?c=[+n,0]:c=kge(n,i,a,l),l==="left"?(i.top+=c[0],i.left-=c[1]):l==="right"?(i.top+=c[0],i.left+=c[1]):l==="top"?(i.left+=c[0],i.top-=c[1]):l==="bottom"&&(i.left+=c[0],i.top+=c[1]),t.popper=i,t}function jge(t,e){var n=e.boundariesElement||lf(t.instance.popper);t.instance.reference===n&&(n=lf(n));var r=U6("transform"),s=t.instance.popper.style,i=s.top,a=s.left,l=s[r];s.top="",s.left="",s[r]="";var c=V6(t.instance.popper,t.instance.reference,e.padding,n,t.positionFixed);s.top=i,s.left=a,s[r]=l,e.boundaries=c;var d=e.priority,h=t.offsets.popper,m={primary:function(x){var y=h[x];return h[x]c[x]&&!e.escapeWithReference&&(w=Math.min(h[y],c[x]-(x==="right"?h.width:h.height))),uf({},y,w)}};return d.forEach(function(g){var x=["left","top"].indexOf(g)!==-1?"primary":"secondary";h=wa({},h,m[x](g))}),t.offsets.popper=h,t}function Nge(t){var e=t.placement,n=e.split("-")[0],r=e.split("-")[1];if(r){var s=t.offsets,i=s.reference,a=s.popper,l=["bottom","top"].indexOf(n)!==-1,c=l?"left":"top",d=l?"width":"height",h={start:uf({},c,i[c]),end:uf({},c,i[c]+i[d]-a[d])};t.offsets.popper=wa({},a,h[r])}return t}function Cge(t){if(!KH(t.instance.modifiers,"hide","preventOverflow"))return t;var e=t.offsets.reference,n=ng(t.instance.modifiers,function(r){return r.name==="preventOverflow"}).boundaries;if(e.bottomn.right||e.top>n.bottom||e.right2&&arguments[2]!==void 0?arguments[2]:{};tge(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=Zpe(this.update.bind(this)),this.options=wa({},t.Defaults,s),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=e&&e.jquery?e[0]:e,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(wa({},t.Defaults.modifiers,s.modifiers)).forEach(function(a){r.options.modifiers[a]=wa({},t.Defaults.modifiers[a]||{},s.modifiers?s.modifiers[a]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(a){return wa({name:a},r.options.modifiers[a])}).sort(function(a,l){return a.order-l.order}),this.modifiers.forEach(function(a){a.enabled&&LH(a.onLoad)&&a.onLoad(r.reference,r.popper,r.options,a,r.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return nge(t,[{key:"update",value:function(){return age.call(this)}},{key:"destroy",value:function(){return oge.call(this)}},{key:"enableEventListeners",value:function(){return cge.call(this)}},{key:"disableEventListeners",value:function(){return dge.call(this)}}]),t})();lp.Utils=(typeof window<"u"?window:global).PopperUtils;lp.placements=ZH;lp.Defaults=_ge;var Age=["innerHTML","ownerDocument","style","attributes","nodeValue"],Mge=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Rge=["bigint","boolean","null","number","string","symbol","undefined"];function Eb(t){var e=Object.prototype.toString.call(t).slice(8,-1);if(/HTML\w+Element/.test(e))return"HTMLElement";if(Dge(e))return e}function so(t){return function(e){return Eb(e)===t}}function Dge(t){return Mge.includes(t)}function Pf(t){return function(e){return typeof e===t}}function Pge(t){return Rge.includes(t)}function _e(t){if(t===null)return"null";switch(typeof t){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(_e.array(t))return"Array";if(_e.plainFunction(t))return"Function";var e=Eb(t);return e||"Object"}_e.array=Array.isArray;_e.arrayOf=function(t,e){return!_e.array(t)&&!_e.function(e)?!1:t.every(function(n){return e(n)})};_e.asyncGeneratorFunction=function(t){return Eb(t)==="AsyncGeneratorFunction"};_e.asyncFunction=so("AsyncFunction");_e.bigint=Pf("bigint");_e.boolean=function(t){return t===!0||t===!1};_e.date=so("Date");_e.defined=function(t){return!_e.undefined(t)};_e.domElement=function(t){return _e.object(t)&&!_e.plainObject(t)&&t.nodeType===1&&_e.string(t.nodeName)&&Age.every(function(e){return e in t})};_e.empty=function(t){return _e.string(t)&&t.length===0||_e.array(t)&&t.length===0||_e.object(t)&&!_e.map(t)&&!_e.set(t)&&Object.keys(t).length===0||_e.set(t)&&t.size===0||_e.map(t)&&t.size===0};_e.error=so("Error");_e.function=Pf("function");_e.generator=function(t){return _e.iterable(t)&&_e.function(t.next)&&_e.function(t.throw)};_e.generatorFunction=so("GeneratorFunction");_e.instanceOf=function(t,e){return!t||!e?!1:Object.getPrototypeOf(t)===e.prototype};_e.iterable=function(t){return!_e.nullOrUndefined(t)&&_e.function(t[Symbol.iterator])};_e.map=so("Map");_e.nan=function(t){return Number.isNaN(t)};_e.null=function(t){return t===null};_e.nullOrUndefined=function(t){return _e.null(t)||_e.undefined(t)};_e.number=function(t){return Pf("number")(t)&&!_e.nan(t)};_e.numericString=function(t){return _e.string(t)&&t.length>0&&!Number.isNaN(Number(t))};_e.object=function(t){return!_e.nullOrUndefined(t)&&(_e.function(t)||typeof t=="object")};_e.oneOf=function(t,e){return _e.array(t)?t.indexOf(e)>-1:!1};_e.plainFunction=so("Function");_e.plainObject=function(t){if(Eb(t)!=="Object")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.getPrototypeOf({})};_e.primitive=function(t){return _e.null(t)||Pge(typeof t)};_e.promise=so("Promise");_e.propertyOf=function(t,e,n){if(!_e.object(t)||!e)return!1;var r=t[e];return _e.function(n)?n(r):_e.defined(r)};_e.regexp=so("RegExp");_e.set=so("Set");_e.string=Pf("string");_e.symbol=Pf("symbol");_e.undefined=Pf("undefined");_e.weakMap=so("WeakMap");_e.weakSet=so("WeakSet");function JH(t){return function(e){return typeof e===t}}var zge=JH("function"),Ige=function(t){return t===null},LA=function(t){return Object.prototype.toString.call(t).slice(8,-1)==="RegExp"},BA=function(t){return!Lge(t)&&!Ige(t)&&(zge(t)||typeof t=="object")},Lge=JH("undefined"),bO=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function Bge(t,e){var n=t.length;if(n!==e.length)return!1;for(var r=n;r--!==0;)if(!bi(t[r],e[r]))return!1;return!0}function Fge(t,e){if(t.byteLength!==e.byteLength)return!1;for(var n=new DataView(t.buffer),r=new DataView(e.buffer),s=t.byteLength;s--;)if(n.getUint8(s)!==r.getUint8(s))return!1;return!0}function qge(t,e){var n,r,s,i;if(t.size!==e.size)return!1;try{for(var a=bO(t.entries()),l=a.next();!l.done;l=a.next()){var c=l.value;if(!e.has(c[0]))return!1}}catch(m){n={error:m}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}try{for(var d=bO(t.entries()),h=d.next();!h.done;h=d.next()){var c=h.value;if(!bi(c[1],e.get(c[0])))return!1}}catch(m){s={error:m}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(s)throw s.error}}return!0}function $ge(t,e){var n,r;if(t.size!==e.size)return!1;try{for(var s=bO(t.entries()),i=s.next();!i.done;i=s.next()){var a=i.value;if(!e.has(a[0]))return!1}}catch(l){n={error:l}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return!0}function bi(t,e){if(t===e)return!0;if(t&&BA(t)&&e&&BA(e)){if(t.constructor!==e.constructor)return!1;if(Array.isArray(t)&&Array.isArray(e))return Bge(t,e);if(t instanceof Map&&e instanceof Map)return qge(t,e);if(t instanceof Set&&e instanceof Set)return $ge(t,e);if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return Fge(t,e);if(LA(t)&&LA(e))return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var s=n.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,n[s]))return!1;for(var s=n.length;s--!==0;){var i=n[s];if(!(i==="_owner"&&t.$$typeof)&&!bi(t[i],e[i]))return!1}return!0}return Number.isNaN(t)&&Number.isNaN(e)?!0:t===e}function Hge(){for(var t=[],e=0;ec);return _e.undefined(r)||(d=d&&c===r),_e.undefined(i)||(d=d&&l===i),d}function qA(t,e,n){var r=n.key,s=n.type,i=n.value,a=Eo(t,r),l=Eo(e,r),c=s==="added"?a:l,d=s==="added"?l:a;if(!_e.nullOrUndefined(i)){if(_e.defined(c)){if(_e.array(c)||_e.plainObject(c))return Qge(c,d,i)}else return bi(d,i);return!1}return[a,l].every(_e.array)?!d.every(G6(c)):[a,l].every(_e.plainObject)?Vge(Object.keys(c),Object.keys(d)):![a,l].every(function(h){return _e.primitive(h)&&_e.defined(h)})&&(s==="added"?!_e.defined(a)&&_e.defined(l):_e.defined(a)&&!_e.defined(l))}function $A(t,e,n){var r=n===void 0?{}:n,s=r.key,i=Eo(t,s),a=Eo(e,s);if(!eQ(i,a))throw new TypeError("Inputs have different types");if(!Hge(i,a))throw new TypeError("Inputs don't have length");return[i,a].every(_e.plainObject)&&(i=Object.keys(i),a=Object.keys(a)),[i,a]}function HA(t){return function(e){var n=e[0],r=e[1];return _e.array(t)?bi(t,r)||t.some(function(s){return bi(s,r)||_e.array(r)&&G6(r)(s)}):_e.plainObject(t)&&t[n]?!!t[n]&&bi(t[n],r):bi(t,r)}}function Vge(t,e){return e.some(function(n){return!t.includes(n)})}function QA(t){return function(e){return _e.array(t)?t.some(function(n){return bi(n,e)||_e.array(e)&&G6(e)(n)}):bi(t,e)}}function Um(t,e){return _e.array(t)?t.some(function(n){return bi(n,e)}):bi(t,e)}function G6(t){return function(e){return t.some(function(n){return bi(n,e)})}}function eQ(){for(var t=[],e=0;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Xge(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i=0)&&(n[s]=t[s]);return n}function tQ(t,e){if(t==null)return{};var n=Xge(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Nl(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Yge(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nl(t)}function ag(t){var e=Gge();return function(){var r=fy(t),s;if(e){var i=fy(this).constructor;s=Reflect.construct(r,arguments,i)}else s=r.apply(this,arguments);return Yge(this,s)}}function Kge(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nQ(t){var e=Kge(t,"string");return typeof e=="symbol"?e:String(e)}var Zge={flip:{padding:20},preventOverflow:{padding:10}},Jge="The typeValidator argument must be a function with the signature function(props, propName, componentName).",exe="The error message is optional, but must be a string if provided.";function txe(t,e,n,r){return typeof t=="boolean"?t:typeof t=="function"?t(e,n,r):t?!!t:!1}function nxe(t,e){return Object.hasOwnProperty.call(t,e)}function rxe(t,e,n,r){return new Error("Required ".concat(t[e]," `").concat(e,"` was not specified in `").concat(n,"`."))}function sxe(t,e){if(typeof t!="function")throw new TypeError(Jge);if(e&&typeof e!="string")throw new TypeError(exe)}function UA(t,e,n){return sxe(t,n),function(r,s,i){for(var a=arguments.length,l=new Array(a>3?a-3:0),c=3;c3&&arguments[3]!==void 0?arguments[3]:!1;t.addEventListener(e,n,r)}function axe(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;t.removeEventListener(e,n,r)}function oxe(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s;s=function(a){n(a),axe(t,e,s)},ixe(t,e,s,r)}function WA(){}var rQ=(function(t){ig(n,t);var e=ag(n);function n(){return rg(this,n),e.apply(this,arguments)}return sg(n,[{key:"componentDidMount",value:function(){vo()&&(this.node||this.appendNode(),Wm||this.renderPortal())}},{key:"componentDidUpdate",value:function(){vo()&&(Wm||this.renderPortal())}},{key:"componentWillUnmount",value:function(){!vo()||!this.node||(Wm||J1.unmountComponentAtNode(this.node),this.node&&this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=void 0))}},{key:"appendNode",value:function(){var s=this.props,i=s.id,a=s.zIndex;this.node||(this.node=document.createElement("div"),i&&(this.node.id=i),a&&(this.node.style.zIndex=a),document.body.appendChild(this.node))}},{key:"renderPortal",value:function(){if(!vo())return null;var s=this.props,i=s.children,a=s.setRef;if(this.node||this.appendNode(),Wm)return J1.createPortal(i,this.node);var l=J1.unstable_renderSubtreeIntoContainer(this,i.length>1?ae.createElement("div",null,i):i[0],this.node);return a(l),null}},{key:"renderReact16",value:function(){var s=this.props,i=s.hasChildren,a=s.placement,l=s.target;return i?this.renderPortal():l||a==="center"?this.renderPortal():null}},{key:"render",value:function(){return Wm?this.renderReact16():null}}]),n})(ae.Component);qs(rQ,"propTypes",{children:Ge.oneOfType([Ge.element,Ge.array]),hasChildren:Ge.bool,id:Ge.oneOfType([Ge.string,Ge.number]),placement:Ge.string,setRef:Ge.func.isRequired,target:Ge.oneOfType([Ge.object,Ge.string]),zIndex:Ge.number});var sQ=(function(t){ig(n,t);var e=ag(n);function n(){return rg(this,n),e.apply(this,arguments)}return sg(n,[{key:"parentStyle",get:function(){var s=this.props,i=s.placement,a=s.styles,l=a.arrow.length,c={pointerEvents:"none",position:"absolute",width:"100%"};return i.startsWith("top")?(c.bottom=0,c.left=0,c.right=0,c.height=l):i.startsWith("bottom")?(c.left=0,c.right=0,c.top=0,c.height=l):i.startsWith("left")?(c.right=0,c.top=0,c.bottom=0):i.startsWith("right")&&(c.left=0,c.top=0),c}},{key:"render",value:function(){var s=this.props,i=s.placement,a=s.setArrowRef,l=s.styles,c=l.arrow,d=c.color,h=c.display,m=c.length,g=c.margin,x=c.position,y=c.spread,w={display:h,position:x},S,k=y,j=m;return i.startsWith("top")?(S="0,0 ".concat(k/2,",").concat(j," ").concat(k,",0"),w.bottom=0,w.marginLeft=g,w.marginRight=g):i.startsWith("bottom")?(S="".concat(k,",").concat(j," ").concat(k/2,",0 0,").concat(j),w.top=0,w.marginLeft=g,w.marginRight=g):i.startsWith("left")?(j=y,k=m,S="0,0 ".concat(k,",").concat(j/2," 0,").concat(j),w.right=0,w.marginTop=g,w.marginBottom=g):i.startsWith("right")&&(j=y,k=m,S="".concat(k,",").concat(j," ").concat(k,",0 0,").concat(j/2),w.left=0,w.marginTop=g,w.marginBottom=g),ae.createElement("div",{className:"__floater__arrow",style:this.parentStyle},ae.createElement("span",{ref:a,style:w},ae.createElement("svg",{width:k,height:j,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},ae.createElement("polygon",{points:S,fill:d}))))}}]),n})(ae.Component);qs(sQ,"propTypes",{placement:Ge.string.isRequired,setArrowRef:Ge.func.isRequired,styles:Ge.object.isRequired});var lxe=["color","height","width"];function iQ(t){var e=t.handleClick,n=t.styles,r=n.color,s=n.height,i=n.width,a=tQ(n,lxe);return ae.createElement("button",{"aria-label":"close",onClick:e,style:a,type:"button"},ae.createElement("svg",{width:"".concat(i,"px"),height:"".concat(s,"px"),viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid"},ae.createElement("g",null,ae.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:r}))))}iQ.propTypes={handleClick:Ge.func.isRequired,styles:Ge.object.isRequired};function aQ(t){var e=t.content,n=t.footer,r=t.handleClick,s=t.open,i=t.positionWrapper,a=t.showCloseButton,l=t.title,c=t.styles,d={content:ae.isValidElement(e)?e:ae.createElement("div",{className:"__floater__content",style:c.content},e)};return l&&(d.title=ae.isValidElement(l)?l:ae.createElement("div",{className:"__floater__title",style:c.title},l)),n&&(d.footer=ae.isValidElement(n)?n:ae.createElement("div",{className:"__floater__footer",style:c.footer},n)),(a||i)&&!_e.boolean(s)&&(d.close=ae.createElement(iQ,{styles:c.close,handleClick:r})),ae.createElement("div",{className:"__floater__container",style:c.container},d.close,d.title,d.content,d.footer)}aQ.propTypes={content:Ge.node.isRequired,footer:Ge.node,handleClick:Ge.func.isRequired,open:Ge.bool,positionWrapper:Ge.bool.isRequired,showCloseButton:Ge.bool.isRequired,styles:Ge.object.isRequired,title:Ge.node};var oQ=(function(t){ig(n,t);var e=ag(n);function n(){return rg(this,n),e.apply(this,arguments)}return sg(n,[{key:"style",get:function(){var s=this.props,i=s.disableAnimation,a=s.component,l=s.placement,c=s.hideArrow,d=s.status,h=s.styles,m=h.arrow.length,g=h.floater,x=h.floaterCentered,y=h.floaterClosing,w=h.floaterOpening,S=h.floaterWithAnimation,k=h.floaterWithComponent,j={};return c||(l.startsWith("top")?j.padding="0 0 ".concat(m,"px"):l.startsWith("bottom")?j.padding="".concat(m,"px 0 0"):l.startsWith("left")?j.padding="0 ".concat(m,"px 0 0"):l.startsWith("right")&&(j.padding="0 0 0 ".concat(m,"px"))),[On.OPENING,On.OPEN].indexOf(d)!==-1&&(j=br(br({},j),w)),d===On.CLOSING&&(j=br(br({},j),y)),d===On.OPEN&&!i&&(j=br(br({},j),S)),l==="center"&&(j=br(br({},j),x)),a&&(j=br(br({},j),k)),br(br({},g),j)}},{key:"render",value:function(){var s=this.props,i=s.component,a=s.handleClick,l=s.hideArrow,c=s.setFloaterRef,d=s.status,h={},m=["__floater"];return i?ae.isValidElement(i)?h.content=ae.cloneElement(i,{closeFn:a}):h.content=i({closeFn:a}):h.content=ae.createElement(aQ,this.props),d===On.OPEN&&m.push("__floater__open"),l||(h.arrow=ae.createElement(sQ,this.props)),ae.createElement("div",{ref:c,className:m.join(" "),style:this.style},ae.createElement("div",{className:"__floater__body"},h.content,h.arrow))}}]),n})(ae.Component);qs(oQ,"propTypes",{component:Ge.oneOfType([Ge.func,Ge.element]),content:Ge.node,disableAnimation:Ge.bool.isRequired,footer:Ge.node,handleClick:Ge.func.isRequired,hideArrow:Ge.bool.isRequired,open:Ge.bool,placement:Ge.string.isRequired,positionWrapper:Ge.bool.isRequired,setArrowRef:Ge.func.isRequired,setFloaterRef:Ge.func.isRequired,showCloseButton:Ge.bool,status:Ge.string.isRequired,styles:Ge.object.isRequired,title:Ge.node});var lQ=(function(t){ig(n,t);var e=ag(n);function n(){return rg(this,n),e.apply(this,arguments)}return sg(n,[{key:"render",value:function(){var s=this.props,i=s.children,a=s.handleClick,l=s.handleMouseEnter,c=s.handleMouseLeave,d=s.setChildRef,h=s.setWrapperRef,m=s.style,g=s.styles,x;if(i)if(ae.Children.count(i)===1)if(!ae.isValidElement(i))x=ae.createElement("span",null,i);else{var y=_e.function(i.type)?"innerRef":"ref";x=ae.cloneElement(ae.Children.only(i),qs({},y,d))}else x=i;return x?ae.createElement("span",{ref:h,style:br(br({},g),m),onClick:a,onMouseEnter:l,onMouseLeave:c},x):null}}]),n})(ae.Component);qs(lQ,"propTypes",{children:Ge.node,handleClick:Ge.func.isRequired,handleMouseEnter:Ge.func.isRequired,handleMouseLeave:Ge.func.isRequired,setChildRef:Ge.func.isRequired,setWrapperRef:Ge.func.isRequired,style:Ge.object,styles:Ge.object.isRequired});var cxe={zIndex:100};function uxe(t){var e=Va(cxe,t.options||{});return{wrapper:{cursor:"help",display:"inline-flex",flexDirection:"column",zIndex:e.zIndex},wrapperPosition:{left:-1e3,position:"absolute",top:-1e3,visibility:"hidden"},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:300,opacity:0,position:"relative",transition:"opacity 0.3s",visibility:"hidden",zIndex:e.zIndex},floaterOpening:{opacity:1,visibility:"visible"},floaterWithAnimation:{opacity:1,transition:"opacity 0.3s, transform 0.2s",visibility:"visible"},floaterWithComponent:{maxWidth:"100%"},floaterClosing:{opacity:0,visibility:"visible"},floaterCentered:{left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)"},container:{backgroundColor:"#fff",color:"#666",minHeight:60,minWidth:200,padding:20,position:"relative",zIndex:10},title:{borderBottom:"1px solid #555",color:"#555",fontSize:18,marginBottom:5,paddingBottom:6,paddingRight:18},content:{fontSize:15},close:{backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",fontSize:0,height:15,outline:"none",padding:10,position:"absolute",right:0,top:0,width:15,WebkitAppearance:"none"},footer:{borderTop:"1px solid #ccc",fontSize:13,marginTop:10,paddingTop:5},arrow:{color:"#fff",display:"inline-flex",length:16,margin:8,position:"absolute",spread:32},options:e}}var dxe=["arrow","flip","offset"],hxe=["position","top","right","bottom","left"],X6=(function(t){ig(n,t);var e=ag(n);function n(r){var s;return rg(this,n),s=e.call(this,r),qs(Nl(s),"setArrowRef",function(i){s.arrowRef=i}),qs(Nl(s),"setChildRef",function(i){s.childRef=i}),qs(Nl(s),"setFloaterRef",function(i){s.floaterRef=i}),qs(Nl(s),"setWrapperRef",function(i){s.wrapperRef=i}),qs(Nl(s),"handleTransitionEnd",function(){var i=s.state.status,a=s.props.callback;s.wrapperPopper&&s.wrapperPopper.instance.update(),s.setState({status:i===On.OPENING?On.OPEN:On.IDLE},function(){var l=s.state.status;a(l===On.OPEN?"open":"close",s.props)})}),qs(Nl(s),"handleClick",function(){var i=s.props,a=i.event,l=i.open;if(!_e.boolean(l)){var c=s.state,d=c.positionWrapper,h=c.status;(s.event==="click"||s.event==="hover"&&d)&&(O1({title:"click",data:[{event:a,status:h===On.OPEN?"closing":"opening"}],debug:s.debug}),s.toggle())}}),qs(Nl(s),"handleMouseEnter",function(){var i=s.props,a=i.event,l=i.open;if(!(_e.boolean(l)||SS())){var c=s.state.status;s.event==="hover"&&c===On.IDLE&&(O1({title:"mouseEnter",data:[{key:"originalEvent",value:a}],debug:s.debug}),clearTimeout(s.eventDelayTimeout),s.toggle())}}),qs(Nl(s),"handleMouseLeave",function(){var i=s.props,a=i.event,l=i.eventDelay,c=i.open;if(!(_e.boolean(c)||SS())){var d=s.state,h=d.status,m=d.positionWrapper;s.event==="hover"&&(O1({title:"mouseLeave",data:[{key:"originalEvent",value:a}],debug:s.debug}),l?[On.OPENING,On.OPEN].indexOf(h)!==-1&&!m&&!s.eventDelayTimeout&&(s.eventDelayTimeout=setTimeout(function(){delete s.eventDelayTimeout,s.toggle()},l*1e3)):s.toggle(On.IDLE))}}),s.state={currentPlacement:r.placement,needsUpdate:!1,positionWrapper:r.wrapperOptions.position&&!!r.target,status:On.INIT,statusWrapper:On.INIT},s._isMounted=!1,s.hasMounted=!1,vo()&&window.addEventListener("load",function(){s.popper&&s.popper.instance.update(),s.wrapperPopper&&s.wrapperPopper.instance.update()}),s}return sg(n,[{key:"componentDidMount",value:function(){if(vo()){var s=this.state.positionWrapper,i=this.props,a=i.children,l=i.open,c=i.target;this._isMounted=!0,O1({title:"init",data:{hasChildren:!!a,hasTarget:!!c,isControlled:_e.boolean(l),positionWrapper:s,target:this.target,floater:this.floaterRef},debug:this.debug}),this.hasMounted||(this.initPopper(),this.hasMounted=!0),!a&&c&&_e.boolean(l)}}},{key:"componentDidUpdate",value:function(s,i){if(vo()){var a=this.props,l=a.autoOpen,c=a.open,d=a.target,h=a.wrapperOptions,m=Uge(i,this.state),g=m.changedFrom,x=m.changed;if(s.open!==c){var y;_e.boolean(c)&&(y=c?On.OPENING:On.CLOSING),this.toggle(y)}(s.wrapperOptions.position!==h.position||s.target!==d)&&this.changeWrapperPosition(this.props),x("status",On.IDLE)&&c?this.toggle(On.OPEN):g("status",On.INIT,On.IDLE)&&l&&this.toggle(On.OPEN),this.popper&&x("status",On.OPENING)&&this.popper.instance.update(),this.floaterRef&&(x("status",On.OPENING)||x("status",On.CLOSING))&&oxe(this.floaterRef,"transitionend",this.handleTransitionEnd),x("needsUpdate",!0)&&this.rebuildPopper()}}},{key:"componentWillUnmount",value:function(){vo()&&(this._isMounted=!1,this.popper&&this.popper.instance.destroy(),this.wrapperPopper&&this.wrapperPopper.instance.destroy())}},{key:"initPopper",value:function(){var s=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.target,a=this.state.positionWrapper,l=this.props,c=l.disableFlip,d=l.getPopper,h=l.hideArrow,m=l.offset,g=l.placement,x=l.wrapperOptions,y=g==="top"||g==="bottom"?"flip":["right","bottom-end","top-end","left","top-start","bottom-start"];if(g==="center")this.setState({status:On.IDLE});else if(i&&this.floaterRef){var w=this.options,S=w.arrow,k=w.flip,j=w.offset,N=tQ(w,dxe);new lp(i,this.floaterRef,{placement:g,modifiers:br({arrow:br({enabled:!h,element:this.arrowRef},S),flip:br({enabled:!c,behavior:y},k),offset:br({offset:"0, ".concat(m,"px")},j)},N),onCreate:function(_){var A;if(s.popper=_,!((A=s.floaterRef)!==null&&A!==void 0&&A.isConnected)){s.setState({needsUpdate:!0});return}d(_,"floater"),s._isMounted&&s.setState({currentPlacement:_.placement,status:On.IDLE}),g!==_.placement&&setTimeout(function(){_.instance.update()},1)},onUpdate:function(_){s.popper=_;var A=s.state.currentPlacement;s._isMounted&&_.placement!==A&&s.setState({currentPlacement:_.placement})}})}if(a){var T=_e.undefined(x.offset)?0:x.offset;new lp(this.target,this.wrapperRef,{placement:x.placement||g,modifiers:{arrow:{enabled:!1},offset:{offset:"0, ".concat(T,"px")},flip:{enabled:!1}},onCreate:function(_){s.wrapperPopper=_,s._isMounted&&s.setState({statusWrapper:On.IDLE}),d(_,"wrapper"),g!==_.placement&&setTimeout(function(){_.instance.update()},1)}})}}},{key:"rebuildPopper",value:function(){var s=this;this.floaterRefInterval=setInterval(function(){var i;(i=s.floaterRef)!==null&&i!==void 0&&i.isConnected&&(clearInterval(s.floaterRefInterval),s.setState({needsUpdate:!1}),s.initPopper())},50)}},{key:"changeWrapperPosition",value:function(s){var i=s.target,a=s.wrapperOptions;this.setState({positionWrapper:a.position&&!!i})}},{key:"toggle",value:function(s){var i=this.state.status,a=i===On.OPEN?On.CLOSING:On.OPENING;_e.undefined(s)||(a=s),this.setState({status:a})}},{key:"debug",get:function(){var s=this.props.debug;return s||vo()&&"ReactFloaterDebug"in window&&!!window.ReactFloaterDebug}},{key:"event",get:function(){var s=this.props,i=s.disableHoverToClick,a=s.event;return a==="hover"&&SS()&&!i?"click":a}},{key:"options",get:function(){var s=this.props.options;return Va(Zge,s||{})}},{key:"styles",get:function(){var s=this,i=this.state,a=i.status,l=i.positionWrapper,c=i.statusWrapper,d=this.props.styles,h=Va(uxe(d),d);if(l){var m;[On.IDLE].indexOf(a)===-1||[On.IDLE].indexOf(c)===-1?m=h.wrapperPosition:m=this.wrapperPopper.styles,h.wrapper=br(br({},h.wrapper),m)}if(this.target){var g=window.getComputedStyle(this.target);this.wrapperStyles?h.wrapper=br(br({},h.wrapper),this.wrapperStyles):["relative","static"].indexOf(g.position)===-1&&(this.wrapperStyles={},l||(hxe.forEach(function(x){s.wrapperStyles[x]=g[x]}),h.wrapper=br(br({},h.wrapper),this.wrapperStyles),this.target.style.position="relative",this.target.style.top="auto",this.target.style.right="auto",this.target.style.bottom="auto",this.target.style.left="auto"))}return h}},{key:"target",get:function(){if(!vo())return null;var s=this.props.target;return s?_e.domElement(s)?s:document.querySelector(s):this.childRef||this.wrapperRef}},{key:"render",value:function(){var s=this.state,i=s.currentPlacement,a=s.positionWrapper,l=s.status,c=this.props,d=c.children,h=c.component,m=c.content,g=c.disableAnimation,x=c.footer,y=c.hideArrow,w=c.id,S=c.open,k=c.showCloseButton,j=c.style,N=c.target,T=c.title,E=ae.createElement(lQ,{handleClick:this.handleClick,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,setChildRef:this.setChildRef,setWrapperRef:this.setWrapperRef,style:j,styles:this.styles.wrapper},d),_={};return a?_.wrapperInPortal=E:_.wrapperAsChildren=E,ae.createElement("span",null,ae.createElement(rQ,{hasChildren:!!d,id:w,placement:i,setRef:this.setFloaterRef,target:N,zIndex:this.styles.options.zIndex},ae.createElement(oQ,{component:h,content:m,disableAnimation:g,footer:x,handleClick:this.handleClick,hideArrow:y||i==="center",open:S,placement:i,positionWrapper:a,setArrowRef:this.setArrowRef,setFloaterRef:this.setFloaterRef,showCloseButton:k,status:l,styles:this.styles,title:T}),_.wrapperInPortal),_.wrapperAsChildren)}}]),n})(ae.Component);qs(X6,"propTypes",{autoOpen:Ge.bool,callback:Ge.func,children:Ge.node,component:UA(Ge.oneOfType([Ge.func,Ge.element]),function(t){return!t.content}),content:UA(Ge.node,function(t){return!t.component}),debug:Ge.bool,disableAnimation:Ge.bool,disableFlip:Ge.bool,disableHoverToClick:Ge.bool,event:Ge.oneOf(["hover","click"]),eventDelay:Ge.number,footer:Ge.node,getPopper:Ge.func,hideArrow:Ge.bool,id:Ge.oneOfType([Ge.string,Ge.number]),offset:Ge.number,open:Ge.bool,options:Ge.object,placement:Ge.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto","center"]),showCloseButton:Ge.bool,style:Ge.object,styles:Ge.object,target:Ge.oneOfType([Ge.object,Ge.string]),title:Ge.node,wrapperOptions:Ge.shape({offset:Ge.number,placement:Ge.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto"]),position:Ge.bool})});qs(X6,"defaultProps",{autoOpen:!1,callback:WA,debug:!1,disableAnimation:!1,disableFlip:!1,disableHoverToClick:!1,event:"click",eventDelay:.4,getPopper:WA,hideArrow:!1,offset:15,placement:"bottom",showCloseButton:!1,styles:{},target:null,wrapperOptions:{position:!1}});var fxe=Object.defineProperty,mxe=(t,e,n)=>e in t?fxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gt=(t,e,n)=>mxe(t,typeof e!="symbol"?e+"":e,n),Qn={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update"},Qa={TOUR_START:"tour:start",STEP_BEFORE:"step:before",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found"},Qt={INIT:"init",READY:"ready",BEACON:"beacon",TOOLTIP:"tooltip",COMPLETE:"complete",ERROR:"error"},mn={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"};function Ic(){var t;return!!(typeof window<"u"&&((t=window.document)!=null&&t.createElement))}function cQ(t){return t?t.getBoundingClientRect():null}function pxe(t=!1){const{body:e,documentElement:n}=document;if(!e||!n)return 0;if(t){const r=[e.scrollHeight,e.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,a)=>i-a),s=Math.floor(r.length/2);return r.length%2===0?(r[s-1]+r[s])/2:r[s]}return Math.max(e.scrollHeight,e.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function Ml(t){if(typeof t=="string")try{return document.querySelector(t)}catch{return null}return t}function gxe(t){return!t||t.nodeType!==1?null:getComputedStyle(t)}function cp(t,e,n){if(!t)return Uu();const r=IH(t);if(r){if(r.isSameNode(Uu()))return n?document:Uu();if(!(r.scrollHeight>r.offsetHeight)&&!e)return r.style.overflow="initial",Uu()}return r}function _b(t,e){if(!t)return!1;const n=cp(t,e);return n?!n.isSameNode(Uu()):!1}function xxe(t){return t.offsetParent!==document.body}function df(t,e="fixed"){if(!t||!(t instanceof HTMLElement))return!1;const{nodeName:n}=t,r=gxe(t);return n==="BODY"||n==="HTML"?!1:r&&r.position===e?!0:t.parentNode?df(t.parentNode,e):!1}function vxe(t){var e;if(!t)return!1;let n=t;for(;n&&n!==document.body;){if(n instanceof HTMLElement){const{display:r,visibility:s}=getComputedStyle(n);if(r==="none"||s==="hidden")return!1}n=(e=n.parentElement)!=null?e:null}return!0}function yxe(t,e,n){var r,s,i;const a=cQ(t),l=cp(t,n),c=_b(t,n),d=df(t);let h=0,m=(r=a?.top)!=null?r:0;if(c&&d){const g=(s=t?.offsetTop)!=null?s:0,x=(i=l?.scrollTop)!=null?i:0;m=g-x}else l instanceof HTMLElement&&(h=l.scrollTop,!c&&!df(t)&&(m+=h),l.isSameNode(Uu())||(m+=Uu().scrollTop));return Math.floor(m-e)}function bxe(t,e,n){var r;if(!t)return 0;const{offsetTop:s=0,scrollTop:i=0}=(r=IH(t))!=null?r:{};let a=t.getBoundingClientRect().top+i;s&&(_b(t,n)||xxe(t))&&(a-=s);const l=Math.floor(a-e);return l<0?0:l}function Uu(){var t;return(t=document.scrollingElement)!=null?t:document.documentElement}function wxe(t,e){const{duration:n,element:r}=e;return new Promise((s,i)=>{const{scrollTop:a}=r,l=t>a?t-a:a-t;Fpe.top(r,t,{duration:l<100?50:n},c=>c&&c.message!=="Element already at target scroll position"?i(c):s())})}var Gm=pa.createPortal!==void 0;function uQ(t=navigator.userAgent){let e=t;return typeof window>"u"?e="node":document.documentMode?e="ie":/Edge/.test(t)?e="edge":window.opera||t.includes(" OPR/")?e="opera":typeof window.InstallTrigger<"u"?e="firefox":window.chrome?e="chrome":/(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(t)&&(e="safari"),e}function bv(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function yo(t,e={}){const{defaultValue:n,step:r,steps:s}=e;let i=AA(t);if(i)(i.includes("{step}")||i.includes("{steps}"))&&r&&s&&(i=i.replace("{step}",r.toString()).replace("{steps}",s.toString()));else if(b.isValidElement(t)&&!Object.values(t.props).length&&bv(t.type)==="function"){const a=t.type({});i=yo(a,e)}else i=AA(n);return i}function Sxe(t,e){return!ft.plainObject(t)||!ft.array(e)?!1:Object.keys(t).every(n=>e.includes(n))}function kxe(t){const e=/^#?([\da-f])([\da-f])([\da-f])$/i,n=t.replace(e,(s,i,a,l)=>i+i+a+a+l+l),r=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(n);return r?[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]:[]}function GA(t){return t.disableBeacon||t.placement==="center"}function XA(){return!["chrome","safari","firefox","opera"].includes(uQ())}function hd({data:t,debug:e=!1,title:n,warn:r=!1}){const s=r?console.warn||console.error:console.log;e&&(n&&t?(console.groupCollapsed(`%creact-joyride: ${n}`,"color: #ff0044; font-weight: bold; font-size: 12px;"),Array.isArray(t)?t.forEach(i=>{ft.plainObject(i)&&i.key?s.apply(console,[i.key,i.value]):s.apply(console,[i])}):s.apply(console,[t]),console.groupEnd()):console.error("Missing title or data props"))}function Oxe(t){return Object.keys(t)}function dQ(t,...e){if(!ft.plainObject(t))throw new TypeError("Expected an object");const n={};for(const r in t)({}).hasOwnProperty.call(t,r)&&(e.includes(r)||(n[r]=t[r]));return n}function jxe(t,...e){if(!ft.plainObject(t))throw new TypeError("Expected an object");if(!e.length)return t;const n={};for(const r in t)({}).hasOwnProperty.call(t,r)&&e.includes(r)&&(n[r]=t[r]);return n}function SO(t,e,n){const r=i=>i.replace("{step}",String(e)).replace("{steps}",String(n));if(bv(t)==="string")return r(t);if(!b.isValidElement(t))return t;const{children:s}=t.props;if(bv(s)==="string"&&s.includes("{step}"))return b.cloneElement(t,{children:r(s)});if(Array.isArray(s))return b.cloneElement(t,{children:s.map(i=>typeof i=="string"?r(i):SO(i,e,n))});if(bv(t.type)==="function"&&!Object.values(t.props).length){const i=t.type({});return SO(i,e,n)}return t}function Nxe(t){const{isFirstStep:e,lifecycle:n,previousLifecycle:r,scrollToFirstStep:s,step:i,target:a}=t;return!i.disableScrolling&&(!e||s||n===Qt.TOOLTIP)&&i.placement!=="center"&&(!i.isFixed||!df(a))&&r!==n&&[Qt.BEACON,Qt.TOOLTIP].includes(n)}var Cxe={options:{preventOverflow:{boundariesElement:"scrollParent"}},wrapperOptions:{offset:-18,position:!0}},hQ={back:"Back",close:"Close",last:"Last",next:"Next",nextLabelWithProgress:"Next (Step {step} of {steps})",open:"Open the dialog",skip:"Skip"},Txe={event:"click",placement:"bottom",offset:10,disableBeacon:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrollParentFix:!1,disableScrolling:!1,hideBackButton:!1,hideCloseButton:!1,hideFooter:!1,isFixed:!1,locale:hQ,showProgress:!1,showSkipButton:!1,spotlightClicks:!1,spotlightPadding:10},Exe={continuous:!1,debug:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrolling:!1,disableScrollParentFix:!1,getHelpers:void 0,hideBackButton:!1,run:!0,scrollOffset:20,scrollDuration:300,scrollToFirstStep:!1,showSkipButton:!1,showProgress:!1,spotlightClicks:!1,spotlightPadding:10,steps:[]},_xe={arrowColor:"#fff",backgroundColor:"#fff",beaconSize:36,overlayColor:"rgba(0, 0, 0, 0.5)",primaryColor:"#f04",spotlightShadow:"0 0 15px rgba(0, 0, 0, 0.5)",textColor:"#333",width:380,zIndex:100},Xm={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",cursor:"pointer",fontSize:16,lineHeight:1,padding:8,WebkitAppearance:"none"},YA={borderRadius:4,position:"absolute"};function Axe(t,e){var n,r,s,i,a;const{floaterProps:l,styles:c}=t,d=Va((n=e.floaterProps)!=null?n:{},l??{}),h=Va(c??{},(r=e.styles)!=null?r:{}),m=Va(_xe,h.options||{}),g=e.placement==="center"||e.disableBeacon;let{width:x}=m;window.innerWidth>480&&(x=380),"width"in m&&(x=typeof m.width=="number"&&window.innerWidthfQ(n,e)):(hd({title:"validateSteps",data:"steps must be an array",warn:!0,debug:e}),!1)}var mQ={action:"init",controlled:!1,index:0,lifecycle:Qt.INIT,origin:null,size:0,status:mn.IDLE},ZA=Oxe(dQ(mQ,"controlled","size")),Rxe=class{constructor(t){gt(this,"beaconPopper"),gt(this,"tooltipPopper"),gt(this,"data",new Map),gt(this,"listener"),gt(this,"store",new Map),gt(this,"addListener",s=>{this.listener=s}),gt(this,"setSteps",s=>{const{size:i,status:a}=this.getState(),l={size:s.length,status:a};this.data.set("steps",s),a===mn.WAITING&&!i&&s.length&&(l.status=mn.RUNNING),this.setState(l)}),gt(this,"getPopper",s=>s==="beacon"?this.beaconPopper:this.tooltipPopper),gt(this,"setPopper",(s,i)=>{s==="beacon"?this.beaconPopper=i:this.tooltipPopper=i}),gt(this,"cleanupPoppers",()=>{this.beaconPopper=null,this.tooltipPopper=null}),gt(this,"close",(s=null)=>{const{index:i,status:a}=this.getState();a===mn.RUNNING&&this.setState({...this.getNextState({action:Qn.CLOSE,index:i+1,origin:s})})}),gt(this,"go",s=>{const{controlled:i,status:a}=this.getState();if(i||a!==mn.RUNNING)return;const l=this.getSteps()[s];this.setState({...this.getNextState({action:Qn.GO,index:s}),status:l?a:mn.FINISHED})}),gt(this,"info",()=>this.getState()),gt(this,"next",()=>{const{index:s,status:i}=this.getState();i===mn.RUNNING&&this.setState(this.getNextState({action:Qn.NEXT,index:s+1}))}),gt(this,"open",()=>{const{status:s}=this.getState();s===mn.RUNNING&&this.setState({...this.getNextState({action:Qn.UPDATE,lifecycle:Qt.TOOLTIP})})}),gt(this,"prev",()=>{const{index:s,status:i}=this.getState();i===mn.RUNNING&&this.setState({...this.getNextState({action:Qn.PREV,index:s-1})})}),gt(this,"reset",(s=!1)=>{const{controlled:i}=this.getState();i||this.setState({...this.getNextState({action:Qn.RESET,index:0}),status:s?mn.RUNNING:mn.READY})}),gt(this,"skip",()=>{const{status:s}=this.getState();s===mn.RUNNING&&this.setState({action:Qn.SKIP,lifecycle:Qt.INIT,status:mn.SKIPPED})}),gt(this,"start",s=>{const{index:i,size:a}=this.getState();this.setState({...this.getNextState({action:Qn.START,index:ft.number(s)?s:i},!0),status:a?mn.RUNNING:mn.WAITING})}),gt(this,"stop",(s=!1)=>{const{index:i,status:a}=this.getState();[mn.FINISHED,mn.SKIPPED].includes(a)||this.setState({...this.getNextState({action:Qn.STOP,index:i+(s?1:0)}),status:mn.PAUSED})}),gt(this,"update",s=>{var i,a;if(!Sxe(s,ZA))throw new Error(`State is not valid. Valid keys: ${ZA.join(", ")}`);this.setState({...this.getNextState({...this.getState(),...s,action:(i=s.action)!=null?i:Qn.UPDATE,origin:(a=s.origin)!=null?a:null},!0)})});const{continuous:e=!1,stepIndex:n,steps:r=[]}=t??{};this.setState({action:Qn.INIT,controlled:ft.number(n),continuous:e,index:ft.number(n)?n:0,lifecycle:Qt.INIT,origin:null,status:r.length?mn.READY:mn.IDLE},!0),this.beaconPopper=null,this.tooltipPopper=null,this.listener=null,this.setSteps(r)}getState(){return this.store.size?{action:this.store.get("action")||"",controlled:this.store.get("controlled")||!1,index:parseInt(this.store.get("index"),10),lifecycle:this.store.get("lifecycle")||"",origin:this.store.get("origin")||null,size:this.store.get("size")||0,status:this.store.get("status")||""}:{...mQ}}getNextState(t,e=!1){var n,r,s,i,a;const{action:l,controlled:c,index:d,size:h,status:m}=this.getState(),g=ft.number(t.index)?t.index:d,x=c&&!e?d:Math.min(Math.max(g,0),h);return{action:(n=t.action)!=null?n:l,controlled:c,index:x,lifecycle:(r=t.lifecycle)!=null?r:Qt.INIT,origin:(s=t.origin)!=null?s:null,size:(i=t.size)!=null?i:h,status:x===h?mn.FINISHED:(a=t.status)!=null?a:m}}getSteps(){const t=this.data.get("steps");return Array.isArray(t)?t:[]}hasUpdatedState(t){const e=JSON.stringify(t),n=JSON.stringify(this.getState());return e!==n}setState(t,e=!1){const n=this.getState(),{action:r,index:s,lifecycle:i,origin:a=null,size:l,status:c}={...n,...t};this.store.set("action",r),this.store.set("index",s),this.store.set("lifecycle",i),this.store.set("origin",a),this.store.set("size",l),this.store.set("status",c),e&&(this.store.set("controlled",t.controlled),this.store.set("continuous",t.continuous)),this.listener&&this.hasUpdatedState(n)&&this.listener(this.getState())}getHelpers(){return{close:this.close,go:this.go,info:this.info,next:this.next,open:this.open,prev:this.prev,reset:this.reset,skip:this.skip}}};function Dxe(t){return new Rxe(t)}function Pxe({styles:t}){return b.createElement("div",{key:"JoyrideSpotlight",className:"react-joyride__spotlight","data-test-id":"spotlight",style:t})}var zxe=Pxe,Ixe=class extends b.Component{constructor(){super(...arguments),gt(this,"isActive",!1),gt(this,"resizeTimeout"),gt(this,"scrollTimeout"),gt(this,"scrollParent"),gt(this,"state",{isScrolling:!1,mouseOverSpotlight:!1,showSpotlight:!0}),gt(this,"hideSpotlight",()=>{const{continuous:t,disableOverlay:e,lifecycle:n}=this.props,r=[Qt.INIT,Qt.BEACON,Qt.COMPLETE,Qt.ERROR];return e||(t?r.includes(n):n!==Qt.TOOLTIP)}),gt(this,"handleMouseMove",t=>{const{mouseOverSpotlight:e}=this.state,{height:n,left:r,position:s,top:i,width:a}=this.spotlightStyles,l=s==="fixed"?t.clientY:t.pageY,c=s==="fixed"?t.clientX:t.pageX,d=l>=i&&l<=i+n,m=c>=r&&c<=r+a&&d;m!==e&&this.updateState({mouseOverSpotlight:m})}),gt(this,"handleScroll",()=>{const{target:t}=this.props,e=Ml(t);if(this.scrollParent!==document){const{isScrolling:n}=this.state;n||this.updateState({isScrolling:!0,showSpotlight:!1}),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.updateState({isScrolling:!1,showSpotlight:!0})},50)}else df(e,"sticky")&&this.updateState({})}),gt(this,"handleResize",()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.isActive&&this.forceUpdate()},100)})}componentDidMount(){const{debug:t,disableScrolling:e,disableScrollParentFix:n=!1,target:r}=this.props,s=Ml(r);this.scrollParent=cp(s??document.body,n,!0),this.isActive=!0,window.addEventListener("resize",this.handleResize)}componentDidUpdate(t){var e;const{disableScrollParentFix:n,lifecycle:r,spotlightClicks:s,target:i}=this.props,{changed:a}=uy(t,this.props);if(a("target")||a("disableScrollParentFix")){const l=Ml(i);this.scrollParent=cp(l??document.body,n,!0)}a("lifecycle",Qt.TOOLTIP)&&((e=this.scrollParent)==null||e.addEventListener("scroll",this.handleScroll,{passive:!0}),setTimeout(()=>{const{isScrolling:l}=this.state;l||this.updateState({showSpotlight:!0})},100)),(a("spotlightClicks")||a("disableOverlay")||a("lifecycle"))&&(s&&r===Qt.TOOLTIP?window.addEventListener("mousemove",this.handleMouseMove,!1):r!==Qt.TOOLTIP&&window.removeEventListener("mousemove",this.handleMouseMove))}componentWillUnmount(){var t;this.isActive=!1,window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("resize",this.handleResize),clearTimeout(this.resizeTimeout),clearTimeout(this.scrollTimeout),(t=this.scrollParent)==null||t.removeEventListener("scroll",this.handleScroll)}get overlayStyles(){const{mouseOverSpotlight:t}=this.state,{disableOverlayClose:e,placement:n,styles:r}=this.props;let s=r.overlay;return XA()&&(s=n==="center"?r.overlayLegacyCenter:r.overlayLegacy),{cursor:e?"default":"pointer",height:pxe(),pointerEvents:t?"none":"auto",...s}}get spotlightStyles(){var t,e,n;const{showSpotlight:r}=this.state,{disableScrollParentFix:s=!1,spotlightClicks:i,spotlightPadding:a=0,styles:l,target:c}=this.props,d=Ml(c),h=cQ(d),m=df(d),g=yxe(d,a,s);return{...XA()?l.spotlightLegacy:l.spotlight,height:Math.round(((t=h?.height)!=null?t:0)+a*2),left:Math.round(((e=h?.left)!=null?e:0)-a),opacity:r?1:0,pointerEvents:i?"none":"auto",position:m?"fixed":"absolute",top:g,transition:"opacity 0.2s",width:Math.round(((n=h?.width)!=null?n:0)+a*2)}}updateState(t){this.isActive&&this.setState(e=>({...e,...t}))}render(){const{showSpotlight:t}=this.state,{onClickOverlay:e,placement:n}=this.props,{hideSpotlight:r,overlayStyles:s,spotlightStyles:i}=this;if(r())return null;let a=n!=="center"&&t&&b.createElement(zxe,{styles:i});if(uQ()==="safari"){const{mixBlendMode:l,zIndex:c,...d}=s;a=b.createElement("div",{style:{...d}},a),delete s.backgroundColor}return b.createElement("div",{className:"react-joyride__overlay","data-test-id":"overlay",onClick:e,role:"presentation",style:s},a)}},Lxe=class extends b.Component{constructor(){super(...arguments),gt(this,"node",null)}componentDidMount(){const{id:t}=this.props;Ic()&&(this.node=document.createElement("div"),this.node.id=t,document.body.appendChild(this.node),Gm||this.renderReact15())}componentDidUpdate(){Ic()&&(Gm||this.renderReact15())}componentWillUnmount(){!Ic()||!this.node||(Gm||pa.unmountComponentAtNode(this.node),this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=null))}renderReact15(){if(!Ic())return;const{children:t}=this.props;this.node&&pa.unstable_renderSubtreeIntoContainer(this,t,this.node)}renderReact16(){if(!Ic()||!Gm)return null;const{children:t}=this.props;return this.node?pa.createPortal(t,this.node):null}render(){return Gm?this.renderReact16():null}},Bxe=class{constructor(t,e){if(gt(this,"element"),gt(this,"options"),gt(this,"canBeTabbed",n=>{const{tabIndex:r}=n;return r===null||r<0?!1:this.canHaveFocus(n)}),gt(this,"canHaveFocus",n=>{const r=/input|select|textarea|button|object/,s=n.nodeName.toLowerCase();return(r.test(s)&&!n.getAttribute("disabled")||s==="a"&&!!n.getAttribute("href"))&&this.isVisible(n)}),gt(this,"findValidTabElements",()=>[].slice.call(this.element.querySelectorAll("*"),0).filter(this.canBeTabbed)),gt(this,"handleKeyDown",n=>{const{code:r="Tab"}=this.options;n.code===r&&this.interceptTab(n)}),gt(this,"interceptTab",n=>{n.preventDefault();const r=this.findValidTabElements(),{shiftKey:s}=n;if(!r.length)return;let i=document.activeElement?r.indexOf(document.activeElement):0;i===-1||!s&&i+1===r.length?i=0:s&&i===0?i=r.length-1:i+=s?-1:1,r[i].focus()}),gt(this,"isHidden",n=>{const r=n.offsetWidth<=0&&n.offsetHeight<=0,s=window.getComputedStyle(n);return r&&!n.innerHTML?!0:r&&s.getPropertyValue("overflow")!=="visible"||s.getPropertyValue("display")==="none"}),gt(this,"isVisible",n=>{let r=n;for(;r;)if(r instanceof HTMLElement){if(r===document.body)break;if(this.isHidden(r))return!1;r=r.parentNode}return!0}),gt(this,"removeScope",()=>{window.removeEventListener("keydown",this.handleKeyDown)}),gt(this,"checkFocus",n=>{document.activeElement!==n&&(n.focus(),window.requestAnimationFrame(()=>this.checkFocus(n)))}),gt(this,"setFocus",()=>{const{selector:n}=this.options;if(!n)return;const r=this.element.querySelector(n);r&&window.requestAnimationFrame(()=>this.checkFocus(r))}),!(t instanceof HTMLElement))throw new TypeError("Invalid parameter: element must be an HTMLElement");this.element=t,this.options=e,window.addEventListener("keydown",this.handleKeyDown,!1),this.setFocus()}},Fxe=class extends b.Component{constructor(t){if(super(t),gt(this,"beacon",null),gt(this,"setBeaconRef",s=>{this.beacon=s}),t.beaconComponent)return;const e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id="joyride-beacon-animation",t.nonce&&n.setAttribute("nonce",t.nonce),n.appendChild(document.createTextNode(` +reaction = "${T.reaction}"`;return o.jsxs(Bo,{children:[o.jsx(Fo,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",children:[o.jsx(Ji,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(Ka,{className:"w-[95vw] sm:w-[500px]",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx(pn,{className:"h-60 rounded-md bg-muted p-3",children:o.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:E})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),o.jsxs(ue,{onClick:c,size:"sm",variant:"outline",children:[o.jsx(Is,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),o.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((T,E)=>o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",E+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(m,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:_=>h(E,"regex",_),onReactionChange:_=>h(E,"reaction",_)}),o.jsx(j,{rule:T}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{size:"sm",variant:"ghost",children:o.jsx(Cn,{className:"h-4 w-4"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:["确定要删除正则规则 ",E+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>d(E),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),o.jsx(Pe,{value:T.regex&&T.regex[0]||"",onChange:_=>h(E,"regex",_.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"反应内容"}),o.jsx(Nr,{value:T.reaction,onChange:_=>h(E,"reaction",_.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},E)),t.regex_rules.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),o.jsxs("div",{className:"space-y-4 border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),o.jsxs(ue,{onClick:g,size:"sm",variant:"outline",children:[o.jsx(Is,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),o.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((T,E)=>o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",E+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(N,{rule:T}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{size:"sm",variant:"ghost",children:o.jsx(Cn,{className:"h-4 w-4"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:["确定要删除关键词规则 ",E+1," 吗?此操作无法撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>x(E),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{className:"text-xs font-medium",children:"关键词列表"}),o.jsxs(ue,{onClick:()=>w(E),size:"sm",variant:"ghost",children:[o.jsx(Is,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),o.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((_,A)=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{value:_,onChange:D=>k(E,A,D.target.value),placeholder:"关键词",className:"flex-1"}),o.jsx(ue,{onClick:()=>S(E,A),size:"sm",variant:"ghost",children:o.jsx(Cn,{className:"h-4 w-4"})})]},A)),(!T.keywords||T.keywords.length===0)&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-xs font-medium",children:"反应内容"}),o.jsx(Nr,{value:T.reaction,onChange:_=>y(E,"reaction",_.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},E)),t.keyword_rules.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:T=>i({...e,enable_response_post_process:T})}),o.jsx(he,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t pt-6 space-y-4",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[o.jsx(Ft,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:T=>a({...n,enable:T})}),o.jsx(he,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&o.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),o.jsx(Pe,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:T=>a({...n,error_rate:parseFloat(T.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),o.jsx(Pe,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:T=>a({...n,min_freq:parseInt(T.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),o.jsx(Pe,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:T=>a({...n,tone_error_rate:parseFloat(T.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),o.jsx(Pe,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:T=>a({...n,word_replace_rate:parseFloat(T.target.value)})})]})]})]})}),o.jsx("div",{className:"border-t pt-6 space-y-4",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[o.jsx(Ft,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:T=>l({...r,enable:T})}),o.jsx(he,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&o.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),o.jsx(Pe,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:T=>l({...r,max_length:parseInt(T.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),o.jsx(Pe,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:T=>l({...r,max_sentence_num:parseInt(T.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:T=>l({...r,enable_kaomoji_protection:T})}),o.jsx(he,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:T=>l({...r,enable_overflow_return_all:T})}),o.jsx(he,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),o.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function Q0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),o.jsx(he,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"情绪更新阈值"}),o.jsx(Pe,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"情感特征"}),o.jsx(Nr,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function V0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),o.jsx(he,{className:"cursor-pointer",children:"启用语音识别"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function U0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),o.jsx(he,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"LPMM 模式"}),o.jsxs(Vt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[o.jsx($t,{children:o.jsx(Ut,{placeholder:"选择 LPMM 模式"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"classic",children:"经典模式"}),o.jsx(De,{value:"agent",children:"Agent 模式"})]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"同义词搜索 TopK"}),o.jsx(Pe,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"同义词阈值"}),o.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"实体提取线程数"}),o.jsx(Pe,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"嵌入向量维度"}),o.jsx(Pe,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function W0e({config:t,onChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState("WARNING"),a=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},l=x=>{e({...t,suppress_libraries:t.suppress_libraries.filter(y=>y!==x)})},c=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},d=x=>{const y={...t.library_log_levels};delete y[x],e({...t,library_log_levels:y})},h=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],m=["FULL","compact","lite"],g=["none","title","full"];return o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"日期格式"}),o.jsx(Pe,{value:t.date_style,onChange:x=>e({...t,date_style:x.target.value}),placeholder:"例如: m-d H:i:s"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"日志级别样式"}),o.jsxs(Vt,{value:t.log_level_style,onValueChange:x=>e({...t,log_level_style:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:m.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"日志文本颜色"}),o.jsxs(Vt,{value:t.color_text,onValueChange:x=>e({...t,color_text:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:g.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"全局日志级别"}),o.jsxs(Vt,{value:t.log_level,onValueChange:x=>e({...t,log_level:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"控制台日志级别"}),o.jsxs(Vt,{value:t.console_log_level,onValueChange:x=>e({...t,console_log_level:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"文件日志级别"}),o.jsxs(Vt,{value:t.file_log_level,onValueChange:x=>e({...t,file_log_level:x}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]})]})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"mb-2 block",children:"完全屏蔽的库"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),a())}}),o.jsx(ue,{onClick:a,size:"sm",className:"flex-shrink-0",children:o.jsx(Is,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(x=>o.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[o.jsx("span",{className:"text-sm",children:x}),o.jsx(ue,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>l(x),children:o.jsx(Cn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},x))})]}),o.jsxs("div",{children:[o.jsx(he,{className:"mb-2 block",children:"特定库的日志级别"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1"}),o.jsxs(Vt,{value:s,onValueChange:i,children:[o.jsx($t,{className:"w-32",children:o.jsx(Ut,{})}),o.jsx(Ht,{children:h.map(x=>o.jsx(De,{value:x,children:x},x))})]}),o.jsx(ue,{onClick:c,size:"sm",children:o.jsx(Is,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([x,y])=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[o.jsx("span",{className:"text-sm font-medium",children:x}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:y}),o.jsx(ue,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>d(x),children:o.jsx(Cn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},x))})]})]})}function G0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),o.jsx(Ft,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示回复器 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),o.jsx(Ft,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示回复器推理"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),o.jsx(Ft,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 Jargon Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),o.jsx(Ft,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示记忆检索 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),o.jsx(Ft,{checked:t.show_memory_prompt,onCheckedChange:n=>e({...t,show_memory_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 Planner Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),o.jsx(Ft,{checked:t.show_planner_prompt,onCheckedChange:n=>e({...t,show_planner_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"显示 LPMM 相关文段"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),o.jsx(Ft,{checked:t.show_lpmm_paragraph,onCheckedChange:n=>e({...t,show_lpmm_paragraph:n})})]})]})]})}function X0e({config:t,onChange:e}){const[n,r]=b.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=a=>{e({...t,auth_token:t.auth_token.filter((l,c)=>c!==a)})};return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"启用自定义服务器"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),o.jsx(Ft,{checked:t.use_custom,onCheckedChange:a=>e({...t,use_custom:a})})]}),t.use_custom&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"主机地址"}),o.jsx(Pe,{value:t.host,onChange:a=>e({...t,host:a.target.value}),placeholder:"127.0.0.1"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"端口号"}),o.jsx(Pe,{type:"number",value:t.port,onChange:a=>e({...t,port:parseInt(a.target.value)}),placeholder:"8090"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"连接模式"}),o.jsxs(Vt,{value:t.mode,onValueChange:a=>e({...t,mode:a}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"ws",children:"WebSocket (ws)"}),o.jsx(De,{value:"tcp",children:"TCP"})]})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{checked:t.use_wss,onCheckedChange:a=>e({...t,use_wss:a}),disabled:t.mode!=="ws"}),o.jsx(he,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"SSL 证书文件路径"}),o.jsx(Pe,{value:t.cert_file,onChange:a=>e({...t,cert_file:a.target.value}),placeholder:"cert.pem"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"SSL 密钥文件路径"}),o.jsx(Pe,{value:t.key_file,onChange:a=>e({...t,key_file:a.target.value}),placeholder:"key.pem"})]})]})]})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"mb-2 block",children:"认证令牌"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(Pe,{value:n,onChange:a=>r(a.target.value),placeholder:"输入认证令牌",onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),s())}}),o.jsx(ue,{onClick:s,size:"sm",children:o.jsx(Is,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"space-y-2",children:t.auth_token.map((a,l)=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[o.jsx("span",{className:"text-sm font-mono",children:a}),o.jsx(ue,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(l),children:o.jsx(Cn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},l))})]})]})}function Y0e({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:"启用统计信息发送"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),o.jsx(Ft,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Af=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{className:"relative w-full overflow-auto",children:o.jsx("table",{ref:n,className:xe("w-full caption-bottom text-sm",t),...e})}));Af.displayName="Table";const Mf=b.forwardRef(({className:t,...e},n)=>o.jsx("thead",{ref:n,className:xe("[&_tr]:border-b",t),...e}));Mf.displayName="TableHeader";const Rf=b.forwardRef(({className:t,...e},n)=>o.jsx("tbody",{ref:n,className:xe("[&_tr:last-child]:border-0",t),...e}));Rf.displayName="TableBody";const K0e=b.forwardRef(({className:t,...e},n)=>o.jsx("tfoot",{ref:n,className:xe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));K0e.displayName="TableFooter";const zs=b.forwardRef(({className:t,...e},n)=>o.jsx("tr",{ref:n,className:xe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));zs.displayName="TableRow";const mn=b.forwardRef(({className:t,...e},n)=>o.jsx("th",{ref:n,className:xe("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}));mn.displayName="TableHead";const Yt=b.forwardRef(({className:t,...e},n)=>o.jsx("td",{ref:n,className:xe("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));Yt.displayName="TableCell";const Z0e=b.forwardRef(({className:t,...e},n)=>o.jsx("caption",{ref:n,className:xe("mt-4 text-sm text-muted-foreground",t),...e}));Z0e.displayName="TableCaption";var kA=1,J0e=.9,epe=.8,tpe=.17,vS=.1,yS=.999,npe=.9999,rpe=.99,spe=/[\\\/_+.#"@\[\(\{&]/,ipe=/[\\\/_+.#"@\[\(\{&]/g,ape=/[\s-]/,EH=/[\s-]/g;function vO(t,e,n,r,s,i,a){if(i===e.length)return s===t.length?kA:rpe;var l=`${s},${i}`;if(a[l]!==void 0)return a[l];for(var c=r.charAt(i),d=n.indexOf(c,s),h=0,m,g,x,y;d>=0;)m=vO(t,e,n,r,d+1,i+1,a),m>h&&(d===s?m*=kA:spe.test(t.charAt(d-1))?(m*=epe,x=t.slice(s,d-1).match(ipe),x&&s>0&&(m*=Math.pow(yS,x.length))):ape.test(t.charAt(d-1))?(m*=J0e,y=t.slice(s,d-1).match(EH),y&&s>0&&(m*=Math.pow(yS,y.length))):(m*=tpe,s>0&&(m*=Math.pow(yS,d-s))),t.charAt(d)!==e.charAt(i)&&(m*=npe)),(mm&&(m=g*vS)),m>h&&(h=m),d=n.indexOf(c,d+1);return a[l]=h,h}function OA(t){return t.toLowerCase().replace(EH," ")}function ope(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,vO(t,e,OA(t),OA(e),0,0,{})}var lpe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hu=lpe.reduce((t,e)=>{const n=Vy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Vm='[cmdk-group=""]',bS='[cmdk-group-items=""]',cpe='[cmdk-group-heading=""]',_H='[cmdk-item=""]',jA=`${_H}:not([aria-disabled="true"])`,yO="cmdk-item-select",kh="data-value",upe=(t,e,n)=>ope(t,e,n),AH=b.createContext(void 0),sg=()=>b.useContext(AH),MH=b.createContext(void 0),W6=()=>b.useContext(MH),RH=b.createContext(void 0),DH=b.forwardRef((t,e)=>{let n=Oh(()=>{var X,z;return{search:"",value:(z=(X=t.value)!=null?X:t.defaultValue)!=null?z:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Oh(()=>new Set),s=Oh(()=>new Map),i=Oh(()=>new Map),a=Oh(()=>new Set),l=PH(t),{label:c,children:d,value:h,onValueChange:m,filter:g,shouldFilter:x,loop:y,disablePointerSelection:w=!1,vimBindings:S=!0,...k}=t,j=Gi(),N=Gi(),T=Gi(),E=b.useRef(null),_=wpe();md(()=>{if(h!==void 0){let X=h.trim();n.current.value=X,A.emit()}},[h]),md(()=>{_(6,ee)},[]);let A=b.useMemo(()=>({subscribe:X=>(a.current.add(X),()=>a.current.delete(X)),snapshot:()=>n.current,setState:(X,z,U)=>{var te,ne,G,se;if(!Object.is(n.current[X],z)){if(n.current[X]=z,X==="search")W(),B(),_(1,H);else if(X==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(T);re?re.focus():(te=document.getElementById(j))==null||te.focus()}if(_(7,()=>{var re;n.current.selectedItemId=(re=I())==null?void 0:re.id,A.emit()}),U||_(5,ee),((ne=l.current)==null?void 0:ne.value)!==void 0){let re=z??"";(se=(G=l.current).onValueChange)==null||se.call(G,re);return}}A.emit()}},emit:()=>{a.current.forEach(X=>X())}}),[]),D=b.useMemo(()=>({value:(X,z,U)=>{var te;z!==((te=i.current.get(X))==null?void 0:te.value)&&(i.current.set(X,{value:z,keywords:U}),n.current.filtered.items.set(X,q(z,U)),_(2,()=>{B(),A.emit()}))},item:(X,z)=>(r.current.add(X),z&&(s.current.has(z)?s.current.get(z).add(X):s.current.set(z,new Set([X]))),_(3,()=>{W(),B(),n.current.value||H(),A.emit()}),()=>{i.current.delete(X),r.current.delete(X),n.current.filtered.items.delete(X);let U=I();_(4,()=>{W(),U?.getAttribute("id")===X&&H(),A.emit()})}),group:X=>(s.current.has(X)||s.current.set(X,new Set),()=>{i.current.delete(X),s.current.delete(X)}),filter:()=>l.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:j,inputId:T,labelId:N,listInnerRef:E}),[]);function q(X,z){var U,te;let ne=(te=(U=l.current)==null?void 0:U.filter)!=null?te:upe;return X?ne(X,n.current.search,z):0}function B(){if(!n.current.search||l.current.shouldFilter===!1)return;let X=n.current.filtered.items,z=[];n.current.filtered.groups.forEach(te=>{let ne=s.current.get(te),G=0;ne.forEach(se=>{let re=X.get(se);G=Math.max(re,G)}),z.push([te,G])});let U=E.current;V().sort((te,ne)=>{var G,se;let re=te.getAttribute("id"),ae=ne.getAttribute("id");return((G=X.get(ae))!=null?G:0)-((se=X.get(re))!=null?se:0)}).forEach(te=>{let ne=te.closest(bS);ne?ne.appendChild(te.parentElement===ne?te:te.closest(`${bS} > *`)):U.appendChild(te.parentElement===U?te:te.closest(`${bS} > *`))}),z.sort((te,ne)=>ne[1]-te[1]).forEach(te=>{var ne;let G=(ne=E.current)==null?void 0:ne.querySelector(`${Vm}[${kh}="${encodeURIComponent(te[0])}"]`);G?.parentElement.appendChild(G)})}function H(){let X=V().find(U=>U.getAttribute("aria-disabled")!=="true"),z=X?.getAttribute(kh);A.setState("value",z||void 0)}function W(){var X,z,U,te;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let G of r.current){let se=(z=(X=i.current.get(G))==null?void 0:X.value)!=null?z:"",re=(te=(U=i.current.get(G))==null?void 0:U.keywords)!=null?te:[],ae=q(se,re);n.current.filtered.items.set(G,ae),ae>0&&ne++}for(let[G,se]of s.current)for(let re of se)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(G);break}n.current.filtered.count=ne}function ee(){var X,z,U;let te=I();te&&(((X=te.parentElement)==null?void 0:X.firstChild)===te&&((U=(z=te.closest(Vm))==null?void 0:z.querySelector(cpe))==null||U.scrollIntoView({block:"nearest"})),te.scrollIntoView({block:"nearest"}))}function I(){var X;return(X=E.current)==null?void 0:X.querySelector(`${_H}[aria-selected="true"]`)}function V(){var X;return Array.from(((X=E.current)==null?void 0:X.querySelectorAll(jA))||[])}function L(X){let z=V()[X];z&&A.setState("value",z.getAttribute(kh))}function $(X){var z;let U=I(),te=V(),ne=te.findIndex(se=>se===U),G=te[ne+X];(z=l.current)!=null&&z.loop&&(G=ne+X<0?te[te.length-1]:ne+X===te.length?te[0]:te[ne+X]),G&&A.setState("value",G.getAttribute(kh))}function K(X){let z=I(),U=z?.closest(Vm),te;for(;U&&!te;)U=X>0?ype(U,Vm):bpe(U,Vm),te=U?.querySelector(jA);te?A.setState("value",te.getAttribute(kh)):$(X)}let Y=()=>L(V().length-1),R=X=>{X.preventDefault(),X.metaKey?Y():X.altKey?K(1):$(1)},ie=X=>{X.preventDefault(),X.metaKey?L(0):X.altKey?K(-1):$(-1)};return b.createElement(hu.div,{ref:e,tabIndex:-1,...k,"cmdk-root":"",onKeyDown:X=>{var z;(z=k.onKeyDown)==null||z.call(k,X);let U=X.nativeEvent.isComposing||X.keyCode===229;if(!(X.defaultPrevented||U))switch(X.key){case"n":case"j":{S&&X.ctrlKey&&R(X);break}case"ArrowDown":{R(X);break}case"p":case"k":{S&&X.ctrlKey&&ie(X);break}case"ArrowUp":{ie(X);break}case"Home":{X.preventDefault(),L(0);break}case"End":{X.preventDefault(),Y();break}case"Enter":{X.preventDefault();let te=I();if(te){let ne=new Event(yO);te.dispatchEvent(ne)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:D.inputId,id:D.labelId,style:kpe},c),Cb(t,X=>b.createElement(MH.Provider,{value:A},b.createElement(AH.Provider,{value:D},X))))}),dpe=b.forwardRef((t,e)=>{var n,r;let s=Gi(),i=b.useRef(null),a=b.useContext(RH),l=sg(),c=PH(t),d=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;md(()=>{if(!d)return l.item(s,a?.id)},[d]);let h=zH(s,i,[t.value,t.children,i],t.keywords),m=W6(),g=tu(_=>_.value&&_.value===h.current),x=tu(_=>d||l.filter()===!1?!0:_.search?_.filtered.items.get(s)>0:!0);b.useEffect(()=>{let _=i.current;if(!(!_||t.disabled))return _.addEventListener(yO,y),()=>_.removeEventListener(yO,y)},[x,t.onSelect,t.disabled]);function y(){var _,A;w(),(A=(_=c.current).onSelect)==null||A.call(_,h.current)}function w(){m.setState("value",h.current,!0)}if(!x)return null;let{disabled:S,value:k,onSelect:j,forceMount:N,keywords:T,...E}=t;return b.createElement(hu.div,{ref:Gc(i,e),...E,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||l.getDisablePointerSelection()?void 0:w,onClick:S?void 0:y},t.children)}),hpe=b.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,a=Gi(),l=b.useRef(null),c=b.useRef(null),d=Gi(),h=sg(),m=tu(x=>s||h.filter()===!1?!0:x.search?x.filtered.groups.has(a):!0);md(()=>h.group(a),[]),zH(a,l,[t.value,t.heading,c]);let g=b.useMemo(()=>({id:a,forceMount:s}),[s]);return b.createElement(hu.div,{ref:Gc(l,e),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),Cb(t,x=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},b.createElement(RH.Provider,{value:g},x))))}),fpe=b.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=b.useRef(null),i=tu(a=>!a.search);return!n&&!i?null:b.createElement(hu.div,{ref:Gc(s,e),...r,"cmdk-separator":"",role:"separator"})}),mpe=b.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=W6(),a=tu(d=>d.search),l=tu(d=>d.selectedItemId),c=sg();return b.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),b.createElement(hu.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?t.value:a,onChange:d=>{s||i.setState("search",d.target.value),n?.(d.target.value)}})}),ppe=b.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=b.useRef(null),a=b.useRef(null),l=tu(d=>d.selectedItemId),c=sg();return b.useEffect(()=>{if(a.current&&i.current){let d=a.current,h=i.current,m,g=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let x=d.offsetHeight;h.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return g.observe(d),()=>{cancelAnimationFrame(m),g.unobserve(d)}}},[]),b.createElement(hu.div,{ref:Gc(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},Cb(t,d=>b.createElement("div",{ref:Gc(a,c.listInnerRef),"cmdk-list-sizer":""},d)))}),gpe=b.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:a,...l}=t;return b.createElement(Mj,{open:n,onOpenChange:r},b.createElement(Ej,{container:a},b.createElement(Uy,{"cmdk-overlay":"",className:s}),b.createElement(Wy,{"aria-label":t.label,"cmdk-dialog":"",className:i},b.createElement(DH,{ref:e,...l}))))}),xpe=b.forwardRef((t,e)=>tu(n=>n.filtered.count===0)?b.createElement(hu.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),vpe=b.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return b.createElement(hu.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Cb(t,a=>b.createElement("div",{"aria-hidden":!0},a)))}),Ei=Object.assign(DH,{List:ppe,Item:dpe,Input:mpe,Group:hpe,Separator:fpe,Dialog:gpe,Empty:xpe,Loading:vpe});function ype(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function bpe(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function PH(t){let e=b.useRef(t);return md(()=>{e.current=t}),e}var md=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Oh(t){let e=b.useRef();return e.current===void 0&&(e.current=t()),e}function tu(t){let e=W6(),n=()=>t(e.snapshot());return b.useSyncExternalStore(e.subscribe,n,n)}function zH(t,e,n,r=[]){let s=b.useRef(),i=sg();return md(()=>{var a;let l=(()=>{var d;for(let h of n){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(d=h.current.textContent)==null?void 0:d.trim():s.current}})(),c=r.map(d=>d.trim());i.value(t,l,c),(a=e.current)==null||a.setAttribute(kh,l),s.current=l}),s}var wpe=()=>{let[t,e]=b.useState(),n=Oh(()=>new Map);return md(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function Spe(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Cb({asChild:t,children:e},n){return t&&b.isValidElement(e)?b.cloneElement(Spe(e),{ref:e.ref},n(e.props.children)):n(e)}var kpe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Tb=b.forwardRef(({className:t,...e},n)=>o.jsx(Ei,{ref:n,className:xe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));Tb.displayName=Ei.displayName;const Eb=b.forwardRef(({className:t,...e},n)=>o.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[o.jsx(ii,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),o.jsx(Ei.Input,{ref:n,className:xe("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})]}));Eb.displayName=Ei.Input.displayName;const _b=b.forwardRef(({className:t,...e},n)=>o.jsx(Ei.List,{ref:n,className:xe("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));_b.displayName=Ei.List.displayName;const Ab=b.forwardRef((t,e)=>o.jsx(Ei.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));Ab.displayName=Ei.Empty.displayName;const up=b.forwardRef(({className:t,...e},n)=>o.jsx(Ei.Group,{ref:n,className:xe("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}));up.displayName=Ei.Group.displayName;const Ope=b.forwardRef(({className:t,...e},n)=>o.jsx(Ei.Separator,{ref:n,className:xe("-mx-1 h-px bg-border",t),...e}));Ope.displayName=Ei.Separator.displayName;const dp=b.forwardRef(({className:t,...e},n)=>o.jsx(Ei.Item,{ref:n,className:xe("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}));dp.displayName=Ei.Item.displayName;const Ci=b.forwardRef(({className:t,...e},n)=>o.jsx(bI,{ref:n,className:xe("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:o.jsx(zee,{className:xe("grid place-content-center text-current"),children:o.jsx(zo,{className:"h-4 w-4"})})}));Ci.displayName=bI.displayName;const IH=b.createContext(null),LH="maibot-completed-tours";function jpe(){try{const t=localStorage.getItem(LH);return t?new Set(JSON.parse(t)):new Set}catch{return new Set}}function NA(t){localStorage.setItem(LH,JSON.stringify([...t]))}function Npe({children:t}){const[e,n]=b.useState({activeTourId:null,stepIndex:0,isRunning:!1}),r=b.useRef(new Map),[,s]=b.useState(0),[i,a]=b.useState(jpe),l=b.useCallback((N,T)=>{r.current.set(N,T),s(E=>E+1)},[]),c=b.useCallback(N=>{r.current.delete(N),n(T=>T.activeTourId===N?{...T,activeTourId:null,isRunning:!1,stepIndex:0}:T)},[]),d=b.useCallback((N,T=0)=>{r.current.has(N)&&n({activeTourId:N,stepIndex:T,isRunning:!0})},[]),h=b.useCallback(()=>{n(N=>({...N,isRunning:!1}))},[]),m=b.useCallback(N=>{n(T=>({...T,stepIndex:N}))},[]),g=b.useCallback(()=>{n(N=>({...N,stepIndex:N.stepIndex+1}))},[]),x=b.useCallback(()=>{n(N=>({...N,stepIndex:Math.max(0,N.stepIndex-1)}))},[]),y=b.useCallback(()=>e.activeTourId?r.current.get(e.activeTourId)||[]:[],[e.activeTourId]),w=b.useCallback(N=>{a(T=>{const E=new Set(T);return E.add(N),NA(E),E})},[]),S=b.useCallback(N=>{const{action:T,index:E,status:_,type:A}=N,D=["finished","skipped"];if(T==="close"){n(q=>({...q,isRunning:!1,stepIndex:0}));return}D.includes(_)?n(q=>(_==="finished"&&q.activeTourId&&setTimeout(()=>w(q.activeTourId),0),{...q,isRunning:!1,stepIndex:0})):A==="step:after"&&(T==="next"?n(q=>({...q,stepIndex:E+1})):T==="prev"&&n(q=>({...q,stepIndex:E-1})))},[w]),k=b.useCallback(N=>i.has(N),[i]),j=b.useCallback(N=>{a(T=>{const E=new Set(T);return E.delete(N),NA(E),E})},[]);return o.jsx(IH.Provider,{value:{state:e,tours:r.current,registerTour:l,unregisterTour:c,startTour:d,stopTour:h,goToStep:m,nextStep:g,prevStep:x,getCurrentSteps:y,handleJoyrideCallback:S,isTourCompleted:k,markTourCompleted:w,resetTourCompleted:j},children:t})}function BH(t){return e=>typeof e===t}var Cpe=BH("function"),Tpe=t=>t===null,CA=t=>Object.prototype.toString.call(t).slice(8,-1)==="RegExp",TA=t=>!Epe(t)&&!Tpe(t)&&(Cpe(t)||typeof t=="object"),Epe=BH("undefined");function _pe(t,e){const{length:n}=t;if(n!==e.length)return!1;for(let r=n;r--!==0;)if(!ti(t[r],e[r]))return!1;return!0}function Ape(t,e){if(t.byteLength!==e.byteLength)return!1;const n=new DataView(t.buffer),r=new DataView(e.buffer);let s=t.byteLength;for(;s--;)if(n.getUint8(s)!==r.getUint8(s))return!1;return!0}function Mpe(t,e){if(t.size!==e.size)return!1;for(const n of t.entries())if(!e.has(n[0]))return!1;for(const n of t.entries())if(!ti(n[1],e.get(n[0])))return!1;return!0}function Rpe(t,e){if(t.size!==e.size)return!1;for(const n of t.entries())if(!e.has(n[0]))return!1;return!0}function ti(t,e){if(t===e)return!0;if(t&&TA(t)&&e&&TA(e)){if(t.constructor!==e.constructor)return!1;if(Array.isArray(t)&&Array.isArray(e))return _pe(t,e);if(t instanceof Map&&e instanceof Map)return Mpe(t,e);if(t instanceof Set&&e instanceof Set)return Rpe(t,e);if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return Ape(t,e);if(CA(t)&&CA(e))return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let s=n.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,n[s]))return!1;for(let s=n.length;s--!==0;){const i=n[s];if(!(i==="_owner"&&t.$$typeof)&&!ti(t[i],e[i]))return!1}return!0}return Number.isNaN(t)&&Number.isNaN(e)?!0:t===e}var Dpe=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Ppe=["bigint","boolean","null","number","string","symbol","undefined"];function Mb(t){const e=Object.prototype.toString.call(t).slice(8,-1);if(/HTML\w+Element/.test(e))return"HTMLElement";if(zpe(e))return e}function io(t){return e=>Mb(e)===t}function zpe(t){return Dpe.includes(t)}function Df(t){return e=>typeof e===t}function Ipe(t){return Ppe.includes(t)}var Lpe=["innerHTML","ownerDocument","style","attributes","nodeValue"];function at(t){if(t===null)return"null";switch(typeof t){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(at.array(t))return"Array";if(at.plainFunction(t))return"Function";const e=Mb(t);return e||"Object"}at.array=Array.isArray;at.arrayOf=(t,e)=>!at.array(t)&&!at.function(e)?!1:t.every(n=>e(n));at.asyncGeneratorFunction=t=>Mb(t)==="AsyncGeneratorFunction";at.asyncFunction=io("AsyncFunction");at.bigint=Df("bigint");at.boolean=t=>t===!0||t===!1;at.date=io("Date");at.defined=t=>!at.undefined(t);at.domElement=t=>at.object(t)&&!at.plainObject(t)&&t.nodeType===1&&at.string(t.nodeName)&&Lpe.every(e=>e in t);at.empty=t=>at.string(t)&&t.length===0||at.array(t)&&t.length===0||at.object(t)&&!at.map(t)&&!at.set(t)&&Object.keys(t).length===0||at.set(t)&&t.size===0||at.map(t)&&t.size===0;at.error=io("Error");at.function=Df("function");at.generator=t=>at.iterable(t)&&at.function(t.next)&&at.function(t.throw);at.generatorFunction=io("GeneratorFunction");at.instanceOf=(t,e)=>!t||!e?!1:Object.getPrototypeOf(t)===e.prototype;at.iterable=t=>!at.nullOrUndefined(t)&&at.function(t[Symbol.iterator]);at.map=io("Map");at.nan=t=>Number.isNaN(t);at.null=t=>t===null;at.nullOrUndefined=t=>at.null(t)||at.undefined(t);at.number=t=>Df("number")(t)&&!at.nan(t);at.numericString=t=>at.string(t)&&t.length>0&&!Number.isNaN(Number(t));at.object=t=>!at.nullOrUndefined(t)&&(at.function(t)||typeof t=="object");at.oneOf=(t,e)=>at.array(t)?t.indexOf(e)>-1:!1;at.plainFunction=io("Function");at.plainObject=t=>{if(Mb(t)!=="Object")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.getPrototypeOf({})};at.primitive=t=>at.null(t)||Ipe(typeof t);at.promise=io("Promise");at.propertyOf=(t,e,n)=>{if(!at.object(t)||!e)return!1;const r=t[e];return at.function(n)?n(r):at.defined(r)};at.regexp=io("RegExp");at.set=io("Set");at.string=Df("string");at.symbol=Df("symbol");at.undefined=Df("undefined");at.weakMap=io("WeakMap");at.weakSet=io("WeakSet");var pt=at;function Bpe(...t){return t.every(e=>pt.string(e)||pt.array(e)||pt.plainObject(e))}function Fpe(t,e,n){return FH(t,e)?[t,e].every(pt.array)?!t.some(RA(n))&&e.some(RA(n)):[t,e].every(pt.plainObject)?!Object.entries(t).some(MA(n))&&Object.entries(e).some(MA(n)):e===n:!1}function EA(t,e,n){const{actual:r,key:s,previous:i,type:a}=n,l=_o(t,s),c=_o(e,s);let d=[l,c].every(pt.number)&&(a==="increased"?lc);return pt.undefined(r)||(d=d&&c===r),pt.undefined(i)||(d=d&&l===i),d}function _A(t,e,n){const{key:r,type:s,value:i}=n,a=_o(t,r),l=_o(e,r),c=s==="added"?a:l,d=s==="added"?l:a;if(!pt.nullOrUndefined(i)){if(pt.defined(c)){if(pt.array(c)||pt.plainObject(c))return Fpe(c,d,i)}else return ti(d,i);return!1}return[a,l].every(pt.array)?!d.every(G6(c)):[a,l].every(pt.plainObject)?qpe(Object.keys(c),Object.keys(d)):![a,l].every(h=>pt.primitive(h)&&pt.defined(h))&&(s==="added"?!pt.defined(a)&&pt.defined(l):pt.defined(a)&&!pt.defined(l))}function AA(t,e,{key:n}={}){let r=_o(t,n),s=_o(e,n);if(!FH(r,s))throw new TypeError("Inputs have different types");if(!Bpe(r,s))throw new TypeError("Inputs don't have length");return[r,s].every(pt.plainObject)&&(r=Object.keys(r),s=Object.keys(s)),[r,s]}function MA(t){return([e,n])=>pt.array(t)?ti(t,n)||t.some(r=>ti(r,n)||pt.array(n)&&G6(n)(r)):pt.plainObject(t)&&t[e]?!!t[e]&&ti(t[e],n):ti(t,n)}function qpe(t,e){return e.some(n=>!t.includes(n))}function RA(t){return e=>pt.array(t)?t.some(n=>ti(n,e)||pt.array(e)&&G6(e)(n)):ti(t,e)}function Um(t,e){return pt.array(t)?t.some(n=>ti(n,e)):ti(t,e)}function G6(t){return e=>t.some(n=>ti(n,e))}function FH(...t){return t.every(pt.array)||t.every(pt.number)||t.every(pt.plainObject)||t.every(pt.string)}function _o(t,e){return pt.plainObject(t)||pt.array(t)?pt.string(e)?e.split(".").reduce((r,s)=>r&&r[s],t):pt.number(e)?t[e]:t:t}function py(t,e){if([t,e].some(pt.nullOrUndefined))throw new Error("Missing required parameters");if(![t,e].every(h=>pt.plainObject(h)||pt.array(h)))throw new Error("Expected plain objects or array");return{added:(h,m)=>{try{return _A(t,e,{key:h,type:"added",value:m})}catch{return!1}},changed:(h,m,g)=>{try{const x=_o(t,h),y=_o(e,h),w=pt.defined(m),S=pt.defined(g);if(w||S){const k=S?Um(g,x):!Um(m,x),j=Um(m,y);return k&&j}return[x,y].every(pt.array)||[x,y].every(pt.plainObject)?!ti(x,y):x!==y}catch{return!1}},changedFrom:(h,m,g)=>{if(!pt.defined(h))return!1;try{const x=_o(t,h),y=_o(e,h),w=pt.defined(g);return Um(m,x)&&(w?Um(g,y):!w)}catch{return!1}},decreased:(h,m,g)=>{if(!pt.defined(h))return!1;try{return EA(t,e,{key:h,actual:m,previous:g,type:"decreased"})}catch{return!1}},emptied:h=>{try{const[m,g]=AA(t,e,{key:h});return!!m.length&&!g.length}catch{return!1}},filled:h=>{try{const[m,g]=AA(t,e,{key:h});return!m.length&&!!g.length}catch{return!1}},increased:(h,m,g)=>{if(!pt.defined(h))return!1;try{return EA(t,e,{key:h,actual:m,previous:g,type:"increased"})}catch{return!1}},removed:(h,m)=>{try{return _A(t,e,{key:h,type:"removed",value:m})}catch{return!1}}}}var wS,DA;function $pe(){if(DA)return wS;DA=1;var t=new Error("Element already at target scroll position"),e=new Error("Scroll cancelled"),n=Math.min,r=Date.now;wS={left:s("scrollLeft"),top:s("scrollTop")};function s(l){return function(d,h,m,g){m=m||{},typeof m=="function"&&(g=m,m={}),typeof g!="function"&&(g=a);var x=r(),y=d[l],w=m.ease||i,S=isNaN(m.duration)?350:+m.duration,k=!1;return y===h?g(t,d[l]):requestAnimationFrame(N),j;function j(){k=!0}function N(T){if(k)return g(e,d[l]);var E=r(),_=n(1,(E-x)/S),A=w(_);d[l]=A*(h-y)+y,_<1?requestAnimationFrame(N):requestAnimationFrame(function(){g(null,d[l])})}}}function i(l){return .5*(1-Math.cos(Math.PI*l))}function a(){}return wS}var Hpe=$pe();const Qpe=yd(Hpe);var Ov={exports:{}},Vpe=Ov.exports,PA;function Upe(){return PA||(PA=1,(function(t){(function(e,n){t.exports?t.exports=n():e.Scrollparent=n()})(Vpe,function(){function e(r){var s=getComputedStyle(r,null).getPropertyValue("overflow");return s.indexOf("scroll")>-1||s.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var s=r.parentNode;s.parentNode;){if(e(s))return s;s=s.parentNode}return document.scrollingElement||document.documentElement}}return n})})(Ov)),Ov.exports}var Wpe=Upe();const qH=yd(Wpe);var SS,zA;function Gpe(){if(zA)return SS;zA=1;var t=function(r){return Object.prototype.hasOwnProperty.call(r,"props")},e=function(r,s){return r+n(s)},n=function(r){return r===null||typeof r=="boolean"||typeof r>"u"?"":typeof r=="number"?r.toString():typeof r=="string"?r:Array.isArray(r)?r.reduce(e,""):t(r)&&Object.prototype.hasOwnProperty.call(r.props,"children")?n(r.props.children):""};return n.default=n,SS=n,SS}var Xpe=Gpe();const IA=yd(Xpe);var kS,LA;function Ype(){if(LA)return kS;LA=1;var t=function(j){return e(j)&&!n(j)};function e(k){return!!k&&typeof k=="object"}function n(k){var j=Object.prototype.toString.call(k);return j==="[object RegExp]"||j==="[object Date]"||i(k)}var r=typeof Symbol=="function"&&Symbol.for,s=r?Symbol.for("react.element"):60103;function i(k){return k.$$typeof===s}function a(k){return Array.isArray(k)?[]:{}}function l(k,j){return j.clone!==!1&&j.isMergeableObject(k)?w(a(k),k,j):k}function c(k,j,N){return k.concat(j).map(function(T){return l(T,N)})}function d(k,j){if(!j.customMerge)return w;var N=j.customMerge(k);return typeof N=="function"?N:w}function h(k){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(k).filter(function(j){return Object.propertyIsEnumerable.call(k,j)}):[]}function m(k){return Object.keys(k).concat(h(k))}function g(k,j){try{return j in k}catch{return!1}}function x(k,j){return g(k,j)&&!(Object.hasOwnProperty.call(k,j)&&Object.propertyIsEnumerable.call(k,j))}function y(k,j,N){var T={};return N.isMergeableObject(k)&&m(k).forEach(function(E){T[E]=l(k[E],N)}),m(j).forEach(function(E){x(k,E)||(g(k,E)&&N.isMergeableObject(j[E])?T[E]=d(E,N)(k[E],j[E],N):T[E]=l(j[E],N))}),T}function w(k,j,N){N=N||{},N.arrayMerge=N.arrayMerge||c,N.isMergeableObject=N.isMergeableObject||t,N.cloneUnlessOtherwiseSpecified=l;var T=Array.isArray(j),E=Array.isArray(k),_=T===E;return _?T?N.arrayMerge(k,j,N):y(k,j,N):l(j,N)}w.all=function(j,N){if(!Array.isArray(j))throw new Error("first argument should be an array");return j.reduce(function(T,E){return w(T,E,N)},{})};var S=w;return kS=S,kS}var Kpe=Ype();const Ua=yd(Kpe);var ig=typeof window<"u"&&typeof document<"u"&&typeof navigator<"u",Zpe=(function(){for(var t=["Edge","Trident","Firefox"],e=0;e=0)return 1;return 0})();function Jpe(t){var e=!1;return function(){e||(e=!0,window.Promise.resolve().then(function(){e=!1,t()}))}}function ege(t){var e=!1;return function(){e||(e=!0,setTimeout(function(){e=!1,t()},Zpe))}}var tge=ig&&window.Promise,nge=tge?Jpe:ege;function $H(t){var e={};return t&&e.toString.call(t)==="[object Function]"}function Sd(t,e){if(t.nodeType!==1)return[];var n=t.ownerDocument.defaultView,r=n.getComputedStyle(t,null);return e?r[e]:r}function X6(t){return t.nodeName==="HTML"?t:t.parentNode||t.host}function ag(t){if(!t)return document.body;switch(t.nodeName){case"HTML":case"BODY":return t.ownerDocument.body;case"#document":return t.body}var e=Sd(t),n=e.overflow,r=e.overflowX,s=e.overflowY;return/(auto|scroll|overlay)/.test(n+s+r)?t:ag(X6(t))}function HH(t){return t&&t.referenceNode?t.referenceNode:t}var BA=ig&&!!(window.MSInputMethodContext&&document.documentMode),FA=ig&&/MSIE 10/.test(navigator.userAgent);function Pf(t){return t===11?BA:t===10?FA:BA||FA}function lf(t){if(!t)return document.documentElement;for(var e=Pf(10)?document.body:null,n=t.offsetParent||null;n===e&&t.nextElementSibling;)n=(t=t.nextElementSibling).offsetParent;var r=n&&n.nodeName;return!r||r==="BODY"||r==="HTML"?t?t.ownerDocument.documentElement:document.documentElement:["TH","TD","TABLE"].indexOf(n.nodeName)!==-1&&Sd(n,"position")==="static"?lf(n):n}function rge(t){var e=t.nodeName;return e==="BODY"?!1:e==="HTML"||lf(t.firstElementChild)===t}function bO(t){return t.parentNode!==null?bO(t.parentNode):t}function gy(t,e){if(!t||!t.nodeType||!e||!e.nodeType)return document.documentElement;var n=t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?t:e,s=n?e:t,i=document.createRange();i.setStart(r,0),i.setEnd(s,0);var a=i.commonAncestorContainer;if(t!==a&&e!==a||r.contains(s))return rge(a)?a:lf(a);var l=bO(t);return l.host?gy(l.host,e):gy(t,bO(e).host)}function cf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"top",n=e==="top"?"scrollTop":"scrollLeft",r=t.nodeName;if(r==="BODY"||r==="HTML"){var s=t.ownerDocument.documentElement,i=t.ownerDocument.scrollingElement||s;return i[n]}return t[n]}function sge(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=cf(e,"top"),s=cf(e,"left"),i=n?-1:1;return t.top+=r*i,t.bottom+=r*i,t.left+=s*i,t.right+=s*i,t}function qA(t,e){var n=e==="x"?"Left":"Top",r=n==="Left"?"Right":"Bottom";return parseFloat(t["border"+n+"Width"])+parseFloat(t["border"+r+"Width"])}function $A(t,e,n,r){return Math.max(e["offset"+t],e["scroll"+t],n["client"+t],n["offset"+t],n["scroll"+t],Pf(10)?parseInt(n["offset"+t])+parseInt(r["margin"+(t==="Height"?"Top":"Left")])+parseInt(r["margin"+(t==="Height"?"Bottom":"Right")]):0)}function QH(t){var e=t.body,n=t.documentElement,r=Pf(10)&&getComputedStyle(n);return{height:$A("Height",e,n,r),width:$A("Width",e,n,r)}}var ige=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},age=(function(){function t(e,n){for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,r=Pf(10),s=e.nodeName==="HTML",i=wO(t),a=wO(e),l=ag(t),c=Sd(e),d=parseFloat(c.borderTopWidth),h=parseFloat(c.borderLeftWidth);n&&s&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var m=nu({top:i.top-a.top-d,left:i.left-a.left-h,width:i.width,height:i.height});if(m.marginTop=0,m.marginLeft=0,!r&&s){var g=parseFloat(c.marginTop),x=parseFloat(c.marginLeft);m.top-=d-g,m.bottom-=d-g,m.left-=h-x,m.right-=h-x,m.marginTop=g,m.marginLeft=x}return(r&&!n?e.contains(l):e===l&&l.nodeName!=="BODY")&&(m=sge(m,e)),m}function oge(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=t.ownerDocument.documentElement,r=Y6(t,n),s=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),a=e?0:cf(n),l=e?0:cf(n,"left"),c={top:a-r.top+r.marginTop,left:l-r.left+r.marginLeft,width:s,height:i};return nu(c)}function VH(t){var e=t.nodeName;if(e==="BODY"||e==="HTML")return!1;if(Sd(t,"position")==="fixed")return!0;var n=X6(t);return n?VH(n):!1}function UH(t){if(!t||!t.parentElement||Pf())return document.documentElement;for(var e=t.parentElement;e&&Sd(e,"transform")==="none";)e=e.parentElement;return e||document.documentElement}function K6(t,e,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,i={top:0,left:0},a=s?UH(t):gy(t,HH(e));if(r==="viewport")i=oge(a,s);else{var l=void 0;r==="scrollParent"?(l=ag(X6(e)),l.nodeName==="BODY"&&(l=t.ownerDocument.documentElement)):r==="window"?l=t.ownerDocument.documentElement:l=r;var c=Y6(l,a,s);if(l.nodeName==="HTML"&&!VH(a)){var d=QH(t.ownerDocument),h=d.height,m=d.width;i.top+=c.top-c.marginTop,i.bottom=h+c.top,i.left+=c.left-c.marginLeft,i.right=m+c.left}else i=c}n=n||0;var g=typeof n=="number";return i.left+=g?n:n.left||0,i.top+=g?n:n.top||0,i.right-=g?n:n.right||0,i.bottom-=g?n:n.bottom||0,i}function lge(t){var e=t.width,n=t.height;return e*n}function WH(t,e,n,r,s){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(t.indexOf("auto")===-1)return t;var a=K6(n,r,i,s),l={top:{width:a.width,height:e.top-a.top},right:{width:a.right-e.right,height:a.height},bottom:{width:a.width,height:a.bottom-e.bottom},left:{width:e.left-a.left,height:a.height}},c=Object.keys(l).map(function(g){return ja({key:g},l[g],{area:lge(l[g])})}).sort(function(g,x){return x.area-g.area}),d=c.filter(function(g){var x=g.width,y=g.height;return x>=n.clientWidth&&y>=n.clientHeight}),h=d.length>0?d[0].key:c[0].key,m=t.split("-")[1];return h+(m?"-"+m:"")}function GH(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,s=r?UH(e):gy(e,HH(n));return Y6(n,s,r)}function XH(t){var e=t.ownerDocument.defaultView,n=e.getComputedStyle(t),r=parseFloat(n.marginTop||0)+parseFloat(n.marginBottom||0),s=parseFloat(n.marginLeft||0)+parseFloat(n.marginRight||0),i={width:t.offsetWidth+s,height:t.offsetHeight+r};return i}function xy(t){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return t.replace(/left|right|bottom|top/g,function(n){return e[n]})}function YH(t,e,n){n=n.split("-")[0];var r=XH(t),s={width:r.width,height:r.height},i=["right","left"].indexOf(n)!==-1,a=i?"top":"left",l=i?"left":"top",c=i?"height":"width",d=i?"width":"height";return s[a]=e[a]+e[c]/2-r[c]/2,n===l?s[l]=e[l]-r[d]:s[l]=e[xy(l)],s}function og(t,e){return Array.prototype.find?t.find(e):t.filter(e)[0]}function cge(t,e,n){if(Array.prototype.findIndex)return t.findIndex(function(s){return s[e]===n});var r=og(t,function(s){return s[e]===n});return t.indexOf(r)}function KH(t,e,n){var r=n===void 0?t:t.slice(0,cge(t,"name",n));return r.forEach(function(s){s.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var i=s.function||s.fn;s.enabled&&$H(i)&&(e.offsets.popper=nu(e.offsets.popper),e.offsets.reference=nu(e.offsets.reference),e=i(e,s))}),e}function uge(){if(!this.state.isDestroyed){var t={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};t.offsets.reference=GH(this.state,this.popper,this.reference,this.options.positionFixed),t.placement=WH(this.options.placement,t.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),t.originalPlacement=t.placement,t.positionFixed=this.options.positionFixed,t.offsets.popper=YH(this.popper,t.offsets.reference,t.placement),t.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",t=KH(this.modifiers,t),this.state.isCreated?this.options.onUpdate(t):(this.state.isCreated=!0,this.options.onCreate(t))}}function ZH(t,e){return t.some(function(n){var r=n.name,s=n.enabled;return s&&r===e})}function Z6(t){for(var e=[!1,"ms","Webkit","Moz","O"],n=t.charAt(0).toUpperCase()+t.slice(1),r=0;ra[x]&&(t.offsets.popper[m]+=l[m]+y-a[x]),t.offsets.popper=nu(t.offsets.popper);var w=l[m]+l[d]/2-y/2,S=Sd(t.instance.popper),k=parseFloat(S["margin"+h]),j=parseFloat(S["border"+h+"Width"]),N=w-t.offsets.popper[m]-k-j;return N=Math.max(Math.min(a[d]-y,N),0),t.arrowElement=r,t.offsets.arrow=(n={},uf(n,m,Math.round(N)),uf(n,g,""),n),t}function kge(t){return t==="end"?"start":t==="start"?"end":t}var nQ=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],OS=nQ.slice(3);function HA(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=OS.indexOf(t),r=OS.slice(n+1).concat(OS.slice(0,n));return e?r.reverse():r}var jS={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"};function Oge(t,e){if(ZH(t.instance.modifiers,"inner")||t.flipped&&t.placement===t.originalPlacement)return t;var n=K6(t.instance.popper,t.instance.reference,e.padding,e.boundariesElement,t.positionFixed),r=t.placement.split("-")[0],s=xy(r),i=t.placement.split("-")[1]||"",a=[];switch(e.behavior){case jS.FLIP:a=[r,s];break;case jS.CLOCKWISE:a=HA(r);break;case jS.COUNTERCLOCKWISE:a=HA(r,!0);break;default:a=e.behavior}return a.forEach(function(l,c){if(r!==l||a.length===c+1)return t;r=t.placement.split("-")[0],s=xy(r);var d=t.offsets.popper,h=t.offsets.reference,m=Math.floor,g=r==="left"&&m(d.right)>m(h.left)||r==="right"&&m(d.left)m(h.top)||r==="bottom"&&m(d.top)m(n.right),w=m(d.top)m(n.bottom),k=r==="left"&&x||r==="right"&&y||r==="top"&&w||r==="bottom"&&S,j=["top","bottom"].indexOf(r)!==-1,N=!!e.flipVariations&&(j&&i==="start"&&x||j&&i==="end"&&y||!j&&i==="start"&&w||!j&&i==="end"&&S),T=!!e.flipVariationsByContent&&(j&&i==="start"&&y||j&&i==="end"&&x||!j&&i==="start"&&S||!j&&i==="end"&&w),E=N||T;(g||k||E)&&(t.flipped=!0,(g||k)&&(r=a[c+1]),E&&(i=kge(i)),t.placement=r+(i?"-"+i:""),t.offsets.popper=ja({},t.offsets.popper,YH(t.instance.popper,t.offsets.reference,t.placement)),t=KH(t.instance.modifiers,t,"flip"))}),t}function jge(t){var e=t.offsets,n=e.popper,r=e.reference,s=t.placement.split("-")[0],i=Math.floor,a=["top","bottom"].indexOf(s)!==-1,l=a?"right":"bottom",c=a?"left":"top",d=a?"width":"height";return n[l]i(r[l])&&(t.offsets.popper[c]=i(r[l])),t}function Nge(t,e,n,r){var s=t.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+s[1],a=s[2];if(!i)return t;if(a.indexOf("%")===0){var l=void 0;switch(a){case"%p":l=n;break;case"%":case"%r":default:l=r}var c=nu(l);return c[e]/100*i}else if(a==="vh"||a==="vw"){var d=void 0;return a==="vh"?d=Math.max(document.documentElement.clientHeight,window.innerHeight||0):d=Math.max(document.documentElement.clientWidth,window.innerWidth||0),d/100*i}else return i}function Cge(t,e,n,r){var s=[0,0],i=["right","left"].indexOf(r)!==-1,a=t.split(/(\+|\-)/).map(function(h){return h.trim()}),l=a.indexOf(og(a,function(h){return h.search(/,|\s/)!==-1}));a[l]&&a[l].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var c=/\s*,\s*|\s+/,d=l!==-1?[a.slice(0,l).concat([a[l].split(c)[0]]),[a[l].split(c)[1]].concat(a.slice(l+1))]:[a];return d=d.map(function(h,m){var g=(m===1?!i:i)?"height":"width",x=!1;return h.reduce(function(y,w){return y[y.length-1]===""&&["+","-"].indexOf(w)!==-1?(y[y.length-1]=w,x=!0,y):x?(y[y.length-1]+=w,x=!1,y):y.concat(w)},[]).map(function(y){return Nge(y,g,e,n)})}),d.forEach(function(h,m){h.forEach(function(g,x){J6(g)&&(s[m]+=g*(h[x-1]==="-"?-1:1))})}),s}function Tge(t,e){var n=e.offset,r=t.placement,s=t.offsets,i=s.popper,a=s.reference,l=r.split("-")[0],c=void 0;return J6(+n)?c=[+n,0]:c=Cge(n,i,a,l),l==="left"?(i.top+=c[0],i.left-=c[1]):l==="right"?(i.top+=c[0],i.left+=c[1]):l==="top"?(i.left+=c[0],i.top-=c[1]):l==="bottom"&&(i.left+=c[0],i.top+=c[1]),t.popper=i,t}function Ege(t,e){var n=e.boundariesElement||lf(t.instance.popper);t.instance.reference===n&&(n=lf(n));var r=Z6("transform"),s=t.instance.popper.style,i=s.top,a=s.left,l=s[r];s.top="",s.left="",s[r]="";var c=K6(t.instance.popper,t.instance.reference,e.padding,n,t.positionFixed);s.top=i,s.left=a,s[r]=l,e.boundaries=c;var d=e.priority,h=t.offsets.popper,m={primary:function(x){var y=h[x];return h[x]c[x]&&!e.escapeWithReference&&(w=Math.min(h[y],c[x]-(x==="right"?h.width:h.height))),uf({},y,w)}};return d.forEach(function(g){var x=["left","top"].indexOf(g)!==-1?"primary":"secondary";h=ja({},h,m[x](g))}),t.offsets.popper=h,t}function _ge(t){var e=t.placement,n=e.split("-")[0],r=e.split("-")[1];if(r){var s=t.offsets,i=s.reference,a=s.popper,l=["bottom","top"].indexOf(n)!==-1,c=l?"left":"top",d=l?"width":"height",h={start:uf({},c,i[c]),end:uf({},c,i[c]+i[d]-a[d])};t.offsets.popper=ja({},a,h[r])}return t}function Age(t){if(!tQ(t.instance.modifiers,"hide","preventOverflow"))return t;var e=t.offsets.reference,n=og(t.instance.modifiers,function(r){return r.name==="preventOverflow"}).boundaries;if(e.bottomn.right||e.top>n.bottom||e.right2&&arguments[2]!==void 0?arguments[2]:{};ige(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=nge(this.update.bind(this)),this.options=ja({},t.Defaults,s),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=e&&e.jquery?e[0]:e,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(ja({},t.Defaults.modifiers,s.modifiers)).forEach(function(a){r.options.modifiers[a]=ja({},t.Defaults.modifiers[a]||{},s.modifiers?s.modifiers[a]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(a){return ja({name:a},r.options.modifiers[a])}).sort(function(a,l){return a.order-l.order}),this.modifiers.forEach(function(a){a.enabled&&$H(a.onLoad)&&a.onLoad(r.reference,r.popper,r.options,a,r.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return age(t,[{key:"update",value:function(){return uge.call(this)}},{key:"destroy",value:function(){return dge.call(this)}},{key:"enableEventListeners",value:function(){return fge.call(this)}},{key:"disableEventListeners",value:function(){return pge.call(this)}}]),t})();hp.Utils=(typeof window<"u"?window:global).PopperUtils;hp.placements=nQ;hp.Defaults=Dge;var Pge=["innerHTML","ownerDocument","style","attributes","nodeValue"],zge=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Ige=["bigint","boolean","null","number","string","symbol","undefined"];function Rb(t){var e=Object.prototype.toString.call(t).slice(8,-1);if(/HTML\w+Element/.test(e))return"HTMLElement";if(Lge(e))return e}function ao(t){return function(e){return Rb(e)===t}}function Lge(t){return zge.includes(t)}function zf(t){return function(e){return typeof e===t}}function Bge(t){return Ige.includes(t)}function Ee(t){if(t===null)return"null";switch(typeof t){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(Ee.array(t))return"Array";if(Ee.plainFunction(t))return"Function";var e=Rb(t);return e||"Object"}Ee.array=Array.isArray;Ee.arrayOf=function(t,e){return!Ee.array(t)&&!Ee.function(e)?!1:t.every(function(n){return e(n)})};Ee.asyncGeneratorFunction=function(t){return Rb(t)==="AsyncGeneratorFunction"};Ee.asyncFunction=ao("AsyncFunction");Ee.bigint=zf("bigint");Ee.boolean=function(t){return t===!0||t===!1};Ee.date=ao("Date");Ee.defined=function(t){return!Ee.undefined(t)};Ee.domElement=function(t){return Ee.object(t)&&!Ee.plainObject(t)&&t.nodeType===1&&Ee.string(t.nodeName)&&Pge.every(function(e){return e in t})};Ee.empty=function(t){return Ee.string(t)&&t.length===0||Ee.array(t)&&t.length===0||Ee.object(t)&&!Ee.map(t)&&!Ee.set(t)&&Object.keys(t).length===0||Ee.set(t)&&t.size===0||Ee.map(t)&&t.size===0};Ee.error=ao("Error");Ee.function=zf("function");Ee.generator=function(t){return Ee.iterable(t)&&Ee.function(t.next)&&Ee.function(t.throw)};Ee.generatorFunction=ao("GeneratorFunction");Ee.instanceOf=function(t,e){return!t||!e?!1:Object.getPrototypeOf(t)===e.prototype};Ee.iterable=function(t){return!Ee.nullOrUndefined(t)&&Ee.function(t[Symbol.iterator])};Ee.map=ao("Map");Ee.nan=function(t){return Number.isNaN(t)};Ee.null=function(t){return t===null};Ee.nullOrUndefined=function(t){return Ee.null(t)||Ee.undefined(t)};Ee.number=function(t){return zf("number")(t)&&!Ee.nan(t)};Ee.numericString=function(t){return Ee.string(t)&&t.length>0&&!Number.isNaN(Number(t))};Ee.object=function(t){return!Ee.nullOrUndefined(t)&&(Ee.function(t)||typeof t=="object")};Ee.oneOf=function(t,e){return Ee.array(t)?t.indexOf(e)>-1:!1};Ee.plainFunction=ao("Function");Ee.plainObject=function(t){if(Rb(t)!=="Object")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.getPrototypeOf({})};Ee.primitive=function(t){return Ee.null(t)||Bge(typeof t)};Ee.promise=ao("Promise");Ee.propertyOf=function(t,e,n){if(!Ee.object(t)||!e)return!1;var r=t[e];return Ee.function(n)?n(r):Ee.defined(r)};Ee.regexp=ao("RegExp");Ee.set=ao("Set");Ee.string=zf("string");Ee.symbol=zf("symbol");Ee.undefined=zf("undefined");Ee.weakMap=ao("WeakMap");Ee.weakSet=ao("WeakSet");function rQ(t){return function(e){return typeof e===t}}var Fge=rQ("function"),qge=function(t){return t===null},QA=function(t){return Object.prototype.toString.call(t).slice(8,-1)==="RegExp"},VA=function(t){return!$ge(t)&&!qge(t)&&(Fge(t)||typeof t=="object")},$ge=rQ("undefined"),kO=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function Hge(t,e){var n=t.length;if(n!==e.length)return!1;for(var r=n;r--!==0;)if(!Si(t[r],e[r]))return!1;return!0}function Qge(t,e){if(t.byteLength!==e.byteLength)return!1;for(var n=new DataView(t.buffer),r=new DataView(e.buffer),s=t.byteLength;s--;)if(n.getUint8(s)!==r.getUint8(s))return!1;return!0}function Vge(t,e){var n,r,s,i;if(t.size!==e.size)return!1;try{for(var a=kO(t.entries()),l=a.next();!l.done;l=a.next()){var c=l.value;if(!e.has(c[0]))return!1}}catch(m){n={error:m}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}try{for(var d=kO(t.entries()),h=d.next();!h.done;h=d.next()){var c=h.value;if(!Si(c[1],e.get(c[0])))return!1}}catch(m){s={error:m}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(s)throw s.error}}return!0}function Uge(t,e){var n,r;if(t.size!==e.size)return!1;try{for(var s=kO(t.entries()),i=s.next();!i.done;i=s.next()){var a=i.value;if(!e.has(a[0]))return!1}}catch(l){n={error:l}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return!0}function Si(t,e){if(t===e)return!0;if(t&&VA(t)&&e&&VA(e)){if(t.constructor!==e.constructor)return!1;if(Array.isArray(t)&&Array.isArray(e))return Hge(t,e);if(t instanceof Map&&e instanceof Map)return Vge(t,e);if(t instanceof Set&&e instanceof Set)return Uge(t,e);if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return Qge(t,e);if(QA(t)&&QA(e))return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var s=n.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,n[s]))return!1;for(var s=n.length;s--!==0;){var i=n[s];if(!(i==="_owner"&&t.$$typeof)&&!Si(t[i],e[i]))return!1}return!0}return Number.isNaN(t)&&Number.isNaN(e)?!0:t===e}function Wge(){for(var t=[],e=0;ec);return Ee.undefined(r)||(d=d&&c===r),Ee.undefined(i)||(d=d&&l===i),d}function WA(t,e,n){var r=n.key,s=n.type,i=n.value,a=Ao(t,r),l=Ao(e,r),c=s==="added"?a:l,d=s==="added"?l:a;if(!Ee.nullOrUndefined(i)){if(Ee.defined(c)){if(Ee.array(c)||Ee.plainObject(c))return Gge(c,d,i)}else return Si(d,i);return!1}return[a,l].every(Ee.array)?!d.every(eN(c)):[a,l].every(Ee.plainObject)?Xge(Object.keys(c),Object.keys(d)):![a,l].every(function(h){return Ee.primitive(h)&&Ee.defined(h)})&&(s==="added"?!Ee.defined(a)&&Ee.defined(l):Ee.defined(a)&&!Ee.defined(l))}function GA(t,e,n){var r=n===void 0?{}:n,s=r.key,i=Ao(t,s),a=Ao(e,s);if(!sQ(i,a))throw new TypeError("Inputs have different types");if(!Wge(i,a))throw new TypeError("Inputs don't have length");return[i,a].every(Ee.plainObject)&&(i=Object.keys(i),a=Object.keys(a)),[i,a]}function XA(t){return function(e){var n=e[0],r=e[1];return Ee.array(t)?Si(t,r)||t.some(function(s){return Si(s,r)||Ee.array(r)&&eN(r)(s)}):Ee.plainObject(t)&&t[n]?!!t[n]&&Si(t[n],r):Si(t,r)}}function Xge(t,e){return e.some(function(n){return!t.includes(n)})}function YA(t){return function(e){return Ee.array(t)?t.some(function(n){return Si(n,e)||Ee.array(e)&&eN(e)(n)}):Si(t,e)}}function Wm(t,e){return Ee.array(t)?t.some(function(n){return Si(n,e)}):Si(t,e)}function eN(t){return function(e){return t.some(function(n){return Si(n,e)})}}function sQ(){for(var t=[],e=0;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Jge(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i=0)&&(n[s]=t[s]);return n}function iQ(t,e){if(t==null)return{};var n=Jge(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function El(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function exe(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return El(t)}function dg(t){var e=Zge();return function(){var r=vy(t),s;if(e){var i=vy(this).constructor;s=Reflect.construct(r,arguments,i)}else s=r.apply(this,arguments);return exe(this,s)}}function txe(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function aQ(t){var e=txe(t,"string");return typeof e=="symbol"?e:String(e)}var nxe={flip:{padding:20},preventOverflow:{padding:10}},rxe="The typeValidator argument must be a function with the signature function(props, propName, componentName).",sxe="The error message is optional, but must be a string if provided.";function ixe(t,e,n,r){return typeof t=="boolean"?t:typeof t=="function"?t(e,n,r):t?!!t:!1}function axe(t,e){return Object.hasOwnProperty.call(t,e)}function oxe(t,e,n,r){return new Error("Required ".concat(t[e]," `").concat(e,"` was not specified in `").concat(n,"`."))}function lxe(t,e){if(typeof t!="function")throw new TypeError(rxe);if(e&&typeof e!="string")throw new TypeError(sxe)}function ZA(t,e,n){return lxe(t,n),function(r,s,i){for(var a=arguments.length,l=new Array(a>3?a-3:0),c=3;c3&&arguments[3]!==void 0?arguments[3]:!1;t.addEventListener(e,n,r)}function uxe(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;t.removeEventListener(e,n,r)}function dxe(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s;s=function(a){n(a),uxe(t,e,s)},cxe(t,e,s,r)}function JA(){}var oQ=(function(t){ug(n,t);var e=dg(n);function n(){return lg(this,n),e.apply(this,arguments)}return cg(n,[{key:"componentDidMount",value:function(){bo()&&(this.node||this.appendNode(),Gm||this.renderPortal())}},{key:"componentDidUpdate",value:function(){bo()&&(Gm||this.renderPortal())}},{key:"componentWillUnmount",value:function(){!bo()||!this.node||(Gm||sv.unmountComponentAtNode(this.node),this.node&&this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=void 0))}},{key:"appendNode",value:function(){var s=this.props,i=s.id,a=s.zIndex;this.node||(this.node=document.createElement("div"),i&&(this.node.id=i),a&&(this.node.style.zIndex=a),document.body.appendChild(this.node))}},{key:"renderPortal",value:function(){if(!bo())return null;var s=this.props,i=s.children,a=s.setRef;if(this.node||this.appendNode(),Gm)return sv.createPortal(i,this.node);var l=sv.unstable_renderSubtreeIntoContainer(this,i.length>1?oe.createElement("div",null,i):i[0],this.node);return a(l),null}},{key:"renderReact16",value:function(){var s=this.props,i=s.hasChildren,a=s.placement,l=s.target;return i?this.renderPortal():l||a==="center"?this.renderPortal():null}},{key:"render",value:function(){return Gm?this.renderReact16():null}}]),n})(oe.Component);Fs(oQ,"propTypes",{children:Ge.oneOfType([Ge.element,Ge.array]),hasChildren:Ge.bool,id:Ge.oneOfType([Ge.string,Ge.number]),placement:Ge.string,setRef:Ge.func.isRequired,target:Ge.oneOfType([Ge.object,Ge.string]),zIndex:Ge.number});var lQ=(function(t){ug(n,t);var e=dg(n);function n(){return lg(this,n),e.apply(this,arguments)}return cg(n,[{key:"parentStyle",get:function(){var s=this.props,i=s.placement,a=s.styles,l=a.arrow.length,c={pointerEvents:"none",position:"absolute",width:"100%"};return i.startsWith("top")?(c.bottom=0,c.left=0,c.right=0,c.height=l):i.startsWith("bottom")?(c.left=0,c.right=0,c.top=0,c.height=l):i.startsWith("left")?(c.right=0,c.top=0,c.bottom=0):i.startsWith("right")&&(c.left=0,c.top=0),c}},{key:"render",value:function(){var s=this.props,i=s.placement,a=s.setArrowRef,l=s.styles,c=l.arrow,d=c.color,h=c.display,m=c.length,g=c.margin,x=c.position,y=c.spread,w={display:h,position:x},S,k=y,j=m;return i.startsWith("top")?(S="0,0 ".concat(k/2,",").concat(j," ").concat(k,",0"),w.bottom=0,w.marginLeft=g,w.marginRight=g):i.startsWith("bottom")?(S="".concat(k,",").concat(j," ").concat(k/2,",0 0,").concat(j),w.top=0,w.marginLeft=g,w.marginRight=g):i.startsWith("left")?(j=y,k=m,S="0,0 ".concat(k,",").concat(j/2," 0,").concat(j),w.right=0,w.marginTop=g,w.marginBottom=g):i.startsWith("right")&&(j=y,k=m,S="".concat(k,",").concat(j," ").concat(k,",0 0,").concat(j/2),w.left=0,w.marginTop=g,w.marginBottom=g),oe.createElement("div",{className:"__floater__arrow",style:this.parentStyle},oe.createElement("span",{ref:a,style:w},oe.createElement("svg",{width:k,height:j,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},oe.createElement("polygon",{points:S,fill:d}))))}}]),n})(oe.Component);Fs(lQ,"propTypes",{placement:Ge.string.isRequired,setArrowRef:Ge.func.isRequired,styles:Ge.object.isRequired});var hxe=["color","height","width"];function cQ(t){var e=t.handleClick,n=t.styles,r=n.color,s=n.height,i=n.width,a=iQ(n,hxe);return oe.createElement("button",{"aria-label":"close",onClick:e,style:a,type:"button"},oe.createElement("svg",{width:"".concat(i,"px"),height:"".concat(s,"px"),viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid"},oe.createElement("g",null,oe.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:r}))))}cQ.propTypes={handleClick:Ge.func.isRequired,styles:Ge.object.isRequired};function uQ(t){var e=t.content,n=t.footer,r=t.handleClick,s=t.open,i=t.positionWrapper,a=t.showCloseButton,l=t.title,c=t.styles,d={content:oe.isValidElement(e)?e:oe.createElement("div",{className:"__floater__content",style:c.content},e)};return l&&(d.title=oe.isValidElement(l)?l:oe.createElement("div",{className:"__floater__title",style:c.title},l)),n&&(d.footer=oe.isValidElement(n)?n:oe.createElement("div",{className:"__floater__footer",style:c.footer},n)),(a||i)&&!Ee.boolean(s)&&(d.close=oe.createElement(cQ,{styles:c.close,handleClick:r})),oe.createElement("div",{className:"__floater__container",style:c.container},d.close,d.title,d.content,d.footer)}uQ.propTypes={content:Ge.node.isRequired,footer:Ge.node,handleClick:Ge.func.isRequired,open:Ge.bool,positionWrapper:Ge.bool.isRequired,showCloseButton:Ge.bool.isRequired,styles:Ge.object.isRequired,title:Ge.node};var dQ=(function(t){ug(n,t);var e=dg(n);function n(){return lg(this,n),e.apply(this,arguments)}return cg(n,[{key:"style",get:function(){var s=this.props,i=s.disableAnimation,a=s.component,l=s.placement,c=s.hideArrow,d=s.status,h=s.styles,m=h.arrow.length,g=h.floater,x=h.floaterCentered,y=h.floaterClosing,w=h.floaterOpening,S=h.floaterWithAnimation,k=h.floaterWithComponent,j={};return c||(l.startsWith("top")?j.padding="0 0 ".concat(m,"px"):l.startsWith("bottom")?j.padding="".concat(m,"px 0 0"):l.startsWith("left")?j.padding="0 ".concat(m,"px 0 0"):l.startsWith("right")&&(j.padding="0 0 0 ".concat(m,"px"))),[Tn.OPENING,Tn.OPEN].indexOf(d)!==-1&&(j=jr(jr({},j),w)),d===Tn.CLOSING&&(j=jr(jr({},j),y)),d===Tn.OPEN&&!i&&(j=jr(jr({},j),S)),l==="center"&&(j=jr(jr({},j),x)),a&&(j=jr(jr({},j),k)),jr(jr({},g),j)}},{key:"render",value:function(){var s=this.props,i=s.component,a=s.handleClick,l=s.hideArrow,c=s.setFloaterRef,d=s.status,h={},m=["__floater"];return i?oe.isValidElement(i)?h.content=oe.cloneElement(i,{closeFn:a}):h.content=i({closeFn:a}):h.content=oe.createElement(uQ,this.props),d===Tn.OPEN&&m.push("__floater__open"),l||(h.arrow=oe.createElement(lQ,this.props)),oe.createElement("div",{ref:c,className:m.join(" "),style:this.style},oe.createElement("div",{className:"__floater__body"},h.content,h.arrow))}}]),n})(oe.Component);Fs(dQ,"propTypes",{component:Ge.oneOfType([Ge.func,Ge.element]),content:Ge.node,disableAnimation:Ge.bool.isRequired,footer:Ge.node,handleClick:Ge.func.isRequired,hideArrow:Ge.bool.isRequired,open:Ge.bool,placement:Ge.string.isRequired,positionWrapper:Ge.bool.isRequired,setArrowRef:Ge.func.isRequired,setFloaterRef:Ge.func.isRequired,showCloseButton:Ge.bool,status:Ge.string.isRequired,styles:Ge.object.isRequired,title:Ge.node});var hQ=(function(t){ug(n,t);var e=dg(n);function n(){return lg(this,n),e.apply(this,arguments)}return cg(n,[{key:"render",value:function(){var s=this.props,i=s.children,a=s.handleClick,l=s.handleMouseEnter,c=s.handleMouseLeave,d=s.setChildRef,h=s.setWrapperRef,m=s.style,g=s.styles,x;if(i)if(oe.Children.count(i)===1)if(!oe.isValidElement(i))x=oe.createElement("span",null,i);else{var y=Ee.function(i.type)?"innerRef":"ref";x=oe.cloneElement(oe.Children.only(i),Fs({},y,d))}else x=i;return x?oe.createElement("span",{ref:h,style:jr(jr({},g),m),onClick:a,onMouseEnter:l,onMouseLeave:c},x):null}}]),n})(oe.Component);Fs(hQ,"propTypes",{children:Ge.node,handleClick:Ge.func.isRequired,handleMouseEnter:Ge.func.isRequired,handleMouseLeave:Ge.func.isRequired,setChildRef:Ge.func.isRequired,setWrapperRef:Ge.func.isRequired,style:Ge.object,styles:Ge.object.isRequired});var fxe={zIndex:100};function mxe(t){var e=Ua(fxe,t.options||{});return{wrapper:{cursor:"help",display:"inline-flex",flexDirection:"column",zIndex:e.zIndex},wrapperPosition:{left:-1e3,position:"absolute",top:-1e3,visibility:"hidden"},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:300,opacity:0,position:"relative",transition:"opacity 0.3s",visibility:"hidden",zIndex:e.zIndex},floaterOpening:{opacity:1,visibility:"visible"},floaterWithAnimation:{opacity:1,transition:"opacity 0.3s, transform 0.2s",visibility:"visible"},floaterWithComponent:{maxWidth:"100%"},floaterClosing:{opacity:0,visibility:"visible"},floaterCentered:{left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)"},container:{backgroundColor:"#fff",color:"#666",minHeight:60,minWidth:200,padding:20,position:"relative",zIndex:10},title:{borderBottom:"1px solid #555",color:"#555",fontSize:18,marginBottom:5,paddingBottom:6,paddingRight:18},content:{fontSize:15},close:{backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",fontSize:0,height:15,outline:"none",padding:10,position:"absolute",right:0,top:0,width:15,WebkitAppearance:"none"},footer:{borderTop:"1px solid #ccc",fontSize:13,marginTop:10,paddingTop:5},arrow:{color:"#fff",display:"inline-flex",length:16,margin:8,position:"absolute",spread:32},options:e}}var pxe=["arrow","flip","offset"],gxe=["position","top","right","bottom","left"],tN=(function(t){ug(n,t);var e=dg(n);function n(r){var s;return lg(this,n),s=e.call(this,r),Fs(El(s),"setArrowRef",function(i){s.arrowRef=i}),Fs(El(s),"setChildRef",function(i){s.childRef=i}),Fs(El(s),"setFloaterRef",function(i){s.floaterRef=i}),Fs(El(s),"setWrapperRef",function(i){s.wrapperRef=i}),Fs(El(s),"handleTransitionEnd",function(){var i=s.state.status,a=s.props.callback;s.wrapperPopper&&s.wrapperPopper.instance.update(),s.setState({status:i===Tn.OPENING?Tn.OPEN:Tn.IDLE},function(){var l=s.state.status;a(l===Tn.OPEN?"open":"close",s.props)})}),Fs(El(s),"handleClick",function(){var i=s.props,a=i.event,l=i.open;if(!Ee.boolean(l)){var c=s.state,d=c.positionWrapper,h=c.status;(s.event==="click"||s.event==="hover"&&d)&&(E1({title:"click",data:[{event:a,status:h===Tn.OPEN?"closing":"opening"}],debug:s.debug}),s.toggle())}}),Fs(El(s),"handleMouseEnter",function(){var i=s.props,a=i.event,l=i.open;if(!(Ee.boolean(l)||NS())){var c=s.state.status;s.event==="hover"&&c===Tn.IDLE&&(E1({title:"mouseEnter",data:[{key:"originalEvent",value:a}],debug:s.debug}),clearTimeout(s.eventDelayTimeout),s.toggle())}}),Fs(El(s),"handleMouseLeave",function(){var i=s.props,a=i.event,l=i.eventDelay,c=i.open;if(!(Ee.boolean(c)||NS())){var d=s.state,h=d.status,m=d.positionWrapper;s.event==="hover"&&(E1({title:"mouseLeave",data:[{key:"originalEvent",value:a}],debug:s.debug}),l?[Tn.OPENING,Tn.OPEN].indexOf(h)!==-1&&!m&&!s.eventDelayTimeout&&(s.eventDelayTimeout=setTimeout(function(){delete s.eventDelayTimeout,s.toggle()},l*1e3)):s.toggle(Tn.IDLE))}}),s.state={currentPlacement:r.placement,needsUpdate:!1,positionWrapper:r.wrapperOptions.position&&!!r.target,status:Tn.INIT,statusWrapper:Tn.INIT},s._isMounted=!1,s.hasMounted=!1,bo()&&window.addEventListener("load",function(){s.popper&&s.popper.instance.update(),s.wrapperPopper&&s.wrapperPopper.instance.update()}),s}return cg(n,[{key:"componentDidMount",value:function(){if(bo()){var s=this.state.positionWrapper,i=this.props,a=i.children,l=i.open,c=i.target;this._isMounted=!0,E1({title:"init",data:{hasChildren:!!a,hasTarget:!!c,isControlled:Ee.boolean(l),positionWrapper:s,target:this.target,floater:this.floaterRef},debug:this.debug}),this.hasMounted||(this.initPopper(),this.hasMounted=!0),!a&&c&&Ee.boolean(l)}}},{key:"componentDidUpdate",value:function(s,i){if(bo()){var a=this.props,l=a.autoOpen,c=a.open,d=a.target,h=a.wrapperOptions,m=Yge(i,this.state),g=m.changedFrom,x=m.changed;if(s.open!==c){var y;Ee.boolean(c)&&(y=c?Tn.OPENING:Tn.CLOSING),this.toggle(y)}(s.wrapperOptions.position!==h.position||s.target!==d)&&this.changeWrapperPosition(this.props),x("status",Tn.IDLE)&&c?this.toggle(Tn.OPEN):g("status",Tn.INIT,Tn.IDLE)&&l&&this.toggle(Tn.OPEN),this.popper&&x("status",Tn.OPENING)&&this.popper.instance.update(),this.floaterRef&&(x("status",Tn.OPENING)||x("status",Tn.CLOSING))&&dxe(this.floaterRef,"transitionend",this.handleTransitionEnd),x("needsUpdate",!0)&&this.rebuildPopper()}}},{key:"componentWillUnmount",value:function(){bo()&&(this._isMounted=!1,this.popper&&this.popper.instance.destroy(),this.wrapperPopper&&this.wrapperPopper.instance.destroy())}},{key:"initPopper",value:function(){var s=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.target,a=this.state.positionWrapper,l=this.props,c=l.disableFlip,d=l.getPopper,h=l.hideArrow,m=l.offset,g=l.placement,x=l.wrapperOptions,y=g==="top"||g==="bottom"?"flip":["right","bottom-end","top-end","left","top-start","bottom-start"];if(g==="center")this.setState({status:Tn.IDLE});else if(i&&this.floaterRef){var w=this.options,S=w.arrow,k=w.flip,j=w.offset,N=iQ(w,pxe);new hp(i,this.floaterRef,{placement:g,modifiers:jr({arrow:jr({enabled:!h,element:this.arrowRef},S),flip:jr({enabled:!c,behavior:y},k),offset:jr({offset:"0, ".concat(m,"px")},j)},N),onCreate:function(_){var A;if(s.popper=_,!((A=s.floaterRef)!==null&&A!==void 0&&A.isConnected)){s.setState({needsUpdate:!0});return}d(_,"floater"),s._isMounted&&s.setState({currentPlacement:_.placement,status:Tn.IDLE}),g!==_.placement&&setTimeout(function(){_.instance.update()},1)},onUpdate:function(_){s.popper=_;var A=s.state.currentPlacement;s._isMounted&&_.placement!==A&&s.setState({currentPlacement:_.placement})}})}if(a){var T=Ee.undefined(x.offset)?0:x.offset;new hp(this.target,this.wrapperRef,{placement:x.placement||g,modifiers:{arrow:{enabled:!1},offset:{offset:"0, ".concat(T,"px")},flip:{enabled:!1}},onCreate:function(_){s.wrapperPopper=_,s._isMounted&&s.setState({statusWrapper:Tn.IDLE}),d(_,"wrapper"),g!==_.placement&&setTimeout(function(){_.instance.update()},1)}})}}},{key:"rebuildPopper",value:function(){var s=this;this.floaterRefInterval=setInterval(function(){var i;(i=s.floaterRef)!==null&&i!==void 0&&i.isConnected&&(clearInterval(s.floaterRefInterval),s.setState({needsUpdate:!1}),s.initPopper())},50)}},{key:"changeWrapperPosition",value:function(s){var i=s.target,a=s.wrapperOptions;this.setState({positionWrapper:a.position&&!!i})}},{key:"toggle",value:function(s){var i=this.state.status,a=i===Tn.OPEN?Tn.CLOSING:Tn.OPENING;Ee.undefined(s)||(a=s),this.setState({status:a})}},{key:"debug",get:function(){var s=this.props.debug;return s||bo()&&"ReactFloaterDebug"in window&&!!window.ReactFloaterDebug}},{key:"event",get:function(){var s=this.props,i=s.disableHoverToClick,a=s.event;return a==="hover"&&NS()&&!i?"click":a}},{key:"options",get:function(){var s=this.props.options;return Ua(nxe,s||{})}},{key:"styles",get:function(){var s=this,i=this.state,a=i.status,l=i.positionWrapper,c=i.statusWrapper,d=this.props.styles,h=Ua(mxe(d),d);if(l){var m;[Tn.IDLE].indexOf(a)===-1||[Tn.IDLE].indexOf(c)===-1?m=h.wrapperPosition:m=this.wrapperPopper.styles,h.wrapper=jr(jr({},h.wrapper),m)}if(this.target){var g=window.getComputedStyle(this.target);this.wrapperStyles?h.wrapper=jr(jr({},h.wrapper),this.wrapperStyles):["relative","static"].indexOf(g.position)===-1&&(this.wrapperStyles={},l||(gxe.forEach(function(x){s.wrapperStyles[x]=g[x]}),h.wrapper=jr(jr({},h.wrapper),this.wrapperStyles),this.target.style.position="relative",this.target.style.top="auto",this.target.style.right="auto",this.target.style.bottom="auto",this.target.style.left="auto"))}return h}},{key:"target",get:function(){if(!bo())return null;var s=this.props.target;return s?Ee.domElement(s)?s:document.querySelector(s):this.childRef||this.wrapperRef}},{key:"render",value:function(){var s=this.state,i=s.currentPlacement,a=s.positionWrapper,l=s.status,c=this.props,d=c.children,h=c.component,m=c.content,g=c.disableAnimation,x=c.footer,y=c.hideArrow,w=c.id,S=c.open,k=c.showCloseButton,j=c.style,N=c.target,T=c.title,E=oe.createElement(hQ,{handleClick:this.handleClick,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,setChildRef:this.setChildRef,setWrapperRef:this.setWrapperRef,style:j,styles:this.styles.wrapper},d),_={};return a?_.wrapperInPortal=E:_.wrapperAsChildren=E,oe.createElement("span",null,oe.createElement(oQ,{hasChildren:!!d,id:w,placement:i,setRef:this.setFloaterRef,target:N,zIndex:this.styles.options.zIndex},oe.createElement(dQ,{component:h,content:m,disableAnimation:g,footer:x,handleClick:this.handleClick,hideArrow:y||i==="center",open:S,placement:i,positionWrapper:a,setArrowRef:this.setArrowRef,setFloaterRef:this.setFloaterRef,showCloseButton:k,status:l,styles:this.styles,title:T}),_.wrapperInPortal),_.wrapperAsChildren)}}]),n})(oe.Component);Fs(tN,"propTypes",{autoOpen:Ge.bool,callback:Ge.func,children:Ge.node,component:ZA(Ge.oneOfType([Ge.func,Ge.element]),function(t){return!t.content}),content:ZA(Ge.node,function(t){return!t.component}),debug:Ge.bool,disableAnimation:Ge.bool,disableFlip:Ge.bool,disableHoverToClick:Ge.bool,event:Ge.oneOf(["hover","click"]),eventDelay:Ge.number,footer:Ge.node,getPopper:Ge.func,hideArrow:Ge.bool,id:Ge.oneOfType([Ge.string,Ge.number]),offset:Ge.number,open:Ge.bool,options:Ge.object,placement:Ge.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto","center"]),showCloseButton:Ge.bool,style:Ge.object,styles:Ge.object,target:Ge.oneOfType([Ge.object,Ge.string]),title:Ge.node,wrapperOptions:Ge.shape({offset:Ge.number,placement:Ge.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto"]),position:Ge.bool})});Fs(tN,"defaultProps",{autoOpen:!1,callback:JA,debug:!1,disableAnimation:!1,disableFlip:!1,disableHoverToClick:!1,event:"click",eventDelay:.4,getPopper:JA,hideArrow:!1,offset:15,placement:"bottom",showCloseButton:!1,styles:{},target:null,wrapperOptions:{position:!1}});var xxe=Object.defineProperty,vxe=(t,e,n)=>e in t?xxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xt=(t,e,n)=>vxe(t,typeof e!="symbol"?e+"":e,n),Yn={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update"},Va={TOUR_START:"tour:start",STEP_BEFORE:"step:before",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found"},Xt={INIT:"init",READY:"ready",BEACON:"beacon",TOOLTIP:"tooltip",COMPLETE:"complete",ERROR:"error"},wn={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"};function Fc(){var t;return!!(typeof window<"u"&&((t=window.document)!=null&&t.createElement))}function fQ(t){return t?t.getBoundingClientRect():null}function yxe(t=!1){const{body:e,documentElement:n}=document;if(!e||!n)return 0;if(t){const r=[e.scrollHeight,e.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,a)=>i-a),s=Math.floor(r.length/2);return r.length%2===0?(r[s-1]+r[s])/2:r[s]}return Math.max(e.scrollHeight,e.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function Pl(t){if(typeof t=="string")try{return document.querySelector(t)}catch{return null}return t}function bxe(t){return!t||t.nodeType!==1?null:getComputedStyle(t)}function fp(t,e,n){if(!t)return Xu();const r=qH(t);if(r){if(r.isSameNode(Xu()))return n?document:Xu();if(!(r.scrollHeight>r.offsetHeight)&&!e)return r.style.overflow="initial",Xu()}return r}function Db(t,e){if(!t)return!1;const n=fp(t,e);return n?!n.isSameNode(Xu()):!1}function wxe(t){return t.offsetParent!==document.body}function df(t,e="fixed"){if(!t||!(t instanceof HTMLElement))return!1;const{nodeName:n}=t,r=bxe(t);return n==="BODY"||n==="HTML"?!1:r&&r.position===e?!0:t.parentNode?df(t.parentNode,e):!1}function Sxe(t){var e;if(!t)return!1;let n=t;for(;n&&n!==document.body;){if(n instanceof HTMLElement){const{display:r,visibility:s}=getComputedStyle(n);if(r==="none"||s==="hidden")return!1}n=(e=n.parentElement)!=null?e:null}return!0}function kxe(t,e,n){var r,s,i;const a=fQ(t),l=fp(t,n),c=Db(t,n),d=df(t);let h=0,m=(r=a?.top)!=null?r:0;if(c&&d){const g=(s=t?.offsetTop)!=null?s:0,x=(i=l?.scrollTop)!=null?i:0;m=g-x}else l instanceof HTMLElement&&(h=l.scrollTop,!c&&!df(t)&&(m+=h),l.isSameNode(Xu())||(m+=Xu().scrollTop));return Math.floor(m-e)}function Oxe(t,e,n){var r;if(!t)return 0;const{offsetTop:s=0,scrollTop:i=0}=(r=qH(t))!=null?r:{};let a=t.getBoundingClientRect().top+i;s&&(Db(t,n)||wxe(t))&&(a-=s);const l=Math.floor(a-e);return l<0?0:l}function Xu(){var t;return(t=document.scrollingElement)!=null?t:document.documentElement}function jxe(t,e){const{duration:n,element:r}=e;return new Promise((s,i)=>{const{scrollTop:a}=r,l=t>a?t-a:a-t;Qpe.top(r,t,{duration:l<100?50:n},c=>c&&c.message!=="Element already at target scroll position"?i(c):s())})}var Xm=ya.createPortal!==void 0;function mQ(t=navigator.userAgent){let e=t;return typeof window>"u"?e="node":document.documentMode?e="ie":/Edge/.test(t)?e="edge":window.opera||t.includes(" OPR/")?e="opera":typeof window.InstallTrigger<"u"?e="firefox":window.chrome?e="chrome":/(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(t)&&(e="safari"),e}function jv(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function wo(t,e={}){const{defaultValue:n,step:r,steps:s}=e;let i=IA(t);if(i)(i.includes("{step}")||i.includes("{steps}"))&&r&&s&&(i=i.replace("{step}",r.toString()).replace("{steps}",s.toString()));else if(b.isValidElement(t)&&!Object.values(t.props).length&&jv(t.type)==="function"){const a=t.type({});i=wo(a,e)}else i=IA(n);return i}function Nxe(t,e){return!pt.plainObject(t)||!pt.array(e)?!1:Object.keys(t).every(n=>e.includes(n))}function Cxe(t){const e=/^#?([\da-f])([\da-f])([\da-f])$/i,n=t.replace(e,(s,i,a,l)=>i+i+a+a+l+l),r=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(n);return r?[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]:[]}function eM(t){return t.disableBeacon||t.placement==="center"}function tM(){return!["chrome","safari","firefox","opera"].includes(mQ())}function pd({data:t,debug:e=!1,title:n,warn:r=!1}){const s=r?console.warn||console.error:console.log;e&&(n&&t?(console.groupCollapsed(`%creact-joyride: ${n}`,"color: #ff0044; font-weight: bold; font-size: 12px;"),Array.isArray(t)?t.forEach(i=>{pt.plainObject(i)&&i.key?s.apply(console,[i.key,i.value]):s.apply(console,[i])}):s.apply(console,[t]),console.groupEnd()):console.error("Missing title or data props"))}function Txe(t){return Object.keys(t)}function pQ(t,...e){if(!pt.plainObject(t))throw new TypeError("Expected an object");const n={};for(const r in t)({}).hasOwnProperty.call(t,r)&&(e.includes(r)||(n[r]=t[r]));return n}function Exe(t,...e){if(!pt.plainObject(t))throw new TypeError("Expected an object");if(!e.length)return t;const n={};for(const r in t)({}).hasOwnProperty.call(t,r)&&e.includes(r)&&(n[r]=t[r]);return n}function jO(t,e,n){const r=i=>i.replace("{step}",String(e)).replace("{steps}",String(n));if(jv(t)==="string")return r(t);if(!b.isValidElement(t))return t;const{children:s}=t.props;if(jv(s)==="string"&&s.includes("{step}"))return b.cloneElement(t,{children:r(s)});if(Array.isArray(s))return b.cloneElement(t,{children:s.map(i=>typeof i=="string"?r(i):jO(i,e,n))});if(jv(t.type)==="function"&&!Object.values(t.props).length){const i=t.type({});return jO(i,e,n)}return t}function _xe(t){const{isFirstStep:e,lifecycle:n,previousLifecycle:r,scrollToFirstStep:s,step:i,target:a}=t;return!i.disableScrolling&&(!e||s||n===Xt.TOOLTIP)&&i.placement!=="center"&&(!i.isFixed||!df(a))&&r!==n&&[Xt.BEACON,Xt.TOOLTIP].includes(n)}var Axe={options:{preventOverflow:{boundariesElement:"scrollParent"}},wrapperOptions:{offset:-18,position:!0}},gQ={back:"Back",close:"Close",last:"Last",next:"Next",nextLabelWithProgress:"Next (Step {step} of {steps})",open:"Open the dialog",skip:"Skip"},Mxe={event:"click",placement:"bottom",offset:10,disableBeacon:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrollParentFix:!1,disableScrolling:!1,hideBackButton:!1,hideCloseButton:!1,hideFooter:!1,isFixed:!1,locale:gQ,showProgress:!1,showSkipButton:!1,spotlightClicks:!1,spotlightPadding:10},Rxe={continuous:!1,debug:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrolling:!1,disableScrollParentFix:!1,getHelpers:void 0,hideBackButton:!1,run:!0,scrollOffset:20,scrollDuration:300,scrollToFirstStep:!1,showSkipButton:!1,showProgress:!1,spotlightClicks:!1,spotlightPadding:10,steps:[]},Dxe={arrowColor:"#fff",backgroundColor:"#fff",beaconSize:36,overlayColor:"rgba(0, 0, 0, 0.5)",primaryColor:"#f04",spotlightShadow:"0 0 15px rgba(0, 0, 0, 0.5)",textColor:"#333",width:380,zIndex:100},Ym={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",cursor:"pointer",fontSize:16,lineHeight:1,padding:8,WebkitAppearance:"none"},nM={borderRadius:4,position:"absolute"};function Pxe(t,e){var n,r,s,i,a;const{floaterProps:l,styles:c}=t,d=Ua((n=e.floaterProps)!=null?n:{},l??{}),h=Ua(c??{},(r=e.styles)!=null?r:{}),m=Ua(Dxe,h.options||{}),g=e.placement==="center"||e.disableBeacon;let{width:x}=m;window.innerWidth>480&&(x=380),"width"in m&&(x=typeof m.width=="number"&&window.innerWidthxQ(n,e)):(pd({title:"validateSteps",data:"steps must be an array",warn:!0,debug:e}),!1)}var vQ={action:"init",controlled:!1,index:0,lifecycle:Xt.INIT,origin:null,size:0,status:wn.IDLE},sM=Txe(pQ(vQ,"controlled","size")),Ixe=class{constructor(t){xt(this,"beaconPopper"),xt(this,"tooltipPopper"),xt(this,"data",new Map),xt(this,"listener"),xt(this,"store",new Map),xt(this,"addListener",s=>{this.listener=s}),xt(this,"setSteps",s=>{const{size:i,status:a}=this.getState(),l={size:s.length,status:a};this.data.set("steps",s),a===wn.WAITING&&!i&&s.length&&(l.status=wn.RUNNING),this.setState(l)}),xt(this,"getPopper",s=>s==="beacon"?this.beaconPopper:this.tooltipPopper),xt(this,"setPopper",(s,i)=>{s==="beacon"?this.beaconPopper=i:this.tooltipPopper=i}),xt(this,"cleanupPoppers",()=>{this.beaconPopper=null,this.tooltipPopper=null}),xt(this,"close",(s=null)=>{const{index:i,status:a}=this.getState();a===wn.RUNNING&&this.setState({...this.getNextState({action:Yn.CLOSE,index:i+1,origin:s})})}),xt(this,"go",s=>{const{controlled:i,status:a}=this.getState();if(i||a!==wn.RUNNING)return;const l=this.getSteps()[s];this.setState({...this.getNextState({action:Yn.GO,index:s}),status:l?a:wn.FINISHED})}),xt(this,"info",()=>this.getState()),xt(this,"next",()=>{const{index:s,status:i}=this.getState();i===wn.RUNNING&&this.setState(this.getNextState({action:Yn.NEXT,index:s+1}))}),xt(this,"open",()=>{const{status:s}=this.getState();s===wn.RUNNING&&this.setState({...this.getNextState({action:Yn.UPDATE,lifecycle:Xt.TOOLTIP})})}),xt(this,"prev",()=>{const{index:s,status:i}=this.getState();i===wn.RUNNING&&this.setState({...this.getNextState({action:Yn.PREV,index:s-1})})}),xt(this,"reset",(s=!1)=>{const{controlled:i}=this.getState();i||this.setState({...this.getNextState({action:Yn.RESET,index:0}),status:s?wn.RUNNING:wn.READY})}),xt(this,"skip",()=>{const{status:s}=this.getState();s===wn.RUNNING&&this.setState({action:Yn.SKIP,lifecycle:Xt.INIT,status:wn.SKIPPED})}),xt(this,"start",s=>{const{index:i,size:a}=this.getState();this.setState({...this.getNextState({action:Yn.START,index:pt.number(s)?s:i},!0),status:a?wn.RUNNING:wn.WAITING})}),xt(this,"stop",(s=!1)=>{const{index:i,status:a}=this.getState();[wn.FINISHED,wn.SKIPPED].includes(a)||this.setState({...this.getNextState({action:Yn.STOP,index:i+(s?1:0)}),status:wn.PAUSED})}),xt(this,"update",s=>{var i,a;if(!Nxe(s,sM))throw new Error(`State is not valid. Valid keys: ${sM.join(", ")}`);this.setState({...this.getNextState({...this.getState(),...s,action:(i=s.action)!=null?i:Yn.UPDATE,origin:(a=s.origin)!=null?a:null},!0)})});const{continuous:e=!1,stepIndex:n,steps:r=[]}=t??{};this.setState({action:Yn.INIT,controlled:pt.number(n),continuous:e,index:pt.number(n)?n:0,lifecycle:Xt.INIT,origin:null,status:r.length?wn.READY:wn.IDLE},!0),this.beaconPopper=null,this.tooltipPopper=null,this.listener=null,this.setSteps(r)}getState(){return this.store.size?{action:this.store.get("action")||"",controlled:this.store.get("controlled")||!1,index:parseInt(this.store.get("index"),10),lifecycle:this.store.get("lifecycle")||"",origin:this.store.get("origin")||null,size:this.store.get("size")||0,status:this.store.get("status")||""}:{...vQ}}getNextState(t,e=!1){var n,r,s,i,a;const{action:l,controlled:c,index:d,size:h,status:m}=this.getState(),g=pt.number(t.index)?t.index:d,x=c&&!e?d:Math.min(Math.max(g,0),h);return{action:(n=t.action)!=null?n:l,controlled:c,index:x,lifecycle:(r=t.lifecycle)!=null?r:Xt.INIT,origin:(s=t.origin)!=null?s:null,size:(i=t.size)!=null?i:h,status:x===h?wn.FINISHED:(a=t.status)!=null?a:m}}getSteps(){const t=this.data.get("steps");return Array.isArray(t)?t:[]}hasUpdatedState(t){const e=JSON.stringify(t),n=JSON.stringify(this.getState());return e!==n}setState(t,e=!1){const n=this.getState(),{action:r,index:s,lifecycle:i,origin:a=null,size:l,status:c}={...n,...t};this.store.set("action",r),this.store.set("index",s),this.store.set("lifecycle",i),this.store.set("origin",a),this.store.set("size",l),this.store.set("status",c),e&&(this.store.set("controlled",t.controlled),this.store.set("continuous",t.continuous)),this.listener&&this.hasUpdatedState(n)&&this.listener(this.getState())}getHelpers(){return{close:this.close,go:this.go,info:this.info,next:this.next,open:this.open,prev:this.prev,reset:this.reset,skip:this.skip}}};function Lxe(t){return new Ixe(t)}function Bxe({styles:t}){return b.createElement("div",{key:"JoyrideSpotlight",className:"react-joyride__spotlight","data-test-id":"spotlight",style:t})}var Fxe=Bxe,qxe=class extends b.Component{constructor(){super(...arguments),xt(this,"isActive",!1),xt(this,"resizeTimeout"),xt(this,"scrollTimeout"),xt(this,"scrollParent"),xt(this,"state",{isScrolling:!1,mouseOverSpotlight:!1,showSpotlight:!0}),xt(this,"hideSpotlight",()=>{const{continuous:t,disableOverlay:e,lifecycle:n}=this.props,r=[Xt.INIT,Xt.BEACON,Xt.COMPLETE,Xt.ERROR];return e||(t?r.includes(n):n!==Xt.TOOLTIP)}),xt(this,"handleMouseMove",t=>{const{mouseOverSpotlight:e}=this.state,{height:n,left:r,position:s,top:i,width:a}=this.spotlightStyles,l=s==="fixed"?t.clientY:t.pageY,c=s==="fixed"?t.clientX:t.pageX,d=l>=i&&l<=i+n,m=c>=r&&c<=r+a&&d;m!==e&&this.updateState({mouseOverSpotlight:m})}),xt(this,"handleScroll",()=>{const{target:t}=this.props,e=Pl(t);if(this.scrollParent!==document){const{isScrolling:n}=this.state;n||this.updateState({isScrolling:!0,showSpotlight:!1}),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.updateState({isScrolling:!1,showSpotlight:!0})},50)}else df(e,"sticky")&&this.updateState({})}),xt(this,"handleResize",()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.isActive&&this.forceUpdate()},100)})}componentDidMount(){const{debug:t,disableScrolling:e,disableScrollParentFix:n=!1,target:r}=this.props,s=Pl(r);this.scrollParent=fp(s??document.body,n,!0),this.isActive=!0,window.addEventListener("resize",this.handleResize)}componentDidUpdate(t){var e;const{disableScrollParentFix:n,lifecycle:r,spotlightClicks:s,target:i}=this.props,{changed:a}=py(t,this.props);if(a("target")||a("disableScrollParentFix")){const l=Pl(i);this.scrollParent=fp(l??document.body,n,!0)}a("lifecycle",Xt.TOOLTIP)&&((e=this.scrollParent)==null||e.addEventListener("scroll",this.handleScroll,{passive:!0}),setTimeout(()=>{const{isScrolling:l}=this.state;l||this.updateState({showSpotlight:!0})},100)),(a("spotlightClicks")||a("disableOverlay")||a("lifecycle"))&&(s&&r===Xt.TOOLTIP?window.addEventListener("mousemove",this.handleMouseMove,!1):r!==Xt.TOOLTIP&&window.removeEventListener("mousemove",this.handleMouseMove))}componentWillUnmount(){var t;this.isActive=!1,window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("resize",this.handleResize),clearTimeout(this.resizeTimeout),clearTimeout(this.scrollTimeout),(t=this.scrollParent)==null||t.removeEventListener("scroll",this.handleScroll)}get overlayStyles(){const{mouseOverSpotlight:t}=this.state,{disableOverlayClose:e,placement:n,styles:r}=this.props;let s=r.overlay;return tM()&&(s=n==="center"?r.overlayLegacyCenter:r.overlayLegacy),{cursor:e?"default":"pointer",height:yxe(),pointerEvents:t?"none":"auto",...s}}get spotlightStyles(){var t,e,n;const{showSpotlight:r}=this.state,{disableScrollParentFix:s=!1,spotlightClicks:i,spotlightPadding:a=0,styles:l,target:c}=this.props,d=Pl(c),h=fQ(d),m=df(d),g=kxe(d,a,s);return{...tM()?l.spotlightLegacy:l.spotlight,height:Math.round(((t=h?.height)!=null?t:0)+a*2),left:Math.round(((e=h?.left)!=null?e:0)-a),opacity:r?1:0,pointerEvents:i?"none":"auto",position:m?"fixed":"absolute",top:g,transition:"opacity 0.2s",width:Math.round(((n=h?.width)!=null?n:0)+a*2)}}updateState(t){this.isActive&&this.setState(e=>({...e,...t}))}render(){const{showSpotlight:t}=this.state,{onClickOverlay:e,placement:n}=this.props,{hideSpotlight:r,overlayStyles:s,spotlightStyles:i}=this;if(r())return null;let a=n!=="center"&&t&&b.createElement(Fxe,{styles:i});if(mQ()==="safari"){const{mixBlendMode:l,zIndex:c,...d}=s;a=b.createElement("div",{style:{...d}},a),delete s.backgroundColor}return b.createElement("div",{className:"react-joyride__overlay","data-test-id":"overlay",onClick:e,role:"presentation",style:s},a)}},$xe=class extends b.Component{constructor(){super(...arguments),xt(this,"node",null)}componentDidMount(){const{id:t}=this.props;Fc()&&(this.node=document.createElement("div"),this.node.id=t,document.body.appendChild(this.node),Xm||this.renderReact15())}componentDidUpdate(){Fc()&&(Xm||this.renderReact15())}componentWillUnmount(){!Fc()||!this.node||(Xm||ya.unmountComponentAtNode(this.node),this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=null))}renderReact15(){if(!Fc())return;const{children:t}=this.props;this.node&&ya.unstable_renderSubtreeIntoContainer(this,t,this.node)}renderReact16(){if(!Fc()||!Xm)return null;const{children:t}=this.props;return this.node?ya.createPortal(t,this.node):null}render(){return Xm?this.renderReact16():null}},Hxe=class{constructor(t,e){if(xt(this,"element"),xt(this,"options"),xt(this,"canBeTabbed",n=>{const{tabIndex:r}=n;return r===null||r<0?!1:this.canHaveFocus(n)}),xt(this,"canHaveFocus",n=>{const r=/input|select|textarea|button|object/,s=n.nodeName.toLowerCase();return(r.test(s)&&!n.getAttribute("disabled")||s==="a"&&!!n.getAttribute("href"))&&this.isVisible(n)}),xt(this,"findValidTabElements",()=>[].slice.call(this.element.querySelectorAll("*"),0).filter(this.canBeTabbed)),xt(this,"handleKeyDown",n=>{const{code:r="Tab"}=this.options;n.code===r&&this.interceptTab(n)}),xt(this,"interceptTab",n=>{n.preventDefault();const r=this.findValidTabElements(),{shiftKey:s}=n;if(!r.length)return;let i=document.activeElement?r.indexOf(document.activeElement):0;i===-1||!s&&i+1===r.length?i=0:s&&i===0?i=r.length-1:i+=s?-1:1,r[i].focus()}),xt(this,"isHidden",n=>{const r=n.offsetWidth<=0&&n.offsetHeight<=0,s=window.getComputedStyle(n);return r&&!n.innerHTML?!0:r&&s.getPropertyValue("overflow")!=="visible"||s.getPropertyValue("display")==="none"}),xt(this,"isVisible",n=>{let r=n;for(;r;)if(r instanceof HTMLElement){if(r===document.body)break;if(this.isHidden(r))return!1;r=r.parentNode}return!0}),xt(this,"removeScope",()=>{window.removeEventListener("keydown",this.handleKeyDown)}),xt(this,"checkFocus",n=>{document.activeElement!==n&&(n.focus(),window.requestAnimationFrame(()=>this.checkFocus(n)))}),xt(this,"setFocus",()=>{const{selector:n}=this.options;if(!n)return;const r=this.element.querySelector(n);r&&window.requestAnimationFrame(()=>this.checkFocus(r))}),!(t instanceof HTMLElement))throw new TypeError("Invalid parameter: element must be an HTMLElement");this.element=t,this.options=e,window.addEventListener("keydown",this.handleKeyDown,!1),this.setFocus()}},Qxe=class extends b.Component{constructor(t){if(super(t),xt(this,"beacon",null),xt(this,"setBeaconRef",s=>{this.beacon=s}),t.beaconComponent)return;const e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id="joyride-beacon-animation",t.nonce&&n.setAttribute("nonce",t.nonce),n.appendChild(document.createTextNode(` @keyframes joyride-beacon-inner { 20% { opacity: 0.9; @@ -85,45 +85,45 @@ reaction = "${T.reaction}"`;return o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,chi transform: scale(1); } } - `)),e.appendChild(n)}componentDidMount(){const{shouldFocus:t}=this.props;setTimeout(()=>{ft.domElement(this.beacon)&&t&&this.beacon.focus()},0)}componentWillUnmount(){const t=document.getElementById("joyride-beacon-animation");t?.parentNode&&t.parentNode.removeChild(t)}render(){const{beaconComponent:t,continuous:e,index:n,isLastStep:r,locale:s,onClickOrHover:i,size:a,step:l,styles:c}=this.props,d=yo(s.open),h={"aria-label":d,onClick:i,onMouseEnter:i,ref:this.setBeaconRef,title:d};let m;if(t){const g=t;m=b.createElement(g,{continuous:e,index:n,isLastStep:r,size:a,step:l,...h})}else m=b.createElement("button",{key:"JoyrideBeacon",className:"react-joyride__beacon","data-test-id":"button-beacon",style:c.beacon,type:"button",...h},b.createElement("span",{style:c.beaconInner}),b.createElement("span",{style:c.beaconOuter}));return m}};function qxe({styles:t,...e}){const{color:n,height:r,width:s,...i}=t;return ae.createElement("button",{style:i,type:"button",...e},ae.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof s=="number"?`${s}px`:s,xmlns:"http://www.w3.org/2000/svg"},ae.createElement("g",null,ae.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:n}))))}var $xe=qxe;function Hxe(t){const{backProps:e,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:c}=t,{content:d,hideBackButton:h,hideCloseButton:m,hideFooter:g,showSkipButton:x,styles:y,title:w}=l,S={};return S.primary=b.createElement("button",{"data-test-id":"button-primary",style:y.buttonNext,type:"button",...i}),x&&!s&&(S.skip=b.createElement("button",{"aria-live":"off","data-test-id":"button-skip",style:y.buttonSkip,type:"button",...a})),!h&&r>0&&(S.back=b.createElement("button",{"data-test-id":"button-back",style:y.buttonBack,type:"button",...e})),S.close=!m&&b.createElement($xe,{"data-test-id":"button-close",styles:y.buttonClose,...n}),b.createElement("div",{key:"JoyrideTooltip","aria-label":yo(w??d),className:"react-joyride__tooltip",style:y.tooltip,...c},b.createElement("div",{style:y.tooltipContainer},w&&b.createElement("h1",{"aria-label":yo(w),style:y.tooltipTitle},w),b.createElement("div",{style:y.tooltipContent},d)),!g&&b.createElement("div",{style:y.tooltipFooter},b.createElement("div",{style:y.tooltipFooterSpacer},S.skip),S.back,S.primary),S.close)}var Qxe=Hxe,Vxe=class extends b.Component{constructor(){super(...arguments),gt(this,"handleClickBack",t=>{t.preventDefault();const{helpers:e}=this.props;e.prev()}),gt(this,"handleClickClose",t=>{t.preventDefault();const{helpers:e}=this.props;e.close("button_close")}),gt(this,"handleClickPrimary",t=>{t.preventDefault();const{continuous:e,helpers:n}=this.props;if(!e){n.close("button_primary");return}n.next()}),gt(this,"handleClickSkip",t=>{t.preventDefault();const{helpers:e}=this.props;e.skip()}),gt(this,"getElementsProps",()=>{const{continuous:t,index:e,isLastStep:n,setTooltipRef:r,size:s,step:i}=this.props,{back:a,close:l,last:c,next:d,nextLabelWithProgress:h,skip:m}=i.locale,g=yo(a),x=yo(l),y=yo(c),w=yo(d),S=yo(m);let k=l,j=x;if(t){if(k=d,j=w,i.showProgress&&!n){const N=yo(h,{step:e+1,steps:s});k=SO(h,e+1,s),j=N}n&&(k=c,j=y)}return{backProps:{"aria-label":g,children:a,"data-action":"back",onClick:this.handleClickBack,role:"button",title:g},closeProps:{"aria-label":x,children:l,"data-action":"close",onClick:this.handleClickClose,role:"button",title:x},primaryProps:{"aria-label":j,children:k,"data-action":"primary",onClick:this.handleClickPrimary,role:"button",title:j},skipProps:{"aria-label":S,children:m,"data-action":"skip",onClick:this.handleClickSkip,role:"button",title:S},tooltipProps:{"aria-modal":!0,ref:r,role:"alertdialog"}}})}render(){const{continuous:t,index:e,isLastStep:n,setTooltipRef:r,size:s,step:i}=this.props,{beaconComponent:a,tooltipComponent:l,...c}=i;let d;if(l){const h={...this.getElementsProps(),continuous:t,index:e,isLastStep:n,size:s,step:c,setTooltipRef:r},m=l;d=b.createElement(m,{...h})}else d=b.createElement(Qxe,{...this.getElementsProps(),continuous:t,index:e,isLastStep:n,size:s,step:i});return d}},Uxe=class extends b.Component{constructor(){super(...arguments),gt(this,"scope",null),gt(this,"tooltip",null),gt(this,"handleClickHoverBeacon",t=>{const{step:e,store:n}=this.props;t.type==="mouseenter"&&e.event!=="hover"||n.update({lifecycle:Qt.TOOLTIP})}),gt(this,"setTooltipRef",t=>{this.tooltip=t}),gt(this,"setPopper",(t,e)=>{var n;const{action:r,lifecycle:s,step:i,store:a}=this.props;e==="wrapper"?a.setPopper("beacon",t):a.setPopper("tooltip",t),a.getPopper("beacon")&&(a.getPopper("tooltip")||i.placement==="center")&&s===Qt.INIT&&a.update({action:r,lifecycle:Qt.READY}),(n=i.floaterProps)!=null&&n.getPopper&&i.floaterProps.getPopper(t,e)}),gt(this,"renderTooltip",t=>{const{continuous:e,helpers:n,index:r,size:s,step:i}=this.props;return b.createElement(Vxe,{continuous:e,helpers:n,index:r,isLastStep:r+1===s,setTooltipRef:this.setTooltipRef,size:s,step:i,...t})})}componentDidMount(){const{debug:t,index:e}=this.props;hd({title:`step:${e}`,data:[{key:"props",value:this.props}],debug:t})}componentDidUpdate(t){var e;const{action:n,callback:r,continuous:s,controlled:i,debug:a,helpers:l,index:c,lifecycle:d,shouldScroll:h,status:m,step:g,store:x}=this.props,{changed:y,changedFrom:w}=uy(t,this.props),S=l.info(),k=s&&n!==Qn.CLOSE&&(c>0||n===Qn.PREV),j=y("action")||y("index")||y("lifecycle")||y("status"),N=w("lifecycle",[Qt.TOOLTIP,Qt.INIT],Qt.INIT),T=y("action",[Qn.NEXT,Qn.PREV,Qn.SKIP,Qn.CLOSE]),E=i&&c===t.index;if(T&&(N||E)&&r({...S,index:t.index,lifecycle:Qt.COMPLETE,step:t.step,type:Qa.STEP_AFTER}),g.placement==="center"&&m===mn.RUNNING&&y("index")&&n!==Qn.START&&d===Qt.INIT&&x.update({lifecycle:Qt.READY}),j){const _=Ml(g.target),A=!!_;A&&vxe(_)?(w("status",mn.READY,mn.RUNNING)||w("lifecycle",Qt.INIT,Qt.READY))&&r({...S,step:g,type:Qa.STEP_BEFORE}):(console.warn(A?"Target not visible":"Target not mounted",g),r({...S,type:Qa.TARGET_NOT_FOUND,step:g}),i||x.update({index:c+(n===Qn.PREV?-1:1)}))}w("lifecycle",Qt.INIT,Qt.READY)&&x.update({lifecycle:GA(g)||k?Qt.TOOLTIP:Qt.BEACON}),y("index")&&hd({title:`step:${d}`,data:[{key:"props",value:this.props}],debug:a}),y("lifecycle",Qt.BEACON)&&r({...S,step:g,type:Qa.BEACON}),y("lifecycle",Qt.TOOLTIP)&&(r({...S,step:g,type:Qa.TOOLTIP}),h&&this.tooltip&&(this.scope=new Bxe(this.tooltip,{selector:"[data-action=primary]"}),this.scope.setFocus())),w("lifecycle",[Qt.TOOLTIP,Qt.INIT],Qt.INIT)&&((e=this.scope)==null||e.removeScope(),x.cleanupPoppers())}componentWillUnmount(){var t;(t=this.scope)==null||t.removeScope()}get open(){const{lifecycle:t,step:e}=this.props;return GA(e)||t===Qt.TOOLTIP}render(){const{continuous:t,debug:e,index:n,nonce:r,shouldScroll:s,size:i,step:a}=this.props,l=Ml(a.target);return!fQ(a)||!ft.domElement(l)?null:b.createElement("div",{key:`JoyrideStep-${n}`,className:"react-joyride__step"},b.createElement(X6,{...a.floaterProps,component:this.renderTooltip,debug:e,getPopper:this.setPopper,id:`react-joyride-step-${n}`,open:this.open,placement:a.placement,target:a.target},b.createElement(Fxe,{beaconComponent:a.beaconComponent,continuous:t,index:n,isLastStep:n+1===i,locale:a.locale,nonce:r,onClickOrHover:this.handleClickHoverBeacon,shouldFocus:s,size:i,step:a,styles:a.styles})))}},pQ=class extends b.Component{constructor(t){super(t),gt(this,"helpers"),gt(this,"store"),gt(this,"callback",a=>{const{callback:l}=this.props;ft.function(l)&&l(a)}),gt(this,"handleKeyboard",a=>{const{index:l,lifecycle:c}=this.state,{steps:d}=this.props,h=d[l];c===Qt.TOOLTIP&&a.code==="Escape"&&h&&!h.disableCloseOnEsc&&this.store.close("keyboard")}),gt(this,"handleClickOverlay",()=>{const{index:a}=this.state,{steps:l}=this.props;ah(this.props,l[a]).disableOverlayClose||this.helpers.close("overlay")}),gt(this,"syncState",a=>{this.setState(a)});const{debug:e,getHelpers:n,run:r=!0,stepIndex:s}=t;this.store=Dxe({...t,controlled:r&&ft.number(s)}),this.helpers=this.store.getHelpers();const{addListener:i}=this.store;hd({title:"init",data:[{key:"props",value:this.props},{key:"state",value:this.state}],debug:e}),i(this.syncState),n&&n(this.helpers),this.state=this.store.getState()}componentDidMount(){if(!Ic())return;const{debug:t,disableCloseOnEsc:e,run:n,steps:r}=this.props,{start:s}=this.store;KA(r,t)&&n&&s(),e||document.body.addEventListener("keydown",this.handleKeyboard,{passive:!0})}componentDidUpdate(t,e){if(!Ic())return;const{action:n,controlled:r,index:s,status:i}=this.state,{debug:a,run:l,stepIndex:c,steps:d}=this.props,{stepIndex:h,steps:m}=t,{reset:g,setSteps:x,start:y,stop:w,update:S}=this.store,{changed:k}=uy(t,this.props),{changed:j,changedFrom:N}=uy(e,this.state),T=ah(this.props,d[s]),E=!ei(m,d),_=ft.number(c)&&k("stepIndex"),A=Ml(T.target);if(E&&(KA(d,a)?x(d):console.warn("Steps are not valid",d)),k("run")&&(l?y(c):w()),_){let B=ft.number(h)&&h=0?w:0,r===mn.RUNNING&&wxe(w,{element:y,duration:a}).then(()=>{setTimeout(()=>{var j;(j=this.store.getPopper("tooltip"))==null||j.instance.update()},10)})}}render(){if(!Ic())return null;const{index:t,lifecycle:e,status:n}=this.state,{continuous:r=!1,debug:s=!1,nonce:i,scrollToFirstStep:a=!1,steps:l}=this.props,c=n===mn.RUNNING,d={};if(c&&l[t]){const h=ah(this.props,l[t]);d.step=b.createElement(Uxe,{...this.state,callback:this.callback,continuous:r,debug:s,helpers:this.helpers,nonce:i,shouldScroll:!h.disableScrolling&&(t!==0||a),step:h,store:this.store}),d.overlay=b.createElement(Lxe,{id:"react-joyride-portal"},b.createElement(Ixe,{...h,continuous:r,debug:s,lifecycle:e,onClickOverlay:this.handleClickOverlay}))}return b.createElement("div",{className:"react-joyride"},d.step,d.overlay)}};gt(pQ,"defaultProps",Exe);var Wxe=pQ;function Y6(){const t=b.useContext(RH);if(!t)throw new Error("useTour must be used within a TourProvider");return t}const Gxe={options:{zIndex:1e4,primaryColor:"hsl(var(--primary))",textColor:"hsl(var(--foreground))",backgroundColor:"hsl(var(--background))",arrowColor:"hsl(var(--background))",overlayColor:"rgba(0, 0, 0, 0.5)"},tooltip:{borderRadius:"var(--radius)",padding:"1rem"},tooltipContainer:{textAlign:"left"},tooltipTitle:{fontSize:"1rem",fontWeight:600,marginBottom:"0.5rem"},tooltipContent:{fontSize:"0.875rem",padding:"0.5rem 0"},buttonNext:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",borderRadius:"calc(var(--radius) - 2px)",fontSize:"0.875rem",padding:"0.5rem 1rem"},buttonBack:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem",marginRight:"0.5rem"},buttonSkip:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem"},buttonClose:{color:"hsl(var(--muted-foreground))"},spotlight:{borderRadius:"var(--radius)"}},Xxe={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function Yxe(){const{state:t,getCurrentSteps:e,handleJoyrideCallback:n}=Y6(),r=e(),[s,i]=b.useState(!1),a=b.useRef(t.stepIndex),l=b.useRef(null);b.useEffect(()=>{a.current!==t.stepIndex&&(i(!1),a.current=t.stepIndex)},[t.stepIndex]),b.useEffect(()=>{if(!t.isRunning||r.length===0){i(!1);return}const h=r[t.stepIndex];if(!h){i(!1);return}const m=h.target;if(m==="body"){i(!0);return}i(!1);const g=setTimeout(()=>{const x=()=>{const k=document.querySelector(m);if(k){const j=k.getBoundingClientRect();if(j.width>0&&j.height>0)return!0}return!1};if(x()){setTimeout(()=>i(!0),100);return}const y=setInterval(()=>{x()&&(clearInterval(y),setTimeout(()=>i(!0),100))},100),w=setTimeout(()=>{clearInterval(y),i(!0)},5e3),S=()=>{clearInterval(y),clearTimeout(w)};l.current=S},150);return()=>{clearTimeout(g),l.current&&(l.current(),l.current=null)}},[t.isRunning,t.stepIndex,r]);const c=b.useRef(null);if(b.useEffect(()=>{let h=document.getElementById("tour-portal-container");return h||(h=document.createElement("div"),h.id="tour-portal-container",h.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(h)),c.current=h,()=>{}},[]),!t.isRunning||r.length===0||!s)return null;const d=o.jsx(Wxe,{steps:r,stepIndex:t.stepIndex,run:t.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:n,styles:Gxe,locale:Xxe,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${t.stepIndex}`);return c.current?pa.createPortal(d,c.current):d}const _l="model-assignment-tour",gQ=[{target:"body",content:"本引导旨在帮助你配置模型提供商和对应的模型,并为麦麦的各个组件分配合适的模型。",placement:"center",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="sidebar-model-provider"]',content:'第一步,你需要配置模型提供商。模型提供商决定了你要使用谁家的模型,无论是单一厂商(如 DeepSeek),还是模型平台(如 Siliconflow),都可以在这里进行配置。点击"下一步"进入配置页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-provider-button"]',content:'点击"添加提供商"按钮,开始配置你的模型提供商。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="provider-dialog"]',content:"在这里,你可以选择你想要配置的模型提供商,填写相关信息后保存即可。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-name-input"]',content:"这里的名称是你为这个模型提供商起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-apikey-input"]',content:"这里需要填写你从模型提供商那里获取的 API 密钥,用于验证和调用模型服务。对于不同的提供商,获取 API 密钥的方式可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-url-input"]',content:"这里需要填写模型提供商的 API 访问地址,确保填写正确以便系统能够连接到模型服务。对于不同的提供商,API 地址可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-template-select"]',content:"当然,如果你不知道如何填写这些信息,很多模型提供商在这里都提供了预设的模板供你选择,选择对应的模板后,相关信息会自动填充。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-save-button"]',content:"填写完所有信息后,点击保存按钮,模型提供商就配置完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-cancel-button"]',content:"因为这次咱们什么都没有填写,所以点击取消按钮退出吧。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="sidebar-model-management"]',content:'配置好模型提供商后,接下来我们需要为麦麦添加模型并分配功能。点击"下一步"进入模型管理页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-model-button"]',content:'在为麦麦的组件分配模型之前,首先需要添加你想要分配的模型,点击"添加模型"按钮开始添加。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="model-dialog"]',content:"在这里,你可以选择你之前配置好的模型提供商,然后选择对应的模型来添加。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-name-input"]',content:"这里的模型名称是你为这个模型起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-provider-select"]',content:"在这里选择你之前配置好的模型提供商,这样系统才能知道你要添加哪个提供商的模型。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-identifier-input"]',content:"这里需要填写你想要添加的模型的标识符,不同的模型提供商可能有不同的标识符格式,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-save-button"]',content:"填写完所有信息后,点击保存按钮,模型就添加完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-cancel-button"]',content:"当然,因为这次咱们什么都没有填写,所以直接点击取消按钮退出吧,等你准备好了再来添加模型。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="tasks-tab-trigger"]',content:'最后一步,添加好模型后,切换到"为模型分配功能"标签页,为麦麦的各个组件分配合适的模型。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="task-model-select"]',content:"在这里,你可以为每个组件选择一个或多个合适的模型,选择完成后配置会自动保存。恭喜你完成了模型配置的学习!",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1}],xQ={0:"/config/model",1:"/config/model",2:"/config/modelProvider",3:"/config/modelProvider",4:"/config/modelProvider",5:"/config/modelProvider",6:"/config/modelProvider",7:"/config/modelProvider",8:"/config/modelProvider",9:"/config/modelProvider",10:"/config/modelProvider",11:"/config/model",12:"/config/model",13:"/config/model",14:"/config/model",15:"/config/model",16:"/config/model",17:"/config/model",18:"/config/model",19:"/config/model"},d0=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini",modelFetcher:{endpoint:"/models",parser:"gemini"}},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function JA(t){return t?t.replace(/\/+$/,"").toLowerCase():""}function Kxe(t){if(!t)return null;const e=JA(t);return d0.find(n=>n.id!=="custom"&&JA(n.base_url)===e)||null}function Zxe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(null),[j,N]=b.useState(null),[T,E]=b.useState("custom"),[_,A]=b.useState(!1),[L,P]=b.useState(!1),[B,$]=b.useState(null),[U,te]=b.useState(!1),[z,Q]=b.useState(""),[F,Y]=b.useState(new Set),[J,X]=b.useState(!1),[R,ie]=b.useState(1),[G,I]=b.useState(20),[V,ee]=b.useState(""),{toast:ne}=as(),W=Zi(),{state:se,goToStep:re,registerTour:oe}=Y6(),Te=b.useRef(null),We=b.useRef(!0);b.useEffect(()=>{oe(_l,gQ)},[oe]),b.useEffect(()=>{if(se.activeTourId===_l&&se.isRunning){const ke=xQ[se.stepIndex];ke&&!window.location.pathname.endsWith(ke.replace("/config/",""))&&W({to:ke})}},[se.stepIndex,se.activeTourId,se.isRunning,W]);const Ye=b.useRef(se.stepIndex);b.useEffect(()=>{if(se.activeTourId===_l&&se.isRunning){const ke=Ye.current,Pe=se.stepIndex;ke>=3&&ke<=9&&Pe<3&&w(!1),Ye.current=Pe}},[se.stepIndex,se.activeTourId,se.isRunning]),b.useEffect(()=>{if(se.activeTourId!==_l||!se.isRunning)return;const ke=Pe=>{const it=Pe.target,ot=se.stepIndex;ot===2&&it.closest('[data-tour="add-provider-button"]')?setTimeout(()=>re(3),300):ot===9&&it.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>re(10),300)};return document.addEventListener("click",ke,!0),()=>document.removeEventListener("click",ke,!0)},[se,re]),b.useEffect(()=>{Je()},[]);const Je=async()=>{try{r(!0);const ke=await Rh();e(ke.api_providers||[]),d(!1),We.current=!1}catch(ke){console.error("加载配置失败:",ke)}finally{r(!1)}},Oe=async()=>{try{m(!0),ib().catch(()=>{}),x(!0)}catch(ke){console.error("重启失败:",ke),x(!1),ne({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),m(!1)}},Ve=async()=>{try{i(!0),Te.current&&clearTimeout(Te.current);const ke=await Rh();ke.api_providers=t,await qv(ke),d(!1),ne({title:"保存成功",description:"正在重启麦麦..."}),await Oe()}catch(ke){console.error("保存配置失败:",ke),ne({title:"保存失败",description:ke.message,variant:"destructive"}),i(!1)}},Ue=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},He=()=>{x(!1),m(!1),ne({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Ot=b.useCallback(async ke=>{if(!We.current)try{l(!0),await xk("api_providers",ke),d(!1)}catch(Pe){console.error("自动保存失败:",Pe),d(!0)}finally{l(!1)}},[]);b.useEffect(()=>{if(!We.current)return d(!0),Te.current&&clearTimeout(Te.current),Te.current=setTimeout(()=>{Ot(t)},2e3),()=>{Te.current&&clearTimeout(Te.current)}},[t,Ot]);const xt=async()=>{try{i(!0),Te.current&&clearTimeout(Te.current);const ke=await Rh();ke.api_providers=t,await qv(ke),d(!1),ne({title:"保存成功",description:"模型提供商配置已保存"})}catch(ke){console.error("保存配置失败:",ke),ne({title:"保存失败",description:ke.message,variant:"destructive"})}finally{i(!1)}},kn=(ke,Pe)=>{if(ke){const it=d0.find(ot=>ot.base_url===ke.base_url&&ot.client_type===ke.client_type);E(it?.id||"custom"),k(ke)}else E("custom"),k({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});N(Pe),te(!1),w(!0)},It=ke=>{E(ke),A(!1);const Pe=d0.find(it=>it.id===ke);Pe&&Pe.id!=="custom"?k(it=>({...it,name:Pe.name,base_url:Pe.base_url,client_type:Pe.client_type})):Pe?.id==="custom"&&k(it=>({...it,name:"",base_url:"",client_type:"openai"}))},Yt=b.useMemo(()=>T!=="custom",[T]),_t=async()=>{if(S?.api_key)try{await navigator.clipboard.writeText(S.api_key),ne({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{ne({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},mt=()=>{if(!S)return;const ke={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};if(j!==null){const Pe=[...t];Pe[j]=ke,e(Pe)}else e([...t,ke]);w(!1),k(null),N(null)},Ne=ke=>{if(!ke&&S){const Pe={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};k(Pe)}w(ke)},Ie=ke=>{$(ke),P(!0)},st=()=>{if(B!==null){const ke=t.filter((Pe,it)=>it!==B);e(ke),ne({title:"删除成功",description:"提供商已从列表中移除"})}P(!1),$(null)},yt=ke=>{const Pe=new Set(F);Pe.has(ke)?Pe.delete(ke):Pe.add(ke),Y(Pe)},Pt=()=>{if(F.size===Fe.length)Y(new Set);else{const ke=Fe.map((Pe,it)=>t.findIndex(ot=>ot===Fe[it]));Y(new Set(ke))}},Mt=()=>{if(F.size===0){ne({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}X(!0)},zn=()=>{const ke=t.filter((Pe,it)=>!F.has(it));e(ke),Y(new Set),X(!1),ne({title:"批量删除成功",description:`已删除 ${F.size} 个提供商`})},Fe=t.filter(ke=>{if(!z)return!0;const Pe=z.toLowerCase();return ke.name.toLowerCase().includes(Pe)||ke.base_url.toLowerCase().includes(Pe)||ke.client_type.toLowerCase().includes(Pe)}),rt=Math.ceil(Fe.length/G),tn=Fe.slice((R-1)*G,R*G),Rt=()=>{const ke=parseInt(V);ke>=1&&ke<=rt&&(ie(ke),ee(""))};return n?o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[F.size>0&&o.jsxs(de,{onClick:Mt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(Sn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",F.size,")"]}),o.jsxs(de,{onClick:()=>kn(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[o.jsx(Ls,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),o.jsxs(de,{onClick:xt,disabled:s||a||!c||h,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[o.jsx(Gy,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":a?"自动保存中...":c?"保存配置":"已保存"]}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{disabled:s||a||h,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[o.jsx(Aj,{className:"mr-2 h-4 w-4"}),h?"重启中...":c?"保存并重启":"重启麦麦"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认重启麦麦?"}),o.jsx(_n,{className:"space-y-3",asChild:!0,children:o.jsxs("div",{children:[o.jsx("p",{children:c?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(ga,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(xa,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",o.jsxs(Dr,{children:[o.jsx(Of,{asChild:!0,children:o.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[o.jsx(Wy,{className:"h-3 w-3"}),"如何结束程序?"]})}),o.jsxs(Sr,{className:"max-w-2xl",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"如何结束使用重启功能后的麦麦程序"}),o.jsx(ss,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),o.jsxs(ja,{defaultValue:"windows",className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-3",children:[o.jsx(Lt,{value:"windows",children:"Windows"}),o.jsx(Lt,{value:"macos",children:"macOS"}),o.jsx(Lt,{value:"linux",children:"Linux"})]}),o.jsxs(un,{value:"windows",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),o.jsxs("li",{children:["在“进程”或“详细信息”标签页中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),o.jsx("li",{children:"右键点击并选择“结束任务”"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),o.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),o.jsxs(un,{value:"macos",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"})," 打开 Spotlight,搜索“活动监视器”"]}),o.jsxs("li",{children:["在进程列表中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),o.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]})]}),o.jsxs(un,{value:"linux",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),o.jsx("p",{children:'pkill -9 -f "bot.py"'}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["在终端输入 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),o.jsx(ws,{children:o.jsx(Gj,{asChild:!0,children:o.jsx(de,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:c?Ve:Oe,children:c?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(ga,{children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsxs(xa,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),o.jsxs(gn,{className:"h-[calc(100vh-260px)]",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[o.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[o.jsx(Ni,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{placeholder:"搜索提供商名称、URL 或类型...",value:z,onChange:ke=>Q(ke.target.value),className:"pl-9"})]}),z&&o.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Fe.length," 个结果"]})]}),o.jsx("div",{className:"md:hidden space-y-3",children:Fe.length===0?o.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):tn.map((ke,Pe)=>{const it=t.findIndex(ot=>ot===ke);return o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"font-semibold text-base truncate",children:ke.name}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ke.base_url})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>kn(ke,it),children:[o.jsx(Yu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(de,{size:"sm",onClick:()=>Ie(it),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),o.jsx("p",{className:"font-medium",children:ke.client_type})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),o.jsx("p",{className:"font-medium",children:ke.max_retry})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),o.jsx("p",{className:"font-medium",children:ke.timeout})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),o.jsx("p",{className:"font-medium",children:ke.retry_interval})]})]})]},Pe)})}),o.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(_f,{children:[o.jsx(Af,{children:o.jsxs(Is,{children:[o.jsx(pn,{className:"w-12",children:o.jsx(Oi,{checked:F.size===Fe.length&&Fe.length>0,onCheckedChange:Pt})}),o.jsx(pn,{children:"名称"}),o.jsx(pn,{children:"基础URL"}),o.jsx(pn,{children:"客户端类型"}),o.jsx(pn,{className:"text-right",children:"最大重试"}),o.jsx(pn,{className:"text-right",children:"超时(秒)"}),o.jsx(pn,{className:"text-right",children:"重试间隔(秒)"}),o.jsx(pn,{className:"text-right",children:"操作"})]})}),o.jsx(Mf,{children:tn.length===0?o.jsx(Is,{children:o.jsx(Gt,{colSpan:8,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):tn.map((ke,Pe)=>{const it=t.findIndex(ot=>ot===ke);return o.jsxs(Is,{children:[o.jsx(Gt,{children:o.jsx(Oi,{checked:F.has(it),onCheckedChange:()=>yt(it)})}),o.jsx(Gt,{className:"font-medium",children:ke.name}),o.jsx(Gt,{className:"max-w-xs truncate",title:ke.base_url,children:ke.base_url}),o.jsx(Gt,{children:ke.client_type}),o.jsx(Gt,{className:"text-right",children:ke.max_retry}),o.jsx(Gt,{className:"text-right",children:ke.timeout}),o.jsx(Gt,{className:"text-right",children:ke.retry_interval}),o.jsx(Gt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>kn(ke,it),children:[o.jsx(Yu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(de,{size:"sm",onClick:()=>Ie(it),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Pe)})})]})})}),Fe.length>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:G.toString(),onValueChange:ke=>{I(parseInt(ke)),ie(1),Y(new Set)},children:[o.jsx($t,{id:"page-size-provider",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*G+1," 到"," ",Math.min(R*G,Fe.length)," 条,共 ",Fe.length," 条"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>ie(1),disabled:R===1,className:"hidden sm:flex",children:o.jsx(Ap,{className:"h-4 w-4"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>ie(ke=>Math.max(1,ke-1)),disabled:R===1,children:[o.jsx(vd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{type:"number",value:V,onChange:ke=>ee(ke.target.value),onKeyDown:ke=>ke.key==="Enter"&&Rt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),o.jsx(de,{variant:"outline",size:"sm",onClick:Rt,disabled:!V,className:"h-8",children:"跳转"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>ie(ke=>ke+1),disabled:R>=rt,children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(yd,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>ie(rt),disabled:R>=rt,className:"hidden sm:flex",children:o.jsx(Mp,{className:"h-4 w-4"})})]})]})]}),o.jsx(Dr,{open:y,onOpenChange:Ne,children:o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:se.isRunning,children:[o.jsxs(kr,{children:[o.jsx(Or,{children:j!==null?"编辑提供商":"添加提供商"}),o.jsx(ss,{children:"配置 API 提供商的连接信息和参数"})]}),o.jsxs("form",{onSubmit:ke=>{ke.preventDefault(),mt()},autoComplete:"off",children:[o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2","data-tour":"provider-template-select",children:[o.jsx(he,{htmlFor:"template",children:"提供商模板"}),o.jsxs(zo,{open:_,onOpenChange:A,children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":_,className:"w-full justify-between",children:[T?d0.find(ke=>ke.id===T)?.display_name:"选择提供商模板...",o.jsx(Mj,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(Xa,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:o.jsxs(Ob,{children:[o.jsx(jb,{placeholder:"搜索提供商模板..."}),o.jsx(gn,{className:"h-[300px]",children:o.jsxs(Nb,{className:"max-h-none overflow-visible",children:[o.jsx(Cb,{children:"未找到匹配的模板"}),o.jsx(ap,{children:d0.map(ke=>o.jsxs(op,{value:ke.display_name,onSelect:()=>It(ke.id),children:[o.jsx(Ro,{className:`mr-2 h-4 w-4 ${T===ke.id?"opacity-100":"opacity-0"}`}),ke.display_name]},ke.id))})]})})]})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[o.jsx(he,{htmlFor:"name",children:"名称 *"}),o.jsx(ze,{id:"name",value:S?.name||"",onChange:ke=>k(Pe=>Pe?{...Pe,name:ke.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[o.jsx(he,{htmlFor:"base_url",children:"基础 URL *"}),o.jsx(ze,{id:"base_url",value:S?.base_url||"",onChange:ke=>k(Pe=>Pe?{...Pe,base_url:ke.target.value}:null),placeholder:"https://api.example.com/v1",disabled:Yt,className:Yt?"bg-muted cursor-not-allowed":""}),Yt&&o.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[o.jsx(he,{htmlFor:"api_key",children:"API Key *"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{id:"api_key",type:U?"text":"password",value:S?.api_key||"",onChange:ke=>k(Pe=>Pe?{...Pe,api_key:ke.target.value}:null),placeholder:"sk-...",className:"flex-1"}),o.jsx(de,{type:"button",variant:"outline",size:"icon",onClick:()=>te(!U),title:U?"隐藏密钥":"显示密钥",children:U?o.jsx(Rv,{className:"h-4 w-4"}):o.jsx(Ea,{className:"h-4 w-4"})}),o.jsx(de,{type:"button",variant:"outline",size:"icon",onClick:_t,title:"复制密钥",children:o.jsx(Mv,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"client_type",children:"客户端类型"}),o.jsxs(Vt,{value:S?.client_type||"openai",onValueChange:ke=>k(Pe=>Pe?{...Pe,client_type:ke}:null),disabled:Yt,children:[o.jsx($t,{id:"client_type",className:Yt?"bg-muted cursor-not-allowed":"",children:o.jsx(Ut,{placeholder:"选择客户端类型"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"openai",children:"OpenAI"}),o.jsx(De,{value:"gemini",children:"Gemini"})]})]}),Yt&&o.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_retry",children:"最大重试"}),o.jsx(ze,{id:"max_retry",type:"number",min:"0",value:S?.max_retry??"",onChange:ke=>{const Pe=ke.target.value===""?null:parseInt(ke.target.value);k(it=>it?{...it,max_retry:Pe}:null)},placeholder:"默认: 2"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"timeout",children:"超时(秒)"}),o.jsx(ze,{id:"timeout",type:"number",min:"1",value:S?.timeout??"",onChange:ke=>{const Pe=ke.target.value===""?null:parseInt(ke.target.value);k(it=>it?{...it,timeout:Pe}:null)},placeholder:"默认: 30"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),o.jsx(ze,{id:"retry_interval",type:"number",min:"1",value:S?.retry_interval??"",onChange:ke=>{const Pe=ke.target.value===""?null:parseInt(ke.target.value);k(it=>it?{...it,retry_interval:Pe}:null)},placeholder:"默认: 10"})]})]})]}),o.jsxs(ws,{children:[o.jsx(de,{type:"button",variant:"outline",onClick:()=>w(!1),"data-tour":"provider-cancel-button",children:"取消"}),o.jsx(de,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),o.jsx(Dn,{open:L,onOpenChange:P,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除提供商 "',B!==null?t[B]?.name:"",'" 吗? 此操作无法撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:st,children:"删除"})]})]})}),o.jsx(Dn,{open:J,onOpenChange:X,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认批量删除"}),o.jsxs(_n,{children:["确定要删除选中的 ",F.size," 个提供商吗? 此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:zn,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),g&&o.jsx(Kj,{onRestartComplete:Ue,onRestartFailed:He})]})}function Jxe(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(s=>s(r))},e)}const Ab=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function zf(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function K6(t){return"nodeType"in t}function Ti(t){var e,n;return t?zf(t)?t:K6(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Z6(t){const{Document:e}=Ti(t);return t instanceof e}function og(t){return zf(t)?!1:t instanceof Ti(t).HTMLElement}function vQ(t){return t instanceof Ti(t).SVGElement}function If(t){return t?zf(t)?t.document:K6(t)?Z6(t)?t:og(t)||vQ(t)?t.ownerDocument:document:document:document}const Bo=Ab?b.useLayoutEffect:b.useEffect;function J6(t){const e=b.useRef(t);return Bo(()=>{e.current=t}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{t.current=setInterval(r,s)},[]),n=b.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function up(t,e){e===void 0&&(e=[t]);const n=b.useRef(t);return Bo(()=>{n.current!==t&&(n.current=t)},e),n}function lg(t,e){const n=b.useRef();return b.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function my(t){const e=J6(t),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function kO(t){const e=b.useRef();return b.useEffect(()=>{e.current=t},[t]),e.current}let kS={};function cg(t,e){return b.useMemo(()=>{if(e)return e;const n=kS[t]==null?0:kS[t]+1;return kS[t]=n,t+"-"+n},[t,e])}function yQ(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const l=Object.entries(a);for(const[c,d]of l){const h=i[c];h!=null&&(i[c]=h+t*d)}return i},{...e})}}const Fh=yQ(1),dp=yQ(-1);function t1e(t){return"clientX"in t&&"clientY"in t}function eN(t){if(!t)return!1;const{KeyboardEvent:e}=Ti(t.target);return e&&t instanceof e}function n1e(t){if(!t)return!1;const{TouchEvent:e}=Ti(t.target);return e&&t instanceof e}function OO(t){if(n1e(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return t1e(t)?{x:t.clientX,y:t.clientY}:null}const hp=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[hp.Translate.toString(t),hp.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),eM="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function r1e(t){return t.matches(eM)?t:t.querySelector(eM)}const s1e={display:"none"};function i1e(t){let{id:e,value:n}=t;return ae.createElement("div",{id:e,style:s1e},n)}function a1e(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ae.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function o1e(){const[t,e]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const bQ=b.createContext(null);function l1e(t){const e=b.useContext(bQ);b.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function c1e(){const[t]=b.useState(()=>new Set),e=b.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[b.useCallback(r=>{let{type:s,event:i}=r;t.forEach(a=>{var l;return(l=a[s])==null?void 0:l.call(a,i)})},[t]),e]}const u1e={draggable:` + `)),e.appendChild(n)}componentDidMount(){const{shouldFocus:t}=this.props;setTimeout(()=>{pt.domElement(this.beacon)&&t&&this.beacon.focus()},0)}componentWillUnmount(){const t=document.getElementById("joyride-beacon-animation");t?.parentNode&&t.parentNode.removeChild(t)}render(){const{beaconComponent:t,continuous:e,index:n,isLastStep:r,locale:s,onClickOrHover:i,size:a,step:l,styles:c}=this.props,d=wo(s.open),h={"aria-label":d,onClick:i,onMouseEnter:i,ref:this.setBeaconRef,title:d};let m;if(t){const g=t;m=b.createElement(g,{continuous:e,index:n,isLastStep:r,size:a,step:l,...h})}else m=b.createElement("button",{key:"JoyrideBeacon",className:"react-joyride__beacon","data-test-id":"button-beacon",style:c.beacon,type:"button",...h},b.createElement("span",{style:c.beaconInner}),b.createElement("span",{style:c.beaconOuter}));return m}};function Vxe({styles:t,...e}){const{color:n,height:r,width:s,...i}=t;return oe.createElement("button",{style:i,type:"button",...e},oe.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof s=="number"?`${s}px`:s,xmlns:"http://www.w3.org/2000/svg"},oe.createElement("g",null,oe.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:n}))))}var Uxe=Vxe;function Wxe(t){const{backProps:e,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:c}=t,{content:d,hideBackButton:h,hideCloseButton:m,hideFooter:g,showSkipButton:x,styles:y,title:w}=l,S={};return S.primary=b.createElement("button",{"data-test-id":"button-primary",style:y.buttonNext,type:"button",...i}),x&&!s&&(S.skip=b.createElement("button",{"aria-live":"off","data-test-id":"button-skip",style:y.buttonSkip,type:"button",...a})),!h&&r>0&&(S.back=b.createElement("button",{"data-test-id":"button-back",style:y.buttonBack,type:"button",...e})),S.close=!m&&b.createElement(Uxe,{"data-test-id":"button-close",styles:y.buttonClose,...n}),b.createElement("div",{key:"JoyrideTooltip","aria-label":wo(w??d),className:"react-joyride__tooltip",style:y.tooltip,...c},b.createElement("div",{style:y.tooltipContainer},w&&b.createElement("h1",{"aria-label":wo(w),style:y.tooltipTitle},w),b.createElement("div",{style:y.tooltipContent},d)),!g&&b.createElement("div",{style:y.tooltipFooter},b.createElement("div",{style:y.tooltipFooterSpacer},S.skip),S.back,S.primary),S.close)}var Gxe=Wxe,Xxe=class extends b.Component{constructor(){super(...arguments),xt(this,"handleClickBack",t=>{t.preventDefault();const{helpers:e}=this.props;e.prev()}),xt(this,"handleClickClose",t=>{t.preventDefault();const{helpers:e}=this.props;e.close("button_close")}),xt(this,"handleClickPrimary",t=>{t.preventDefault();const{continuous:e,helpers:n}=this.props;if(!e){n.close("button_primary");return}n.next()}),xt(this,"handleClickSkip",t=>{t.preventDefault();const{helpers:e}=this.props;e.skip()}),xt(this,"getElementsProps",()=>{const{continuous:t,index:e,isLastStep:n,setTooltipRef:r,size:s,step:i}=this.props,{back:a,close:l,last:c,next:d,nextLabelWithProgress:h,skip:m}=i.locale,g=wo(a),x=wo(l),y=wo(c),w=wo(d),S=wo(m);let k=l,j=x;if(t){if(k=d,j=w,i.showProgress&&!n){const N=wo(h,{step:e+1,steps:s});k=jO(h,e+1,s),j=N}n&&(k=c,j=y)}return{backProps:{"aria-label":g,children:a,"data-action":"back",onClick:this.handleClickBack,role:"button",title:g},closeProps:{"aria-label":x,children:l,"data-action":"close",onClick:this.handleClickClose,role:"button",title:x},primaryProps:{"aria-label":j,children:k,"data-action":"primary",onClick:this.handleClickPrimary,role:"button",title:j},skipProps:{"aria-label":S,children:m,"data-action":"skip",onClick:this.handleClickSkip,role:"button",title:S},tooltipProps:{"aria-modal":!0,ref:r,role:"alertdialog"}}})}render(){const{continuous:t,index:e,isLastStep:n,setTooltipRef:r,size:s,step:i}=this.props,{beaconComponent:a,tooltipComponent:l,...c}=i;let d;if(l){const h={...this.getElementsProps(),continuous:t,index:e,isLastStep:n,size:s,step:c,setTooltipRef:r},m=l;d=b.createElement(m,{...h})}else d=b.createElement(Gxe,{...this.getElementsProps(),continuous:t,index:e,isLastStep:n,size:s,step:i});return d}},Yxe=class extends b.Component{constructor(){super(...arguments),xt(this,"scope",null),xt(this,"tooltip",null),xt(this,"handleClickHoverBeacon",t=>{const{step:e,store:n}=this.props;t.type==="mouseenter"&&e.event!=="hover"||n.update({lifecycle:Xt.TOOLTIP})}),xt(this,"setTooltipRef",t=>{this.tooltip=t}),xt(this,"setPopper",(t,e)=>{var n;const{action:r,lifecycle:s,step:i,store:a}=this.props;e==="wrapper"?a.setPopper("beacon",t):a.setPopper("tooltip",t),a.getPopper("beacon")&&(a.getPopper("tooltip")||i.placement==="center")&&s===Xt.INIT&&a.update({action:r,lifecycle:Xt.READY}),(n=i.floaterProps)!=null&&n.getPopper&&i.floaterProps.getPopper(t,e)}),xt(this,"renderTooltip",t=>{const{continuous:e,helpers:n,index:r,size:s,step:i}=this.props;return b.createElement(Xxe,{continuous:e,helpers:n,index:r,isLastStep:r+1===s,setTooltipRef:this.setTooltipRef,size:s,step:i,...t})})}componentDidMount(){const{debug:t,index:e}=this.props;pd({title:`step:${e}`,data:[{key:"props",value:this.props}],debug:t})}componentDidUpdate(t){var e;const{action:n,callback:r,continuous:s,controlled:i,debug:a,helpers:l,index:c,lifecycle:d,shouldScroll:h,status:m,step:g,store:x}=this.props,{changed:y,changedFrom:w}=py(t,this.props),S=l.info(),k=s&&n!==Yn.CLOSE&&(c>0||n===Yn.PREV),j=y("action")||y("index")||y("lifecycle")||y("status"),N=w("lifecycle",[Xt.TOOLTIP,Xt.INIT],Xt.INIT),T=y("action",[Yn.NEXT,Yn.PREV,Yn.SKIP,Yn.CLOSE]),E=i&&c===t.index;if(T&&(N||E)&&r({...S,index:t.index,lifecycle:Xt.COMPLETE,step:t.step,type:Va.STEP_AFTER}),g.placement==="center"&&m===wn.RUNNING&&y("index")&&n!==Yn.START&&d===Xt.INIT&&x.update({lifecycle:Xt.READY}),j){const _=Pl(g.target),A=!!_;A&&Sxe(_)?(w("status",wn.READY,wn.RUNNING)||w("lifecycle",Xt.INIT,Xt.READY))&&r({...S,step:g,type:Va.STEP_BEFORE}):(console.warn(A?"Target not visible":"Target not mounted",g),r({...S,type:Va.TARGET_NOT_FOUND,step:g}),i||x.update({index:c+(n===Yn.PREV?-1:1)}))}w("lifecycle",Xt.INIT,Xt.READY)&&x.update({lifecycle:eM(g)||k?Xt.TOOLTIP:Xt.BEACON}),y("index")&&pd({title:`step:${d}`,data:[{key:"props",value:this.props}],debug:a}),y("lifecycle",Xt.BEACON)&&r({...S,step:g,type:Va.BEACON}),y("lifecycle",Xt.TOOLTIP)&&(r({...S,step:g,type:Va.TOOLTIP}),h&&this.tooltip&&(this.scope=new Hxe(this.tooltip,{selector:"[data-action=primary]"}),this.scope.setFocus())),w("lifecycle",[Xt.TOOLTIP,Xt.INIT],Xt.INIT)&&((e=this.scope)==null||e.removeScope(),x.cleanupPoppers())}componentWillUnmount(){var t;(t=this.scope)==null||t.removeScope()}get open(){const{lifecycle:t,step:e}=this.props;return eM(e)||t===Xt.TOOLTIP}render(){const{continuous:t,debug:e,index:n,nonce:r,shouldScroll:s,size:i,step:a}=this.props,l=Pl(a.target);return!xQ(a)||!pt.domElement(l)?null:b.createElement("div",{key:`JoyrideStep-${n}`,className:"react-joyride__step"},b.createElement(tN,{...a.floaterProps,component:this.renderTooltip,debug:e,getPopper:this.setPopper,id:`react-joyride-step-${n}`,open:this.open,placement:a.placement,target:a.target},b.createElement(Qxe,{beaconComponent:a.beaconComponent,continuous:t,index:n,isLastStep:n+1===i,locale:a.locale,nonce:r,onClickOrHover:this.handleClickHoverBeacon,shouldFocus:s,size:i,step:a,styles:a.styles})))}},yQ=class extends b.Component{constructor(t){super(t),xt(this,"helpers"),xt(this,"store"),xt(this,"callback",a=>{const{callback:l}=this.props;pt.function(l)&&l(a)}),xt(this,"handleKeyboard",a=>{const{index:l,lifecycle:c}=this.state,{steps:d}=this.props,h=d[l];c===Xt.TOOLTIP&&a.code==="Escape"&&h&&!h.disableCloseOnEsc&&this.store.close("keyboard")}),xt(this,"handleClickOverlay",()=>{const{index:a}=this.state,{steps:l}=this.props;lh(this.props,l[a]).disableOverlayClose||this.helpers.close("overlay")}),xt(this,"syncState",a=>{this.setState(a)});const{debug:e,getHelpers:n,run:r=!0,stepIndex:s}=t;this.store=Lxe({...t,controlled:r&&pt.number(s)}),this.helpers=this.store.getHelpers();const{addListener:i}=this.store;pd({title:"init",data:[{key:"props",value:this.props},{key:"state",value:this.state}],debug:e}),i(this.syncState),n&&n(this.helpers),this.state=this.store.getState()}componentDidMount(){if(!Fc())return;const{debug:t,disableCloseOnEsc:e,run:n,steps:r}=this.props,{start:s}=this.store;rM(r,t)&&n&&s(),e||document.body.addEventListener("keydown",this.handleKeyboard,{passive:!0})}componentDidUpdate(t,e){if(!Fc())return;const{action:n,controlled:r,index:s,status:i}=this.state,{debug:a,run:l,stepIndex:c,steps:d}=this.props,{stepIndex:h,steps:m}=t,{reset:g,setSteps:x,start:y,stop:w,update:S}=this.store,{changed:k}=py(t,this.props),{changed:j,changedFrom:N}=py(e,this.state),T=lh(this.props,d[s]),E=!ti(m,d),_=pt.number(c)&&k("stepIndex"),A=Pl(T.target);if(E&&(rM(d,a)?x(d):console.warn("Steps are not valid",d)),k("run")&&(l?y(c):w()),_){let B=pt.number(h)&&h=0?w:0,r===wn.RUNNING&&jxe(w,{element:y,duration:a}).then(()=>{setTimeout(()=>{var j;(j=this.store.getPopper("tooltip"))==null||j.instance.update()},10)})}}render(){if(!Fc())return null;const{index:t,lifecycle:e,status:n}=this.state,{continuous:r=!1,debug:s=!1,nonce:i,scrollToFirstStep:a=!1,steps:l}=this.props,c=n===wn.RUNNING,d={};if(c&&l[t]){const h=lh(this.props,l[t]);d.step=b.createElement(Yxe,{...this.state,callback:this.callback,continuous:r,debug:s,helpers:this.helpers,nonce:i,shouldScroll:!h.disableScrolling&&(t!==0||a),step:h,store:this.store}),d.overlay=b.createElement($xe,{id:"react-joyride-portal"},b.createElement(qxe,{...h,continuous:r,debug:s,lifecycle:e,onClickOverlay:this.handleClickOverlay}))}return b.createElement("div",{className:"react-joyride"},d.step,d.overlay)}};xt(yQ,"defaultProps",Rxe);var Kxe=yQ;function nN(){const t=b.useContext(IH);if(!t)throw new Error("useTour must be used within a TourProvider");return t}const Zxe={options:{zIndex:1e4,primaryColor:"hsl(var(--primary))",textColor:"hsl(var(--foreground))",backgroundColor:"hsl(var(--background))",arrowColor:"hsl(var(--background))",overlayColor:"rgba(0, 0, 0, 0.5)"},tooltip:{borderRadius:"var(--radius)",padding:"1rem"},tooltipContainer:{textAlign:"left"},tooltipTitle:{fontSize:"1rem",fontWeight:600,marginBottom:"0.5rem"},tooltipContent:{fontSize:"0.875rem",padding:"0.5rem 0"},buttonNext:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",borderRadius:"calc(var(--radius) - 2px)",fontSize:"0.875rem",padding:"0.5rem 1rem"},buttonBack:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem",marginRight:"0.5rem"},buttonSkip:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem"},buttonClose:{color:"hsl(var(--muted-foreground))"},spotlight:{borderRadius:"var(--radius)"}},Jxe={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function e1e(){const{state:t,getCurrentSteps:e,handleJoyrideCallback:n}=nN(),r=e(),[s,i]=b.useState(!1),a=b.useRef(t.stepIndex),l=b.useRef(null);b.useEffect(()=>{a.current!==t.stepIndex&&(i(!1),a.current=t.stepIndex)},[t.stepIndex]),b.useEffect(()=>{if(!t.isRunning||r.length===0){i(!1);return}const h=r[t.stepIndex];if(!h){i(!1);return}const m=h.target;if(m==="body"){i(!0);return}i(!1);const g=setTimeout(()=>{const x=()=>{const k=document.querySelector(m);if(k){const j=k.getBoundingClientRect();if(j.width>0&&j.height>0)return!0}return!1};if(x()){setTimeout(()=>i(!0),100);return}const y=setInterval(()=>{x()&&(clearInterval(y),setTimeout(()=>i(!0),100))},100),w=setTimeout(()=>{clearInterval(y),i(!0)},5e3),S=()=>{clearInterval(y),clearTimeout(w)};l.current=S},150);return()=>{clearTimeout(g),l.current&&(l.current(),l.current=null)}},[t.isRunning,t.stepIndex,r]);const c=b.useRef(null);if(b.useEffect(()=>{let h=document.getElementById("tour-portal-container");return h||(h=document.createElement("div"),h.id="tour-portal-container",h.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(h)),c.current=h,()=>{}},[]),!t.isRunning||r.length===0||!s)return null;const d=o.jsx(Kxe,{steps:r,stepIndex:t.stepIndex,run:t.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:n,styles:Zxe,locale:Jxe,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${t.stepIndex}`);return c.current?ya.createPortal(d,c.current):d}const Rl="model-assignment-tour",bQ=[{target:"body",content:"本引导旨在帮助你配置模型提供商和对应的模型,并为麦麦的各个组件分配合适的模型。",placement:"center",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="sidebar-model-provider"]',content:'第一步,你需要配置模型提供商。模型提供商决定了你要使用谁家的模型,无论是单一厂商(如 DeepSeek),还是模型平台(如 Siliconflow),都可以在这里进行配置。点击"下一步"进入配置页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-provider-button"]',content:'点击"添加提供商"按钮,开始配置你的模型提供商。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="provider-dialog"]',content:"在这里,你可以选择你想要配置的模型提供商,填写相关信息后保存即可。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-name-input"]',content:"这里的名称是你为这个模型提供商起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-apikey-input"]',content:"这里需要填写你从模型提供商那里获取的 API 密钥,用于验证和调用模型服务。对于不同的提供商,获取 API 密钥的方式可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-url-input"]',content:"这里需要填写模型提供商的 API 访问地址,确保填写正确以便系统能够连接到模型服务。对于不同的提供商,API 地址可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-template-select"]',content:"当然,如果你不知道如何填写这些信息,很多模型提供商在这里都提供了预设的模板供你选择,选择对应的模板后,相关信息会自动填充。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-save-button"]',content:"填写完所有信息后,点击保存按钮,模型提供商就配置完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-cancel-button"]',content:"因为这次咱们什么都没有填写,所以点击取消按钮退出吧。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="sidebar-model-management"]',content:'配置好模型提供商后,接下来我们需要为麦麦添加模型并分配功能。点击"下一步"进入模型管理页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-model-button"]',content:'在为麦麦的组件分配模型之前,首先需要添加你想要分配的模型,点击"添加模型"按钮开始添加。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="model-dialog"]',content:"在这里,你可以选择你之前配置好的模型提供商,然后选择对应的模型来添加。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-name-input"]',content:"这里的模型名称是你为这个模型起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-provider-select"]',content:"在这里选择你之前配置好的模型提供商,这样系统才能知道你要添加哪个提供商的模型。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-identifier-input"]',content:"这里需要填写你想要添加的模型的标识符,不同的模型提供商可能有不同的标识符格式,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-save-button"]',content:"填写完所有信息后,点击保存按钮,模型就添加完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-cancel-button"]',content:"当然,因为这次咱们什么都没有填写,所以直接点击取消按钮退出吧,等你准备好了再来添加模型。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="tasks-tab-trigger"]',content:'最后一步,添加好模型后,切换到"为模型分配功能"标签页,为麦麦的各个组件分配合适的模型。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="task-model-select"]',content:"在这里,你可以为每个组件选择一个或多个合适的模型,选择完成后配置会自动保存。恭喜你完成了模型配置的学习!",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1}],wQ={0:"/config/model",1:"/config/model",2:"/config/modelProvider",3:"/config/modelProvider",4:"/config/modelProvider",5:"/config/modelProvider",6:"/config/modelProvider",7:"/config/modelProvider",8:"/config/modelProvider",9:"/config/modelProvider",10:"/config/modelProvider",11:"/config/model",12:"/config/model",13:"/config/model",14:"/config/model",15:"/config/model",16:"/config/model",17:"/config/model",18:"/config/model",19:"/config/model"},h0=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini",modelFetcher:{endpoint:"/models",parser:"gemini"}},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function iM(t){return t?t.replace(/\/+$/,"").toLowerCase():""}function t1e(t){if(!t)return null;const e=iM(t);return h0.find(n=>n.id!=="custom"&&iM(n.base_url)===e)||null}function n1e(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(null),[j,N]=b.useState(null),[T,E]=b.useState("custom"),[_,A]=b.useState(!1),[D,q]=b.useState(!1),[B,H]=b.useState(null),[W,ee]=b.useState(!1),[I,V]=b.useState(""),[L,$]=b.useState(new Set),[K,Y]=b.useState(!1),[R,ie]=b.useState(1),[X,z]=b.useState(20),[U,te]=b.useState(""),[ne,G]=b.useState(new Set),[se,re]=b.useState(new Map),{toast:ae}=Lr(),_e=na(),{state:Be,goToStep:Ye,registerTour:Je}=nN(),Oe=b.useRef(null),Ve=b.useRef(!0);b.useEffect(()=>{Je(Rl,bQ)},[Je]),b.useEffect(()=>{if(Be.activeTourId===Rl&&Be.isRunning){const ve=wQ[Be.stepIndex];ve&&!window.location.pathname.endsWith(ve.replace("/config/",""))&&_e({to:ve})}},[Be.stepIndex,Be.activeTourId,Be.isRunning,_e]);const Ue=b.useRef(Be.stepIndex);b.useEffect(()=>{if(Be.activeTourId===Rl&&Be.isRunning){const ve=Ue.current,He=Be.stepIndex;ve>=3&&ve<=9&&He<3&&w(!1),Ue.current=He}},[Be.stepIndex,Be.activeTourId,Be.isRunning]),b.useEffect(()=>{if(Be.activeTourId!==Rl||!Be.isRunning)return;const ve=He=>{const ht=He.target,vn=Be.stepIndex;vn===2&&ht.closest('[data-tour="add-provider-button"]')?setTimeout(()=>Ye(3),300):vn===9&&ht.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>Ye(10),300)};return document.addEventListener("click",ve,!0),()=>document.removeEventListener("click",ve,!0)},[Be,Ye]),b.useEffect(()=>{$e()},[]);const $e=async()=>{try{r(!0);const ve=await Dh();e(ve.api_providers||[]),d(!1),Ve.current=!1}catch(ve){console.error("加载配置失败:",ve)}finally{r(!1)}},jt=async()=>{try{m(!0),cb().catch(()=>{}),x(!0)}catch(ve){console.error("重启失败:",ve),x(!1),ae({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),m(!1)}},vt=async()=>{try{i(!0),Oe.current&&clearTimeout(Oe.current);const ve=await Dh();ve.api_providers=t,await Uv(ve),d(!1),ae({title:"保存成功",description:"正在重启麦麦..."}),await jt()}catch(ve){console.error("保存配置失败:",ve),ae({title:"保存失败",description:ve.message,variant:"destructive"}),i(!1)}},$n=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},qt=()=>{x(!1),m(!1),ae({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},un=b.useCallback(async ve=>{if(!Ve.current)try{l(!0),await bk("api_providers",ve),d(!1)}catch(He){console.error("自动保存失败:",He),d(!0)}finally{l(!1)}},[]);b.useEffect(()=>{if(!Ve.current)return d(!0),Oe.current&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{un(t)},2e3),()=>{Oe.current&&clearTimeout(Oe.current)}},[t,un]);const Mt=async()=>{try{i(!0),Oe.current&&clearTimeout(Oe.current);const ve=await Dh();ve.api_providers=t,await Uv(ve),d(!1),ae({title:"保存成功",description:"模型提供商配置已保存"})}catch(ve){console.error("保存配置失败:",ve),ae({title:"保存失败",description:ve.message,variant:"destructive"})}finally{i(!1)}},ct=(ve,He)=>{if(ve){const ht=h0.find(vn=>vn.base_url===ve.base_url&&vn.client_type===ve.client_type);E(ht?.id||"custom"),k(ve)}else E("custom"),k({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});N(He),ee(!1),w(!0)},Ne=ve=>{E(ve),A(!1);const He=h0.find(ht=>ht.id===ve);He&&He.id!=="custom"?k(ht=>({...ht,name:He.name,base_url:He.base_url,client_type:He.client_type})):He?.id==="custom"&&k(ht=>({...ht,name:"",base_url:"",client_type:"openai"}))},ze=b.useMemo(()=>T!=="custom",[T]),rt=async()=>{if(S?.api_key)try{await navigator.clipboard.writeText(S.api_key),ae({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{ae({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},bt=()=>{if(!S)return;const ve={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};if(j!==null){const He=[...t];He[j]=ve,e(He)}else e([...t,ve]);w(!1),k(null),N(null)},zt=ve=>{if(!ve&&S){const He={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};k(He)}w(ve)},Rt=ve=>{H(ve),q(!0)},Hn=()=>{if(B!==null){const ve=t.filter((He,ht)=>ht!==B);e(ve),ae({title:"删除成功",description:"提供商已从列表中移除"})}q(!1),H(null)},We=ve=>{const He=new Set(L);He.has(ve)?He.delete(ve):He.add(ve),$(He)},ot=()=>{if(L.size===xn.length)$(new Set);else{const ve=xn.map((He,ht)=>t.findIndex(vn=>vn===xn[ht]));$(new Set(ve))}},dn=()=>{if(L.size===0){ae({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}Y(!0)},Pt=()=>{const ve=t.filter((He,ht)=>!L.has(ht));e(ve),$(new Set),Y(!1),ae({title:"批量删除成功",description:`已删除 ${L.size} 个提供商`})},xn=t.filter(ve=>{if(!I)return!0;const He=I.toLowerCase();return ve.name.toLowerCase().includes(He)||ve.base_url.toLowerCase().includes(He)||ve.client_type.toLowerCase().includes(He)}),dt=Math.ceil(xn.length/X),rn=xn.slice((R-1)*X,R*X),wt=()=>{const ve=parseInt(U);ve>=1&&ve<=dt&&(ie(ve),te(""))},Wt=async ve=>{G(He=>new Set(He).add(ve));try{const He=await Cae(ve);re(ht=>new Map(ht).set(ve,He)),He.network_ok?He.api_key_valid===!0?ae({title:"连接正常",description:`${ve} 网络连接正常,API Key 有效 (${He.latency_ms}ms)`}):He.api_key_valid===!1?ae({title:"连接正常但 Key 无效",description:`${ve} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):ae({title:"网络连接正常",description:`${ve} 可以访问 (${He.latency_ms}ms)`}):ae({title:"连接失败",description:He.error||"无法连接到提供商",variant:"destructive"})}catch(He){ae({title:"测试失败",description:He.message,variant:"destructive"})}finally{G(He=>{const ht=new Set(He);return ht.delete(ve),ht})}},Gt=async()=>{for(const ve of t)await Wt(ve.name)},lt=ve=>{const He=ne.has(ve),ht=se.get(ve);return He?o.jsxs(tn,{variant:"secondary",className:"gap-1",children:[o.jsx(Us,{className:"h-3 w-3 animate-spin"}),"测试中"]}):ht?ht.network_ok?ht.api_key_valid===!0?o.jsxs(tn,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[o.jsx(Ya,{className:"h-3 w-3"}),"正常"]}):ht.api_key_valid===!1?o.jsxs(tn,{variant:"destructive",className:"gap-1",children:[o.jsx(Lo,{className:"h-3 w-3"}),"Key无效"]}):o.jsxs(tn,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[o.jsx(Ya,{className:"h-3 w-3"}),"可访问"]}):o.jsxs(tn,{variant:"destructive",className:"gap-1",children:[o.jsx(OI,{className:"h-3 w-3"}),"离线"]}):null};return n?o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[L.size>0&&o.jsxs(ue,{onClick:dn,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(Cn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",L.size,")"]}),o.jsxs(ue,{onClick:Gt,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:t.length===0||ne.size>0,children:[o.jsx(Zu,{className:"mr-2 h-4 w-4"}),ne.size>0?`测试中 (${ne.size})`:"测试全部"]}),o.jsxs(ue,{onClick:()=>ct(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[o.jsx(Is,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),o.jsxs(ue,{onClick:Mt,disabled:s||a||!c||h,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[o.jsx(zp,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":a?"自动保存中...":c?"保存配置":"已保存"]}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsxs(ue,{disabled:s||a||h,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[o.jsx(Dp,{className:"mr-2 h-4 w-4"}),h?"重启中...":c?"保存并重启":"重启麦麦"]})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认重启麦麦?"}),o.jsx(zn,{className:"space-y-3",asChild:!0,children:o.jsxs("div",{children:[o.jsx("p",{children:c?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(ba,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(Xi,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(wa,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",o.jsxs(Er,{children:[o.jsx(Of,{asChild:!0,children:o.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[o.jsx(Zy,{className:"h-3 w-3"}),"如何结束程序?"]})}),o.jsxs(wr,{className:"max-w-2xl",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"如何结束使用重启功能后的麦麦程序"}),o.jsx(Xr,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),o.jsxs(Yi,{defaultValue:"windows",className:"w-full",children:[o.jsxs(ji,{className:"grid w-full grid-cols-3",children:[o.jsx(Bt,{value:"windows",children:"Windows"}),o.jsx(Bt,{value:"macos",children:"macOS"}),o.jsx(Bt,{value:"linux",children:"Linux"})]}),o.jsxs(ln,{value:"windows",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),o.jsxs("li",{children:["在“进程”或“详细信息”标签页中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),o.jsx("li",{children:"右键点击并选择“结束任务”"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),o.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),o.jsxs(ln,{value:"macos",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"})," 打开 Spotlight,搜索“活动监视器”"]}),o.jsxs("li",{children:["在进程列表中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),o.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]})]}),o.jsxs(ln,{value:"linux",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),o.jsx("p",{children:'pkill -9 -f "bot.py"'}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["在终端输入 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),o.jsx(fs,{children:o.jsx(e6,{asChild:!0,children:o.jsx(ue,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:c?vt:jt,children:c?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(ba,{children:[o.jsx(Xi,{className:"h-4 w-4"}),o.jsxs(wa,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),o.jsxs(pn,{className:"h-[calc(100vh-260px)]",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[o.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索提供商名称、URL 或类型...",value:I,onChange:ve=>V(ve.target.value),className:"pl-9"})]}),I&&o.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",xn.length," 个结果"]})]}),o.jsx("div",{className:"md:hidden space-y-3",children:xn.length===0?o.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:I?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):rn.map((ve,He)=>{const ht=t.findIndex(vn=>vn===ve);return o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o.jsx("h3",{className:"font-semibold text-base truncate",children:ve.name}),lt(ve.name)]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:ve.base_url})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>Wt(ve.name),disabled:ne.has(ve.name),title:"测试连接",children:ne.has(ve.name)?o.jsx(Us,{className:"h-4 w-4 animate-spin"}):o.jsx(Zu,{className:"h-4 w-4"})}),o.jsx(ue,{variant:"default",size:"sm",onClick:()=>ct(ve,ht),children:o.jsx(Ju,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),o.jsx(ue,{size:"sm",onClick:()=>Rt(ht),className:"bg-red-600 hover:bg-red-700 text-white",children:o.jsx(Cn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),o.jsx("p",{className:"font-medium",children:ve.client_type})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),o.jsx("p",{className:"font-medium",children:ve.max_retry})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),o.jsx("p",{className:"font-medium",children:ve.timeout})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),o.jsx("p",{className:"font-medium",children:ve.retry_interval})]})]})]},He)})}),o.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(Af,{children:[o.jsx(Mf,{children:o.jsxs(zs,{children:[o.jsx(mn,{className:"w-12",children:o.jsx(Ci,{checked:L.size===xn.length&&xn.length>0,onCheckedChange:ot})}),o.jsx(mn,{children:"状态"}),o.jsx(mn,{children:"名称"}),o.jsx(mn,{children:"基础URL"}),o.jsx(mn,{children:"客户端类型"}),o.jsx(mn,{className:"text-right",children:"最大重试"}),o.jsx(mn,{className:"text-right",children:"超时(秒)"}),o.jsx(mn,{className:"text-right",children:"重试间隔(秒)"}),o.jsx(mn,{className:"text-right",children:"操作"})]})}),o.jsx(Rf,{children:rn.length===0?o.jsx(zs,{children:o.jsx(Yt,{colSpan:9,className:"text-center text-muted-foreground py-8",children:I?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):rn.map((ve,He)=>{const ht=t.findIndex(vn=>vn===ve);return o.jsxs(zs,{children:[o.jsx(Yt,{children:o.jsx(Ci,{checked:L.has(ht),onCheckedChange:()=>We(ht)})}),o.jsx(Yt,{children:lt(ve.name)||o.jsx(tn,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),o.jsx(Yt,{className:"font-medium",children:ve.name}),o.jsx(Yt,{className:"max-w-xs truncate",title:ve.base_url,children:ve.base_url}),o.jsx(Yt,{children:ve.client_type}),o.jsx(Yt,{className:"text-right",children:ve.max_retry}),o.jsx(Yt,{className:"text-right",children:ve.timeout}),o.jsx(Yt,{className:"text-right",children:ve.retry_interval}),o.jsx(Yt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>Wt(ve.name),disabled:ne.has(ve.name),title:"测试连接",children:ne.has(ve.name)?o.jsx(Us,{className:"h-4 w-4 animate-spin"}):o.jsx(Zu,{className:"h-4 w-4"})}),o.jsxs(ue,{variant:"default",size:"sm",onClick:()=>ct(ve,ht),children:[o.jsx(Ju,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(ue,{size:"sm",onClick:()=>Rt(ht),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Cn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},He)})})]})})}),xn.length>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:X.toString(),onValueChange:ve=>{z(parseInt(ve)),ie(1),$(new Set)},children:[o.jsx($t,{id:"page-size-provider",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*X+1," 到"," ",Math.min(R*X,xn.length)," 条,共 ",xn.length," 条"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>ie(1),disabled:R===1,className:"hidden sm:flex",children:o.jsx(Ip,{className:"h-4 w-4"})}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>ie(ve=>Math.max(1,ve-1)),disabled:R===1,children:[o.jsx(wd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:U,onChange:ve=>te(ve.target.value),onKeyDown:ve=>ve.key==="Enter"&&wt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:dt}),o.jsx(ue,{variant:"outline",size:"sm",onClick:wt,disabled:!U,className:"h-8",children:"跳转"})]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>ie(ve=>ve+1),disabled:R>=dt,children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Zl,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>ie(dt),disabled:R>=dt,className:"hidden sm:flex",children:o.jsx(Lp,{className:"h-4 w-4"})})]})]})]}),o.jsx(Er,{open:y,onOpenChange:zt,children:o.jsxs(wr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:Be.isRunning,children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:j!==null?"编辑提供商":"添加提供商"}),o.jsx(Xr,{children:"配置 API 提供商的连接信息和参数"})]}),o.jsxs("form",{onSubmit:ve=>{ve.preventDefault(),bt()},autoComplete:"off",children:[o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2","data-tour":"provider-template-select",children:[o.jsx(he,{htmlFor:"template",children:"提供商模板"}),o.jsxs(Bo,{open:_,onOpenChange:A,children:[o.jsx(Fo,{asChild:!0,children:o.jsxs(ue,{variant:"outline",role:"combobox","aria-expanded":_,className:"w-full justify-between",children:[T?h0.find(ve=>ve.id===T)?.display_name:"选择提供商模板...",o.jsx(Lj,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(Ka,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:o.jsxs(Tb,{children:[o.jsx(Eb,{placeholder:"搜索提供商模板..."}),o.jsx(pn,{className:"h-[300px]",children:o.jsxs(_b,{className:"max-h-none overflow-visible",children:[o.jsx(Ab,{children:"未找到匹配的模板"}),o.jsx(up,{children:h0.map(ve=>o.jsxs(dp,{value:ve.display_name,onSelect:()=>Ne(ve.id),children:[o.jsx(zo,{className:`mr-2 h-4 w-4 ${T===ve.id?"opacity-100":"opacity-0"}`}),ve.display_name]},ve.id))})]})})]})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[o.jsx(he,{htmlFor:"name",children:"名称 *"}),o.jsx(Pe,{id:"name",value:S?.name||"",onChange:ve=>k(He=>He?{...He,name:ve.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[o.jsx(he,{htmlFor:"base_url",children:"基础 URL *"}),o.jsx(Pe,{id:"base_url",value:S?.base_url||"",onChange:ve=>k(He=>He?{...He,base_url:ve.target.value}:null),placeholder:"https://api.example.com/v1",disabled:ze,className:ze?"bg-muted cursor-not-allowed":""}),ze&&o.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[o.jsx(he,{htmlFor:"api_key",children:"API Key *"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{id:"api_key",type:W?"text":"password",value:S?.api_key||"",onChange:ve=>k(He=>He?{...He,api_key:ve.target.value}:null),placeholder:"sk-...",className:"flex-1"}),o.jsx(ue,{type:"button",variant:"outline",size:"icon",onClick:()=>ee(!W),title:W?"隐藏密钥":"显示密钥",children:W?o.jsx(I0,{className:"h-4 w-4"}):o.jsx(Ji,{className:"h-4 w-4"})}),o.jsx(ue,{type:"button",variant:"outline",size:"icon",onClick:rt,title:"复制密钥",children:o.jsx(Iv,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"client_type",children:"客户端类型"}),o.jsxs(Vt,{value:S?.client_type||"openai",onValueChange:ve=>k(He=>He?{...He,client_type:ve}:null),disabled:ze,children:[o.jsx($t,{id:"client_type",className:ze?"bg-muted cursor-not-allowed":"",children:o.jsx(Ut,{placeholder:"选择客户端类型"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"openai",children:"OpenAI"}),o.jsx(De,{value:"gemini",children:"Gemini"})]})]}),ze&&o.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"max_retry",children:"最大重试"}),o.jsx(Pe,{id:"max_retry",type:"number",min:"0",value:S?.max_retry??"",onChange:ve=>{const He=ve.target.value===""?null:parseInt(ve.target.value);k(ht=>ht?{...ht,max_retry:He}:null)},placeholder:"默认: 2"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"timeout",children:"超时(秒)"}),o.jsx(Pe,{id:"timeout",type:"number",min:"1",value:S?.timeout??"",onChange:ve=>{const He=ve.target.value===""?null:parseInt(ve.target.value);k(ht=>ht?{...ht,timeout:He}:null)},placeholder:"默认: 30"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),o.jsx(Pe,{id:"retry_interval",type:"number",min:"1",value:S?.retry_interval??"",onChange:ve=>{const He=ve.target.value===""?null:parseInt(ve.target.value);k(ht=>ht?{...ht,retry_interval:He}:null)},placeholder:"默认: 10"})]})]})]}),o.jsxs(fs,{children:[o.jsx(ue,{type:"button",variant:"outline",onClick:()=>w(!1),"data-tour":"provider-cancel-button",children:"取消"}),o.jsx(ue,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),o.jsx(Fn,{open:D,onOpenChange:q,children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:['确定要删除提供商 "',B!==null?t[B]?.name:"",'" 吗? 此操作无法撤销。']})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:Hn,children:"删除"})]})]})}),o.jsx(Fn,{open:K,onOpenChange:Y,children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认批量删除"}),o.jsxs(zn,{children:["确定要删除选中的 ",L.size," 个提供商吗? 此操作无法撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:Pt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),g&&o.jsx(r6,{onRestartComplete:$n,onRestartFailed:qt})]})}function r1e(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(s=>s(r))},e)}const Pb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function If(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function rN(t){return"nodeType"in t}function _i(t){var e,n;return t?If(t)?t:rN(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function sN(t){const{Document:e}=_i(t);return t instanceof e}function hg(t){return If(t)?!1:t instanceof _i(t).HTMLElement}function SQ(t){return t instanceof _i(t).SVGElement}function Lf(t){return t?If(t)?t.document:rN(t)?sN(t)?t:hg(t)||SQ(t)?t.ownerDocument:document:document:document}const $o=Pb?b.useLayoutEffect:b.useEffect;function iN(t){const e=b.useRef(t);return $o(()=>{e.current=t}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{t.current=setInterval(r,s)},[]),n=b.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function mp(t,e){e===void 0&&(e=[t]);const n=b.useRef(t);return $o(()=>{n.current!==t&&(n.current=t)},e),n}function fg(t,e){const n=b.useRef();return b.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function yy(t){const e=iN(t),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function NO(t){const e=b.useRef();return b.useEffect(()=>{e.current=t},[t]),e.current}let CS={};function mg(t,e){return b.useMemo(()=>{if(e)return e;const n=CS[t]==null?0:CS[t]+1;return CS[t]=n,t+"-"+n},[t,e])}function kQ(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const l=Object.entries(a);for(const[c,d]of l){const h=i[c];h!=null&&(i[c]=h+t*d)}return i},{...e})}}const qh=kQ(1),pp=kQ(-1);function i1e(t){return"clientX"in t&&"clientY"in t}function aN(t){if(!t)return!1;const{KeyboardEvent:e}=_i(t.target);return e&&t instanceof e}function a1e(t){if(!t)return!1;const{TouchEvent:e}=_i(t.target);return e&&t instanceof e}function CO(t){if(a1e(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return i1e(t)?{x:t.clientX,y:t.clientY}:null}const gp=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[gp.Translate.toString(t),gp.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),aM="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function o1e(t){return t.matches(aM)?t:t.querySelector(aM)}const l1e={display:"none"};function c1e(t){let{id:e,value:n}=t;return oe.createElement("div",{id:e,style:l1e},n)}function u1e(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return oe.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function d1e(){const[t,e]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const OQ=b.createContext(null);function h1e(t){const e=b.useContext(OQ);b.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function f1e(){const[t]=b.useState(()=>new Set),e=b.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[b.useCallback(r=>{let{type:s,event:i}=r;t.forEach(a=>{var l;return(l=a[s])==null?void 0:l.call(a,i)})},[t]),e]}const m1e={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. - `},d1e={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function h1e(t){let{announcements:e=d1e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=u1e}=t;const{announce:i,announcement:a}=o1e(),l=cg("DndLiveRegion"),[c,d]=b.useState(!1);if(b.useEffect(()=>{d(!0)},[]),l1e(b.useMemo(()=>({onDragStart(m){let{active:g}=m;i(e.onDragStart({active:g}))},onDragMove(m){let{active:g,over:x}=m;e.onDragMove&&i(e.onDragMove({active:g,over:x}))},onDragOver(m){let{active:g,over:x}=m;i(e.onDragOver({active:g,over:x}))},onDragEnd(m){let{active:g,over:x}=m;i(e.onDragEnd({active:g,over:x}))},onDragCancel(m){let{active:g,over:x}=m;i(e.onDragCancel({active:g,over:x}))}}),[i,e])),!c)return null;const h=ae.createElement(ae.Fragment,null,ae.createElement(i1e,{id:r,value:s.draggable}),ae.createElement(a1e,{id:l,announcement:a}));return n?pa.createPortal(h,n):h}var ds;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(ds||(ds={}));function py(){}function tM(t,e){return b.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function f1e(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}const Za=Object.freeze({x:0,y:0});function wQ(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function SQ(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function m1e(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function nM(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function kQ(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function rM(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const p1e=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=rM(e,e.left,e.top),i=[];for(const a of r){const{id:l}=a,c=n.get(l);if(c){const d=wQ(rM(c),s);i.push({id:l,data:{droppableContainer:a,value:d}})}}return i.sort(SQ)},g1e=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=nM(e),i=[];for(const a of r){const{id:l}=a,c=n.get(l);if(c){const d=nM(c),h=s.reduce((g,x,y)=>g+wQ(d[y],x),0),m=Number((h/4).toFixed(4));i.push({id:l,data:{droppableContainer:a,value:m}})}}return i.sort(SQ)};function x1e(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),a=s-r,l=i-n;if(r{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=x1e(l,e);c>0&&s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(m1e)};function y1e(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function OQ(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Za}function b1e(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i({...a,top:a.top+t*l.y,bottom:a.bottom+t*l.y,left:a.left+t*l.x,right:a.right+t*l.x}),{...n})}}const w1e=b1e(1);function S1e(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function k1e(t,e,n){const r=S1e(e);if(!r)return t;const{scaleX:s,scaleY:i,x:a,y:l}=r,c=t.left-a-(1-s)*parseFloat(n),d=t.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),h=s?t.width/s:t.width,m=i?t.height/i:t.height;return{width:h,height:m,top:d,right:c+h,bottom:d+m,left:c}}const O1e={ignoreTransform:!1};function Lf(t,e){e===void 0&&(e=O1e);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:h}=Ti(t).getComputedStyle(t);d&&(n=k1e(n,d,h))}const{top:r,left:s,width:i,height:a,bottom:l,right:c}=n;return{top:r,left:s,width:i,height:a,bottom:l,right:c}}function sM(t){return Lf(t,{ignoreTransform:!0})}function j1e(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function N1e(t,e){return e===void 0&&(e=Ti(t).getComputedStyle(t)),e.position==="fixed"}function C1e(t,e){e===void 0&&(e=Ti(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?n.test(i):!1})}function Mb(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(Z6(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!og(s)||vQ(s)||n.includes(s))return n;const i=Ti(t).getComputedStyle(s);return s!==t&&C1e(s,i)&&n.push(s),N1e(s,i)?n:r(s.parentNode)}return t?r(t):n}function jQ(t){const[e]=Mb(t,1);return e??null}function OS(t){return!Ab||!t?null:zf(t)?t:K6(t)?Z6(t)||t===If(t).scrollingElement?window:og(t)?t:null:null}function NQ(t){return zf(t)?t.scrollX:t.scrollLeft}function CQ(t){return zf(t)?t.scrollY:t.scrollTop}function jO(t){return{x:NQ(t),y:CQ(t)}}var ys;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(ys||(ys={}));function TQ(t){return!Ab||!t?!1:t===document.scrollingElement}function EQ(t){const e={x:0,y:0},n=TQ(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,a=t.scrollTop>=r.y,l=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:a,isRight:l,maxScroll:r,minScroll:e}}const T1e={x:.2,y:.2};function E1e(t,e,n,r,s){let{top:i,left:a,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=T1e);const{isTop:d,isBottom:h,isLeft:m,isRight:g}=EQ(t),x={x:0,y:0},y={x:0,y:0},w={height:e.height*s.y,width:e.width*s.x};return!d&&i<=e.top+w.height?(x.y=ys.Backward,y.y=r*Math.abs((e.top+w.height-i)/w.height)):!h&&c>=e.bottom-w.height&&(x.y=ys.Forward,y.y=r*Math.abs((e.bottom-w.height-c)/w.height)),!g&&l>=e.right-w.width?(x.x=ys.Forward,y.x=r*Math.abs((e.right-w.width-l)/w.width)):!m&&a<=e.left+w.width&&(x.x=ys.Backward,y.x=r*Math.abs((e.left+w.width-a)/w.width)),{direction:x,speed:y}}function _1e(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function _Q(t){return t.reduce((e,n)=>Fh(e,jO(n)),Za)}function A1e(t){return t.reduce((e,n)=>e+NQ(n),0)}function M1e(t){return t.reduce((e,n)=>e+CQ(n),0)}function R1e(t,e){if(e===void 0&&(e=Lf),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);jQ(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const D1e=[["x",["left","right"],A1e],["y",["top","bottom"],M1e]];class tN{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Mb(n),s=_Q(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,a,l]of D1e)for(const c of a)Object.defineProperty(this,c,{get:()=>{const d=l(r),h=s[i]-d;return this.rect[c]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class C0{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function P1e(t){const{EventTarget:e}=Ti(t);return t instanceof e?t:If(t)}function jS(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var da;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(da||(da={}));function iM(t){t.preventDefault()}function z1e(t){t.stopPropagation()}var bn;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(bn||(bn={}));const AQ={start:[bn.Space,bn.Enter],cancel:[bn.Esc],end:[bn.Space,bn.Enter,bn.Tab]},I1e=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case bn.Right:return{...n,x:n.x+25};case bn.Left:return{...n,x:n.x-25};case bn.Down:return{...n,y:n.y+25};case bn.Up:return{...n,y:n.y-25}}};class nN{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new C0(If(n)),this.windowListeners=new C0(Ti(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(da.Resize,this.handleCancel),this.windowListeners.add(da.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(da.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&R1e(r),n(Za)}handleKeyDown(e){if(eN(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=AQ,coordinateGetter:a=I1e,scrollBehavior:l="smooth"}=s,{code:c}=e;if(i.end.includes(c)){this.handleEnd(e);return}if(i.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:d}=r.current,h=d?{x:d.left,y:d.top}:Za;this.referenceCoordinates||(this.referenceCoordinates=h);const m=a(e,{active:n,context:r.current,currentCoordinates:h});if(m){const g=dp(m,h),x={x:0,y:0},{scrollableAncestors:y}=r.current;for(const w of y){const S=e.code,{isTop:k,isRight:j,isLeft:N,isBottom:T,maxScroll:E,minScroll:_}=EQ(w),A=_1e(w),L={x:Math.min(S===bn.Right?A.right-A.width/2:A.right,Math.max(S===bn.Right?A.left:A.left+A.width/2,m.x)),y:Math.min(S===bn.Down?A.bottom-A.height/2:A.bottom,Math.max(S===bn.Down?A.top:A.top+A.height/2,m.y))},P=S===bn.Right&&!j||S===bn.Left&&!N,B=S===bn.Down&&!T||S===bn.Up&&!k;if(P&&L.x!==m.x){const $=w.scrollLeft+g.x,U=S===bn.Right&&$<=E.x||S===bn.Left&&$>=_.x;if(U&&!g.y){w.scrollTo({left:$,behavior:l});return}U?x.x=w.scrollLeft-$:x.x=S===bn.Right?w.scrollLeft-E.x:w.scrollLeft-_.x,x.x&&w.scrollBy({left:-x.x,behavior:l});break}else if(B&&L.y!==m.y){const $=w.scrollTop+g.y,U=S===bn.Down&&$<=E.y||S===bn.Up&&$>=_.y;if(U&&!g.x){w.scrollTo({top:$,behavior:l});return}U?x.y=w.scrollTop-$:x.y=S===bn.Down?w.scrollTop-E.y:w.scrollTop-_.y,x.y&&w.scrollBy({top:-x.y,behavior:l});break}}this.handleMove(e,Fh(dp(m,this.referenceCoordinates),x))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}nN.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=AQ,onActivation:s}=e,{active:i}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const l=i.activatorNode.current;return l&&t.target!==l?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function aM(t){return!!(t&&"distance"in t)}function oM(t){return!!(t&&"delay"in t)}class rN{constructor(e,n,r){var s;r===void 0&&(r=P1e(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:a}=i;this.props=e,this.events=n,this.document=If(a),this.documentListeners=new C0(this.document),this.listeners=new C0(r),this.windowListeners=new C0(Ti(a)),this.initialCoordinates=(s=OO(i))!=null?s:Za,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(da.Resize,this.handleCancel),this.windowListeners.add(da.DragStart,iM),this.windowListeners.add(da.VisibilityChange,this.handleCancel),this.windowListeners.add(da.ContextMenu,iM),this.documentListeners.add(da.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(oM(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(aM(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(da.Click,z1e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(da.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:l}}=i;if(!s)return;const c=(n=OO(e))!=null?n:Za,d=dp(s,c);if(!r&&l){if(aM(l)){if(l.tolerance!=null&&jS(d,l.tolerance))return this.handleCancel();if(jS(d,l.distance))return this.handleStart()}if(oM(l)&&jS(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}e.cancelable&&e.preventDefault(),a(c)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===bn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const L1e={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class sN extends rN{constructor(e){const{event:n}=e,r=If(n.target);super(e,L1e,r)}}sN.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const B1e={move:{name:"mousemove"},end:{name:"mouseup"}};var NO;(function(t){t[t.RightClick=2]="RightClick"})(NO||(NO={}));class F1e extends rN{constructor(e){super(e,B1e,If(e.event.target))}}F1e.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===NO.RightClick?!1:(r?.({event:n}),!0)}}];const NS={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class q1e extends rN{constructor(e){super(e,NS)}static setup(){return window.addEventListener(NS.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(NS.move.name,e)};function e(){}}}q1e.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var T0;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(T0||(T0={}));var gy;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(gy||(gy={}));function $1e(t){let{acceleration:e,activator:n=T0.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:a=5,order:l=gy.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:h,delta:m,threshold:g}=t;const x=Q1e({delta:m,disabled:!i}),[y,w]=e1e(),S=b.useRef({x:0,y:0}),k=b.useRef({x:0,y:0}),j=b.useMemo(()=>{switch(n){case T0.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case T0.DraggableRect:return s}},[n,s,c]),N=b.useRef(null),T=b.useCallback(()=>{const _=N.current;if(!_)return;const A=S.current.x*k.current.x,L=S.current.y*k.current.y;_.scrollBy(A,L)},[]),E=b.useMemo(()=>l===gy.TreeOrder?[...d].reverse():d,[l,d]);b.useEffect(()=>{if(!i||!d.length||!j){w();return}for(const _ of E){if(r?.(_)===!1)continue;const A=d.indexOf(_),L=h[A];if(!L)continue;const{direction:P,speed:B}=E1e(_,L,j,e,g);for(const $ of["x","y"])x[$][P[$]]||(B[$]=0,P[$]=0);if(B.x>0||B.y>0){w(),N.current=_,y(T,a),S.current=B,k.current=P;return}}S.current={x:0,y:0},k.current={x:0,y:0},w()},[e,T,r,w,i,a,JSON.stringify(j),JSON.stringify(x),y,d,E,h,JSON.stringify(g)])}const H1e={x:{[ys.Backward]:!1,[ys.Forward]:!1},y:{[ys.Backward]:!1,[ys.Forward]:!1}};function Q1e(t){let{delta:e,disabled:n}=t;const r=kO(e);return lg(s=>{if(n||!r||!s)return H1e;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[ys.Backward]:s.x[ys.Backward]||i.x===-1,[ys.Forward]:s.x[ys.Forward]||i.x===1},y:{[ys.Backward]:s.y[ys.Backward]||i.y===-1,[ys.Forward]:s.y[ys.Forward]||i.y===1}}},[n,e,r])}function V1e(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return lg(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function U1e(t,e){return b.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,r)}));return[...n,...i]},[]),[t,e])}var fp;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(fp||(fp={}));var CO;(function(t){t.Optimized="optimized"})(CO||(CO={}));const lM=new Map;function W1e(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,a]=b.useState(null),{frequency:l,measure:c,strategy:d}=s,h=b.useRef(t),m=S(),g=up(m),x=b.useCallback(function(k){k===void 0&&(k=[]),!g.current&&a(j=>j===null?k:j.concat(k.filter(N=>!j.includes(N))))},[g]),y=b.useRef(null),w=lg(k=>{if(m&&!n)return lM;if(!k||k===lM||h.current!==t||i!=null){const j=new Map;for(let N of t){if(!N)continue;if(i&&i.length>0&&!i.includes(N.id)&&N.rect.current){j.set(N.id,N.rect.current);continue}const T=N.node.current,E=T?new tN(c(T),T):null;N.rect.current=E,E&&j.set(N.id,E)}return j}return k},[t,i,n,m,c]);return b.useEffect(()=>{h.current=t},[t]),b.useEffect(()=>{m||x()},[n,m]),b.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),b.useEffect(()=>{m||typeof l!="number"||y.current!==null||(y.current=setTimeout(()=>{x(),y.current=null},l))},[l,m,x,...r]),{droppableRects:w,measureDroppableContainers:x,measuringScheduled:i!=null};function S(){switch(d){case fp.Always:return!1;case fp.BeforeDragging:return n;default:return!n}}}function MQ(t,e){return lg(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function G1e(t,e){return MQ(t,e)}function X1e(t){let{callback:e,disabled:n}=t;const r=J6(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function Rb(t){let{callback:e,disabled:n}=t;const r=J6(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function Y1e(t){return new tN(Lf(t),t)}function cM(t,e,n){e===void 0&&(e=Y1e);const[r,s]=b.useState(null);function i(){s(c=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=c??n)!=null?d:null}const h=e(t);return JSON.stringify(c)===JSON.stringify(h)?c:h})}const a=X1e({callback(c){if(t)for(const d of c){const{type:h,target:m}=d;if(h==="childList"&&m instanceof HTMLElement&&m.contains(t)){i();break}}}}),l=Rb({callback:i});return Bo(()=>{i(),t?(l?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),a?.disconnect())},[t]),r}function K1e(t){const e=MQ(t);return OQ(t,e)}const uM=[];function Z1e(t){const e=b.useRef(t),n=lg(r=>t?r&&r!==uM&&t&&e.current&&t.parentNode===e.current.parentNode?r:Mb(t):uM,[t]);return b.useEffect(()=>{e.current=t},[t]),n}function J1e(t){const[e,n]=b.useState(null),r=b.useRef(t),s=b.useCallback(i=>{const a=OS(i.target);a&&n(l=>l?(l.set(a,jO(a)),new Map(l)):null)},[]);return b.useEffect(()=>{const i=r.current;if(t!==i){a(i);const l=t.map(c=>{const d=OS(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,jO(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=t}return()=>{a(t),a(i)};function a(l){l.forEach(c=>{const d=OS(c);d?.removeEventListener("scroll",s)})}},[s,t]),b.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>Fh(i,a),Za):_Q(t):Za,[t,e])}function dM(t,e){e===void 0&&(e=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},e),b.useEffect(()=>{const r=t!==Za;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?dp(t,n.current):Za}function eve(t){b.useEffect(()=>{if(!Ab)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function tve(t,e){return b.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=a=>{i(a,e)},n},{}),[t,e])}function RQ(t){return b.useMemo(()=>t?j1e(t):null,[t])}const hM=[];function nve(t,e){e===void 0&&(e=Lf);const[n]=t,r=RQ(n?Ti(n):null),[s,i]=b.useState(hM);function a(){i(()=>t.length?t.map(c=>TQ(c)?r:new tN(e(c),c)):hM)}const l=Rb({callback:a});return Bo(()=>{l?.disconnect(),a(),t.forEach(c=>l?.observe(c))},[t]),s}function rve(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return og(e)?e:t}function sve(t){let{measure:e}=t;const[n,r]=b.useState(null),s=b.useCallback(d=>{for(const{target:h}of d)if(og(h)){r(m=>{const g=e(h);return m?{...m,width:g.width,height:g.height}:g});break}},[e]),i=Rb({callback:s}),a=b.useCallback(d=>{const h=rve(d);i?.disconnect(),h&&i?.observe(h),r(h?e(h):null)},[e,i]),[l,c]=my(a);return b.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const ive=[{sensor:sN,options:{}},{sensor:nN,options:{}}],ave={current:{}},wv={draggable:{measure:sM},droppable:{measure:sM,strategy:fp.WhileDragging,frequency:CO.Optimized},dragOverlay:{measure:Lf}};class E0 extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const ove={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new E0,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:py},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:wv,measureDroppableContainers:py,windowRect:null,measuringScheduled:!1},lve={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:py,draggableNodes:new Map,over:null,measureDroppableContainers:py},Db=b.createContext(lve),DQ=b.createContext(ove);function cve(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new E0}}}function uve(t,e){switch(e.type){case ds.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ds.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case ds.DragEnd:case ds.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ds.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new E0(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case ds.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const a=new E0(t.droppable.containers);return a.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:a}}}case ds.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new E0(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function dve(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=b.useContext(Db),i=kO(r),a=kO(n?.id);return b.useEffect(()=>{if(!e&&!r&&i&&a!=null){if(!eN(i)||document.activeElement===i.target)return;const l=s.get(a);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const h of[c.current,d.current]){if(!h)continue;const m=r1e(h);if(m){m.focus();break}}})}},[r,e,s,a,i]),null}function hve(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function fve(t){return b.useMemo(()=>({draggable:{...wv.draggable,...t?.draggable},droppable:{...wv.droppable,...t?.droppable},dragOverlay:{...wv.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function mve(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=b.useRef(!1),{x:a,y:l}=typeof s=="boolean"?{x:s,y:s}:s;Bo(()=>{if(!a&&!l||!e){i.current=!1;return}if(i.current||!r)return;const d=e?.node.current;if(!d||d.isConnected===!1)return;const h=n(d),m=OQ(h,r);if(a||(m.x=0),l||(m.y=0),i.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const g=jQ(d);g&&g.scrollBy({top:m.y,left:m.x})}},[e,a,l,r,n])}const PQ=b.createContext({...Za,scaleX:1,scaleY:1});var Dc;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Dc||(Dc={}));const pve=b.memo(function(e){var n,r,s,i;let{id:a,accessibility:l,autoScroll:c=!0,children:d,sensors:h=ive,collisionDetection:m=v1e,measuring:g,modifiers:x,...y}=e;const w=b.useReducer(uve,void 0,cve),[S,k]=w,[j,N]=c1e(),[T,E]=b.useState(Dc.Uninitialized),_=T===Dc.Initialized,{draggable:{active:A,nodes:L,translate:P},droppable:{containers:B}}=S,$=A!=null?L.get(A):null,U=b.useRef({initial:null,translated:null}),te=b.useMemo(()=>{var Kt;return A!=null?{id:A,data:(Kt=$?.data)!=null?Kt:ave,rect:U}:null},[A,$]),z=b.useRef(null),[Q,F]=b.useState(null),[Y,J]=b.useState(null),X=up(y,Object.values(y)),R=cg("DndDescribedBy",a),ie=b.useMemo(()=>B.getEnabled(),[B]),G=fve(g),{droppableRects:I,measureDroppableContainers:V,measuringScheduled:ee}=W1e(ie,{dragging:_,dependencies:[P.x,P.y],config:G.droppable}),ne=V1e(L,A),W=b.useMemo(()=>Y?OO(Y):null,[Y]),se=nn(),re=G1e(ne,G.draggable.measure);mve({activeNode:A!=null?L.get(A):null,config:se.layoutShiftCompensation,initialRect:re,measure:G.draggable.measure});const oe=cM(ne,G.draggable.measure,re),Te=cM(ne?ne.parentElement:null),We=b.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ye=B.getNodeFor((n=We.current.over)==null?void 0:n.id),Je=sve({measure:G.dragOverlay.measure}),Oe=(r=Je.nodeRef.current)!=null?r:ne,Ve=_?(s=Je.rect)!=null?s:oe:null,Ue=!!(Je.nodeRef.current&&Je.rect),He=K1e(Ue?null:oe),Ot=RQ(Oe?Ti(Oe):null),xt=Z1e(_?Ye??ne:null),kn=nve(xt),It=hve(x,{transform:{x:P.x-He.x,y:P.y-He.y,scaleX:1,scaleY:1},activatorEvent:Y,active:te,activeNodeRect:oe,containerNodeRect:Te,draggingNodeRect:Ve,over:We.current.over,overlayNodeRect:Je.rect,scrollableAncestors:xt,scrollableAncestorRects:kn,windowRect:Ot}),Yt=W?Fh(W,P):null,_t=J1e(xt),mt=dM(_t),Ne=dM(_t,[oe]),Ie=Fh(It,mt),st=Ve?w1e(Ve,It):null,yt=te&&st?m({active:te,collisionRect:st,droppableRects:I,droppableContainers:ie,pointerCoordinates:Yt}):null,Pt=kQ(yt,"id"),[Mt,zn]=b.useState(null),Fe=Ue?It:Fh(It,Ne),rt=y1e(Fe,(i=Mt?.rect)!=null?i:null,oe),tn=b.useRef(null),Rt=b.useCallback((Kt,pt)=>{let{sensor:xr,options:Ur}=pt;if(z.current==null)return;const Wr=L.get(z.current);if(!Wr)return;const vr=Kt.nativeEvent,In=new xr({active:z.current,activeNode:Wr,event:vr,options:Ur,context:We,onAbort(nr){if(!L.get(nr))return;const{onDragAbort:xs}=X.current,js={id:nr};xs?.(js),j({type:"onDragAbort",event:js})},onPending(nr,gs,xs,js){if(!L.get(nr))return;const{onDragPending:Le}=X.current,Ct={id:nr,constraint:gs,initialCoordinates:xs,offset:js};Le?.(Ct),j({type:"onDragPending",event:Ct})},onStart(nr){const gs=z.current;if(gs==null)return;const xs=L.get(gs);if(!xs)return;const{onDragStart:js}=X.current,ge={activatorEvent:vr,active:{id:gs,data:xs.data,rect:U}};pa.unstable_batchedUpdates(()=>{js?.(ge),E(Dc.Initializing),k({type:ds.DragStart,initialCoordinates:nr,active:gs}),j({type:"onDragStart",event:ge}),F(tn.current),J(vr)})},onMove(nr){k({type:ds.DragMove,coordinates:nr})},onEnd:cr(ds.DragEnd),onCancel:cr(ds.DragCancel)});tn.current=In;function cr(nr){return async function(){const{active:xs,collisions:js,over:ge,scrollAdjustedTranslate:Le}=We.current;let Ct=null;if(xs&&Le){const{cancelDrop:vn}=X.current;Ct={activatorEvent:vr,active:xs,collisions:js,delta:Le,over:ge},nr===ds.DragEnd&&typeof vn=="function"&&await Promise.resolve(vn(Ct))&&(nr=ds.DragCancel)}z.current=null,pa.unstable_batchedUpdates(()=>{k({type:nr}),E(Dc.Uninitialized),zn(null),F(null),J(null),tn.current=null;const vn=nr===ds.DragEnd?"onDragEnd":"onDragCancel";if(Ct){const Fr=X.current[vn];Fr?.(Ct),j({type:vn,event:Ct})}})}}},[L]),ke=b.useCallback((Kt,pt)=>(xr,Ur)=>{const Wr=xr.nativeEvent,vr=L.get(Ur);if(z.current!==null||!vr||Wr.dndKit||Wr.defaultPrevented)return;const In={active:vr};Kt(xr,pt.options,In)===!0&&(Wr.dndKit={capturedBy:pt.sensor},z.current=Ur,Rt(xr,pt))},[L,Rt]),Pe=U1e(h,ke);eve(h),Bo(()=>{oe&&T===Dc.Initializing&&E(Dc.Initialized)},[oe,T]),b.useEffect(()=>{const{onDragMove:Kt}=X.current,{active:pt,activatorEvent:xr,collisions:Ur,over:Wr}=We.current;if(!pt||!xr)return;const vr={active:pt,activatorEvent:xr,collisions:Ur,delta:{x:Ie.x,y:Ie.y},over:Wr};pa.unstable_batchedUpdates(()=>{Kt?.(vr),j({type:"onDragMove",event:vr})})},[Ie.x,Ie.y]),b.useEffect(()=>{const{active:Kt,activatorEvent:pt,collisions:xr,droppableContainers:Ur,scrollAdjustedTranslate:Wr}=We.current;if(!Kt||z.current==null||!pt||!Wr)return;const{onDragOver:vr}=X.current,In=Ur.get(Pt),cr=In&&In.rect.current?{id:In.id,rect:In.rect.current,data:In.data,disabled:In.disabled}:null,nr={active:Kt,activatorEvent:pt,collisions:xr,delta:{x:Wr.x,y:Wr.y},over:cr};pa.unstable_batchedUpdates(()=>{zn(cr),vr?.(nr),j({type:"onDragOver",event:nr})})},[Pt]),Bo(()=>{We.current={activatorEvent:Y,active:te,activeNode:ne,collisionRect:st,collisions:yt,droppableRects:I,draggableNodes:L,draggingNode:Oe,draggingNodeRect:Ve,droppableContainers:B,over:Mt,scrollableAncestors:xt,scrollAdjustedTranslate:Ie},U.current={initial:Ve,translated:st}},[te,ne,yt,st,L,Oe,Ve,I,B,Mt,xt,Ie]),$1e({...se,delta:P,draggingRect:st,pointerCoordinates:Yt,scrollableAncestors:xt,scrollableAncestorRects:kn});const it=b.useMemo(()=>({active:te,activeNode:ne,activeNodeRect:oe,activatorEvent:Y,collisions:yt,containerNodeRect:Te,dragOverlay:Je,draggableNodes:L,droppableContainers:B,droppableRects:I,over:Mt,measureDroppableContainers:V,scrollableAncestors:xt,scrollableAncestorRects:kn,measuringConfiguration:G,measuringScheduled:ee,windowRect:Ot}),[te,ne,oe,Y,yt,Te,Je,L,B,I,Mt,V,xt,kn,G,ee,Ot]),ot=b.useMemo(()=>({activatorEvent:Y,activators:Pe,active:te,activeNodeRect:oe,ariaDescribedById:{draggable:R},dispatch:k,draggableNodes:L,over:Mt,measureDroppableContainers:V}),[Y,Pe,te,oe,k,R,L,Mt,V]);return ae.createElement(bQ.Provider,{value:N},ae.createElement(Db.Provider,{value:ot},ae.createElement(DQ.Provider,{value:it},ae.createElement(PQ.Provider,{value:rt},d)),ae.createElement(dve,{disabled:l?.restoreFocus===!1})),ae.createElement(h1e,{...l,hiddenTextDescribedById:R}));function nn(){const Kt=Q?.autoScrollEnabled===!1,pt=typeof c=="object"?c.enabled===!1:c===!1,xr=_&&!Kt&&!pt;return typeof c=="object"?{...c,enabled:xr}:{enabled:xr}}}),gve=b.createContext(null),fM="button",xve="Draggable";function vve(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=cg(xve),{activators:a,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:h,draggableNodes:m,over:g}=b.useContext(Db),{role:x=fM,roleDescription:y="draggable",tabIndex:w=0}=s??{},S=c?.id===e,k=b.useContext(S?PQ:gve),[j,N]=my(),[T,E]=my(),_=tve(a,e),A=up(n);Bo(()=>(m.set(e,{id:e,key:i,node:j,activatorNode:T,data:A}),()=>{const P=m.get(e);P&&P.key===i&&m.delete(e)}),[m,e]);const L=b.useMemo(()=>({role:x,tabIndex:w,"aria-disabled":r,"aria-pressed":S&&x===fM?!0:void 0,"aria-roledescription":y,"aria-describedby":h.draggable}),[r,x,w,S,y,h.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:L,isDragging:S,listeners:r?void 0:_,node:j,over:g,setNodeRef:N,setActivatorNodeRef:E,transform:k}}function yve(){return b.useContext(DQ)}const bve="Droppable",wve={timeout:25};function Sve(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=cg(bve),{active:a,dispatch:l,over:c,measureDroppableContainers:d}=b.useContext(Db),h=b.useRef({disabled:n}),m=b.useRef(!1),g=b.useRef(null),x=b.useRef(null),{disabled:y,updateMeasurementsFor:w,timeout:S}={...wve,...s},k=up(w??r),j=b.useCallback(()=>{if(!m.current){m.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{d(Array.isArray(k.current)?k.current:[k.current]),x.current=null},S)},[S]),N=Rb({callback:j,disabled:y||!a}),T=b.useCallback((L,P)=>{N&&(P&&(N.unobserve(P),m.current=!1),L&&N.observe(L))},[N]),[E,_]=my(T),A=up(e);return b.useEffect(()=>{!N||!E.current||(N.disconnect(),m.current=!1,N.observe(E.current))},[E,N]),b.useEffect(()=>(l({type:ds.RegisterDroppable,element:{id:r,key:i,disabled:n,node:E,rect:g,data:A}}),()=>l({type:ds.UnregisterDroppable,key:i,id:r})),[r]),b.useEffect(()=>{n!==h.current.disabled&&(l({type:ds.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)},[r,i,n,l]),{active:a,rect:g,isOver:c?.id===r,node:E,over:c,setNodeRef:_}}function iN(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function kve(t,e){return t.reduce((n,r,s)=>{const i=e.get(r);return i&&(n[s]=i),n},Array(t.length))}function j1(t){return t!==null&&t>=0}function Ove(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{var e;let{rects:n,activeNodeRect:r,activeIndex:s,overIndex:i,index:a}=t;const l=(e=n[s])!=null?e:r;if(!l)return null;const c=Cve(n,a,s);if(a===s){const d=n[i];return d?{x:ss&&a<=i?{x:-l.width-c,y:0,...N1}:a=i?{x:l.width+c,y:0,...N1}:{x:0,y:0,...N1}};function Cve(t,e,n){const r=t[e],s=t[e-1],i=t[e+1];return!r||!s&&!i?0:n{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const i=iN(e,r,n),a=e[s],l=i[s];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},IQ="Sortable",LQ=ae.createContext({activeIndex:-1,containerId:IQ,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:zQ,disabled:{draggable:!1,droppable:!1}});function Tve(t){let{children:e,id:n,items:r,strategy:s=zQ,disabled:i=!1}=t;const{active:a,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:h}=yve(),m=cg(IQ,n),g=l.rect!==null,x=b.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),y=a!=null,w=a?x.indexOf(a.id):-1,S=d?x.indexOf(d.id):-1,k=b.useRef(x),j=!Ove(x,k.current),N=S!==-1&&w===-1||j,T=jve(i);Bo(()=>{j&&y&&h(x)},[j,x,y,h]),b.useEffect(()=>{k.current=x},[x]);const E=b.useMemo(()=>({activeIndex:w,containerId:m,disabled:T,disableTransforms:N,items:x,overIndex:S,useDragOverlay:g,sortedRects:kve(x,c),strategy:s}),[w,m,T.draggable,T.droppable,N,x,S,c,g,s]);return ae.createElement(LQ.Provider,{value:E},e)}const Eve=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return iN(n,r,s).indexOf(e)},_ve=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:i,newIndex:a,previousItems:l,previousContainerId:c,transition:d}=t;return!d||!r||l!==i&&s===a?!1:n?!0:a!==s&&e===c},Ave={duration:200,easing:"ease"},BQ="transform",Mve=hp.Transition.toString({property:BQ,duration:0,easing:"linear"}),Rve={roleDescription:"sortable"};function Dve(t){let{disabled:e,index:n,node:r,rect:s}=t;const[i,a]=b.useState(null),l=b.useRef(n);return Bo(()=>{if(!e&&n!==l.current&&r.current){const c=s.current;if(c){const d=Lf(r.current,{ignoreTransform:!0}),h={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(h.x||h.y)&&a(h)}}n!==l.current&&(l.current=n)},[e,n,r,s]),b.useEffect(()=>{i&&a(null)},[i]),i}function Pve(t){let{animateLayoutChanges:e=_ve,attributes:n,disabled:r,data:s,getNewIndex:i=Eve,id:a,strategy:l,resizeObserverConfig:c,transition:d=Ave}=t;const{items:h,containerId:m,activeIndex:g,disabled:x,disableTransforms:y,sortedRects:w,overIndex:S,useDragOverlay:k,strategy:j}=b.useContext(LQ),N=zve(r,x),T=h.indexOf(a),E=b.useMemo(()=>({sortable:{containerId:m,index:T,items:h},...s}),[m,s,T,h]),_=b.useMemo(()=>h.slice(h.indexOf(a)),[h,a]),{rect:A,node:L,isOver:P,setNodeRef:B}=Sve({id:a,data:E,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...c}}),{active:$,activatorEvent:U,activeNodeRect:te,attributes:z,setNodeRef:Q,listeners:F,isDragging:Y,over:J,setActivatorNodeRef:X,transform:R}=vve({id:a,data:E,attributes:{...Rve,...n},disabled:N.draggable}),ie=Jxe(B,Q),G=!!$,I=G&&!y&&j1(g)&&j1(S),V=!k&&Y,ee=V&&I?R:null,W=I?ee??(l??j)({rects:w,activeNodeRect:te,activeIndex:g,overIndex:S,index:T}):null,se=j1(g)&&j1(S)?i({id:a,items:h,activeIndex:g,overIndex:S}):T,re=$?.id,oe=b.useRef({activeId:re,items:h,newIndex:se,containerId:m}),Te=h!==oe.current.items,We=e({active:$,containerId:m,isDragging:Y,isSorting:G,id:a,index:T,items:h,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:d,wasDragging:oe.current.activeId!=null}),Ye=Dve({disabled:!We,index:T,node:L,rect:A});return b.useEffect(()=>{G&&oe.current.newIndex!==se&&(oe.current.newIndex=se),m!==oe.current.containerId&&(oe.current.containerId=m),h!==oe.current.items&&(oe.current.items=h)},[G,se,m,h]),b.useEffect(()=>{if(re===oe.current.activeId)return;if(re!=null&&oe.current.activeId==null){oe.current.activeId=re;return}const Oe=setTimeout(()=>{oe.current.activeId=re},50);return()=>clearTimeout(Oe)},[re]),{active:$,activeIndex:g,attributes:z,data:E,rect:A,index:T,newIndex:se,items:h,isOver:P,isSorting:G,isDragging:Y,listeners:F,node:L,overIndex:S,over:J,setNodeRef:ie,setActivatorNodeRef:X,setDroppableNodeRef:B,setDraggableNodeRef:Q,transform:Ye??W,transition:Je()};function Je(){if(Ye||Te&&oe.current.newIndex===T)return Mve;if(!(V&&!eN(U)||!d)&&(G||We))return hp.Transition.toString({...d,property:BQ})}}function zve(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function xy(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Ive=[bn.Down,bn.Right,bn.Up,bn.Left],Lve=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:a,scrollableAncestors:l}}=e;if(Ive.includes(t.code)){if(t.preventDefault(),!n||!r)return;const c=[];i.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const g=s.get(m.id);if(g)switch(t.code){case bn.Down:r.topg.top&&c.push(m);break;case bn.Left:r.left>g.left&&c.push(m);break;case bn.Right:r.left1&&(h=d[1].id),h!=null){const m=i.get(n.id),g=i.get(h),x=g?s.get(g.id):null,y=g?.node.current;if(y&&x&&m&&g){const S=Mb(y).some((_,A)=>l[A]!==_),k=FQ(m,g),j=Bve(m,g),N=S||!k?{x:0,y:0}:{x:j?r.width-x.width:0,y:j?r.height-x.height:0},T={x:x.left,y:x.top};return N.x&&N.y?T:dp(T,N)}}}};function FQ(t,e){return!xy(t)||!xy(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Bve(t,e){return!xy(t)||!xy(e)||!FQ(t,e)?!1:t.data.current.sortable.index{h.stopPropagation(),n(t)}})]})})}function qve({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[a,l]=b.useState(!1),c=f1e(tM(sN,{activationConstraint:{distance:8}}),tM(nN,{coordinateGetter:Lve})),d=g=>{e.includes(g)?n(e.filter(x=>x!==g)):n([...e,g])},h=g=>{n(e.filter(x=>x!==g))},m=g=>{const{active:x,over:y}=g;if(y&&x.id!==y.id){const w=e.indexOf(x.id),S=e.indexOf(y.id);n(iN(e,w,S))}};return o.jsxs(zo,{open:a,onOpenChange:l,children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":a,className:xe("w-full justify-between min-h-10 h-auto",i),children:[o.jsx(pve,{sensors:c,collisionDetection:p1e,onDragEnd:m,children:o.jsx(Tve,{items:e,strategy:Nve,children:o.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?o.jsx("span",{className:"text-muted-foreground",children:r}):e.map(g=>{const x=t.find(y=>y.value===g);return o.jsx(Fve,{value:g,label:x?.label||g,onRemove:h},g)})})})}),o.jsx(Mj,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),o.jsx(Xa,{className:"w-full p-0",align:"start",children:o.jsxs(Ob,{children:[o.jsx(jb,{placeholder:"搜索...",className:"h-9"}),o.jsxs(Nb,{children:[o.jsx(Cb,{children:s}),o.jsx(ap,{children:t.map(g=>{const x=e.includes(g.value);return o.jsxs(op,{value:g.value,onSelect:()=>d(g.value),children:[o.jsx("div",{className:xe("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:o.jsx(Ro,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),o.jsx("span",{children:g.label})]},g.value)})})]})]})})]})}const mM=new Map,$ve=300*1e3;function Hve(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[a,l]=b.useState([]),[c,d]=b.useState(null),[h,m]=b.useState(!0),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[j,N]=b.useState(!1),[T,E]=b.useState(!1),[_,A]=b.useState(!1),[L,P]=b.useState(null),[B,$]=b.useState(null),[U,te]=b.useState(!1),[z,Q]=b.useState(null),[F,Y]=b.useState(""),[J,X]=b.useState(new Set),[R,ie]=b.useState(!1),[G,I]=b.useState(1),[V,ee]=b.useState(20),[ne,W]=b.useState(""),[se,re]=b.useState([]),[oe,Te]=b.useState(!1),[We,Ye]=b.useState(null),[Je,Oe]=b.useState(!1),[Ve,Ue]=b.useState(null),{toast:He}=as(),Ot=Zi(),{registerTour:xt,startTour:kn,state:It,goToStep:Yt}=Y6(),_t=b.useRef(null),mt=b.useRef(null),Ne=b.useRef(!0);b.useEffect(()=>{xt(_l,gQ)},[xt]),b.useEffect(()=>{if(It.activeTourId===_l&&It.isRunning){const ge=xQ[It.stepIndex];ge&&!window.location.pathname.endsWith(ge.replace("/config/",""))&&Ot({to:ge})}},[It.stepIndex,It.activeTourId,It.isRunning,Ot]);const Ie=b.useRef(It.stepIndex);b.useEffect(()=>{if(It.activeTourId===_l&&It.isRunning){const ge=Ie.current,Le=It.stepIndex;ge>=12&&ge<=17&&Le<12&&A(!1),Ie.current=Le}},[It.stepIndex,It.activeTourId,It.isRunning]),b.useEffect(()=>{if(It.activeTourId!==_l||!It.isRunning)return;const ge=Le=>{const Ct=Le.target,vn=It.stepIndex;vn===2&&Ct.closest('[data-tour="add-provider-button"]')?setTimeout(()=>Yt(3),300):vn===9&&Ct.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>Yt(10),300):vn===11&&Ct.closest('[data-tour="add-model-button"]')?setTimeout(()=>Yt(12),300):vn===17&&Ct.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>Yt(18),300):vn===18&&Ct.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>Yt(19),300)};return document.addEventListener("click",ge,!0),()=>document.removeEventListener("click",ge,!0)},[It,Yt]);const st=()=>{kn(_l)};b.useEffect(()=>{yt()},[]);const yt=async()=>{try{m(!0);const ge=await Rh(),Le=ge.models||[];e(Le),l(Le.map(vn=>vn.name));const Ct=ge.api_providers||[];r(Ct.map(vn=>vn.name)),i(Ct),d(ge.model_task_config||null),k(!1),Ne.current=!1}catch(ge){console.error("加载配置失败:",ge)}finally{m(!1)}},Pt=b.useCallback(ge=>s.find(Le=>Le.name===ge),[s]),Mt=b.useCallback(async(ge,Le=!1)=>{const Ct=Pt(ge);if(!Ct?.base_url){re([]),Ue(null),Ye('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!Ct.api_key){re([]),Ue(null),Ye('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const vn=Kxe(Ct.base_url);if(Ue(vn),!vn?.modelFetcher){re([]),Ye(null);return}const Fr=`${ge}:${Ct.base_url}`,Cr=mM.get(Fr);if(!Le&&Cr&&Date.now()-Cr.timestamp<$ve){re(Cr.models),Ye(null);return}Te(!0),Ye(null);try{const Tr=await kae(ge,vn.modelFetcher.parser,vn.modelFetcher.endpoint);re(Tr),mM.set(Fr,{models:Tr,timestamp:Date.now()})}catch(Tr){console.error("获取模型列表失败:",Tr);const Ns=Tr.message||"获取模型列表失败";Ns.includes("无效")||Ns.includes("过期")||Ns.includes("API Key")?Ye('API Key 无效或已过期,请检查"模型提供商配置"中的密钥'):Ns.includes("权限")?Ye("没有权限获取模型列表,请检查 API Key 权限"):Ns.includes("timeout")||Ns.includes("超时")?Ye("请求超时,请检查网络连接后重试"):Ns.includes("不支持")?Ye("该提供商不支持自动获取模型列表,请手动输入"):Ye(Ns),re([])}finally{Te(!1)}},[Pt]);b.useEffect(()=>{_&&L?.api_provider&&Mt(L.api_provider)},[_,L?.api_provider,Mt]);const zn=async()=>{try{N(!0),ib().catch(()=>{}),E(!0)}catch(ge){console.error("重启失败:",ge),E(!1),He({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),N(!1)}},Fe=async()=>{try{x(!0),_t.current&&clearTimeout(_t.current),mt.current&&clearTimeout(mt.current);const ge=await Rh();ge.models=t,ge.model_task_config=c,await qv(ge),k(!1),He({title:"保存成功",description:"正在重启麦麦..."}),await zn()}catch(ge){console.error("保存配置失败:",ge),He({title:"保存失败",description:ge.message,variant:"destructive"}),x(!1)}},rt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},tn=()=>{E(!1),N(!1),He({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Rt=b.useCallback(async ge=>{if(!Ne.current)try{w(!0),await xk("models",ge),k(!1)}catch(Le){console.error("自动保存模型列表失败:",Le),k(!0)}finally{w(!1)}},[]),ke=b.useCallback(async ge=>{if(!Ne.current)try{w(!0),await xk("model_task_config",ge),k(!1)}catch(Le){console.error("自动保存任务配置失败:",Le),k(!0)}finally{w(!1)}},[]);b.useEffect(()=>{if(!Ne.current)return k(!0),_t.current&&clearTimeout(_t.current),_t.current=setTimeout(()=>{Rt(t)},2e3),()=>{_t.current&&clearTimeout(_t.current)}},[t,Rt]),b.useEffect(()=>{if(!(Ne.current||!c))return k(!0),mt.current&&clearTimeout(mt.current),mt.current=setTimeout(()=>{ke(c)},2e3),()=>{mt.current&&clearTimeout(mt.current)}},[c,ke]);const Pe=async()=>{try{x(!0),_t.current&&clearTimeout(_t.current),mt.current&&clearTimeout(mt.current);const ge=await Rh();ge.models=t,ge.model_task_config=c,await qv(ge),k(!1),He({title:"保存成功",description:"模型配置已保存"}),await yt()}catch(ge){console.error("保存配置失败:",ge),He({title:"保存失败",description:ge.message,variant:"destructive"})}finally{x(!1)}},it=(ge,Le)=>{P(ge||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),$(Le),A(!0)},ot=()=>{if(!L)return;const ge={...L,price_in:L.price_in??0,price_out:L.price_out??0};let Le;B!==null?(Le=[...t],Le[B]=ge):Le=[...t,ge],e(Le),l(Le.map(Ct=>Ct.name)),A(!1),P(null),$(null)},nn=ge=>{if(!ge&&L){const Le={...L,price_in:L.price_in??0,price_out:L.price_out??0};P(Le)}A(ge)},Kt=ge=>{Q(ge),te(!0)},pt=()=>{if(z!==null){const ge=t.filter((Le,Ct)=>Ct!==z);e(ge),l(ge.map(Le=>Le.name)),He({title:"删除成功",description:"模型已从列表中移除"})}te(!1),Q(null)},xr=ge=>{const Le=new Set(J);Le.has(ge)?Le.delete(ge):Le.add(ge),X(Le)},Ur=()=>{if(J.size===cr.length)X(new Set);else{const ge=cr.map((Le,Ct)=>t.findIndex(vn=>vn===cr[Ct]));X(new Set(ge))}},Wr=()=>{if(J.size===0){He({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ie(!0)},vr=()=>{const ge=t.filter((Le,Ct)=>!J.has(Ct));e(ge),l(ge.map(Le=>Le.name)),X(new Set),ie(!1),He({title:"批量删除成功",description:`已删除 ${J.size} 个模型`})},In=(ge,Le,Ct)=>{c&&d({...c,[ge]:{...c[ge],[Le]:Ct}})},cr=t.filter(ge=>{if(!F)return!0;const Le=F.toLowerCase();return ge.name.toLowerCase().includes(Le)||ge.model_identifier.toLowerCase().includes(Le)||ge.api_provider.toLowerCase().includes(Le)}),nr=Math.ceil(cr.length/V),gs=cr.slice((G-1)*V,G*V),xs=()=>{const ge=parseInt(ne);ge>=1&&ge<=nr&&(I(ge),W(""))},js=ge=>c?[c.utils?.model_list||[],c.utils_small?.model_list||[],c.tool_use?.model_list||[],c.replyer?.model_list||[],c.planner?.model_list||[],c.vlm?.model_list||[],c.voice?.model_list||[],c.embedding?.model_list||[],c.lpmm_entity_extract?.model_list||[],c.lpmm_rdf_build?.model_list||[],c.lpmm_qa?.model_list||[]].some(Ct=>Ct.includes(ge)):!1;return h?o.jsx(gn,{className:"h-full",children:o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(de,{onClick:Pe,disabled:g||y||!S||j,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[o.jsx(Gy,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),g?"保存中...":y?"自动保存中...":S?"保存配置":"已保存"]}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsxs(de,{disabled:g||y||j,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[o.jsx(Aj,{className:"mr-2 h-4 w-4"}),j?"重启中...":S?"保存并重启":"重启麦麦"]})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认重启麦麦?"}),o.jsx(_n,{className:"space-y-3",asChild:!0,children:o.jsxs("div",{children:[o.jsx("p",{children:S?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(ga,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(xa,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",o.jsxs(Dr,{children:[o.jsx(Of,{asChild:!0,children:o.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[o.jsx(Wy,{className:"h-3 w-3"}),"如何结束程序?"]})}),o.jsxs(Sr,{className:"max-w-2xl",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"如何结束使用重启功能后的麦麦程序"}),o.jsx(ss,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),o.jsxs(ja,{defaultValue:"windows",className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full grid-cols-3",children:[o.jsx(Lt,{value:"windows",children:"Windows"}),o.jsx(Lt,{value:"macos",children:"macOS"}),o.jsx(Lt,{value:"linux",children:"Linux"})]}),o.jsxs(un,{value:"windows",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),o.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),o.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),o.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),o.jsxs(un,{value:"macos",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight,搜索"活动监视器"']}),o.jsxs("li",{children:["在进程列表中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),o.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]})]}),o.jsxs(un,{value:"linux",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),o.jsx("p",{children:'pkill -9 -f "bot.py"'}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["在终端输入 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),o.jsx(ws,{children:o.jsx(Gj,{asChild:!0,children:o.jsx(de,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:S?Fe:zn,children:S?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(ga,{children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsxs(xa,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),o.jsxs(ga,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:st,children:[o.jsx(Yee,{className:"h-4 w-4 text-primary"}),o.jsxs(xa,{className:"flex items-center justify-between",children:[o.jsxs("span",{children:[o.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),o.jsx(de,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),o.jsxs(ja,{defaultValue:"models",className:"w-full",children:[o.jsxs(Wi,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[o.jsx(Lt,{value:"models",children:"添加模型"}),o.jsx(Lt,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),o.jsxs(un,{value:"models",className:"space-y-4 mt-0",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[J.size>0&&o.jsxs(de,{onClick:Wr,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(Sn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",J.size,")"]}),o.jsxs(de,{onClick:()=>it(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[o.jsx(Ls,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[o.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[o.jsx(Ni,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{placeholder:"搜索模型名称、标识符或提供商...",value:F,onChange:ge=>Y(ge.target.value),className:"pl-9"})]}),F&&o.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",cr.length," 个结果"]})]}),o.jsx("div",{className:"md:hidden space-y-3",children:gs.length===0?o.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:F?"未找到匹配的模型":"暂无模型配置"}):gs.map((ge,Le)=>{const Ct=t.findIndex(Fr=>Fr===ge),vn=js(ge.name);return o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("h3",{className:"font-semibold text-base",children:ge.name}),o.jsx(Xn,{variant:vn?"default":"secondary",className:vn?"bg-green-600 hover:bg-green-700":"",children:vn?"已使用":"未使用"})]}),o.jsx("p",{className:"text-xs text-muted-foreground break-all",title:ge.model_identifier,children:ge.model_identifier})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>it(ge,Ct),children:[o.jsx(Yu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(de,{size:"sm",onClick:()=>Kt(Ct),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),o.jsx("p",{className:"font-medium",children:ge.api_provider})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),o.jsx("p",{className:"font-medium",children:ge.force_stream_mode?"是":"否"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),o.jsxs("p",{className:"font-medium",children:["¥",ge.price_in,"/M"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),o.jsxs("p",{className:"font-medium",children:["¥",ge.price_out,"/M"]})]})]})]},Le)})}),o.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(_f,{children:[o.jsx(Af,{children:o.jsxs(Is,{children:[o.jsx(pn,{className:"w-12",children:o.jsx(Oi,{checked:J.size===cr.length&&cr.length>0,onCheckedChange:Ur})}),o.jsx(pn,{className:"w-24",children:"使用状态"}),o.jsx(pn,{children:"模型名称"}),o.jsx(pn,{children:"模型标识符"}),o.jsx(pn,{children:"提供商"}),o.jsx(pn,{className:"text-right",children:"输入价格"}),o.jsx(pn,{className:"text-right",children:"输出价格"}),o.jsx(pn,{className:"text-center",children:"强制流式"}),o.jsx(pn,{className:"text-right",children:"操作"})]})}),o.jsx(Mf,{children:gs.length===0?o.jsx(Is,{children:o.jsx(Gt,{colSpan:9,className:"text-center text-muted-foreground py-8",children:F?"未找到匹配的模型":"暂无模型配置"})}):gs.map((ge,Le)=>{const Ct=t.findIndex(Fr=>Fr===ge),vn=js(ge.name);return o.jsxs(Is,{children:[o.jsx(Gt,{children:o.jsx(Oi,{checked:J.has(Ct),onCheckedChange:()=>xr(Ct)})}),o.jsx(Gt,{children:o.jsx(Xn,{variant:vn?"default":"secondary",className:vn?"bg-green-600 hover:bg-green-700":"",children:vn?"已使用":"未使用"})}),o.jsx(Gt,{className:"font-medium",children:ge.name}),o.jsx(Gt,{className:"max-w-xs truncate",title:ge.model_identifier,children:ge.model_identifier}),o.jsx(Gt,{children:ge.api_provider}),o.jsxs(Gt,{className:"text-right",children:["¥",ge.price_in,"/M"]}),o.jsxs(Gt,{className:"text-right",children:["¥",ge.price_out,"/M"]}),o.jsx(Gt,{className:"text-center",children:ge.force_stream_mode?"是":"否"}),o.jsx(Gt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>it(ge,Ct),children:[o.jsx(Yu,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(de,{size:"sm",onClick:()=>Kt(Ct),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Le)})})]})})}),cr.length>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:V.toString(),onValueChange:ge=>{ee(parseInt(ge)),I(1),X(new Set)},children:[o.jsx($t,{id:"page-size-model",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(G-1)*V+1," 到"," ",Math.min(G*V,cr.length)," 条,共 ",cr.length," 条"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>I(1),disabled:G===1,className:"hidden sm:flex",children:o.jsx(Ap,{className:"h-4 w-4"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>I(ge=>Math.max(1,ge-1)),disabled:G===1,children:[o.jsx(vd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{type:"number",value:ne,onChange:ge=>W(ge.target.value),onKeyDown:ge=>ge.key==="Enter"&&xs(),placeholder:G.toString(),className:"w-16 h-8 text-center",min:1,max:nr}),o.jsx(de,{variant:"outline",size:"sm",onClick:xs,disabled:!ne,className:"h-8",children:"跳转"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>I(ge=>ge+1),disabled:G>=nr,children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(yd,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>I(nr),disabled:G>=nr,className:"hidden sm:flex",children:o.jsx(Mp,{className:"h-4 w-4"})})]})]})]}),o.jsxs(un,{value:"tasks",className:"space-y-6 mt-0",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),c&&o.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[o.jsx(Fa,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:c.utils,modelNames:a,onChange:(ge,Le)=>In("utils",ge,Le),dataTour:"task-model-select"}),o.jsx(Fa,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:c.utils_small,modelNames:a,onChange:(ge,Le)=>In("utils_small",ge,Le)}),o.jsx(Fa,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:c.tool_use,modelNames:a,onChange:(ge,Le)=>In("tool_use",ge,Le)}),o.jsx(Fa,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:c.replyer,modelNames:a,onChange:(ge,Le)=>In("replyer",ge,Le)}),o.jsx(Fa,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:c.planner,modelNames:a,onChange:(ge,Le)=>In("planner",ge,Le)}),o.jsx(Fa,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:c.vlm,modelNames:a,onChange:(ge,Le)=>In("vlm",ge,Le),hideTemperature:!0}),o.jsx(Fa,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:c.voice,modelNames:a,onChange:(ge,Le)=>In("voice",ge,Le),hideTemperature:!0,hideMaxTokens:!0}),o.jsx(Fa,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:c.embedding,modelNames:a,onChange:(ge,Le)=>In("embedding",ge,Le),hideTemperature:!0,hideMaxTokens:!0}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),o.jsx(Fa,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:c.lpmm_entity_extract,modelNames:a,onChange:(ge,Le)=>In("lpmm_entity_extract",ge,Le)}),o.jsx(Fa,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:c.lpmm_rdf_build,modelNames:a,onChange:(ge,Le)=>In("lpmm_rdf_build",ge,Le)}),o.jsx(Fa,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:c.lpmm_qa,modelNames:a,onChange:(ge,Le)=>In("lpmm_qa",ge,Le)})]})]})]})]}),o.jsx(Dr,{open:_,onOpenChange:nn,children:o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:It.isRunning,children:[o.jsxs(kr,{children:[o.jsx(Or,{children:B!==null?"编辑模型":"添加模型"}),o.jsx(ss,{children:"配置模型的基本信息和参数"})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2","data-tour":"model-name-input",children:[o.jsx(he,{htmlFor:"model_name",children:"模型名称 *"}),o.jsx(ze,{id:"model_name",value:L?.name||"",onChange:ge=>P(Le=>Le?{...Le,name:ge.target.value}:null),placeholder:"例如: qwen3-30b"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"model-provider-select",children:[o.jsx(he,{htmlFor:"api_provider",children:"API 提供商 *"}),o.jsxs(Vt,{value:L?.api_provider||"",onValueChange:ge=>{P(Le=>Le?{...Le,api_provider:ge}:null),re([]),Ye(null)},children:[o.jsx($t,{id:"api_provider",children:o.jsx(Ut,{placeholder:"选择提供商"})}),o.jsx(Ht,{children:n.map(ge=>o.jsx(De,{value:ge,children:ge},ge))})]})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"model-identifier-input",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{htmlFor:"model_identifier",children:"模型标识符 *"}),Ve?.modelFetcher&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Xn,{variant:"secondary",className:"text-xs",children:Ve.display_name}),o.jsx(de,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>L?.api_provider&&Mt(L.api_provider,!0),disabled:oe,children:oe?o.jsx(Po,{className:"h-3 w-3 animate-spin"}):o.jsx(Ps,{className:"h-3 w-3"})})]})]}),Ve?.modelFetcher?o.jsxs(zo,{open:Je,onOpenChange:Oe,children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":Je,className:"w-full justify-between font-normal",disabled:oe||!!We,children:[oe?o.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(Po,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):We?o.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):L?.model_identifier?o.jsx("span",{className:"truncate",children:L.model_identifier}):o.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),o.jsx(Mj,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(Xa,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:o.jsxs(Ob,{children:[o.jsx(jb,{placeholder:"搜索模型..."}),o.jsx(gn,{className:"h-[300px]",children:o.jsxs(Nb,{className:"max-h-none overflow-visible",children:[o.jsx(Cb,{children:We?o.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[o.jsx("p",{className:"text-sm text-destructive",children:We}),!We.includes("API Key")&&o.jsx(de,{variant:"link",size:"sm",onClick:()=>L?.api_provider&&Mt(L.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),o.jsx(ap,{heading:"可用模型",children:se.map(ge=>o.jsxs(op,{value:ge.id,onSelect:()=>{P(Le=>Le?{...Le,model_identifier:ge.id}:null),Oe(!1)},children:[o.jsx(Ro,{className:`mr-2 h-4 w-4 ${L?.model_identifier===ge.id?"opacity-100":"opacity-0"}`}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{children:ge.id}),ge.name!==ge.id&&o.jsx("span",{className:"text-xs text-muted-foreground",children:ge.name})]})]},ge.id))}),o.jsx(ap,{heading:"手动输入",children:o.jsxs(op,{value:"__manual_input__",onSelect:()=>{Oe(!1)},children:[o.jsx(Yu,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):o.jsx(ze,{id:"model_identifier",value:L?.model_identifier||"",onChange:ge=>P(Le=>Le?{...Le,model_identifier:ge.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),We&&Ve?.modelFetcher&&o.jsxs(ga,{variant:"destructive",className:"mt-2 py-2",children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsx(xa,{className:"text-xs",children:We})]}),Ve?.modelFetcher&&o.jsx(ze,{value:L?.model_identifier||"",onChange:ge=>P(Le=>Le?{...Le,model_identifier:ge.target.value}:null),placeholder:"或手动输入模型标识符",className:"mt-2"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:We?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':Ve?.modelFetcher?`已识别为 ${Ve.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),o.jsx(ze,{id:"price_in",type:"number",step:"0.1",min:"0",value:L?.price_in??"",onChange:ge=>{const Le=ge.target.value===""?null:parseFloat(ge.target.value);P(Ct=>Ct?{...Ct,price_in:Le}:null)},placeholder:"默认: 0"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),o.jsx(ze,{id:"price_out",type:"number",step:"0.1",min:"0",value:L?.price_out??"",onChange:ge=>{const Le=ge.target.value===""?null:parseFloat(ge.target.value);P(Ct=>Ct?{...Ct,price_out:Le}:null)},placeholder:"默认: 0"})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"force_stream_mode",checked:L?.force_stream_mode||!1,onCheckedChange:ge=>P(Le=>Le?{...Le,force_stream_mode:ge}:null)}),o.jsx(he,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>A(!1),"data-tour":"model-cancel-button",children:"取消"}),o.jsx(de,{onClick:ot,"data-tour":"model-save-button",children:"保存"})]})]})}),o.jsx(Dn,{open:U,onOpenChange:te,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除模型 "',z!==null?t[z]?.name:"",'" 吗? 此操作无法撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:pt,children:"删除"})]})]})}),o.jsx(Dn,{open:R,onOpenChange:ie,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认批量删除"}),o.jsxs(_n,{children:["确定要删除选中的 ",J.size," 个模型吗? 此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:vr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&o.jsx(Kj,{onRestartComplete:rt,onRestartFailed:tn})]})})}function Fa({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:a=!1,dataTour:l}){const c=d=>{s("model_list",d)};return o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2","data-tour":l,children:[o.jsx(he,{children:"模型列表"}),o.jsx(qve,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:c,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"温度"}),o.jsx(ze,{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"})]}),o.jsx(Bp,{value:[n.temperature??.3],onValueChange:d=>s("temperature",d[0]),min:0,max:1,step:.1,className:"w-full"})]}),!a&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"最大 Token"}),o.jsx(ze,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:d=>s("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Pb="/api/webui/config";async function Qve(){const e=await(await St(`${Pb}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function pM(t){const n=await(await St(`${Pb}/adapter-config/path`,{method:"POST",headers:Dt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function gM(t){const n=await(await St(`${Pb}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function xM(t,e){const r=await(await St(`${Pb}/adapter-config`,{method:"POST",headers:Dt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Fi={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"}},CS={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:Gh},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:Kee}};function Vve(){const[t,e]=b.useState("upload"),[n,r]=b.useState(null),[s,i]=b.useState(""),[a,l]=b.useState(""),[c,d]=b.useState("oneclick"),[h,m]=b.useState(""),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[j,N]=b.useState(!1),[T,E]=b.useState(null),_=b.useRef(null),{toast:A}=as(),L=b.useRef(null),P=W=>{if(!W.trim())return{valid:!1,error:"路径不能为空"};if(!W.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const se=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,re=/^(\/|~\/).+\.toml$/i,oe=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,Te=se.test(W),We=re.test(W),Ye=oe.test(W);return!Te&&!We&&!Ye?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(W)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}},B=W=>{if(l(W),W.trim()){const se=P(W);m(se.error)}else m("")},$=b.useCallback(async W=>{const se=CS[W];w(!0);try{const re=await gM(se.path),oe=G(re);r(oe),d(W),l(se.path),await pM(se.path),A({title:"加载成功",description:`已从${se.name}预设加载配置`})}catch(re){console.error("加载预设配置失败:",re),A({title:"加载失败",description:re instanceof Error?re.message:"无法读取预设配置文件",variant:"destructive"})}finally{w(!1)}},[A]),U=b.useCallback(async W=>{const se=P(W);if(!se.valid){m(se.error),A({title:"路径无效",description:se.error,variant:"destructive"});return}m(""),w(!0);try{const re=await gM(W),oe=G(re);r(oe),l(W),await pM(W),A({title:"加载成功",description:"已从配置文件加载"})}catch(re){console.error("加载配置失败:",re),A({title:"加载失败",description:re instanceof Error?re.message:"无法读取配置文件",variant:"destructive"})}finally{w(!1)}},[A]);b.useEffect(()=>{(async()=>{try{const se=await Qve();if(se&&se.path){l(se.path);const re=Object.entries(CS).find(([,oe])=>oe.path===se.path);re?(e("preset"),d(re[0]),await $(re[0])):(e("path"),await U(se.path))}}catch(se){console.error("加载保存的路径失败:",se)}})()},[U,$]);const te=b.useCallback(W=>{t!=="path"&&t!=="preset"||!a||(L.current&&clearTimeout(L.current),L.current=setTimeout(async()=>{x(!0);try{const se=I(W);await xM(a,se),A({title:"自动保存成功",description:"配置已保存到文件"})}catch(se){console.error("自动保存失败:",se),A({title:"自动保存失败",description:se instanceof Error?se.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},1e3))},[t,a,A]),z=async()=>{if(!n||!a)return;const W=P(a);if(!W.valid){A({title:"保存失败",description:W.error,variant:"destructive"});return}x(!0);try{const se=I(n);await xM(a,se),A({title:"保存成功",description:"配置已保存到文件"})}catch(se){console.error("保存失败:",se),A({title:"保存失败",description:se instanceof Error?se.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},Q=async()=>{a&&await U(a)},F=W=>{if(W!==t){if(n){E(W),k(!0);return}Y(W)}},Y=W=>{r(null),i(""),m(""),e(W),W==="preset"&&$("oneclick"),A({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[W]})},J=()=>{T&&(Y(T),E(null)),k(!1)},X=()=>{if(n){N(!0);return}R()},R=()=>{l(""),r(null),m(""),A({title:"已清空",description:"路径和配置已清空"})},ie=()=>{R(),N(!1)},G=W=>{const se=JSON.parse(JSON.stringify(Fi)),re=W.split(` -`);let oe="";for(const Te of re){const We=Te.trim();if(!We||We.startsWith("#"))continue;const Ye=We.match(/^\[(\w+)\]/);if(Ye){oe=Ye[1];continue}const Je=We.match(/^(\w+)\s*=\s*(.+)$/);if(Je&&oe){const[,Oe,Ve]=Je;let Ue=Ve.trim();const He=Ue.match(/^("[^"]*")/);if(He)Ue=He[1];else{const xt=Ue.indexOf("#");xt!==-1&&(Ue=Ue.substring(0,xt).trim())}let Ot;if(Ue==="true")Ot=!0;else if(Ue==="false")Ot=!1;else if(Ue.startsWith("[")&&Ue.endsWith("]")){const xt=Ue.slice(1,-1).trim();if(xt){const kn=xt.split(",").map(Yt=>{const _t=Yt.trim();return isNaN(Number(_t))?_t.replace(/"/g,""):Number(_t)}),It=typeof kn[0];Ot=kn.every(Yt=>typeof Yt===It)?kn:kn.filter(Yt=>typeof Yt=="number")}else Ot=[]}else Ue.startsWith('"')&&Ue.endsWith('"')?Ot=Ue.slice(1,-1):isNaN(Number(Ue))?Ot=Ue.replace(/"/g,""):Ot=Number(Ue);if(oe in se){const xt=se[oe];xt[Oe]=Ot}}}return se},I=W=>{const se=[],re=(oe,Te)=>oe===""||oe===null||oe===void 0?Te:oe;return se.push("[inner]"),se.push(`version = "${re(W.inner.version,Fi.inner.version)}" # 版本号`),se.push("# 请勿修改版本号,除非你知道自己在做什么"),se.push(""),se.push("[nickname] # 现在没用"),se.push(`nickname = "${re(W.nickname.nickname,Fi.nickname.nickname)}"`),se.push(""),se.push("[napcat_server] # Napcat连接的ws服务设置"),se.push(`host = "${re(W.napcat_server.host,Fi.napcat_server.host)}" # Napcat设定的主机地址`),se.push(`port = ${re(W.napcat_server.port||0,Fi.napcat_server.port)} # Napcat设定的端口`),se.push(`token = "${re(W.napcat_server.token,Fi.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),se.push(`heartbeat_interval = ${re(W.napcat_server.heartbeat_interval||0,Fi.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),se.push(""),se.push("[maibot_server] # 连接麦麦的ws服务设置"),se.push(`host = "${re(W.maibot_server.host,Fi.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),se.push(`port = ${re(W.maibot_server.port||0,Fi.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),se.push(""),se.push("[chat] # 黑白名单功能"),se.push(`group_list_type = "${re(W.chat.group_list_type,Fi.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),se.push(`group_list = [${W.chat.group_list.join(", ")}] # 群组名单`),se.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),se.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),se.push(`private_list_type = "${re(W.chat.private_list_type,Fi.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),se.push(`private_list = [${W.chat.private_list.join(", ")}] # 私聊名单`),se.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),se.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),se.push(`ban_user_id = [${W.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),se.push(`ban_qq_bot = ${W.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),se.push(`enable_poke = ${W.chat.enable_poke} # 是否启用戳一戳功能`),se.push(""),se.push("[voice] # 发送语音设置"),se.push(`use_tts = ${W.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),se.push(""),se.push("[debug]"),se.push(`level = "${re(W.debug.level,Fi.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),se.join(` -`)},V=W=>{const se=W.target.files?.[0];if(!se)return;const re=new FileReader;re.onload=oe=>{try{const Te=oe.target?.result,We=G(Te);r(We),i(se.name),A({title:"上传成功",description:`已加载配置文件:${se.name}`})}catch(Te){console.error("解析配置文件失败:",Te),A({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},re.readAsText(se)},ee=()=>{if(!n)return;const W=I(n),se=new Blob([W],{type:"text/plain;charset=utf-8"}),re=URL.createObjectURL(se),oe=document.createElement("a");oe.href=re,oe.download=s||"config.toml",document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),URL.revokeObjectURL(re),A({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},ne=()=>{r(JSON.parse(JSON.stringify(Fi))),i("config.toml"),A({title:"已加载默认配置",description:"可以开始编辑配置"})};return o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),o.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[o.jsx(Uc,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),o.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"工作模式"}),o.jsx(ts,{children:"选择配置文件的管理方式"})]}),o.jsxs(Gn,{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[o.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>F("preset"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(Gh,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),o.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>F("upload"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(b9,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),o.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>F("path"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(Zee,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="preset"&&o.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[o.jsx(he,{className:"text-sm md:text-base",children:"选择部署方式"}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(CS).map(([W,se])=>{const re=se.icon,oe=c===W;return o.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${oe?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{d(W),$(W)},children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h4",{className:"font-semibold text-sm",children:se.name}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:se.description}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:se.path})]})]})},W)})})]}),t==="path"&&o.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs("div",{className:"flex-1 space-y-1",children:[o.jsx(ze,{id:"config-path",value:a,onChange:W=>B(W.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${h?"border-destructive":""}`}),h&&o.jsx("p",{className:"text-xs text-destructive",children:h})]}),o.jsx(de,{onClick:()=>U(a),disabled:y||!a||!!h,className:"w-full sm:w-auto",children:y?o.jsxs(o.Fragment,{children:[o.jsx(Ps,{className:"h-4 w-4 animate-spin mr-2"}),o.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sm:hidden",children:"加载配置"}),o.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),o.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[o.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[o.jsx("span",{children:"路径格式说明"}),o.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),o.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),o.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[o.jsx("div",{children:"C:\\Adapter\\config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),o.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[o.jsx("div",{children:"/opt/adapter/config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),o.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),o.jsxs(ga,{children:[o.jsx(Oa,{className:"h-4 w-4"}),o.jsx(xa,{children:t==="preset"?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]}):t==="upload"?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]})})]}),t==="upload"&&!n&&o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[o.jsx("input",{ref:_,type:"file",accept:".toml",className:"hidden",onChange:V}),o.jsxs(de,{onClick:()=>_.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(b9,{className:"mr-2 h-4 w-4"}),"上传配置"]}),o.jsxs(de,{onClick:ne,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(zl,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&o.jsx("div",{className:"flex gap-2",children:o.jsxs(de,{onClick:ee,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(Ku,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(t==="preset"||t==="path")&&n&&o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs(de,{onClick:z,size:"sm",disabled:g||!!h,className:"w-full sm:w-auto",children:[o.jsx(Gy,{className:"mr-2 h-4 w-4"}),g?"保存中...":"立即保存"]}),o.jsxs(de,{onClick:Q,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[o.jsx(Ps,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),t==="path"&&o.jsxs(de,{onClick:X,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(Sn,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?o.jsxs(ja,{defaultValue:"napcat",className:"w-full",children:[o.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:o.jsxs(Wi,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[o.jsxs(Lt,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),o.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),o.jsxs(Lt,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),o.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),o.jsxs(Lt,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),o.jsx("span",{className:"sm:hidden",children:"聊天"})]}),o.jsxs(Lt,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),o.jsx("span",{className:"sm:hidden",children:"语音"})]}),o.jsx(Lt,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),o.jsx(un,{value:"napcat",className:"space-y-4",children:o.jsx(Uve,{config:n,onChange:W=>{r(W),te(W)}})}),o.jsx(un,{value:"maibot",className:"space-y-4",children:o.jsx(Wve,{config:n,onChange:W=>{r(W),te(W)}})}),o.jsx(un,{value:"chat",className:"space-y-4",children:o.jsx(Gve,{config:n,onChange:W=>{r(W),te(W)}})}),o.jsx(un,{value:"voice",className:"space-y-4",children:o.jsx(Xve,{config:n,onChange:W=>{r(W),te(W)}})}),o.jsx(un,{value:"debug",className:"space-y-4",children:o.jsx(Yve,{config:n,onChange:W=>{r(W),te(W)}})})]}):o.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:o.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[o.jsx(zl,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="preset"?"请选择预设的部署方式":t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),o.jsx(Dn,{open:S,onOpenChange:k,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认切换模式"}),o.jsxs(_n,{children:["切换模式将清空当前配置,确定要继续吗?",o.jsx("br",{}),o.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{onClick:()=>{k(!1),E(null)},children:"取消"}),o.jsx(An,{onClick:J,children:"确认切换"})]})]})}),o.jsx(Dn,{open:j,onOpenChange:N,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认清空路径"}),o.jsxs(_n,{children:["清空路径将清除当前配置,确定要继续吗?",o.jsx("br",{}),o.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{onClick:()=>N(!1),children:"取消"}),o.jsx(An,{onClick:ie,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Uve({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),o.jsxs("div",{className:"grid gap-3 md:gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),o.jsx(ze,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),o.jsx(ze,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),o.jsx(ze,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),o.jsx(ze,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Wve({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),o.jsxs("div",{className:"grid gap-3 md:gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),o.jsx(ze,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),o.jsx(ze,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function Gve({config:t,onChange:e}){const n=i=>{const a={...t};i==="group"?a.chat.group_list=[...a.chat.group_list,0]:i==="private"?a.chat.private_list=[...a.chat.private_list,0]:a.chat.ban_user_id=[...a.chat.ban_user_id,0],e(a)},r=(i,a)=>{const l={...t};i==="group"?l.chat.group_list=l.chat.group_list.filter((c,d)=>d!==a):i==="private"?l.chat.private_list=l.chat.private_list.filter((c,d)=>d!==a):l.chat.ban_user_id=l.chat.ban_user_id.filter((c,d)=>d!==a),e(l)},s=(i,a,l)=>{const c={...t};i==="group"?c.chat.group_list[a]=l:i==="private"?c.chat.private_list[a]=l:c.chat.ban_user_id[a]=l,e(c)};return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),o.jsxs("div",{className:"grid gap-4 md:gap-6",children:[o.jsxs("div",{className:"space-y-3 md:space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-sm md:text-base",children:"群组名单类型"}),o.jsxs(Vt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),o.jsx(De,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsx(he,{className:"text-sm md:text-base",children:"群组列表"}),o.jsxs(de,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(zl,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{type:"number",value:i,onChange:l=>s("group",a,parseInt(l.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r("group",a),children:"删除"})]})]})]})]},a)),t.chat.group_list.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),o.jsxs("div",{className:"space-y-3 md:space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-sm md:text-base",children:"私聊名单类型"}),o.jsxs(Vt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),o.jsx(De,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsx(he,{className:"text-sm md:text-base",children:"私聊列表"}),o.jsxs(de,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(zl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{type:"number",value:i,onChange:l=>s("private",a,parseInt(l.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r("private",a),children:"删除"})]})]})]})]},a)),t.chat.private_list.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"全局禁止名单"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),o.jsxs(de,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(zl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{type:"number",value:i,onChange:l=>s("ban",a,parseInt(l.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),o.jsxs(Dn,{children:[o.jsx(rs,{asChild:!0,children:o.jsx(de,{size:"icon",variant:"outline",children:o.jsx(Sn,{className:"h-4 w-4"})})}),o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>r("ban",a),children:"删除"})]})]})]})]},a)),t.chat.ban_user_id.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),o.jsx(Bt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),o.jsx(Bt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Xve({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),o.jsx(Bt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Yve({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),o.jsx("div",{className:"grid gap-3 md:gap-4",children:o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-sm md:text-base",children:"日志等级"}),o.jsxs(Vt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"DEBUG",children:"DEBUG(调试)"}),o.jsx(De,{value:"INFO",children:"INFO(信息)"}),o.jsx(De,{value:"WARNING",children:"WARNING(警告)"}),o.jsx(De,{value:"ERROR",children:"ERROR(错误)"}),o.jsx(De,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function vM(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&e.push(a),s=r+1,r=n.indexOf(",",s)}return e}function Kve(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Zve=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Jve=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eye={};function yM(t,e){return(eye.jsx?Jve:Zve).test(t)}const tye=/[ \t\n\f\r]/g;function nye(t){return typeof t=="object"?t.type==="text"?bM(t.value):!1:bM(t)}function bM(t){return t.replace(tye,"")===""}class ug{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}ug.prototype.normal={};ug.prototype.property={};ug.prototype.space=void 0;function qQ(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new ug(n,r,e)}function mp(t){return t.toLowerCase()}class Ei{constructor(e,n){this.attribute=n,this.property=e}}Ei.prototype.attribute="";Ei.prototype.booleanish=!1;Ei.prototype.boolean=!1;Ei.prototype.commaOrSpaceSeparated=!1;Ei.prototype.commaSeparated=!1;Ei.prototype.defined=!1;Ei.prototype.mustUseProperty=!1;Ei.prototype.number=!1;Ei.prototype.overloadedBoolean=!1;Ei.prototype.property="";Ei.prototype.spaceSeparated=!1;Ei.prototype.space=void 0;let rye=0;const Jt=wd(),Jr=wd(),TO=wd(),Qe=wd(),ur=wd(),qh=wd(),qi=wd();function wd(){return 2**++rye}const EO=Object.freeze(Object.defineProperty({__proto__:null,boolean:Jt,booleanish:Jr,commaOrSpaceSeparated:qi,commaSeparated:qh,number:Qe,overloadedBoolean:TO,spaceSeparated:ur},Symbol.toStringTag,{value:"Module"})),TS=Object.keys(EO);class aN extends Ei{constructor(e,n,r,s){let i=-1;if(super(e,n),wM(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&lye.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(SM,uye);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!SM.test(i)){let a=i.replace(oye,cye);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=aN}return new s(r,e)}function cye(t){return"-"+t.toLowerCase()}function uye(t){return t.charAt(1).toUpperCase()}const XQ=qQ([$Q,sye,VQ,UQ,WQ],"html"),zb=qQ([$Q,iye,VQ,UQ,WQ],"svg");function kM(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function dye(t){return t.join(" ").trim()}var oh={},ES,OM;function hye(){if(OM)return ES;OM=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,c=` -`,d="/",h="*",m="",g="comment",x="declaration";function y(S,k){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];k=k||{};var j=1,N=1;function T(z){var Q=z.match(e);Q&&(j+=Q.length);var F=z.lastIndexOf(c);N=~F?z.length-F:N+z.length}function E(){var z={line:j,column:N};return function(Q){return Q.position=new _(z),P(),Q}}function _(z){this.start=z,this.end={line:j,column:N},this.source=k.source}_.prototype.content=S;function A(z){var Q=new Error(k.source+":"+j+":"+N+": "+z);if(Q.reason=z,Q.filename=k.source,Q.line=j,Q.column=N,Q.source=S,!k.silent)throw Q}function L(z){var Q=z.exec(S);if(Q){var F=Q[0];return T(F),S=S.slice(F.length),Q}}function P(){L(n)}function B(z){var Q;for(z=z||[];Q=$();)Q!==!1&&z.push(Q);return z}function $(){var z=E();if(!(d!=S.charAt(0)||h!=S.charAt(1))){for(var Q=2;m!=S.charAt(Q)&&(h!=S.charAt(Q)||d!=S.charAt(Q+1));)++Q;if(Q+=2,m===S.charAt(Q-1))return A("End of comment missing");var F=S.slice(2,Q-2);return N+=2,T(F),S=S.slice(Q),N+=2,z({type:g,comment:F})}}function U(){var z=E(),Q=L(r);if(Q){if($(),!L(s))return A("property missing ':'");var F=L(i),Y=z({type:x,property:w(Q[0].replace(t,m)),value:F?w(F[0].replace(t,m)):m});return L(a),Y}}function te(){var z=[];B(z);for(var Q;Q=U();)Q!==!1&&(z.push(Q),B(z));return z}return P(),te()}function w(S){return S?S.replace(l,m):m}return ES=y,ES}var jM;function fye(){if(jM)return oh;jM=1;var t=oh&&oh.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(oh,"__esModule",{value:!0}),oh.default=n;const e=t(hye());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,e.default)(r),l=typeof s=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:d,value:h}=c;l?s(d,h,c):h&&(i=i||{},i[d]=h)}),i}return oh}var Ym={},NM;function mye(){if(NM)return Ym;NM=1,Object.defineProperty(Ym,"__esModule",{value:!0}),Ym.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(d){return!d||n.test(d)||t.test(d)},a=function(d,h){return h.toUpperCase()},l=function(d,h){return"".concat(h,"-")},c=function(d,h){return h===void 0&&(h={}),i(d)?d:(d=d.toLowerCase(),h.reactCompat?d=d.replace(s,l):d=d.replace(r,l),d.replace(e,a))};return Ym.camelCase=c,Ym}var Km,CM;function pye(){if(CM)return Km;CM=1;var t=Km&&Km.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(fye()),n=mye();function r(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(l,c){l&&c&&(a[(0,n.camelCase)(l,i)]=c)}),a}return r.default=r,Km=r,Km}var gye=pye();const xye=gd(gye),YQ=KQ("end"),oN=KQ("start");function KQ(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 vye(t){const e=oN(t),n=YQ(t);if(e&&n)return{start:e,end:n}}function _0(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?TM(t.position):"start"in t||"end"in t?TM(t):"line"in t||"column"in t?_O(t):""}function _O(t){return EM(t&&t.line)+":"+EM(t&&t.column)}function TM(t){return _O(t&&t.start)+"-"+_O(t&&t.end)}function EM(t){return t&&typeof t=="number"?t:1}class Ws extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(a=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=_0(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ws.prototype.file="";Ws.prototype.name="";Ws.prototype.reason="";Ws.prototype.message="";Ws.prototype.stack="";Ws.prototype.column=void 0;Ws.prototype.line=void 0;Ws.prototype.ancestors=void 0;Ws.prototype.cause=void 0;Ws.prototype.fatal=void 0;Ws.prototype.place=void 0;Ws.prototype.ruleId=void 0;Ws.prototype.source=void 0;const lN={}.hasOwnProperty,yye=new Map,bye=/[A-Z]/g,wye=new Set(["table","tbody","thead","tfoot","tr"]),Sye=new Set(["td","th"]),ZQ="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function kye(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=Aye(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=_ye(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"?zb:XQ,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=JQ(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function JQ(t,e,n){if(e.type==="element")return Oye(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return jye(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Cye(t,e,n);if(e.type==="mdxjsEsm")return Nye(t,e);if(e.type==="root")return Tye(t,e,n);if(e.type==="text")return Eye(t,e)}function Oye(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=zb,t.schema=s),t.ancestors.push(e);const i=tV(t,e.tagName,!1),a=Mye(t,e);let l=uN(t,e);return wye.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!nye(c):!0})),eV(t,a,i,e),cN(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function jye(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)}pp(t,e.position)}function Nye(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);pp(t,e.position)}function Cye(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=zb,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:tV(t,e.name,!0),a=Rye(t,e),l=uN(t,e);return eV(t,a,i,e),cN(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function Tye(t,e,n){const r={};return cN(r,uN(t,e)),t.create(e,t.Fragment,r,n)}function Eye(t,e){return e.value}function eV(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function cN(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function _ye(t,e,n){return r;function r(s,i,a,l){const d=Array.isArray(a.children)?n:e;return l?d(i,a,l):d(i,a)}}function Aye(t,e){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=oN(r);return e(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function Mye(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&lN.call(e.properties,s)){const i=Dye(t,s,e.properties[s]);if(i){const[a,l]=i;t.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Sye.has(e.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Rye(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else pp(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const l=r.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else pp(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function uN(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:yye;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);i0?(Gi(t,t.length,0,e),t):e}const MM={}.hasOwnProperty;function rV(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 Ga(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Js=uu(/[A-Za-z]/),Vs=uu(/[\dA-Za-z]/),Hye=uu(/[#-'*+\--9=?A-Z^-~]/);function vy(t){return t!==null&&(t<32||t===127)}const AO=uu(/\d/),Qye=uu(/[\dA-Fa-f]/),Vye=uu(/[!-/:-@[-`{-~]/);function bt(t){return t!==null&&t<-2}function or(t){return t!==null&&(t<0||t===32)}function dn(t){return t===-2||t===-1||t===32}const Ib=uu(new RegExp("\\p{P}|\\p{S}","u")),fd=uu(/\s/);function uu(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ff(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const l=t.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),s=1):a="�"}else a=String.fromCharCode(i);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function on(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return dn(c)?(t.enter(n),l(c)):e(c)}function l(c){return dn(c)&&i++a))return;const A=e.events.length;let L=A,P,B;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){if(P){B=e.events[L][1].end;break}P=!0}for(k(r),_=A;_N;){const E=n[T];e.containerState=E[1],E[0].exit.call(e,t)}n.length=N}function j(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function Yye(t,e,n){return on(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function hf(t){if(t===null||or(t)||fd(t))return 1;if(Ib(t))return 2}function Lb(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};DM(m,-c),DM(g,c),a={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},i={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},t[r][1].end={...a.start},t[n][1].start={...l.end},d=[],t[r][1].end.offset-t[r][1].start.offset&&(d=fa(d,[["enter",t[r][1],e],["exit",t[r][1],e]])),d=fa(d,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),d=fa(d,Lb(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),d=fa(d,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,d=fa(d,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,Gi(t,r-1,n-r+3,d),n=r+d.length-h-2;break}}for(n=-1;++n0&&dn(_)?on(t,j,"linePrefix",i+1)(_):j(_)}function j(_){return _===null||bt(_)?t.check(PM,w,T)(_):(t.enter("codeFlowValue"),N(_))}function N(_){return _===null||bt(_)?(t.exit("codeFlowValue"),j(_)):(t.consume(_),N)}function T(_){return t.exit("codeFenced"),e(_)}function E(_,A,L){let P=0;return B;function B(Q){return _.enter("lineEnding"),_.consume(Q),_.exit("lineEnding"),$}function $(Q){return _.enter("codeFencedFence"),dn(Q)?on(_,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Q):U(Q)}function U(Q){return Q===l?(_.enter("codeFencedFenceSequence"),te(Q)):L(Q)}function te(Q){return Q===l?(P++,_.consume(Q),te):P>=a?(_.exit("codeFencedFenceSequence"),dn(Q)?on(_,z,"whitespace")(Q):z(Q)):L(Q)}function z(Q){return Q===null||bt(Q)?(_.exit("codeFencedFence"),A(Q)):L(Q)}}}function lbe(t,e,n){const r=this;return s;function s(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const AS={name:"codeIndented",tokenize:ube},cbe={partial:!0,tokenize:dbe};function ube(t,e,n){const r=this;return s;function s(d){return t.enter("codeIndented"),on(t,i,"linePrefix",5)(d)}function i(d){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?c(d):bt(d)?t.attempt(cbe,a,c)(d):(t.enter("codeFlowValue"),l(d))}function l(d){return d===null||bt(d)?(t.exit("codeFlowValue"),a(d)):(t.consume(d),l)}function c(d){return t.exit("codeIndented"),e(d)}}function dbe(t,e,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):bt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):on(t,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):bt(a)?s(a):n(a)}}const hbe={name:"codeText",previous:mbe,resolve:fbe,tokenize:pbe};function fbe(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&&Zm(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),Zm(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Zm(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function cV(t,e,n,r,s,i,a,l,c){const d=c||Number.POSITIVE_INFINITY;let h=0;return m;function m(k){return k===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(k),t.exit(i),g):k===null||k===32||k===41||vy(k)?n(k):(t.enter(r),t.enter(a),t.enter(l),t.enter("chunkString",{contentType:"string"}),w(k))}function g(k){return k===62?(t.enter(i),t.consume(k),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===62?(t.exit("chunkString"),t.exit(l),g(k)):k===null||k===60||bt(k)?n(k):(t.consume(k),k===92?y:x)}function y(k){return k===60||k===62||k===92?(t.consume(k),x):x(k)}function w(k){return!h&&(k===null||k===41||or(k))?(t.exit("chunkString"),t.exit(l),t.exit(a),t.exit(r),e(k)):h999||x===null||x===91||x===93&&!c||x===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(x):x===93?(t.exit(i),t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):bt(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||x===91||x===93||bt(x)||l++>999?(t.exit("chunkString"),h(x)):(t.consume(x),c||(c=!dn(x)),x===92?g:m)}function g(x){return x===91||x===92||x===93?(t.consume(x),l++,m):m(x)}}function dV(t,e,n,r,s,i){let a;return l;function l(g){return g===34||g===39||g===40?(t.enter(r),t.enter(s),t.consume(g),t.exit(s),a=g===40?41:g,c):n(g)}function c(g){return g===a?(t.enter(s),t.consume(g),t.exit(s),t.exit(r),e):(t.enter(i),d(g))}function d(g){return g===a?(t.exit(i),c(a)):g===null?n(g):bt(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),on(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===a||g===null||bt(g)?(t.exit("chunkString"),d(g)):(t.consume(g),g===92?m:h)}function m(g){return g===a||g===92?(t.consume(g),h):h(g)}}function A0(t,e){let n;return r;function r(s){return bt(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):dn(s)?on(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const kbe={name:"definition",tokenize:jbe},Obe={partial:!0,tokenize:Nbe};function jbe(t,e,n){const r=this;let s;return i;function i(x){return t.enter("definition"),a(x)}function a(x){return uV.call(r,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function l(x){return s=Ga(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),c):n(x)}function c(x){return or(x)?A0(t,d)(x):d(x)}function d(x){return cV(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function h(x){return t.attempt(Obe,m,m)(x)}function m(x){return dn(x)?on(t,g,"whitespace")(x):g(x)}function g(x){return x===null||bt(x)?(t.exit("definition"),r.parser.defined.push(s),e(x)):n(x)}}function Nbe(t,e,n){return r;function r(l){return or(l)?A0(t,s)(l):n(l)}function s(l){return dV(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return dn(l)?on(t,a,"whitespace")(l):a(l)}function a(l){return l===null||bt(l)?e(l):n(l)}}const Cbe={name:"hardBreakEscape",tokenize:Tbe};function Tbe(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return bt(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Ebe={name:"headingAtx",resolve:_be,tokenize:Abe};function _be(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"},Gi(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Abe(t,e,n){let r=0;return s;function s(h){return t.enter("atxHeading"),i(h)}function i(h){return t.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&r++<6?(t.consume(h),a):h===null||or(h)?(t.exit("atxHeadingSequence"),l(h)):n(h)}function l(h){return h===35?(t.enter("atxHeadingSequence"),c(h)):h===null||bt(h)?(t.exit("atxHeading"),e(h)):dn(h)?on(t,l,"whitespace")(h):(t.enter("atxHeadingText"),d(h))}function c(h){return h===35?(t.consume(h),c):(t.exit("atxHeadingSequence"),l(h))}function d(h){return h===null||h===35||or(h)?(t.exit("atxHeadingText"),l(h)):(t.consume(h),d)}}const Mbe=["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"],IM=["pre","script","style","textarea"],Rbe={concrete:!0,name:"htmlFlow",resolveTo:zbe,tokenize:Ibe},Dbe={partial:!0,tokenize:Bbe},Pbe={partial:!0,tokenize:Lbe};function zbe(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 Ibe(t,e,n){const r=this;let s,i,a,l,c;return d;function d(I){return h(I)}function h(I){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(I),m}function m(I){return I===33?(t.consume(I),g):I===47?(t.consume(I),i=!0,w):I===63?(t.consume(I),s=3,r.interrupt?e:R):Js(I)?(t.consume(I),a=String.fromCharCode(I),S):n(I)}function g(I){return I===45?(t.consume(I),s=2,x):I===91?(t.consume(I),s=5,l=0,y):Js(I)?(t.consume(I),s=4,r.interrupt?e:R):n(I)}function x(I){return I===45?(t.consume(I),r.interrupt?e:R):n(I)}function y(I){const V="CDATA[";return I===V.charCodeAt(l++)?(t.consume(I),l===V.length?r.interrupt?e:U:y):n(I)}function w(I){return Js(I)?(t.consume(I),a=String.fromCharCode(I),S):n(I)}function S(I){if(I===null||I===47||I===62||or(I)){const V=I===47,ee=a.toLowerCase();return!V&&!i&&IM.includes(ee)?(s=1,r.interrupt?e(I):U(I)):Mbe.includes(a.toLowerCase())?(s=6,V?(t.consume(I),k):r.interrupt?e(I):U(I)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):i?j(I):N(I))}return I===45||Vs(I)?(t.consume(I),a+=String.fromCharCode(I),S):n(I)}function k(I){return I===62?(t.consume(I),r.interrupt?e:U):n(I)}function j(I){return dn(I)?(t.consume(I),j):B(I)}function N(I){return I===47?(t.consume(I),B):I===58||I===95||Js(I)?(t.consume(I),T):dn(I)?(t.consume(I),N):B(I)}function T(I){return I===45||I===46||I===58||I===95||Vs(I)?(t.consume(I),T):E(I)}function E(I){return I===61?(t.consume(I),_):dn(I)?(t.consume(I),E):N(I)}function _(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(t.consume(I),c=I,A):dn(I)?(t.consume(I),_):L(I)}function A(I){return I===c?(t.consume(I),c=null,P):I===null||bt(I)?n(I):(t.consume(I),A)}function L(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||or(I)?E(I):(t.consume(I),L)}function P(I){return I===47||I===62||dn(I)?N(I):n(I)}function B(I){return I===62?(t.consume(I),$):n(I)}function $(I){return I===null||bt(I)?U(I):dn(I)?(t.consume(I),$):n(I)}function U(I){return I===45&&s===2?(t.consume(I),F):I===60&&s===1?(t.consume(I),Y):I===62&&s===4?(t.consume(I),ie):I===63&&s===3?(t.consume(I),R):I===93&&s===5?(t.consume(I),X):bt(I)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Dbe,G,te)(I)):I===null||bt(I)?(t.exit("htmlFlowData"),te(I)):(t.consume(I),U)}function te(I){return t.check(Pbe,z,G)(I)}function z(I){return t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),Q}function Q(I){return I===null||bt(I)?te(I):(t.enter("htmlFlowData"),U(I))}function F(I){return I===45?(t.consume(I),R):U(I)}function Y(I){return I===47?(t.consume(I),a="",J):U(I)}function J(I){if(I===62){const V=a.toLowerCase();return IM.includes(V)?(t.consume(I),ie):U(I)}return Js(I)&&a.length<8?(t.consume(I),a+=String.fromCharCode(I),J):U(I)}function X(I){return I===93?(t.consume(I),R):U(I)}function R(I){return I===62?(t.consume(I),ie):I===45&&s===2?(t.consume(I),R):U(I)}function ie(I){return I===null||bt(I)?(t.exit("htmlFlowData"),G(I)):(t.consume(I),ie)}function G(I){return t.exit("htmlFlow"),e(I)}}function Lbe(t,e,n){const r=this;return s;function s(a){return bt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function Bbe(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(dg,e,n)}}const Fbe={name:"htmlText",tokenize:qbe};function qbe(t,e,n){const r=this;let s,i,a;return l;function l(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),c}function c(R){return R===33?(t.consume(R),d):R===47?(t.consume(R),E):R===63?(t.consume(R),N):Js(R)?(t.consume(R),L):n(R)}function d(R){return R===45?(t.consume(R),h):R===91?(t.consume(R),i=0,y):Js(R)?(t.consume(R),j):n(R)}function h(R){return R===45?(t.consume(R),x):n(R)}function m(R){return R===null?n(R):R===45?(t.consume(R),g):bt(R)?(a=m,Y(R)):(t.consume(R),m)}function g(R){return R===45?(t.consume(R),x):m(R)}function x(R){return R===62?F(R):R===45?g(R):m(R)}function y(R){const ie="CDATA[";return R===ie.charCodeAt(i++)?(t.consume(R),i===ie.length?w:y):n(R)}function w(R){return R===null?n(R):R===93?(t.consume(R),S):bt(R)?(a=w,Y(R)):(t.consume(R),w)}function S(R){return R===93?(t.consume(R),k):w(R)}function k(R){return R===62?F(R):R===93?(t.consume(R),k):w(R)}function j(R){return R===null||R===62?F(R):bt(R)?(a=j,Y(R)):(t.consume(R),j)}function N(R){return R===null?n(R):R===63?(t.consume(R),T):bt(R)?(a=N,Y(R)):(t.consume(R),N)}function T(R){return R===62?F(R):N(R)}function E(R){return Js(R)?(t.consume(R),_):n(R)}function _(R){return R===45||Vs(R)?(t.consume(R),_):A(R)}function A(R){return bt(R)?(a=A,Y(R)):dn(R)?(t.consume(R),A):F(R)}function L(R){return R===45||Vs(R)?(t.consume(R),L):R===47||R===62||or(R)?P(R):n(R)}function P(R){return R===47?(t.consume(R),F):R===58||R===95||Js(R)?(t.consume(R),B):bt(R)?(a=P,Y(R)):dn(R)?(t.consume(R),P):F(R)}function B(R){return R===45||R===46||R===58||R===95||Vs(R)?(t.consume(R),B):$(R)}function $(R){return R===61?(t.consume(R),U):bt(R)?(a=$,Y(R)):dn(R)?(t.consume(R),$):P(R)}function U(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,te):bt(R)?(a=U,Y(R)):dn(R)?(t.consume(R),U):(t.consume(R),z)}function te(R){return R===s?(t.consume(R),s=void 0,Q):R===null?n(R):bt(R)?(a=te,Y(R)):(t.consume(R),te)}function z(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||or(R)?P(R):(t.consume(R),z)}function Q(R){return R===47||R===62||or(R)?P(R):n(R)}function F(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function Y(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),J}function J(R){return dn(R)?on(t,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):X(R)}function X(R){return t.enter("htmlTextData"),a(R)}}const fN={name:"labelEnd",resolveAll:Vbe,resolveTo:Ube,tokenize:Wbe},$be={tokenize:Gbe},Hbe={tokenize:Xbe},Qbe={tokenize:Ybe};function Vbe(t){let e=-1;const n=[];for(;++e=3&&(d===null||bt(d))?(t.exit("thematicBreak"),e(d)):n(d)}function c(d){return d===s?(t.consume(d),r++,c):(t.exit("thematicBreakSequence"),dn(d)?on(t,l,"whitespace")(d):l(d))}}const fi={continuation:{tokenize:awe},exit:lwe,name:"list",tokenize:iwe},rwe={partial:!0,tokenize:cwe},swe={partial:!0,tokenize:owe};function iwe(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(x){const y=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:AO(x)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(Sv,n,d)(x):d(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(x)}return n(x)}function c(x){return AO(x)&&++a<10?(t.consume(x),c):(!r.interrupt||a<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),d(x)):n(x)}function d(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,t.check(dg,r.interrupt?n:h,t.attempt(rwe,g,m))}function h(x){return r.containerState.initialBlankLine=!0,i++,g(x)}function m(x){return dn(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),g):n(x)}function g(x){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(x)}}function awe(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(dg,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,on(t,e,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!dn(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(swe,e,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,on(t,t.attempt(fi,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function owe(t,e,n){const r=this;return on(t,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(i):n(i)}}function lwe(t){t.exit(this.containerState.type)}function cwe(t,e,n){const r=this;return on(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!dn(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const LM={name:"setextUnderline",resolveTo:uwe,tokenize:dwe};function uwe(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",a,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function dwe(t,e,n){const r=this;let s;return i;function i(d){let h=r.events.length,m;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){m=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),s=d,a(d)):n(d)}function a(d){return t.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(t.consume(d),l):(t.exit("setextHeadingLineSequence"),dn(d)?on(t,c,"lineSuffix")(d):c(d))}function c(d){return d===null||bt(d)?(t.exit("setextHeadingLine"),e(d)):n(d)}}const hwe={tokenize:fwe};function fwe(t){const e=this,n=t.attempt(dg,r,t.attempt(this.parser.constructs.flowInitial,s,on(t,t.attempt(this.parser.constructs.flow,s,t.attempt(vbe,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 mwe={resolveAll:fV()},pwe=hV("string"),gwe=hV("text");function hV(t){return{resolveAll:fV(t==="text"?xwe:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,a,l);return a;function a(h){return d(h)?i(h):l(h)}function l(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),c}function c(h){return d(h)?(n.exit("data"),i(h)):(n.consume(h),c)}function d(h){if(h===null)return!0;const m=s[h];let g=-1;if(m)for(;++g-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function _we(t,e){let n=-1;const r=[];let s;for(;++n{d(!0)},[]),h1e(b.useMemo(()=>({onDragStart(m){let{active:g}=m;i(e.onDragStart({active:g}))},onDragMove(m){let{active:g,over:x}=m;e.onDragMove&&i(e.onDragMove({active:g,over:x}))},onDragOver(m){let{active:g,over:x}=m;i(e.onDragOver({active:g,over:x}))},onDragEnd(m){let{active:g,over:x}=m;i(e.onDragEnd({active:g,over:x}))},onDragCancel(m){let{active:g,over:x}=m;i(e.onDragCancel({active:g,over:x}))}}),[i,e])),!c)return null;const h=oe.createElement(oe.Fragment,null,oe.createElement(c1e,{id:r,value:s.draggable}),oe.createElement(u1e,{id:l,announcement:a}));return n?ya.createPortal(h,n):h}var ds;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(ds||(ds={}));function by(){}function oM(t,e){return b.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function x1e(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}const eo=Object.freeze({x:0,y:0});function jQ(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function NQ(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function v1e(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function lM(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function CQ(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function cM(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const y1e=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=cM(e,e.left,e.top),i=[];for(const a of r){const{id:l}=a,c=n.get(l);if(c){const d=jQ(cM(c),s);i.push({id:l,data:{droppableContainer:a,value:d}})}}return i.sort(NQ)},b1e=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=lM(e),i=[];for(const a of r){const{id:l}=a,c=n.get(l);if(c){const d=lM(c),h=s.reduce((g,x,y)=>g+jQ(d[y],x),0),m=Number((h/4).toFixed(4));i.push({id:l,data:{droppableContainer:a,value:m}})}}return i.sort(NQ)};function w1e(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),a=s-r,l=i-n;if(r{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=w1e(l,e);c>0&&s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(v1e)};function k1e(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function TQ(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:eo}function O1e(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i({...a,top:a.top+t*l.y,bottom:a.bottom+t*l.y,left:a.left+t*l.x,right:a.right+t*l.x}),{...n})}}const j1e=O1e(1);function N1e(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function C1e(t,e,n){const r=N1e(e);if(!r)return t;const{scaleX:s,scaleY:i,x:a,y:l}=r,c=t.left-a-(1-s)*parseFloat(n),d=t.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),h=s?t.width/s:t.width,m=i?t.height/i:t.height;return{width:h,height:m,top:d,right:c+h,bottom:d+m,left:c}}const T1e={ignoreTransform:!1};function Bf(t,e){e===void 0&&(e=T1e);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:h}=_i(t).getComputedStyle(t);d&&(n=C1e(n,d,h))}const{top:r,left:s,width:i,height:a,bottom:l,right:c}=n;return{top:r,left:s,width:i,height:a,bottom:l,right:c}}function uM(t){return Bf(t,{ignoreTransform:!0})}function E1e(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function _1e(t,e){return e===void 0&&(e=_i(t).getComputedStyle(t)),e.position==="fixed"}function A1e(t,e){e===void 0&&(e=_i(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?n.test(i):!1})}function zb(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(sN(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!hg(s)||SQ(s)||n.includes(s))return n;const i=_i(t).getComputedStyle(s);return s!==t&&A1e(s,i)&&n.push(s),_1e(s,i)?n:r(s.parentNode)}return t?r(t):n}function EQ(t){const[e]=zb(t,1);return e??null}function TS(t){return!Pb||!t?null:If(t)?t:rN(t)?sN(t)||t===Lf(t).scrollingElement?window:hg(t)?t:null:null}function _Q(t){return If(t)?t.scrollX:t.scrollLeft}function AQ(t){return If(t)?t.scrollY:t.scrollTop}function TO(t){return{x:_Q(t),y:AQ(t)}}var bs;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(bs||(bs={}));function MQ(t){return!Pb||!t?!1:t===document.scrollingElement}function RQ(t){const e={x:0,y:0},n=MQ(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,a=t.scrollTop>=r.y,l=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:a,isRight:l,maxScroll:r,minScroll:e}}const M1e={x:.2,y:.2};function R1e(t,e,n,r,s){let{top:i,left:a,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=M1e);const{isTop:d,isBottom:h,isLeft:m,isRight:g}=RQ(t),x={x:0,y:0},y={x:0,y:0},w={height:e.height*s.y,width:e.width*s.x};return!d&&i<=e.top+w.height?(x.y=bs.Backward,y.y=r*Math.abs((e.top+w.height-i)/w.height)):!h&&c>=e.bottom-w.height&&(x.y=bs.Forward,y.y=r*Math.abs((e.bottom-w.height-c)/w.height)),!g&&l>=e.right-w.width?(x.x=bs.Forward,y.x=r*Math.abs((e.right-w.width-l)/w.width)):!m&&a<=e.left+w.width&&(x.x=bs.Backward,y.x=r*Math.abs((e.left+w.width-a)/w.width)),{direction:x,speed:y}}function D1e(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function DQ(t){return t.reduce((e,n)=>qh(e,TO(n)),eo)}function P1e(t){return t.reduce((e,n)=>e+_Q(n),0)}function z1e(t){return t.reduce((e,n)=>e+AQ(n),0)}function I1e(t,e){if(e===void 0&&(e=Bf),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);EQ(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const L1e=[["x",["left","right"],P1e],["y",["top","bottom"],z1e]];class oN{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=zb(n),s=DQ(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,a,l]of L1e)for(const c of a)Object.defineProperty(this,c,{get:()=>{const d=l(r),h=s[i]-d;return this.rect[c]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class _0{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function B1e(t){const{EventTarget:e}=_i(t);return t instanceof e?t:Lf(t)}function ES(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var pa;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(pa||(pa={}));function dM(t){t.preventDefault()}function F1e(t){t.stopPropagation()}var jn;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(jn||(jn={}));const PQ={start:[jn.Space,jn.Enter],cancel:[jn.Esc],end:[jn.Space,jn.Enter,jn.Tab]},q1e=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case jn.Right:return{...n,x:n.x+25};case jn.Left:return{...n,x:n.x-25};case jn.Down:return{...n,y:n.y+25};case jn.Up:return{...n,y:n.y-25}}};class lN{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new _0(Lf(n)),this.windowListeners=new _0(_i(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(pa.Resize,this.handleCancel),this.windowListeners.add(pa.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(pa.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&I1e(r),n(eo)}handleKeyDown(e){if(aN(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=PQ,coordinateGetter:a=q1e,scrollBehavior:l="smooth"}=s,{code:c}=e;if(i.end.includes(c)){this.handleEnd(e);return}if(i.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:d}=r.current,h=d?{x:d.left,y:d.top}:eo;this.referenceCoordinates||(this.referenceCoordinates=h);const m=a(e,{active:n,context:r.current,currentCoordinates:h});if(m){const g=pp(m,h),x={x:0,y:0},{scrollableAncestors:y}=r.current;for(const w of y){const S=e.code,{isTop:k,isRight:j,isLeft:N,isBottom:T,maxScroll:E,minScroll:_}=RQ(w),A=D1e(w),D={x:Math.min(S===jn.Right?A.right-A.width/2:A.right,Math.max(S===jn.Right?A.left:A.left+A.width/2,m.x)),y:Math.min(S===jn.Down?A.bottom-A.height/2:A.bottom,Math.max(S===jn.Down?A.top:A.top+A.height/2,m.y))},q=S===jn.Right&&!j||S===jn.Left&&!N,B=S===jn.Down&&!T||S===jn.Up&&!k;if(q&&D.x!==m.x){const H=w.scrollLeft+g.x,W=S===jn.Right&&H<=E.x||S===jn.Left&&H>=_.x;if(W&&!g.y){w.scrollTo({left:H,behavior:l});return}W?x.x=w.scrollLeft-H:x.x=S===jn.Right?w.scrollLeft-E.x:w.scrollLeft-_.x,x.x&&w.scrollBy({left:-x.x,behavior:l});break}else if(B&&D.y!==m.y){const H=w.scrollTop+g.y,W=S===jn.Down&&H<=E.y||S===jn.Up&&H>=_.y;if(W&&!g.x){w.scrollTo({top:H,behavior:l});return}W?x.y=w.scrollTop-H:x.y=S===jn.Down?w.scrollTop-E.y:w.scrollTop-_.y,x.y&&w.scrollBy({top:-x.y,behavior:l});break}}this.handleMove(e,qh(pp(m,this.referenceCoordinates),x))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}lN.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=PQ,onActivation:s}=e,{active:i}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const l=i.activatorNode.current;return l&&t.target!==l?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function hM(t){return!!(t&&"distance"in t)}function fM(t){return!!(t&&"delay"in t)}class cN{constructor(e,n,r){var s;r===void 0&&(r=B1e(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:a}=i;this.props=e,this.events=n,this.document=Lf(a),this.documentListeners=new _0(this.document),this.listeners=new _0(r),this.windowListeners=new _0(_i(a)),this.initialCoordinates=(s=CO(i))!=null?s:eo,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(pa.Resize,this.handleCancel),this.windowListeners.add(pa.DragStart,dM),this.windowListeners.add(pa.VisibilityChange,this.handleCancel),this.windowListeners.add(pa.ContextMenu,dM),this.documentListeners.add(pa.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(fM(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(hM(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(pa.Click,F1e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(pa.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:l}}=i;if(!s)return;const c=(n=CO(e))!=null?n:eo,d=pp(s,c);if(!r&&l){if(hM(l)){if(l.tolerance!=null&&ES(d,l.tolerance))return this.handleCancel();if(ES(d,l.distance))return this.handleStart()}if(fM(l)&&ES(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}e.cancelable&&e.preventDefault(),a(c)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===jn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const $1e={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class uN extends cN{constructor(e){const{event:n}=e,r=Lf(n.target);super(e,$1e,r)}}uN.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const H1e={move:{name:"mousemove"},end:{name:"mouseup"}};var EO;(function(t){t[t.RightClick=2]="RightClick"})(EO||(EO={}));class Q1e extends cN{constructor(e){super(e,H1e,Lf(e.event.target))}}Q1e.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===EO.RightClick?!1:(r?.({event:n}),!0)}}];const _S={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class V1e extends cN{constructor(e){super(e,_S)}static setup(){return window.addEventListener(_S.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(_S.move.name,e)};function e(){}}}V1e.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var A0;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(A0||(A0={}));var wy;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(wy||(wy={}));function U1e(t){let{acceleration:e,activator:n=A0.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:a=5,order:l=wy.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:h,delta:m,threshold:g}=t;const x=G1e({delta:m,disabled:!i}),[y,w]=s1e(),S=b.useRef({x:0,y:0}),k=b.useRef({x:0,y:0}),j=b.useMemo(()=>{switch(n){case A0.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case A0.DraggableRect:return s}},[n,s,c]),N=b.useRef(null),T=b.useCallback(()=>{const _=N.current;if(!_)return;const A=S.current.x*k.current.x,D=S.current.y*k.current.y;_.scrollBy(A,D)},[]),E=b.useMemo(()=>l===wy.TreeOrder?[...d].reverse():d,[l,d]);b.useEffect(()=>{if(!i||!d.length||!j){w();return}for(const _ of E){if(r?.(_)===!1)continue;const A=d.indexOf(_),D=h[A];if(!D)continue;const{direction:q,speed:B}=R1e(_,D,j,e,g);for(const H of["x","y"])x[H][q[H]]||(B[H]=0,q[H]=0);if(B.x>0||B.y>0){w(),N.current=_,y(T,a),S.current=B,k.current=q;return}}S.current={x:0,y:0},k.current={x:0,y:0},w()},[e,T,r,w,i,a,JSON.stringify(j),JSON.stringify(x),y,d,E,h,JSON.stringify(g)])}const W1e={x:{[bs.Backward]:!1,[bs.Forward]:!1},y:{[bs.Backward]:!1,[bs.Forward]:!1}};function G1e(t){let{delta:e,disabled:n}=t;const r=NO(e);return fg(s=>{if(n||!r||!s)return W1e;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[bs.Backward]:s.x[bs.Backward]||i.x===-1,[bs.Forward]:s.x[bs.Forward]||i.x===1},y:{[bs.Backward]:s.y[bs.Backward]||i.y===-1,[bs.Forward]:s.y[bs.Forward]||i.y===1}}},[n,e,r])}function X1e(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return fg(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function Y1e(t,e){return b.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,r)}));return[...n,...i]},[]),[t,e])}var xp;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(xp||(xp={}));var _O;(function(t){t.Optimized="optimized"})(_O||(_O={}));const mM=new Map;function K1e(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,a]=b.useState(null),{frequency:l,measure:c,strategy:d}=s,h=b.useRef(t),m=S(),g=mp(m),x=b.useCallback(function(k){k===void 0&&(k=[]),!g.current&&a(j=>j===null?k:j.concat(k.filter(N=>!j.includes(N))))},[g]),y=b.useRef(null),w=fg(k=>{if(m&&!n)return mM;if(!k||k===mM||h.current!==t||i!=null){const j=new Map;for(let N of t){if(!N)continue;if(i&&i.length>0&&!i.includes(N.id)&&N.rect.current){j.set(N.id,N.rect.current);continue}const T=N.node.current,E=T?new oN(c(T),T):null;N.rect.current=E,E&&j.set(N.id,E)}return j}return k},[t,i,n,m,c]);return b.useEffect(()=>{h.current=t},[t]),b.useEffect(()=>{m||x()},[n,m]),b.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),b.useEffect(()=>{m||typeof l!="number"||y.current!==null||(y.current=setTimeout(()=>{x(),y.current=null},l))},[l,m,x,...r]),{droppableRects:w,measureDroppableContainers:x,measuringScheduled:i!=null};function S(){switch(d){case xp.Always:return!1;case xp.BeforeDragging:return n;default:return!n}}}function zQ(t,e){return fg(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function Z1e(t,e){return zQ(t,e)}function J1e(t){let{callback:e,disabled:n}=t;const r=iN(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function Ib(t){let{callback:e,disabled:n}=t;const r=iN(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function eve(t){return new oN(Bf(t),t)}function pM(t,e,n){e===void 0&&(e=eve);const[r,s]=b.useState(null);function i(){s(c=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=c??n)!=null?d:null}const h=e(t);return JSON.stringify(c)===JSON.stringify(h)?c:h})}const a=J1e({callback(c){if(t)for(const d of c){const{type:h,target:m}=d;if(h==="childList"&&m instanceof HTMLElement&&m.contains(t)){i();break}}}}),l=Ib({callback:i});return $o(()=>{i(),t?(l?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),a?.disconnect())},[t]),r}function tve(t){const e=zQ(t);return TQ(t,e)}const gM=[];function nve(t){const e=b.useRef(t),n=fg(r=>t?r&&r!==gM&&t&&e.current&&t.parentNode===e.current.parentNode?r:zb(t):gM,[t]);return b.useEffect(()=>{e.current=t},[t]),n}function rve(t){const[e,n]=b.useState(null),r=b.useRef(t),s=b.useCallback(i=>{const a=TS(i.target);a&&n(l=>l?(l.set(a,TO(a)),new Map(l)):null)},[]);return b.useEffect(()=>{const i=r.current;if(t!==i){a(i);const l=t.map(c=>{const d=TS(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,TO(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=t}return()=>{a(t),a(i)};function a(l){l.forEach(c=>{const d=TS(c);d?.removeEventListener("scroll",s)})}},[s,t]),b.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>qh(i,a),eo):DQ(t):eo,[t,e])}function xM(t,e){e===void 0&&(e=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},e),b.useEffect(()=>{const r=t!==eo;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?pp(t,n.current):eo}function sve(t){b.useEffect(()=>{if(!Pb)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function ive(t,e){return b.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=a=>{i(a,e)},n},{}),[t,e])}function IQ(t){return b.useMemo(()=>t?E1e(t):null,[t])}const vM=[];function ave(t,e){e===void 0&&(e=Bf);const[n]=t,r=IQ(n?_i(n):null),[s,i]=b.useState(vM);function a(){i(()=>t.length?t.map(c=>MQ(c)?r:new oN(e(c),c)):vM)}const l=Ib({callback:a});return $o(()=>{l?.disconnect(),a(),t.forEach(c=>l?.observe(c))},[t]),s}function ove(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return hg(e)?e:t}function lve(t){let{measure:e}=t;const[n,r]=b.useState(null),s=b.useCallback(d=>{for(const{target:h}of d)if(hg(h)){r(m=>{const g=e(h);return m?{...m,width:g.width,height:g.height}:g});break}},[e]),i=Ib({callback:s}),a=b.useCallback(d=>{const h=ove(d);i?.disconnect(),h&&i?.observe(h),r(h?e(h):null)},[e,i]),[l,c]=yy(a);return b.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const cve=[{sensor:uN,options:{}},{sensor:lN,options:{}}],uve={current:{}},Nv={draggable:{measure:uM},droppable:{measure:uM,strategy:xp.WhileDragging,frequency:_O.Optimized},dragOverlay:{measure:Bf}};class M0 extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const dve={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new M0,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:by},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Nv,measureDroppableContainers:by,windowRect:null,measuringScheduled:!1},hve={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:by,draggableNodes:new Map,over:null,measureDroppableContainers:by},Lb=b.createContext(hve),LQ=b.createContext(dve);function fve(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new M0}}}function mve(t,e){switch(e.type){case ds.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ds.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case ds.DragEnd:case ds.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ds.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new M0(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case ds.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const a=new M0(t.droppable.containers);return a.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:a}}}case ds.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new M0(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function pve(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=b.useContext(Lb),i=NO(r),a=NO(n?.id);return b.useEffect(()=>{if(!e&&!r&&i&&a!=null){if(!aN(i)||document.activeElement===i.target)return;const l=s.get(a);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const h of[c.current,d.current]){if(!h)continue;const m=o1e(h);if(m){m.focus();break}}})}},[r,e,s,a,i]),null}function gve(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function xve(t){return b.useMemo(()=>({draggable:{...Nv.draggable,...t?.draggable},droppable:{...Nv.droppable,...t?.droppable},dragOverlay:{...Nv.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function vve(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=b.useRef(!1),{x:a,y:l}=typeof s=="boolean"?{x:s,y:s}:s;$o(()=>{if(!a&&!l||!e){i.current=!1;return}if(i.current||!r)return;const d=e?.node.current;if(!d||d.isConnected===!1)return;const h=n(d),m=TQ(h,r);if(a||(m.x=0),l||(m.y=0),i.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const g=EQ(d);g&&g.scrollBy({top:m.y,left:m.x})}},[e,a,l,r,n])}const BQ=b.createContext({...eo,scaleX:1,scaleY:1});var Ic;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Ic||(Ic={}));const yve=b.memo(function(e){var n,r,s,i;let{id:a,accessibility:l,autoScroll:c=!0,children:d,sensors:h=cve,collisionDetection:m=S1e,measuring:g,modifiers:x,...y}=e;const w=b.useReducer(mve,void 0,fve),[S,k]=w,[j,N]=f1e(),[T,E]=b.useState(Ic.Uninitialized),_=T===Ic.Initialized,{draggable:{active:A,nodes:D,translate:q},droppable:{containers:B}}=S,H=A!=null?D.get(A):null,W=b.useRef({initial:null,translated:null}),ee=b.useMemo(()=>{var Gt;return A!=null?{id:A,data:(Gt=H?.data)!=null?Gt:uve,rect:W}:null},[A,H]),I=b.useRef(null),[V,L]=b.useState(null),[$,K]=b.useState(null),Y=mp(y,Object.values(y)),R=mg("DndDescribedBy",a),ie=b.useMemo(()=>B.getEnabled(),[B]),X=xve(g),{droppableRects:z,measureDroppableContainers:U,measuringScheduled:te}=K1e(ie,{dragging:_,dependencies:[q.x,q.y],config:X.droppable}),ne=X1e(D,A),G=b.useMemo(()=>$?CO($):null,[$]),se=Wt(),re=Z1e(ne,X.draggable.measure);vve({activeNode:A!=null?D.get(A):null,config:se.layoutShiftCompensation,initialRect:re,measure:X.draggable.measure});const ae=pM(ne,X.draggable.measure,re),_e=pM(ne?ne.parentElement:null),Be=b.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ye=B.getNodeFor((n=Be.current.over)==null?void 0:n.id),Je=lve({measure:X.dragOverlay.measure}),Oe=(r=Je.nodeRef.current)!=null?r:ne,Ve=_?(s=Je.rect)!=null?s:ae:null,Ue=!!(Je.nodeRef.current&&Je.rect),$e=tve(Ue?null:ae),jt=IQ(Oe?_i(Oe):null),vt=nve(_?Ye??ne:null),$n=ave(vt),qt=gve(x,{transform:{x:q.x-$e.x,y:q.y-$e.y,scaleX:1,scaleY:1},activatorEvent:$,active:ee,activeNodeRect:ae,containerNodeRect:_e,draggingNodeRect:Ve,over:Be.current.over,overlayNodeRect:Je.rect,scrollableAncestors:vt,scrollableAncestorRects:$n,windowRect:jt}),un=G?qh(G,q):null,Mt=rve(vt),ct=xM(Mt),Ne=xM(Mt,[ae]),ze=qh(qt,ct),rt=Ve?j1e(Ve,qt):null,bt=ee&&rt?m({active:ee,collisionRect:rt,droppableRects:z,droppableContainers:ie,pointerCoordinates:un}):null,zt=CQ(bt,"id"),[Rt,Hn]=b.useState(null),We=Ue?qt:qh(qt,Ne),ot=k1e(We,(i=Rt?.rect)!=null?i:null,ae),dn=b.useRef(null),Pt=b.useCallback((Gt,lt)=>{let{sensor:ve,options:He}=lt;if(I.current==null)return;const ht=D.get(I.current);if(!ht)return;const vn=Gt.nativeEvent,Qn=new ve({active:I.current,activeNode:ht,event:vn,options:He,context:Be,onAbort(ar){if(!D.get(ar))return;const{onDragAbort:vs}=Y.current,js={id:ar};vs?.(js),j({type:"onDragAbort",event:js})},onPending(ar,xs,vs,js){if(!D.get(ar))return;const{onDragPending:Ie}=Y.current,Et={id:ar,constraint:xs,initialCoordinates:vs,offset:js};Ie?.(Et),j({type:"onDragPending",event:Et})},onStart(ar){const xs=I.current;if(xs==null)return;const vs=D.get(xs);if(!vs)return;const{onDragStart:js}=Y.current,ge={activatorEvent:vn,active:{id:xs,data:vs.data,rect:W}};ya.unstable_batchedUpdates(()=>{js?.(ge),E(Ic.Initializing),k({type:ds.DragStart,initialCoordinates:ar,active:xs}),j({type:"onDragStart",event:ge}),L(dn.current),K(vn)})},onMove(ar){k({type:ds.DragMove,coordinates:ar})},onEnd:fr(ds.DragEnd),onCancel:fr(ds.DragCancel)});dn.current=Qn;function fr(ar){return async function(){const{active:vs,collisions:js,over:ge,scrollAdjustedTranslate:Ie}=Be.current;let Et=null;if(vs&&Ie){const{cancelDrop:kn}=Y.current;Et={activatorEvent:vn,active:vs,collisions:js,delta:Ie,over:ge},ar===ds.DragEnd&&typeof kn=="function"&&await Promise.resolve(kn(Et))&&(ar=ds.DragCancel)}I.current=null,ya.unstable_batchedUpdates(()=>{k({type:ar}),E(Ic.Uninitialized),Hn(null),L(null),K(null),dn.current=null;const kn=ar===ds.DragEnd?"onDragEnd":"onDragCancel";if(Et){const Hr=Y.current[kn];Hr?.(Et),j({type:kn,event:Et})}})}}},[D]),xn=b.useCallback((Gt,lt)=>(ve,He)=>{const ht=ve.nativeEvent,vn=D.get(He);if(I.current!==null||!vn||ht.dndKit||ht.defaultPrevented)return;const Qn={active:vn};Gt(ve,lt.options,Qn)===!0&&(ht.dndKit={capturedBy:lt.sensor},I.current=He,Pt(ve,lt))},[D,Pt]),dt=Y1e(h,xn);sve(h),$o(()=>{ae&&T===Ic.Initializing&&E(Ic.Initialized)},[ae,T]),b.useEffect(()=>{const{onDragMove:Gt}=Y.current,{active:lt,activatorEvent:ve,collisions:He,over:ht}=Be.current;if(!lt||!ve)return;const vn={active:lt,activatorEvent:ve,collisions:He,delta:{x:ze.x,y:ze.y},over:ht};ya.unstable_batchedUpdates(()=>{Gt?.(vn),j({type:"onDragMove",event:vn})})},[ze.x,ze.y]),b.useEffect(()=>{const{active:Gt,activatorEvent:lt,collisions:ve,droppableContainers:He,scrollAdjustedTranslate:ht}=Be.current;if(!Gt||I.current==null||!lt||!ht)return;const{onDragOver:vn}=Y.current,Qn=He.get(zt),fr=Qn&&Qn.rect.current?{id:Qn.id,rect:Qn.rect.current,data:Qn.data,disabled:Qn.disabled}:null,ar={active:Gt,activatorEvent:lt,collisions:ve,delta:{x:ht.x,y:ht.y},over:fr};ya.unstable_batchedUpdates(()=>{Hn(fr),vn?.(ar),j({type:"onDragOver",event:ar})})},[zt]),$o(()=>{Be.current={activatorEvent:$,active:ee,activeNode:ne,collisionRect:rt,collisions:bt,droppableRects:z,draggableNodes:D,draggingNode:Oe,draggingNodeRect:Ve,droppableContainers:B,over:Rt,scrollableAncestors:vt,scrollAdjustedTranslate:ze},W.current={initial:Ve,translated:rt}},[ee,ne,bt,rt,D,Oe,Ve,z,B,Rt,vt,ze]),U1e({...se,delta:q,draggingRect:rt,pointerCoordinates:un,scrollableAncestors:vt,scrollableAncestorRects:$n});const rn=b.useMemo(()=>({active:ee,activeNode:ne,activeNodeRect:ae,activatorEvent:$,collisions:bt,containerNodeRect:_e,dragOverlay:Je,draggableNodes:D,droppableContainers:B,droppableRects:z,over:Rt,measureDroppableContainers:U,scrollableAncestors:vt,scrollableAncestorRects:$n,measuringConfiguration:X,measuringScheduled:te,windowRect:jt}),[ee,ne,ae,$,bt,_e,Je,D,B,z,Rt,U,vt,$n,X,te,jt]),wt=b.useMemo(()=>({activatorEvent:$,activators:dt,active:ee,activeNodeRect:ae,ariaDescribedById:{draggable:R},dispatch:k,draggableNodes:D,over:Rt,measureDroppableContainers:U}),[$,dt,ee,ae,k,R,D,Rt,U]);return oe.createElement(OQ.Provider,{value:N},oe.createElement(Lb.Provider,{value:wt},oe.createElement(LQ.Provider,{value:rn},oe.createElement(BQ.Provider,{value:ot},d)),oe.createElement(pve,{disabled:l?.restoreFocus===!1})),oe.createElement(g1e,{...l,hiddenTextDescribedById:R}));function Wt(){const Gt=V?.autoScrollEnabled===!1,lt=typeof c=="object"?c.enabled===!1:c===!1,ve=_&&!Gt&&!lt;return typeof c=="object"?{...c,enabled:ve}:{enabled:ve}}}),bve=b.createContext(null),yM="button",wve="Draggable";function Sve(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=mg(wve),{activators:a,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:h,draggableNodes:m,over:g}=b.useContext(Lb),{role:x=yM,roleDescription:y="draggable",tabIndex:w=0}=s??{},S=c?.id===e,k=b.useContext(S?BQ:bve),[j,N]=yy(),[T,E]=yy(),_=ive(a,e),A=mp(n);$o(()=>(m.set(e,{id:e,key:i,node:j,activatorNode:T,data:A}),()=>{const q=m.get(e);q&&q.key===i&&m.delete(e)}),[m,e]);const D=b.useMemo(()=>({role:x,tabIndex:w,"aria-disabled":r,"aria-pressed":S&&x===yM?!0:void 0,"aria-roledescription":y,"aria-describedby":h.draggable}),[r,x,w,S,y,h.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:D,isDragging:S,listeners:r?void 0:_,node:j,over:g,setNodeRef:N,setActivatorNodeRef:E,transform:k}}function kve(){return b.useContext(LQ)}const Ove="Droppable",jve={timeout:25};function Nve(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=mg(Ove),{active:a,dispatch:l,over:c,measureDroppableContainers:d}=b.useContext(Lb),h=b.useRef({disabled:n}),m=b.useRef(!1),g=b.useRef(null),x=b.useRef(null),{disabled:y,updateMeasurementsFor:w,timeout:S}={...jve,...s},k=mp(w??r),j=b.useCallback(()=>{if(!m.current){m.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{d(Array.isArray(k.current)?k.current:[k.current]),x.current=null},S)},[S]),N=Ib({callback:j,disabled:y||!a}),T=b.useCallback((D,q)=>{N&&(q&&(N.unobserve(q),m.current=!1),D&&N.observe(D))},[N]),[E,_]=yy(T),A=mp(e);return b.useEffect(()=>{!N||!E.current||(N.disconnect(),m.current=!1,N.observe(E.current))},[E,N]),b.useEffect(()=>(l({type:ds.RegisterDroppable,element:{id:r,key:i,disabled:n,node:E,rect:g,data:A}}),()=>l({type:ds.UnregisterDroppable,key:i,id:r})),[r]),b.useEffect(()=>{n!==h.current.disabled&&(l({type:ds.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)},[r,i,n,l]),{active:a,rect:g,isOver:c?.id===r,node:E,over:c,setNodeRef:_}}function dN(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Cve(t,e){return t.reduce((n,r,s)=>{const i=e.get(r);return i&&(n[s]=i),n},Array(t.length))}function _1(t){return t!==null&&t>=0}function Tve(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{var e;let{rects:n,activeNodeRect:r,activeIndex:s,overIndex:i,index:a}=t;const l=(e=n[s])!=null?e:r;if(!l)return null;const c=Ave(n,a,s);if(a===s){const d=n[i];return d?{x:ss&&a<=i?{x:-l.width-c,y:0,...A1}:a=i?{x:l.width+c,y:0,...A1}:{x:0,y:0,...A1}};function Ave(t,e,n){const r=t[e],s=t[e-1],i=t[e+1];return!r||!s&&!i?0:n{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const i=dN(e,r,n),a=e[s],l=i[s];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},qQ="Sortable",$Q=oe.createContext({activeIndex:-1,containerId:qQ,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:FQ,disabled:{draggable:!1,droppable:!1}});function Mve(t){let{children:e,id:n,items:r,strategy:s=FQ,disabled:i=!1}=t;const{active:a,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:h}=kve(),m=mg(qQ,n),g=l.rect!==null,x=b.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),y=a!=null,w=a?x.indexOf(a.id):-1,S=d?x.indexOf(d.id):-1,k=b.useRef(x),j=!Tve(x,k.current),N=S!==-1&&w===-1||j,T=Eve(i);$o(()=>{j&&y&&h(x)},[j,x,y,h]),b.useEffect(()=>{k.current=x},[x]);const E=b.useMemo(()=>({activeIndex:w,containerId:m,disabled:T,disableTransforms:N,items:x,overIndex:S,useDragOverlay:g,sortedRects:Cve(x,c),strategy:s}),[w,m,T.draggable,T.droppable,N,x,S,c,g,s]);return oe.createElement($Q.Provider,{value:E},e)}const Rve=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return dN(n,r,s).indexOf(e)},Dve=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:i,newIndex:a,previousItems:l,previousContainerId:c,transition:d}=t;return!d||!r||l!==i&&s===a?!1:n?!0:a!==s&&e===c},Pve={duration:200,easing:"ease"},HQ="transform",zve=gp.Transition.toString({property:HQ,duration:0,easing:"linear"}),Ive={roleDescription:"sortable"};function Lve(t){let{disabled:e,index:n,node:r,rect:s}=t;const[i,a]=b.useState(null),l=b.useRef(n);return $o(()=>{if(!e&&n!==l.current&&r.current){const c=s.current;if(c){const d=Bf(r.current,{ignoreTransform:!0}),h={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(h.x||h.y)&&a(h)}}n!==l.current&&(l.current=n)},[e,n,r,s]),b.useEffect(()=>{i&&a(null)},[i]),i}function Bve(t){let{animateLayoutChanges:e=Dve,attributes:n,disabled:r,data:s,getNewIndex:i=Rve,id:a,strategy:l,resizeObserverConfig:c,transition:d=Pve}=t;const{items:h,containerId:m,activeIndex:g,disabled:x,disableTransforms:y,sortedRects:w,overIndex:S,useDragOverlay:k,strategy:j}=b.useContext($Q),N=Fve(r,x),T=h.indexOf(a),E=b.useMemo(()=>({sortable:{containerId:m,index:T,items:h},...s}),[m,s,T,h]),_=b.useMemo(()=>h.slice(h.indexOf(a)),[h,a]),{rect:A,node:D,isOver:q,setNodeRef:B}=Nve({id:a,data:E,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...c}}),{active:H,activatorEvent:W,activeNodeRect:ee,attributes:I,setNodeRef:V,listeners:L,isDragging:$,over:K,setActivatorNodeRef:Y,transform:R}=Sve({id:a,data:E,attributes:{...Ive,...n},disabled:N.draggable}),ie=r1e(B,V),X=!!H,z=X&&!y&&_1(g)&&_1(S),U=!k&&$,te=U&&z?R:null,G=z?te??(l??j)({rects:w,activeNodeRect:ee,activeIndex:g,overIndex:S,index:T}):null,se=_1(g)&&_1(S)?i({id:a,items:h,activeIndex:g,overIndex:S}):T,re=H?.id,ae=b.useRef({activeId:re,items:h,newIndex:se,containerId:m}),_e=h!==ae.current.items,Be=e({active:H,containerId:m,isDragging:$,isSorting:X,id:a,index:T,items:h,newIndex:ae.current.newIndex,previousItems:ae.current.items,previousContainerId:ae.current.containerId,transition:d,wasDragging:ae.current.activeId!=null}),Ye=Lve({disabled:!Be,index:T,node:D,rect:A});return b.useEffect(()=>{X&&ae.current.newIndex!==se&&(ae.current.newIndex=se),m!==ae.current.containerId&&(ae.current.containerId=m),h!==ae.current.items&&(ae.current.items=h)},[X,se,m,h]),b.useEffect(()=>{if(re===ae.current.activeId)return;if(re!=null&&ae.current.activeId==null){ae.current.activeId=re;return}const Oe=setTimeout(()=>{ae.current.activeId=re},50);return()=>clearTimeout(Oe)},[re]),{active:H,activeIndex:g,attributes:I,data:E,rect:A,index:T,newIndex:se,items:h,isOver:q,isSorting:X,isDragging:$,listeners:L,node:D,overIndex:S,over:K,setNodeRef:ie,setActivatorNodeRef:Y,setDroppableNodeRef:B,setDraggableNodeRef:V,transform:Ye??G,transition:Je()};function Je(){if(Ye||_e&&ae.current.newIndex===T)return zve;if(!(U&&!aN(W)||!d)&&(X||Be))return gp.Transition.toString({...d,property:HQ})}}function Fve(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function Sy(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const qve=[jn.Down,jn.Right,jn.Up,jn.Left],$ve=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:a,scrollableAncestors:l}}=e;if(qve.includes(t.code)){if(t.preventDefault(),!n||!r)return;const c=[];i.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const g=s.get(m.id);if(g)switch(t.code){case jn.Down:r.topg.top&&c.push(m);break;case jn.Left:r.left>g.left&&c.push(m);break;case jn.Right:r.left1&&(h=d[1].id),h!=null){const m=i.get(n.id),g=i.get(h),x=g?s.get(g.id):null,y=g?.node.current;if(y&&x&&m&&g){const S=zb(y).some((_,A)=>l[A]!==_),k=QQ(m,g),j=Hve(m,g),N=S||!k?{x:0,y:0}:{x:j?r.width-x.width:0,y:j?r.height-x.height:0},T={x:x.left,y:x.top};return N.x&&N.y?T:pp(T,N)}}}};function QQ(t,e){return!Sy(t)||!Sy(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Hve(t,e){return!Sy(t)||!Sy(e)||!QQ(t,e)?!1:t.data.current.sortable.index{h.stopPropagation(),n(t)}})]})})}function Vve({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[a,l]=b.useState(!1),c=x1e(oM(uN,{activationConstraint:{distance:8}}),oM(lN,{coordinateGetter:$ve})),d=g=>{e.includes(g)?n(e.filter(x=>x!==g)):n([...e,g])},h=g=>{n(e.filter(x=>x!==g))},m=g=>{const{active:x,over:y}=g;if(y&&x.id!==y.id){const w=e.indexOf(x.id),S=e.indexOf(y.id);n(dN(e,w,S))}};return o.jsxs(Bo,{open:a,onOpenChange:l,children:[o.jsx(Fo,{asChild:!0,children:o.jsxs(ue,{variant:"outline",role:"combobox","aria-expanded":a,className:xe("w-full justify-between min-h-10 h-auto",i),children:[o.jsx(yve,{sensors:c,collisionDetection:y1e,onDragEnd:m,children:o.jsx(Mve,{items:e,strategy:_ve,children:o.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?o.jsx("span",{className:"text-muted-foreground",children:r}):e.map(g=>{const x=t.find(y=>y.value===g);return o.jsx(Qve,{value:g,label:x?.label||g,onRemove:h},g)})})})}),o.jsx(Lj,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),o.jsx(Ka,{className:"w-full p-0",align:"start",children:o.jsxs(Tb,{children:[o.jsx(Eb,{placeholder:"搜索...",className:"h-9"}),o.jsxs(_b,{children:[o.jsx(Ab,{children:s}),o.jsx(up,{children:t.map(g=>{const x=e.includes(g.value);return o.jsxs(dp,{value:g.value,onSelect:()=>d(g.value),children:[o.jsx("div",{className:xe("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:o.jsx(zo,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),o.jsx("span",{children:g.label})]},g.value)})})]})]})})]})}const bM=new Map,Uve=300*1e3;function Wve(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[a,l]=b.useState([]),[c,d]=b.useState(null),[h,m]=b.useState(!0),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[j,N]=b.useState(!1),[T,E]=b.useState(!1),[_,A]=b.useState(!1),[D,q]=b.useState(null),[B,H]=b.useState(null),[W,ee]=b.useState(!1),[I,V]=b.useState(null),[L,$]=b.useState(""),[K,Y]=b.useState(new Set),[R,ie]=b.useState(!1),[X,z]=b.useState(1),[U,te]=b.useState(20),[ne,G]=b.useState(""),[se,re]=b.useState([]),[ae,_e]=b.useState(!1),[Be,Ye]=b.useState(null),[Je,Oe]=b.useState(!1),[Ve,Ue]=b.useState(null),{toast:$e}=Lr(),jt=na(),{registerTour:vt,startTour:$n,state:qt,goToStep:un}=nN(),Mt=b.useRef(null),ct=b.useRef(null),Ne=b.useRef(!0);b.useEffect(()=>{vt(Rl,bQ)},[vt]),b.useEffect(()=>{if(qt.activeTourId===Rl&&qt.isRunning){const ge=wQ[qt.stepIndex];ge&&!window.location.pathname.endsWith(ge.replace("/config/",""))&&jt({to:ge})}},[qt.stepIndex,qt.activeTourId,qt.isRunning,jt]);const ze=b.useRef(qt.stepIndex);b.useEffect(()=>{if(qt.activeTourId===Rl&&qt.isRunning){const ge=ze.current,Ie=qt.stepIndex;ge>=12&&ge<=17&&Ie<12&&A(!1),ze.current=Ie}},[qt.stepIndex,qt.activeTourId,qt.isRunning]),b.useEffect(()=>{if(qt.activeTourId!==Rl||!qt.isRunning)return;const ge=Ie=>{const Et=Ie.target,kn=qt.stepIndex;kn===2&&Et.closest('[data-tour="add-provider-button"]')?setTimeout(()=>un(3),300):kn===9&&Et.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>un(10),300):kn===11&&Et.closest('[data-tour="add-model-button"]')?setTimeout(()=>un(12),300):kn===17&&Et.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>un(18),300):kn===18&&Et.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>un(19),300)};return document.addEventListener("click",ge,!0),()=>document.removeEventListener("click",ge,!0)},[qt,un]);const rt=()=>{$n(Rl)};b.useEffect(()=>{bt()},[]);const bt=async()=>{try{m(!0);const ge=await Dh(),Ie=ge.models||[];e(Ie),l(Ie.map(kn=>kn.name));const Et=ge.api_providers||[];r(Et.map(kn=>kn.name)),i(Et),d(ge.model_task_config||null),k(!1),Ne.current=!1}catch(ge){console.error("加载配置失败:",ge)}finally{m(!1)}},zt=b.useCallback(ge=>s.find(Ie=>Ie.name===ge),[s]),Rt=b.useCallback(async(ge,Ie=!1)=>{const Et=zt(ge);if(!Et?.base_url){re([]),Ue(null),Ye('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!Et.api_key){re([]),Ue(null),Ye('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const kn=t1e(Et.base_url);if(Ue(kn),!kn?.modelFetcher){re([]),Ye(null);return}const Hr=`${ge}:${Et.base_url}`,Mr=bM.get(Hr);if(!Ie&&Mr&&Date.now()-Mr.timestamp{_&&D?.api_provider&&Rt(D.api_provider)},[_,D?.api_provider,Rt]);const Hn=async()=>{try{N(!0),cb().catch(()=>{}),E(!0)}catch(ge){console.error("重启失败:",ge),E(!1),$e({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),N(!1)}},We=async()=>{try{x(!0),Mt.current&&clearTimeout(Mt.current),ct.current&&clearTimeout(ct.current);const ge=await Dh();ge.models=t,ge.model_task_config=c,await Uv(ge),k(!1),$e({title:"保存成功",description:"正在重启麦麦..."}),await Hn()}catch(ge){console.error("保存配置失败:",ge),$e({title:"保存失败",description:ge.message,variant:"destructive"}),x(!1)}},ot=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},dn=()=>{E(!1),N(!1),$e({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Pt=b.useCallback(async ge=>{if(!Ne.current)try{w(!0),await bk("models",ge),k(!1)}catch(Ie){console.error("自动保存模型列表失败:",Ie),k(!0)}finally{w(!1)}},[]),xn=b.useCallback(async ge=>{if(!Ne.current)try{w(!0),await bk("model_task_config",ge),k(!1)}catch(Ie){console.error("自动保存任务配置失败:",Ie),k(!0)}finally{w(!1)}},[]);b.useEffect(()=>{if(!Ne.current)return k(!0),Mt.current&&clearTimeout(Mt.current),Mt.current=setTimeout(()=>{Pt(t)},2e3),()=>{Mt.current&&clearTimeout(Mt.current)}},[t,Pt]),b.useEffect(()=>{if(!(Ne.current||!c))return k(!0),ct.current&&clearTimeout(ct.current),ct.current=setTimeout(()=>{xn(c)},2e3),()=>{ct.current&&clearTimeout(ct.current)}},[c,xn]);const dt=async()=>{try{x(!0),Mt.current&&clearTimeout(Mt.current),ct.current&&clearTimeout(ct.current);const ge=await Dh();ge.models=t,ge.model_task_config=c,await Uv(ge),k(!1),$e({title:"保存成功",description:"模型配置已保存"}),await bt()}catch(ge){console.error("保存配置失败:",ge),$e({title:"保存失败",description:ge.message,variant:"destructive"})}finally{x(!1)}},rn=(ge,Ie)=>{q(ge||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),H(Ie),A(!0)},wt=()=>{if(!D)return;const ge={...D,price_in:D.price_in??0,price_out:D.price_out??0};let Ie;B!==null?(Ie=[...t],Ie[B]=ge):Ie=[...t,ge],e(Ie),l(Ie.map(Et=>Et.name)),A(!1),q(null),H(null)},Wt=ge=>{if(!ge&&D){const Ie={...D,price_in:D.price_in??0,price_out:D.price_out??0};q(Ie)}A(ge)},Gt=ge=>{V(ge),ee(!0)},lt=()=>{if(I!==null){const ge=t.filter((Ie,Et)=>Et!==I);e(ge),l(ge.map(Ie=>Ie.name)),$e({title:"删除成功",description:"模型已从列表中移除"})}ee(!1),V(null)},ve=ge=>{const Ie=new Set(K);Ie.has(ge)?Ie.delete(ge):Ie.add(ge),Y(Ie)},He=()=>{if(K.size===fr.length)Y(new Set);else{const ge=fr.map((Ie,Et)=>t.findIndex(kn=>kn===fr[Et]));Y(new Set(ge))}},ht=()=>{if(K.size===0){$e({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ie(!0)},vn=()=>{const ge=t.filter((Ie,Et)=>!K.has(Et));e(ge),l(ge.map(Ie=>Ie.name)),Y(new Set),ie(!1),$e({title:"批量删除成功",description:`已删除 ${K.size} 个模型`})},Qn=(ge,Ie,Et)=>{c&&d({...c,[ge]:{...c[ge],[Ie]:Et}})},fr=t.filter(ge=>{if(!L)return!0;const Ie=L.toLowerCase();return ge.name.toLowerCase().includes(Ie)||ge.model_identifier.toLowerCase().includes(Ie)||ge.api_provider.toLowerCase().includes(Ie)}),ar=Math.ceil(fr.length/U),xs=fr.slice((X-1)*U,X*U),vs=()=>{const ge=parseInt(ne);ge>=1&&ge<=ar&&(z(ge),G(""))},js=ge=>c?[c.utils?.model_list||[],c.utils_small?.model_list||[],c.tool_use?.model_list||[],c.replyer?.model_list||[],c.planner?.model_list||[],c.vlm?.model_list||[],c.voice?.model_list||[],c.embedding?.model_list||[],c.lpmm_entity_extract?.model_list||[],c.lpmm_rdf_build?.model_list||[],c.lpmm_qa?.model_list||[]].some(Et=>Et.includes(ge)):!1;return h?o.jsx(pn,{className:"h-full",children:o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):o.jsx(pn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(ue,{onClick:dt,disabled:g||y||!S||j,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[o.jsx(zp,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),g?"保存中...":y?"自动保存中...":S?"保存配置":"已保存"]}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsxs(ue,{disabled:g||y||j,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[o.jsx(Dp,{className:"mr-2 h-4 w-4"}),j?"重启中...":S?"保存并重启":"重启麦麦"]})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认重启麦麦?"}),o.jsx(zn,{className:"space-y-3",asChild:!0,children:o.jsxs("div",{children:[o.jsx("p",{children:S?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(ba,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(Xi,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(wa,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",o.jsxs(Er,{children:[o.jsx(Of,{asChild:!0,children:o.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[o.jsx(Zy,{className:"h-3 w-3"}),"如何结束程序?"]})}),o.jsxs(wr,{className:"max-w-2xl",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"如何结束使用重启功能后的麦麦程序"}),o.jsx(Xr,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),o.jsxs(Yi,{defaultValue:"windows",className:"w-full",children:[o.jsxs(ji,{className:"grid w-full grid-cols-3",children:[o.jsx(Bt,{value:"windows",children:"Windows"}),o.jsx(Bt,{value:"macos",children:"macOS"}),o.jsx(Bt,{value:"linux",children:"Linux"})]}),o.jsxs(ln,{value:"windows",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),o.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),o.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),o.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),o.jsxs(ln,{value:"macos",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight,搜索"活动监视器"']}),o.jsxs("li",{children:["在进程列表中找到 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),o.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]})]}),o.jsxs(ln,{value:"linux",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),o.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[o.jsx("p",{children:"# 查找麦麦进程"}),o.jsx("p",{children:"ps aux | grep python | grep -v grep"}),o.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),o.jsx("p",{children:"kill -9 "}),o.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),o.jsx("p",{children:'pkill -9 -f "bot.py"'}),o.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),o.jsx("p",{children:"pkill -9 python"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[o.jsxs("li",{children:["在终端输入 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),o.jsxs("li",{children:["按 ",o.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),o.jsx(fs,{children:o.jsx(e6,{asChild:!0,children:o.jsx(ue,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:S?We:Hn,children:S?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(ba,{children:[o.jsx(Xi,{className:"h-4 w-4"}),o.jsxs(wa,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),o.jsxs(ba,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:rt,children:[o.jsx(Zee,{className:"h-4 w-4 text-primary"}),o.jsxs(wa,{className:"flex items-center justify-between",children:[o.jsxs("span",{children:[o.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),o.jsx(ue,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),o.jsxs(Yi,{defaultValue:"models",className:"w-full",children:[o.jsxs(ji,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[o.jsx(Bt,{value:"models",children:"添加模型"}),o.jsx(Bt,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),o.jsxs(ln,{value:"models",className:"space-y-4 mt-0",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[K.size>0&&o.jsxs(ue,{onClick:ht,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(Cn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",K.size,")"]}),o.jsxs(ue,{onClick:()=>rn(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[o.jsx(Is,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[o.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索模型名称、标识符或提供商...",value:L,onChange:ge=>$(ge.target.value),className:"pl-9"})]}),L&&o.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",fr.length," 个结果"]})]}),o.jsx("div",{className:"md:hidden space-y-3",children:xs.length===0?o.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:L?"未找到匹配的模型":"暂无模型配置"}):xs.map((ge,Ie)=>{const Et=t.findIndex(Hr=>Hr===ge),kn=js(ge.name);return o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("h3",{className:"font-semibold text-base",children:ge.name}),o.jsx(tn,{variant:kn?"default":"secondary",className:kn?"bg-green-600 hover:bg-green-700":"",children:kn?"已使用":"未使用"})]}),o.jsx("p",{className:"text-xs text-muted-foreground break-all",title:ge.model_identifier,children:ge.model_identifier})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[o.jsxs(ue,{variant:"default",size:"sm",onClick:()=>rn(ge,Et),children:[o.jsx(Ju,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(ue,{size:"sm",onClick:()=>Gt(Et),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Cn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),o.jsx("p",{className:"font-medium",children:ge.api_provider})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),o.jsx("p",{className:"font-medium",children:ge.force_stream_mode?"是":"否"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),o.jsxs("p",{className:"font-medium",children:["¥",ge.price_in,"/M"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),o.jsxs("p",{className:"font-medium",children:["¥",ge.price_out,"/M"]})]})]})]},Ie)})}),o.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(Af,{children:[o.jsx(Mf,{children:o.jsxs(zs,{children:[o.jsx(mn,{className:"w-12",children:o.jsx(Ci,{checked:K.size===fr.length&&fr.length>0,onCheckedChange:He})}),o.jsx(mn,{className:"w-24",children:"使用状态"}),o.jsx(mn,{children:"模型名称"}),o.jsx(mn,{children:"模型标识符"}),o.jsx(mn,{children:"提供商"}),o.jsx(mn,{className:"text-right",children:"输入价格"}),o.jsx(mn,{className:"text-right",children:"输出价格"}),o.jsx(mn,{className:"text-center",children:"强制流式"}),o.jsx(mn,{className:"text-right",children:"操作"})]})}),o.jsx(Rf,{children:xs.length===0?o.jsx(zs,{children:o.jsx(Yt,{colSpan:9,className:"text-center text-muted-foreground py-8",children:L?"未找到匹配的模型":"暂无模型配置"})}):xs.map((ge,Ie)=>{const Et=t.findIndex(Hr=>Hr===ge),kn=js(ge.name);return o.jsxs(zs,{children:[o.jsx(Yt,{children:o.jsx(Ci,{checked:K.has(Et),onCheckedChange:()=>ve(Et)})}),o.jsx(Yt,{children:o.jsx(tn,{variant:kn?"default":"secondary",className:kn?"bg-green-600 hover:bg-green-700":"",children:kn?"已使用":"未使用"})}),o.jsx(Yt,{className:"font-medium",children:ge.name}),o.jsx(Yt,{className:"max-w-xs truncate",title:ge.model_identifier,children:ge.model_identifier}),o.jsx(Yt,{children:ge.api_provider}),o.jsxs(Yt,{className:"text-right",children:["¥",ge.price_in,"/M"]}),o.jsxs(Yt,{className:"text-right",children:["¥",ge.price_out,"/M"]}),o.jsx(Yt,{className:"text-center",children:ge.force_stream_mode?"是":"否"}),o.jsx(Yt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(ue,{variant:"default",size:"sm",onClick:()=>rn(ge,Et),children:[o.jsx(Ju,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(ue,{size:"sm",onClick:()=>Gt(Et),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Cn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},Ie)})})]})})}),fr.length>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:U.toString(),onValueChange:ge=>{te(parseInt(ge)),z(1),Y(new Set)},children:[o.jsx($t,{id:"page-size-model",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(X-1)*U+1," 到"," ",Math.min(X*U,fr.length)," 条,共 ",fr.length," 条"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>z(1),disabled:X===1,className:"hidden sm:flex",children:o.jsx(Ip,{className:"h-4 w-4"})}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>z(ge=>Math.max(1,ge-1)),disabled:X===1,children:[o.jsx(wd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:ne,onChange:ge=>G(ge.target.value),onKeyDown:ge=>ge.key==="Enter"&&vs(),placeholder:X.toString(),className:"w-16 h-8 text-center",min:1,max:ar}),o.jsx(ue,{variant:"outline",size:"sm",onClick:vs,disabled:!ne,className:"h-8",children:"跳转"})]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>z(ge=>ge+1),disabled:X>=ar,children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Zl,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>z(ar),disabled:X>=ar,className:"hidden sm:flex",children:o.jsx(Lp,{className:"h-4 w-4"})})]})]})]}),o.jsxs(ln,{value:"tasks",className:"space-y-6 mt-0",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),c&&o.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[o.jsx(qa,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:c.utils,modelNames:a,onChange:(ge,Ie)=>Qn("utils",ge,Ie),dataTour:"task-model-select"}),o.jsx(qa,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:c.utils_small,modelNames:a,onChange:(ge,Ie)=>Qn("utils_small",ge,Ie)}),o.jsx(qa,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:c.tool_use,modelNames:a,onChange:(ge,Ie)=>Qn("tool_use",ge,Ie)}),o.jsx(qa,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:c.replyer,modelNames:a,onChange:(ge,Ie)=>Qn("replyer",ge,Ie)}),o.jsx(qa,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:c.planner,modelNames:a,onChange:(ge,Ie)=>Qn("planner",ge,Ie)}),o.jsx(qa,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:c.vlm,modelNames:a,onChange:(ge,Ie)=>Qn("vlm",ge,Ie),hideTemperature:!0}),o.jsx(qa,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:c.voice,modelNames:a,onChange:(ge,Ie)=>Qn("voice",ge,Ie),hideTemperature:!0,hideMaxTokens:!0}),o.jsx(qa,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:c.embedding,modelNames:a,onChange:(ge,Ie)=>Qn("embedding",ge,Ie),hideTemperature:!0,hideMaxTokens:!0}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),o.jsx(qa,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:c.lpmm_entity_extract,modelNames:a,onChange:(ge,Ie)=>Qn("lpmm_entity_extract",ge,Ie)}),o.jsx(qa,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:c.lpmm_rdf_build,modelNames:a,onChange:(ge,Ie)=>Qn("lpmm_rdf_build",ge,Ie)}),o.jsx(qa,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:c.lpmm_qa,modelNames:a,onChange:(ge,Ie)=>Qn("lpmm_qa",ge,Ie)})]})]})]})]}),o.jsx(Er,{open:_,onOpenChange:Wt,children:o.jsxs(wr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:qt.isRunning,children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:B!==null?"编辑模型":"添加模型"}),o.jsx(Xr,{children:"配置模型的基本信息和参数"})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2","data-tour":"model-name-input",children:[o.jsx(he,{htmlFor:"model_name",children:"模型名称 *"}),o.jsx(Pe,{id:"model_name",value:D?.name||"",onChange:ge=>q(Ie=>Ie?{...Ie,name:ge.target.value}:null),placeholder:"例如: qwen3-30b"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"model-provider-select",children:[o.jsx(he,{htmlFor:"api_provider",children:"API 提供商 *"}),o.jsxs(Vt,{value:D?.api_provider||"",onValueChange:ge=>{q(Ie=>Ie?{...Ie,api_provider:ge}:null),re([]),Ye(null)},children:[o.jsx($t,{id:"api_provider",children:o.jsx(Ut,{placeholder:"选择提供商"})}),o.jsx(Ht,{children:n.map(ge=>o.jsx(De,{value:ge,children:ge},ge))})]})]}),o.jsxs("div",{className:"grid gap-2","data-tour":"model-identifier-input",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{htmlFor:"model_identifier",children:"模型标识符 *"}),Ve?.modelFetcher&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(tn,{variant:"secondary",className:"text-xs",children:Ve.display_name}),o.jsx(ue,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>D?.api_provider&&Rt(D.api_provider,!0),disabled:ae,children:ae?o.jsx(Us,{className:"h-3 w-3 animate-spin"}):o.jsx(Qs,{className:"h-3 w-3"})})]})]}),Ve?.modelFetcher?o.jsxs(Bo,{open:Je,onOpenChange:Oe,children:[o.jsx(Fo,{asChild:!0,children:o.jsxs(ue,{variant:"outline",role:"combobox","aria-expanded":Je,className:"w-full justify-between font-normal",disabled:ae||!!Be,children:[ae?o.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(Us,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):Be?o.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):D?.model_identifier?o.jsx("span",{className:"truncate",children:D.model_identifier}):o.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),o.jsx(Lj,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(Ka,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:o.jsxs(Tb,{children:[o.jsx(Eb,{placeholder:"搜索模型..."}),o.jsx(pn,{className:"h-[300px]",children:o.jsxs(_b,{className:"max-h-none overflow-visible",children:[o.jsx(Ab,{children:Be?o.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[o.jsx("p",{className:"text-sm text-destructive",children:Be}),!Be.includes("API Key")&&o.jsx(ue,{variant:"link",size:"sm",onClick:()=>D?.api_provider&&Rt(D.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),o.jsx(up,{heading:"可用模型",children:se.map(ge=>o.jsxs(dp,{value:ge.id,onSelect:()=>{q(Ie=>Ie?{...Ie,model_identifier:ge.id}:null),Oe(!1)},children:[o.jsx(zo,{className:`mr-2 h-4 w-4 ${D?.model_identifier===ge.id?"opacity-100":"opacity-0"}`}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{children:ge.id}),ge.name!==ge.id&&o.jsx("span",{className:"text-xs text-muted-foreground",children:ge.name})]})]},ge.id))}),o.jsx(up,{heading:"手动输入",children:o.jsxs(dp,{value:"__manual_input__",onSelect:()=>{Oe(!1)},children:[o.jsx(Ju,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):o.jsx(Pe,{id:"model_identifier",value:D?.model_identifier||"",onChange:ge=>q(Ie=>Ie?{...Ie,model_identifier:ge.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),Be&&Ve?.modelFetcher&&o.jsxs(ba,{variant:"destructive",className:"mt-2 py-2",children:[o.jsx(Xi,{className:"h-4 w-4"}),o.jsx(wa,{className:"text-xs",children:Be})]}),Ve?.modelFetcher&&o.jsx(Pe,{value:D?.model_identifier||"",onChange:ge=>q(Ie=>Ie?{...Ie,model_identifier:ge.target.value}:null),placeholder:"或手动输入模型标识符",className:"mt-2"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:Be?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':Ve?.modelFetcher?`已识别为 ${Ve.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),o.jsx(Pe,{id:"price_in",type:"number",step:"0.1",min:"0",value:D?.price_in??"",onChange:ge=>{const Ie=ge.target.value===""?null:parseFloat(ge.target.value);q(Et=>Et?{...Et,price_in:Ie}:null)},placeholder:"默认: 0"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),o.jsx(Pe,{id:"price_out",type:"number",step:"0.1",min:"0",value:D?.price_out??"",onChange:ge=>{const Ie=ge.target.value===""?null:parseFloat(ge.target.value);q(Et=>Et?{...Et,price_out:Ie}:null)},placeholder:"默认: 0"})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"force_stream_mode",checked:D?.force_stream_mode||!1,onCheckedChange:ge=>q(Ie=>Ie?{...Ie,force_stream_mode:ge}:null)}),o.jsx(he,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),o.jsxs(fs,{children:[o.jsx(ue,{variant:"outline",onClick:()=>A(!1),"data-tour":"model-cancel-button",children:"取消"}),o.jsx(ue,{onClick:wt,"data-tour":"model-save-button",children:"保存"})]})]})}),o.jsx(Fn,{open:W,onOpenChange:ee,children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:['确定要删除模型 "',I!==null?t[I]?.name:"",'" 吗? 此操作无法撤销。']})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:lt,children:"删除"})]})]})}),o.jsx(Fn,{open:R,onOpenChange:ie,children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认批量删除"}),o.jsxs(zn,{children:["确定要删除选中的 ",K.size," 个模型吗? 此操作无法撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:vn,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&o.jsx(r6,{onRestartComplete:ot,onRestartFailed:dn})]})})}function qa({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:a=!1,dataTour:l}){const c=d=>{s("model_list",d)};return o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2","data-tour":l,children:[o.jsx(he,{children:"模型列表"}),o.jsx(Vve,{options:r.map(d=>({label:d,value:d})),selected:n.model_list||[],onChange:c,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:"温度"}),o.jsx(Pe,{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"})]}),o.jsx(Nf,{value:[n.temperature??.3],onValueChange:d=>s("temperature",d[0]),min:0,max:1,step:.1,className:"w-full"})]}),!a&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{children:"最大 Token"}),o.jsx(Pe,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:d=>s("max_tokens",parseInt(d.target.value))})]})]})]})]})}const Bb="/api/webui/config";async function Gve(){const e=await(await gt(`${Bb}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function wM(t){const n=await(await gt(`${Bb}/adapter-config/path`,{method:"POST",headers:Tt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function SM(t){const n=await(await gt(`${Bb}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function kM(t,e){const r=await(await gt(`${Bb}/adapter-config`,{method:"POST",headers:Tt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const $i={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"}},AS={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:ed},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:Jee}};function Xve(){const[t,e]=b.useState("upload"),[n,r]=b.useState(null),[s,i]=b.useState(""),[a,l]=b.useState(""),[c,d]=b.useState("oneclick"),[h,m]=b.useState(""),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[j,N]=b.useState(!1),[T,E]=b.useState(null),_=b.useRef(null),{toast:A}=Lr(),D=b.useRef(null),q=G=>{if(!G.trim())return{valid:!1,error:"路径不能为空"};if(!G.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const se=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,re=/^(\/|~\/).+\.toml$/i,ae=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,_e=se.test(G),Be=re.test(G),Ye=ae.test(G);return!_e&&!Be&&!Ye?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(G)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}},B=G=>{if(l(G),G.trim()){const se=q(G);m(se.error)}else m("")},H=b.useCallback(async G=>{const se=AS[G];w(!0);try{const re=await SM(se.path),ae=X(re);r(ae),d(G),l(se.path),await wM(se.path),A({title:"加载成功",description:`已从${se.name}预设加载配置`})}catch(re){console.error("加载预设配置失败:",re),A({title:"加载失败",description:re instanceof Error?re.message:"无法读取预设配置文件",variant:"destructive"})}finally{w(!1)}},[A]),W=b.useCallback(async G=>{const se=q(G);if(!se.valid){m(se.error),A({title:"路径无效",description:se.error,variant:"destructive"});return}m(""),w(!0);try{const re=await SM(G),ae=X(re);r(ae),l(G),await wM(G),A({title:"加载成功",description:"已从配置文件加载"})}catch(re){console.error("加载配置失败:",re),A({title:"加载失败",description:re instanceof Error?re.message:"无法读取配置文件",variant:"destructive"})}finally{w(!1)}},[A]);b.useEffect(()=>{(async()=>{try{const se=await Gve();if(se&&se.path){l(se.path);const re=Object.entries(AS).find(([,ae])=>ae.path===se.path);re?(e("preset"),d(re[0]),await H(re[0])):(e("path"),await W(se.path))}}catch(se){console.error("加载保存的路径失败:",se)}})()},[W,H]);const ee=b.useCallback(G=>{t!=="path"&&t!=="preset"||!a||(D.current&&clearTimeout(D.current),D.current=setTimeout(async()=>{x(!0);try{const se=z(G);await kM(a,se),A({title:"自动保存成功",description:"配置已保存到文件"})}catch(se){console.error("自动保存失败:",se),A({title:"自动保存失败",description:se instanceof Error?se.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},1e3))},[t,a,A]),I=async()=>{if(!n||!a)return;const G=q(a);if(!G.valid){A({title:"保存失败",description:G.error,variant:"destructive"});return}x(!0);try{const se=z(n);await kM(a,se),A({title:"保存成功",description:"配置已保存到文件"})}catch(se){console.error("保存失败:",se),A({title:"保存失败",description:se instanceof Error?se.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},V=async()=>{a&&await W(a)},L=G=>{if(G!==t){if(n){E(G),k(!0);return}$(G)}},$=G=>{r(null),i(""),m(""),e(G),G==="preset"&&H("oneclick"),A({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[G]})},K=()=>{T&&($(T),E(null)),k(!1)},Y=()=>{if(n){N(!0);return}R()},R=()=>{l(""),r(null),m(""),A({title:"已清空",description:"路径和配置已清空"})},ie=()=>{R(),N(!1)},X=G=>{const se=JSON.parse(JSON.stringify($i)),re=G.split(` +`);let ae="";for(const _e of re){const Be=_e.trim();if(!Be||Be.startsWith("#"))continue;const Ye=Be.match(/^\[(\w+)\]/);if(Ye){ae=Ye[1];continue}const Je=Be.match(/^(\w+)\s*=\s*(.+)$/);if(Je&&ae){const[,Oe,Ve]=Je;let Ue=Ve.trim();const $e=Ue.match(/^("[^"]*")/);if($e)Ue=$e[1];else{const vt=Ue.indexOf("#");vt!==-1&&(Ue=Ue.substring(0,vt).trim())}let jt;if(Ue==="true")jt=!0;else if(Ue==="false")jt=!1;else if(Ue.startsWith("[")&&Ue.endsWith("]")){const vt=Ue.slice(1,-1).trim();if(vt){const $n=vt.split(",").map(un=>{const Mt=un.trim();return isNaN(Number(Mt))?Mt.replace(/"/g,""):Number(Mt)}),qt=typeof $n[0];jt=$n.every(un=>typeof un===qt)?$n:$n.filter(un=>typeof un=="number")}else jt=[]}else Ue.startsWith('"')&&Ue.endsWith('"')?jt=Ue.slice(1,-1):isNaN(Number(Ue))?jt=Ue.replace(/"/g,""):jt=Number(Ue);if(ae in se){const vt=se[ae];vt[Oe]=jt}}}return se},z=G=>{const se=[],re=(ae,_e)=>ae===""||ae===null||ae===void 0?_e:ae;return se.push("[inner]"),se.push(`version = "${re(G.inner.version,$i.inner.version)}" # 版本号`),se.push("# 请勿修改版本号,除非你知道自己在做什么"),se.push(""),se.push("[nickname] # 现在没用"),se.push(`nickname = "${re(G.nickname.nickname,$i.nickname.nickname)}"`),se.push(""),se.push("[napcat_server] # Napcat连接的ws服务设置"),se.push(`host = "${re(G.napcat_server.host,$i.napcat_server.host)}" # Napcat设定的主机地址`),se.push(`port = ${re(G.napcat_server.port||0,$i.napcat_server.port)} # Napcat设定的端口`),se.push(`token = "${re(G.napcat_server.token,$i.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),se.push(`heartbeat_interval = ${re(G.napcat_server.heartbeat_interval||0,$i.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),se.push(""),se.push("[maibot_server] # 连接麦麦的ws服务设置"),se.push(`host = "${re(G.maibot_server.host,$i.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),se.push(`port = ${re(G.maibot_server.port||0,$i.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),se.push(""),se.push("[chat] # 黑白名单功能"),se.push(`group_list_type = "${re(G.chat.group_list_type,$i.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),se.push(`group_list = [${G.chat.group_list.join(", ")}] # 群组名单`),se.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),se.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),se.push(`private_list_type = "${re(G.chat.private_list_type,$i.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),se.push(`private_list = [${G.chat.private_list.join(", ")}] # 私聊名单`),se.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),se.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),se.push(`ban_user_id = [${G.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),se.push(`ban_qq_bot = ${G.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),se.push(`enable_poke = ${G.chat.enable_poke} # 是否启用戳一戳功能`),se.push(""),se.push("[voice] # 发送语音设置"),se.push(`use_tts = ${G.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),se.push(""),se.push("[debug]"),se.push(`level = "${re(G.debug.level,$i.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),se.join(` +`)},U=G=>{const se=G.target.files?.[0];if(!se)return;const re=new FileReader;re.onload=ae=>{try{const _e=ae.target?.result,Be=X(_e);r(Be),i(se.name),A({title:"上传成功",description:`已加载配置文件:${se.name}`})}catch(_e){console.error("解析配置文件失败:",_e),A({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},re.readAsText(se)},te=()=>{if(!n)return;const G=z(n),se=new Blob([G],{type:"text/plain;charset=utf-8"}),re=URL.createObjectURL(se),ae=document.createElement("a");ae.href=re,ae.download=s||"config.toml",document.body.appendChild(ae),ae.click(),document.body.removeChild(ae),URL.revokeObjectURL(re),A({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},ne=()=>{r(JSON.parse(JSON.stringify($i))),i("config.toml"),A({title:"已加载默认配置",description:"可以开始编辑配置"})};return o.jsx(pn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),o.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[o.jsx(Lo,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),o.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),o.jsxs(Lt,{children:[o.jsxs(En,{children:[o.jsx(_n,{children:"工作模式"}),o.jsx(Wr,{children:"选择配置文件的管理方式"})]}),o.jsxs(Xn,{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[o.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>L("preset"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(ed,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),o.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>L("upload"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(N9,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),o.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>L("path"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(ete,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="preset"&&o.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[o.jsx(he,{className:"text-sm md:text-base",children:"选择部署方式"}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(AS).map(([G,se])=>{const re=se.icon,ae=c===G;return o.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${ae?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{d(G),H(G)},children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h4",{className:"font-semibold text-sm",children:se.name}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:se.description}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:se.path})]})]})},G)})})]}),t==="path"&&o.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs("div",{className:"flex-1 space-y-1",children:[o.jsx(Pe,{id:"config-path",value:a,onChange:G=>B(G.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${h?"border-destructive":""}`}),h&&o.jsx("p",{className:"text-xs text-destructive",children:h})]}),o.jsx(ue,{onClick:()=>W(a),disabled:y||!a||!!h,className:"w-full sm:w-auto",children:y?o.jsxs(o.Fragment,{children:[o.jsx(Qs,{className:"h-4 w-4 animate-spin mr-2"}),o.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sm:hidden",children:"加载配置"}),o.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),o.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[o.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[o.jsx("span",{children:"路径格式说明"}),o.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),o.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),o.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[o.jsx("div",{children:"C:\\Adapter\\config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),o.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[o.jsx("div",{children:"/opt/adapter/config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),o.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),o.jsxs(ba,{children:[o.jsx(Xi,{className:"h-4 w-4"}),o.jsx(wa,{children:t==="preset"?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]}):t==="upload"?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]})})]}),t==="upload"&&!n&&o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[o.jsx("input",{ref:_,type:"file",accept:".toml",className:"hidden",onChange:U}),o.jsxs(ue,{onClick:()=>_.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(N9,{className:"mr-2 h-4 w-4"}),"上传配置"]}),o.jsxs(ue,{onClick:ne,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(Po,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&o.jsx("div",{className:"flex gap-2",children:o.jsxs(ue,{onClick:te,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(td,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(t==="preset"||t==="path")&&n&&o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs(ue,{onClick:I,size:"sm",disabled:g||!!h,className:"w-full sm:w-auto",children:[o.jsx(zp,{className:"mr-2 h-4 w-4"}),g?"保存中...":"立即保存"]}),o.jsxs(ue,{onClick:V,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[o.jsx(Qs,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),t==="path"&&o.jsxs(ue,{onClick:Y,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(Cn,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?o.jsxs(Yi,{defaultValue:"napcat",className:"w-full",children:[o.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:o.jsxs(ji,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[o.jsxs(Bt,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),o.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),o.jsxs(Bt,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),o.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),o.jsxs(Bt,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),o.jsx("span",{className:"sm:hidden",children:"聊天"})]}),o.jsxs(Bt,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),o.jsx("span",{className:"sm:hidden",children:"语音"})]}),o.jsx(Bt,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),o.jsx(ln,{value:"napcat",className:"space-y-4",children:o.jsx(Yve,{config:n,onChange:G=>{r(G),ee(G)}})}),o.jsx(ln,{value:"maibot",className:"space-y-4",children:o.jsx(Kve,{config:n,onChange:G=>{r(G),ee(G)}})}),o.jsx(ln,{value:"chat",className:"space-y-4",children:o.jsx(Zve,{config:n,onChange:G=>{r(G),ee(G)}})}),o.jsx(ln,{value:"voice",className:"space-y-4",children:o.jsx(Jve,{config:n,onChange:G=>{r(G),ee(G)}})}),o.jsx(ln,{value:"debug",className:"space-y-4",children:o.jsx(eye,{config:n,onChange:G=>{r(G),ee(G)}})})]}):o.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:o.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[o.jsx(Po,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="preset"?"请选择预设的部署方式":t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),o.jsx(Fn,{open:S,onOpenChange:k,children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认切换模式"}),o.jsxs(zn,{children:["切换模式将清空当前配置,确定要继续吗?",o.jsx("br",{}),o.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{onClick:()=>{k(!1),E(null)},children:"取消"}),o.jsx(In,{onClick:K,children:"确认切换"})]})]})}),o.jsx(Fn,{open:j,onOpenChange:N,children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认清空路径"}),o.jsxs(zn,{children:["清空路径将清除当前配置,确定要继续吗?",o.jsx("br",{}),o.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{onClick:()=>N(!1),children:"取消"}),o.jsx(In,{onClick:ie,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Yve({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),o.jsxs("div",{className:"grid gap-3 md:gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),o.jsx(Pe,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),o.jsx(Pe,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),o.jsx(Pe,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),o.jsx(Pe,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Kve({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),o.jsxs("div",{className:"grid gap-3 md:gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),o.jsx(Pe,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),o.jsx(Pe,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function Zve({config:t,onChange:e}){const n=i=>{const a={...t};i==="group"?a.chat.group_list=[...a.chat.group_list,0]:i==="private"?a.chat.private_list=[...a.chat.private_list,0]:a.chat.ban_user_id=[...a.chat.ban_user_id,0],e(a)},r=(i,a)=>{const l={...t};i==="group"?l.chat.group_list=l.chat.group_list.filter((c,d)=>d!==a):i==="private"?l.chat.private_list=l.chat.private_list.filter((c,d)=>d!==a):l.chat.ban_user_id=l.chat.ban_user_id.filter((c,d)=>d!==a),e(l)},s=(i,a,l)=>{const c={...t};i==="group"?c.chat.group_list[a]=l:i==="private"?c.chat.private_list[a]=l:c.chat.ban_user_id[a]=l,e(c)};return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),o.jsxs("div",{className:"grid gap-4 md:gap-6",children:[o.jsxs("div",{className:"space-y-3 md:space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-sm md:text-base",children:"群组名单类型"}),o.jsxs(Vt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),o.jsx(De,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsx(he,{className:"text-sm md:text-base",children:"群组列表"}),o.jsxs(ue,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(Po,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{type:"number",value:i,onChange:l=>s("group",a,parseInt(l.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{size:"icon",variant:"outline",children:o.jsx(Cn,{className:"h-4 w-4"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>r("group",a),children:"删除"})]})]})]})]},a)),t.chat.group_list.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),o.jsxs("div",{className:"space-y-3 md:space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-sm md:text-base",children:"私聊名单类型"}),o.jsxs(Vt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),o.jsx(De,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsx(he,{className:"text-sm md:text-base",children:"私聊列表"}),o.jsxs(ue,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(Po,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{type:"number",value:i,onChange:l=>s("private",a,parseInt(l.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{size:"icon",variant:"outline",children:o.jsx(Cn,{className:"h-4 w-4"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>r("private",a),children:"删除"})]})]})]})]},a)),t.chat.private_list.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"全局禁止名单"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),o.jsxs(ue,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(Po,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{type:"number",value:i,onChange:l=>s("ban",a,parseInt(l.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),o.jsxs(Fn,{children:[o.jsx(is,{asChild:!0,children:o.jsx(ue,{size:"icon",variant:"outline",children:o.jsx(Cn,{className:"h-4 w-4"})})}),o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>r("ban",a),children:"删除"})]})]})]})]},a)),t.chat.ban_user_id.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),o.jsx(Ft,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),o.jsx(Ft,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Jve({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),o.jsx(Ft,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function eye({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),o.jsx("div",{className:"grid gap-3 md:gap-4",children:o.jsxs("div",{className:"grid gap-2",children:[o.jsx(he,{className:"text-sm md:text-base",children:"日志等级"}),o.jsxs(Vt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"DEBUG",children:"DEBUG(调试)"}),o.jsx(De,{value:"INFO",children:"INFO(信息)"}),o.jsx(De,{value:"WARNING",children:"WARNING(警告)"}),o.jsx(De,{value:"ERROR",children:"ERROR(错误)"}),o.jsx(De,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function OM(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&e.push(a),s=r+1,r=n.indexOf(",",s)}return e}function tye(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const nye=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rye=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sye={};function jM(t,e){return(sye.jsx?rye:nye).test(t)}const iye=/[ \t\n\f\r]/g;function aye(t){return typeof t=="object"?t.type==="text"?NM(t.value):!1:NM(t)}function NM(t){return t.replace(iye,"")===""}class pg{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}pg.prototype.normal={};pg.prototype.property={};pg.prototype.space=void 0;function VQ(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new pg(n,r,e)}function vp(t){return t.toLowerCase()}class Ai{constructor(e,n){this.attribute=n,this.property=e}}Ai.prototype.attribute="";Ai.prototype.booleanish=!1;Ai.prototype.boolean=!1;Ai.prototype.commaOrSpaceSeparated=!1;Ai.prototype.commaSeparated=!1;Ai.prototype.defined=!1;Ai.prototype.mustUseProperty=!1;Ai.prototype.number=!1;Ai.prototype.overloadedBoolean=!1;Ai.prototype.property="";Ai.prototype.spaceSeparated=!1;Ai.prototype.space=void 0;let oye=0;const en=kd(),ns=kd(),AO=kd(),Qe=kd(),mr=kd(),$h=kd(),Hi=kd();function kd(){return 2**++oye}const MO=Object.freeze(Object.defineProperty({__proto__:null,boolean:en,booleanish:ns,commaOrSpaceSeparated:Hi,commaSeparated:$h,number:Qe,overloadedBoolean:AO,spaceSeparated:mr},Symbol.toStringTag,{value:"Module"})),MS=Object.keys(MO);class hN extends Ai{constructor(e,n,r,s){let i=-1;if(super(e,n),CM(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&hye.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(TM,mye);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!TM.test(i)){let a=i.replace(dye,fye);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=hN}return new s(r,e)}function fye(t){return"-"+t.toLowerCase()}function mye(t){return t.charAt(1).toUpperCase()}const JQ=VQ([UQ,lye,XQ,YQ,KQ],"html"),Fb=VQ([UQ,cye,XQ,YQ,KQ],"svg");function EM(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function pye(t){return t.join(" ").trim()}var ch={},RS,_M;function gye(){if(_M)return RS;_M=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,c=` +`,d="/",h="*",m="",g="comment",x="declaration";function y(S,k){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];k=k||{};var j=1,N=1;function T(I){var V=I.match(e);V&&(j+=V.length);var L=I.lastIndexOf(c);N=~L?I.length-L:N+I.length}function E(){var I={line:j,column:N};return function(V){return V.position=new _(I),q(),V}}function _(I){this.start=I,this.end={line:j,column:N},this.source=k.source}_.prototype.content=S;function A(I){var V=new Error(k.source+":"+j+":"+N+": "+I);if(V.reason=I,V.filename=k.source,V.line=j,V.column=N,V.source=S,!k.silent)throw V}function D(I){var V=I.exec(S);if(V){var L=V[0];return T(L),S=S.slice(L.length),V}}function q(){D(n)}function B(I){var V;for(I=I||[];V=H();)V!==!1&&I.push(V);return I}function H(){var I=E();if(!(d!=S.charAt(0)||h!=S.charAt(1))){for(var V=2;m!=S.charAt(V)&&(h!=S.charAt(V)||d!=S.charAt(V+1));)++V;if(V+=2,m===S.charAt(V-1))return A("End of comment missing");var L=S.slice(2,V-2);return N+=2,T(L),S=S.slice(V),N+=2,I({type:g,comment:L})}}function W(){var I=E(),V=D(r);if(V){if(H(),!D(s))return A("property missing ':'");var L=D(i),$=I({type:x,property:w(V[0].replace(t,m)),value:L?w(L[0].replace(t,m)):m});return D(a),$}}function ee(){var I=[];B(I);for(var V;V=W();)V!==!1&&(I.push(V),B(I));return I}return q(),ee()}function w(S){return S?S.replace(l,m):m}return RS=y,RS}var AM;function xye(){if(AM)return ch;AM=1;var t=ch&&ch.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ch,"__esModule",{value:!0}),ch.default=n;const e=t(gye());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,e.default)(r),l=typeof s=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:d,value:h}=c;l?s(d,h,c):h&&(i=i||{},i[d]=h)}),i}return ch}var Km={},MM;function vye(){if(MM)return Km;MM=1,Object.defineProperty(Km,"__esModule",{value:!0}),Km.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(d){return!d||n.test(d)||t.test(d)},a=function(d,h){return h.toUpperCase()},l=function(d,h){return"".concat(h,"-")},c=function(d,h){return h===void 0&&(h={}),i(d)?d:(d=d.toLowerCase(),h.reactCompat?d=d.replace(s,l):d=d.replace(r,l),d.replace(e,a))};return Km.camelCase=c,Km}var Zm,RM;function yye(){if(RM)return Zm;RM=1;var t=Zm&&Zm.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(xye()),n=vye();function r(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(l,c){l&&c&&(a[(0,n.camelCase)(l,i)]=c)}),a}return r.default=r,Zm=r,Zm}var bye=yye();const wye=yd(bye),eV=tV("end"),fN=tV("start");function tV(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 Sye(t){const e=fN(t),n=eV(t);if(e&&n)return{start:e,end:n}}function R0(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?DM(t.position):"start"in t||"end"in t?DM(t):"line"in t||"column"in t?RO(t):""}function RO(t){return PM(t&&t.line)+":"+PM(t&&t.column)}function DM(t){return RO(t&&t.start)+"-"+RO(t&&t.end)}function PM(t){return t&&typeof t=="number"?t:1}class Gs extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(a=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=R0(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Gs.prototype.file="";Gs.prototype.name="";Gs.prototype.reason="";Gs.prototype.message="";Gs.prototype.stack="";Gs.prototype.column=void 0;Gs.prototype.line=void 0;Gs.prototype.ancestors=void 0;Gs.prototype.cause=void 0;Gs.prototype.fatal=void 0;Gs.prototype.place=void 0;Gs.prototype.ruleId=void 0;Gs.prototype.source=void 0;const mN={}.hasOwnProperty,kye=new Map,Oye=/[A-Z]/g,jye=new Set(["table","tbody","thead","tfoot","tr"]),Nye=new Set(["td","th"]),nV="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Cye(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=Pye(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=Dye(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"?Fb:JQ,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=rV(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function rV(t,e,n){if(e.type==="element")return Tye(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return Eye(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Aye(t,e,n);if(e.type==="mdxjsEsm")return _ye(t,e);if(e.type==="root")return Mye(t,e,n);if(e.type==="text")return Rye(t,e)}function Tye(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Fb,t.schema=s),t.ancestors.push(e);const i=iV(t,e.tagName,!1),a=zye(t,e);let l=gN(t,e);return jye.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!aye(c):!0})),sV(t,a,i,e),pN(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function Eye(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)}yp(t,e.position)}function _ye(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);yp(t,e.position)}function Aye(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Fb,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:iV(t,e.name,!0),a=Iye(t,e),l=gN(t,e);return sV(t,a,i,e),pN(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function Mye(t,e,n){const r={};return pN(r,gN(t,e)),t.create(e,t.Fragment,r,n)}function Rye(t,e){return e.value}function sV(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function pN(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Dye(t,e,n){return r;function r(s,i,a,l){const d=Array.isArray(a.children)?n:e;return l?d(i,a,l):d(i,a)}}function Pye(t,e){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=fN(r);return e(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function zye(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&mN.call(e.properties,s)){const i=Lye(t,s,e.properties[s]);if(i){const[a,l]=i;t.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Nye.has(e.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Iye(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else yp(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const l=r.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else yp(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function gN(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:kye;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);i0?(Ki(t,t.length,0,e),t):e}const LM={}.hasOwnProperty;function oV(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 Xa(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ei=fu(/[A-Za-z]/),Vs=fu(/[\dA-Za-z]/),Wye=fu(/[#-'*+\--9=?A-Z^-~]/);function ky(t){return t!==null&&(t<32||t===127)}const DO=fu(/\d/),Gye=fu(/[\dA-Fa-f]/),Xye=fu(/[!-/:-@[-`{-~]/);function St(t){return t!==null&&t<-2}function dr(t){return t!==null&&(t<0||t===32)}function gn(t){return t===-2||t===-1||t===32}const qb=fu(new RegExp("\\p{P}|\\p{S}","u")),gd=fu(/\s/);function fu(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function qf(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const l=t.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),s=1):a="�"}else a=String.fromCharCode(i);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function cn(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return gn(c)?(t.enter(n),l(c)):e(c)}function l(c){return gn(c)&&i++a))return;const A=e.events.length;let D=A,q,B;for(;D--;)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){if(q){B=e.events[D][1].end;break}q=!0}for(k(r),_=A;_N;){const E=n[T];e.containerState=E[1],E[0].exit.call(e,t)}n.length=N}function j(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function ebe(t,e,n){return cn(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function hf(t){if(t===null||dr(t)||gd(t))return 1;if(qb(t))return 2}function $b(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};FM(m,-c),FM(g,c),a={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},i={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},t[r][1].end={...a.start},t[n][1].start={...l.end},d=[],t[r][1].end.offset-t[r][1].start.offset&&(d=xa(d,[["enter",t[r][1],e],["exit",t[r][1],e]])),d=xa(d,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),d=xa(d,$b(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),d=xa(d,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,d=xa(d,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,Ki(t,r-1,n-r+3,d),n=r+d.length-h-2;break}}for(n=-1;++n0&&gn(_)?cn(t,j,"linePrefix",i+1)(_):j(_)}function j(_){return _===null||St(_)?t.check(qM,w,T)(_):(t.enter("codeFlowValue"),N(_))}function N(_){return _===null||St(_)?(t.exit("codeFlowValue"),j(_)):(t.consume(_),N)}function T(_){return t.exit("codeFenced"),e(_)}function E(_,A,D){let q=0;return B;function B(V){return _.enter("lineEnding"),_.consume(V),_.exit("lineEnding"),H}function H(V){return _.enter("codeFencedFence"),gn(V)?cn(_,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):W(V)}function W(V){return V===l?(_.enter("codeFencedFenceSequence"),ee(V)):D(V)}function ee(V){return V===l?(q++,_.consume(V),ee):q>=a?(_.exit("codeFencedFenceSequence"),gn(V)?cn(_,I,"whitespace")(V):I(V)):D(V)}function I(V){return V===null||St(V)?(_.exit("codeFencedFence"),A(V)):D(V)}}}function hbe(t,e,n){const r=this;return s;function s(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const PS={name:"codeIndented",tokenize:mbe},fbe={partial:!0,tokenize:pbe};function mbe(t,e,n){const r=this;return s;function s(d){return t.enter("codeIndented"),cn(t,i,"linePrefix",5)(d)}function i(d){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?c(d):St(d)?t.attempt(fbe,a,c)(d):(t.enter("codeFlowValue"),l(d))}function l(d){return d===null||St(d)?(t.exit("codeFlowValue"),a(d)):(t.consume(d),l)}function c(d){return t.exit("codeIndented"),e(d)}}function pbe(t,e,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):St(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):cn(t,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):St(a)?s(a):n(a)}}const gbe={name:"codeText",previous:vbe,resolve:xbe,tokenize:ybe};function xbe(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&&Jm(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),Jm(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Jm(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function fV(t,e,n,r,s,i,a,l,c){const d=c||Number.POSITIVE_INFINITY;let h=0;return m;function m(k){return k===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(k),t.exit(i),g):k===null||k===32||k===41||ky(k)?n(k):(t.enter(r),t.enter(a),t.enter(l),t.enter("chunkString",{contentType:"string"}),w(k))}function g(k){return k===62?(t.enter(i),t.consume(k),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===62?(t.exit("chunkString"),t.exit(l),g(k)):k===null||k===60||St(k)?n(k):(t.consume(k),k===92?y:x)}function y(k){return k===60||k===62||k===92?(t.consume(k),x):x(k)}function w(k){return!h&&(k===null||k===41||dr(k))?(t.exit("chunkString"),t.exit(l),t.exit(a),t.exit(r),e(k)):h999||x===null||x===91||x===93&&!c||x===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(x):x===93?(t.exit(i),t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):St(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||x===91||x===93||St(x)||l++>999?(t.exit("chunkString"),h(x)):(t.consume(x),c||(c=!gn(x)),x===92?g:m)}function g(x){return x===91||x===92||x===93?(t.consume(x),l++,m):m(x)}}function pV(t,e,n,r,s,i){let a;return l;function l(g){return g===34||g===39||g===40?(t.enter(r),t.enter(s),t.consume(g),t.exit(s),a=g===40?41:g,c):n(g)}function c(g){return g===a?(t.enter(s),t.consume(g),t.exit(s),t.exit(r),e):(t.enter(i),d(g))}function d(g){return g===a?(t.exit(i),c(a)):g===null?n(g):St(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),cn(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===a||g===null||St(g)?(t.exit("chunkString"),d(g)):(t.consume(g),g===92?m:h)}function m(g){return g===a||g===92?(t.consume(g),h):h(g)}}function D0(t,e){let n;return r;function r(s){return St(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):gn(s)?cn(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const Cbe={name:"definition",tokenize:Ebe},Tbe={partial:!0,tokenize:_be};function Ebe(t,e,n){const r=this;let s;return i;function i(x){return t.enter("definition"),a(x)}function a(x){return mV.call(r,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function l(x){return s=Xa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),c):n(x)}function c(x){return dr(x)?D0(t,d)(x):d(x)}function d(x){return fV(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function h(x){return t.attempt(Tbe,m,m)(x)}function m(x){return gn(x)?cn(t,g,"whitespace")(x):g(x)}function g(x){return x===null||St(x)?(t.exit("definition"),r.parser.defined.push(s),e(x)):n(x)}}function _be(t,e,n){return r;function r(l){return dr(l)?D0(t,s)(l):n(l)}function s(l){return pV(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return gn(l)?cn(t,a,"whitespace")(l):a(l)}function a(l){return l===null||St(l)?e(l):n(l)}}const Abe={name:"hardBreakEscape",tokenize:Mbe};function Mbe(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return St(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Rbe={name:"headingAtx",resolve:Dbe,tokenize:Pbe};function Dbe(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"},Ki(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Pbe(t,e,n){let r=0;return s;function s(h){return t.enter("atxHeading"),i(h)}function i(h){return t.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&r++<6?(t.consume(h),a):h===null||dr(h)?(t.exit("atxHeadingSequence"),l(h)):n(h)}function l(h){return h===35?(t.enter("atxHeadingSequence"),c(h)):h===null||St(h)?(t.exit("atxHeading"),e(h)):gn(h)?cn(t,l,"whitespace")(h):(t.enter("atxHeadingText"),d(h))}function c(h){return h===35?(t.consume(h),c):(t.exit("atxHeadingSequence"),l(h))}function d(h){return h===null||h===35||dr(h)?(t.exit("atxHeadingText"),l(h)):(t.consume(h),d)}}const zbe=["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"],HM=["pre","script","style","textarea"],Ibe={concrete:!0,name:"htmlFlow",resolveTo:Fbe,tokenize:qbe},Lbe={partial:!0,tokenize:Hbe},Bbe={partial:!0,tokenize:$be};function Fbe(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 qbe(t,e,n){const r=this;let s,i,a,l,c;return d;function d(z){return h(z)}function h(z){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(z),m}function m(z){return z===33?(t.consume(z),g):z===47?(t.consume(z),i=!0,w):z===63?(t.consume(z),s=3,r.interrupt?e:R):ei(z)?(t.consume(z),a=String.fromCharCode(z),S):n(z)}function g(z){return z===45?(t.consume(z),s=2,x):z===91?(t.consume(z),s=5,l=0,y):ei(z)?(t.consume(z),s=4,r.interrupt?e:R):n(z)}function x(z){return z===45?(t.consume(z),r.interrupt?e:R):n(z)}function y(z){const U="CDATA[";return z===U.charCodeAt(l++)?(t.consume(z),l===U.length?r.interrupt?e:W:y):n(z)}function w(z){return ei(z)?(t.consume(z),a=String.fromCharCode(z),S):n(z)}function S(z){if(z===null||z===47||z===62||dr(z)){const U=z===47,te=a.toLowerCase();return!U&&!i&&HM.includes(te)?(s=1,r.interrupt?e(z):W(z)):zbe.includes(a.toLowerCase())?(s=6,U?(t.consume(z),k):r.interrupt?e(z):W(z)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(z):i?j(z):N(z))}return z===45||Vs(z)?(t.consume(z),a+=String.fromCharCode(z),S):n(z)}function k(z){return z===62?(t.consume(z),r.interrupt?e:W):n(z)}function j(z){return gn(z)?(t.consume(z),j):B(z)}function N(z){return z===47?(t.consume(z),B):z===58||z===95||ei(z)?(t.consume(z),T):gn(z)?(t.consume(z),N):B(z)}function T(z){return z===45||z===46||z===58||z===95||Vs(z)?(t.consume(z),T):E(z)}function E(z){return z===61?(t.consume(z),_):gn(z)?(t.consume(z),E):N(z)}function _(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(t.consume(z),c=z,A):gn(z)?(t.consume(z),_):D(z)}function A(z){return z===c?(t.consume(z),c=null,q):z===null||St(z)?n(z):(t.consume(z),A)}function D(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||dr(z)?E(z):(t.consume(z),D)}function q(z){return z===47||z===62||gn(z)?N(z):n(z)}function B(z){return z===62?(t.consume(z),H):n(z)}function H(z){return z===null||St(z)?W(z):gn(z)?(t.consume(z),H):n(z)}function W(z){return z===45&&s===2?(t.consume(z),L):z===60&&s===1?(t.consume(z),$):z===62&&s===4?(t.consume(z),ie):z===63&&s===3?(t.consume(z),R):z===93&&s===5?(t.consume(z),Y):St(z)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Lbe,X,ee)(z)):z===null||St(z)?(t.exit("htmlFlowData"),ee(z)):(t.consume(z),W)}function ee(z){return t.check(Bbe,I,X)(z)}function I(z){return t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),V}function V(z){return z===null||St(z)?ee(z):(t.enter("htmlFlowData"),W(z))}function L(z){return z===45?(t.consume(z),R):W(z)}function $(z){return z===47?(t.consume(z),a="",K):W(z)}function K(z){if(z===62){const U=a.toLowerCase();return HM.includes(U)?(t.consume(z),ie):W(z)}return ei(z)&&a.length<8?(t.consume(z),a+=String.fromCharCode(z),K):W(z)}function Y(z){return z===93?(t.consume(z),R):W(z)}function R(z){return z===62?(t.consume(z),ie):z===45&&s===2?(t.consume(z),R):W(z)}function ie(z){return z===null||St(z)?(t.exit("htmlFlowData"),X(z)):(t.consume(z),ie)}function X(z){return t.exit("htmlFlow"),e(z)}}function $be(t,e,n){const r=this;return s;function s(a){return St(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function Hbe(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(gg,e,n)}}const Qbe={name:"htmlText",tokenize:Vbe};function Vbe(t,e,n){const r=this;let s,i,a;return l;function l(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),c}function c(R){return R===33?(t.consume(R),d):R===47?(t.consume(R),E):R===63?(t.consume(R),N):ei(R)?(t.consume(R),D):n(R)}function d(R){return R===45?(t.consume(R),h):R===91?(t.consume(R),i=0,y):ei(R)?(t.consume(R),j):n(R)}function h(R){return R===45?(t.consume(R),x):n(R)}function m(R){return R===null?n(R):R===45?(t.consume(R),g):St(R)?(a=m,$(R)):(t.consume(R),m)}function g(R){return R===45?(t.consume(R),x):m(R)}function x(R){return R===62?L(R):R===45?g(R):m(R)}function y(R){const ie="CDATA[";return R===ie.charCodeAt(i++)?(t.consume(R),i===ie.length?w:y):n(R)}function w(R){return R===null?n(R):R===93?(t.consume(R),S):St(R)?(a=w,$(R)):(t.consume(R),w)}function S(R){return R===93?(t.consume(R),k):w(R)}function k(R){return R===62?L(R):R===93?(t.consume(R),k):w(R)}function j(R){return R===null||R===62?L(R):St(R)?(a=j,$(R)):(t.consume(R),j)}function N(R){return R===null?n(R):R===63?(t.consume(R),T):St(R)?(a=N,$(R)):(t.consume(R),N)}function T(R){return R===62?L(R):N(R)}function E(R){return ei(R)?(t.consume(R),_):n(R)}function _(R){return R===45||Vs(R)?(t.consume(R),_):A(R)}function A(R){return St(R)?(a=A,$(R)):gn(R)?(t.consume(R),A):L(R)}function D(R){return R===45||Vs(R)?(t.consume(R),D):R===47||R===62||dr(R)?q(R):n(R)}function q(R){return R===47?(t.consume(R),L):R===58||R===95||ei(R)?(t.consume(R),B):St(R)?(a=q,$(R)):gn(R)?(t.consume(R),q):L(R)}function B(R){return R===45||R===46||R===58||R===95||Vs(R)?(t.consume(R),B):H(R)}function H(R){return R===61?(t.consume(R),W):St(R)?(a=H,$(R)):gn(R)?(t.consume(R),H):q(R)}function W(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,ee):St(R)?(a=W,$(R)):gn(R)?(t.consume(R),W):(t.consume(R),I)}function ee(R){return R===s?(t.consume(R),s=void 0,V):R===null?n(R):St(R)?(a=ee,$(R)):(t.consume(R),ee)}function I(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||dr(R)?q(R):(t.consume(R),I)}function V(R){return R===47||R===62||dr(R)?q(R):n(R)}function L(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function $(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),K}function K(R){return gn(R)?cn(t,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):Y(R)}function Y(R){return t.enter("htmlTextData"),a(R)}}const yN={name:"labelEnd",resolveAll:Xbe,resolveTo:Ybe,tokenize:Kbe},Ube={tokenize:Zbe},Wbe={tokenize:Jbe},Gbe={tokenize:ewe};function Xbe(t){let e=-1;const n=[];for(;++e=3&&(d===null||St(d))?(t.exit("thematicBreak"),e(d)):n(d)}function c(d){return d===s?(t.consume(d),r++,c):(t.exit("thematicBreakSequence"),gn(d)?cn(t,l,"whitespace")(d):l(d))}}const pi={continuation:{tokenize:uwe},exit:hwe,name:"list",tokenize:cwe},owe={partial:!0,tokenize:fwe},lwe={partial:!0,tokenize:dwe};function cwe(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(x){const y=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:DO(x)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(Cv,n,d)(x):d(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(x)}return n(x)}function c(x){return DO(x)&&++a<10?(t.consume(x),c):(!r.interrupt||a<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),d(x)):n(x)}function d(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,t.check(gg,r.interrupt?n:h,t.attempt(owe,g,m))}function h(x){return r.containerState.initialBlankLine=!0,i++,g(x)}function m(x){return gn(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),g):n(x)}function g(x){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(x)}}function uwe(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(gg,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,cn(t,e,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!gn(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(lwe,e,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,cn(t,t.attempt(pi,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function dwe(t,e,n){const r=this;return cn(t,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(i):n(i)}}function hwe(t){t.exit(this.containerState.type)}function fwe(t,e,n){const r=this;return cn(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!gn(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const QM={name:"setextUnderline",resolveTo:mwe,tokenize:pwe};function mwe(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",a,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function pwe(t,e,n){const r=this;let s;return i;function i(d){let h=r.events.length,m;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){m=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),s=d,a(d)):n(d)}function a(d){return t.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(t.consume(d),l):(t.exit("setextHeadingLineSequence"),gn(d)?cn(t,c,"lineSuffix")(d):c(d))}function c(d){return d===null||St(d)?(t.exit("setextHeadingLine"),e(d)):n(d)}}const gwe={tokenize:xwe};function xwe(t){const e=this,n=t.attempt(gg,r,t.attempt(this.parser.constructs.flowInitial,s,cn(t,t.attempt(this.parser.constructs.flow,s,t.attempt(Sbe,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 vwe={resolveAll:xV()},ywe=gV("string"),bwe=gV("text");function gV(t){return{resolveAll:xV(t==="text"?wwe:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,a,l);return a;function a(h){return d(h)?i(h):l(h)}function l(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),c}function c(h){return d(h)?(n.exit("data"),i(h)):(n.consume(h),c)}function d(h){if(h===null)return!0;const m=s[h];let g=-1;if(m)for(;++g-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function Dwe(t,e){let n=-1;const r=[];let s;for(;++n0){const Mt=st.tokenStack[st.tokenStack.length-1];(Mt[1]||FM).call(st,void 0,Mt[0])}for(Ie.position={start:Nc(Ne.length>0?Ne[0][1].start:{line:1,column:1,offset:0}),end:Nc(Ne.length>0?Ne[Ne.length-2][1].end:{line:1,column:1,offset:0})},Pt=-1;++Pt1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,d),t.applyData(e,d)}function Wwe(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 Gwe(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function gV(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function Xwe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return gV(t,e);const s={src:Ff(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 Ywe(t,e){const n={src:Ff(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 Kwe(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 Zwe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return gV(t,e);const s={href:Ff(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 Jwe(t,e){const n={href:Ff(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 e2e(t,e,n){const r=t.all(e),s=n?t2e(n):xV(e),i={},a=[];if(typeof e.checked=="boolean"){const h=r[0];let m;h&&h.type==="element"&&h.tagName==="p"?m=h:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l0){const Rt=rt.tokenStack[rt.tokenStack.length-1];(Rt[1]||UM).call(rt,void 0,Rt[0])}for(ze.position={start:Ec(Ne.length>0?Ne[0][1].start:{line:1,column:1,offset:0}),end:Ec(Ne.length>0?Ne[Ne.length-2][1].end:{line:1,column:1,offset:0})},zt=-1;++zt1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,d),t.applyData(e,d)}function Kwe(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 Zwe(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function bV(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function Jwe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return bV(t,e);const s={src:qf(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 e2e(t,e){const n={src:qf(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 t2e(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 n2e(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return bV(t,e);const s={href:qf(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 r2e(t,e){const n={href:qf(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 s2e(t,e,n){const r=t.all(e),s=n?i2e(n):wV(e),i={},a=[];if(typeof e.checked=="boolean"){const h=r[0];let m;h&&h.type==="element"&&h.tagName==="p"?m=h:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l1}function n2e(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=oN(e.children[1]),c=YQ(e.children[e.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function o2e(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:e.children.length;let c=-1;const d=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(HM(e.slice(s),s>0,!1)),i.join("")}function HM(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===qM||i===$M;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===qM||i===$M;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function u2e(t,e){const n={type:"text",value:c2e(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function d2e(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const h2e={blockquote:qwe,break:$we,code:Hwe,delete:Qwe,emphasis:Vwe,footnoteReference:Uwe,heading:Wwe,html:Gwe,imageReference:Xwe,image:Ywe,inlineCode:Kwe,linkReference:Zwe,link:Jwe,listItem:e2e,list:n2e,paragraph:r2e,root:s2e,strong:i2e,table:a2e,tableCell:l2e,tableRow:o2e,text:u2e,thematicBreak:d2e,toml:C1,yaml:C1,definition:C1,footnoteDefinition:C1};function C1(){}const vV=-1,Bb=0,M0=1,yy=2,mN=3,pN=4,gN=5,xN=6,yV=7,bV=8,QM=typeof self=="object"?self:globalThis,f2e=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,a]=e[s];switch(i){case Bb:case vV:return n(a,s);case M0:{const l=n([],s);for(const c of a)l.push(r(c));return l}case yy:{const l=n({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case mN:return n(new Date(a),s);case pN:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case gN:{const l=n(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case xN:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case yV:{const{name:l,message:c}=a;return n(new QM[l](c),s)}case bV:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new QM[i](a),s)};return r},VM=t=>f2e(new Map,t)(0),lh="",{toString:m2e}={},{keys:p2e}=Object,Jm=t=>{const e=typeof t;if(e!=="object"||!t)return[Bb,e];const n=m2e.call(t).slice(8,-1);switch(n){case"Array":return[M0,lh];case"Object":return[yy,lh];case"Date":return[mN,lh];case"RegExp":return[pN,lh];case"Map":return[gN,lh];case"Set":return[xN,lh];case"DataView":return[M0,n]}return n.includes("Array")?[M0,n]:n.includes("Error")?[yV,n]:[yy,n]},T1=([t,e])=>t===Bb&&(e==="function"||e==="symbol"),g2e=(t,e,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=Jm(a);switch(l){case Bb:{let h=a;switch(c){case"bigint":l=bV,h=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);h=null;break;case"undefined":return s([vV],a)}return s([l,h],a)}case M0:{if(c){let g=a;return c==="DataView"?g=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(g=new Uint8Array(a)),s([c,[...g]],a)}const h=[],m=s([l,h],a);for(const g of a)h.push(i(g));return m}case yy:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(e&&"toJSON"in a)return i(a.toJSON());const h=[],m=s([l,h],a);for(const g of p2e(a))(t||!T1(Jm(a[g])))&&h.push([i(g),i(a[g])]);return m}case mN:return s([l,a.toISOString()],a);case pN:{const{source:h,flags:m}=a;return s([l,{source:h,flags:m}],a)}case gN:{const h=[],m=s([l,h],a);for(const[g,x]of a)(t||!(T1(Jm(g))||T1(Jm(x))))&&h.push([i(g),i(x)]);return m}case xN:{const h=[],m=s([l,h],a);for(const g of a)(t||!T1(Jm(g)))&&h.push(i(g));return m}}const{message:d}=a;return s([l,{name:c,message:d}],a)};return i},UM=(t,{json:e,lossy:n}={})=>{const r=[];return g2e(!(e||n),!!e,new Map,r)(t),r},by=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?VM(UM(t,e)):structuredClone(t):(t,e)=>VM(UM(t,e));function x2e(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function v2e(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function y2e(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||x2e,r=t.options.footnoteBackLabel||v2e,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&y.push({type:"text",value:" "});let j=typeof n=="string"?n:n(c,x);typeof j=="string"&&(j={type:"text",value:j}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,x),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const S=h[h.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const j=S.children[S.children.length-1];j&&j.type==="text"?j.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...y)}else h.push(...y);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(h,!0)};t.patch(d,k),l.push(k)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...by(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`});const d={type:"element",tagName:"li",properties:i,children:a};return t.patch(e,d),t.applyData(e,d)}function i2e(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r1}function a2e(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=fN(e.children[1]),c=eV(e.children[e.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function d2e(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:e.children.length;let c=-1;const d=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(XM(e.slice(s),s>0,!1)),i.join("")}function XM(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===WM||i===GM;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===WM||i===GM;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function m2e(t,e){const n={type:"text",value:f2e(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function p2e(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const g2e={blockquote:Vwe,break:Uwe,code:Wwe,delete:Gwe,emphasis:Xwe,footnoteReference:Ywe,heading:Kwe,html:Zwe,imageReference:Jwe,image:e2e,inlineCode:t2e,linkReference:n2e,link:r2e,listItem:s2e,list:a2e,paragraph:o2e,root:l2e,strong:c2e,table:u2e,tableCell:h2e,tableRow:d2e,text:m2e,thematicBreak:p2e,toml:M1,yaml:M1,definition:M1,footnoteDefinition:M1};function M1(){}const SV=-1,Hb=0,P0=1,Oy=2,bN=3,wN=4,SN=5,kN=6,kV=7,OV=8,YM=typeof self=="object"?self:globalThis,x2e=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,a]=e[s];switch(i){case Hb:case SV:return n(a,s);case P0:{const l=n([],s);for(const c of a)l.push(r(c));return l}case Oy:{const l=n({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case bN:return n(new Date(a),s);case wN:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case SN:{const l=n(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case kN:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case kV:{const{name:l,message:c}=a;return n(new YM[l](c),s)}case OV:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new YM[i](a),s)};return r},KM=t=>x2e(new Map,t)(0),uh="",{toString:v2e}={},{keys:y2e}=Object,e0=t=>{const e=typeof t;if(e!=="object"||!t)return[Hb,e];const n=v2e.call(t).slice(8,-1);switch(n){case"Array":return[P0,uh];case"Object":return[Oy,uh];case"Date":return[bN,uh];case"RegExp":return[wN,uh];case"Map":return[SN,uh];case"Set":return[kN,uh];case"DataView":return[P0,n]}return n.includes("Array")?[P0,n]:n.includes("Error")?[kV,n]:[Oy,n]},R1=([t,e])=>t===Hb&&(e==="function"||e==="symbol"),b2e=(t,e,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=e0(a);switch(l){case Hb:{let h=a;switch(c){case"bigint":l=OV,h=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);h=null;break;case"undefined":return s([SV],a)}return s([l,h],a)}case P0:{if(c){let g=a;return c==="DataView"?g=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(g=new Uint8Array(a)),s([c,[...g]],a)}const h=[],m=s([l,h],a);for(const g of a)h.push(i(g));return m}case Oy:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(e&&"toJSON"in a)return i(a.toJSON());const h=[],m=s([l,h],a);for(const g of y2e(a))(t||!R1(e0(a[g])))&&h.push([i(g),i(a[g])]);return m}case bN:return s([l,a.toISOString()],a);case wN:{const{source:h,flags:m}=a;return s([l,{source:h,flags:m}],a)}case SN:{const h=[],m=s([l,h],a);for(const[g,x]of a)(t||!(R1(e0(g))||R1(e0(x))))&&h.push([i(g),i(x)]);return m}case kN:{const h=[],m=s([l,h],a);for(const g of a)(t||!R1(e0(g)))&&h.push(i(g));return m}}const{message:d}=a;return s([l,{name:c,message:d}],a)};return i},ZM=(t,{json:e,lossy:n}={})=>{const r=[];return b2e(!(e||n),!!e,new Map,r)(t),r},jy=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?KM(ZM(t,e)):structuredClone(t):(t,e)=>KM(ZM(t,e));function w2e(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function S2e(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function k2e(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||w2e,r=t.options.footnoteBackLabel||S2e,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&y.push({type:"text",value:" "});let j=typeof n=="string"?n:n(c,x);typeof j=="string"&&(j={type:"text",value:j}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,x),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const S=h[h.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const j=S.children[S.children.length-1];j&&j.type==="text"?j.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...y)}else h.push(...y);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(h,!0)};t.patch(d,k),l.push(k)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...jy(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:` -`}]}}const hg=(function(t){if(t==null)return k2e;if(typeof t=="function")return Fb(t);if(typeof t=="object")return Array.isArray(t)?b2e(t):w2e(t);if(typeof t=="string")return S2e(t);throw new Error("Expected function, string, or object as test")});function b2e(t){const e=[];let n=-1;for(;++n":""))+")"})}return g;function g(){let x=wV,y,w,S;if((!e||i(c,d,h[h.length-1]||void 0))&&(x=N2e(n(c,h)),x[0]===RO))return x;if("children"in c&&c.children){const k=c;if(k.children&&x[0]!==SV)for(w=(r?k.children.length:-1)+a,S=h.concat(k);w>-1&&w":""))+")"})}return g;function g(){let x=jV,y,w,S;if((!e||i(c,d,h[h.length-1]||void 0))&&(x=_2e(n(c,h)),x[0]===zO))return x;if("children"in c&&c.children){const k=c;if(k.children&&x[0]!==NV)for(w=(r?k.children.length:-1)+a,S=h.concat(k);w>-1&&w0&&n.push({type:"text",value:` -`}),n}function WM(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function GM(t,e){const n=T2e(t,e),r=n.one(t,void 0),s=y2e(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` -`},s),i}function R2e(t,e){return t&&"run"in t?async function(n,r){const s=GM(n,{file:r,...e});await t.run(s,r)}:function(n,r){return GM(n,{file:r,...t||e})}}function XM(t){if(t)throw t}var RS,YM;function D2e(){if(YM)return RS;YM=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},i=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var h=t.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!h&&!m)return!1;var g;for(g in d);return typeof g>"u"||t.call(d,g)},a=function(d,h){n&&h.name==="__proto__"?n(d,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):d[h.name]=h.newValue},l=function(d,h){if(h==="__proto__")if(t.call(d,h)){if(r)return r(d,h).value}else return;return d[h]};return RS=function c(){var d,h,m,g,x,y,w=arguments[0],S=1,k=arguments.length,j=!1;for(typeof w=="boolean"&&(j=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});Sa.length;let c;l&&a.push(s);try{c=t.apply(this,a)}catch(d){const h=d;if(l&&n)throw h;return s(h)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,e(a,...l))}function i(a){s(null,a)}}const go={basename:L2e,dirname:B2e,extname:F2e,join:q2e,sep:"/"};function L2e(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');fg(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(r=s):(l=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function B2e(t){if(fg(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function F2e(t){fg(t);let e=t.length,n=-1,r=0,s=-1,i=0,a;for(;e--;){const l=t.codePointAt(e);if(l===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),l===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function q2e(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function H2e(t,e){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=t.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,a):n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function fg(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Q2e={cwd:V2e};function V2e(){return"/"}function zO(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function U2e(t){if(typeof t=="string")t=new URL(t);else if(!zO(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return W2e(t)}function W2e(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[x,...y]=h;const w=r[g][1];PO(w)&&PO(x)&&(x=DS(!0,w,x)),r[g]=[d,x,...y]}}}}const K2e=new bN().freeze();function LS(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function BS(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function FS(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ZM(t){if(!PO(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function JM(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function E1(t){return Z2e(t)?t:new kV(t)}function Z2e(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function J2e(t){return typeof t=="string"||e4e(t)}function e4e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const t4e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",eR=[],tR={allowDangerousHtml:!0},n4e=/^(https?|ircs?|mailto|xmpp)$/i,r4e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function s4e(t){const e=i4e(t),n=a4e(t);return o4e(e.runSync(e.parse(n),n),t)}function i4e(t){const e=t.rehypePlugins||eR,n=t.remarkPlugins||eR,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...tR}:tR;return K2e().use(Fwe).use(n).use(R2e,r).use(e)}function a4e(t){const e=t.children||"",n=new kV;return typeof e=="string"&&(n.value=e),n}function o4e(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||l4e;for(const h of r4e)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+t4e+h.id,void 0);return yN(t,d),kye(t,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(h,m,g){if(h.type==="raw"&&g&&typeof m=="number")return a?g.children.splice(m,1):g.children[m]={type:"text",value:h.value},m;if(h.type==="element"){let x;for(x in _S)if(Object.hasOwn(_S,x)&&Object.hasOwn(h.properties,x)){const y=h.properties[x],w=_S[x];(w===null||w.includes(h.tagName))&&(h.properties[x]=c(String(y||""),x,h))}}if(h.type==="element"){let x=n?!n.includes(h.tagName):i?i.includes(h.tagName):!1;if(!x&&r&&typeof m=="number"&&(x=!r(h,m,g)),x&&g&&typeof m=="number")return l&&h.children?g.children.splice(m,1,...h.children):g.children.splice(m,1),m}}}function l4e(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||n4e.test(t.slice(0,e))?t:""}function nR(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function c4e(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function u4e(t,e,n){const s=hg((n||{}).ignore||[]),i=d4e(e);let a=-1;for(;++a0?{type:"text",value:_}:void 0),_===!1?g.lastIndex=T+1:(y!==T&&j.push({type:"text",value:d.value.slice(y,T)}),Array.isArray(_)?j.push(..._):_&&j.push(_),y=T+N[0].length,k=!0),!g.global)break;N=g.exec(d.value)}return k?(y?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=nR(t,"(");let i=nR(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function OV(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||fd(n)||Ib(n))&&(!e||n!==47)}jV.peek=D4e;function N4e(){this.buffer()}function C4e(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function T4e(){this.buffer()}function E4e(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function _4e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ga(this.sliceSerialize(t)).toLowerCase(),n.label=e}function A4e(t){this.exit(t)}function M4e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ga(this.sliceSerialize(t)).toLowerCase(),n.label=e}function R4e(t){this.exit(t)}function D4e(){return"["}function jV(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),l(),a(),i+=s.move("]"),i}function P4e(){return{enter:{gfmFootnoteCallString:N4e,gfmFootnoteCall:C4e,gfmFootnoteDefinitionLabelString:T4e,gfmFootnoteDefinition:E4e},exit:{gfmFootnoteCallString:_4e,gfmFootnoteCall:A4e,gfmFootnoteDefinitionLabelString:M4e,gfmFootnoteDefinition:R4e}}}function z4e(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:jV},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const l=i.createTracker(a);let c=l.move("[^");const d=i.enter("footnoteDefinition"),h=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),h(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((e?` -`:" ")+i.indentLines(i.containerFlow(r,l.current()),e?NV:I4e))),d(),c}}function I4e(t,e,n){return e===0?t:NV(t,e,n)}function NV(t,e,n){return(n?"":" ")+t}const L4e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];CV.peek=H4e;function B4e(){return{canContainEols:["delete"],enter:{strikethrough:q4e},exit:{strikethrough:$4e}}}function F4e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:L4e}],handlers:{delete:CV}}}function q4e(t){this.enter({type:"delete",children:[]},t)}function $4e(t){this.exit(t)}function CV(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(t,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function H4e(){return"~"}function Q4e(t){return t.length}function V4e(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||Q4e,i=[],a=[],l=[],c=[];let d=0,h=-1;for(;++hd&&(d=t[h].length);++kc[k])&&(c[k]=N)}w.push(j)}a[h]=w,l[h]=S}let m=-1;if(typeof r=="object"&&"length"in r)for(;++mc[m]&&(c[m]=j),x[m]=j),g[m]=N}a.splice(1,0,g),l.splice(1,0,x),h=-1;const y=[];for(;++h "),i.shift(2);const a=n.indentLines(n.containerFlow(t,i.current()),G4e);return s(),a}function G4e(t,e,n){return">"+(n?"":" ")+t}function X4e(t,e){return sR(t,e.inConstruct,!0)&&!sR(t,e.notInConstruct,!1)}function sR(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+e.length,r=n.indexOf(e,s);return a}function Y4e(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function K4e(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function Z4e(t,e,n,r){const s=K4e(n),i=t.value||"",a=s==="`"?"GraveAccent":"Tilde";if(Y4e(t,n)){const m=n.enter("codeIndented"),g=n.indentLines(i,J4e);return m(),g}const l=n.createTracker(r),c=s.repeat(Math.max(TV(i,s)+1,3)),d=n.enter("codeFenced");let h=l.move(c);if(t.lang){const m=n.enter(`codeFencedLang${a}`);h+=l.move(n.safe(t.lang,{before:h,after:" ",encode:["`"],...l.current()})),m()}if(t.lang&&t.meta){const m=n.enter(`codeFencedMeta${a}`);h+=l.move(" "),h+=l.move(n.safe(t.meta,{before:h,after:` +`}),n}function JM(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function eR(t,e){const n=M2e(t,e),r=n.one(t,void 0),s=k2e(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` +`},s),i}function I2e(t,e){return t&&"run"in t?async function(n,r){const s=eR(n,{file:r,...e});await t.run(s,r)}:function(n,r){return eR(n,{file:r,...t||e})}}function tR(t){if(t)throw t}var IS,nR;function L2e(){if(nR)return IS;nR=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},i=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var h=t.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!h&&!m)return!1;var g;for(g in d);return typeof g>"u"||t.call(d,g)},a=function(d,h){n&&h.name==="__proto__"?n(d,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):d[h.name]=h.newValue},l=function(d,h){if(h==="__proto__")if(t.call(d,h)){if(r)return r(d,h).value}else return;return d[h]};return IS=function c(){var d,h,m,g,x,y,w=arguments[0],S=1,k=arguments.length,j=!1;for(typeof w=="boolean"&&(j=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});Sa.length;let c;l&&a.push(s);try{c=t.apply(this,a)}catch(d){const h=d;if(l&&n)throw h;return s(h)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,e(a,...l))}function i(a){s(null,a)}}const vo={basename:$2e,dirname:H2e,extname:Q2e,join:V2e,sep:"/"};function $2e(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');vg(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(r=s):(l=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function H2e(t){if(vg(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Q2e(t){vg(t);let e=t.length,n=-1,r=0,s=-1,i=0,a;for(;e--;){const l=t.codePointAt(e);if(l===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),l===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function V2e(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function W2e(t,e){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=t.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,a):n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function vg(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const G2e={cwd:X2e};function X2e(){return"/"}function BO(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Y2e(t){if(typeof t=="string")t=new URL(t);else if(!BO(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return K2e(t)}function K2e(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[x,...y]=h;const w=r[g][1];LO(w)&&LO(x)&&(x=LS(!0,w,x)),r[g]=[d,x,...y]}}}}const t4e=new NN().freeze();function $S(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function HS(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function QS(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function sR(t){if(!LO(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function iR(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function D1(t){return n4e(t)?t:new CV(t)}function n4e(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function r4e(t){return typeof t=="string"||s4e(t)}function s4e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const i4e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",aR=[],oR={allowDangerousHtml:!0},a4e=/^(https?|ircs?|mailto|xmpp)$/i,o4e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function l4e(t){const e=c4e(t),n=u4e(t);return d4e(e.runSync(e.parse(n),n),t)}function c4e(t){const e=t.rehypePlugins||aR,n=t.remarkPlugins||aR,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...oR}:oR;return t4e().use(Qwe).use(n).use(I2e,r).use(e)}function u4e(t){const e=t.children||"",n=new CV;return typeof e=="string"&&(n.value=e),n}function d4e(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||h4e;for(const h of o4e)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+i4e+h.id,void 0);return jN(t,d),Cye(t,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(h,m,g){if(h.type==="raw"&&g&&typeof m=="number")return a?g.children.splice(m,1):g.children[m]={type:"text",value:h.value},m;if(h.type==="element"){let x;for(x in DS)if(Object.hasOwn(DS,x)&&Object.hasOwn(h.properties,x)){const y=h.properties[x],w=DS[x];(w===null||w.includes(h.tagName))&&(h.properties[x]=c(String(y||""),x,h))}}if(h.type==="element"){let x=n?!n.includes(h.tagName):i?i.includes(h.tagName):!1;if(!x&&r&&typeof m=="number"&&(x=!r(h,m,g)),x&&g&&typeof m=="number")return l&&h.children?g.children.splice(m,1,...h.children):g.children.splice(m,1),m}}}function h4e(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||a4e.test(t.slice(0,e))?t:""}function lR(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function f4e(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function m4e(t,e,n){const s=xg((n||{}).ignore||[]),i=p4e(e);let a=-1;for(;++a0?{type:"text",value:_}:void 0),_===!1?g.lastIndex=T+1:(y!==T&&j.push({type:"text",value:d.value.slice(y,T)}),Array.isArray(_)?j.push(..._):_&&j.push(_),y=T+N[0].length,k=!0),!g.global)break;N=g.exec(d.value)}return k?(y?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=lR(t,"(");let i=lR(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function TV(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||gd(n)||qb(n))&&(!e||n!==47)}EV.peek=L4e;function _4e(){this.buffer()}function A4e(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function M4e(){this.buffer()}function R4e(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function D4e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Xa(this.sliceSerialize(t)).toLowerCase(),n.label=e}function P4e(t){this.exit(t)}function z4e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Xa(this.sliceSerialize(t)).toLowerCase(),n.label=e}function I4e(t){this.exit(t)}function L4e(){return"["}function EV(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),l(),a(),i+=s.move("]"),i}function B4e(){return{enter:{gfmFootnoteCallString:_4e,gfmFootnoteCall:A4e,gfmFootnoteDefinitionLabelString:M4e,gfmFootnoteDefinition:R4e},exit:{gfmFootnoteCallString:D4e,gfmFootnoteCall:P4e,gfmFootnoteDefinitionLabelString:z4e,gfmFootnoteDefinition:I4e}}}function F4e(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:EV},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const l=i.createTracker(a);let c=l.move("[^");const d=i.enter("footnoteDefinition"),h=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),h(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((e?` +`:" ")+i.indentLines(i.containerFlow(r,l.current()),e?_V:q4e))),d(),c}}function q4e(t,e,n){return e===0?t:_V(t,e,n)}function _V(t,e,n){return(n?"":" ")+t}const $4e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];AV.peek=W4e;function H4e(){return{canContainEols:["delete"],enter:{strikethrough:V4e},exit:{strikethrough:U4e}}}function Q4e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$4e}],handlers:{delete:AV}}}function V4e(t){this.enter({type:"delete",children:[]},t)}function U4e(t){this.exit(t)}function AV(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(t,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function W4e(){return"~"}function G4e(t){return t.length}function X4e(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||G4e,i=[],a=[],l=[],c=[];let d=0,h=-1;for(;++hd&&(d=t[h].length);++kc[k])&&(c[k]=N)}w.push(j)}a[h]=w,l[h]=S}let m=-1;if(typeof r=="object"&&"length"in r)for(;++mc[m]&&(c[m]=j),x[m]=j),g[m]=N}a.splice(1,0,g),l.splice(1,0,x),h=-1;const y=[];for(;++h "),i.shift(2);const a=n.indentLines(n.containerFlow(t,i.current()),Z4e);return s(),a}function Z4e(t,e,n){return">"+(n?"":" ")+t}function J4e(t,e){return uR(t,e.inConstruct,!0)&&!uR(t,e.notInConstruct,!1)}function uR(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+e.length,r=n.indexOf(e,s);return a}function eSe(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function tSe(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function nSe(t,e,n,r){const s=tSe(n),i=t.value||"",a=s==="`"?"GraveAccent":"Tilde";if(eSe(t,n)){const m=n.enter("codeIndented"),g=n.indentLines(i,rSe);return m(),g}const l=n.createTracker(r),c=s.repeat(Math.max(MV(i,s)+1,3)),d=n.enter("codeFenced");let h=l.move(c);if(t.lang){const m=n.enter(`codeFencedLang${a}`);h+=l.move(n.safe(t.lang,{before:h,after:" ",encode:["`"],...l.current()})),m()}if(t.lang&&t.meta){const m=n.enter(`codeFencedMeta${a}`);h+=l.move(" "),h+=l.move(n.safe(t.meta,{before:h,after:` `,encode:["`"],...l.current()})),m()}return h+=l.move(` `),i&&(h+=l.move(i+` -`)),h+=l.move(c),d(),h}function J4e(t,e,n){return(n?"":" ")+t}function wN(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function eSe(t,e,n,r){const s=wN(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("[");return d+=c.move(n.safe(n.associationId(t),{before:d,after:"]",...c.current()})),d+=c.move("]: "),l(),!t.url||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(t.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(t.url,{before:d,after:t.title?" ":` -`,...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(n.safe(t.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),a(),d}function tSe(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function gp(t){return"&#x"+t.toString(16).toUpperCase()+";"}function wy(t,e,n){const r=hf(t),s=hf(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}EV.peek=nSe;function EV(t,e,n,r){const s=tSe(n),i=n.enter("emphasis"),a=n.createTracker(r),l=a.move(s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const d=c.charCodeAt(0),h=wy(r.before.charCodeAt(r.before.length-1),d,s);h.inside&&(c=gp(d)+c.slice(1));const m=c.charCodeAt(c.length-1),g=wy(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+gp(m));const x=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},l+c+x}function nSe(t,e,n){return n.options.emphasis||"*"}function rSe(t,e){let n=!1;return yN(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,RO}),!!((!t.depth||t.depth<3)&&dN(t)&&(e.options.setext||n))}function sSe(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(rSe(t,n)){const h=n.enter("headingSetext"),m=n.enter("phrasing"),g=n.containerPhrasing(t,{...i.current(),before:` +`)),h+=l.move(c),d(),h}function rSe(t,e,n){return(n?"":" ")+t}function CN(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function sSe(t,e,n,r){const s=CN(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("[");return d+=c.move(n.safe(n.associationId(t),{before:d,after:"]",...c.current()})),d+=c.move("]: "),l(),!t.url||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(t.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(t.url,{before:d,after:t.title?" ":` +`,...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(n.safe(t.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),a(),d}function iSe(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function bp(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Ny(t,e,n){const r=hf(t),s=hf(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}RV.peek=aSe;function RV(t,e,n,r){const s=iSe(n),i=n.enter("emphasis"),a=n.createTracker(r),l=a.move(s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const d=c.charCodeAt(0),h=Ny(r.before.charCodeAt(r.before.length-1),d,s);h.inside&&(c=bp(d)+c.slice(1));const m=c.charCodeAt(c.length-1),g=Ny(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+bp(m));const x=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},l+c+x}function aSe(t,e,n){return n.options.emphasis||"*"}function oSe(t,e){let n=!1;return jN(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,zO}),!!((!t.depth||t.depth<3)&&xN(t)&&(e.options.setext||n))}function lSe(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(oSe(t,n)){const h=n.enter("headingSetext"),m=n.enter("phrasing"),g=n.containerPhrasing(t,{...i.current(),before:` `,after:` `});return m(),h(),g+` `+(s===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(` `))+1))}const a="#".repeat(s),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(a+" ");let d=n.containerPhrasing(t,{before:"# ",after:` -`,...i.current()});return/^[\t ]/.test(d)&&(d=gp(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),c(),l(),d}_V.peek=iSe;function _V(t){return t.value||""}function iSe(){return"<"}AV.peek=aSe;function AV(t,e,n,r){const s=wN(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("![");return d+=c.move(n.safe(t.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(t.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(t.url,{before:d,after:t.title?" ":")",...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(n.safe(t.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),d+=c.move(")"),a(),d}function aSe(){return"!"}MV.peek=oSe;function MV(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const d=n.safe(t.alt,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=h,i(),s==="full"||!d||d!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function oSe(){return"!"}RV.peek=lSe;function RV(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))}PV.peek=cSe;function PV(t,e,n,r){const s=wN(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(DV(t,n)){const h=n.stack;n.stack=[],l=n.enter("autolink");let m=a.move("<");return m+=a.move(n.containerPhrasing(t,{before:m,after:">",...a.current()})),m+=a.move(">"),l(),n.stack=h,m}l=n.enter("link"),c=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(t,{before:d,after:"](",...a.current()})),d+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(t.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(c=n.enter("destinationRaw"),d+=a.move(n.safe(t.url,{before:d,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=n.enter(`title${i}`),d+=a.move(" "+s),d+=a.move(n.safe(t.title,{before:d,after:s,...a.current()})),d+=a.move(s),c()),d+=a.move(")"),l(),d}function cSe(t,e,n){return DV(t,n)?"<":"["}zV.peek=uSe;function zV(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const d=n.containerPhrasing(t,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=h,i(),s==="full"||!d||d!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function uSe(){return"["}function SN(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 dSe(t){const e=SN(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 hSe(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 IV(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 fSe(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=t.ordered?hSe(n):SN(n);const l=t.ordered?a==="."?")":".":dSe(n);let c=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const h=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),IV(n)===a&&h){let m=-1;for(;++m-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(a-i.length)),l.shift(a);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(t,l.current()),h);return c(),d;function h(m,g,x){return g?(x?"":" ".repeat(a))+m:(x?i:i+" ".repeat(a-i.length))+m}}function gSe(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(t,r);return i(),s(),a}const xSe=hg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function vSe(t,e,n,r){return(t.children.some(function(a){return xSe(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function ySe(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}LV.peek=bSe;function LV(t,e,n,r){const s=ySe(n),i=n.enter("strong"),a=n.createTracker(r),l=a.move(s+s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const d=c.charCodeAt(0),h=wy(r.before.charCodeAt(r.before.length-1),d,s);h.inside&&(c=gp(d)+c.slice(1));const m=c.charCodeAt(c.length-1),g=wy(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+gp(m));const x=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},l+c+x}function bSe(t,e,n){return n.options.strong||"*"}function wSe(t,e,n,r){return n.safe(t.value,r)}function SSe(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 kSe(t,e,n){const r=(IV(n)+(n.options.ruleSpaces?" ":"")).repeat(SSe(n));return n.options.ruleSpaces?r.slice(0,-1):r}const BV={blockquote:W4e,break:iR,code:Z4e,definition:eSe,emphasis:EV,hardBreak:iR,heading:sSe,html:_V,image:AV,imageReference:MV,inlineCode:RV,link:PV,linkReference:zV,list:fSe,listItem:pSe,paragraph:gSe,root:vSe,strong:LV,text:wSe,thematicBreak:kSe};function OSe(){return{enter:{table:jSe,tableData:aR,tableHeader:aR,tableRow:CSe},exit:{codeText:TSe,table:NSe,tableData:QS,tableHeader:QS,tableRow:QS}}}function jSe(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 NSe(t){this.exit(t),this.data.inTable=void 0}function CSe(t){this.enter({type:"tableRow",children:[]},t)}function QS(t){this.exit(t)}function aR(t){this.enter({type:"tableCell",children:[]},t)}function TSe(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,ESe));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function ESe(t,e){return e==="|"?e:t}function _Se(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...i.current()});return/^[\t ]/.test(d)&&(d=bp(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),c(),l(),d}DV.peek=cSe;function DV(t){return t.value||""}function cSe(){return"<"}PV.peek=uSe;function PV(t,e,n,r){const s=CN(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("![");return d+=c.move(n.safe(t.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(t.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(t.url,{before:d,after:t.title?" ":")",...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(n.safe(t.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),d+=c.move(")"),a(),d}function uSe(){return"!"}zV.peek=dSe;function zV(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const d=n.safe(t.alt,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=h,i(),s==="full"||!d||d!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function dSe(){return"!"}IV.peek=hSe;function IV(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))}BV.peek=fSe;function BV(t,e,n,r){const s=CN(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(LV(t,n)){const h=n.stack;n.stack=[],l=n.enter("autolink");let m=a.move("<");return m+=a.move(n.containerPhrasing(t,{before:m,after:">",...a.current()})),m+=a.move(">"),l(),n.stack=h,m}l=n.enter("link"),c=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(t,{before:d,after:"](",...a.current()})),d+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(t.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(c=n.enter("destinationRaw"),d+=a.move(n.safe(t.url,{before:d,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=n.enter(`title${i}`),d+=a.move(" "+s),d+=a.move(n.safe(t.title,{before:d,after:s,...a.current()})),d+=a.move(s),c()),d+=a.move(")"),l(),d}function fSe(t,e,n){return LV(t,n)?"<":"["}FV.peek=mSe;function FV(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const d=n.containerPhrasing(t,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=h,i(),s==="full"||!d||d!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function mSe(){return"["}function TN(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 pSe(t){const e=TN(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 gSe(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 qV(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 xSe(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=t.ordered?gSe(n):TN(n);const l=t.ordered?a==="."?")":".":pSe(n);let c=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const h=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),qV(n)===a&&h){let m=-1;for(;++m-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(a-i.length)),l.shift(a);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(t,l.current()),h);return c(),d;function h(m,g,x){return g?(x?"":" ".repeat(a))+m:(x?i:i+" ".repeat(a-i.length))+m}}function bSe(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(t,r);return i(),s(),a}const wSe=xg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function SSe(t,e,n,r){return(t.children.some(function(a){return wSe(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function kSe(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}$V.peek=OSe;function $V(t,e,n,r){const s=kSe(n),i=n.enter("strong"),a=n.createTracker(r),l=a.move(s+s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const d=c.charCodeAt(0),h=Ny(r.before.charCodeAt(r.before.length-1),d,s);h.inside&&(c=bp(d)+c.slice(1));const m=c.charCodeAt(c.length-1),g=Ny(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+bp(m));const x=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},l+c+x}function OSe(t,e,n){return n.options.strong||"*"}function jSe(t,e,n,r){return n.safe(t.value,r)}function NSe(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 CSe(t,e,n){const r=(qV(n)+(n.options.ruleSpaces?" ":"")).repeat(NSe(n));return n.options.ruleSpaces?r.slice(0,-1):r}const HV={blockquote:K4e,break:dR,code:nSe,definition:sSe,emphasis:RV,hardBreak:dR,heading:lSe,html:DV,image:PV,imageReference:zV,inlineCode:IV,link:BV,linkReference:FV,list:xSe,listItem:ySe,paragraph:bSe,root:SSe,strong:$V,text:jSe,thematicBreak:CSe};function TSe(){return{enter:{table:ESe,tableData:hR,tableHeader:hR,tableRow:ASe},exit:{codeText:MSe,table:_Se,tableData:GS,tableHeader:GS,tableRow:GS}}}function ESe(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 _Se(t){this.exit(t),this.data.inTable=void 0}function ASe(t){this.enter({type:"tableRow",children:[]},t)}function GS(t){this.exit(t)}function hR(t){this.enter({type:"tableCell",children:[]},t)}function MSe(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,RSe));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function RSe(t,e){return e==="|"?e:t}function DSe(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:c,tableRow:l}};function a(x,y,w,S){return d(h(x,w,S),x.align)}function l(x,y,w,S){const k=m(x,w,S),j=d([k]);return j.slice(0,j.indexOf(` -`))}function c(x,y,w,S){const k=w.enter("tableCell"),j=w.enter("phrasing"),N=w.containerPhrasing(x,{...S,before:i,after:i});return j(),k(),N}function d(x,y){return V4e(x,{align:y,alignDelimiters:r,padding:n,stringLength:s})}function h(x,y,w){const S=x.children;let k=-1;const j=[],N=y.enter("table");for(;++k0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const GSe={tokenize:n5e,partial:!0};function XSe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:JSe,continuation:{tokenize:e5e},exit:t5e}},text:{91:{name:"gfmFootnoteCall",tokenize:ZSe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:YSe,resolveTo:KSe}}}}function YSe(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const d=Ga(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function KSe(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...l),t}function ZSe(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return l;function l(m){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),c}function c(m){return m!==94?n(m):(t.enter("gfmFootnoteCallMarker"),t.consume(m),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",d)}function d(m){if(i>999||m===93&&!a||m===null||m===91||or(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return s.includes(Ga(r.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return or(m)||(a=!0),i++,t.consume(m),m===92?h:d}function h(m){return m===91||m===92||m===93?(t.consume(m),i++,d):d(m)}}function JSe(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,l;return c;function c(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",h):n(y)}function h(y){if(a>999||y===93&&!l||y===null||y===91||or(y))return n(y);if(y===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return i=Ga(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return or(y)||(l=!0),a++,t.consume(y),y===92?m:h}function m(y){return y===91||y===92||y===93?(t.consume(y),a++,h):h(y)}function g(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),s.includes(i)||s.push(i),on(t,x,"gfmFootnoteDefinitionWhitespace")):n(y)}function x(y){return e(y)}}function e5e(t,e,n){return t.check(dg,e,t.attempt(GSe,e,n))}function t5e(t){t.exit("gfmFootnoteDefinition")}function n5e(t,e,n){const r=this;return on(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):n(i)}}function r5e(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,l){let c=-1;for(;++c1?c(y):(a.consume(y),m++,x);if(m<2&&!n)return c(y);const S=a.exit("strikethroughSequenceTemporary"),k=hf(y);return S._open=!k||k===2&&!!w,S._close=!w||w===2&&!!k,l(y)}}}class s5e{constructor(){this.map=[]}add(e,n,r){i5e(this,e,n,r)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function i5e(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const z=r.events[$][1].type;if(z==="lineEnding"||z==="linePrefix")$--;else break}const U=$>-1?r.events[$][1].type:null,te=U==="tableHead"||U==="tableRow"?_:c;return te===_&&r.parser.lazy[r.now().line]?n(B):te(B)}function c(B){return t.enter("tableHead"),t.enter("tableRow"),d(B)}function d(B){return B===124||(a=!0,i+=1),h(B)}function h(B){return B===null?n(B):bt(B)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(B),t.exit("lineEnding"),x):n(B):dn(B)?on(t,h,"whitespace")(B):(i+=1,a&&(a=!1,s+=1),B===124?(t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),a=!0,h):(t.enter("data"),m(B)))}function m(B){return B===null||B===124||or(B)?(t.exit("data"),h(B)):(t.consume(B),B===92?g:m)}function g(B){return B===92||B===124?(t.consume(B),m):m(B)}function x(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(B):(t.enter("tableDelimiterRow"),a=!1,dn(B)?on(t,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):y(B))}function y(B){return B===45||B===58?S(B):B===124?(a=!0,t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),w):E(B)}function w(B){return dn(B)?on(t,S,"whitespace")(B):S(B)}function S(B){return B===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(B),t.exit("tableDelimiterMarker"),k):B===45?(i+=1,k(B)):B===null||bt(B)?T(B):E(B)}function k(B){return B===45?(t.enter("tableDelimiterFiller"),j(B)):E(B)}function j(B){return B===45?(t.consume(B),j):B===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(B),t.exit("tableDelimiterMarker"),N):(t.exit("tableDelimiterFiller"),N(B))}function N(B){return dn(B)?on(t,T,"whitespace")(B):T(B)}function T(B){return B===124?y(B):B===null||bt(B)?!a||s!==i?E(B):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(B)):E(B)}function E(B){return n(B)}function _(B){return t.enter("tableRow"),A(B)}function A(B){return B===124?(t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),A):B===null||bt(B)?(t.exit("tableRow"),e(B)):dn(B)?on(t,A,"whitespace")(B):(t.enter("data"),L(B))}function L(B){return B===null||B===124||or(B)?(t.exit("data"),A(B)):(t.consume(B),B===92?P:L)}function P(B){return B===92||B===124?(t.consume(B),L):L(B)}}function c5e(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,d,h,m;const g=new s5e;for(;++nn[2]+1){const y=n[2]+1,w=n[3]-n[2]-1;t.add(y,w,[])}}t.add(n[3]+1,0,[["exit",m,e]])}return s!==void 0&&(i.end=Object.assign({},kh(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function lR(t,e,n,r,s){const i=[],a=kh(e.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,e])),r.end=Object.assign({},a),i.push(["exit",r,e]),t.add(n+1,0,i)}function kh(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const u5e={name:"tasklistCheck",tokenize:h5e};function d5e(){return{text:{91:u5e}}}function h5e(t,e,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),i)}function i(c){return or(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),l):n(c)}function l(c){return bt(c)?e(c):dn(c)?t.check({tokenize:f5e},e,n)(c):n(c)}}function f5e(t,e,n){return on(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function m5e(t){return rV([BSe(),XSe(),r5e(t),o5e(),d5e()])}const p5e={};function g5e(t){const e=this,n=t||p5e,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(m5e(n)),i.push(PSe()),a.push(zSe(n))}function x5e(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:l,mathText:a,mathTextData:l}};function t(c){const d={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[d]}},c)}function e(){this.buffer()}function n(){const c=this.resume(),d=this.stack[this.stack.length-1];d.type,d.meta=c}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(c){const d=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),h=this.stack[this.stack.length-1];h.type,this.exit(c),h.value=d;const m=h.data.hChildren[0];m.type,m.tagName,m.children.push({type:"text",value:d}),this.data.mathFlowInside=void 0}function i(c){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},c),this.buffer()}function a(c){const d=this.resume(),h=this.stack[this.stack.length-1];h.type,this.exit(c),h.value=d,h.data.hChildren.push({type:"text",value:d})}function l(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function v5e(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` -`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,a,l,c){const d=i.value||"",h=l.createTracker(c),m="$".repeat(Math.max(TV(d,"$")+1,2)),g=l.enter("mathFlow");let x=h.move(m);if(i.meta){const y=l.enter("mathFlowMeta");x+=h.move(l.safe(i.meta,{after:` +`))}function c(x,y,w,S){const k=w.enter("tableCell"),j=w.enter("phrasing"),N=w.containerPhrasing(x,{...S,before:i,after:i});return j(),k(),N}function d(x,y){return X4e(x,{align:y,alignDelimiters:r,padding:n,stringLength:s})}function h(x,y,w){const S=x.children;let k=-1;const j=[],N=y.enter("table");for(;++k0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ZSe={tokenize:a5e,partial:!0};function JSe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:r5e,continuation:{tokenize:s5e},exit:i5e}},text:{91:{name:"gfmFootnoteCall",tokenize:n5e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:e5e,resolveTo:t5e}}}}function e5e(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const d=Xa(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function t5e(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...l),t}function n5e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return l;function l(m){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),c}function c(m){return m!==94?n(m):(t.enter("gfmFootnoteCallMarker"),t.consume(m),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",d)}function d(m){if(i>999||m===93&&!a||m===null||m===91||dr(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return s.includes(Xa(r.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return dr(m)||(a=!0),i++,t.consume(m),m===92?h:d}function h(m){return m===91||m===92||m===93?(t.consume(m),i++,d):d(m)}}function r5e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,l;return c;function c(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",h):n(y)}function h(y){if(a>999||y===93&&!l||y===null||y===91||dr(y))return n(y);if(y===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return i=Xa(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return dr(y)||(l=!0),a++,t.consume(y),y===92?m:h}function m(y){return y===91||y===92||y===93?(t.consume(y),a++,h):h(y)}function g(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),s.includes(i)||s.push(i),cn(t,x,"gfmFootnoteDefinitionWhitespace")):n(y)}function x(y){return e(y)}}function s5e(t,e,n){return t.check(gg,e,t.attempt(ZSe,e,n))}function i5e(t){t.exit("gfmFootnoteDefinition")}function a5e(t,e,n){const r=this;return cn(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):n(i)}}function o5e(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,l){let c=-1;for(;++c1?c(y):(a.consume(y),m++,x);if(m<2&&!n)return c(y);const S=a.exit("strikethroughSequenceTemporary"),k=hf(y);return S._open=!k||k===2&&!!w,S._close=!w||w===2&&!!k,l(y)}}}class l5e{constructor(){this.map=[]}add(e,n,r){c5e(this,e,n,r)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function c5e(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const I=r.events[H][1].type;if(I==="lineEnding"||I==="linePrefix")H--;else break}const W=H>-1?r.events[H][1].type:null,ee=W==="tableHead"||W==="tableRow"?_:c;return ee===_&&r.parser.lazy[r.now().line]?n(B):ee(B)}function c(B){return t.enter("tableHead"),t.enter("tableRow"),d(B)}function d(B){return B===124||(a=!0,i+=1),h(B)}function h(B){return B===null?n(B):St(B)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(B),t.exit("lineEnding"),x):n(B):gn(B)?cn(t,h,"whitespace")(B):(i+=1,a&&(a=!1,s+=1),B===124?(t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),a=!0,h):(t.enter("data"),m(B)))}function m(B){return B===null||B===124||dr(B)?(t.exit("data"),h(B)):(t.consume(B),B===92?g:m)}function g(B){return B===92||B===124?(t.consume(B),m):m(B)}function x(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(B):(t.enter("tableDelimiterRow"),a=!1,gn(B)?cn(t,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):y(B))}function y(B){return B===45||B===58?S(B):B===124?(a=!0,t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),w):E(B)}function w(B){return gn(B)?cn(t,S,"whitespace")(B):S(B)}function S(B){return B===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(B),t.exit("tableDelimiterMarker"),k):B===45?(i+=1,k(B)):B===null||St(B)?T(B):E(B)}function k(B){return B===45?(t.enter("tableDelimiterFiller"),j(B)):E(B)}function j(B){return B===45?(t.consume(B),j):B===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(B),t.exit("tableDelimiterMarker"),N):(t.exit("tableDelimiterFiller"),N(B))}function N(B){return gn(B)?cn(t,T,"whitespace")(B):T(B)}function T(B){return B===124?y(B):B===null||St(B)?!a||s!==i?E(B):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(B)):E(B)}function E(B){return n(B)}function _(B){return t.enter("tableRow"),A(B)}function A(B){return B===124?(t.enter("tableCellDivider"),t.consume(B),t.exit("tableCellDivider"),A):B===null||St(B)?(t.exit("tableRow"),e(B)):gn(B)?cn(t,A,"whitespace")(B):(t.enter("data"),D(B))}function D(B){return B===null||B===124||dr(B)?(t.exit("data"),A(B)):(t.consume(B),B===92?q:D)}function q(B){return B===92||B===124?(t.consume(B),D):D(B)}}function f5e(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,d,h,m;const g=new l5e;for(;++nn[2]+1){const y=n[2]+1,w=n[3]-n[2]-1;t.add(y,w,[])}}t.add(n[3]+1,0,[["exit",m,e]])}return s!==void 0&&(i.end=Object.assign({},jh(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function mR(t,e,n,r,s){const i=[],a=jh(e.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,e])),r.end=Object.assign({},a),i.push(["exit",r,e]),t.add(n+1,0,i)}function jh(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const m5e={name:"tasklistCheck",tokenize:g5e};function p5e(){return{text:{91:m5e}}}function g5e(t,e,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),i)}function i(c){return dr(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),l):n(c)}function l(c){return St(c)?e(c):gn(c)?t.check({tokenize:x5e},e,n)(c):n(c)}}function x5e(t,e,n){return cn(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function v5e(t){return oV([HSe(),JSe(),o5e(t),d5e(),p5e()])}const y5e={};function b5e(t){const e=this,n=t||y5e,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(v5e(n)),i.push(BSe()),a.push(FSe(n))}function w5e(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:l,mathText:a,mathTextData:l}};function t(c){const d={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[d]}},c)}function e(){this.buffer()}function n(){const c=this.resume(),d=this.stack[this.stack.length-1];d.type,d.meta=c}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(c){const d=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),h=this.stack[this.stack.length-1];h.type,this.exit(c),h.value=d;const m=h.data.hChildren[0];m.type,m.tagName,m.children.push({type:"text",value:d}),this.data.mathFlowInside=void 0}function i(c){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},c),this.buffer()}function a(c){const d=this.resume(),h=this.stack[this.stack.length-1];h.type,this.exit(c),h.value=d,h.data.hChildren.push({type:"text",value:d})}function l(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function S5e(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,a,l,c){const d=i.value||"",h=l.createTracker(c),m="$".repeat(Math.max(MV(d,"$")+1,2)),g=l.enter("mathFlow");let x=h.move(m);if(i.meta){const y=l.enter("mathFlowMeta");x+=h.move(l.safe(i.meta,{after:` `,before:x,encode:["$"],...h.current()})),y()}return x+=h.move(` `),d&&(x+=h.move(d+` -`)),x+=h.move(m),g(),x}function r(i,a,l){let c=i.value||"",d=1;for(e||d++;new RegExp("(^|[^$])"+"\\$".repeat(d)+"([^$]|$)").test(c);)d++;const h="$".repeat(d);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");let m=-1;for(;++m15?d="…"+l.slice(s-15,s):d=l.slice(0,s);var h;i+15":">","<":"<",'"':""","'":"'"},_5e=/[&><"']/g;function A5e(t){return String(t).replace(_5e,e=>E5e[e])}var GV=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},M5e=function(e){var n=GV(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},R5e=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},D5e=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"},$n={deflt:N5e,escape:A5e,hyphenate:T5e,getBaseElem:GV,isCharacterBox:M5e,protocolFromUrl:D5e},kv={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 P5e(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 ON{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 kv)if(kv.hasOwnProperty(n)){var r=kv[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:P5e(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 $e("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=$n.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 Cc{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 bo[z5e[this.id]]}sub(){return bo[I5e[this.id]]}fracNum(){return bo[L5e[this.id]]}fracDen(){return bo[B5e[this.id]]}cramp(){return bo[F5e[this.id]]}text(){return bo[q5e[this.id]]}isTight(){return this.size>=2}}var jN=0,Sy=1,$h=2,Ll=3,xp=4,Sa=5,ff=6,ti=7,bo=[new Cc(jN,0,!1),new Cc(Sy,0,!0),new Cc($h,1,!1),new Cc(Ll,1,!0),new Cc(xp,2,!1),new Cc(Sa,2,!0),new Cc(ff,3,!1),new Cc(ti,3,!0)],z5e=[xp,Sa,xp,Sa,ff,ti,ff,ti],I5e=[Sa,Sa,Sa,Sa,ti,ti,ti,ti],L5e=[$h,Ll,xp,Sa,ff,ti,ff,ti],B5e=[Ll,Ll,Sa,Sa,ti,ti,ti,ti],F5e=[Sy,Sy,Ll,Ll,Sa,Sa,ti,ti],q5e=[jN,Sy,$h,Ll,$h,Ll,$h,Ll],Et={DISPLAY:bo[jN],TEXT:bo[$h],SCRIPT:bo[xp],SCRIPTSCRIPT:bo[ff]},LO=[{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 $5e(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var Ov=[];LO.forEach(t=>t.blocks.forEach(e=>Ov.push(...e)));function XV(t){for(var e=0;e=Ov[e]&&t<=Ov[e+1])return!0;return!1}var ch=80,H5e=function(e,n){return"M95,"+(622+e+n)+` +`)),x+=h.move(m),g(),x}function r(i,a,l){let c=i.value||"",d=1;for(e||d++;new RegExp("(^|[^$])"+"\\$".repeat(d)+"([^$]|$)").test(c);)d++;const h="$".repeat(d);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");let m=-1;for(;++m15?d="…"+l.slice(s-15,s):d=l.slice(0,s);var h;i+15":">","<":"<",'"':""","'":"'"},D5e=/[&><"']/g;function P5e(t){return String(t).replace(D5e,e=>R5e[e])}var ZV=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},z5e=function(e){var n=ZV(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},I5e=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},L5e=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"},Wn={deflt:_5e,escape:P5e,hyphenate:M5e,getBaseElem:ZV,isCharacterBox:z5e,protocolFromUrl:L5e},Tv={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 B5e(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 _N{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 Tv)if(Tv.hasOwnProperty(n)){var r=Tv[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:B5e(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 qe("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=Wn.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 _c{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 So[F5e[this.id]]}sub(){return So[q5e[this.id]]}fracNum(){return So[$5e[this.id]]}fracDen(){return So[H5e[this.id]]}cramp(){return So[Q5e[this.id]]}text(){return So[V5e[this.id]]}isTight(){return this.size>=2}}var AN=0,Cy=1,Hh=2,Fl=3,wp=4,Na=5,ff=6,ni=7,So=[new _c(AN,0,!1),new _c(Cy,0,!0),new _c(Hh,1,!1),new _c(Fl,1,!0),new _c(wp,2,!1),new _c(Na,2,!0),new _c(ff,3,!1),new _c(ni,3,!0)],F5e=[wp,Na,wp,Na,ff,ni,ff,ni],q5e=[Na,Na,Na,Na,ni,ni,ni,ni],$5e=[Hh,Fl,wp,Na,ff,ni,ff,ni],H5e=[Fl,Fl,Na,Na,ni,ni,ni,ni],Q5e=[Cy,Cy,Fl,Fl,Na,Na,ni,ni],V5e=[AN,Cy,Hh,Fl,Hh,Fl,Hh,Fl],At={DISPLAY:So[AN],TEXT:So[Hh],SCRIPT:So[wp],SCRIPTSCRIPT:So[ff]},qO=[{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 U5e(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var Ev=[];qO.forEach(t=>t.blocks.forEach(e=>Ev.push(...e)));function JV(t){for(var e=0;e=Ev[e]&&t<=Ev[e+1])return!0;return!1}var dh=80,W5e=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 @@ -134,7 +134,7 @@ c5.3,-9.3,12,-14,20,-14 H400000v`+(40+e)+`H845.2724 s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z -M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Q5e=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119 +M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},G5e=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119 c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 c340,-704.7,510.7,-1060.3,512,-1067 l`+e/2.084+" -"+e+` @@ -144,7 +144,7 @@ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5, c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z -M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},V5e=function(e,n){return"M983 "+(10+e+n)+` +M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},X5e=function(e,n){return"M983 "+(10+e+n)+` l`+e/3.13+" -"+e+` c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+` H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 @@ -153,7 +153,7 @@ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 c53.7,-170.3,84.5,-266.8,92.5,-289.5z -M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},U5e=function(e,n){return"M424,"+(2398+e+n)+` +M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Y5e=function(e,n){return"M424,"+(2398+e+n)+` c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 @@ -163,18 +163,18 @@ v`+(40+e)+`H1014.6 s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+n+` -h400000v`+(40+e)+"h-400000z"},W5e=function(e,n){return"M473,"+(2713+e+n)+` +h400000v`+(40+e)+"h-400000z"},K5e=function(e,n){return"M473,"+(2713+e+n)+` c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+` c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7 s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, -606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},G5e=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},X5e=function(e,n,r){var s=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+` +606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},Z5e=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},J5e=function(e,n,r){var s=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+` H742v`+s+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 -219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},Y5e=function(e,n,r){n=1e3*n;var s="";switch(e){case"sqrtMain":s=H5e(n,ch);break;case"sqrtSize1":s=Q5e(n,ch);break;case"sqrtSize2":s=V5e(n,ch);break;case"sqrtSize3":s=U5e(n,ch);break;case"sqrtSize4":s=W5e(n,ch);break;case"sqrtTall":s=X5e(n,ch,r)}return s},K5e=function(e,n){switch(e){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},uR={doubleleftarrow:`M262 157 +219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},e3e=function(e,n,r){n=1e3*n;var s="";switch(e){case"sqrtMain":s=W5e(n,dh);break;case"sqrtSize1":s=G5e(n,dh);break;case"sqrtSize2":s=X5e(n,dh);break;case"sqrtSize3":s=Y5e(n,dh);break;case"sqrtSize4":s=K5e(n,dh);break;case"sqrtTall":s=J5e(n,dh,r)}return s},t3e=function(e,n){switch(e){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},gR={doubleleftarrow:`M262 157 l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 @@ -349,7 +349,7 @@ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z` c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z -M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},Z5e=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},n3e=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 H403z M403 1759 V0 H319 V1759 v`+n+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 @@ -377,21 +377,21 @@ 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 mg{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 _o={"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]}},A1={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]},dR={Å:"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 J5e(t,e){_o[t]=e}function NN(t,e,n){if(!_o[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=_o[e][r];if(!s&&t[0]in dR&&(r=dR[t[0]].charCodeAt(0),s=_o[e][r]),!s&&n==="text"&&XV(r)&&(s=_o[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var VS={};function e3e(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!VS[e]){var n=VS[e]={cssEmPerMu:A1.quad[e]/18};for(var r in A1)A1.hasOwnProperty(r)&&(n[r]=A1[r][e])}return VS[e]}var t3e=[[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]],hR=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],fR=function(e,n){return n.size<2?e:t3e[e-1][n.size-1]};class Tl{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||Tl.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=hR[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new Tl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:fR(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:hR[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=fR(Tl.BASESIZE,e);return this.size===n&&this.textSize===Tl.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Tl.BASESIZE?["sizing","reset-size"+this.size,"size"+Tl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=e3e(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Tl.BASESIZE=6;var BO={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},n3e={ex:!0,em:!0,mu:!0},YV=function(e){return typeof e!="string"&&(e=e.unit),e in BO||e in n3e||e==="ex"},Rr=function(e,n){var r;if(e.unit in BO)r=BO[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 $e("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Xe=function(e){return+e.toFixed(4)+"em"},eu=function(e){return e.filter(n=>n).join(" ")},KV=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)}},ZV=function(e){var n=document.createElement(e);n.className=eu(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]/,JV=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+$n.escape(eu(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=$n.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+$n.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(r3e.test(i))throw new $e("Invalid attribute name '"+i+"'");n+=" "+i+'="'+$n.escape(this.attributes[i])+'"'}n+=">";for(var a=0;a",n};class pg{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,KV.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return ZV.call(this,"span")}toMarkup(){return JV.call(this,"span")}}class CN{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,KV.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 ZV.call(this,"a")}toMarkup(){return JV.call(this,"a")}}class s3e{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=''+$n.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Xe(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=eu(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+=$n.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+$n.escape(r)+'"');var i=$n.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class Ql{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 FO{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 o3e={bin:1,close:1,inner:1,open:1,punct:1,rel:1},l3e={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},dr={math:{},text:{}};function M(t,e,n,r,s,i){dr[t][s]={font:e,group:n,replace:r},i&&r&&(dr[t][r]=dr[t][s])}var D="math",Be="text",H="main",le="ams",jr="accent-token",lt="bin",ai="close",qf="inner",Tt="mathord",os="op-token",Ji="open",qb="punct",ce="rel",Zl="spacing",me="textord";M(D,H,ce,"≡","\\equiv",!0);M(D,H,ce,"≺","\\prec",!0);M(D,H,ce,"≻","\\succ",!0);M(D,H,ce,"∼","\\sim",!0);M(D,H,ce,"⊥","\\perp");M(D,H,ce,"⪯","\\preceq",!0);M(D,H,ce,"⪰","\\succeq",!0);M(D,H,ce,"≃","\\simeq",!0);M(D,H,ce,"∣","\\mid",!0);M(D,H,ce,"≪","\\ll",!0);M(D,H,ce,"≫","\\gg",!0);M(D,H,ce,"≍","\\asymp",!0);M(D,H,ce,"∥","\\parallel");M(D,H,ce,"⋈","\\bowtie",!0);M(D,H,ce,"⌣","\\smile",!0);M(D,H,ce,"⊑","\\sqsubseteq",!0);M(D,H,ce,"⊒","\\sqsupseteq",!0);M(D,H,ce,"≐","\\doteq",!0);M(D,H,ce,"⌢","\\frown",!0);M(D,H,ce,"∋","\\ni",!0);M(D,H,ce,"∝","\\propto",!0);M(D,H,ce,"⊢","\\vdash",!0);M(D,H,ce,"⊣","\\dashv",!0);M(D,H,ce,"∋","\\owns");M(D,H,qb,".","\\ldotp");M(D,H,qb,"⋅","\\cdotp");M(D,H,me,"#","\\#");M(Be,H,me,"#","\\#");M(D,H,me,"&","\\&");M(Be,H,me,"&","\\&");M(D,H,me,"ℵ","\\aleph",!0);M(D,H,me,"∀","\\forall",!0);M(D,H,me,"ℏ","\\hbar",!0);M(D,H,me,"∃","\\exists",!0);M(D,H,me,"∇","\\nabla",!0);M(D,H,me,"♭","\\flat",!0);M(D,H,me,"ℓ","\\ell",!0);M(D,H,me,"♮","\\natural",!0);M(D,H,me,"♣","\\clubsuit",!0);M(D,H,me,"℘","\\wp",!0);M(D,H,me,"♯","\\sharp",!0);M(D,H,me,"♢","\\diamondsuit",!0);M(D,H,me,"ℜ","\\Re",!0);M(D,H,me,"♡","\\heartsuit",!0);M(D,H,me,"ℑ","\\Im",!0);M(D,H,me,"♠","\\spadesuit",!0);M(D,H,me,"§","\\S",!0);M(Be,H,me,"§","\\S");M(D,H,me,"¶","\\P",!0);M(Be,H,me,"¶","\\P");M(D,H,me,"†","\\dag");M(Be,H,me,"†","\\dag");M(Be,H,me,"†","\\textdagger");M(D,H,me,"‡","\\ddag");M(Be,H,me,"‡","\\ddag");M(Be,H,me,"‡","\\textdaggerdbl");M(D,H,ai,"⎱","\\rmoustache",!0);M(D,H,Ji,"⎰","\\lmoustache",!0);M(D,H,ai,"⟯","\\rgroup",!0);M(D,H,Ji,"⟮","\\lgroup",!0);M(D,H,lt,"∓","\\mp",!0);M(D,H,lt,"⊖","\\ominus",!0);M(D,H,lt,"⊎","\\uplus",!0);M(D,H,lt,"⊓","\\sqcap",!0);M(D,H,lt,"∗","\\ast");M(D,H,lt,"⊔","\\sqcup",!0);M(D,H,lt,"◯","\\bigcirc",!0);M(D,H,lt,"∙","\\bullet",!0);M(D,H,lt,"‡","\\ddagger");M(D,H,lt,"≀","\\wr",!0);M(D,H,lt,"⨿","\\amalg");M(D,H,lt,"&","\\And");M(D,H,ce,"⟵","\\longleftarrow",!0);M(D,H,ce,"⇐","\\Leftarrow",!0);M(D,H,ce,"⟸","\\Longleftarrow",!0);M(D,H,ce,"⟶","\\longrightarrow",!0);M(D,H,ce,"⇒","\\Rightarrow",!0);M(D,H,ce,"⟹","\\Longrightarrow",!0);M(D,H,ce,"↔","\\leftrightarrow",!0);M(D,H,ce,"⟷","\\longleftrightarrow",!0);M(D,H,ce,"⇔","\\Leftrightarrow",!0);M(D,H,ce,"⟺","\\Longleftrightarrow",!0);M(D,H,ce,"↦","\\mapsto",!0);M(D,H,ce,"⟼","\\longmapsto",!0);M(D,H,ce,"↗","\\nearrow",!0);M(D,H,ce,"↩","\\hookleftarrow",!0);M(D,H,ce,"↪","\\hookrightarrow",!0);M(D,H,ce,"↘","\\searrow",!0);M(D,H,ce,"↼","\\leftharpoonup",!0);M(D,H,ce,"⇀","\\rightharpoonup",!0);M(D,H,ce,"↙","\\swarrow",!0);M(D,H,ce,"↽","\\leftharpoondown",!0);M(D,H,ce,"⇁","\\rightharpoondown",!0);M(D,H,ce,"↖","\\nwarrow",!0);M(D,H,ce,"⇌","\\rightleftharpoons",!0);M(D,le,ce,"≮","\\nless",!0);M(D,le,ce,"","\\@nleqslant");M(D,le,ce,"","\\@nleqq");M(D,le,ce,"⪇","\\lneq",!0);M(D,le,ce,"≨","\\lneqq",!0);M(D,le,ce,"","\\@lvertneqq");M(D,le,ce,"⋦","\\lnsim",!0);M(D,le,ce,"⪉","\\lnapprox",!0);M(D,le,ce,"⊀","\\nprec",!0);M(D,le,ce,"⋠","\\npreceq",!0);M(D,le,ce,"⋨","\\precnsim",!0);M(D,le,ce,"⪹","\\precnapprox",!0);M(D,le,ce,"≁","\\nsim",!0);M(D,le,ce,"","\\@nshortmid");M(D,le,ce,"∤","\\nmid",!0);M(D,le,ce,"⊬","\\nvdash",!0);M(D,le,ce,"⊭","\\nvDash",!0);M(D,le,ce,"⋪","\\ntriangleleft");M(D,le,ce,"⋬","\\ntrianglelefteq",!0);M(D,le,ce,"⊊","\\subsetneq",!0);M(D,le,ce,"","\\@varsubsetneq");M(D,le,ce,"⫋","\\subsetneqq",!0);M(D,le,ce,"","\\@varsubsetneqq");M(D,le,ce,"≯","\\ngtr",!0);M(D,le,ce,"","\\@ngeqslant");M(D,le,ce,"","\\@ngeqq");M(D,le,ce,"⪈","\\gneq",!0);M(D,le,ce,"≩","\\gneqq",!0);M(D,le,ce,"","\\@gvertneqq");M(D,le,ce,"⋧","\\gnsim",!0);M(D,le,ce,"⪊","\\gnapprox",!0);M(D,le,ce,"⊁","\\nsucc",!0);M(D,le,ce,"⋡","\\nsucceq",!0);M(D,le,ce,"⋩","\\succnsim",!0);M(D,le,ce,"⪺","\\succnapprox",!0);M(D,le,ce,"≆","\\ncong",!0);M(D,le,ce,"","\\@nshortparallel");M(D,le,ce,"∦","\\nparallel",!0);M(D,le,ce,"⊯","\\nVDash",!0);M(D,le,ce,"⋫","\\ntriangleright");M(D,le,ce,"⋭","\\ntrianglerighteq",!0);M(D,le,ce,"","\\@nsupseteqq");M(D,le,ce,"⊋","\\supsetneq",!0);M(D,le,ce,"","\\@varsupsetneq");M(D,le,ce,"⫌","\\supsetneqq",!0);M(D,le,ce,"","\\@varsupsetneqq");M(D,le,ce,"⊮","\\nVdash",!0);M(D,le,ce,"⪵","\\precneqq",!0);M(D,le,ce,"⪶","\\succneqq",!0);M(D,le,ce,"","\\@nsubseteqq");M(D,le,lt,"⊴","\\unlhd");M(D,le,lt,"⊵","\\unrhd");M(D,le,ce,"↚","\\nleftarrow",!0);M(D,le,ce,"↛","\\nrightarrow",!0);M(D,le,ce,"⇍","\\nLeftarrow",!0);M(D,le,ce,"⇏","\\nRightarrow",!0);M(D,le,ce,"↮","\\nleftrightarrow",!0);M(D,le,ce,"⇎","\\nLeftrightarrow",!0);M(D,le,ce,"△","\\vartriangle");M(D,le,me,"ℏ","\\hslash");M(D,le,me,"▽","\\triangledown");M(D,le,me,"◊","\\lozenge");M(D,le,me,"Ⓢ","\\circledS");M(D,le,me,"®","\\circledR");M(Be,le,me,"®","\\circledR");M(D,le,me,"∡","\\measuredangle",!0);M(D,le,me,"∄","\\nexists");M(D,le,me,"℧","\\mho");M(D,le,me,"Ⅎ","\\Finv",!0);M(D,le,me,"⅁","\\Game",!0);M(D,le,me,"‵","\\backprime");M(D,le,me,"▲","\\blacktriangle");M(D,le,me,"▼","\\blacktriangledown");M(D,le,me,"■","\\blacksquare");M(D,le,me,"⧫","\\blacklozenge");M(D,le,me,"★","\\bigstar");M(D,le,me,"∢","\\sphericalangle",!0);M(D,le,me,"∁","\\complement",!0);M(D,le,me,"ð","\\eth",!0);M(Be,H,me,"ð","ð");M(D,le,me,"╱","\\diagup");M(D,le,me,"╲","\\diagdown");M(D,le,me,"□","\\square");M(D,le,me,"□","\\Box");M(D,le,me,"◊","\\Diamond");M(D,le,me,"¥","\\yen",!0);M(Be,le,me,"¥","\\yen",!0);M(D,le,me,"✓","\\checkmark",!0);M(Be,le,me,"✓","\\checkmark");M(D,le,me,"ℶ","\\beth",!0);M(D,le,me,"ℸ","\\daleth",!0);M(D,le,me,"ℷ","\\gimel",!0);M(D,le,me,"ϝ","\\digamma",!0);M(D,le,me,"ϰ","\\varkappa");M(D,le,Ji,"┌","\\@ulcorner",!0);M(D,le,ai,"┐","\\@urcorner",!0);M(D,le,Ji,"└","\\@llcorner",!0);M(D,le,ai,"┘","\\@lrcorner",!0);M(D,le,ce,"≦","\\leqq",!0);M(D,le,ce,"⩽","\\leqslant",!0);M(D,le,ce,"⪕","\\eqslantless",!0);M(D,le,ce,"≲","\\lesssim",!0);M(D,le,ce,"⪅","\\lessapprox",!0);M(D,le,ce,"≊","\\approxeq",!0);M(D,le,lt,"⋖","\\lessdot");M(D,le,ce,"⋘","\\lll",!0);M(D,le,ce,"≶","\\lessgtr",!0);M(D,le,ce,"⋚","\\lesseqgtr",!0);M(D,le,ce,"⪋","\\lesseqqgtr",!0);M(D,le,ce,"≑","\\doteqdot");M(D,le,ce,"≓","\\risingdotseq",!0);M(D,le,ce,"≒","\\fallingdotseq",!0);M(D,le,ce,"∽","\\backsim",!0);M(D,le,ce,"⋍","\\backsimeq",!0);M(D,le,ce,"⫅","\\subseteqq",!0);M(D,le,ce,"⋐","\\Subset",!0);M(D,le,ce,"⊏","\\sqsubset",!0);M(D,le,ce,"≼","\\preccurlyeq",!0);M(D,le,ce,"⋞","\\curlyeqprec",!0);M(D,le,ce,"≾","\\precsim",!0);M(D,le,ce,"⪷","\\precapprox",!0);M(D,le,ce,"⊲","\\vartriangleleft");M(D,le,ce,"⊴","\\trianglelefteq");M(D,le,ce,"⊨","\\vDash",!0);M(D,le,ce,"⊪","\\Vvdash",!0);M(D,le,ce,"⌣","\\smallsmile");M(D,le,ce,"⌢","\\smallfrown");M(D,le,ce,"≏","\\bumpeq",!0);M(D,le,ce,"≎","\\Bumpeq",!0);M(D,le,ce,"≧","\\geqq",!0);M(D,le,ce,"⩾","\\geqslant",!0);M(D,le,ce,"⪖","\\eqslantgtr",!0);M(D,le,ce,"≳","\\gtrsim",!0);M(D,le,ce,"⪆","\\gtrapprox",!0);M(D,le,lt,"⋗","\\gtrdot");M(D,le,ce,"⋙","\\ggg",!0);M(D,le,ce,"≷","\\gtrless",!0);M(D,le,ce,"⋛","\\gtreqless",!0);M(D,le,ce,"⪌","\\gtreqqless",!0);M(D,le,ce,"≖","\\eqcirc",!0);M(D,le,ce,"≗","\\circeq",!0);M(D,le,ce,"≜","\\triangleq",!0);M(D,le,ce,"∼","\\thicksim");M(D,le,ce,"≈","\\thickapprox");M(D,le,ce,"⫆","\\supseteqq",!0);M(D,le,ce,"⋑","\\Supset",!0);M(D,le,ce,"⊐","\\sqsupset",!0);M(D,le,ce,"≽","\\succcurlyeq",!0);M(D,le,ce,"⋟","\\curlyeqsucc",!0);M(D,le,ce,"≿","\\succsim",!0);M(D,le,ce,"⪸","\\succapprox",!0);M(D,le,ce,"⊳","\\vartriangleright");M(D,le,ce,"⊵","\\trianglerighteq");M(D,le,ce,"⊩","\\Vdash",!0);M(D,le,ce,"∣","\\shortmid");M(D,le,ce,"∥","\\shortparallel");M(D,le,ce,"≬","\\between",!0);M(D,le,ce,"⋔","\\pitchfork",!0);M(D,le,ce,"∝","\\varpropto");M(D,le,ce,"◀","\\blacktriangleleft");M(D,le,ce,"∴","\\therefore",!0);M(D,le,ce,"∍","\\backepsilon");M(D,le,ce,"▶","\\blacktriangleright");M(D,le,ce,"∵","\\because",!0);M(D,le,ce,"⋘","\\llless");M(D,le,ce,"⋙","\\gggtr");M(D,le,lt,"⊲","\\lhd");M(D,le,lt,"⊳","\\rhd");M(D,le,ce,"≂","\\eqsim",!0);M(D,H,ce,"⋈","\\Join");M(D,le,ce,"≑","\\Doteq",!0);M(D,le,lt,"∔","\\dotplus",!0);M(D,le,lt,"∖","\\smallsetminus");M(D,le,lt,"⋒","\\Cap",!0);M(D,le,lt,"⋓","\\Cup",!0);M(D,le,lt,"⩞","\\doublebarwedge",!0);M(D,le,lt,"⊟","\\boxminus",!0);M(D,le,lt,"⊞","\\boxplus",!0);M(D,le,lt,"⋇","\\divideontimes",!0);M(D,le,lt,"⋉","\\ltimes",!0);M(D,le,lt,"⋊","\\rtimes",!0);M(D,le,lt,"⋋","\\leftthreetimes",!0);M(D,le,lt,"⋌","\\rightthreetimes",!0);M(D,le,lt,"⋏","\\curlywedge",!0);M(D,le,lt,"⋎","\\curlyvee",!0);M(D,le,lt,"⊝","\\circleddash",!0);M(D,le,lt,"⊛","\\circledast",!0);M(D,le,lt,"⋅","\\centerdot");M(D,le,lt,"⊺","\\intercal",!0);M(D,le,lt,"⋒","\\doublecap");M(D,le,lt,"⋓","\\doublecup");M(D,le,lt,"⊠","\\boxtimes",!0);M(D,le,ce,"⇢","\\dashrightarrow",!0);M(D,le,ce,"⇠","\\dashleftarrow",!0);M(D,le,ce,"⇇","\\leftleftarrows",!0);M(D,le,ce,"⇆","\\leftrightarrows",!0);M(D,le,ce,"⇚","\\Lleftarrow",!0);M(D,le,ce,"↞","\\twoheadleftarrow",!0);M(D,le,ce,"↢","\\leftarrowtail",!0);M(D,le,ce,"↫","\\looparrowleft",!0);M(D,le,ce,"⇋","\\leftrightharpoons",!0);M(D,le,ce,"↶","\\curvearrowleft",!0);M(D,le,ce,"↺","\\circlearrowleft",!0);M(D,le,ce,"↰","\\Lsh",!0);M(D,le,ce,"⇈","\\upuparrows",!0);M(D,le,ce,"↿","\\upharpoonleft",!0);M(D,le,ce,"⇃","\\downharpoonleft",!0);M(D,H,ce,"⊶","\\origof",!0);M(D,H,ce,"⊷","\\imageof",!0);M(D,le,ce,"⊸","\\multimap",!0);M(D,le,ce,"↭","\\leftrightsquigarrow",!0);M(D,le,ce,"⇉","\\rightrightarrows",!0);M(D,le,ce,"⇄","\\rightleftarrows",!0);M(D,le,ce,"↠","\\twoheadrightarrow",!0);M(D,le,ce,"↣","\\rightarrowtail",!0);M(D,le,ce,"↬","\\looparrowright",!0);M(D,le,ce,"↷","\\curvearrowright",!0);M(D,le,ce,"↻","\\circlearrowright",!0);M(D,le,ce,"↱","\\Rsh",!0);M(D,le,ce,"⇊","\\downdownarrows",!0);M(D,le,ce,"↾","\\upharpoonright",!0);M(D,le,ce,"⇂","\\downharpoonright",!0);M(D,le,ce,"⇝","\\rightsquigarrow",!0);M(D,le,ce,"⇝","\\leadsto");M(D,le,ce,"⇛","\\Rrightarrow",!0);M(D,le,ce,"↾","\\restriction");M(D,H,me,"‘","`");M(D,H,me,"$","\\$");M(Be,H,me,"$","\\$");M(Be,H,me,"$","\\textdollar");M(D,H,me,"%","\\%");M(Be,H,me,"%","\\%");M(D,H,me,"_","\\_");M(Be,H,me,"_","\\_");M(Be,H,me,"_","\\textunderscore");M(D,H,me,"∠","\\angle",!0);M(D,H,me,"∞","\\infty",!0);M(D,H,me,"′","\\prime");M(D,H,me,"△","\\triangle");M(D,H,me,"Γ","\\Gamma",!0);M(D,H,me,"Δ","\\Delta",!0);M(D,H,me,"Θ","\\Theta",!0);M(D,H,me,"Λ","\\Lambda",!0);M(D,H,me,"Ξ","\\Xi",!0);M(D,H,me,"Π","\\Pi",!0);M(D,H,me,"Σ","\\Sigma",!0);M(D,H,me,"Υ","\\Upsilon",!0);M(D,H,me,"Φ","\\Phi",!0);M(D,H,me,"Ψ","\\Psi",!0);M(D,H,me,"Ω","\\Omega",!0);M(D,H,me,"A","Α");M(D,H,me,"B","Β");M(D,H,me,"E","Ε");M(D,H,me,"Z","Ζ");M(D,H,me,"H","Η");M(D,H,me,"I","Ι");M(D,H,me,"K","Κ");M(D,H,me,"M","Μ");M(D,H,me,"N","Ν");M(D,H,me,"O","Ο");M(D,H,me,"P","Ρ");M(D,H,me,"T","Τ");M(D,H,me,"X","Χ");M(D,H,me,"¬","\\neg",!0);M(D,H,me,"¬","\\lnot");M(D,H,me,"⊤","\\top");M(D,H,me,"⊥","\\bot");M(D,H,me,"∅","\\emptyset");M(D,le,me,"∅","\\varnothing");M(D,H,Tt,"α","\\alpha",!0);M(D,H,Tt,"β","\\beta",!0);M(D,H,Tt,"γ","\\gamma",!0);M(D,H,Tt,"δ","\\delta",!0);M(D,H,Tt,"ϵ","\\epsilon",!0);M(D,H,Tt,"ζ","\\zeta",!0);M(D,H,Tt,"η","\\eta",!0);M(D,H,Tt,"θ","\\theta",!0);M(D,H,Tt,"ι","\\iota",!0);M(D,H,Tt,"κ","\\kappa",!0);M(D,H,Tt,"λ","\\lambda",!0);M(D,H,Tt,"μ","\\mu",!0);M(D,H,Tt,"ν","\\nu",!0);M(D,H,Tt,"ξ","\\xi",!0);M(D,H,Tt,"ο","\\omicron",!0);M(D,H,Tt,"π","\\pi",!0);M(D,H,Tt,"ρ","\\rho",!0);M(D,H,Tt,"σ","\\sigma",!0);M(D,H,Tt,"τ","\\tau",!0);M(D,H,Tt,"υ","\\upsilon",!0);M(D,H,Tt,"ϕ","\\phi",!0);M(D,H,Tt,"χ","\\chi",!0);M(D,H,Tt,"ψ","\\psi",!0);M(D,H,Tt,"ω","\\omega",!0);M(D,H,Tt,"ε","\\varepsilon",!0);M(D,H,Tt,"ϑ","\\vartheta",!0);M(D,H,Tt,"ϖ","\\varpi",!0);M(D,H,Tt,"ϱ","\\varrho",!0);M(D,H,Tt,"ς","\\varsigma",!0);M(D,H,Tt,"φ","\\varphi",!0);M(D,H,lt,"∗","*",!0);M(D,H,lt,"+","+");M(D,H,lt,"−","-",!0);M(D,H,lt,"⋅","\\cdot",!0);M(D,H,lt,"∘","\\circ",!0);M(D,H,lt,"÷","\\div",!0);M(D,H,lt,"±","\\pm",!0);M(D,H,lt,"×","\\times",!0);M(D,H,lt,"∩","\\cap",!0);M(D,H,lt,"∪","\\cup",!0);M(D,H,lt,"∖","\\setminus",!0);M(D,H,lt,"∧","\\land");M(D,H,lt,"∨","\\lor");M(D,H,lt,"∧","\\wedge",!0);M(D,H,lt,"∨","\\vee",!0);M(D,H,me,"√","\\surd");M(D,H,Ji,"⟨","\\langle",!0);M(D,H,Ji,"∣","\\lvert");M(D,H,Ji,"∥","\\lVert");M(D,H,ai,"?","?");M(D,H,ai,"!","!");M(D,H,ai,"⟩","\\rangle",!0);M(D,H,ai,"∣","\\rvert");M(D,H,ai,"∥","\\rVert");M(D,H,ce,"=","=");M(D,H,ce,":",":");M(D,H,ce,"≈","\\approx",!0);M(D,H,ce,"≅","\\cong",!0);M(D,H,ce,"≥","\\ge");M(D,H,ce,"≥","\\geq",!0);M(D,H,ce,"←","\\gets");M(D,H,ce,">","\\gt",!0);M(D,H,ce,"∈","\\in",!0);M(D,H,ce,"","\\@not");M(D,H,ce,"⊂","\\subset",!0);M(D,H,ce,"⊃","\\supset",!0);M(D,H,ce,"⊆","\\subseteq",!0);M(D,H,ce,"⊇","\\supseteq",!0);M(D,le,ce,"⊈","\\nsubseteq",!0);M(D,le,ce,"⊉","\\nsupseteq",!0);M(D,H,ce,"⊨","\\models");M(D,H,ce,"←","\\leftarrow",!0);M(D,H,ce,"≤","\\le");M(D,H,ce,"≤","\\leq",!0);M(D,H,ce,"<","\\lt",!0);M(D,H,ce,"→","\\rightarrow",!0);M(D,H,ce,"→","\\to");M(D,le,ce,"≱","\\ngeq",!0);M(D,le,ce,"≰","\\nleq",!0);M(D,H,Zl," ","\\ ");M(D,H,Zl," ","\\space");M(D,H,Zl," ","\\nobreakspace");M(Be,H,Zl," ","\\ ");M(Be,H,Zl," "," ");M(Be,H,Zl," ","\\space");M(Be,H,Zl," ","\\nobreakspace");M(D,H,Zl,null,"\\nobreak");M(D,H,Zl,null,"\\allowbreak");M(D,H,qb,",",",");M(D,H,qb,";",";");M(D,le,lt,"⊼","\\barwedge",!0);M(D,le,lt,"⊻","\\veebar",!0);M(D,H,lt,"⊙","\\odot",!0);M(D,H,lt,"⊕","\\oplus",!0);M(D,H,lt,"⊗","\\otimes",!0);M(D,H,me,"∂","\\partial",!0);M(D,H,lt,"⊘","\\oslash",!0);M(D,le,lt,"⊚","\\circledcirc",!0);M(D,le,lt,"⊡","\\boxdot",!0);M(D,H,lt,"△","\\bigtriangleup");M(D,H,lt,"▽","\\bigtriangledown");M(D,H,lt,"†","\\dagger");M(D,H,lt,"⋄","\\diamond");M(D,H,lt,"⋆","\\star");M(D,H,lt,"◃","\\triangleleft");M(D,H,lt,"▹","\\triangleright");M(D,H,Ji,"{","\\{");M(Be,H,me,"{","\\{");M(Be,H,me,"{","\\textbraceleft");M(D,H,ai,"}","\\}");M(Be,H,me,"}","\\}");M(Be,H,me,"}","\\textbraceright");M(D,H,Ji,"{","\\lbrace");M(D,H,ai,"}","\\rbrace");M(D,H,Ji,"[","\\lbrack",!0);M(Be,H,me,"[","\\lbrack",!0);M(D,H,ai,"]","\\rbrack",!0);M(Be,H,me,"]","\\rbrack",!0);M(D,H,Ji,"(","\\lparen",!0);M(D,H,ai,")","\\rparen",!0);M(Be,H,me,"<","\\textless",!0);M(Be,H,me,">","\\textgreater",!0);M(D,H,Ji,"⌊","\\lfloor",!0);M(D,H,ai,"⌋","\\rfloor",!0);M(D,H,Ji,"⌈","\\lceil",!0);M(D,H,ai,"⌉","\\rceil",!0);M(D,H,me,"\\","\\backslash");M(D,H,me,"∣","|");M(D,H,me,"∣","\\vert");M(Be,H,me,"|","\\textbar",!0);M(D,H,me,"∥","\\|");M(D,H,me,"∥","\\Vert");M(Be,H,me,"∥","\\textbardbl");M(Be,H,me,"~","\\textasciitilde");M(Be,H,me,"\\","\\textbackslash");M(Be,H,me,"^","\\textasciicircum");M(D,H,ce,"↑","\\uparrow",!0);M(D,H,ce,"⇑","\\Uparrow",!0);M(D,H,ce,"↓","\\downarrow",!0);M(D,H,ce,"⇓","\\Downarrow",!0);M(D,H,ce,"↕","\\updownarrow",!0);M(D,H,ce,"⇕","\\Updownarrow",!0);M(D,H,os,"∐","\\coprod");M(D,H,os,"⋁","\\bigvee");M(D,H,os,"⋀","\\bigwedge");M(D,H,os,"⨄","\\biguplus");M(D,H,os,"⋂","\\bigcap");M(D,H,os,"⋃","\\bigcup");M(D,H,os,"∫","\\int");M(D,H,os,"∫","\\intop");M(D,H,os,"∬","\\iint");M(D,H,os,"∭","\\iiint");M(D,H,os,"∏","\\prod");M(D,H,os,"∑","\\sum");M(D,H,os,"⨂","\\bigotimes");M(D,H,os,"⨁","\\bigoplus");M(D,H,os,"⨀","\\bigodot");M(D,H,os,"∮","\\oint");M(D,H,os,"∯","\\oiint");M(D,H,os,"∰","\\oiiint");M(D,H,os,"⨆","\\bigsqcup");M(D,H,os,"∫","\\smallint");M(Be,H,qf,"…","\\textellipsis");M(D,H,qf,"…","\\mathellipsis");M(Be,H,qf,"…","\\ldots",!0);M(D,H,qf,"…","\\ldots",!0);M(D,H,qf,"⋯","\\@cdots",!0);M(D,H,qf,"⋱","\\ddots",!0);M(D,H,me,"⋮","\\varvdots");M(Be,H,me,"⋮","\\varvdots");M(D,H,jr,"ˊ","\\acute");M(D,H,jr,"ˋ","\\grave");M(D,H,jr,"¨","\\ddot");M(D,H,jr,"~","\\tilde");M(D,H,jr,"ˉ","\\bar");M(D,H,jr,"˘","\\breve");M(D,H,jr,"ˇ","\\check");M(D,H,jr,"^","\\hat");M(D,H,jr,"⃗","\\vec");M(D,H,jr,"˙","\\dot");M(D,H,jr,"˚","\\mathring");M(D,H,Tt,"","\\@imath");M(D,H,Tt,"","\\@jmath");M(D,H,me,"ı","ı");M(D,H,me,"ȷ","ȷ");M(Be,H,me,"ı","\\i",!0);M(Be,H,me,"ȷ","\\j",!0);M(Be,H,me,"ß","\\ss",!0);M(Be,H,me,"æ","\\ae",!0);M(Be,H,me,"œ","\\oe",!0);M(Be,H,me,"ø","\\o",!0);M(Be,H,me,"Æ","\\AE",!0);M(Be,H,me,"Œ","\\OE",!0);M(Be,H,me,"Ø","\\O",!0);M(Be,H,jr,"ˊ","\\'");M(Be,H,jr,"ˋ","\\`");M(Be,H,jr,"ˆ","\\^");M(Be,H,jr,"˜","\\~");M(Be,H,jr,"ˉ","\\=");M(Be,H,jr,"˘","\\u");M(Be,H,jr,"˙","\\.");M(Be,H,jr,"¸","\\c");M(Be,H,jr,"˚","\\r");M(Be,H,jr,"ˇ","\\v");M(Be,H,jr,"¨",'\\"');M(Be,H,jr,"˝","\\H");M(Be,H,jr,"◯","\\textcircled");var eU={"--":!0,"---":!0,"``":!0,"''":!0};M(Be,H,me,"–","--",!0);M(Be,H,me,"–","\\textendash");M(Be,H,me,"—","---",!0);M(Be,H,me,"—","\\textemdash");M(Be,H,me,"‘","`",!0);M(Be,H,me,"‘","\\textquoteleft");M(Be,H,me,"’","'",!0);M(Be,H,me,"’","\\textquoteright");M(Be,H,me,"“","``",!0);M(Be,H,me,"“","\\textquotedblleft");M(Be,H,me,"”","''",!0);M(Be,H,me,"”","\\textquotedblright");M(D,H,me,"°","\\degree",!0);M(Be,H,me,"°","\\degree");M(Be,H,me,"°","\\textdegree",!0);M(D,H,me,"£","\\pounds");M(D,H,me,"£","\\mathsterling",!0);M(Be,H,me,"£","\\pounds");M(Be,H,me,"£","\\textsterling",!0);M(D,le,me,"✠","\\maltese");M(Be,le,me,"✠","\\maltese");var pR='0123456789/@."';for(var US=0;US0)return $a(i,d,s,n,a.concat(h));if(c){var m,g;if(c==="boldsymbol"){var x=d3e(i,s,n,a,r);m=x.fontName,g=[x.fontClass]}else l?(m=rU[c].fontName,g=[c]):(m=P1(c,n.fontWeight,n.fontShape),g=[c,n.fontWeight,n.fontShape]);if($b(i,m,s).metrics)return $a(i,m,s,n,a.concat(g));if(eU.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w{if(eu(t.classes)!==eu(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},m3e=t=>{for(var e=0;en&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},mi=function(e,n,r,s){var i=new pg(e,n,r,s);return TN(i),i},tU=(t,e,n,r)=>new pg(t,e,n,r),p3e=function(e,n,r){var s=mi([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Xe(s.height),s.maxFontSize=1,s},g3e=function(e,n,r,s){var i=new CN(e,n,r,s);return TN(i),i},nU=function(e){var n=new mg(e);return TN(n),n},x3e=function(e,n){return e instanceof mg?mi([],[e],n):e},v3e=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,a=1;a{var n=mi(["mspace"],[],e),r=Rr(t,e);return n.style.marginRight=Xe(r),n},P1=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},rU={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"}},sU={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},w3e=function(e,n){var[r,s,i]=sU[e],a=new tu(r),l=new Ql([a],{width:Xe(s),height:Xe(i),style:"width:"+Xe(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=tU(["overlay"],[l],n);return c.height=i,c.style.height=Xe(i),c.style.width=Xe(s),c},be={fontMap:rU,makeSymbol:$a,mathsym:u3e,makeSpan:mi,makeSvgSpan:tU,makeLineSpan:p3e,makeAnchor:g3e,makeFragment:nU,wrapFragment:x3e,makeVList:y3e,makeOrd:h3e,makeGlue:b3e,staticSvg:w3e,svgData:sU,tryCombineChars:m3e},_r={number:3,unit:"mu"},zu={number:4,unit:"mu"},yl={number:5,unit:"mu"},S3e={mord:{mop:_r,mbin:zu,mrel:yl,minner:_r},mop:{mord:_r,mop:_r,mrel:yl,minner:_r},mbin:{mord:zu,mop:zu,mopen:zu,minner:zu},mrel:{mord:yl,mop:yl,mopen:yl,minner:yl},mopen:{},mclose:{mop:_r,mbin:zu,mrel:yl,minner:_r},mpunct:{mord:_r,mop:_r,mrel:yl,mopen:_r,mclose:_r,mpunct:_r,minner:_r},minner:{mord:_r,mop:_r,mbin:zu,mrel:yl,mopen:_r,mpunct:_r,minner:_r}},k3e={mord:{mop:_r},mop:{mord:_r,mop:_r},mbin:{},mrel:{},mopen:{},mclose:{mop:_r},mpunct:{},minner:{mop:_r}},iU={},Oy={},jy={};function tt(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,l={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},c=0;c{var S=w.classes[0],k=y.classes[0];S==="mbin"&&j3e.includes(k)?w.classes[0]="mord":k==="mbin"&&O3e.includes(S)&&(y.classes[0]="mord")},{node:m},g,x),bR(i,(y,w)=>{var S=$O(w),k=$O(y),j=S&&k?y.hasClass("mtight")?k3e[S][k]:S3e[S][k]:null;if(j)return be.makeGlue(j,d)},{node:m},g,x),i},bR=function t(e,n,r,s,i){s&&e.push(s);for(var a=0;ag=>{e.splice(m+1,0,g),a++})(a)}s&&e.pop()},aU=function(e){return e instanceof mg||e instanceof CN||e instanceof pg&&e.hasClass("enclosing")?e:null},T3e=function t(e,n){var r=aU(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},$O=function(e,n){return e?(n&&(e=T3e(e,n)),C3e[e.classes[0]]||null):null},vp=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return Vl(n.concat(r))},Pn=function(e,n,r){if(!e)return Vl();if(Oy[e.type]){var s=Oy[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 $e("Got group of unknown type: '"+e.type+"'")};function z1(t,e){var n=Vl(["base"],t,e),r=Vl(["strut"]);return r.style.height=Xe(n.height+n.depth),n.depth&&(r.style.verticalAlign=Xe(-n.depth)),n.children.unshift(r),n}function HO(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=fs(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],l=0;l0&&(i.push(z1(a,e)),a=[]),i.push(r[l]));a.length>0&&i.push(z1(a,e));var d;n?(d=z1(fs(n,e,!0)),d.classes=["tag"],i.push(d)):s&&i.push(s);var h=Vl(["katex-html"],i);if(h.setAttribute("aria-hidden","true"),d){var m=d.children[0];m.style.height=Xe(h.height+h.depth),h.depth&&(m.style.verticalAlign=Xe(-h.depth))}return h}function oU(t){return new mg(t)}class Qi{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=eu(this.classes));for(var r=0;r0&&(e+=' class ="'+$n.escape(eu(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Ao{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return $n.escape(this.toText())}toText(){return this.text}}class E3e{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",Xe(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var qe={MathNode:Qi,TextNode:Ao,SpaceNode:E3e,newDocumentFragment:oU},Ma=function(e,n,r){return dr[n][e]&&dr[n][e].replace&&e.charCodeAt(0)!==55349&&!(eU.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=dr[n][e].replace),new qe.TextNode(e)},EN=function(e){return e.length===1?e[0]:new qe.MathNode("mrow",e)},_N=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;dr[s][i]&&dr[s][i].replace&&(i=dr[s][i].replace);var a=be.fontMap[r].fontName;return NN(i,a,s)?be.fontMap[r].variant:null};function YS(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Ao&&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 Ao&&n.text===","}else return!1}var _i=function(e,n,r){if(e.length===1){var s=lr(e[0],n);return r&&s instanceof Qi&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,l=0;l=1&&(a.type==="mn"||YS(a))){var d=c.children[0];d instanceof Qi&&d.type==="mn"&&(d.children=[...a.children,...d.children],i.pop())}else if(a.type==="mi"&&a.children.length===1){var h=a.children[0];if(h instanceof Ao&&h.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var m=c.children[0];m instanceof Ao&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),i.pop())}}}i.push(c),a=c}return i},nu=function(e,n,r){return EN(_i(e,n,r))},lr=function(e,n){if(!e)return new qe.MathNode("mrow");if(jy[e.type]){var r=jy[e.type](e,n);return r}else throw new $e("Got group of unknown type: '"+e.type+"'")};function wR(t,e,n,r,s){var i=_i(t,n),a;i.length===1&&i[0]instanceof Qi&&["mrow","mtable"].includes(i[0].type)?a=i[0]:a=new qe.MathNode("mrow",i);var l=new qe.MathNode("annotation",[new qe.TextNode(e)]);l.setAttribute("encoding","application/x-tex");var c=new qe.MathNode("semantics",[a,l]),d=new qe.MathNode("math",[c]);d.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&d.setAttribute("display","block");var h=s?"katex":"katex-mathml";return be.makeSpan([h],[d])}var lU=function(e){return new Tl({style:e.displayMode?Et.DISPLAY:Et.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},cU=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=be.makeSpan(r,[e])}return e},_3e=function(e,n,r){var s=lU(r),i;if(r.output==="mathml")return wR(e,n,s,r.displayMode,!0);if(r.output==="html"){var a=HO(e,s);i=be.makeSpan(["katex"],[a])}else{var l=wR(e,n,s,r.displayMode,!1),c=HO(e,s);i=be.makeSpan(["katex"],[l,c])}return cU(i,r)},A3e=function(e,n,r){var s=lU(r),i=HO(e,s),a=be.makeSpan(["katex"],[i]);return cU(a,r)},M3e={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":"="},R3e=function(e){var n=new qe.MathNode("mo",[new qe.TextNode(M3e[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},D3e={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]},P3e=function(e){return e.type==="ordgroup"?e.body.length:1},z3e=function(e,n){function r(){var l=4e5,c=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(c)){var d=e,h=P3e(d.base),m,g,x;if(h>5)c==="widehat"||c==="widecheck"?(m=420,l=2364,x=.42,g=c+"4"):(m=312,l=2340,x=.34,g="tilde4");else{var y=[1,1,2,2,3,3][h];c==="widehat"||c==="widecheck"?(l=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],x=[0,.24,.3,.3,.36,.42][y],g=c+y):(l=[0,600,1033,2339,2340][y],m=[0,260,286,306,312][y],x=[0,.26,.286,.3,.306,.34][y],g="tilde"+y)}var w=new tu(g),S=new Ql([w],{width:"100%",height:Xe(x),viewBox:"0 0 "+l+" "+m,preserveAspectRatio:"none"});return{span:be.makeSvgSpan([],[S],n),minWidth:0,height:x}}else{var k=[],j=D3e[c],[N,T,E]=j,_=E/1e3,A=N.length,L,P;if(A===1){var B=j[3];L=["hide-tail"],P=[B]}else if(A===2)L=["halfarrow-left","halfarrow-right"],P=["xMinYMin","xMaxYMin"];else if(A===3)L=["brace-left","brace-center","brace-right"],P=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+A+" children.");for(var $=0;$0&&(s.style.minWidth=Xe(i)),s},I3e=function(e,n,r,s,i){var a,l=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(a=be.makeSpan(["stretchy",n],[],i),n==="fbox"){var c=i.color&&i.getColor();c&&(a.style.borderColor=c)}}else{var d=[];/^[bx]cancel$/.test(n)&&d.push(new FO({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&d.push(new FO({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new Ql(d,{width:"100%",height:Xe(l)});a=be.makeSvgSpan([],[h],i)}return a.height=l,a.style.height=Xe(l),a},Ul={encloseSpan:I3e,mathMLnode:R3e,svgSpan:z3e};function en(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 AN(t){var e=Hb(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 Hb(t){return t&&(t.type==="atom"||l3e.hasOwnProperty(t.type))?t:null}var MN=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=en(t.base,"accent"),n=r.base,t.base=n,s=a3e(Pn(t,e)),t.base=r):(r=en(t,"accent"),n=r.base);var i=Pn(n,e.havingCrampedStyle()),a=r.isShifty&&$n.isCharacterBox(n),l=0;if(a){var c=$n.getBaseElem(n),d=Pn(c,e.havingCrampedStyle());l=mR(d).skew}var h=r.label==="\\c",m=h?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),g;if(r.isStretchy)g=Ul.svgSpan(r,e),g=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+Xe(2*l)+")",marginLeft:Xe(2*l)}:void 0}]},e);else{var x,y;r.label==="\\vec"?(x=be.staticSvg("vec",e),y=be.svgData.vec[1]):(x=be.makeOrd({mode:r.mode,text:r.label},e,"textord"),x=mR(x),x.italic=0,y=x.width,h&&(m+=x.depth)),g=be.makeSpan(["accent-body"],[x]);var w=r.label==="\\textcircled";w&&(g.classes.push("accent-full"),m=i.height);var S=l;w||(S-=y/2),g.style.left=Xe(S),r.label==="\\textcircled"&&(g.style.top=".2em"),g=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:g}]},e)}var k=be.makeSpan(["mord","accent"],[g],e);return s?(s.children[0]=k,s.height=Math.max(k.height,s.height),s.classes[0]="mord",s):k},uU=(t,e)=>{var n=t.isStretchy?Ul.mathMLnode(t.label):new qe.MathNode("mo",[Ma(t.label,t.mode)]),r=new qe.MathNode("mover",[lr(t.base,e),n]);return r.setAttribute("accent","true"),r},L3e=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));tt({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=Ny(e[0]),r=!L3e.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:MN,mathmlBuilder:uU});tt({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:MN,mathmlBuilder:uU});tt({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=Pn(t.base,e),r=Ul.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=be.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return be.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=Ul.mathMLnode(t.label),r=new qe.MathNode("munder",[lr(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var I1=t=>{var e=new qe.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};tt({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=be.wrapFragment(Pn(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var a;t.below&&(r=e.havingStyle(n.sub()),a=be.wrapFragment(Pn(t.below,r,e),e),a.classes.push(i+"-arrow-pad"));var l=Ul.svgSpan(t,e),c=-e.fontMetrics().axisHeight+.5*l.height,d=-e.fontMetrics().axisHeight-.5*l.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(d-=s.depth);var h;if(a){var m=-e.fontMetrics().axisHeight+a.height+.5*l.height+.111;h=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:d},{type:"elem",elem:l,shift:c},{type:"elem",elem:a,shift:m}]},e)}else h=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:d},{type:"elem",elem:l,shift:c}]},e);return h.children[0].children[0].children[1].classes.push("svg-align"),be.makeSpan(["mrel","x-arrow"],[h],e)},mathmlBuilder(t,e){var n=Ul.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=I1(lr(t.body,e));if(t.below){var i=I1(lr(t.below,e));r=new qe.MathNode("munderover",[n,i,s])}else r=new qe.MathNode("mover",[n,s])}else if(t.below){var a=I1(lr(t.below,e));r=new qe.MathNode("munder",[n,a])}else r=I1(),r=new qe.MathNode("mover",[n,r]);return r}});var B3e=be.makeSpan;function dU(t,e){var n=fs(t.body,e,!0);return B3e([t.mclass],n,e)}function hU(t,e){var n,r=_i(t.body,e);return t.mclass==="minner"?n=new qe.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new qe.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new qe.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}tt({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:Qr(s),isCharacterBox:$n.isCharacterBox(s)}},htmlBuilder:dU,mathmlBuilder:hU});var Qb=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"};tt({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Qb(e[0]),body:Qr(e[1]),isCharacterBox:$n.isCharacterBox(e[1])}}});tt({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],a;r!=="\\stackrel"?a=Qb(s):a="mrel";var l={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Qr(s)},c={type:"supsub",mode:i.mode,base:l,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:a,body:[c],isCharacterBox:$n.isCharacterBox(c)}},htmlBuilder:dU,mathmlBuilder:hU});tt({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Qb(e[0]),body:Qr(e[0])}},htmlBuilder(t,e){var n=fs(t.body,e,!0),r=be.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=_i(t.body,e),r=new qe.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var F3e={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},SR=()=>({type:"styling",body:[],mode:"math",style:"display"}),kR=t=>t.type==="textord"&&t.text==="@",q3e=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function $3e(t,e,n){var r=F3e[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},a=n.callFunction("\\Big",[i],[]),l=n.callFunction("\\\\cdright",[e[1]],[]),c={type:"ordgroup",mode:"math",body:[s,a,l]};return n.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var d={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[d],[])}default:return{type:"textord",text:" ",mode:"math"}}}function H3e(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 $e("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(d)>-1)for(var m=0;m<2;m++){for(var g=!0,x=c+1;xAV=|." after @',a[c]);var y=$3e(d,h,t),w={type:"styling",body:[y],mode:"math",style:"display"};r.push(w),l=SR()}i%2===0?r.push(l):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var S=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:S,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}tt({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=be.wrapFragment(Pn(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Xe(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new qe.MathNode("mrow",[lr(t.label,e)]);return n=new qe.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new qe.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});tt({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=be.wrapFragment(Pn(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new qe.MathNode("mrow",[lr(t.fragment,e)])}});tt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=en(e[0],"ordgroup"),s=r.body,i="",a=0;a=1114111)throw new $e("\\@char with invalid code point "+i);return c<=65535?d=String.fromCharCode(c):(c-=65536,d=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:n.mode,text:d}}});var fU=(t,e)=>{var n=fs(t.body,e.withColor(t.color),!1);return be.makeFragment(n)},mU=(t,e)=>{var n=_i(t.body,e.withColor(t.color)),r=new qe.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};tt({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=en(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:Qr(s)}},htmlBuilder:fU,mathmlBuilder:mU});tt({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=en(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:fU,mathmlBuilder:mU});tt({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&&en(s,"size").value}},htmlBuilder(t,e){var n=be.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Xe(Rr(t.size,e)))),n},mathmlBuilder(t,e){var n=new qe.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Xe(Rr(t.size,e)))),n}});var QO={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},pU=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new $e("Expected a control sequence",t);return e},Q3e=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},gU=(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)};tt({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(QO[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=QO[r.text]),en(e.parseFunction(),"internal");throw new $e("Invalid token after macro prefix",r)}});tt({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 $e("Expected a control sequence",r);for(var i=0,a,l=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),l[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new $e('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new $e('Argument number "'+r.text+'" out of order');i++,l.push([])}else{if(r.text==="EOF")throw new $e("Expected a macro definition");l[i].push(r.text)}var{tokens:c}=e.gullet.consumeArg();return a&&c.unshift(a),(n==="\\edef"||n==="\\xdef")&&(c=e.gullet.expandTokens(c),c.reverse()),e.gullet.macros.set(s,{tokens:c,numArgs:i,delimiters:l},n===QO[n]),{type:"internal",mode:e.mode}}});tt({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=pU(e.gullet.popToken());e.gullet.consumeSpaces();var s=Q3e(e);return gU(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});tt({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=pU(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return gU(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var h0=function(e,n,r){var s=dr.math[e]&&dr.math[e].replace,i=NN(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},RN=function(e,n,r,s){var i=r.havingBaseStyle(n),a=be.makeSpan(s.concat(i.sizingClasses(r)),[e],r),l=i.sizeMultiplier/r.sizeMultiplier;return a.height*=l,a.depth*=l,a.maxFontSize=i.sizeMultiplier,a},xU=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=Xe(i),e.height-=i,e.depth+=i},V3e=function(e,n,r,s,i,a){var l=be.makeSymbol(e,"Main-Regular",i,s),c=RN(l,n,s,a);return r&&xU(c,s,n),c},U3e=function(e,n,r,s){return be.makeSymbol(e,"Size"+n+"-Regular",r,s)},vU=function(e,n,r,s,i,a){var l=U3e(e,n,i,s),c=RN(be.makeSpan(["delimsizing","size"+n],[l],s),Et.TEXT,s,a);return r&&xU(c,s,Et.TEXT),c},KS=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=be.makeSpan(["delimsizinginner",s],[be.makeSpan([],[be.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},ZS=function(e,n,r){var s=_o["Size4-Regular"][e.charCodeAt(0)]?_o["Size4-Regular"][e.charCodeAt(0)][4]:_o["Size1-Regular"][e.charCodeAt(0)][4],i=new tu("inner",K5e(e,Math.round(1e3*n))),a=new Ql([i],{width:Xe(s),height:Xe(n),style:"width:"+Xe(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),l=be.makeSvgSpan([],[a],r);return l.height=n,l.style.height=Xe(n),l.style.width=Xe(s),{type:"elem",elem:l}},VO=.008,L1={type:"kern",size:-1*VO},W3e=["|","\\lvert","\\rvert","\\vert"],G3e=["\\|","\\lVert","\\rVert","\\Vert"],yU=function(e,n,r,s,i,a){var l,c,d,h,m="",g=0;l=d=h=e,c=null;var x="Size1-Regular";e==="\\uparrow"?d=h="⏐":e==="\\Uparrow"?d=h="‖":e==="\\downarrow"?l=d="⏐":e==="\\Downarrow"?l=d="‖":e==="\\updownarrow"?(l="\\uparrow",d="⏐",h="\\downarrow"):e==="\\Updownarrow"?(l="\\Uparrow",d="‖",h="\\Downarrow"):W3e.includes(e)?(d="∣",m="vert",g=333):G3e.includes(e)?(d="∥",m="doublevert",g=556):e==="["||e==="\\lbrack"?(l="⎡",d="⎢",h="⎣",x="Size4-Regular",m="lbrack",g=667):e==="]"||e==="\\rbrack"?(l="⎤",d="⎥",h="⎦",x="Size4-Regular",m="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(d=l="⎢",h="⎣",x="Size4-Regular",m="lfloor",g=667):e==="\\lceil"||e==="⌈"?(l="⎡",d=h="⎢",x="Size4-Regular",m="lceil",g=667):e==="\\rfloor"||e==="⌋"?(d=l="⎥",h="⎦",x="Size4-Regular",m="rfloor",g=667):e==="\\rceil"||e==="⌉"?(l="⎤",d=h="⎥",x="Size4-Regular",m="rceil",g=667):e==="("||e==="\\lparen"?(l="⎛",d="⎜",h="⎝",x="Size4-Regular",m="lparen",g=875):e===")"||e==="\\rparen"?(l="⎞",d="⎟",h="⎠",x="Size4-Regular",m="rparen",g=875):e==="\\{"||e==="\\lbrace"?(l="⎧",c="⎨",h="⎩",d="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(l="⎫",c="⎬",h="⎭",d="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(l="⎧",h="⎩",d="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(l="⎫",h="⎭",d="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(l="⎧",h="⎭",d="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(l="⎫",h="⎩",d="⎪",x="Size4-Regular");var y=h0(l,x,i),w=y.height+y.depth,S=h0(d,x,i),k=S.height+S.depth,j=h0(h,x,i),N=j.height+j.depth,T=0,E=1;if(c!==null){var _=h0(c,x,i);T=_.height+_.depth,E=2}var A=w+N+T,L=Math.max(0,Math.ceil((n-A)/(E*k))),P=A+L*E*k,B=s.fontMetrics().axisHeight;r&&(B*=s.sizeMultiplier);var $=P/2-B,U=[];if(m.length>0){var te=P-w-N,z=Math.round(P*1e3),Q=Z5e(m,Math.round(te*1e3)),F=new tu(m,Q),Y=(g/1e3).toFixed(3)+"em",J=(z/1e3).toFixed(3)+"em",X=new Ql([F],{width:Y,height:J,viewBox:"0 0 "+g+" "+z}),R=be.makeSvgSpan([],[X],s);R.height=z/1e3,R.style.width=Y,R.style.height=J,U.push({type:"elem",elem:R})}else{if(U.push(KS(h,x,i)),U.push(L1),c===null){var ie=P-w-N+2*VO;U.push(ZS(d,ie,s))}else{var G=(P-w-N-T)/2+2*VO;U.push(ZS(d,G,s)),U.push(L1),U.push(KS(c,x,i)),U.push(L1),U.push(ZS(d,G,s))}U.push(L1),U.push(KS(l,x,i))}var I=s.havingBaseStyle(Et.TEXT),V=be.makeVList({positionType:"bottom",positionData:$,children:U},I);return RN(be.makeSpan(["delimsizing","mult"],[V],I),Et.TEXT,s,a)},JS=80,e5=.08,t5=function(e,n,r,s,i){var a=Y5e(e,s,r),l=new tu(e,a),c=new Ql([l],{width:"400em",height:Xe(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return be.makeSvgSpan(["hide-tail"],[c],i)},X3e=function(e,n){var r=n.havingBaseSizing(),s=kU("\\surd",e*r.sizeMultiplier,SU,r),i=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),l,c=0,d=0,h=0,m;return s.type==="small"?(h=1e3+1e3*a+JS,e<1?i=1:e<1.4&&(i=.7),c=(1+a+e5)/i,d=(1+a)/i,l=t5("sqrtMain",c,h,a,n),l.style.minWidth="0.853em",m=.833/i):s.type==="large"?(h=(1e3+JS)*R0[s.size],d=(R0[s.size]+a)/i,c=(R0[s.size]+a+e5)/i,l=t5("sqrtSize"+s.size,c,h,a,n),l.style.minWidth="1.02em",m=1/i):(c=e+a+e5,d=e+a,h=Math.floor(1e3*e+a)+JS,l=t5("sqrtTall",c,h,a,n),l.style.minWidth="0.742em",m=1.056),l.height=d,l.style.height=Xe(c),{span:l,advanceWidth:m,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*i}},bU=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Y3e=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],wU=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],R0=[0,1.2,1.8,2.4,3],K3e=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),bU.includes(e)||wU.includes(e))return vU(e,n,!1,r,s,i);if(Y3e.includes(e))return yU(e,R0[n],!1,r,s,i);throw new $e("Illegal delimiter: '"+e+"'")},Z3e=[{type:"small",style:Et.SCRIPTSCRIPT},{type:"small",style:Et.SCRIPT},{type:"small",style:Et.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],J3e=[{type:"small",style:Et.SCRIPTSCRIPT},{type:"small",style:Et.SCRIPT},{type:"small",style:Et.TEXT},{type:"stack"}],SU=[{type:"small",style:Et.SCRIPTSCRIPT},{type:"small",style:Et.SCRIPT},{type:"small",style:Et.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],eke=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.")},kU=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),a=i;an)return r[a]}return r[r.length-1]},OU=function(e,n,r,s,i,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var l;wU.includes(e)?l=Z3e:bU.includes(e)?l=SU:l=J3e;var c=kU(e,n,l,s);return c.type==="small"?V3e(e,c.style,r,s,i,a):c.type==="large"?vU(e,c.size,r,s,i,a):yU(e,n,r,s,i,a)},tke=function(e,n,r,s,i,a){var l=s.fontMetrics().axisHeight*s.sizeMultiplier,c=901,d=5/s.fontMetrics().ptPerEm,h=Math.max(n-l,r+l),m=Math.max(h/500*c,2*h-d);return OU(e,m,!0,s,i,a)},Bl={sqrtImage:X3e,sizedDelim:K3e,sizeToMaxHeight:R0,customSizedDelim:OU,leftRightDelim:tke},OR={"\\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}},nke=["(","\\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 Vb(t,e){var n=Hb(t);if(n&&nke.includes(n.text))return n;throw n?new $e("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new $e("Invalid delimiter type '"+t.type+"'",t)}tt({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=Vb(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:OR[t.funcName].size,mclass:OR[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?be.makeSpan([t.mclass]):Bl.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Ma(t.delim,t.mode));var n=new qe.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Xe(Bl.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function jR(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}tt({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 $e("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Vb(e[0],t).text,color:n}}});tt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Vb(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=en(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{jR(t);for(var n=fs(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a{jR(t);var n=_i(t.body,e);if(t.left!=="."){var r=new qe.MathNode("mo",[Ma(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new qe.MathNode("mo",[Ma(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return EN(n)}});tt({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Vb(e[0],t);if(!t.parser.leftrightDepth)throw new $e("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=vp(e,[]);else{n=Bl.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==="|"?Ma("|","text"):Ma(t.delim,t.mode),r=new qe.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var DN=(t,e)=>{var n=be.wrapFragment(Pn(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,a=0,l=$n.isCharacterBox(t.body);if(r==="sout")i=be.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,a=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var c=Rr({number:.6,unit:"pt"},e),d=Rr({number:.35,unit:"ex"},e),h=e.havingBaseSizing();s=s/h.sizeMultiplier;var m=n.height+n.depth+c+d;n.style.paddingLeft=Xe(m/2+c);var g=Math.floor(1e3*m*s),x=G5e(g),y=new Ql([new tu("phase",x)],{width:"400em",height:Xe(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});i=be.makeSvgSpan(["hide-tail"],[y],e),i.style.height=Xe(m),a=n.depth+c+d}else{/cancel/.test(r)?l||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var w=0,S=0,k=0;/box/.test(r)?(k=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),w=e.fontMetrics().fboxsep+(r==="colorbox"?0:k),S=w):r==="angl"?(k=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),w=4*k,S=Math.max(0,.25-n.depth)):(w=l?.2:0,S=w),i=Ul.encloseSpan(n,r,w,S,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Xe(k)):r==="angl"&&k!==.049&&(i.style.borderTopWidth=Xe(k),i.style.borderRightWidth=Xe(k)),a=n.depth+S,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var j;if(t.backgroundColor)j=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:a},{type:"elem",elem:n,shift:0}]},e);else{var N=/cancel|phase/.test(r)?["svg-align"]:[];j=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:a,wrapperClasses:N}]},e)}return/cancel/.test(r)&&(j.height=n.height,j.depth=n.depth),/cancel/.test(r)&&!l?be.makeSpan(["mord","cancel-lap"],[j],e):be.makeSpan(["mord"],[j],e)},PN=(t,e)=>{var n=0,r=new qe.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[lr(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};tt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=en(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:DN,mathmlBuilder:PN});tt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=en(e[0],"color-token").color,a=en(e[1],"color-token").color,l=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:l}},htmlBuilder:DN,mathmlBuilder:PN});tt({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]}}});tt({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:DN,mathmlBuilder:PN});tt({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 jU={};function Vo(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,l={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},c=0;c{var e=t.parser.settings;if(!e.displayMode)throw new $e("{"+t.envName+"} can be used only in display mode.")};function zN(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function du(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:l,autoTag:c,singleRow:d,emptySingleRow:h,maxNumCols:m,leqno:g}=e;if(t.gullet.beginGroup(),d||t.gullet.macros.set("\\cr","\\\\\\relax"),!a){var x=t.gullet.expandMacroAsText("\\arraystretch");if(x==null)a=1;else if(a=parseFloat(x),!a||a<0)throw new $e("Invalid \\arraystretch: "+x)}t.gullet.beginGroup();var y=[],w=[y],S=[],k=[],j=c!=null?[]:void 0;function N(){c&&t.gullet.macros.set("\\@eqnsw","1",!0)}function T(){j&&(t.gullet.macros.get("\\df@tag")?(j.push(t.subparse([new Xi("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):j.push(!!c&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(N(),k.push(NR(t));;){var E=t.parseExpression(!1,d?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),E={type:"ordgroup",mode:t.mode,body:E},n&&(E={type:"styling",mode:t.mode,style:n,body:[E]}),y.push(E);var _=t.fetch().text;if(_==="&"){if(m&&y.length===m){if(d||l)throw new $e("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(_==="\\end"){T(),y.length===1&&E.type==="styling"&&E.body[0].body.length===0&&(w.length>1||!h)&&w.pop(),k.length0&&(N+=.25),d.push({pos:N,isDashed:He[Ot]})}for(T(a[0]),r=0;r0&&($+=j,A<$&&(A=$),$=0)),e.addJot&&(A+=w),L.height=_,L.depth=A,N+=_,L.pos=N,N+=A+$,c[r]=L,T(a[r+1])}var U=N/2+n.fontMetrics().axisHeight,te=e.cols||[],z=[],Q,F,Y=[];if(e.tags&&e.tags.some(He=>He))for(r=0;r=l)){var W=void 0;(s>0||e.hskipBeforeAndAfter)&&(W=$n.deflt(G.pregap,g),W!==0&&(Q=be.makeSpan(["arraycolsep"],[]),Q.style.width=Xe(W),z.push(Q)));var se=[];for(r=0;r0){for(var We=be.makeLineSpan("hline",n,h),Ye=be.makeLineSpan("hdashline",n,h),Je=[{type:"elem",elem:c,shift:0}];d.length>0;){var Oe=d.pop(),Ve=Oe.pos-U;Oe.isDashed?Je.push({type:"elem",elem:Ye,shift:Ve}):Je.push({type:"elem",elem:We,shift:Ve})}c=be.makeVList({positionType:"individualShift",children:Je},n)}if(Y.length===0)return be.makeSpan(["mord"],[c],n);var Ue=be.makeVList({positionType:"individualShift",children:Y},n);return Ue=be.makeSpan(["tag"],[Ue],n),be.makeFragment([c,Ue])},rke={c:"center ",l:"left ",r:"right "},Wo=function(e,n){for(var r=[],s=new qe.MathNode("mtd",[],["mtr-glue"]),i=new qe.MathNode("mtd",[],["mml-eqn-num"]),a=0;a0){var y=e.cols,w="",S=!1,k=0,j=y.length;y[0].type==="separator"&&(g+="top ",k=1),y[y.length-1].type==="separator"&&(g+="bottom ",j-=1);for(var N=k;N0?"left ":"",g+=L[L.length-1].length>0?"right ":"";for(var P=1;P-1?"alignat":"align",i=e.envName==="split",a=du(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:zN(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),l,c=0,d={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var h="",m=0;m0&&x&&(S=1),r[y]={type:"align",align:w,pregap:S,postgap:0}}return a.colSeparationType=x?"align":"alignat",a};Vo({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Hb(e[0]),r=n?[e[0]]:en(e[0],"ordgroup").body,s=r.map(function(a){var l=AN(a),c=l.text;if("lcr".indexOf(c)!==-1)return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new $e("Unknown column alignment: "+c,a)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return du(t.parser,i,IN(t.envName))},htmlBuilder:Uo,mathmlBuilder:Wo});Vo({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 $e("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=du(t.parser,r,IN(t.envName)),a=Math.max(0,...i.body.map(l=>l.length));return i.cols=new Array(a).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=du(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Hb(e[0]),r=n?[e[0]]:en(e[0],"ordgroup").body,s=r.map(function(a){var l=AN(a),c=l.text;if("lc".indexOf(c)!==-1)return{type:"align",align:c};throw new $e("Unknown column alignment: "+c,a)});if(s.length>1)throw new $e("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=du(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new $e("{subarray} can contain only one column");return i},htmlBuilder:Uo,mathmlBuilder:Wo});Vo({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=du(t.parser,e,IN(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:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:CU,htmlBuilder:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Ub(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:zN(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return du(t.parser,e,"display")},htmlBuilder:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:CU,htmlBuilder:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Ub(t);var e={autoTag:zN(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return du(t.parser,e,"display")},htmlBuilder:Uo,mathmlBuilder:Wo});Vo({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Ub(t),H3e(t.parser)},htmlBuilder:Uo,mathmlBuilder:Wo});Z("\\nonumber","\\gdef\\@eqnsw{0}");Z("\\notag","\\nonumber");tt({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new $e(t.funcName+" valid only within array environment")}});var CR=jU;tt({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 $e("Invalid environment name",s);for(var i="",a=0;a{var n=t.font,r=e.withFont(n);return Pn(t.body,r)},EU=(t,e)=>{var n=t.font,r=e.withFont(n);return lr(t.body,r)},TR={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};tt({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=Ny(e[0]),i=r;return i in TR&&(i=TR[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:TU,mathmlBuilder:EU});tt({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=$n.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Qb(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});tt({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,a=n.parseExpression(!0,s),l="math"+r.slice(1);return{type:"font",mode:i,font:l,body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:TU,mathmlBuilder:EU});var _U=(t,e)=>{var n=e;return t==="display"?n=n.id>=Et.SCRIPT.id?n.text():Et.DISPLAY:t==="text"&&n.size===Et.DISPLAY.size?n=Et.TEXT:t==="script"?n=Et.SCRIPT:t==="scriptscript"&&(n=Et.SCRIPTSCRIPT),n},LN=(t,e)=>{var n=_U(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var a=Pn(t.numer,i,e);if(t.continued){var l=8.5/e.fontMetrics().ptPerEm,c=3.5/e.fontMetrics().ptPerEm;a.height=a.height0?y=3*g:y=7*g,w=e.fontMetrics().denom1):(m>0?(x=e.fontMetrics().num2,y=g):(x=e.fontMetrics().num3,y=3*g),w=e.fontMetrics().denom2);var S;if(h){var j=e.fontMetrics().axisHeight;x-a.depth-(j+.5*m){var n=new qe.MathNode("mfrac",[lr(t.numer,e),lr(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Rr(t.barSize,e);n.setAttribute("linethickness",Xe(r))}var s=_U(t.size,e.style);if(s.size!==e.style.size){n=new qe.MathNode("mstyle",[n]);var i=s.size===Et.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var a=[];if(t.leftDelim!=null){var l=new qe.MathNode("mo",[new qe.TextNode(t.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),a.push(l)}if(a.push(n),t.rightDelim!=null){var c=new qe.MathNode("mo",[new qe.TextNode(t.rightDelim.replace("\\",""))]);c.setAttribute("fence","true"),a.push(c)}return EN(a)}return n};tt({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],a,l=null,c=null,d="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,l="(",c=")";break;case"\\\\bracefrac":a=!1,l="\\{",c="\\}";break;case"\\\\brackfrac":a=!1,l="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":d="display";break;case"\\tfrac":case"\\tbinom":d="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:a,leftDelim:l,rightDelim:c,size:d,barSize:null}},htmlBuilder:LN,mathmlBuilder:BN});tt({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}}});tt({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 ER=["display","text","script","scriptscript"],_R=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};tt({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=Ny(e[0]),a=i.type==="atom"&&i.family==="open"?_R(i.text):null,l=Ny(e[1]),c=l.type==="atom"&&l.family==="close"?_R(l.text):null,d=en(e[2],"size"),h,m=null;d.isBlank?h=!0:(m=d.value,h=m.number>0);var g="auto",x=e[3];if(x.type==="ordgroup"){if(x.body.length>0){var y=en(x.body[0],"textord");g=ER[Number(y.text)]}}else x=en(x,"textord"),g=ER[Number(x.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:h,barSize:m,leftDelim:a,rightDelim:c,size:g}},htmlBuilder:LN,mathmlBuilder:BN});tt({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:en(e[0],"size").value,token:s}}});tt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=R5e(en(e[1],"infix").size),a=e[2],l=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:a,continued:!1,hasBarLine:l,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:LN,mathmlBuilder:BN});var AU=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Pn(t.sup,e.havingStyle(n.sup()),e):Pn(t.sub,e.havingStyle(n.sub()),e),s=en(t.base,"horizBrace")):s=en(t,"horizBrace");var i=Pn(s.base,e.havingBaseStyle(Et.DISPLAY)),a=Ul.svgSpan(s,e),l;if(s.isOver?(l=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a}]},e),l.children[0].children[0].children[1].classes.push("svg-align")):(l=be.makeVList({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:i}]},e),l.children[0].children[0].children[0].classes.push("svg-align")),r){var c=be.makeSpan(["mord",s.isOver?"mover":"munder"],[l],e);s.isOver?l=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:r}]},e):l=be.makeVList({positionType:"bottom",positionData:c.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:c}]},e)}return be.makeSpan(["mord",s.isOver?"mover":"munder"],[l],e)},ske=(t,e)=>{var n=Ul.mathMLnode(t.label);return new qe.MathNode(t.isOver?"mover":"munder",[lr(t.base,e),n])};tt({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:AU,mathmlBuilder:ske});tt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=en(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:Qr(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=fs(t.body,e,!1);return be.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=nu(t.body,e);return n instanceof Qi||(n=new Qi("mrow",[n])),n.setAttribute("href",t.href),n}});tt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=en(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=en(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l,c={};switch(r){case"\\htmlClass":c.class=i,l={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,l={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,l={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var d=i.split(","),h=0;h{var n=fs(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=be.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>nu(t.body,e)});tt({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:Qr(e[0]),mathml:Qr(e[1])}},htmlBuilder:(t,e)=>{var n=fs(t.html,e,!1);return be.makeFragment(n)},mathmlBuilder:(t,e)=>nu(t.mathml,e)});var n5=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 $e("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!YV(r))throw new $e("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};tt({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},a={number:0,unit:"em"},l="";if(n[0])for(var c=en(n[0],"raw").string,d=c.split(","),h=0;h{var n=Rr(t.height,e),r=0;t.totalheight.number>0&&(r=Rr(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=Rr(t.width,e));var i={height:Xe(n+r)};s>0&&(i.width=Xe(s)),r>0&&(i.verticalAlign=Xe(-r));var a=new s3e(t.src,t.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new qe.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Rr(t.height,e),s=0;if(t.totalheight.number>0&&(s=Rr(t.totalheight,e)-r,n.setAttribute("valign",Xe(-s))),n.setAttribute("height",Xe(r+s)),t.width.number>0){var i=Rr(t.width,e);n.setAttribute("width",Xe(i))}return n.setAttribute("src",t.src),n}});tt({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=en(e[0],"size");if(n.settings.strict){var i=r[1]==="m",a=s.value.unit==="mu";i?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return be.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=Rr(t.dimension,e);return new qe.SpaceNode(n)}});tt({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=be.makeSpan([],[Pn(t.body,e)]),n=be.makeSpan(["inner"],[n],e)):n=be.makeSpan(["inner"],[Pn(t.body,e)]);var r=be.makeSpan(["fix"],[]),s=be.makeSpan([t.alignment],[n,r],e),i=be.makeSpan(["strut"]);return i.style.height=Xe(s.height+s.depth),s.depth&&(i.style.verticalAlign=Xe(-s.depth)),s.children.unshift(i),s=be.makeSpan(["thinbox"],[s],e),be.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new qe.MathNode("mpadded",[lr(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}});tt({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:a}}});tt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new $e("Mismatched "+t.funcName)}});var AR=(t,e)=>{switch(e.style.size){case Et.DISPLAY.size:return t.display;case Et.TEXT.size:return t.text;case Et.SCRIPT.size:return t.script;case Et.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};tt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:Qr(e[0]),text:Qr(e[1]),script:Qr(e[2]),scriptscript:Qr(e[3])}},htmlBuilder:(t,e)=>{var n=AR(t,e),r=fs(n,e,!1);return be.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=AR(t,e);return nu(n,e)}});var MU=(t,e,n,r,s,i,a)=>{t=be.makeSpan([],[t]);var l=n&&$n.isCharacterBox(n),c,d;if(e){var h=Pn(e,r.havingStyle(s.sup()),r);d={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-h.depth)}}if(n){var m=Pn(n,r.havingStyle(s.sub()),r);c={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-m.height)}}var g;if(d&&c){var x=r.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+t.depth+a;g=be.makeVList({positionType:"bottom",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Xe(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:Xe(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(c){var y=t.height-a;g=be.makeVList({positionType:"top",positionData:y,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Xe(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t}]},r)}else if(d){var w=t.depth+a;g=be.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:t},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:Xe(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var S=[g];if(c&&i!==0&&!l){var k=be.makeSpan(["mspace"],[],r);k.style.marginRight=Xe(i),S.unshift(k)}return be.makeSpan(["mop","op-limits"],S,r)},RU=["\\smallint"],$f=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=en(t.base,"op"),s=!0):i=en(t,"op");var a=e.style,l=!1;a.size===Et.DISPLAY.size&&i.symbol&&!RU.includes(i.name)&&(l=!0);var c;if(i.symbol){var d=l?"Size2-Regular":"Size1-Regular",h="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(h=i.name.slice(1),i.name=h==="oiint"?"\\iint":"\\iiint"),c=be.makeSymbol(i.name,d,"math",e,["mop","op-symbol",l?"large-op":"small-op"]),h.length>0){var m=c.italic,g=be.staticSvg(h+"Size"+(l?"2":"1"),e);c=be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:g,shift:l?.08:0}]},e),i.name="\\"+h,c.classes.unshift("mop"),c.italic=m}}else if(i.body){var x=fs(i.body,e,!0);x.length===1&&x[0]instanceof Aa?(c=x[0],c.classes[0]="mop"):c=be.makeSpan(["mop"],x,e)}else{for(var y=[],w=1;w{var n;if(t.symbol)n=new Qi("mo",[Ma(t.name,t.mode)]),RU.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Qi("mo",_i(t.body,e));else{n=new Qi("mi",[new Ao(t.name.slice(1))]);var r=new Qi("mo",[Ma("⁡","text")]);t.parentIsSupSub?n=new Qi("mrow",[n,r]):n=oU([n,r])}return n},ike={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};tt({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=ike[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:$f,mathmlBuilder:gg});tt({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:Qr(r)}},htmlBuilder:$f,mathmlBuilder:gg});var ake={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};tt({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:$f,mathmlBuilder:gg});tt({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:$f,mathmlBuilder:gg});tt({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=ake[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:$f,mathmlBuilder:gg});var DU=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=en(t.base,"operatorname"),s=!0):i=en(t,"operatorname");var a;if(i.body.length>0){for(var l=i.body.map(m=>{var g=m.text;return typeof g=="string"?{type:"textord",mode:m.mode,text:g}:m}),c=fs(l,e.withFont("mathrm"),!0),d=0;d{for(var n=_i(t.body,e.withFont("mathrm")),r=!0,s=0;sh.toText()).join("");n=[new qe.TextNode(l)]}var c=new qe.MathNode("mi",n);c.setAttribute("mathvariant","normal");var d=new qe.MathNode("mo",[Ma("⁡","text")]);return t.parentIsSupSub?new qe.MathNode("mrow",[c,d]):qe.newDocumentFragment([c,d])};tt({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:Qr(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:DU,mathmlBuilder:oke});Z("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Sd({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?be.makeFragment(fs(t.body,e,!1)):be.makeSpan(["mord"],fs(t.body,e,!0),e)},mathmlBuilder(t,e){return nu(t.body,e,!0)}});tt({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=Pn(t.body,e.havingCrampedStyle()),r=be.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return be.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new qe.MathNode("mo",[new qe.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new qe.MathNode("mover",[lr(t.body,e),n]);return r.setAttribute("accent","true"),r}});tt({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:Qr(r)}},htmlBuilder:(t,e)=>{var n=fs(t.body,e.withPhantom(),!1);return be.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=_i(t.body,e);return new qe.MathNode("mphantom",n)}});tt({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=be.makeSpan([],[Pn(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=_i(Qr(t.body),e),r=new qe.MathNode("mphantom",n),s=new qe.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});tt({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=be.makeSpan(["inner"],[Pn(t.body,e.withPhantom())]),r=be.makeSpan(["fix"],[]);return be.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=_i(Qr(t.body),e),r=new qe.MathNode("mphantom",n),s=new qe.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});tt({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=en(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Pn(t.body,e),r=Rr(t.dy,e);return be.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new qe.MathNode("mpadded",[lr(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});tt({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});tt({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=en(e[0],"size"),a=en(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&en(s,"size").value,width:i.value,height:a.value}},htmlBuilder(t,e){var n=be.makeSpan(["mord","rule"],[],e),r=Rr(t.width,e),s=Rr(t.height,e),i=t.shift?Rr(t.shift,e):0;return n.style.borderRightWidth=Xe(r),n.style.borderTopWidth=Xe(s),n.style.bottom=Xe(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Rr(t.width,e),r=Rr(t.height,e),s=t.shift?Rr(t.shift,e):0,i=e.color&&e.getColor()||"black",a=new qe.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",Xe(n)),a.setAttribute("height",Xe(r));var l=new qe.MathNode("mpadded",[a]);return s>=0?l.setAttribute("height",Xe(s)):(l.setAttribute("height",Xe(s)),l.setAttribute("depth",Xe(-s))),l.setAttribute("voffset",Xe(s)),l}});function PU(t,e,n){for(var r=fs(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return PU(t.body,n,e)};tt({type:"sizing",names:MR,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:MR.indexOf(r)+1,body:i}},htmlBuilder:lke,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=_i(t.body,n),s=new qe.MathNode("mstyle",r);return s.setAttribute("mathsize",Xe(n.sizeMultiplier)),s}});tt({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,a=n[0]&&en(n[0],"ordgroup");if(a)for(var l="",c=0;c{var n=be.makeSpan([],[Pn(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 qe.MathNode("mpadded",[lr(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});tt({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=Pn(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=be.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+a&&(a=(a+m-n.height-n.depth)/2);var g=c.height-n.height-a-d;n.style.paddingLeft=Xe(h);var x=be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+g)},{type:"elem",elem:c},{type:"kern",size:d}]},e);if(t.index){var y=e.havingStyle(Et.SCRIPTSCRIPT),w=Pn(t.index,y,e),S=.6*(x.height-x.depth),k=be.makeVList({positionType:"shift",positionData:-S,children:[{type:"elem",elem:w}]},e),j=be.makeSpan(["root"],[k]);return be.makeSpan(["mord","sqrt"],[j,x],e)}else return be.makeSpan(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new qe.MathNode("mroot",[lr(n,e),lr(r,e)]):new qe.MathNode("msqrt",[lr(n,e)])}});var RR={display:Et.DISPLAY,text:Et.TEXT,script:Et.SCRIPT,scriptscript:Et.SCRIPTSCRIPT};tt({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:a,body:i}},htmlBuilder(t,e){var n=RR[t.style],r=e.havingStyle(n).withFont("");return PU(t.body,r,e)},mathmlBuilder(t,e){var n=RR[t.style],r=e.havingStyle(n),s=_i(t.body,r),i=new qe.MathNode("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},l=a[t.style];return i.setAttribute("scriptlevel",l[0]),i.setAttribute("displaystyle",l[1]),i}});var cke=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===Et.DISPLAY.size||r.alwaysHandleSupSub);return s?$f:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===Et.DISPLAY.size||r.limits);return i?DU:null}else{if(r.type==="accent")return $n.isCharacterBox(r.base)?MN:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?AU:null}else return null}else return null};Sd({type:"supsub",htmlBuilder(t,e){var n=cke(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,a=Pn(r,e),l,c,d=e.fontMetrics(),h=0,m=0,g=r&&$n.isCharacterBox(r);if(s){var x=e.havingStyle(e.style.sup());l=Pn(s,x,e),g||(h=a.height-x.fontMetrics().supDrop*x.sizeMultiplier/e.sizeMultiplier)}if(i){var y=e.havingStyle(e.style.sub());c=Pn(i,y,e),g||(m=a.depth+y.fontMetrics().subDrop*y.sizeMultiplier/e.sizeMultiplier)}var w;e.style===Et.DISPLAY?w=d.sup1:e.style.cramped?w=d.sup3:w=d.sup2;var S=e.sizeMultiplier,k=Xe(.5/d.ptPerEm/S),j=null;if(c){var N=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(a instanceof Aa||N)&&(j=Xe(-a.italic))}var T;if(l&&c){h=Math.max(h,w,l.depth+.25*d.xHeight),m=Math.max(m,d.sub2);var E=d.defaultRuleThickness,_=4*E;if(h-l.depth-(c.height-m)<_){m=_-(h-l.depth)+c.height;var A=.8*d.xHeight-(h-l.depth);A>0&&(h+=A,m-=A)}var L=[{type:"elem",elem:c,shift:m,marginRight:k,marginLeft:j},{type:"elem",elem:l,shift:-h,marginRight:k}];T=be.makeVList({positionType:"individualShift",children:L},e)}else if(c){m=Math.max(m,d.sub1,c.height-.8*d.xHeight);var P=[{type:"elem",elem:c,marginLeft:j,marginRight:k}];T=be.makeVList({positionType:"shift",positionData:m,children:P},e)}else if(l)h=Math.max(h,w,l.depth+.25*d.xHeight),T=be.makeVList({positionType:"shift",positionData:-h,children:[{type:"elem",elem:l,marginRight:k}]},e);else throw new Error("supsub must have either sup or sub.");var B=$O(a,"right")||"mord";return be.makeSpan([B],[a,be.makeSpan(["msupsub"],[T])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[lr(t.base,e)];t.sub&&i.push(lr(t.sub,e)),t.sup&&i.push(lr(t.sup,e));var a;if(n)a=r?"mover":"munder";else if(t.sub)if(t.sup){var d=t.base;d&&d.type==="op"&&d.limits&&e.style===Et.DISPLAY||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(e.style===Et.DISPLAY||d.limits)?a="munderover":a="msubsup"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===Et.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===Et.DISPLAY)?a="munder":a="msub"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===Et.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===Et.DISPLAY)?a="mover":a="msup"}return new qe.MathNode(a,i)}});Sd({type:"atom",htmlBuilder(t,e){return be.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new qe.MathNode("mo",[Ma(t.text,t.mode)]);if(t.family==="bin"){var r=_N(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 zU={mi:"italic",mn:"normal",mtext:"normal"};Sd({type:"mathord",htmlBuilder(t,e){return be.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new qe.MathNode("mi",[Ma(t.text,t.mode,e)]),r=_N(t,e)||"italic";return r!==zU[n.type]&&n.setAttribute("mathvariant",r),n}});Sd({type:"textord",htmlBuilder(t,e){return be.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Ma(t.text,t.mode,e),r=_N(t,e)||"normal",s;return t.mode==="text"?s=new qe.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new qe.MathNode("mn",[n]):t.text==="\\prime"?s=new qe.MathNode("mo",[n]):s=new qe.MathNode("mi",[n]),r!==zU[s.type]&&s.setAttribute("mathvariant",r),s}});var r5={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},s5={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Sd({type:"spacing",htmlBuilder(t,e){if(s5.hasOwnProperty(t.text)){var n=s5[t.text].className||"";if(t.mode==="text"){var r=be.makeOrd(t,e,"textord");return r.classes.push(n),r}else return be.makeSpan(["mspace",n],[be.mathsym(t.text,t.mode,e)],e)}else{if(r5.hasOwnProperty(t.text))return be.makeSpan(["mspace",r5[t.text]],[],e);throw new $e('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(s5.hasOwnProperty(t.text))n=new qe.MathNode("mtext",[new qe.TextNode(" ")]);else{if(r5.hasOwnProperty(t.text))return new qe.MathNode("mspace");throw new $e('Unknown type of space "'+t.text+'"')}return n}});var DR=()=>{var t=new qe.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Sd({type:"tag",mathmlBuilder(t,e){var n=new qe.MathNode("mtable",[new qe.MathNode("mtr",[DR(),new qe.MathNode("mtd",[nu(t.body,e)]),DR(),new qe.MathNode("mtd",[nu(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var PR={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},zR={"\\textbf":"textbf","\\textmd":"textmd"},uke={"\\textit":"textit","\\textup":"textup"},IR=(t,e)=>{var n=t.font;if(n){if(PR[n])return e.withTextFontFamily(PR[n]);if(zR[n])return e.withTextFontWeight(zR[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(uke[n])};tt({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:Qr(s),font:r}},htmlBuilder(t,e){var n=IR(t,e),r=fs(t.body,n,!0);return be.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=IR(t,e);return nu(t.body,n)}});tt({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=Pn(t.body,e),r=be.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=be.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return be.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new qe.MathNode("mo",[new qe.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new qe.MathNode("munder",[lr(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});tt({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=Pn(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return be.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new qe.MathNode("mpadded",[lr(t.body,e)],["vcenter"])}});tt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new $e("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=LR(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),qc=iU,IU=`[ \r - ]`,dke="\\\\[a-zA-Z@]+",hke="\\\\[^\uD800-\uDFFF]",fke="("+dke+")"+IU+"*",mke=`\\\\( +-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 yg{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 Mo={"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]}},z1={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]},xR={Å:"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 r3e(t,e){Mo[t]=e}function MN(t,e,n){if(!Mo[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=Mo[e][r];if(!s&&t[0]in xR&&(r=xR[t[0]].charCodeAt(0),s=Mo[e][r]),!s&&n==="text"&&JV(r)&&(s=Mo[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var XS={};function s3e(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!XS[e]){var n=XS[e]={cssEmPerMu:z1.quad[e]/18};for(var r in z1)z1.hasOwnProperty(r)&&(n[r]=z1[r][e])}return XS[e]}var i3e=[[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]],vR=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],yR=function(e,n){return n.size<2?e:i3e[e-1][n.size-1]};class Al{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||Al.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=vR[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 Al(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:yR(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:vR[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=yR(Al.BASESIZE,e);return this.size===n&&this.textSize===Al.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!==Al.BASESIZE?["sizing","reset-size"+this.size,"size"+Al.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=s3e(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Al.BASESIZE=6;var $O={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},a3e={ex:!0,em:!0,mu:!0},eU=function(e){return typeof e!="string"&&(e=e.unit),e in $O||e in a3e||e==="ex"},Ir=function(e,n){var r;if(e.unit in $O)r=$O[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 qe("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Xe=function(e){return+e.toFixed(4)+"em"},ru=function(e){return e.filter(n=>n).join(" ")},tU=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)}},nU=function(e){var n=document.createElement(e);n.className=ru(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]/,rU=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+Wn.escape(ru(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=Wn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+Wn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(o3e.test(i))throw new qe("Invalid attribute name '"+i+"'");n+=" "+i+'="'+Wn.escape(this.attributes[i])+'"'}n+=">";for(var a=0;a",n};class bg{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,tU.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return nU.call(this,"span")}toMarkup(){return rU.call(this,"span")}}class RN{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,tU.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 nU.call(this,"a")}toMarkup(){return rU.call(this,"a")}}class l3e{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=''+Wn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Xe(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=ru(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+=Wn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+Wn.escape(r)+'"');var i=Wn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class Ul{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 HO{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 d3e={bin:1,close:1,inner:1,open:1,punct:1,rel:1},h3e={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},pr={math:{},text:{}};function M(t,e,n,r,s,i){pr[t][s]={font:e,group:n,replace:r},i&&r&&(pr[t][r]=pr[t][s])}var P="math",Le="text",Q="main",le="ams",_r="accent-token",it="bin",li="close",$f="inner",_t="mathord",os="op-token",ra="open",Vb="punct",ce="rel",tc="spacing",me="textord";M(P,Q,ce,"≡","\\equiv",!0);M(P,Q,ce,"≺","\\prec",!0);M(P,Q,ce,"≻","\\succ",!0);M(P,Q,ce,"∼","\\sim",!0);M(P,Q,ce,"⊥","\\perp");M(P,Q,ce,"⪯","\\preceq",!0);M(P,Q,ce,"⪰","\\succeq",!0);M(P,Q,ce,"≃","\\simeq",!0);M(P,Q,ce,"∣","\\mid",!0);M(P,Q,ce,"≪","\\ll",!0);M(P,Q,ce,"≫","\\gg",!0);M(P,Q,ce,"≍","\\asymp",!0);M(P,Q,ce,"∥","\\parallel");M(P,Q,ce,"⋈","\\bowtie",!0);M(P,Q,ce,"⌣","\\smile",!0);M(P,Q,ce,"⊑","\\sqsubseteq",!0);M(P,Q,ce,"⊒","\\sqsupseteq",!0);M(P,Q,ce,"≐","\\doteq",!0);M(P,Q,ce,"⌢","\\frown",!0);M(P,Q,ce,"∋","\\ni",!0);M(P,Q,ce,"∝","\\propto",!0);M(P,Q,ce,"⊢","\\vdash",!0);M(P,Q,ce,"⊣","\\dashv",!0);M(P,Q,ce,"∋","\\owns");M(P,Q,Vb,".","\\ldotp");M(P,Q,Vb,"⋅","\\cdotp");M(P,Q,me,"#","\\#");M(Le,Q,me,"#","\\#");M(P,Q,me,"&","\\&");M(Le,Q,me,"&","\\&");M(P,Q,me,"ℵ","\\aleph",!0);M(P,Q,me,"∀","\\forall",!0);M(P,Q,me,"ℏ","\\hbar",!0);M(P,Q,me,"∃","\\exists",!0);M(P,Q,me,"∇","\\nabla",!0);M(P,Q,me,"♭","\\flat",!0);M(P,Q,me,"ℓ","\\ell",!0);M(P,Q,me,"♮","\\natural",!0);M(P,Q,me,"♣","\\clubsuit",!0);M(P,Q,me,"℘","\\wp",!0);M(P,Q,me,"♯","\\sharp",!0);M(P,Q,me,"♢","\\diamondsuit",!0);M(P,Q,me,"ℜ","\\Re",!0);M(P,Q,me,"♡","\\heartsuit",!0);M(P,Q,me,"ℑ","\\Im",!0);M(P,Q,me,"♠","\\spadesuit",!0);M(P,Q,me,"§","\\S",!0);M(Le,Q,me,"§","\\S");M(P,Q,me,"¶","\\P",!0);M(Le,Q,me,"¶","\\P");M(P,Q,me,"†","\\dag");M(Le,Q,me,"†","\\dag");M(Le,Q,me,"†","\\textdagger");M(P,Q,me,"‡","\\ddag");M(Le,Q,me,"‡","\\ddag");M(Le,Q,me,"‡","\\textdaggerdbl");M(P,Q,li,"⎱","\\rmoustache",!0);M(P,Q,ra,"⎰","\\lmoustache",!0);M(P,Q,li,"⟯","\\rgroup",!0);M(P,Q,ra,"⟮","\\lgroup",!0);M(P,Q,it,"∓","\\mp",!0);M(P,Q,it,"⊖","\\ominus",!0);M(P,Q,it,"⊎","\\uplus",!0);M(P,Q,it,"⊓","\\sqcap",!0);M(P,Q,it,"∗","\\ast");M(P,Q,it,"⊔","\\sqcup",!0);M(P,Q,it,"◯","\\bigcirc",!0);M(P,Q,it,"∙","\\bullet",!0);M(P,Q,it,"‡","\\ddagger");M(P,Q,it,"≀","\\wr",!0);M(P,Q,it,"⨿","\\amalg");M(P,Q,it,"&","\\And");M(P,Q,ce,"⟵","\\longleftarrow",!0);M(P,Q,ce,"⇐","\\Leftarrow",!0);M(P,Q,ce,"⟸","\\Longleftarrow",!0);M(P,Q,ce,"⟶","\\longrightarrow",!0);M(P,Q,ce,"⇒","\\Rightarrow",!0);M(P,Q,ce,"⟹","\\Longrightarrow",!0);M(P,Q,ce,"↔","\\leftrightarrow",!0);M(P,Q,ce,"⟷","\\longleftrightarrow",!0);M(P,Q,ce,"⇔","\\Leftrightarrow",!0);M(P,Q,ce,"⟺","\\Longleftrightarrow",!0);M(P,Q,ce,"↦","\\mapsto",!0);M(P,Q,ce,"⟼","\\longmapsto",!0);M(P,Q,ce,"↗","\\nearrow",!0);M(P,Q,ce,"↩","\\hookleftarrow",!0);M(P,Q,ce,"↪","\\hookrightarrow",!0);M(P,Q,ce,"↘","\\searrow",!0);M(P,Q,ce,"↼","\\leftharpoonup",!0);M(P,Q,ce,"⇀","\\rightharpoonup",!0);M(P,Q,ce,"↙","\\swarrow",!0);M(P,Q,ce,"↽","\\leftharpoondown",!0);M(P,Q,ce,"⇁","\\rightharpoondown",!0);M(P,Q,ce,"↖","\\nwarrow",!0);M(P,Q,ce,"⇌","\\rightleftharpoons",!0);M(P,le,ce,"≮","\\nless",!0);M(P,le,ce,"","\\@nleqslant");M(P,le,ce,"","\\@nleqq");M(P,le,ce,"⪇","\\lneq",!0);M(P,le,ce,"≨","\\lneqq",!0);M(P,le,ce,"","\\@lvertneqq");M(P,le,ce,"⋦","\\lnsim",!0);M(P,le,ce,"⪉","\\lnapprox",!0);M(P,le,ce,"⊀","\\nprec",!0);M(P,le,ce,"⋠","\\npreceq",!0);M(P,le,ce,"⋨","\\precnsim",!0);M(P,le,ce,"⪹","\\precnapprox",!0);M(P,le,ce,"≁","\\nsim",!0);M(P,le,ce,"","\\@nshortmid");M(P,le,ce,"∤","\\nmid",!0);M(P,le,ce,"⊬","\\nvdash",!0);M(P,le,ce,"⊭","\\nvDash",!0);M(P,le,ce,"⋪","\\ntriangleleft");M(P,le,ce,"⋬","\\ntrianglelefteq",!0);M(P,le,ce,"⊊","\\subsetneq",!0);M(P,le,ce,"","\\@varsubsetneq");M(P,le,ce,"⫋","\\subsetneqq",!0);M(P,le,ce,"","\\@varsubsetneqq");M(P,le,ce,"≯","\\ngtr",!0);M(P,le,ce,"","\\@ngeqslant");M(P,le,ce,"","\\@ngeqq");M(P,le,ce,"⪈","\\gneq",!0);M(P,le,ce,"≩","\\gneqq",!0);M(P,le,ce,"","\\@gvertneqq");M(P,le,ce,"⋧","\\gnsim",!0);M(P,le,ce,"⪊","\\gnapprox",!0);M(P,le,ce,"⊁","\\nsucc",!0);M(P,le,ce,"⋡","\\nsucceq",!0);M(P,le,ce,"⋩","\\succnsim",!0);M(P,le,ce,"⪺","\\succnapprox",!0);M(P,le,ce,"≆","\\ncong",!0);M(P,le,ce,"","\\@nshortparallel");M(P,le,ce,"∦","\\nparallel",!0);M(P,le,ce,"⊯","\\nVDash",!0);M(P,le,ce,"⋫","\\ntriangleright");M(P,le,ce,"⋭","\\ntrianglerighteq",!0);M(P,le,ce,"","\\@nsupseteqq");M(P,le,ce,"⊋","\\supsetneq",!0);M(P,le,ce,"","\\@varsupsetneq");M(P,le,ce,"⫌","\\supsetneqq",!0);M(P,le,ce,"","\\@varsupsetneqq");M(P,le,ce,"⊮","\\nVdash",!0);M(P,le,ce,"⪵","\\precneqq",!0);M(P,le,ce,"⪶","\\succneqq",!0);M(P,le,ce,"","\\@nsubseteqq");M(P,le,it,"⊴","\\unlhd");M(P,le,it,"⊵","\\unrhd");M(P,le,ce,"↚","\\nleftarrow",!0);M(P,le,ce,"↛","\\nrightarrow",!0);M(P,le,ce,"⇍","\\nLeftarrow",!0);M(P,le,ce,"⇏","\\nRightarrow",!0);M(P,le,ce,"↮","\\nleftrightarrow",!0);M(P,le,ce,"⇎","\\nLeftrightarrow",!0);M(P,le,ce,"△","\\vartriangle");M(P,le,me,"ℏ","\\hslash");M(P,le,me,"▽","\\triangledown");M(P,le,me,"◊","\\lozenge");M(P,le,me,"Ⓢ","\\circledS");M(P,le,me,"®","\\circledR");M(Le,le,me,"®","\\circledR");M(P,le,me,"∡","\\measuredangle",!0);M(P,le,me,"∄","\\nexists");M(P,le,me,"℧","\\mho");M(P,le,me,"Ⅎ","\\Finv",!0);M(P,le,me,"⅁","\\Game",!0);M(P,le,me,"‵","\\backprime");M(P,le,me,"▲","\\blacktriangle");M(P,le,me,"▼","\\blacktriangledown");M(P,le,me,"■","\\blacksquare");M(P,le,me,"⧫","\\blacklozenge");M(P,le,me,"★","\\bigstar");M(P,le,me,"∢","\\sphericalangle",!0);M(P,le,me,"∁","\\complement",!0);M(P,le,me,"ð","\\eth",!0);M(Le,Q,me,"ð","ð");M(P,le,me,"╱","\\diagup");M(P,le,me,"╲","\\diagdown");M(P,le,me,"□","\\square");M(P,le,me,"□","\\Box");M(P,le,me,"◊","\\Diamond");M(P,le,me,"¥","\\yen",!0);M(Le,le,me,"¥","\\yen",!0);M(P,le,me,"✓","\\checkmark",!0);M(Le,le,me,"✓","\\checkmark");M(P,le,me,"ℶ","\\beth",!0);M(P,le,me,"ℸ","\\daleth",!0);M(P,le,me,"ℷ","\\gimel",!0);M(P,le,me,"ϝ","\\digamma",!0);M(P,le,me,"ϰ","\\varkappa");M(P,le,ra,"┌","\\@ulcorner",!0);M(P,le,li,"┐","\\@urcorner",!0);M(P,le,ra,"└","\\@llcorner",!0);M(P,le,li,"┘","\\@lrcorner",!0);M(P,le,ce,"≦","\\leqq",!0);M(P,le,ce,"⩽","\\leqslant",!0);M(P,le,ce,"⪕","\\eqslantless",!0);M(P,le,ce,"≲","\\lesssim",!0);M(P,le,ce,"⪅","\\lessapprox",!0);M(P,le,ce,"≊","\\approxeq",!0);M(P,le,it,"⋖","\\lessdot");M(P,le,ce,"⋘","\\lll",!0);M(P,le,ce,"≶","\\lessgtr",!0);M(P,le,ce,"⋚","\\lesseqgtr",!0);M(P,le,ce,"⪋","\\lesseqqgtr",!0);M(P,le,ce,"≑","\\doteqdot");M(P,le,ce,"≓","\\risingdotseq",!0);M(P,le,ce,"≒","\\fallingdotseq",!0);M(P,le,ce,"∽","\\backsim",!0);M(P,le,ce,"⋍","\\backsimeq",!0);M(P,le,ce,"⫅","\\subseteqq",!0);M(P,le,ce,"⋐","\\Subset",!0);M(P,le,ce,"⊏","\\sqsubset",!0);M(P,le,ce,"≼","\\preccurlyeq",!0);M(P,le,ce,"⋞","\\curlyeqprec",!0);M(P,le,ce,"≾","\\precsim",!0);M(P,le,ce,"⪷","\\precapprox",!0);M(P,le,ce,"⊲","\\vartriangleleft");M(P,le,ce,"⊴","\\trianglelefteq");M(P,le,ce,"⊨","\\vDash",!0);M(P,le,ce,"⊪","\\Vvdash",!0);M(P,le,ce,"⌣","\\smallsmile");M(P,le,ce,"⌢","\\smallfrown");M(P,le,ce,"≏","\\bumpeq",!0);M(P,le,ce,"≎","\\Bumpeq",!0);M(P,le,ce,"≧","\\geqq",!0);M(P,le,ce,"⩾","\\geqslant",!0);M(P,le,ce,"⪖","\\eqslantgtr",!0);M(P,le,ce,"≳","\\gtrsim",!0);M(P,le,ce,"⪆","\\gtrapprox",!0);M(P,le,it,"⋗","\\gtrdot");M(P,le,ce,"⋙","\\ggg",!0);M(P,le,ce,"≷","\\gtrless",!0);M(P,le,ce,"⋛","\\gtreqless",!0);M(P,le,ce,"⪌","\\gtreqqless",!0);M(P,le,ce,"≖","\\eqcirc",!0);M(P,le,ce,"≗","\\circeq",!0);M(P,le,ce,"≜","\\triangleq",!0);M(P,le,ce,"∼","\\thicksim");M(P,le,ce,"≈","\\thickapprox");M(P,le,ce,"⫆","\\supseteqq",!0);M(P,le,ce,"⋑","\\Supset",!0);M(P,le,ce,"⊐","\\sqsupset",!0);M(P,le,ce,"≽","\\succcurlyeq",!0);M(P,le,ce,"⋟","\\curlyeqsucc",!0);M(P,le,ce,"≿","\\succsim",!0);M(P,le,ce,"⪸","\\succapprox",!0);M(P,le,ce,"⊳","\\vartriangleright");M(P,le,ce,"⊵","\\trianglerighteq");M(P,le,ce,"⊩","\\Vdash",!0);M(P,le,ce,"∣","\\shortmid");M(P,le,ce,"∥","\\shortparallel");M(P,le,ce,"≬","\\between",!0);M(P,le,ce,"⋔","\\pitchfork",!0);M(P,le,ce,"∝","\\varpropto");M(P,le,ce,"◀","\\blacktriangleleft");M(P,le,ce,"∴","\\therefore",!0);M(P,le,ce,"∍","\\backepsilon");M(P,le,ce,"▶","\\blacktriangleright");M(P,le,ce,"∵","\\because",!0);M(P,le,ce,"⋘","\\llless");M(P,le,ce,"⋙","\\gggtr");M(P,le,it,"⊲","\\lhd");M(P,le,it,"⊳","\\rhd");M(P,le,ce,"≂","\\eqsim",!0);M(P,Q,ce,"⋈","\\Join");M(P,le,ce,"≑","\\Doteq",!0);M(P,le,it,"∔","\\dotplus",!0);M(P,le,it,"∖","\\smallsetminus");M(P,le,it,"⋒","\\Cap",!0);M(P,le,it,"⋓","\\Cup",!0);M(P,le,it,"⩞","\\doublebarwedge",!0);M(P,le,it,"⊟","\\boxminus",!0);M(P,le,it,"⊞","\\boxplus",!0);M(P,le,it,"⋇","\\divideontimes",!0);M(P,le,it,"⋉","\\ltimes",!0);M(P,le,it,"⋊","\\rtimes",!0);M(P,le,it,"⋋","\\leftthreetimes",!0);M(P,le,it,"⋌","\\rightthreetimes",!0);M(P,le,it,"⋏","\\curlywedge",!0);M(P,le,it,"⋎","\\curlyvee",!0);M(P,le,it,"⊝","\\circleddash",!0);M(P,le,it,"⊛","\\circledast",!0);M(P,le,it,"⋅","\\centerdot");M(P,le,it,"⊺","\\intercal",!0);M(P,le,it,"⋒","\\doublecap");M(P,le,it,"⋓","\\doublecup");M(P,le,it,"⊠","\\boxtimes",!0);M(P,le,ce,"⇢","\\dashrightarrow",!0);M(P,le,ce,"⇠","\\dashleftarrow",!0);M(P,le,ce,"⇇","\\leftleftarrows",!0);M(P,le,ce,"⇆","\\leftrightarrows",!0);M(P,le,ce,"⇚","\\Lleftarrow",!0);M(P,le,ce,"↞","\\twoheadleftarrow",!0);M(P,le,ce,"↢","\\leftarrowtail",!0);M(P,le,ce,"↫","\\looparrowleft",!0);M(P,le,ce,"⇋","\\leftrightharpoons",!0);M(P,le,ce,"↶","\\curvearrowleft",!0);M(P,le,ce,"↺","\\circlearrowleft",!0);M(P,le,ce,"↰","\\Lsh",!0);M(P,le,ce,"⇈","\\upuparrows",!0);M(P,le,ce,"↿","\\upharpoonleft",!0);M(P,le,ce,"⇃","\\downharpoonleft",!0);M(P,Q,ce,"⊶","\\origof",!0);M(P,Q,ce,"⊷","\\imageof",!0);M(P,le,ce,"⊸","\\multimap",!0);M(P,le,ce,"↭","\\leftrightsquigarrow",!0);M(P,le,ce,"⇉","\\rightrightarrows",!0);M(P,le,ce,"⇄","\\rightleftarrows",!0);M(P,le,ce,"↠","\\twoheadrightarrow",!0);M(P,le,ce,"↣","\\rightarrowtail",!0);M(P,le,ce,"↬","\\looparrowright",!0);M(P,le,ce,"↷","\\curvearrowright",!0);M(P,le,ce,"↻","\\circlearrowright",!0);M(P,le,ce,"↱","\\Rsh",!0);M(P,le,ce,"⇊","\\downdownarrows",!0);M(P,le,ce,"↾","\\upharpoonright",!0);M(P,le,ce,"⇂","\\downharpoonright",!0);M(P,le,ce,"⇝","\\rightsquigarrow",!0);M(P,le,ce,"⇝","\\leadsto");M(P,le,ce,"⇛","\\Rrightarrow",!0);M(P,le,ce,"↾","\\restriction");M(P,Q,me,"‘","`");M(P,Q,me,"$","\\$");M(Le,Q,me,"$","\\$");M(Le,Q,me,"$","\\textdollar");M(P,Q,me,"%","\\%");M(Le,Q,me,"%","\\%");M(P,Q,me,"_","\\_");M(Le,Q,me,"_","\\_");M(Le,Q,me,"_","\\textunderscore");M(P,Q,me,"∠","\\angle",!0);M(P,Q,me,"∞","\\infty",!0);M(P,Q,me,"′","\\prime");M(P,Q,me,"△","\\triangle");M(P,Q,me,"Γ","\\Gamma",!0);M(P,Q,me,"Δ","\\Delta",!0);M(P,Q,me,"Θ","\\Theta",!0);M(P,Q,me,"Λ","\\Lambda",!0);M(P,Q,me,"Ξ","\\Xi",!0);M(P,Q,me,"Π","\\Pi",!0);M(P,Q,me,"Σ","\\Sigma",!0);M(P,Q,me,"Υ","\\Upsilon",!0);M(P,Q,me,"Φ","\\Phi",!0);M(P,Q,me,"Ψ","\\Psi",!0);M(P,Q,me,"Ω","\\Omega",!0);M(P,Q,me,"A","Α");M(P,Q,me,"B","Β");M(P,Q,me,"E","Ε");M(P,Q,me,"Z","Ζ");M(P,Q,me,"H","Η");M(P,Q,me,"I","Ι");M(P,Q,me,"K","Κ");M(P,Q,me,"M","Μ");M(P,Q,me,"N","Ν");M(P,Q,me,"O","Ο");M(P,Q,me,"P","Ρ");M(P,Q,me,"T","Τ");M(P,Q,me,"X","Χ");M(P,Q,me,"¬","\\neg",!0);M(P,Q,me,"¬","\\lnot");M(P,Q,me,"⊤","\\top");M(P,Q,me,"⊥","\\bot");M(P,Q,me,"∅","\\emptyset");M(P,le,me,"∅","\\varnothing");M(P,Q,_t,"α","\\alpha",!0);M(P,Q,_t,"β","\\beta",!0);M(P,Q,_t,"γ","\\gamma",!0);M(P,Q,_t,"δ","\\delta",!0);M(P,Q,_t,"ϵ","\\epsilon",!0);M(P,Q,_t,"ζ","\\zeta",!0);M(P,Q,_t,"η","\\eta",!0);M(P,Q,_t,"θ","\\theta",!0);M(P,Q,_t,"ι","\\iota",!0);M(P,Q,_t,"κ","\\kappa",!0);M(P,Q,_t,"λ","\\lambda",!0);M(P,Q,_t,"μ","\\mu",!0);M(P,Q,_t,"ν","\\nu",!0);M(P,Q,_t,"ξ","\\xi",!0);M(P,Q,_t,"ο","\\omicron",!0);M(P,Q,_t,"π","\\pi",!0);M(P,Q,_t,"ρ","\\rho",!0);M(P,Q,_t,"σ","\\sigma",!0);M(P,Q,_t,"τ","\\tau",!0);M(P,Q,_t,"υ","\\upsilon",!0);M(P,Q,_t,"ϕ","\\phi",!0);M(P,Q,_t,"χ","\\chi",!0);M(P,Q,_t,"ψ","\\psi",!0);M(P,Q,_t,"ω","\\omega",!0);M(P,Q,_t,"ε","\\varepsilon",!0);M(P,Q,_t,"ϑ","\\vartheta",!0);M(P,Q,_t,"ϖ","\\varpi",!0);M(P,Q,_t,"ϱ","\\varrho",!0);M(P,Q,_t,"ς","\\varsigma",!0);M(P,Q,_t,"φ","\\varphi",!0);M(P,Q,it,"∗","*",!0);M(P,Q,it,"+","+");M(P,Q,it,"−","-",!0);M(P,Q,it,"⋅","\\cdot",!0);M(P,Q,it,"∘","\\circ",!0);M(P,Q,it,"÷","\\div",!0);M(P,Q,it,"±","\\pm",!0);M(P,Q,it,"×","\\times",!0);M(P,Q,it,"∩","\\cap",!0);M(P,Q,it,"∪","\\cup",!0);M(P,Q,it,"∖","\\setminus",!0);M(P,Q,it,"∧","\\land");M(P,Q,it,"∨","\\lor");M(P,Q,it,"∧","\\wedge",!0);M(P,Q,it,"∨","\\vee",!0);M(P,Q,me,"√","\\surd");M(P,Q,ra,"⟨","\\langle",!0);M(P,Q,ra,"∣","\\lvert");M(P,Q,ra,"∥","\\lVert");M(P,Q,li,"?","?");M(P,Q,li,"!","!");M(P,Q,li,"⟩","\\rangle",!0);M(P,Q,li,"∣","\\rvert");M(P,Q,li,"∥","\\rVert");M(P,Q,ce,"=","=");M(P,Q,ce,":",":");M(P,Q,ce,"≈","\\approx",!0);M(P,Q,ce,"≅","\\cong",!0);M(P,Q,ce,"≥","\\ge");M(P,Q,ce,"≥","\\geq",!0);M(P,Q,ce,"←","\\gets");M(P,Q,ce,">","\\gt",!0);M(P,Q,ce,"∈","\\in",!0);M(P,Q,ce,"","\\@not");M(P,Q,ce,"⊂","\\subset",!0);M(P,Q,ce,"⊃","\\supset",!0);M(P,Q,ce,"⊆","\\subseteq",!0);M(P,Q,ce,"⊇","\\supseteq",!0);M(P,le,ce,"⊈","\\nsubseteq",!0);M(P,le,ce,"⊉","\\nsupseteq",!0);M(P,Q,ce,"⊨","\\models");M(P,Q,ce,"←","\\leftarrow",!0);M(P,Q,ce,"≤","\\le");M(P,Q,ce,"≤","\\leq",!0);M(P,Q,ce,"<","\\lt",!0);M(P,Q,ce,"→","\\rightarrow",!0);M(P,Q,ce,"→","\\to");M(P,le,ce,"≱","\\ngeq",!0);M(P,le,ce,"≰","\\nleq",!0);M(P,Q,tc," ","\\ ");M(P,Q,tc," ","\\space");M(P,Q,tc," ","\\nobreakspace");M(Le,Q,tc," ","\\ ");M(Le,Q,tc," "," ");M(Le,Q,tc," ","\\space");M(Le,Q,tc," ","\\nobreakspace");M(P,Q,tc,null,"\\nobreak");M(P,Q,tc,null,"\\allowbreak");M(P,Q,Vb,",",",");M(P,Q,Vb,";",";");M(P,le,it,"⊼","\\barwedge",!0);M(P,le,it,"⊻","\\veebar",!0);M(P,Q,it,"⊙","\\odot",!0);M(P,Q,it,"⊕","\\oplus",!0);M(P,Q,it,"⊗","\\otimes",!0);M(P,Q,me,"∂","\\partial",!0);M(P,Q,it,"⊘","\\oslash",!0);M(P,le,it,"⊚","\\circledcirc",!0);M(P,le,it,"⊡","\\boxdot",!0);M(P,Q,it,"△","\\bigtriangleup");M(P,Q,it,"▽","\\bigtriangledown");M(P,Q,it,"†","\\dagger");M(P,Q,it,"⋄","\\diamond");M(P,Q,it,"⋆","\\star");M(P,Q,it,"◃","\\triangleleft");M(P,Q,it,"▹","\\triangleright");M(P,Q,ra,"{","\\{");M(Le,Q,me,"{","\\{");M(Le,Q,me,"{","\\textbraceleft");M(P,Q,li,"}","\\}");M(Le,Q,me,"}","\\}");M(Le,Q,me,"}","\\textbraceright");M(P,Q,ra,"{","\\lbrace");M(P,Q,li,"}","\\rbrace");M(P,Q,ra,"[","\\lbrack",!0);M(Le,Q,me,"[","\\lbrack",!0);M(P,Q,li,"]","\\rbrack",!0);M(Le,Q,me,"]","\\rbrack",!0);M(P,Q,ra,"(","\\lparen",!0);M(P,Q,li,")","\\rparen",!0);M(Le,Q,me,"<","\\textless",!0);M(Le,Q,me,">","\\textgreater",!0);M(P,Q,ra,"⌊","\\lfloor",!0);M(P,Q,li,"⌋","\\rfloor",!0);M(P,Q,ra,"⌈","\\lceil",!0);M(P,Q,li,"⌉","\\rceil",!0);M(P,Q,me,"\\","\\backslash");M(P,Q,me,"∣","|");M(P,Q,me,"∣","\\vert");M(Le,Q,me,"|","\\textbar",!0);M(P,Q,me,"∥","\\|");M(P,Q,me,"∥","\\Vert");M(Le,Q,me,"∥","\\textbardbl");M(Le,Q,me,"~","\\textasciitilde");M(Le,Q,me,"\\","\\textbackslash");M(Le,Q,me,"^","\\textasciicircum");M(P,Q,ce,"↑","\\uparrow",!0);M(P,Q,ce,"⇑","\\Uparrow",!0);M(P,Q,ce,"↓","\\downarrow",!0);M(P,Q,ce,"⇓","\\Downarrow",!0);M(P,Q,ce,"↕","\\updownarrow",!0);M(P,Q,ce,"⇕","\\Updownarrow",!0);M(P,Q,os,"∐","\\coprod");M(P,Q,os,"⋁","\\bigvee");M(P,Q,os,"⋀","\\bigwedge");M(P,Q,os,"⨄","\\biguplus");M(P,Q,os,"⋂","\\bigcap");M(P,Q,os,"⋃","\\bigcup");M(P,Q,os,"∫","\\int");M(P,Q,os,"∫","\\intop");M(P,Q,os,"∬","\\iint");M(P,Q,os,"∭","\\iiint");M(P,Q,os,"∏","\\prod");M(P,Q,os,"∑","\\sum");M(P,Q,os,"⨂","\\bigotimes");M(P,Q,os,"⨁","\\bigoplus");M(P,Q,os,"⨀","\\bigodot");M(P,Q,os,"∮","\\oint");M(P,Q,os,"∯","\\oiint");M(P,Q,os,"∰","\\oiiint");M(P,Q,os,"⨆","\\bigsqcup");M(P,Q,os,"∫","\\smallint");M(Le,Q,$f,"…","\\textellipsis");M(P,Q,$f,"…","\\mathellipsis");M(Le,Q,$f,"…","\\ldots",!0);M(P,Q,$f,"…","\\ldots",!0);M(P,Q,$f,"⋯","\\@cdots",!0);M(P,Q,$f,"⋱","\\ddots",!0);M(P,Q,me,"⋮","\\varvdots");M(Le,Q,me,"⋮","\\varvdots");M(P,Q,_r,"ˊ","\\acute");M(P,Q,_r,"ˋ","\\grave");M(P,Q,_r,"¨","\\ddot");M(P,Q,_r,"~","\\tilde");M(P,Q,_r,"ˉ","\\bar");M(P,Q,_r,"˘","\\breve");M(P,Q,_r,"ˇ","\\check");M(P,Q,_r,"^","\\hat");M(P,Q,_r,"⃗","\\vec");M(P,Q,_r,"˙","\\dot");M(P,Q,_r,"˚","\\mathring");M(P,Q,_t,"","\\@imath");M(P,Q,_t,"","\\@jmath");M(P,Q,me,"ı","ı");M(P,Q,me,"ȷ","ȷ");M(Le,Q,me,"ı","\\i",!0);M(Le,Q,me,"ȷ","\\j",!0);M(Le,Q,me,"ß","\\ss",!0);M(Le,Q,me,"æ","\\ae",!0);M(Le,Q,me,"œ","\\oe",!0);M(Le,Q,me,"ø","\\o",!0);M(Le,Q,me,"Æ","\\AE",!0);M(Le,Q,me,"Œ","\\OE",!0);M(Le,Q,me,"Ø","\\O",!0);M(Le,Q,_r,"ˊ","\\'");M(Le,Q,_r,"ˋ","\\`");M(Le,Q,_r,"ˆ","\\^");M(Le,Q,_r,"˜","\\~");M(Le,Q,_r,"ˉ","\\=");M(Le,Q,_r,"˘","\\u");M(Le,Q,_r,"˙","\\.");M(Le,Q,_r,"¸","\\c");M(Le,Q,_r,"˚","\\r");M(Le,Q,_r,"ˇ","\\v");M(Le,Q,_r,"¨",'\\"');M(Le,Q,_r,"˝","\\H");M(Le,Q,_r,"◯","\\textcircled");var sU={"--":!0,"---":!0,"``":!0,"''":!0};M(Le,Q,me,"–","--",!0);M(Le,Q,me,"–","\\textendash");M(Le,Q,me,"—","---",!0);M(Le,Q,me,"—","\\textemdash");M(Le,Q,me,"‘","`",!0);M(Le,Q,me,"‘","\\textquoteleft");M(Le,Q,me,"’","'",!0);M(Le,Q,me,"’","\\textquoteright");M(Le,Q,me,"“","``",!0);M(Le,Q,me,"“","\\textquotedblleft");M(Le,Q,me,"”","''",!0);M(Le,Q,me,"”","\\textquotedblright");M(P,Q,me,"°","\\degree",!0);M(Le,Q,me,"°","\\degree");M(Le,Q,me,"°","\\textdegree",!0);M(P,Q,me,"£","\\pounds");M(P,Q,me,"£","\\mathsterling",!0);M(Le,Q,me,"£","\\pounds");M(Le,Q,me,"£","\\textsterling",!0);M(P,le,me,"✠","\\maltese");M(Le,le,me,"✠","\\maltese");var wR='0123456789/@."';for(var YS=0;YS0)return Ha(i,d,s,n,a.concat(h));if(c){var m,g;if(c==="boldsymbol"){var x=p3e(i,s,n,a,r);m=x.fontName,g=[x.fontClass]}else l?(m=oU[c].fontName,g=[c]):(m=F1(c,n.fontWeight,n.fontShape),g=[c,n.fontWeight,n.fontShape]);if(Ub(i,m,s).metrics)return Ha(i,m,s,n,a.concat(g));if(sU.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w{if(ru(t.classes)!==ru(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},v3e=t=>{for(var e=0;en&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},gi=function(e,n,r,s){var i=new bg(e,n,r,s);return DN(i),i},iU=(t,e,n,r)=>new bg(t,e,n,r),y3e=function(e,n,r){var s=gi([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Xe(s.height),s.maxFontSize=1,s},b3e=function(e,n,r,s){var i=new RN(e,n,r,s);return DN(i),i},aU=function(e){var n=new yg(e);return DN(n),n},w3e=function(e,n){return e instanceof yg?gi([],[e],n):e},S3e=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,a=1;a{var n=gi(["mspace"],[],e),r=Ir(t,e);return n.style.marginRight=Xe(r),n},F1=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},oU={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"}},lU={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},j3e=function(e,n){var[r,s,i]=lU[e],a=new su(r),l=new Ul([a],{width:Xe(s),height:Xe(i),style:"width:"+Xe(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=iU(["overlay"],[l],n);return c.height=i,c.style.height=Xe(i),c.style.width=Xe(s),c},we={fontMap:oU,makeSymbol:Ha,mathsym:m3e,makeSpan:gi,makeSvgSpan:iU,makeLineSpan:y3e,makeAnchor:b3e,makeFragment:aU,wrapFragment:w3e,makeVList:k3e,makeOrd:g3e,makeGlue:O3e,staticSvg:j3e,svgData:lU,tryCombineChars:v3e},Pr={number:3,unit:"mu"},Bu={number:4,unit:"mu"},Sl={number:5,unit:"mu"},N3e={mord:{mop:Pr,mbin:Bu,mrel:Sl,minner:Pr},mop:{mord:Pr,mop:Pr,mrel:Sl,minner:Pr},mbin:{mord:Bu,mop:Bu,mopen:Bu,minner:Bu},mrel:{mord:Sl,mop:Sl,mopen:Sl,minner:Sl},mopen:{},mclose:{mop:Pr,mbin:Bu,mrel:Sl,minner:Pr},mpunct:{mord:Pr,mop:Pr,mrel:Sl,mopen:Pr,mclose:Pr,mpunct:Pr,minner:Pr},minner:{mord:Pr,mop:Pr,mbin:Bu,mrel:Sl,mopen:Pr,mpunct:Pr,minner:Pr}},C3e={mord:{mop:Pr},mop:{mord:Pr,mop:Pr},mbin:{},mrel:{},mopen:{},mclose:{mop:Pr},mpunct:{},minner:{mop:Pr}},cU={},Ey={},_y={};function tt(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,l={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},c=0;c{var S=w.classes[0],k=y.classes[0];S==="mbin"&&E3e.includes(k)?w.classes[0]="mord":k==="mbin"&&T3e.includes(S)&&(y.classes[0]="mord")},{node:m},g,x),NR(i,(y,w)=>{var S=VO(w),k=VO(y),j=S&&k?y.hasClass("mtight")?C3e[S][k]:N3e[S][k]:null;if(j)return we.makeGlue(j,d)},{node:m},g,x),i},NR=function t(e,n,r,s,i){s&&e.push(s);for(var a=0;ag=>{e.splice(m+1,0,g),a++})(a)}s&&e.pop()},uU=function(e){return e instanceof yg||e instanceof RN||e instanceof bg&&e.hasClass("enclosing")?e:null},M3e=function t(e,n){var r=uU(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},VO=function(e,n){return e?(n&&(e=M3e(e,n)),A3e[e.classes[0]]||null):null},Sp=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return Wl(n.concat(r))},qn=function(e,n,r){if(!e)return Wl();if(Ey[e.type]){var s=Ey[e.type](e,n);if(r&&n.size!==r.size){s=Wl(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new qe("Got group of unknown type: '"+e.type+"'")};function q1(t,e){var n=Wl(["base"],t,e),r=Wl(["strut"]);return r.style.height=Xe(n.height+n.depth),n.depth&&(r.style.verticalAlign=Xe(-n.depth)),n.children.unshift(r),n}function UO(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=ms(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],l=0;l0&&(i.push(q1(a,e)),a=[]),i.push(r[l]));a.length>0&&i.push(q1(a,e));var d;n?(d=q1(ms(n,e,!0)),d.classes=["tag"],i.push(d)):s&&i.push(s);var h=Wl(["katex-html"],i);if(h.setAttribute("aria-hidden","true"),d){var m=d.children[0];m.style.height=Xe(h.height+h.depth),h.depth&&(m.style.verticalAlign=Xe(-h.depth))}return h}function dU(t){return new yg(t)}class Ui{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=ru(this.classes));for(var r=0;r0&&(e+=' class ="'+Wn.escape(ru(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Ro{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Wn.escape(this.toText())}toText(){return this.text}}class R3e{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",Xe(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var Fe={MathNode:Ui,TextNode:Ro,SpaceNode:R3e,newDocumentFragment:dU},Ra=function(e,n,r){return pr[n][e]&&pr[n][e].replace&&e.charCodeAt(0)!==55349&&!(sU.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=pr[n][e].replace),new Fe.TextNode(e)},PN=function(e){return e.length===1?e[0]:new Fe.MathNode("mrow",e)},zN=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;pr[s][i]&&pr[s][i].replace&&(i=pr[s][i].replace);var a=we.fontMap[r].fontName;return MN(i,a,s)?we.fontMap[r].variant:null};function e5(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Ro&&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 Ro&&n.text===","}else return!1}var Mi=function(e,n,r){if(e.length===1){var s=hr(e[0],n);return r&&s instanceof Ui&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,l=0;l=1&&(a.type==="mn"||e5(a))){var d=c.children[0];d instanceof Ui&&d.type==="mn"&&(d.children=[...a.children,...d.children],i.pop())}else if(a.type==="mi"&&a.children.length===1){var h=a.children[0];if(h instanceof Ro&&h.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var m=c.children[0];m instanceof Ro&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),i.pop())}}}i.push(c),a=c}return i},iu=function(e,n,r){return PN(Mi(e,n,r))},hr=function(e,n){if(!e)return new Fe.MathNode("mrow");if(_y[e.type]){var r=_y[e.type](e,n);return r}else throw new qe("Got group of unknown type: '"+e.type+"'")};function CR(t,e,n,r,s){var i=Mi(t,n),a;i.length===1&&i[0]instanceof Ui&&["mrow","mtable"].includes(i[0].type)?a=i[0]:a=new Fe.MathNode("mrow",i);var l=new Fe.MathNode("annotation",[new Fe.TextNode(e)]);l.setAttribute("encoding","application/x-tex");var c=new Fe.MathNode("semantics",[a,l]),d=new Fe.MathNode("math",[c]);d.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&d.setAttribute("display","block");var h=s?"katex":"katex-mathml";return we.makeSpan([h],[d])}var hU=function(e){return new Al({style:e.displayMode?At.DISPLAY:At.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},fU=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=we.makeSpan(r,[e])}return e},D3e=function(e,n,r){var s=hU(r),i;if(r.output==="mathml")return CR(e,n,s,r.displayMode,!0);if(r.output==="html"){var a=UO(e,s);i=we.makeSpan(["katex"],[a])}else{var l=CR(e,n,s,r.displayMode,!1),c=UO(e,s);i=we.makeSpan(["katex"],[l,c])}return fU(i,r)},P3e=function(e,n,r){var s=hU(r),i=UO(e,s),a=we.makeSpan(["katex"],[i]);return fU(a,r)},z3e={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":"="},I3e=function(e){var n=new Fe.MathNode("mo",[new Fe.TextNode(z3e[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},L3e={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]},B3e=function(e){return e.type==="ordgroup"?e.body.length:1},F3e=function(e,n){function r(){var l=4e5,c=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(c)){var d=e,h=B3e(d.base),m,g,x;if(h>5)c==="widehat"||c==="widecheck"?(m=420,l=2364,x=.42,g=c+"4"):(m=312,l=2340,x=.34,g="tilde4");else{var y=[1,1,2,2,3,3][h];c==="widehat"||c==="widecheck"?(l=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],x=[0,.24,.3,.3,.36,.42][y],g=c+y):(l=[0,600,1033,2339,2340][y],m=[0,260,286,306,312][y],x=[0,.26,.286,.3,.306,.34][y],g="tilde"+y)}var w=new su(g),S=new Ul([w],{width:"100%",height:Xe(x),viewBox:"0 0 "+l+" "+m,preserveAspectRatio:"none"});return{span:we.makeSvgSpan([],[S],n),minWidth:0,height:x}}else{var k=[],j=L3e[c],[N,T,E]=j,_=E/1e3,A=N.length,D,q;if(A===1){var B=j[3];D=["hide-tail"],q=[B]}else if(A===2)D=["halfarrow-left","halfarrow-right"],q=["xMinYMin","xMaxYMin"];else if(A===3)D=["brace-left","brace-center","brace-right"],q=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+A+" children.");for(var H=0;H0&&(s.style.minWidth=Xe(i)),s},q3e=function(e,n,r,s,i){var a,l=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(a=we.makeSpan(["stretchy",n],[],i),n==="fbox"){var c=i.color&&i.getColor();c&&(a.style.borderColor=c)}}else{var d=[];/^[bx]cancel$/.test(n)&&d.push(new HO({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&d.push(new HO({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new Ul(d,{width:"100%",height:Xe(l)});a=we.makeSvgSpan([],[h],i)}return a.height=l,a.style.height=Xe(l),a},Gl={encloseSpan:q3e,mathMLnode:I3e,svgSpan:F3e};function nn(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 IN(t){var e=Wb(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 Wb(t){return t&&(t.type==="atom"||h3e.hasOwnProperty(t.type))?t:null}var LN=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=nn(t.base,"accent"),n=r.base,t.base=n,s=u3e(qn(t,e)),t.base=r):(r=nn(t,"accent"),n=r.base);var i=qn(n,e.havingCrampedStyle()),a=r.isShifty&&Wn.isCharacterBox(n),l=0;if(a){var c=Wn.getBaseElem(n),d=qn(c,e.havingCrampedStyle());l=bR(d).skew}var h=r.label==="\\c",m=h?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),g;if(r.isStretchy)g=Gl.svgSpan(r,e),g=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+Xe(2*l)+")",marginLeft:Xe(2*l)}:void 0}]},e);else{var x,y;r.label==="\\vec"?(x=we.staticSvg("vec",e),y=we.svgData.vec[1]):(x=we.makeOrd({mode:r.mode,text:r.label},e,"textord"),x=bR(x),x.italic=0,y=x.width,h&&(m+=x.depth)),g=we.makeSpan(["accent-body"],[x]);var w=r.label==="\\textcircled";w&&(g.classes.push("accent-full"),m=i.height);var S=l;w||(S-=y/2),g.style.left=Xe(S),r.label==="\\textcircled"&&(g.style.top=".2em"),g=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:g}]},e)}var k=we.makeSpan(["mord","accent"],[g],e);return s?(s.children[0]=k,s.height=Math.max(k.height,s.height),s.classes[0]="mord",s):k},mU=(t,e)=>{var n=t.isStretchy?Gl.mathMLnode(t.label):new Fe.MathNode("mo",[Ra(t.label,t.mode)]),r=new Fe.MathNode("mover",[hr(t.base,e),n]);return r.setAttribute("accent","true"),r},$3e=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));tt({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=Ay(e[0]),r=!$3e.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:LN,mathmlBuilder:mU});tt({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:LN,mathmlBuilder:mU});tt({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=qn(t.base,e),r=Gl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=we.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return we.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=Gl.mathMLnode(t.label),r=new Fe.MathNode("munder",[hr(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var $1=t=>{var e=new Fe.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};tt({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=we.wrapFragment(qn(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var a;t.below&&(r=e.havingStyle(n.sub()),a=we.wrapFragment(qn(t.below,r,e),e),a.classes.push(i+"-arrow-pad"));var l=Gl.svgSpan(t,e),c=-e.fontMetrics().axisHeight+.5*l.height,d=-e.fontMetrics().axisHeight-.5*l.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(d-=s.depth);var h;if(a){var m=-e.fontMetrics().axisHeight+a.height+.5*l.height+.111;h=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:d},{type:"elem",elem:l,shift:c},{type:"elem",elem:a,shift:m}]},e)}else h=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:d},{type:"elem",elem:l,shift:c}]},e);return h.children[0].children[0].children[1].classes.push("svg-align"),we.makeSpan(["mrel","x-arrow"],[h],e)},mathmlBuilder(t,e){var n=Gl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=$1(hr(t.body,e));if(t.below){var i=$1(hr(t.below,e));r=new Fe.MathNode("munderover",[n,i,s])}else r=new Fe.MathNode("mover",[n,s])}else if(t.below){var a=$1(hr(t.below,e));r=new Fe.MathNode("munder",[n,a])}else r=$1(),r=new Fe.MathNode("mover",[n,r]);return r}});var H3e=we.makeSpan;function pU(t,e){var n=ms(t.body,e,!0);return H3e([t.mclass],n,e)}function gU(t,e){var n,r=Mi(t.body,e);return t.mclass==="minner"?n=new Fe.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new Fe.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new Fe.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}tt({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:Gr(s),isCharacterBox:Wn.isCharacterBox(s)}},htmlBuilder:pU,mathmlBuilder:gU});var Gb=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"};tt({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Gb(e[0]),body:Gr(e[1]),isCharacterBox:Wn.isCharacterBox(e[1])}}});tt({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],a;r!=="\\stackrel"?a=Gb(s):a="mrel";var l={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Gr(s)},c={type:"supsub",mode:i.mode,base:l,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:a,body:[c],isCharacterBox:Wn.isCharacterBox(c)}},htmlBuilder:pU,mathmlBuilder:gU});tt({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Gb(e[0]),body:Gr(e[0])}},htmlBuilder(t,e){var n=ms(t.body,e,!0),r=we.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Mi(t.body,e),r=new Fe.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Q3e={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},TR=()=>({type:"styling",body:[],mode:"math",style:"display"}),ER=t=>t.type==="textord"&&t.text==="@",V3e=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function U3e(t,e,n){var r=Q3e[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},a=n.callFunction("\\Big",[i],[]),l=n.callFunction("\\\\cdright",[e[1]],[]),c={type:"ordgroup",mode:"math",body:[s,a,l]};return n.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var d={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[d],[])}default:return{type:"textord",text:" ",mode:"math"}}}function W3e(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 qe("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(d)>-1)for(var m=0;m<2;m++){for(var g=!0,x=c+1;xAV=|." after @',a[c]);var y=U3e(d,h,t),w={type:"styling",body:[y],mode:"math",style:"display"};r.push(w),l=TR()}i%2===0?r.push(l):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var S=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:S,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}tt({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=we.wrapFragment(qn(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Xe(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new Fe.MathNode("mrow",[hr(t.label,e)]);return n=new Fe.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Fe.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});tt({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=we.wrapFragment(qn(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new Fe.MathNode("mrow",[hr(t.fragment,e)])}});tt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=nn(e[0],"ordgroup"),s=r.body,i="",a=0;a=1114111)throw new qe("\\@char with invalid code point "+i);return c<=65535?d=String.fromCharCode(c):(c-=65536,d=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:n.mode,text:d}}});var xU=(t,e)=>{var n=ms(t.body,e.withColor(t.color),!1);return we.makeFragment(n)},vU=(t,e)=>{var n=Mi(t.body,e.withColor(t.color)),r=new Fe.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};tt({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=nn(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:Gr(s)}},htmlBuilder:xU,mathmlBuilder:vU});tt({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=nn(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:xU,mathmlBuilder:vU});tt({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&&nn(s,"size").value}},htmlBuilder(t,e){var n=we.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Xe(Ir(t.size,e)))),n},mathmlBuilder(t,e){var n=new Fe.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Xe(Ir(t.size,e)))),n}});var WO={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},yU=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new qe("Expected a control sequence",t);return e},G3e=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},bU=(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)};tt({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(WO[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=WO[r.text]),nn(e.parseFunction(),"internal");throw new qe("Invalid token after macro prefix",r)}});tt({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 qe("Expected a control sequence",r);for(var i=0,a,l=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),l[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new qe('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new qe('Argument number "'+r.text+'" out of order');i++,l.push([])}else{if(r.text==="EOF")throw new qe("Expected a macro definition");l[i].push(r.text)}var{tokens:c}=e.gullet.consumeArg();return a&&c.unshift(a),(n==="\\edef"||n==="\\xdef")&&(c=e.gullet.expandTokens(c),c.reverse()),e.gullet.macros.set(s,{tokens:c,numArgs:i,delimiters:l},n===WO[n]),{type:"internal",mode:e.mode}}});tt({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=yU(e.gullet.popToken());e.gullet.consumeSpaces();var s=G3e(e);return bU(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});tt({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=yU(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return bU(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var f0=function(e,n,r){var s=pr.math[e]&&pr.math[e].replace,i=MN(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},BN=function(e,n,r,s){var i=r.havingBaseStyle(n),a=we.makeSpan(s.concat(i.sizingClasses(r)),[e],r),l=i.sizeMultiplier/r.sizeMultiplier;return a.height*=l,a.depth*=l,a.maxFontSize=i.sizeMultiplier,a},wU=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=Xe(i),e.height-=i,e.depth+=i},X3e=function(e,n,r,s,i,a){var l=we.makeSymbol(e,"Main-Regular",i,s),c=BN(l,n,s,a);return r&&wU(c,s,n),c},Y3e=function(e,n,r,s){return we.makeSymbol(e,"Size"+n+"-Regular",r,s)},SU=function(e,n,r,s,i,a){var l=Y3e(e,n,i,s),c=BN(we.makeSpan(["delimsizing","size"+n],[l],s),At.TEXT,s,a);return r&&wU(c,s,At.TEXT),c},t5=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=we.makeSpan(["delimsizinginner",s],[we.makeSpan([],[we.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},n5=function(e,n,r){var s=Mo["Size4-Regular"][e.charCodeAt(0)]?Mo["Size4-Regular"][e.charCodeAt(0)][4]:Mo["Size1-Regular"][e.charCodeAt(0)][4],i=new su("inner",t3e(e,Math.round(1e3*n))),a=new Ul([i],{width:Xe(s),height:Xe(n),style:"width:"+Xe(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),l=we.makeSvgSpan([],[a],r);return l.height=n,l.style.height=Xe(n),l.style.width=Xe(s),{type:"elem",elem:l}},GO=.008,H1={type:"kern",size:-1*GO},K3e=["|","\\lvert","\\rvert","\\vert"],Z3e=["\\|","\\lVert","\\rVert","\\Vert"],kU=function(e,n,r,s,i,a){var l,c,d,h,m="",g=0;l=d=h=e,c=null;var x="Size1-Regular";e==="\\uparrow"?d=h="⏐":e==="\\Uparrow"?d=h="‖":e==="\\downarrow"?l=d="⏐":e==="\\Downarrow"?l=d="‖":e==="\\updownarrow"?(l="\\uparrow",d="⏐",h="\\downarrow"):e==="\\Updownarrow"?(l="\\Uparrow",d="‖",h="\\Downarrow"):K3e.includes(e)?(d="∣",m="vert",g=333):Z3e.includes(e)?(d="∥",m="doublevert",g=556):e==="["||e==="\\lbrack"?(l="⎡",d="⎢",h="⎣",x="Size4-Regular",m="lbrack",g=667):e==="]"||e==="\\rbrack"?(l="⎤",d="⎥",h="⎦",x="Size4-Regular",m="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(d=l="⎢",h="⎣",x="Size4-Regular",m="lfloor",g=667):e==="\\lceil"||e==="⌈"?(l="⎡",d=h="⎢",x="Size4-Regular",m="lceil",g=667):e==="\\rfloor"||e==="⌋"?(d=l="⎥",h="⎦",x="Size4-Regular",m="rfloor",g=667):e==="\\rceil"||e==="⌉"?(l="⎤",d=h="⎥",x="Size4-Regular",m="rceil",g=667):e==="("||e==="\\lparen"?(l="⎛",d="⎜",h="⎝",x="Size4-Regular",m="lparen",g=875):e===")"||e==="\\rparen"?(l="⎞",d="⎟",h="⎠",x="Size4-Regular",m="rparen",g=875):e==="\\{"||e==="\\lbrace"?(l="⎧",c="⎨",h="⎩",d="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(l="⎫",c="⎬",h="⎭",d="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(l="⎧",h="⎩",d="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(l="⎫",h="⎭",d="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(l="⎧",h="⎭",d="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(l="⎫",h="⎩",d="⎪",x="Size4-Regular");var y=f0(l,x,i),w=y.height+y.depth,S=f0(d,x,i),k=S.height+S.depth,j=f0(h,x,i),N=j.height+j.depth,T=0,E=1;if(c!==null){var _=f0(c,x,i);T=_.height+_.depth,E=2}var A=w+N+T,D=Math.max(0,Math.ceil((n-A)/(E*k))),q=A+D*E*k,B=s.fontMetrics().axisHeight;r&&(B*=s.sizeMultiplier);var H=q/2-B,W=[];if(m.length>0){var ee=q-w-N,I=Math.round(q*1e3),V=n3e(m,Math.round(ee*1e3)),L=new su(m,V),$=(g/1e3).toFixed(3)+"em",K=(I/1e3).toFixed(3)+"em",Y=new Ul([L],{width:$,height:K,viewBox:"0 0 "+g+" "+I}),R=we.makeSvgSpan([],[Y],s);R.height=I/1e3,R.style.width=$,R.style.height=K,W.push({type:"elem",elem:R})}else{if(W.push(t5(h,x,i)),W.push(H1),c===null){var ie=q-w-N+2*GO;W.push(n5(d,ie,s))}else{var X=(q-w-N-T)/2+2*GO;W.push(n5(d,X,s)),W.push(H1),W.push(t5(c,x,i)),W.push(H1),W.push(n5(d,X,s))}W.push(H1),W.push(t5(l,x,i))}var z=s.havingBaseStyle(At.TEXT),U=we.makeVList({positionType:"bottom",positionData:H,children:W},z);return BN(we.makeSpan(["delimsizing","mult"],[U],z),At.TEXT,s,a)},r5=80,s5=.08,i5=function(e,n,r,s,i){var a=e3e(e,s,r),l=new su(e,a),c=new Ul([l],{width:"400em",height:Xe(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return we.makeSvgSpan(["hide-tail"],[c],i)},J3e=function(e,n){var r=n.havingBaseSizing(),s=CU("\\surd",e*r.sizeMultiplier,NU,r),i=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),l,c=0,d=0,h=0,m;return s.type==="small"?(h=1e3+1e3*a+r5,e<1?i=1:e<1.4&&(i=.7),c=(1+a+s5)/i,d=(1+a)/i,l=i5("sqrtMain",c,h,a,n),l.style.minWidth="0.853em",m=.833/i):s.type==="large"?(h=(1e3+r5)*z0[s.size],d=(z0[s.size]+a)/i,c=(z0[s.size]+a+s5)/i,l=i5("sqrtSize"+s.size,c,h,a,n),l.style.minWidth="1.02em",m=1/i):(c=e+a+s5,d=e+a,h=Math.floor(1e3*e+a)+r5,l=i5("sqrtTall",c,h,a,n),l.style.minWidth="0.742em",m=1.056),l.height=d,l.style.height=Xe(c),{span:l,advanceWidth:m,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*i}},OU=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],eke=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],jU=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],z0=[0,1.2,1.8,2.4,3],tke=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),OU.includes(e)||jU.includes(e))return SU(e,n,!1,r,s,i);if(eke.includes(e))return kU(e,z0[n],!1,r,s,i);throw new qe("Illegal delimiter: '"+e+"'")},nke=[{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}],rke=[{type:"small",style:At.SCRIPTSCRIPT},{type:"small",style:At.SCRIPT},{type:"small",style:At.TEXT},{type:"stack"}],NU=[{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"}],ske=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.")},CU=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),a=i;an)return r[a]}return r[r.length-1]},TU=function(e,n,r,s,i,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var l;jU.includes(e)?l=nke:OU.includes(e)?l=NU:l=rke;var c=CU(e,n,l,s);return c.type==="small"?X3e(e,c.style,r,s,i,a):c.type==="large"?SU(e,c.size,r,s,i,a):kU(e,n,r,s,i,a)},ike=function(e,n,r,s,i,a){var l=s.fontMetrics().axisHeight*s.sizeMultiplier,c=901,d=5/s.fontMetrics().ptPerEm,h=Math.max(n-l,r+l),m=Math.max(h/500*c,2*h-d);return TU(e,m,!0,s,i,a)},ql={sqrtImage:J3e,sizedDelim:tke,sizeToMaxHeight:z0,customSizedDelim:TU,leftRightDelim:ike},_R={"\\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}},ake=["(","\\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 Xb(t,e){var n=Wb(t);if(n&&ake.includes(n.text))return n;throw n?new qe("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new qe("Invalid delimiter type '"+t.type+"'",t)}tt({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=Xb(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:_R[t.funcName].size,mclass:_R[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?we.makeSpan([t.mclass]):ql.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Ra(t.delim,t.mode));var n=new Fe.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Xe(ql.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function AR(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}tt({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 qe("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Xb(e[0],t).text,color:n}}});tt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Xb(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=nn(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{AR(t);for(var n=ms(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a{AR(t);var n=Mi(t.body,e);if(t.left!=="."){var r=new Fe.MathNode("mo",[Ra(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new Fe.MathNode("mo",[Ra(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return PN(n)}});tt({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=Xb(e[0],t);if(!t.parser.leftrightDepth)throw new qe("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=Sp(e,[]);else{n=ql.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==="|"?Ra("|","text"):Ra(t.delim,t.mode),r=new Fe.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var FN=(t,e)=>{var n=we.wrapFragment(qn(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,a=0,l=Wn.isCharacterBox(t.body);if(r==="sout")i=we.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,a=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var c=Ir({number:.6,unit:"pt"},e),d=Ir({number:.35,unit:"ex"},e),h=e.havingBaseSizing();s=s/h.sizeMultiplier;var m=n.height+n.depth+c+d;n.style.paddingLeft=Xe(m/2+c);var g=Math.floor(1e3*m*s),x=Z5e(g),y=new Ul([new su("phase",x)],{width:"400em",height:Xe(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});i=we.makeSvgSpan(["hide-tail"],[y],e),i.style.height=Xe(m),a=n.depth+c+d}else{/cancel/.test(r)?l||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var w=0,S=0,k=0;/box/.test(r)?(k=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),w=e.fontMetrics().fboxsep+(r==="colorbox"?0:k),S=w):r==="angl"?(k=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),w=4*k,S=Math.max(0,.25-n.depth)):(w=l?.2:0,S=w),i=Gl.encloseSpan(n,r,w,S,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Xe(k)):r==="angl"&&k!==.049&&(i.style.borderTopWidth=Xe(k),i.style.borderRightWidth=Xe(k)),a=n.depth+S,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var j;if(t.backgroundColor)j=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:a},{type:"elem",elem:n,shift:0}]},e);else{var N=/cancel|phase/.test(r)?["svg-align"]:[];j=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:a,wrapperClasses:N}]},e)}return/cancel/.test(r)&&(j.height=n.height,j.depth=n.depth),/cancel/.test(r)&&!l?we.makeSpan(["mord","cancel-lap"],[j],e):we.makeSpan(["mord"],[j],e)},qN=(t,e)=>{var n=0,r=new Fe.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[hr(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};tt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=nn(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:FN,mathmlBuilder:qN});tt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=nn(e[0],"color-token").color,a=nn(e[1],"color-token").color,l=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:l}},htmlBuilder:FN,mathmlBuilder:qN});tt({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]}}});tt({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:FN,mathmlBuilder:qN});tt({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 EU={};function Go(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,l={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},c=0;c{var e=t.parser.settings;if(!e.displayMode)throw new qe("{"+t.envName+"} can be used only in display mode.")};function $N(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function mu(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:l,autoTag:c,singleRow:d,emptySingleRow:h,maxNumCols:m,leqno:g}=e;if(t.gullet.beginGroup(),d||t.gullet.macros.set("\\cr","\\\\\\relax"),!a){var x=t.gullet.expandMacroAsText("\\arraystretch");if(x==null)a=1;else if(a=parseFloat(x),!a||a<0)throw new qe("Invalid \\arraystretch: "+x)}t.gullet.beginGroup();var y=[],w=[y],S=[],k=[],j=c!=null?[]:void 0;function N(){c&&t.gullet.macros.set("\\@eqnsw","1",!0)}function T(){j&&(t.gullet.macros.get("\\df@tag")?(j.push(t.subparse([new Zi("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):j.push(!!c&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(N(),k.push(MR(t));;){var E=t.parseExpression(!1,d?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),E={type:"ordgroup",mode:t.mode,body:E},n&&(E={type:"styling",mode:t.mode,style:n,body:[E]}),y.push(E);var _=t.fetch().text;if(_==="&"){if(m&&y.length===m){if(d||l)throw new qe("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(_==="\\end"){T(),y.length===1&&E.type==="styling"&&E.body[0].body.length===0&&(w.length>1||!h)&&w.pop(),k.length0&&(N+=.25),d.push({pos:N,isDashed:$e[jt]})}for(T(a[0]),r=0;r0&&(H+=j,A$e))for(r=0;r=l)){var G=void 0;(s>0||e.hskipBeforeAndAfter)&&(G=Wn.deflt(X.pregap,g),G!==0&&(V=we.makeSpan(["arraycolsep"],[]),V.style.width=Xe(G),I.push(V)));var se=[];for(r=0;r0){for(var Be=we.makeLineSpan("hline",n,h),Ye=we.makeLineSpan("hdashline",n,h),Je=[{type:"elem",elem:c,shift:0}];d.length>0;){var Oe=d.pop(),Ve=Oe.pos-W;Oe.isDashed?Je.push({type:"elem",elem:Ye,shift:Ve}):Je.push({type:"elem",elem:Be,shift:Ve})}c=we.makeVList({positionType:"individualShift",children:Je},n)}if($.length===0)return we.makeSpan(["mord"],[c],n);var Ue=we.makeVList({positionType:"individualShift",children:$},n);return Ue=we.makeSpan(["tag"],[Ue],n),we.makeFragment([c,Ue])},oke={c:"center ",l:"left ",r:"right "},Yo=function(e,n){for(var r=[],s=new Fe.MathNode("mtd",[],["mtr-glue"]),i=new Fe.MathNode("mtd",[],["mml-eqn-num"]),a=0;a0){var y=e.cols,w="",S=!1,k=0,j=y.length;y[0].type==="separator"&&(g+="top ",k=1),y[y.length-1].type==="separator"&&(g+="bottom ",j-=1);for(var N=k;N0?"left ":"",g+=D[D.length-1].length>0?"right ":"";for(var q=1;q-1?"alignat":"align",i=e.envName==="split",a=mu(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:$N(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),l,c=0,d={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var h="",m=0;m0&&x&&(S=1),r[y]={type:"align",align:w,pregap:S,postgap:0}}return a.colSeparationType=x?"align":"alignat",a};Go({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=Wb(e[0]),r=n?[e[0]]:nn(e[0],"ordgroup").body,s=r.map(function(a){var l=IN(a),c=l.text;if("lcr".indexOf(c)!==-1)return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new qe("Unknown column alignment: "+c,a)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return mu(t.parser,i,HN(t.envName))},htmlBuilder:Xo,mathmlBuilder:Yo});Go({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 qe("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=mu(t.parser,r,HN(t.envName)),a=Math.max(0,...i.body.map(l=>l.length));return i.cols=new Array(a).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Xo,mathmlBuilder:Yo});Go({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=mu(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Xo,mathmlBuilder:Yo});Go({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=Wb(e[0]),r=n?[e[0]]:nn(e[0],"ordgroup").body,s=r.map(function(a){var l=IN(a),c=l.text;if("lc".indexOf(c)!==-1)return{type:"align",align:c};throw new qe("Unknown column alignment: "+c,a)});if(s.length>1)throw new qe("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=mu(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new qe("{subarray} can contain only one column");return i},htmlBuilder:Xo,mathmlBuilder:Yo});Go({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=mu(t.parser,e,HN(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:Xo,mathmlBuilder:Yo});Go({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:AU,htmlBuilder:Xo,mathmlBuilder:Yo});Go({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Yb(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:$N(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return mu(t.parser,e,"display")},htmlBuilder:Xo,mathmlBuilder:Yo});Go({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:AU,htmlBuilder:Xo,mathmlBuilder:Yo});Go({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Yb(t);var e={autoTag:$N(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return mu(t.parser,e,"display")},htmlBuilder:Xo,mathmlBuilder:Yo});Go({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Yb(t),W3e(t.parser)},htmlBuilder:Xo,mathmlBuilder:Yo});J("\\nonumber","\\gdef\\@eqnsw{0}");J("\\notag","\\nonumber");tt({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new qe(t.funcName+" valid only within array environment")}});var RR=EU;tt({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 qe("Invalid environment name",s);for(var i="",a=0;a{var n=t.font,r=e.withFont(n);return qn(t.body,r)},RU=(t,e)=>{var n=t.font,r=e.withFont(n);return hr(t.body,r)},DR={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};tt({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=Ay(e[0]),i=r;return i in DR&&(i=DR[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:MU,mathmlBuilder:RU});tt({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=Wn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Gb(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});tt({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,a=n.parseExpression(!0,s),l="math"+r.slice(1);return{type:"font",mode:i,font:l,body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:MU,mathmlBuilder:RU});var DU=(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},QN=(t,e)=>{var n=DU(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var a=qn(t.numer,i,e);if(t.continued){var l=8.5/e.fontMetrics().ptPerEm,c=3.5/e.fontMetrics().ptPerEm;a.height=a.height0?y=3*g:y=7*g,w=e.fontMetrics().denom1):(m>0?(x=e.fontMetrics().num2,y=g):(x=e.fontMetrics().num3,y=3*g),w=e.fontMetrics().denom2);var S;if(h){var j=e.fontMetrics().axisHeight;x-a.depth-(j+.5*m){var n=new Fe.MathNode("mfrac",[hr(t.numer,e),hr(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Ir(t.barSize,e);n.setAttribute("linethickness",Xe(r))}var s=DU(t.size,e.style);if(s.size!==e.style.size){n=new Fe.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 a=[];if(t.leftDelim!=null){var l=new Fe.MathNode("mo",[new Fe.TextNode(t.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),a.push(l)}if(a.push(n),t.rightDelim!=null){var c=new Fe.MathNode("mo",[new Fe.TextNode(t.rightDelim.replace("\\",""))]);c.setAttribute("fence","true"),a.push(c)}return PN(a)}return n};tt({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],a,l=null,c=null,d="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,l="(",c=")";break;case"\\\\bracefrac":a=!1,l="\\{",c="\\}";break;case"\\\\brackfrac":a=!1,l="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":d="display";break;case"\\tfrac":case"\\tbinom":d="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:a,leftDelim:l,rightDelim:c,size:d,barSize:null}},htmlBuilder:QN,mathmlBuilder:VN});tt({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}}});tt({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 PR=["display","text","script","scriptscript"],zR=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};tt({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=Ay(e[0]),a=i.type==="atom"&&i.family==="open"?zR(i.text):null,l=Ay(e[1]),c=l.type==="atom"&&l.family==="close"?zR(l.text):null,d=nn(e[2],"size"),h,m=null;d.isBlank?h=!0:(m=d.value,h=m.number>0);var g="auto",x=e[3];if(x.type==="ordgroup"){if(x.body.length>0){var y=nn(x.body[0],"textord");g=PR[Number(y.text)]}}else x=nn(x,"textord"),g=PR[Number(x.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:h,barSize:m,leftDelim:a,rightDelim:c,size:g}},htmlBuilder:QN,mathmlBuilder:VN});tt({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:nn(e[0],"size").value,token:s}}});tt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=I5e(nn(e[1],"infix").size),a=e[2],l=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:a,continued:!1,hasBarLine:l,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:QN,mathmlBuilder:VN});var PU=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?qn(t.sup,e.havingStyle(n.sup()),e):qn(t.sub,e.havingStyle(n.sub()),e),s=nn(t.base,"horizBrace")):s=nn(t,"horizBrace");var i=qn(s.base,e.havingBaseStyle(At.DISPLAY)),a=Gl.svgSpan(s,e),l;if(s.isOver?(l=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a}]},e),l.children[0].children[0].children[1].classes.push("svg-align")):(l=we.makeVList({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:i}]},e),l.children[0].children[0].children[0].classes.push("svg-align")),r){var c=we.makeSpan(["mord",s.isOver?"mover":"munder"],[l],e);s.isOver?l=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:r}]},e):l=we.makeVList({positionType:"bottom",positionData:c.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:c}]},e)}return we.makeSpan(["mord",s.isOver?"mover":"munder"],[l],e)},lke=(t,e)=>{var n=Gl.mathMLnode(t.label);return new Fe.MathNode(t.isOver?"mover":"munder",[hr(t.base,e),n])};tt({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:PU,mathmlBuilder:lke});tt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=nn(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:Gr(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=ms(t.body,e,!1);return we.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=iu(t.body,e);return n instanceof Ui||(n=new Ui("mrow",[n])),n.setAttribute("href",t.href),n}});tt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=nn(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=nn(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l,c={};switch(r){case"\\htmlClass":c.class=i,l={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,l={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,l={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var d=i.split(","),h=0;h{var n=ms(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=we.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>iu(t.body,e)});tt({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:Gr(e[0]),mathml:Gr(e[1])}},htmlBuilder:(t,e)=>{var n=ms(t.html,e,!1);return we.makeFragment(n)},mathmlBuilder:(t,e)=>iu(t.mathml,e)});var a5=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 qe("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!eU(r))throw new qe("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};tt({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},a={number:0,unit:"em"},l="";if(n[0])for(var c=nn(n[0],"raw").string,d=c.split(","),h=0;h{var n=Ir(t.height,e),r=0;t.totalheight.number>0&&(r=Ir(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=Ir(t.width,e));var i={height:Xe(n+r)};s>0&&(i.width=Xe(s)),r>0&&(i.verticalAlign=Xe(-r));var a=new l3e(t.src,t.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new Fe.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Ir(t.height,e),s=0;if(t.totalheight.number>0&&(s=Ir(t.totalheight,e)-r,n.setAttribute("valign",Xe(-s))),n.setAttribute("height",Xe(r+s)),t.width.number>0){var i=Ir(t.width,e);n.setAttribute("width",Xe(i))}return n.setAttribute("src",t.src),n}});tt({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=nn(e[0],"size");if(n.settings.strict){var i=r[1]==="m",a=s.value.unit==="mu";i?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return we.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=Ir(t.dimension,e);return new Fe.SpaceNode(n)}});tt({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=we.makeSpan([],[qn(t.body,e)]),n=we.makeSpan(["inner"],[n],e)):n=we.makeSpan(["inner"],[qn(t.body,e)]);var r=we.makeSpan(["fix"],[]),s=we.makeSpan([t.alignment],[n,r],e),i=we.makeSpan(["strut"]);return i.style.height=Xe(s.height+s.depth),s.depth&&(i.style.verticalAlign=Xe(-s.depth)),s.children.unshift(i),s=we.makeSpan(["thinbox"],[s],e),we.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new Fe.MathNode("mpadded",[hr(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}});tt({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:a}}});tt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new qe("Mismatched "+t.funcName)}});var IR=(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}};tt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:Gr(e[0]),text:Gr(e[1]),script:Gr(e[2]),scriptscript:Gr(e[3])}},htmlBuilder:(t,e)=>{var n=IR(t,e),r=ms(n,e,!1);return we.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=IR(t,e);return iu(n,e)}});var zU=(t,e,n,r,s,i,a)=>{t=we.makeSpan([],[t]);var l=n&&Wn.isCharacterBox(n),c,d;if(e){var h=qn(e,r.havingStyle(s.sup()),r);d={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-h.depth)}}if(n){var m=qn(n,r.havingStyle(s.sub()),r);c={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-m.height)}}var g;if(d&&c){var x=r.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+t.depth+a;g=we.makeVList({positionType:"bottom",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Xe(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:Xe(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(c){var y=t.height-a;g=we.makeVList({positionType:"top",positionData:y,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Xe(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t}]},r)}else if(d){var w=t.depth+a;g=we.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:t},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:Xe(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var S=[g];if(c&&i!==0&&!l){var k=we.makeSpan(["mspace"],[],r);k.style.marginRight=Xe(i),S.unshift(k)}return we.makeSpan(["mop","op-limits"],S,r)},IU=["\\smallint"],Hf=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=nn(t.base,"op"),s=!0):i=nn(t,"op");var a=e.style,l=!1;a.size===At.DISPLAY.size&&i.symbol&&!IU.includes(i.name)&&(l=!0);var c;if(i.symbol){var d=l?"Size2-Regular":"Size1-Regular",h="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(h=i.name.slice(1),i.name=h==="oiint"?"\\iint":"\\iiint"),c=we.makeSymbol(i.name,d,"math",e,["mop","op-symbol",l?"large-op":"small-op"]),h.length>0){var m=c.italic,g=we.staticSvg(h+"Size"+(l?"2":"1"),e);c=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:g,shift:l?.08:0}]},e),i.name="\\"+h,c.classes.unshift("mop"),c.italic=m}}else if(i.body){var x=ms(i.body,e,!0);x.length===1&&x[0]instanceof Ma?(c=x[0],c.classes[0]="mop"):c=we.makeSpan(["mop"],x,e)}else{for(var y=[],w=1;w{var n;if(t.symbol)n=new Ui("mo",[Ra(t.name,t.mode)]),IU.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Ui("mo",Mi(t.body,e));else{n=new Ui("mi",[new Ro(t.name.slice(1))]);var r=new Ui("mo",[Ra("⁡","text")]);t.parentIsSupSub?n=new Ui("mrow",[n,r]):n=dU([n,r])}return n},cke={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};tt({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=cke[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Hf,mathmlBuilder:wg});tt({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:Gr(r)}},htmlBuilder:Hf,mathmlBuilder:wg});var uke={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};tt({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:Hf,mathmlBuilder:wg});tt({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:Hf,mathmlBuilder:wg});tt({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=uke[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Hf,mathmlBuilder:wg});var LU=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=nn(t.base,"operatorname"),s=!0):i=nn(t,"operatorname");var a;if(i.body.length>0){for(var l=i.body.map(m=>{var g=m.text;return typeof g=="string"?{type:"textord",mode:m.mode,text:g}:m}),c=ms(l,e.withFont("mathrm"),!0),d=0;d{for(var n=Mi(t.body,e.withFont("mathrm")),r=!0,s=0;sh.toText()).join("");n=[new Fe.TextNode(l)]}var c=new Fe.MathNode("mi",n);c.setAttribute("mathvariant","normal");var d=new Fe.MathNode("mo",[Ra("⁡","text")]);return t.parentIsSupSub?new Fe.MathNode("mrow",[c,d]):Fe.newDocumentFragment([c,d])};tt({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:Gr(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:LU,mathmlBuilder:dke});J("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Od({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?we.makeFragment(ms(t.body,e,!1)):we.makeSpan(["mord"],ms(t.body,e,!0),e)},mathmlBuilder(t,e){return iu(t.body,e,!0)}});tt({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=qn(t.body,e.havingCrampedStyle()),r=we.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return we.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new Fe.MathNode("mo",[new Fe.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Fe.MathNode("mover",[hr(t.body,e),n]);return r.setAttribute("accent","true"),r}});tt({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:Gr(r)}},htmlBuilder:(t,e)=>{var n=ms(t.body,e.withPhantom(),!1);return we.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=Mi(t.body,e);return new Fe.MathNode("mphantom",n)}});tt({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=we.makeSpan([],[qn(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=Mi(Gr(t.body),e),r=new Fe.MathNode("mphantom",n),s=new Fe.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});tt({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=we.makeSpan(["inner"],[qn(t.body,e.withPhantom())]),r=we.makeSpan(["fix"],[]);return we.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Mi(Gr(t.body),e),r=new Fe.MathNode("mphantom",n),s=new Fe.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});tt({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=nn(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=qn(t.body,e),r=Ir(t.dy,e);return we.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new Fe.MathNode("mpadded",[hr(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});tt({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});tt({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=nn(e[0],"size"),a=nn(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&nn(s,"size").value,width:i.value,height:a.value}},htmlBuilder(t,e){var n=we.makeSpan(["mord","rule"],[],e),r=Ir(t.width,e),s=Ir(t.height,e),i=t.shift?Ir(t.shift,e):0;return n.style.borderRightWidth=Xe(r),n.style.borderTopWidth=Xe(s),n.style.bottom=Xe(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Ir(t.width,e),r=Ir(t.height,e),s=t.shift?Ir(t.shift,e):0,i=e.color&&e.getColor()||"black",a=new Fe.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",Xe(n)),a.setAttribute("height",Xe(r));var l=new Fe.MathNode("mpadded",[a]);return s>=0?l.setAttribute("height",Xe(s)):(l.setAttribute("height",Xe(s)),l.setAttribute("depth",Xe(-s))),l.setAttribute("voffset",Xe(s)),l}});function BU(t,e,n){for(var r=ms(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return BU(t.body,n,e)};tt({type:"sizing",names:LR,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:LR.indexOf(r)+1,body:i}},htmlBuilder:hke,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Mi(t.body,n),s=new Fe.MathNode("mstyle",r);return s.setAttribute("mathsize",Xe(n.sizeMultiplier)),s}});tt({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,a=n[0]&&nn(n[0],"ordgroup");if(a)for(var l="",c=0;c{var n=we.makeSpan([],[qn(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 Fe.MathNode("mpadded",[hr(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});tt({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=qn(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=we.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+a&&(a=(a+m-n.height-n.depth)/2);var g=c.height-n.height-a-d;n.style.paddingLeft=Xe(h);var x=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+g)},{type:"elem",elem:c},{type:"kern",size:d}]},e);if(t.index){var y=e.havingStyle(At.SCRIPTSCRIPT),w=qn(t.index,y,e),S=.6*(x.height-x.depth),k=we.makeVList({positionType:"shift",positionData:-S,children:[{type:"elem",elem:w}]},e),j=we.makeSpan(["root"],[k]);return we.makeSpan(["mord","sqrt"],[j,x],e)}else return we.makeSpan(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new Fe.MathNode("mroot",[hr(n,e),hr(r,e)]):new Fe.MathNode("msqrt",[hr(n,e)])}});var BR={display:At.DISPLAY,text:At.TEXT,script:At.SCRIPT,scriptscript:At.SCRIPTSCRIPT};tt({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:a,body:i}},htmlBuilder(t,e){var n=BR[t.style],r=e.havingStyle(n).withFont("");return BU(t.body,r,e)},mathmlBuilder(t,e){var n=BR[t.style],r=e.havingStyle(n),s=Mi(t.body,r),i=new Fe.MathNode("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},l=a[t.style];return i.setAttribute("scriptlevel",l[0]),i.setAttribute("displaystyle",l[1]),i}});var fke=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?Hf:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===At.DISPLAY.size||r.limits);return i?LU:null}else{if(r.type==="accent")return Wn.isCharacterBox(r.base)?LN:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?PU:null}else return null}else return null};Od({type:"supsub",htmlBuilder(t,e){var n=fke(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,a=qn(r,e),l,c,d=e.fontMetrics(),h=0,m=0,g=r&&Wn.isCharacterBox(r);if(s){var x=e.havingStyle(e.style.sup());l=qn(s,x,e),g||(h=a.height-x.fontMetrics().supDrop*x.sizeMultiplier/e.sizeMultiplier)}if(i){var y=e.havingStyle(e.style.sub());c=qn(i,y,e),g||(m=a.depth+y.fontMetrics().subDrop*y.sizeMultiplier/e.sizeMultiplier)}var w;e.style===At.DISPLAY?w=d.sup1:e.style.cramped?w=d.sup3:w=d.sup2;var S=e.sizeMultiplier,k=Xe(.5/d.ptPerEm/S),j=null;if(c){var N=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(a instanceof Ma||N)&&(j=Xe(-a.italic))}var T;if(l&&c){h=Math.max(h,w,l.depth+.25*d.xHeight),m=Math.max(m,d.sub2);var E=d.defaultRuleThickness,_=4*E;if(h-l.depth-(c.height-m)<_){m=_-(h-l.depth)+c.height;var A=.8*d.xHeight-(h-l.depth);A>0&&(h+=A,m-=A)}var D=[{type:"elem",elem:c,shift:m,marginRight:k,marginLeft:j},{type:"elem",elem:l,shift:-h,marginRight:k}];T=we.makeVList({positionType:"individualShift",children:D},e)}else if(c){m=Math.max(m,d.sub1,c.height-.8*d.xHeight);var q=[{type:"elem",elem:c,marginLeft:j,marginRight:k}];T=we.makeVList({positionType:"shift",positionData:m,children:q},e)}else if(l)h=Math.max(h,w,l.depth+.25*d.xHeight),T=we.makeVList({positionType:"shift",positionData:-h,children:[{type:"elem",elem:l,marginRight:k}]},e);else throw new Error("supsub must have either sup or sub.");var B=VO(a,"right")||"mord";return we.makeSpan([B],[a,we.makeSpan(["msupsub"],[T])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[hr(t.base,e)];t.sub&&i.push(hr(t.sub,e)),t.sup&&i.push(hr(t.sup,e));var a;if(n)a=r?"mover":"munder";else if(t.sub)if(t.sup){var d=t.base;d&&d.type==="op"&&d.limits&&e.style===At.DISPLAY||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(e.style===At.DISPLAY||d.limits)?a="munderover":a="msubsup"}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)?a="munder":a="msub"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===At.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===At.DISPLAY)?a="mover":a="msup"}return new Fe.MathNode(a,i)}});Od({type:"atom",htmlBuilder(t,e){return we.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new Fe.MathNode("mo",[Ra(t.text,t.mode)]);if(t.family==="bin"){var r=zN(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 FU={mi:"italic",mn:"normal",mtext:"normal"};Od({type:"mathord",htmlBuilder(t,e){return we.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new Fe.MathNode("mi",[Ra(t.text,t.mode,e)]),r=zN(t,e)||"italic";return r!==FU[n.type]&&n.setAttribute("mathvariant",r),n}});Od({type:"textord",htmlBuilder(t,e){return we.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=Ra(t.text,t.mode,e),r=zN(t,e)||"normal",s;return t.mode==="text"?s=new Fe.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new Fe.MathNode("mn",[n]):t.text==="\\prime"?s=new Fe.MathNode("mo",[n]):s=new Fe.MathNode("mi",[n]),r!==FU[s.type]&&s.setAttribute("mathvariant",r),s}});var o5={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},l5={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Od({type:"spacing",htmlBuilder(t,e){if(l5.hasOwnProperty(t.text)){var n=l5[t.text].className||"";if(t.mode==="text"){var r=we.makeOrd(t,e,"textord");return r.classes.push(n),r}else return we.makeSpan(["mspace",n],[we.mathsym(t.text,t.mode,e)],e)}else{if(o5.hasOwnProperty(t.text))return we.makeSpan(["mspace",o5[t.text]],[],e);throw new qe('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(l5.hasOwnProperty(t.text))n=new Fe.MathNode("mtext",[new Fe.TextNode(" ")]);else{if(o5.hasOwnProperty(t.text))return new Fe.MathNode("mspace");throw new qe('Unknown type of space "'+t.text+'"')}return n}});var FR=()=>{var t=new Fe.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Od({type:"tag",mathmlBuilder(t,e){var n=new Fe.MathNode("mtable",[new Fe.MathNode("mtr",[FR(),new Fe.MathNode("mtd",[iu(t.body,e)]),FR(),new Fe.MathNode("mtd",[iu(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var qR={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},$R={"\\textbf":"textbf","\\textmd":"textmd"},mke={"\\textit":"textit","\\textup":"textup"},HR=(t,e)=>{var n=t.font;if(n){if(qR[n])return e.withTextFontFamily(qR[n]);if($R[n])return e.withTextFontWeight($R[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(mke[n])};tt({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:Gr(s),font:r}},htmlBuilder(t,e){var n=HR(t,e),r=ms(t.body,n,!0);return we.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=HR(t,e);return iu(t.body,n)}});tt({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=qn(t.body,e),r=we.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=we.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return we.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new Fe.MathNode("mo",[new Fe.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Fe.MathNode("munder",[hr(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});tt({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=qn(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return we.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new Fe.MathNode("mpadded",[hr(t.body,e)],["vcenter"])}});tt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new qe("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=QR(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),Qc=cU,qU=`[ \r + ]`,pke="\\\\[a-zA-Z@]+",gke="\\\\[^\uD800-\uDFFF]",xke="("+pke+")"+qU+"*",vke=`\\\\( |[ \r ]+ -?)[ \r ]*`,UO="[̀-ͯ]",pke=new RegExp(UO+"+$"),gke="("+IU+"+)|"+(mke+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(UO+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(UO+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+fke)+("|"+hke+")");class BR{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(gke,"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 Xi("EOF",new pi(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new $e("Unexpected character: '"+e[n]+"'",new Xi(e[n],new pi(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 Xi(s,new pi(this,n,this.tokenRegex.lastIndex))}}class xke{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 $e("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 vke=NU;Z("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});Z("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});Z("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});Z("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});Z("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});Z("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Z("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var FR={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Z("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new $e("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=FR[e.text],r==null||r>=n)throw new $e("Invalid base-"+n+" digit "+e.text);for(var s;(s=FR[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new $e("\\newcommand's first argument must be a macro name");var i=s[0].text,a=t.isDefined(i);if(a&&!e)throw new $e("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!a&&!n)throw new $e("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var l=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var c="",d=t.expandNextToken();d.text!=="]"&&d.text!=="EOF";)c+=d.text,d=t.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new $e("Invalid number of arguments: "+c);l=parseInt(c),s=t.consumeArg().tokens}return a&&r||t.macros.set(i,{tokens:s,numArgs:l}),""};Z("\\newcommand",t=>FN(t,!1,!0,!1));Z("\\renewcommand",t=>FN(t,!0,!1,!1));Z("\\providecommand",t=>FN(t,!0,!0,!0));Z("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});Z("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});Z("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),qc[n],dr.math[n],dr.text[n]),""});Z("\\bgroup","{");Z("\\egroup","}");Z("~","\\nobreakspace");Z("\\lq","`");Z("\\rq","'");Z("\\aa","\\r a");Z("\\AA","\\r A");Z("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");Z("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Z("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");Z("ℬ","\\mathscr{B}");Z("ℰ","\\mathscr{E}");Z("ℱ","\\mathscr{F}");Z("ℋ","\\mathscr{H}");Z("ℐ","\\mathscr{I}");Z("ℒ","\\mathscr{L}");Z("ℳ","\\mathscr{M}");Z("ℛ","\\mathscr{R}");Z("ℭ","\\mathfrak{C}");Z("ℌ","\\mathfrak{H}");Z("ℨ","\\mathfrak{Z}");Z("\\Bbbk","\\Bbb{k}");Z("·","\\cdotp");Z("\\llap","\\mathllap{\\textrm{#1}}");Z("\\rlap","\\mathrlap{\\textrm{#1}}");Z("\\clap","\\mathclap{\\textrm{#1}}");Z("\\mathstrut","\\vphantom{(}");Z("\\underbar","\\underline{\\text{#1}}");Z("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');Z("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");Z("\\ne","\\neq");Z("≠","\\neq");Z("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");Z("∉","\\notin");Z("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");Z("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");Z("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");Z("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");Z("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");Z("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");Z("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");Z("⟂","\\perp");Z("‼","\\mathclose{!\\mkern-0.8mu!}");Z("∌","\\notni");Z("⌜","\\ulcorner");Z("⌝","\\urcorner");Z("⌞","\\llcorner");Z("⌟","\\lrcorner");Z("©","\\copyright");Z("®","\\textregistered");Z("️","\\textregistered");Z("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Z("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Z("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Z("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Z("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Z("⋮","\\vdots");Z("\\varGamma","\\mathit{\\Gamma}");Z("\\varDelta","\\mathit{\\Delta}");Z("\\varTheta","\\mathit{\\Theta}");Z("\\varLambda","\\mathit{\\Lambda}");Z("\\varXi","\\mathit{\\Xi}");Z("\\varPi","\\mathit{\\Pi}");Z("\\varSigma","\\mathit{\\Sigma}");Z("\\varUpsilon","\\mathit{\\Upsilon}");Z("\\varPhi","\\mathit{\\Phi}");Z("\\varPsi","\\mathit{\\Psi}");Z("\\varOmega","\\mathit{\\Omega}");Z("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Z("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Z("\\boxed","\\fbox{$\\displaystyle{#1}$}");Z("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Z("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Z("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Z("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Z("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var qR={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};Z("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in qR?e=qR[n]:(n.slice(0,4)==="\\not"||n in dr.math&&["bin","rel"].includes(dr.math[n].group))&&(e="\\dotsb"),e});var qN={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Z("\\dotso",function(t){var e=t.future().text;return e in qN?"\\ldots\\,":"\\ldots"});Z("\\dotsc",function(t){var e=t.future().text;return e in qN&&e!==","?"\\ldots\\,":"\\ldots"});Z("\\cdots",function(t){var e=t.future().text;return e in qN?"\\@cdots\\,":"\\@cdots"});Z("\\dotsb","\\cdots");Z("\\dotsm","\\cdots");Z("\\dotsi","\\!\\cdots");Z("\\dotsx","\\ldots\\,");Z("\\DOTSI","\\relax");Z("\\DOTSB","\\relax");Z("\\DOTSX","\\relax");Z("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Z("\\,","\\tmspace+{3mu}{.1667em}");Z("\\thinspace","\\,");Z("\\>","\\mskip{4mu}");Z("\\:","\\tmspace+{4mu}{.2222em}");Z("\\medspace","\\:");Z("\\;","\\tmspace+{5mu}{.2777em}");Z("\\thickspace","\\;");Z("\\!","\\tmspace-{3mu}{.1667em}");Z("\\negthinspace","\\!");Z("\\negmedspace","\\tmspace-{4mu}{.2222em}");Z("\\negthickspace","\\tmspace-{5mu}{.277em}");Z("\\enspace","\\kern.5em ");Z("\\enskip","\\hskip.5em\\relax");Z("\\quad","\\hskip1em\\relax");Z("\\qquad","\\hskip2em\\relax");Z("\\tag","\\@ifstar\\tag@literal\\tag@paren");Z("\\tag@paren","\\tag@literal{({#1})}");Z("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new $e("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Z("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Z("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Z("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Z("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Z("\\newline","\\\\\\relax");Z("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var LU=Xe(_o["Main-Regular"][84][1]-.7*_o["Main-Regular"][65][1]);Z("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+LU+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Z("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+LU+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Z("\\hspace","\\@ifstar\\@hspacer\\@hspace");Z("\\@hspace","\\hskip #1\\relax");Z("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Z("\\ordinarycolon",":");Z("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Z("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Z("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Z("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Z("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Z("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Z("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Z("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Z("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Z("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Z("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Z("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Z("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Z("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Z("∷","\\dblcolon");Z("∹","\\eqcolon");Z("≔","\\coloneqq");Z("≕","\\eqqcolon");Z("⩴","\\Coloneqq");Z("\\ratio","\\vcentcolon");Z("\\coloncolon","\\dblcolon");Z("\\colonequals","\\coloneqq");Z("\\coloncolonequals","\\Coloneqq");Z("\\equalscolon","\\eqqcolon");Z("\\equalscoloncolon","\\Eqqcolon");Z("\\colonminus","\\coloneq");Z("\\coloncolonminus","\\Coloneq");Z("\\minuscolon","\\eqcolon");Z("\\minuscoloncolon","\\Eqcolon");Z("\\coloncolonapprox","\\Colonapprox");Z("\\coloncolonsim","\\Colonsim");Z("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");Z("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Z("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Z("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Z("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Z("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Z("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Z("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Z("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Z("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");Z("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");Z("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");Z("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");Z("\\nleqq","\\html@mathml{\\@nleqq}{≰}");Z("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");Z("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");Z("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");Z("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");Z("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");Z("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");Z("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");Z("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");Z("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");Z("\\imath","\\html@mathml{\\@imath}{ı}");Z("\\jmath","\\html@mathml{\\@jmath}{ȷ}");Z("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");Z("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");Z("⟦","\\llbracket");Z("⟧","\\rrbracket");Z("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");Z("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");Z("⦃","\\lBrace");Z("⦄","\\rBrace");Z("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");Z("⦵","\\minuso");Z("\\darr","\\downarrow");Z("\\dArr","\\Downarrow");Z("\\Darr","\\Downarrow");Z("\\lang","\\langle");Z("\\rang","\\rangle");Z("\\uarr","\\uparrow");Z("\\uArr","\\Uparrow");Z("\\Uarr","\\Uparrow");Z("\\N","\\mathbb{N}");Z("\\R","\\mathbb{R}");Z("\\Z","\\mathbb{Z}");Z("\\alef","\\aleph");Z("\\alefsym","\\aleph");Z("\\Alpha","\\mathrm{A}");Z("\\Beta","\\mathrm{B}");Z("\\bull","\\bullet");Z("\\Chi","\\mathrm{X}");Z("\\clubs","\\clubsuit");Z("\\cnums","\\mathbb{C}");Z("\\Complex","\\mathbb{C}");Z("\\Dagger","\\ddagger");Z("\\diamonds","\\diamondsuit");Z("\\empty","\\emptyset");Z("\\Epsilon","\\mathrm{E}");Z("\\Eta","\\mathrm{H}");Z("\\exist","\\exists");Z("\\harr","\\leftrightarrow");Z("\\hArr","\\Leftrightarrow");Z("\\Harr","\\Leftrightarrow");Z("\\hearts","\\heartsuit");Z("\\image","\\Im");Z("\\infin","\\infty");Z("\\Iota","\\mathrm{I}");Z("\\isin","\\in");Z("\\Kappa","\\mathrm{K}");Z("\\larr","\\leftarrow");Z("\\lArr","\\Leftarrow");Z("\\Larr","\\Leftarrow");Z("\\lrarr","\\leftrightarrow");Z("\\lrArr","\\Leftrightarrow");Z("\\Lrarr","\\Leftrightarrow");Z("\\Mu","\\mathrm{M}");Z("\\natnums","\\mathbb{N}");Z("\\Nu","\\mathrm{N}");Z("\\Omicron","\\mathrm{O}");Z("\\plusmn","\\pm");Z("\\rarr","\\rightarrow");Z("\\rArr","\\Rightarrow");Z("\\Rarr","\\Rightarrow");Z("\\real","\\Re");Z("\\reals","\\mathbb{R}");Z("\\Reals","\\mathbb{R}");Z("\\Rho","\\mathrm{P}");Z("\\sdot","\\cdot");Z("\\sect","\\S");Z("\\spades","\\spadesuit");Z("\\sub","\\subset");Z("\\sube","\\subseteq");Z("\\supe","\\supseteq");Z("\\Tau","\\mathrm{T}");Z("\\thetasym","\\vartheta");Z("\\weierp","\\wp");Z("\\Zeta","\\mathrm{Z}");Z("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Z("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Z("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Z("\\bra","\\mathinner{\\langle{#1}|}");Z("\\ket","\\mathinner{|{#1}\\rangle}");Z("\\braket","\\mathinner{\\langle{#1}\\rangle}");Z("\\Bra","\\left\\langle#1\\right|");Z("\\Ket","\\left|#1\\right\\rangle");var BU=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,a=e.macros.get("|"),l=e.macros.get("\\|");e.macros.beginGroup();var c=m=>g=>{t&&(g.macros.set("|",a),s.length&&g.macros.set("\\|",l));var x=m;if(!m&&s.length){var y=g.future();y.text==="|"&&(g.popToken(),x=!0)}return{tokens:x?s:r,numArgs:0}};e.macros.set("|",c(!1)),s.length&&e.macros.set("\\|",c(!0));var d=e.consumeArg().tokens,h=e.expandTokens([...i,...d,...n]);return e.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};Z("\\bra@ket",BU(!1));Z("\\bra@set",BU(!0));Z("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Z("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Z("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Z("\\angln","{\\angl n}");Z("\\blue","\\textcolor{##6495ed}{#1}");Z("\\orange","\\textcolor{##ffa500}{#1}");Z("\\pink","\\textcolor{##ff00af}{#1}");Z("\\red","\\textcolor{##df0030}{#1}");Z("\\green","\\textcolor{##28ae7b}{#1}");Z("\\gray","\\textcolor{gray}{#1}");Z("\\purple","\\textcolor{##9d38bd}{#1}");Z("\\blueA","\\textcolor{##ccfaff}{#1}");Z("\\blueB","\\textcolor{##80f6ff}{#1}");Z("\\blueC","\\textcolor{##63d9ea}{#1}");Z("\\blueD","\\textcolor{##11accd}{#1}");Z("\\blueE","\\textcolor{##0c7f99}{#1}");Z("\\tealA","\\textcolor{##94fff5}{#1}");Z("\\tealB","\\textcolor{##26edd5}{#1}");Z("\\tealC","\\textcolor{##01d1c1}{#1}");Z("\\tealD","\\textcolor{##01a995}{#1}");Z("\\tealE","\\textcolor{##208170}{#1}");Z("\\greenA","\\textcolor{##b6ffb0}{#1}");Z("\\greenB","\\textcolor{##8af281}{#1}");Z("\\greenC","\\textcolor{##74cf70}{#1}");Z("\\greenD","\\textcolor{##1fab54}{#1}");Z("\\greenE","\\textcolor{##0d923f}{#1}");Z("\\goldA","\\textcolor{##ffd0a9}{#1}");Z("\\goldB","\\textcolor{##ffbb71}{#1}");Z("\\goldC","\\textcolor{##ff9c39}{#1}");Z("\\goldD","\\textcolor{##e07d10}{#1}");Z("\\goldE","\\textcolor{##a75a05}{#1}");Z("\\redA","\\textcolor{##fca9a9}{#1}");Z("\\redB","\\textcolor{##ff8482}{#1}");Z("\\redC","\\textcolor{##f9685d}{#1}");Z("\\redD","\\textcolor{##e84d39}{#1}");Z("\\redE","\\textcolor{##bc2612}{#1}");Z("\\maroonA","\\textcolor{##ffbde0}{#1}");Z("\\maroonB","\\textcolor{##ff92c6}{#1}");Z("\\maroonC","\\textcolor{##ed5fa6}{#1}");Z("\\maroonD","\\textcolor{##ca337c}{#1}");Z("\\maroonE","\\textcolor{##9e034e}{#1}");Z("\\purpleA","\\textcolor{##ddd7ff}{#1}");Z("\\purpleB","\\textcolor{##c6b9fc}{#1}");Z("\\purpleC","\\textcolor{##aa87ff}{#1}");Z("\\purpleD","\\textcolor{##7854ab}{#1}");Z("\\purpleE","\\textcolor{##543b78}{#1}");Z("\\mintA","\\textcolor{##f5f9e8}{#1}");Z("\\mintB","\\textcolor{##edf2df}{#1}");Z("\\mintC","\\textcolor{##e0e5cc}{#1}");Z("\\grayA","\\textcolor{##f6f7f7}{#1}");Z("\\grayB","\\textcolor{##f0f1f2}{#1}");Z("\\grayC","\\textcolor{##e3e5e6}{#1}");Z("\\grayD","\\textcolor{##d6d8da}{#1}");Z("\\grayE","\\textcolor{##babec2}{#1}");Z("\\grayF","\\textcolor{##888d93}{#1}");Z("\\grayG","\\textcolor{##626569}{#1}");Z("\\grayH","\\textcolor{##3b3e40}{#1}");Z("\\grayI","\\textcolor{##21242c}{#1}");Z("\\kaBlue","\\textcolor{##314453}{#1}");Z("\\kaGreen","\\textcolor{##71B307}{#1}");var FU={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class yke{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 xke(vke,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new BR(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 Xi("EOF",r.loc)),this.pushTokens(s),new Xi("",pi.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,a=0,l=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++a;else if(i.text==="}"){if(--a,a===-1)throw new $e("Extra }",i)}else if(i.text==="EOF")throw new $e("Unexpected end of input in a macro argument, expected '"+(e&&r?e[l]:"}")+"'",i);if(e&&r)if((a===0||a===1&&e[l]==="{")&&i.text===e[l]){if(++l,l===e.length){n.splice(-l,l);break}}else l=0}while(a!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new $e("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new $e("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 $e("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,a=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var l=i.length-1;l>=0;--l){var c=i[l];if(c.text==="#"){if(l===0)throw new $e("Incomplete placeholder at end of macro body",c);if(c=i[--l],c.text==="#")i.splice(l+1,1);else if(/^[1-9]$/.test(c.text))i.splice(l,2,...a[+c.text-1]);else throw new $e("Not a valid argument number",c)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Xi(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var a=s.replace(/##/g,"");a.indexOf("#"+(i+1))!==-1;)++i;for(var l=new BR(s,this.settings),c=[],d=l.lex();d.text!=="EOF";)c.push(d),d=l.lex();c.reverse();var h={tokens:c,numArgs:i};return h}return s}isDefined(e){return this.macros.has(e)||qc.hasOwnProperty(e)||dr.math.hasOwnProperty(e)||dr.text.hasOwnProperty(e)||FU.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:qc.hasOwnProperty(e)&&!qc[e].primitive}}var $R=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,B1=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),i5={"́":{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"}},HR={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Wb{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 yke(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 $e("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 Xi("}")),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(Wb.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&qc[s.text]&&qc[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 l=dr[this.mode][n].group,c=pi.range(e),d;if(o3e.hasOwnProperty(l)){var h=l;d={type:"atom",mode:this.mode,family:h,loc:c,text:n}}else d={type:l,mode:this.mode,loc:c,text:n};a=d}else if(n.charCodeAt(0)>=128)this.settings.strict&&(XV(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),a={type:"textord",mode:"text",loc:pi.range(e),text:n};else return null;if(this.consume(),i)for(var m=0;md&&(d=h):h&&(d!==void 0&&d>-1&&c.push(` -`.repeat(d)||" "),d=-1,c.push(h))}return c.join("")}function WU(t,e,n){return t.type==="element"?Yke(t,e,n):t.type==="text"?n.whitespace==="normal"?GU(t,n):Kke(t):[]}function Yke(t,e,n){const r=XU(t,n),s=t.children||[];let i=-1,a=[];if(Gke(t))return a;let l,c;for(GO(t)||ZR(t)&&GR(e,t,ZR)?c=` -`:Wke(t)?(l=2,c=2):UU(t)&&(l=1,c=1);++i{try{i(!0);const Oe=await oOe({page:a,page_size:h,is_registered:g==="all"?void 0:g==="registered",is_banned:y==="all"?void 0:y==="banned",format:S==="all"?void 0:S,sort_by:j,sort_order:T});e(Oe.data),d(Oe.total)}catch(Oe){const Ve=Oe instanceof Error?Oe.message:"加载表情包列表失败";G({title:"错误",description:Ve,variant:"destructive"})}finally{i(!1)}},[a,h,g,y,S,j,T,G]),V=async()=>{try{const Oe=await dOe();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};b.useEffect(()=>{I()},[I]),b.useEffect(()=>{V()},[]);const ee=async Oe=>{try{const Ve=await lOe(Oe.id);A(Ve.data),P(!0)}catch(Ve){const Ue=Ve instanceof Error?Ve.message:"加载详情失败";G({title:"错误",description:Ue,variant:"destructive"})}},ne=Oe=>{A(Oe),$(!0)},W=Oe=>{A(Oe),te(!0)},se=async()=>{if(_)try{await uOe(_.id),G({title:"成功",description:"表情包已删除"}),te(!1),A(null),I(),V()}catch(Oe){const Ve=Oe instanceof Error?Oe.message:"删除失败";G({title:"错误",description:Ve,variant:"destructive"})}},re=async Oe=>{try{await hOe(Oe.id),G({title:"成功",description:"表情包已注册"}),I(),V()}catch(Ve){const Ue=Ve instanceof Error?Ve.message:"注册失败";G({title:"错误",description:Ue,variant:"destructive"})}},oe=async Oe=>{try{await fOe(Oe.id),G({title:"成功",description:"表情包已封禁"}),I(),V()}catch(Ve){const Ue=Ve instanceof Error?Ve.message:"封禁失败";G({title:"错误",description:Ue,variant:"destructive"})}},Te=Oe=>{const Ve=new Set(z);Ve.has(Oe)?Ve.delete(Oe):Ve.add(Oe),Q(Ve)},We=async()=>{try{const Oe=await mOe(Array.from(z));G({title:"批量删除完成",description:Oe.message}),Q(new Set),Y(!1),I(),V()}catch(Oe){G({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},Ye=()=>{const Oe=parseInt(J),Ve=Math.ceil(c/h);Oe>=1&&Oe<=Ve?(l(Oe),X("")):G({title:"无效的页码",description:`请输入1-${Ve}之间的页码`,variant:"destructive"})},Je=n?.formats?Object.keys(n.formats):[];return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsxs("div",{className:"mb-4 sm:mb-6",children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),o.jsx(gn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&o.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[o.jsx(qt,{children:o.jsxs(Fn,{className:"pb-2",children:[o.jsx(ts,{children:"总数"}),o.jsx(qn,{className:"text-2xl",children:n.total})]})}),o.jsx(qt,{children:o.jsxs(Fn,{className:"pb-2",children:[o.jsx(ts,{children:"已注册"}),o.jsx(qn,{className:"text-2xl text-green-600",children:n.registered})]})}),o.jsx(qt,{children:o.jsxs(Fn,{className:"pb-2",children:[o.jsx(ts,{children:"已封禁"}),o.jsx(qn,{className:"text-2xl text-red-600",children:n.banned})]})}),o.jsx(qt,{children:o.jsxs(Fn,{className:"pb-2",children:[o.jsx(ts,{children:"未注册"}),o.jsx(qn,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),o.jsxs(qt,{children:[o.jsx(Fn,{children:o.jsxs(qn,{className:"flex items-center gap-2",children:[o.jsx(sk,{className:"h-5 w-5"}),"筛选和排序"]})}),o.jsxs(Gn,{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"排序方式"}),o.jsxs(Vt,{value:`${j}-${T}`,onValueChange:Oe=>{const[Ve,Ue]=Oe.split("-");N(Ve),E(Ue),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"usage_count-desc",children:"使用次数 (多→少)"}),o.jsx(De,{value:"usage_count-asc",children:"使用次数 (少→多)"}),o.jsx(De,{value:"register_time-desc",children:"注册时间 (新→旧)"}),o.jsx(De,{value:"register_time-asc",children:"注册时间 (旧→新)"}),o.jsx(De,{value:"record_time-desc",children:"记录时间 (新→旧)"}),o.jsx(De,{value:"record_time-asc",children:"记录时间 (旧→新)"}),o.jsx(De,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),o.jsx(De,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"注册状态"}),o.jsxs(Vt,{value:g,onValueChange:Oe=>{x(Oe),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),o.jsx(De,{value:"registered",children:"已注册"}),o.jsx(De,{value:"unregistered",children:"未注册"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"封禁状态"}),o.jsxs(Vt,{value:y,onValueChange:Oe=>{w(Oe),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),o.jsx(De,{value:"banned",children:"已封禁"}),o.jsx(De,{value:"unbanned",children:"未封禁"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"格式"}),o.jsxs(Vt,{value:S,onValueChange:Oe=>{k(Oe),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),Je.map(Oe=>o.jsxs(De,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[z.size>0&&o.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",z.size," 个表情包"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),o.jsxs(Vt,{value:R,onValueChange:Oe=>ie(Oe),children:[o.jsx($t,{className:"w-24",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"small",children:"小"}),o.jsx(De,{value:"medium",children:"中"}),o.jsx(De,{value:"large",children:"大"})]})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:h.toString(),onValueChange:Oe=>{m(parseInt(Oe)),l(1),Q(new Set)},children:[o.jsx($t,{id:"emoji-page-size",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"40",children:"40"}),o.jsx(De,{value:"60",children:"60"}),o.jsx(De,{value:"100",children:"100"})]})]}),z.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>Q(new Set),children:"取消选择"}),o.jsxs(de,{variant:"destructive",size:"sm",onClick:()=>Y(!0),children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(de,{variant:"outline",size:"sm",onClick:I,disabled:s,children:[o.jsx(Ps,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"表情包列表"}),o.jsxs(ts,{children:["共 ",c," 个表情包,当前第 ",a," 页"]})]}),o.jsxs(Gn,{children:[t.length===0?o.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):o.jsx("div",{className:`grid gap-3 ${R==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":R==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:t.map(Oe=>o.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${z.has(Oe.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>Te(Oe.id),children:[o.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${z.has(Oe.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:o.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${z.has(Oe.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:z.has(Oe.id)&&o.jsx(Vc,{className:"h-3 w-3"})})}),o.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[Oe.is_registered&&o.jsx(Xn,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),Oe.is_banned&&o.jsx(Xn,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),o.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${R==="small"?"p-1":R==="medium"?"p-2":"p-3"}`,children:o.jsx("img",{src:YU(Oe.id),alt:"表情包",className:"w-full h-full object-contain",loading:"lazy",onError:Ve=>{const Ue=Ve.target;Ue.style.display="none";const He=Ue.parentElement;He&&(He.innerHTML='')}})}),o.jsxs("div",{className:`border-t bg-card ${R==="small"?"p-1":"p-2"}`,children:[o.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[o.jsx(Xn,{variant:"outline",className:"text-[10px] px-1 py-0",children:Oe.format.toUpperCase()}),o.jsxs("span",{className:"font-mono",children:[Oe.usage_count,"次"]})]}),o.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${R==="small"?"flex-wrap":""}`,children:[o.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ve=>{Ve.stopPropagation(),ne(Oe)},title:"编辑",children:o.jsx(z0,{className:"h-3 w-3"})}),o.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ve=>{Ve.stopPropagation(),ee(Oe)},title:"详情",children:o.jsx(Oa,{className:"h-3 w-3"})}),!Oe.is_registered&&o.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Ve=>{Ve.stopPropagation(),re(Oe)},title:"注册",children:o.jsx(Vc,{className:"h-3 w-3"})}),!Oe.is_banned&&o.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Ve=>{Ve.stopPropagation(),oe(Oe)},title:"封禁",children:o.jsx(Jee,{className:"h-3 w-3"})}),o.jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Ve=>{Ve.stopPropagation(),W(Oe)},title:"删除",children:o.jsx(Sn,{className:"h-3 w-3"})})]})]})]},Oe.id))}),c>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(a-1)*h+1," 到"," ",Math.min(a*h,c)," 条,共 ",c," 条"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(Ap,{className:"h-4 w-4"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(Oe=>Math.max(1,Oe-1)),disabled:a===1,children:[o.jsx(vd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{type:"number",value:J,onChange:Oe=>X(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&Ye(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(c/h)}),o.jsx(de,{variant:"outline",size:"sm",onClick:Ye,disabled:!J,className:"h-8",children:"跳转"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(Oe=>Oe+1),disabled:a>=Math.ceil(c/h),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(yd,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(c/h)),disabled:a>=Math.ceil(c/h),className:"hidden sm:flex",children:o.jsx(Mp,{className:"h-4 w-4"})})]})]})]})]}),o.jsx(gOe,{emoji:_,open:L,onOpenChange:P}),o.jsx(xOe,{emoji:_,open:B,onOpenChange:$,onSuccess:()=>{I(),V()}})]})}),o.jsx(Dn,{open:F,onOpenChange:Y,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认批量删除"}),o.jsxs(_n,{children:["你确定要删除选中的 ",z.size," 个表情包吗?此操作不可撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:We,children:"确认删除"})]})]})}),o.jsx(Dr,{open:U,onOpenChange:te,children:o.jsxs(Sr,{children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"确认删除"}),o.jsx(ss,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>te(!1),children:"取消"}),o.jsx(de,{variant:"destructive",onClick:se,children:"删除"})]})]})})]})}function gOe({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[90vh]",children:[o.jsx(kr,{children:o.jsx(Or,{children:"表情包详情"})}),o.jsx(gn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:o.jsx("img",{src:YU(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const a=i.parentElement;a&&(a.innerHTML='')}})})}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"ID"}),o.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"格式"}),o.jsx("div",{className:"mt-1",children:o.jsx(Xn,{variant:"outline",children:t.format.toUpperCase()})})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"文件路径"}),o.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"哈希值"}),o.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"描述"}),t.description?o.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:o.jsx(aOe,{className:"prose-sm",children:t.description})}):o.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"情绪"}),o.jsx("div",{className:"mt-1",children:t.emotion?o.jsx("span",{className:"text-sm",children:t.emotion}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"状态"}),o.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&o.jsx(Xn,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&o.jsx(Xn,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&o.jsx(Xn,{variant:"outline",children:"未注册"})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"使用次数"}),o.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"记录时间"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"注册时间"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"最后使用"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function xOe({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState(""),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!1),{toast:g}=as();b.useEffect(()=>{t&&(i(t.emotion||""),l(t.is_registered),d(t.is_banned))},[t]);const x=async()=>{if(t)try{m(!0);const y=s.split(/[,,]/).map(w=>w.trim()).filter(Boolean).join(",");await cOe(t.id,{emotion:y||void 0,is_registered:a,is_banned:c}),g({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(y){const w=y instanceof Error?y.message:"保存失败";g({title:"错误",description:w,variant:"destructive"})}finally{m(!1)}};return t?o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑表情包"}),o.jsx(ss,{children:"修改表情包的情绪和状态信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx(he,{children:"情绪"}),o.jsx(Mr,{value:s,onChange:y=>i(y.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Oi,{id:"is_registered",checked:a,onCheckedChange:y=>{y===!0?(l(!0),d(!1)):l(!1)}}),o.jsx(he,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Oi,{id:"is_banned",checked:c,onCheckedChange:y=>{y===!0?(d(!0),l(!1)):d(!1)}}),o.jsx(he,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(de,{onClick:x,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}const hu="/api/webui/expression";async function vOe(){const t=await St(`${hu}/chats`,{headers:Dt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取聊天列表失败")}return t.json()}async function yOe(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 St(`${hu}/list?${e}`,{headers:Dt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function bOe(t){const e=await St(`${hu}/${t}`,{headers:Dt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function wOe(t){const e=await St(`${hu}/`,{method:"POST",headers:Dt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function SOe(t,e){const n=await St(`${hu}/${t}`,{method:"PATCH",headers:Dt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function kOe(t){const e=await St(`${hu}/${t}`,{method:"DELETE",headers:Dt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function OOe(t){const e=await St(`${hu}/batch/delete`,{method:"POST",headers:Dt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function jOe(){const t=await St(`${hu}/stats/summary`,{headers:Dt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function NOe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(1),[c,d]=b.useState(20),[h,m]=b.useState(""),[g,x]=b.useState(null),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[j,N]=b.useState(!1),[T,E]=b.useState(null),[_,A]=b.useState(new Set),[L,P]=b.useState(!1),[B,$]=b.useState(""),[U,te]=b.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[z,Q]=b.useState([]),[F,Y]=b.useState(new Map),{toast:J}=as(),X=async()=>{try{r(!0);const oe=await yOe({page:a,page_size:c,search:h||void 0});e(oe.data),i(oe.total)}catch(oe){J({title:"加载失败",description:oe instanceof Error?oe.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},R=async()=>{try{const oe=await jOe();oe?.data&&te(oe.data)}catch(oe){console.error("加载统计数据失败:",oe)}},ie=async()=>{try{const oe=await vOe();if(oe?.data){Q(oe.data);const Te=new Map;oe.data.forEach(We=>{Te.set(We.chat_id,We.chat_name)}),Y(Te)}}catch(oe){console.error("加载聊天列表失败:",oe)}},G=oe=>F.get(oe)||oe;b.useEffect(()=>{X(),R(),ie()},[a,c,h]);const I=async oe=>{try{const Te=await bOe(oe.id);x(Te.data),w(!0)}catch(Te){J({title:"加载详情失败",description:Te instanceof Error?Te.message:"无法加载表达方式详情",variant:"destructive"})}},V=oe=>{x(oe),k(!0)},ee=async oe=>{try{await kOe(oe.id),J({title:"删除成功",description:`已删除表达方式: ${oe.situation}`}),E(null),X(),R()}catch(Te){J({title:"删除失败",description:Te instanceof Error?Te.message:"无法删除表达方式",variant:"destructive"})}},ne=oe=>{const Te=new Set(_);Te.has(oe)?Te.delete(oe):Te.add(oe),A(Te)},W=()=>{_.size===t.length&&t.length>0?A(new Set):A(new Set(t.map(oe=>oe.id)))},se=async()=>{try{await OOe(Array.from(_)),J({title:"批量删除成功",description:`已删除 ${_.size} 个表达方式`}),A(new Set),P(!1),X(),R()}catch(oe){J({title:"批量删除失败",description:oe instanceof Error?oe.message:"无法批量删除表达方式",variant:"destructive"})}},re=()=>{const oe=parseInt(B),Te=Math.ceil(s/c);oe>=1&&oe<=Te?(l(oe),$("")):J({title:"无效的页码",description:`请输入1-${Te}之间的页码`,variant:"destructive"})};return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsx("div",{className:"mb-4 sm:mb-6",children:o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[o.jsx(Wh,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),o.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),o.jsxs(de,{onClick:()=>N(!0),className:"gap-2",children:[o.jsx(Ls,{className:"h-4 w-4"}),"新增表达方式"]})]})}),o.jsx(gn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),o.jsx("div",{className:"text-2xl font-bold mt-1",children:U.total})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:U.recent_7days})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:U.chat_count})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx(he,{htmlFor:"search",children:"搜索"}),o.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(Ni,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{id:"search",placeholder:"搜索情境、风格或上下文...",value:h,onChange:oe=>m(oe.target.value),className:"pl-9"})]})}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[o.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:_.size>0&&o.jsxs("span",{children:["已选择 ",_.size," 个表达方式"]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:c.toString(),onValueChange:oe=>{d(parseInt(oe)),l(1),A(new Set)},children:[o.jsx($t,{id:"page-size",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),_.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>A(new Set),children:"取消选择"}),o.jsxs(de,{variant:"destructive",size:"sm",onClick:()=>P(!0),children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card",children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(_f,{children:[o.jsx(Af,{children:o.jsxs(Is,{children:[o.jsx(pn,{className:"w-12",children:o.jsx(Oi,{checked:_.size===t.length&&t.length>0,onCheckedChange:W})}),o.jsx(pn,{children:"情境"}),o.jsx(pn,{children:"风格"}),o.jsx(pn,{children:"聊天"}),o.jsx(pn,{className:"text-right",children:"操作"})]})}),o.jsx(Mf,{children:n?o.jsx(Is,{children:o.jsx(Gt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?o.jsx(Is,{children:o.jsx(Gt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(oe=>o.jsxs(Is,{children:[o.jsx(Gt,{children:o.jsx(Oi,{checked:_.has(oe.id),onCheckedChange:()=>ne(oe.id)})}),o.jsx(Gt,{className:"font-medium max-w-xs truncate",children:oe.situation}),o.jsx(Gt,{className:"max-w-xs truncate",children:oe.style}),o.jsx(Gt,{className:"max-w-[200px] truncate",title:G(oe.chat_id),style:{wordBreak:"keep-all"},children:o.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:G(oe.chat_id)})}),o.jsx(Gt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>V(oe),children:[o.jsx(z0,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsx(de,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>I(oe),title:"查看详情",children:o.jsx(Ea,{className:"h-4 w-4"})}),o.jsxs(de,{size:"sm",onClick:()=>E(oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},oe.id))})]})}),o.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(oe=>o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Oi,{checked:_.has(oe.id),onCheckedChange:()=>ne(oe.id),className:"mt-1"}),o.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),o.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:oe.situation,children:oe.situation})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),o.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:oe.style,children:oe.style})]})]})]}),o.jsxs("div",{className:"text-sm",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),o.jsx("p",{className:"text-sm truncate",title:G(oe.chat_id),style:{wordBreak:"keep-all"},children:G(oe.chat_id)})]}),o.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>V(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(z0,{className:"h-3 w-3 mr-1"}),"编辑"]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>I(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:o.jsx(Ea,{className:"h-3 w-3"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>E(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[o.jsx(Sn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},oe.id))}),s>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(Ap,{className:"h-4 w-4"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(a-1),disabled:a===1,children:[o.jsx(vd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{type:"number",value:B,onChange:oe=>$(oe.target.value),onKeyDown:oe=>oe.key==="Enter"&&re(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),o.jsx(de,{variant:"outline",size:"sm",onClick:re,disabled:!B,className:"h-8",children:"跳转"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(a+1),disabled:a>=Math.ceil(s/c),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(yd,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:o.jsx(Mp,{className:"h-4 w-4"})})]})]})]})]})}),o.jsx(COe,{expression:g,open:y,onOpenChange:w,chatNameMap:F}),o.jsx(TOe,{open:j,onOpenChange:N,chatList:z,onSuccess:()=>{X(),R(),N(!1)}}),o.jsx(EOe,{expression:g,open:S,onOpenChange:k,chatList:z,onSuccess:()=>{X(),R(),k(!1)}}),o.jsx(Dn,{open:!!T,onOpenChange:()=>E(null),children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除表达方式 "',T?.situation,'" 吗? 此操作不可撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>T&&ee(T),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),o.jsx(_Oe,{open:L,onOpenChange:P,onConfirm:se,count:_.size})]})}function COe({expression:t,open:e,onOpenChange:n,chatNameMap:r}){if(!t)return null;const s=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-",i=a=>r.get(a)||a;return o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"表达方式详情"}),o.jsx(ss,{children:"查看表达方式的完整信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(e0,{label:"情境",value:t.situation}),o.jsx(e0,{label:"风格",value:t.style}),o.jsx(e0,{label:"聊天",value:i(t.chat_id)}),o.jsx(e0,{icon:ik,label:"记录ID",value:t.id.toString(),mono:!0})]}),o.jsx("div",{className:"grid grid-cols-2 gap-4",children:o.jsx(e0,{icon:_h,label:"创建时间",value:s(t.create_date)})})]}),o.jsx(ws,{children:o.jsx(de,{onClick:()=>n(!1),children:"关闭"})})]})})}function e0({icon:t,label:e,value:n,mono:r=!1}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(he,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&o.jsx(t,{className:"h-3 w-3"}),e]}),o.jsx("div",{className:xe("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function TOe({open:t,onOpenChange:e,chatList:n,onSuccess:r}){const[s,i]=b.useState({situation:"",style:"",chat_id:""}),[a,l]=b.useState(!1),{toast:c}=as(),d=async()=>{if(!s.situation||!s.style||!s.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{l(!0),await wOe(s),c({title:"创建成功",description:"表达方式已创建"}),i({situation:"",style:"",chat_id:""}),r()}catch(h){c({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return o.jsx(Dr,{open:t,onOpenChange:e,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"新增表达方式"}),o.jsx(ss,{children:"创建新的表达方式记录"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(he,{htmlFor:"situation",children:["情境 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(ze,{id:"situation",value:s.situation,onChange:h=>i({...s,situation:h.target.value}),placeholder:"描述使用场景"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(he,{htmlFor:"style",children:["风格 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(ze,{id:"style",value:s.style,onChange:h=>i({...s,style:h.target.value}),placeholder:"描述表达风格"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(he,{htmlFor:"chat_id",children:["聊天 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsxs(Vt,{value:s.chat_id,onValueChange:h=>i({...s,chat_id:h}),children:[o.jsx($t,{children:o.jsx(Ut,{placeholder:"选择关联的聊天"})}),o.jsx(Ht,{children:n.map(h=>o.jsx(De,{value:h.chat_id,children:o.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[h.chat_name,h.is_group&&o.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},h.chat_id))})]})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>e(!1),children:"取消"}),o.jsx(de,{onClick:d,disabled:a,children:a?"创建中...":"创建"})]})]})})}function EOe({expression:t,open:e,onOpenChange:n,chatList:r,onSuccess:s}){const[i,a]=b.useState({}),[l,c]=b.useState(!1),{toast:d}=as();b.useEffect(()=>{t&&a({situation:t.situation,style:t.style,chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{c(!0),await SOe(t.id,i),d({title:"保存成功",description:"表达方式已更新"}),s()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑表达方式"}),o.jsx(ss,{children:"修改表达方式的信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit_situation",children:"情境"}),o.jsx(ze,{id:"edit_situation",value:i.situation||"",onChange:m=>a({...i,situation:m.target.value}),placeholder:"描述使用场景"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit_style",children:"风格"}),o.jsx(ze,{id:"edit_style",value:i.style||"",onChange:m=>a({...i,style:m.target.value}),placeholder:"描述表达风格"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit_chat_id",children:"聊天"}),o.jsxs(Vt,{value:i.chat_id||"",onValueChange:m=>a({...i,chat_id:m}),children:[o.jsx($t,{children:o.jsx(Ut,{placeholder:"选择关联的聊天"})}),o.jsx(Ht,{children:r.map(m=>o.jsx(De,{value:m.chat_id,children:o.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[m.chat_name,m.is_group&&o.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},m.chat_id))})]})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(de,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function _Oe({open:t,onOpenChange:e,onConfirm:n,count:r}){return o.jsx(Dn,{open:t,onOpenChange:e,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认批量删除"}),o.jsxs(_n,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Hf="/api/webui/person";async function AOe(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 St(`${Hf}/list?${e}`,{headers:Dt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function MOe(t){const e=await St(`${Hf}/${t}`,{headers:Dt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function ROe(t,e){const n=await St(`${Hf}/${t}`,{method:"PATCH",headers:Dt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function DOe(t){const e=await St(`${Hf}/${t}`,{method:"DELETE",headers:Dt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function POe(){const t=await St(`${Hf}/stats/summary`,{headers:Dt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function zOe(t){const e=await St(`${Hf}/batch/delete`,{method:"POST",headers:Dt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function IOe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(1),[c,d]=b.useState(20),[h,m]=b.useState(""),[g,x]=b.useState(void 0),[y,w]=b.useState(void 0),[S,k]=b.useState(null),[j,N]=b.useState(!1),[T,E]=b.useState(!1),[_,A]=b.useState(null),[L,P]=b.useState({total:0,known:0,unknown:0,platforms:{}}),[B,$]=b.useState(new Set),[U,te]=b.useState(!1),[z,Q]=b.useState(""),{toast:F}=as(),Y=async()=>{try{r(!0);const re=await AOe({page:a,page_size:c,search:h||void 0,is_known:g,platform:y});e(re.data),i(re.total)}catch(re){F({title:"加载失败",description:re instanceof Error?re.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},J=async()=>{try{const re=await POe();re?.data&&P(re.data)}catch(re){console.error("加载统计数据失败:",re)}};b.useEffect(()=>{Y(),J()},[a,c,h,g,y]);const X=async re=>{try{const oe=await MOe(re.person_id);k(oe.data),N(!0)}catch(oe){F({title:"加载详情失败",description:oe instanceof Error?oe.message:"无法加载人物详情",variant:"destructive"})}},R=re=>{k(re),E(!0)},ie=async re=>{try{await DOe(re.person_id),F({title:"删除成功",description:`已删除人物信息: ${re.person_name||re.nickname||re.user_id}`}),A(null),Y(),J()}catch(oe){F({title:"删除失败",description:oe instanceof Error?oe.message:"无法删除人物信息",variant:"destructive"})}},G=b.useMemo(()=>Object.keys(L.platforms),[L.platforms]),I=re=>{const oe=new Set(B);oe.has(re)?oe.delete(re):oe.add(re),$(oe)},V=()=>{B.size===t.length&&t.length>0?$(new Set):$(new Set(t.map(re=>re.person_id)))},ee=()=>{if(B.size===0){F({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}te(!0)},ne=async()=>{try{const re=await zOe(Array.from(B));F({title:"批量删除完成",description:re.message}),$(new Set),te(!1),Y(),J()}catch(re){F({title:"批量删除失败",description:re instanceof Error?re.message:"批量删除失败",variant:"destructive"})}},W=()=>{const re=parseInt(z),oe=Math.ceil(s/c);re>=1&&re<=oe?(l(re),Q("")):F({title:"无效的页码",description:`请输入1-${oe}之间的页码`,variant:"destructive"})},se=re=>re?new Date(re*1e3).toLocaleString("zh-CN"):"-";return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsx("div",{className:"mb-4 sm:mb-6",children:o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[o.jsx(ete,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),o.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),o.jsx(gn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),o.jsx("div",{className:"text-2xl font-bold mt-1",children:L.total})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:L.known})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:L.unknown})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[o.jsxs("div",{className:"sm:col-span-2",children:[o.jsx(he,{htmlFor:"search",children:"搜索"}),o.jsxs("div",{className:"relative mt-1.5",children:[o.jsx(Ni,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:h,onChange:re=>m(re.target.value),className:"pl-9"})]})]}),o.jsxs("div",{children:[o.jsx(he,{htmlFor:"filter-known",children:"认识状态"}),o.jsxs(Vt,{value:g===void 0?"all":g.toString(),onValueChange:re=>{x(re==="all"?void 0:re==="true"),l(1)},children:[o.jsx($t,{id:"filter-known",className:"mt-1.5",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),o.jsx(De,{value:"true",children:"已认识"}),o.jsx(De,{value:"false",children:"未认识"})]})]})]}),o.jsxs("div",{children:[o.jsx(he,{htmlFor:"filter-platform",children:"平台"}),o.jsxs(Vt,{value:y||"all",onValueChange:re=>{w(re==="all"?void 0:re),l(1)},children:[o.jsx($t,{id:"filter-platform",className:"mt-1.5",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部平台"}),G.map(re=>o.jsxs(De,{value:re,children:[re," (",L.platforms[re],")"]},re))]})]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[o.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:B.size>0&&o.jsxs("span",{children:["已选择 ",B.size," 个人物"]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:c.toString(),onValueChange:re=>{d(parseInt(re)),l(1),$(new Set)},children:[o.jsx($t,{id:"page-size",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),B.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>$(new Set),children:"取消选择"}),o.jsxs(de,{variant:"destructive",size:"sm",onClick:ee,children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card",children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(_f,{children:[o.jsx(Af,{children:o.jsxs(Is,{children:[o.jsx(pn,{className:"w-12",children:o.jsx(Oi,{checked:t.length>0&&B.size===t.length,onCheckedChange:V,"aria-label":"全选"})}),o.jsx(pn,{children:"状态"}),o.jsx(pn,{children:"名称"}),o.jsx(pn,{children:"昵称"}),o.jsx(pn,{children:"平台"}),o.jsx(pn,{children:"用户ID"}),o.jsx(pn,{children:"最后更新"}),o.jsx(pn,{className:"text-right",children:"操作"})]})}),o.jsx(Mf,{children:n?o.jsx(Is,{children:o.jsx(Gt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?o.jsx(Is,{children:o.jsx(Gt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(re=>o.jsxs(Is,{children:[o.jsx(Gt,{children:o.jsx(Oi,{checked:B.has(re.person_id),onCheckedChange:()=>I(re.person_id),"aria-label":`选择 ${re.person_name||re.nickname||re.user_id}`})}),o.jsx(Gt,{children:o.jsx("div",{className:xe("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"})}),o.jsx(Gt,{className:"font-medium",children:re.person_name||o.jsx("span",{className:"text-muted-foreground",children:"-"})}),o.jsx(Gt,{children:re.nickname||"-"}),o.jsx(Gt,{children:re.platform}),o.jsx(Gt,{className:"font-mono text-sm",children:re.user_id}),o.jsx(Gt,{className:"text-sm text-muted-foreground",children:se(re.last_know)}),o.jsx(Gt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(de,{variant:"default",size:"sm",onClick:()=>X(re),children:[o.jsx(Ea,{className:"h-4 w-4 mr-1"}),"详情"]}),o.jsxs(de,{variant:"default",size:"sm",onClick:()=>R(re),children:[o.jsx(z0,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsxs(de,{size:"sm",onClick:()=>A(re),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},re.id))})]})}),o.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(re=>o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Oi,{checked:B.has(re.person_id),onCheckedChange:()=>I(re.person_id),className:"mt-1"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:xe("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"}),o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:re.person_name||o.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),re.nickname&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",re.nickname]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),o.jsx("p",{className:"font-medium text-xs",children:re.platform})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),o.jsx("p",{className:"font-mono text-xs truncate",title:re.user_id,children:re.user_id})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),o.jsx("p",{className:"text-xs",children:se(re.last_know)})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>X(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(Ea,{className:"h-3 w-3 mr-1"}),"查看"]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>R(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(z0,{className:"h-3 w-3 mr-1"}),"编辑"]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>A(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[o.jsx(Sn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},re.id))}),s>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(Ap,{className:"h-4 w-4"})}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(a-1),disabled:a===1,children:[o.jsx(vd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{type:"number",value:z,onChange:re=>Q(re.target.value),onKeyDown:re=>re.key==="Enter"&&W(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),o.jsx(de,{variant:"outline",size:"sm",onClick:W,disabled:!z,className:"h-8",children:"跳转"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:()=>l(a+1),disabled:a>=Math.ceil(s/c),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(yd,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:o.jsx(Mp,{className:"h-4 w-4"})})]})]})]})]})}),o.jsx(LOe,{person:S,open:j,onOpenChange:N}),o.jsx(BOe,{person:S,open:T,onOpenChange:E,onSuccess:()=>{Y(),J(),E(!1)}}),o.jsx(Dn,{open:!!_,onOpenChange:()=>A(null),children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认删除"}),o.jsxs(_n,{children:['确定要删除人物信息 "',_?.person_name||_?.nickname||_?.user_id,'" 吗? 此操作不可撤销。']})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:()=>_&&ie(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),o.jsx(Dn,{open:U,onOpenChange:te,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"确认批量删除"}),o.jsxs(_n,{children:["确定要删除选中的 ",B.size," 个人物信息吗? 此操作不可撤销。"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{children:"取消"}),o.jsx(An,{onClick:ne,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function LOe({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"人物详情"}),o.jsxs(ss,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(bl,{icon:Dv,label:"人物名称",value:t.person_name}),o.jsx(bl,{icon:Wh,label:"昵称",value:t.nickname}),o.jsx(bl,{icon:ik,label:"用户ID",value:t.user_id,mono:!0}),o.jsx(bl,{icon:ik,label:"人物ID",value:t.person_id,mono:!0}),o.jsx(bl,{label:"平台",value:t.platform}),o.jsx(bl,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(he,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),o.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(he,{className:"text-xs text-muted-foreground",children:"个人印象"}),o.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(he,{className:"text-xs text-muted-foreground",children:"群昵称"}),o.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>o.jsxs("div",{className:"text-sm flex items-center gap-2",children:[o.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),o.jsx("span",{children:"→"}),o.jsx("span",{children:s.group_nick_name})]},i))})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[o.jsx(bl,{icon:_h,label:"认识时间",value:r(t.know_times)}),o.jsx(bl,{icon:_h,label:"首次记录",value:r(t.know_since)}),o.jsx(bl,{icon:_h,label:"最后更新",value:r(t.last_know)})]})]}),o.jsx(ws,{children:o.jsx(de,{onClick:()=>n(!1),children:"关闭"})})]})})}function bl({icon:t,label:e,value:n,mono:r=!1}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(he,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&o.jsx(t,{className:"h-3 w-3"}),e]}),o.jsx("div",{className:xe("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function BOe({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState({}),[a,l]=b.useState(!1),{toast:c}=as();b.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const d=async()=>{if(t)try{l(!0),await ROe(t.person_id,s),c({title:"保存成功",description:"人物信息已更新"}),r()}catch(h){c({title:"保存失败",description:h instanceof Error?h.message:"无法更新人物信息",variant:"destructive"})}finally{l(!1)}};return t?o.jsx(Dr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑人物信息"}),o.jsxs(ss,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"person_name",children:"人物名称"}),o.jsx(ze,{id:"person_name",value:s.person_name||"",onChange:h=>i({...s,person_name:h.target.value}),placeholder:"为这个人设置一个名称"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"nickname",children:"昵称"}),o.jsx(ze,{id:"nickname",value:s.nickname||"",onChange:h=>i({...s,nickname:h.target.value}),placeholder:"昵称"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"name_reason",children:"名称设定原因"}),o.jsx(Mr,{id:"name_reason",value:s.name_reason||"",onChange:h=>i({...s,name_reason:h.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"memory_points",children:"个人印象"}),o.jsx(Mr,{id:"memory_points",value:s.memory_points||"",onChange:h=>i({...s,memory_points:h.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),o.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[o.jsxs("div",{children:[o.jsx(he,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),o.jsx(Bt,{id:"is_known",checked:s.is_known,onCheckedChange:h=>i({...s,is_known:h})})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(de,{onClick:d,disabled:a,children:a?"保存中...":"保存"})]})]})}):null}function Bs(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n{let e;const n=new Set,r=(h,m)=>{const g=typeof h=="function"?h(e):h;if(!Object.is(g,e)){const x=e;e=m??(typeof g!="object"||g===null)?g:Object.assign({},e,g),n.forEach(y=>y(e,x))}},s=()=>e,c={setState:r,getState:s,getInitialState:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(FOe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=e=t(r,s,c);return c},qOe=t=>t?JR(t):JR,{useDebugValue:$Oe}=ae,{useSyncExternalStoreWithSelector:HOe}=pJ,QOe=t=>t;function KU(t,e=QOe,n){const r=HOe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return $Oe(r),r}const eD=(t,e)=>{const n=qOe(t),r=(s,i=e)=>KU(n,s,i);return Object.assign(r,n),r},VOe=(t,e)=>t?eD(t,e):eD;function ks(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,s]of t)if(!Object.is(s,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}var UOe={value:()=>{}};function Gb(){for(var t=0,e=arguments.length,n={},r;t=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}jv.prototype=Gb.prototype={constructor:jv,on:function(t,e){var n=this._,r=WOe(t+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),nD.hasOwnProperty(e)?{space:nD[e],local:t}:t}function XOe(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===XO&&e.documentElement.namespaceURI===XO?e.createElement(t):e.createElementNS(n,t)}}function YOe(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function ZU(t){var e=Xb(t);return(e.local?YOe:XOe)(e)}function KOe(){}function VN(t){return t==null?KOe:function(){return this.querySelector(t)}}function ZOe(t){typeof t!="function"&&(t=VN(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s=N&&(N=j+1);!(E=S[N])&&++N=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function kje(t){t||(t=Oje);function e(m,g){return m&&g?t(m.__data__,g.__data__):!m-!g}for(var n=this._groups,r=n.length,s=new Array(r),i=0;ie?1:t>=e?0:NaN}function jje(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Nje(){return Array.from(this)}function Cje(){for(var t=this._groups,e=0,n=t.length;e1?this.each((e==null?Lje:typeof e=="function"?Fje:Bje)(t,e,n??"")):mf(this.node(),t)}function mf(t,e){return t.style.getPropertyValue(e)||rW(t).getComputedStyle(t,null).getPropertyValue(e)}function $je(t){return function(){delete this[t]}}function Hje(t,e){return function(){this[t]=e}}function Qje(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Vje(t,e){return arguments.length>1?this.each((e==null?$je:typeof e=="function"?Qje:Hje)(t,e)):this.node()[t]}function sW(t){return t.trim().split(/^|\s+/)}function UN(t){return t.classList||new iW(t)}function iW(t){this._node=t,this._names=sW(t.getAttribute("class")||"")}iW.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function aW(t,e){for(var n=UN(t),r=-1,s=e.length;++r=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function y6e(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,i;n()=>t;function YO(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,dy:d,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:h}})}YO.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function E6e(t){return!t.ctrlKey&&!t.button}function _6e(){return this.parentNode}function A6e(t,e){return e??{x:t.x,y:t.y}}function M6e(){return navigator.maxTouchPoints||"ontouchstart"in this}function R6e(){var t=E6e,e=_6e,n=A6e,r=M6e,s={},i=Gb("start","drag","end"),a=0,l,c,d,h,m=0;function g(T){T.on("mousedown.drag",x).filter(r).on("touchstart.drag",S).on("touchmove.drag",k,T6e).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(T,E){if(!(h||!t.call(this,T,E))){var _=N(this,e.call(this,T,E),T,E,"mouse");_&&(ma(T.view).on("mousemove.drag",y,yp).on("mouseup.drag",w,yp),uW(T.view),o5(T),d=!1,l=T.clientX,c=T.clientY,_("start",T))}}function y(T){if(Hh(T),!d){var E=T.clientX-l,_=T.clientY-c;d=E*E+_*_>m}s.mouse("drag",T)}function w(T){ma(T.view).on("mousemove.drag mouseup.drag",null),dW(T.view,d),Hh(T),s.mouse("end",T)}function S(T,E){if(t.call(this,T,E)){var _=T.changedTouches,A=e.call(this,T,E),L=_.length,P,B;for(P=0;P=0&&t._call.call(void 0,e),t=t._next;--pf}function rD(){md=(Ey=bp.now())+Yb,pf=f0=0;try{P6e()}finally{pf=0,I6e(),md=0}}function z6e(){var t=bp.now(),e=t-Ey;e>hW&&(Yb-=e,Ey=t)}function I6e(){for(var t,e=Ty,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ty=n);m0=t,KO(r)}function KO(t){if(!pf){f0&&(f0=clearTimeout(f0));var e=t-md;e>24?(t<1/0&&(f0=setTimeout(rD,t-bp.now()-Yb)),t0&&(t0=clearInterval(t0))):(t0||(Ey=bp.now(),t0=setInterval(z6e,hW)),pf=1,fW(rD))}}function sD(t,e,n){var r=new _y;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var L6e=Gb("start","end","cancel","interrupt"),B6e=[],pW=0,iD=1,ZO=2,Nv=3,aD=4,JO=5,Cv=6;function Kb(t,e,n,r,s,i){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;F6e(t,n,{name:e,index:r,group:s,on:L6e,tween:B6e,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:pW})}function GN(t,e){var n=io(t,e);if(n.state>pW)throw new Error("too late; already scheduled");return n}function Go(t,e){var n=io(t,e);if(n.state>Nv)throw new Error("too late; already running");return n}function io(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function F6e(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=mW(i,0,n.time);function i(d){n.state=iD,n.timer.restart(a,n.delay,n.time),n.delay<=d&&a(d-n.delay)}function a(d){var h,m,g,x;if(n.state!==iD)return c();for(h in r)if(x=r[h],x.name===n.name){if(x.state===Nv)return sD(a);x.state===aD?(x.state=Cv,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete r[h]):+hZO&&r.state=0&&(e=e.slice(0,n)),!e||e==="start"})}function gNe(t,e,n){var r,s,i=pNe(e)?GN:Go;return function(){var a=i(this,t),l=a.on;l!==r&&(s=(r=l).copy()).on(e,n),a.on=s}}function xNe(t,e){var n=this._id;return arguments.length<2?io(this.node(),n).on.on(t):this.each(gNe(n,t,e))}function vNe(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function yNe(){return this.on("end.remove",vNe(this._id))}function bNe(t){var e=this._name,n=this._id;typeof t!="function"&&(t=VN(t));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>t;function VNe(t,{sourceEvent:e,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Rl(t,e,n){this.k=t,this.x=e,this.y=n}Rl.prototype={constructor:Rl,scale:function(t){return t===1?this:new Rl(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Rl(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Fl=new Rl(1,0,0);Rl.prototype;function l5(t){t.stopImmediatePropagation()}function n0(t){t.preventDefault(),t.stopImmediatePropagation()}function UNe(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function WNe(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function oD(){return this.__zoom||Fl}function GNe(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function XNe(){return navigator.maxTouchPoints||"ontouchstart"in this}function YNe(t,e,n){var r=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function yW(){var t=UNe,e=WNe,n=YNe,r=GNe,s=XNe,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=BJ,d=Gb("start","zoom","end"),h,m,g,x=500,y=150,w=0,S=10;function k(z){z.property("__zoom",oD).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",B).filter(s).on("touchstart.zoom",$).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",te).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(z,Q,F,Y){var J=z.selection?z.selection():z;J.property("__zoom",oD),z!==J?E(z,Q,F,Y):J.interrupt().each(function(){_(this,arguments).event(Y).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},k.scaleBy=function(z,Q,F,Y){k.scaleTo(z,function(){var J=this.__zoom.k,X=typeof Q=="function"?Q.apply(this,arguments):Q;return J*X},F,Y)},k.scaleTo=function(z,Q,F,Y){k.transform(z,function(){var J=e.apply(this,arguments),X=this.__zoom,R=F==null?T(J):typeof F=="function"?F.apply(this,arguments):F,ie=X.invert(R),G=typeof Q=="function"?Q.apply(this,arguments):Q;return n(N(j(X,G),R,ie),J,a)},F,Y)},k.translateBy=function(z,Q,F,Y){k.transform(z,function(){return n(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof F=="function"?F.apply(this,arguments):F),e.apply(this,arguments),a)},null,Y)},k.translateTo=function(z,Q,F,Y,J){k.transform(z,function(){var X=e.apply(this,arguments),R=this.__zoom,ie=Y==null?T(X):typeof Y=="function"?Y.apply(this,arguments):Y;return n(Fl.translate(ie[0],ie[1]).scale(R.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof F=="function"?-F.apply(this,arguments):-F),X,a)},Y,J)};function j(z,Q){return Q=Math.max(i[0],Math.min(i[1],Q)),Q===z.k?z:new Rl(Q,z.x,z.y)}function N(z,Q,F){var Y=Q[0]-F[0]*z.k,J=Q[1]-F[1]*z.k;return Y===z.x&&J===z.y?z:new Rl(z.k,Y,J)}function T(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function E(z,Q,F,Y){z.on("start.zoom",function(){_(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(Y).end()}).tween("zoom",function(){var J=this,X=arguments,R=_(J,X).event(Y),ie=e.apply(J,X),G=F==null?T(ie):typeof F=="function"?F.apply(J,X):F,I=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),V=J.__zoom,ee=typeof Q=="function"?Q.apply(J,X):Q,ne=c(V.invert(G).concat(I/V.k),ee.invert(G).concat(I/ee.k));return function(W){if(W===1)W=ee;else{var se=ne(W),re=I/se[2];W=new Rl(re,G[0]-se[0]*re,G[1]-se[1]*re)}R.zoom(null,W)}})}function _(z,Q,F){return!F&&z.__zooming||new A(z,Q)}function A(z,Q){this.that=z,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=e.apply(z,Q),this.taps=0}A.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,Q){return this.mouse&&z!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=Q.invert(this.touch1[0])),this.that.__zoom=Q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var Q=ma(this.that).datum();d.call(z,this.that,new VNe(z,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:d}),Q)}};function L(z,...Q){if(!t.apply(this,arguments))return;var F=_(this,Q).event(z),Y=this.__zoom,J=Math.max(i[0],Math.min(i[1],Y.k*Math.pow(2,r.apply(this,arguments)))),X=Ha(z);if(F.wheel)(F.mouse[0][0]!==X[0]||F.mouse[0][1]!==X[1])&&(F.mouse[1]=Y.invert(F.mouse[0]=X)),clearTimeout(F.wheel);else{if(Y.k===J)return;F.mouse=[X,Y.invert(X)],Tv(this),F.start()}n0(z),F.wheel=setTimeout(R,y),F.zoom("mouse",n(N(j(Y,J),F.mouse[0],F.mouse[1]),F.extent,a));function R(){F.wheel=null,F.end()}}function P(z,...Q){if(g||!t.apply(this,arguments))return;var F=z.currentTarget,Y=_(this,Q,!0).event(z),J=ma(z.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",I,!0),X=Ha(z,F),R=z.clientX,ie=z.clientY;uW(z.view),l5(z),Y.mouse=[X,this.__zoom.invert(X)],Tv(this),Y.start();function G(V){if(n0(V),!Y.moved){var ee=V.clientX-R,ne=V.clientY-ie;Y.moved=ee*ee+ne*ne>w}Y.event(V).zoom("mouse",n(N(Y.that.__zoom,Y.mouse[0]=Ha(V,F),Y.mouse[1]),Y.extent,a))}function I(V){J.on("mousemove.zoom mouseup.zoom",null),dW(V.view,Y.moved),n0(V),Y.event(V).end()}}function B(z,...Q){if(t.apply(this,arguments)){var F=this.__zoom,Y=Ha(z.changedTouches?z.changedTouches[0]:z,this),J=F.invert(Y),X=F.k*(z.shiftKey?.5:2),R=n(N(j(F,X),Y,J),e.apply(this,Q),a);n0(z),l>0?ma(this).transition().duration(l).call(E,R,Y,z):ma(this).call(k.transform,R,Y,z)}}function $(z,...Q){if(t.apply(this,arguments)){var F=z.touches,Y=F.length,J=_(this,Q,z.changedTouches.length===Y).event(z),X,R,ie,G;for(l5(z),R=0;R"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},bW=Gl.error001();function hr(t,e){const n=b.useContext(Zb);if(n===null)throw new Error(bW);return KU(n,t,e)}const ps=()=>{const t=b.useContext(Zb);if(t===null)throw new Error(bW);return b.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},ZNe=t=>t.userSelectionActive?"none":"all";function Jb({position:t,children:e,className:n,style:r,...s}){const i=hr(ZNe),a=`${t}`.split("-");return ae.createElement("div",{className:Bs(["react-flow__panel",n,...a]),style:{...r,pointerEvents:i},...s},e)}function JNe({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:ae.createElement(Jb,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},ae.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const e7e=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...h})=>{const m=b.useRef(null),[g,x]=b.useState({x:0,y:0,width:0,height:0}),y=Bs(["react-flow__edge-textwrapper",d]);return b.useEffect(()=>{if(m.current){const w=m.current.getBBox();x({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),typeof n>"u"||!n?null:ae.createElement("g",{transform:`translate(${t-g.width/2} ${e-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...h},s&&ae.createElement("rect",{width:g.width+2*a[0],x:-a[0],y:-a[1],height:g.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),ae.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:m,style:r},n),c)};var t7e=b.memo(e7e);const YN=t=>({width:t.offsetWidth,height:t.offsetHeight}),gf=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),KN=(t={x:0,y:0},e)=>({x:gf(t.x,e[0][0],e[1][0]),y:gf(t.y,e[0][1],e[1][1])}),lD=(t,e,n)=>tn?-gf(Math.abs(t-n),1,50)/50:0,wW=(t,e)=>{const n=lD(t.x,35,e.width-35)*20,r=lD(t.y,35,e.height-35)*20;return[n,r]},SW=t=>t.getRootNode?.()||window?.document,kW=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),wp=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),OW=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),cD=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),n7e=(t,e)=>OW(kW(wp(t),wp(e))),ej=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},r7e=t=>ka(t.width)&&ka(t.height)&&ka(t.x)&&ka(t.y),ka=t=>!isNaN(t)&&isFinite(t),Lr=Symbol.for("internals"),jW=["Enter"," ","Escape"],s7e=(t,e)=>{},i7e=t=>"nativeEvent"in t;function tj(t){const n=(i7e(t)?t.nativeEvent:t).composedPath?.()?.[0]||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n?.nodeName)||n?.hasAttribute("contenteditable")||!!n?.closest(".nokey")}const NW=t=>"clientX"in t,Hc=(t,e)=>{const n=NW(t),r=n?t.clientX:t.touches?.[0].clientX,s=n?t.clientY:t.touches?.[0].clientY;return{x:r-(e?.left??0),y:s-(e?.top??0)}},Ay=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,vg=({id:t,path:e,labelX:n,labelY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:m,markerStart:g,interactionWidth:x=20})=>ae.createElement(ae.Fragment,null,ae.createElement("path",{id:t,style:h,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:g}),x&&ae.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),s&&ka(n)&&ka(r)?ae.createElement(t7e,{x:n,y:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d}):null);vg.displayName="BaseEdge";function r0(t,e,n){return n===void 0?n:r=>{const s=e().edges.find(i=>i.id===t);s&&n(r,{...s})}}function CW({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,i=n{const[S,k,j]=EW({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i});return ae.createElement(vg,{path:S,labelX:k,labelY:j,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:w})});ZN.displayName="SimpleBezierEdge";const dD={[wt.Left]:{x:-1,y:0},[wt.Right]:{x:1,y:0},[wt.Top]:{x:0,y:-1},[wt.Bottom]:{x:0,y:1}},a7e=({source:t,sourcePosition:e=wt.Bottom,target:n})=>e===wt.Left||e===wt.Right?t.xMath.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function o7e({source:t,sourcePosition:e=wt.Bottom,target:n,targetPosition:r=wt.Top,center:s,offset:i}){const a=dD[e],l=dD[r],c={x:t.x+a.x*i,y:t.y+a.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},h=a7e({source:c,sourcePosition:e,target:d}),m=h.x!==0?"x":"y",g=h[m];let x=[],y,w;const S={x:0,y:0},k={x:0,y:0},[j,N,T,E]=CW({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[m]*l[m]===-1){y=s.x??j,w=s.y??N;const A=[{x:y,y:c.y},{x:y,y:d.y}],L=[{x:c.x,y:w},{x:d.x,y:w}];a[m]===g?x=m==="x"?A:L:x=m==="x"?L:A}else{const A=[{x:c.x,y:d.y}],L=[{x:d.x,y:c.y}];if(m==="x"?x=a.x===g?L:A:x=a.y===g?A:L,e===r){const te=Math.abs(t[m]-n[m]);if(te<=i){const z=Math.min(i-1,i-te);a[m]===g?S[m]=(c[m]>t[m]?-1:1)*z:k[m]=(d[m]>n[m]?-1:1)*z}}if(e!==r){const te=m==="x"?"y":"x",z=a[m]===l[te],Q=c[te]>d[te],F=c[te]=U?(y=(P.x+B.x)/2,w=x[0].y):(y=x[0].x,w=(P.y+B.y)/2)}return[[t,{x:c.x+S.x,y:c.y+S.y},...x,{x:d.x+k.x,y:d.y+k.y},n],y,w,T,E]}function l7e(t,e,n,r){const s=Math.min(hD(t,e)/2,hD(e,n)/2,r),{x:i,y:a}=e;if(t.x===i&&i===n.x||t.y===a&&a===n.y)return`L${i} ${a}`;if(t.y===a){const d=t.x{let N="";return j>0&&j{const[k,j,N]=nj({sourceX:t,sourceY:e,sourcePosition:m,targetX:n,targetY:r,targetPosition:g,borderRadius:w?.borderRadius,offset:w?.offset});return ae.createElement(vg,{path:k,labelX:j,labelY:N,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:x,markerStart:y,interactionWidth:S})});ew.displayName="SmoothStepEdge";const JN=b.memo(t=>ae.createElement(ew,{...t,pathOptions:b.useMemo(()=>({borderRadius:0,offset:t.pathOptions?.offset}),[t.pathOptions?.offset])}));JN.displayName="StepEdge";function c7e({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,i,a,l]=CW({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,i,a,l]}const e7=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:m,markerStart:g,interactionWidth:x})=>{const[y,w,S]=c7e({sourceX:t,sourceY:e,targetX:n,targetY:r});return ae.createElement(vg,{path:y,labelX:w,labelY:S,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:m,markerStart:g,interactionWidth:x})});e7.displayName="StraightEdge";function $1(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function fD({pos:t,x1:e,y1:n,x2:r,y2:s,c:i}){switch(t){case wt.Left:return[e-$1(e-r,i),n];case wt.Right:return[e+$1(r-e,i),n];case wt.Top:return[e,n-$1(n-s,i)];case wt.Bottom:return[e,n+$1(s-n,i)]}}function _W({sourceX:t,sourceY:e,sourcePosition:n=wt.Bottom,targetX:r,targetY:s,targetPosition:i=wt.Top,curvature:a=.25}){const[l,c]=fD({pos:n,x1:t,y1:e,x2:r,y2:s,c:a}),[d,h]=fD({pos:i,x1:r,y1:s,x2:t,y2:e,c:a}),[m,g,x,y]=TW({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${t},${e} C${l},${c} ${d},${h} ${r},${s}`,m,g,x,y]}const Ry=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=wt.Bottom,targetPosition:i=wt.Top,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,pathOptions:w,interactionWidth:S})=>{const[k,j,N]=_W({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:w?.curvature});return ae.createElement(vg,{path:k,labelX:j,labelY:N,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:S})});Ry.displayName="BezierEdge";const t7=b.createContext(null),u7e=t7.Provider;t7.Consumer;const d7e=()=>b.useContext(t7),h7e=t=>"id"in t&&"source"in t&&"target"in t,f7e=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,rj=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,m7e=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),p7e=(t,e)=>{if(!t.source||!t.target)return e;let n;return h7e(t)?n={...t}:n={...t,id:f7e(t)},m7e(n,e)?e:e.concat(n)},sj=({x:t,y:e},[n,r,s],i,[a,l])=>{const c={x:(t-n)/s,y:(e-r)/s};return i?{x:a*Math.round(c.x/a),y:l*Math.round(c.y/l)}:c},AW=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r}),td=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],r=(t.height??0)*e[1],s={x:t.position.x-n,y:t.position.y-r};return{...s,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-r}:s}},tw=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,s)=>{const{x:i,y:a}=td(s,e).positionAbsolute;return kW(r,wp({x:i,y:a,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return OW(n)},MW=(t,e,[n,r,s]=[0,0,1],i=!1,a=!1,l=[0,0])=>{const c={x:(e.x-n)/s,y:(e.y-r)/s,width:e.width/s,height:e.height/s},d=[];return t.forEach(h=>{const{width:m,height:g,selectable:x=!0,hidden:y=!1}=h;if(a&&!x||y)return!1;const{positionAbsolute:w}=td(h,l),S={x:w.x,y:w.y,width:m||0,height:g||0},k=ej(c,S),j=typeof m>"u"||typeof g>"u"||m===null||g===null,N=i&&k>0,T=(m||0)*(g||0);(j||N||k>=T||h.dragging)&&d.push(h)}),d},RW=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},DW=(t,e,n,r,s,i=.1)=>{const a=e/(t.width*(1+i)),l=n/(t.height*(1+i)),c=Math.min(a,l),d=gf(c,r,s),h=t.x+t.width/2,m=t.y+t.height/2,g=e/2-h*d,x=n/2-m*d;return{x:g,y:x,zoom:d}},Lu=(t,e=0)=>t.transition().duration(e);function mD(t,e,n,r){return(e[n]||[]).reduce((s,i)=>(`${t.id}-${i.id}-${n}`!==r&&s.push({id:i.id||null,type:n,nodeId:t.id,x:(t.positionAbsolute?.x??0)+i.x+i.width/2,y:(t.positionAbsolute?.y??0)+i.y+i.height/2}),s),[])}function g7e(t,e,n,r,s,i){const{x:a,y:l}=Hc(t),d=e.elementsFromPoint(a,l).find(y=>y.classList.contains("react-flow__handle"));if(d){const y=d.getAttribute("data-nodeid");if(y){const w=n7(void 0,d),S=d.getAttribute("data-handleid"),k=i({nodeId:y,id:S,type:w});if(k){const j=s.find(N=>N.nodeId===y&&N.type===w&&N.id===S);return{handle:{id:S,type:w,nodeId:y,x:j?.x||n.x,y:j?.y||n.y},validHandleResult:k}}}}let h=[],m=1/0;if(s.forEach(y=>{const w=Math.sqrt((y.x-n.x)**2+(y.y-n.y)**2);if(w<=r){const S=i(y);w<=m&&(wy.isValid),x=h.some(({handle:y})=>y.type==="target");return h.find(({handle:y,validHandleResult:w})=>x?y.type==="target":g?w.isValid:!0)||h[0]}const x7e={source:null,target:null,sourceHandle:null,targetHandle:null},PW=()=>({handleDomNode:null,isValid:!1,connection:x7e,endHandle:null});function zW(t,e,n,r,s,i,a){const l=s==="target",c=a.querySelector(`.react-flow__handle[data-id="${t?.nodeId}-${t?.id}-${t?.type}"]`),d={...PW(),handleDomNode:c};if(c){const h=n7(void 0,c),m=c.getAttribute("data-nodeid"),g=c.getAttribute("data-handleid"),x=c.classList.contains("connectable"),y=c.classList.contains("connectableend"),w={source:l?m:n,sourceHandle:l?g:r,target:l?n:m,targetHandle:l?r:g};d.connection=w,x&&y&&(e===pd.Strict?l&&h==="source"||!l&&h==="target":m!==n||g!==r)&&(d.endHandle={nodeId:m,handleId:g,type:h},d.isValid=i(w))}return d}function v7e({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((s,i)=>{if(i[Lr]){const{handleBounds:a}=i[Lr];let l=[],c=[];a&&(l=mD(i,a,"source",`${e}-${n}-${r}`),c=mD(i,a,"target",`${e}-${n}-${r}`)),s.push(...l,...c)}return s},[])}function n7(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function c5(t){t?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function y7e(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function IW({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:s,getState:i,setState:a,isValidConnection:l,edgeUpdaterType:c,onReconnectEnd:d}){const h=SW(t.target),{connectionMode:m,domNode:g,autoPanOnConnect:x,connectionRadius:y,onConnectStart:w,panBy:S,getNodes:k,cancelConnection:j}=i();let N=0,T;const{x:E,y:_}=Hc(t),A=h?.elementFromPoint(E,_),L=n7(c,A),P=g?.getBoundingClientRect();if(!P||!L)return;let B,$=Hc(t,P),U=!1,te=null,z=!1,Q=null;const F=v7e({nodes:k(),nodeId:n,handleId:e,handleType:L}),Y=()=>{if(!x)return;const[R,ie]=wW($,P);S({x:R,y:ie}),N=requestAnimationFrame(Y)};a({connectionPosition:$,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:L,connectionStartHandle:{nodeId:n,handleId:e,type:L},connectionEndHandle:null}),w?.(t,{nodeId:n,handleId:e,handleType:L});function J(R){const{transform:ie}=i();$=Hc(R,P);const{handle:G,validHandleResult:I}=g7e(R,h,sj($,ie,!1,[1,1]),y,F,V=>zW(V,m,n,e,s?"target":"source",l,h));if(T=G,U||(Y(),U=!0),Q=I.handleDomNode,te=I.connection,z=I.isValid,a({connectionPosition:T&&z?AW({x:T.x,y:T.y},ie):$,connectionStatus:y7e(!!T,z),connectionEndHandle:I.endHandle}),!T&&!z&&!Q)return c5(B);te.source!==te.target&&Q&&(c5(B),B=Q,Q.classList.add("connecting","react-flow__handle-connecting"),Q.classList.toggle("valid",z),Q.classList.toggle("react-flow__handle-valid",z))}function X(R){(T||Q)&&te&&z&&r?.(te),i().onConnectEnd?.(R),c&&d?.(R),c5(B),j(),cancelAnimationFrame(N),U=!1,z=!1,te=null,Q=null,h.removeEventListener("mousemove",J),h.removeEventListener("mouseup",X),h.removeEventListener("touchmove",J),h.removeEventListener("touchend",X)}h.addEventListener("mousemove",J),h.addEventListener("mouseup",X),h.addEventListener("touchmove",J),h.addEventListener("touchend",X)}const pD=()=>!0,b7e=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),w7e=(t,e,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:i,connectionClickStartHandle:a}=r;return{connecting:s?.nodeId===t&&s?.handleId===e&&s?.type===n||i?.nodeId===t&&i?.handleId===e&&i?.type===n,clickConnecting:a?.nodeId===t&&a?.handleId===e&&a?.type===n}},LW=b.forwardRef(({type:t="source",position:e=wt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:d,onMouseDown:h,onTouchStart:m,...g},x)=>{const y=a||null,w=t==="target",S=ps(),k=d7e(),{connectOnClick:j,noPanClassName:N}=hr(b7e,ks),{connecting:T,clickConnecting:E}=hr(w7e(k,y,t),ks);k||S.getState().onError?.("010",Gl.error010());const _=P=>{const{defaultEdgeOptions:B,onConnect:$,hasDefaultEdges:U}=S.getState(),te={...B,...P};if(U){const{edges:z,setEdges:Q}=S.getState();Q(p7e(te,z))}$?.(te),l?.(te)},A=P=>{if(!k)return;const B=NW(P);s&&(B&&P.button===0||!B)&&IW({event:P,handleId:y,nodeId:k,onConnect:_,isTarget:w,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||pD}),B?h?.(P):m?.(P)},L=P=>{const{onClickConnectStart:B,onClickConnectEnd:$,connectionClickStartHandle:U,connectionMode:te,isValidConnection:z}=S.getState();if(!k||!U&&!s)return;if(!U){B?.(P,{nodeId:k,handleId:y,handleType:t}),S.setState({connectionClickStartHandle:{nodeId:k,type:t,handleId:y}});return}const Q=SW(P.target),F=n||z||pD,{connection:Y,isValid:J}=zW({nodeId:k,id:y,type:t},te,U.nodeId,U.handleId||null,U.type,F,Q);J&&_(Y),$?.(P),S.setState({connectionClickStartHandle:null})};return ae.createElement("div",{"data-handleid":y,"data-nodeid":k,"data-handlepos":e,"data-id":`${k}-${y}-${t}`,className:Bs(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",N,d,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:i,connecting:E,connectionindicator:r&&(s&&!T||i&&T)}]),onMouseDown:A,onTouchStart:A,onClick:j?L:void 0,ref:x,...g},c)});LW.displayName="Handle";var ru=b.memo(LW);const BW=({data:t,isConnectable:e,targetPosition:n=wt.Top,sourcePosition:r=wt.Bottom})=>ae.createElement(ae.Fragment,null,ae.createElement(ru,{type:"target",position:n,isConnectable:e}),t?.label,ae.createElement(ru,{type:"source",position:r,isConnectable:e}));BW.displayName="DefaultNode";var ij=b.memo(BW);const FW=({data:t,isConnectable:e,sourcePosition:n=wt.Bottom})=>ae.createElement(ae.Fragment,null,t?.label,ae.createElement(ru,{type:"source",position:n,isConnectable:e}));FW.displayName="InputNode";var qW=b.memo(FW);const $W=({data:t,isConnectable:e,targetPosition:n=wt.Top})=>ae.createElement(ae.Fragment,null,ae.createElement(ru,{type:"target",position:n,isConnectable:e}),t?.label);$W.displayName="OutputNode";var HW=b.memo($W);const r7=()=>null;r7.displayName="GroupNode";const S7e=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),H1=t=>t.id;function k7e(t,e){return ks(t.selectedNodes.map(H1),e.selectedNodes.map(H1))&&ks(t.selectedEdges.map(H1),e.selectedEdges.map(H1))}const QW=b.memo(({onSelectionChange:t})=>{const e=ps(),{selectedNodes:n,selectedEdges:r}=hr(S7e,k7e);return b.useEffect(()=>{const s={nodes:n,edges:r};t?.(s),e.getState().onSelectionChange.forEach(i=>i(s))},[n,r,t]),null});QW.displayName="SelectionListener";const O7e=t=>!!t.onSelectionChange;function j7e({onSelectionChange:t}){const e=hr(O7e);return t||e?ae.createElement(QW,{onSelectionChange:t}):null}const N7e=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function uh(t,e){b.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function an(t,e,n){b.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const C7e=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:i,onConnectEnd:a,onClickConnectStart:l,onClickConnectEnd:c,nodesDraggable:d,nodesConnectable:h,nodesFocusable:m,edgesFocusable:g,edgesUpdatable:x,elevateNodesOnSelect:y,minZoom:w,maxZoom:S,nodeExtent:k,onNodesChange:j,onEdgesChange:N,elementsSelectable:T,connectionMode:E,snapGrid:_,snapToGrid:A,translateExtent:L,connectOnClick:P,defaultEdgeOptions:B,fitView:$,fitViewOptions:U,onNodesDelete:te,onEdgesDelete:z,onNodeDrag:Q,onNodeDragStart:F,onNodeDragStop:Y,onSelectionDrag:J,onSelectionDragStart:X,onSelectionDragStop:R,noPanClassName:ie,nodeOrigin:G,rfId:I,autoPanOnConnect:V,autoPanOnNodeDrag:ee,onError:ne,connectionRadius:W,isValidConnection:se,nodeDragThreshold:re})=>{const{setNodes:oe,setEdges:Te,setDefaultNodesAndEdges:We,setMinZoom:Ye,setMaxZoom:Je,setTranslateExtent:Oe,setNodeExtent:Ve,reset:Ue}=hr(N7e,ks),He=ps();return b.useEffect(()=>{const Ot=r?.map(xt=>({...xt,...B}));return We(n,Ot),()=>{Ue()}},[]),an("defaultEdgeOptions",B,He.setState),an("connectionMode",E,He.setState),an("onConnect",s,He.setState),an("onConnectStart",i,He.setState),an("onConnectEnd",a,He.setState),an("onClickConnectStart",l,He.setState),an("onClickConnectEnd",c,He.setState),an("nodesDraggable",d,He.setState),an("nodesConnectable",h,He.setState),an("nodesFocusable",m,He.setState),an("edgesFocusable",g,He.setState),an("edgesUpdatable",x,He.setState),an("elementsSelectable",T,He.setState),an("elevateNodesOnSelect",y,He.setState),an("snapToGrid",A,He.setState),an("snapGrid",_,He.setState),an("onNodesChange",j,He.setState),an("onEdgesChange",N,He.setState),an("connectOnClick",P,He.setState),an("fitViewOnInit",$,He.setState),an("fitViewOnInitOptions",U,He.setState),an("onNodesDelete",te,He.setState),an("onEdgesDelete",z,He.setState),an("onNodeDrag",Q,He.setState),an("onNodeDragStart",F,He.setState),an("onNodeDragStop",Y,He.setState),an("onSelectionDrag",J,He.setState),an("onSelectionDragStart",X,He.setState),an("onSelectionDragStop",R,He.setState),an("noPanClassName",ie,He.setState),an("nodeOrigin",G,He.setState),an("rfId",I,He.setState),an("autoPanOnConnect",V,He.setState),an("autoPanOnNodeDrag",ee,He.setState),an("onError",ne,He.setState),an("connectionRadius",W,He.setState),an("isValidConnection",se,He.setState),an("nodeDragThreshold",re,He.setState),uh(t,oe),uh(e,Te),uh(w,Ye),uh(S,Je),uh(L,Oe),uh(k,Ve),null},gD={display:"none"},T7e={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},VW="react-flow__node-desc",UW="react-flow__edge-desc",E7e="react-flow__aria-live",_7e=t=>t.ariaLiveMessage;function A7e({rfId:t}){const e=hr(_7e);return ae.createElement("div",{id:`${E7e}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:T7e},e)}function M7e({rfId:t,disableKeyboardA11y:e}){return ae.createElement(ae.Fragment,null,ae.createElement("div",{id:`${VW}-${t}`,style:gD},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),ae.createElement("div",{id:`${UW}-${t}`,style:gD},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&ae.createElement(A7e,{rfId:t}))}var kp=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=b.useState(!1),s=b.useRef(!1),i=b.useRef(new Set([])),[a,l]=b.useMemo(()=>{if(t!==null){const d=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=d.reduce((m,g)=>m.concat(...g),[]);return[d,h]}return[[],[]]},[t]);return b.useEffect(()=>{const c=typeof document<"u"?document:null,d=e?.target||c;if(t!==null){const h=x=>{if(s.current=x.ctrlKey||x.metaKey||x.shiftKey,(!s.current||s.current&&!e.actInsideInputWithModifier)&&tj(x))return!1;const w=vD(x.code,l);i.current.add(x[w]),xD(a,i.current,!1)&&(x.preventDefault(),r(!0))},m=x=>{if((!s.current||s.current&&!e.actInsideInputWithModifier)&&tj(x))return!1;const w=vD(x.code,l);xD(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(x[w]),x.key==="Meta"&&i.current.clear(),s.current=!1},g=()=>{i.current.clear(),r(!1)};return d?.addEventListener("keydown",h),d?.addEventListener("keyup",m),window.addEventListener("blur",g),()=>{d?.removeEventListener("keydown",h),d?.removeEventListener("keyup",m),window.removeEventListener("blur",g)}}},[t,r]),n};function xD(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function vD(t,e){return e.includes(t)?"code":"key"}function WW(t,e,n,r){const s=t.parentNode||t.parentId;if(!s)return n;const i=e.get(s),a=td(i,r);return WW(i,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(i[Lr]?.z??0)>(n.z??0)?i[Lr]?.z??0:n.z??0},r)}function GW(t,e,n){t.forEach(r=>{const s=r.parentNode||r.parentId;if(s&&!t.has(s))throw new Error(`Parent node ${s} not found`);if(s||n?.[r.id]){const{x:i,y:a,z:l}=WW(r,t,{...r.position,z:r[Lr]?.z??0},e);r.positionAbsolute={x:i,y:a},r[Lr].z=l,n?.[r.id]&&(r[Lr].isParent=!0)}})}function u5(t,e,n,r){const s=new Map,i={},a=r?1e3:0;return t.forEach(l=>{const c=(ka(l.zIndex)?l.zIndex:0)+(l.selected?a:0),d=e.get(l.id),h={...l,positionAbsolute:{x:l.position.x,y:l.position.y}},m=l.parentNode||l.parentId;m&&(i[m]=!0);const g=d?.type&&d?.type!==l.type;Object.defineProperty(h,Lr,{enumerable:!1,value:{handleBounds:g?void 0:d?.[Lr]?.handleBounds,z:c}}),s.set(l.id,h)}),GW(s,n,i),s}function XW(t,e={}){const{getNodes:n,width:r,height:s,minZoom:i,maxZoom:a,d3Zoom:l,d3Selection:c,fitViewOnInitDone:d,fitViewOnInit:h,nodeOrigin:m}=t(),g=e.initial&&!d&&h;if(l&&c&&(g||!e.initial)){const y=n().filter(S=>{const k=e.includeHiddenNodes?S.width&&S.height:!S.hidden;return e.nodes?.length?k&&e.nodes.some(j=>j.id===S.id):k}),w=y.every(S=>S.width&&S.height);if(y.length>0&&w){const S=tw(y,m),{x:k,y:j,zoom:N}=DW(S,r,s,e.minZoom??i,e.maxZoom??a,e.padding??.1),T=Fl.translate(k,j).scale(N);return typeof e.duration=="number"&&e.duration>0?l.transform(Lu(c,e.duration),T):l.transform(c,T),!0}}return!1}function R7e(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[Lr]:r[Lr],selected:n.selected})}),new Map(e)}function D7e(t,e){return e.map(n=>{const r=t.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function Q1({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:s,edges:i,onNodesChange:a,onEdgesChange:l,hasDefaultNodes:c,hasDefaultEdges:d}=n();t?.length&&(c&&r({nodeInternals:R7e(t,s)}),a?.(t)),e?.length&&(d&&r({edges:D7e(e,i)}),l?.(e))}const dh=()=>{},P7e={zoomIn:dh,zoomOut:dh,zoomTo:dh,getZoom:()=>1,setViewport:dh,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:dh,fitBounds:dh,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},z7e=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),I7e=()=>{const t=ps(),{d3Zoom:e,d3Selection:n}=hr(z7e,ks);return b.useMemo(()=>n&&e?{zoomIn:s=>e.scaleBy(Lu(n,s?.duration),1.2),zoomOut:s=>e.scaleBy(Lu(n,s?.duration),1/1.2),zoomTo:(s,i)=>e.scaleTo(Lu(n,i?.duration),s),getZoom:()=>t.getState().transform[2],setViewport:(s,i)=>{const[a,l,c]=t.getState().transform,d=Fl.translate(s.x??a,s.y??l).scale(s.zoom??c);e.transform(Lu(n,i?.duration),d)},getViewport:()=>{const[s,i,a]=t.getState().transform;return{x:s,y:i,zoom:a}},fitView:s=>XW(t.getState,s),setCenter:(s,i,a)=>{const{width:l,height:c,maxZoom:d}=t.getState(),h=typeof a?.zoom<"u"?a.zoom:d,m=l/2-s*h,g=c/2-i*h,x=Fl.translate(m,g).scale(h);e.transform(Lu(n,a?.duration),x)},fitBounds:(s,i)=>{const{width:a,height:l,minZoom:c,maxZoom:d}=t.getState(),{x:h,y:m,zoom:g}=DW(s,a,l,c,d,i?.padding??.1),x=Fl.translate(h,m).scale(g);e.transform(Lu(n,i?.duration),x)},project:s=>{const{transform:i,snapToGrid:a,snapGrid:l}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),sj(s,i,a,l)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:a,snapGrid:l,domNode:c}=t.getState();if(!c)return s;const{x:d,y:h}=c.getBoundingClientRect(),m={x:s.x-d,y:s.y-h};return sj(m,i,a,l)},flowToScreenPosition:s=>{const{transform:i,domNode:a}=t.getState();if(!a)return s;const{x:l,y:c}=a.getBoundingClientRect(),d=AW(s,i);return{x:d.x+l,y:d.y+c}},viewportInitialized:!0}:P7e,[e,n])};function s7(){const t=I7e(),e=ps(),n=b.useCallback(()=>e.getState().getNodes().map(w=>({...w})),[]),r=b.useCallback(w=>e.getState().nodeInternals.get(w),[]),s=b.useCallback(()=>{const{edges:w=[]}=e.getState();return w.map(S=>({...S}))},[]),i=b.useCallback(w=>{const{edges:S=[]}=e.getState();return S.find(k=>k.id===w)},[]),a=b.useCallback(w=>{const{getNodes:S,setNodes:k,hasDefaultNodes:j,onNodesChange:N}=e.getState(),T=S(),E=typeof w=="function"?w(T):w;if(j)k(E);else if(N){const _=E.length===0?T.map(A=>({type:"remove",id:A.id})):E.map(A=>({item:A,type:"reset"}));N(_)}},[]),l=b.useCallback(w=>{const{edges:S=[],setEdges:k,hasDefaultEdges:j,onEdgesChange:N}=e.getState(),T=typeof w=="function"?w(S):w;if(j)k(T);else if(N){const E=T.length===0?S.map(_=>({type:"remove",id:_.id})):T.map(_=>({item:_,type:"reset"}));N(E)}},[]),c=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{getNodes:k,setNodes:j,hasDefaultNodes:N,onNodesChange:T}=e.getState();if(N){const _=[...k(),...S];j(_)}else if(T){const E=S.map(_=>({item:_,type:"add"}));T(E)}},[]),d=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{edges:k=[],setEdges:j,hasDefaultEdges:N,onEdgesChange:T}=e.getState();if(N)j([...k,...S]);else if(T){const E=S.map(_=>({item:_,type:"add"}));T(E)}},[]),h=b.useCallback(()=>{const{getNodes:w,edges:S=[],transform:k}=e.getState(),[j,N,T]=k;return{nodes:w().map(E=>({...E})),edges:S.map(E=>({...E})),viewport:{x:j,y:N,zoom:T}}},[]),m=b.useCallback(({nodes:w,edges:S})=>{const{nodeInternals:k,getNodes:j,edges:N,hasDefaultNodes:T,hasDefaultEdges:E,onNodesDelete:_,onEdgesDelete:A,onNodesChange:L,onEdgesChange:P}=e.getState(),B=(w||[]).map(Q=>Q.id),$=(S||[]).map(Q=>Q.id),U=j().reduce((Q,F)=>{const Y=F.parentNode||F.parentId,J=!B.includes(F.id)&&Y&&Q.find(R=>R.id===Y);return(typeof F.deletable=="boolean"?F.deletable:!0)&&(B.includes(F.id)||J)&&Q.push(F),Q},[]),te=N.filter(Q=>typeof Q.deletable=="boolean"?Q.deletable:!0),z=te.filter(Q=>$.includes(Q.id));if(U||z){const Q=RW(U,te),F=[...z,...Q],Y=F.reduce((J,X)=>(J.includes(X.id)||J.push(X.id),J),[]);if((E||T)&&(E&&e.setState({edges:N.filter(J=>!Y.includes(J.id))}),T&&(U.forEach(J=>{k.delete(J.id)}),e.setState({nodeInternals:new Map(k)}))),Y.length>0&&(A?.(F),P&&P(Y.map(J=>({id:J,type:"remove"})))),U.length>0&&(_?.(U),L)){const J=U.map(X=>({id:X.id,type:"remove"}));L(J)}}},[]),g=b.useCallback(w=>{const S=r7e(w),k=S?null:e.getState().nodeInternals.get(w.id);return!S&&!k?[null,null,S]:[S?w:cD(k),k,S]},[]),x=b.useCallback((w,S=!0,k)=>{const[j,N,T]=g(w);return j?(k||e.getState().getNodes()).filter(E=>{if(!T&&(E.id===N.id||!E.positionAbsolute))return!1;const _=cD(E),A=ej(_,j);return S&&A>0||A>=j.width*j.height}):[]},[]),y=b.useCallback((w,S,k=!0)=>{const[j]=g(w);if(!j)return!1;const N=ej(j,S);return k&&N>0||N>=j.width*j.height},[]);return b.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:s,getEdge:i,setNodes:a,setEdges:l,addNodes:c,addEdges:d,toObject:h,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:y}),[t,n,r,s,i,a,l,c,d,h,m,x,y])}const L7e={actInsideInputWithModifier:!1};var B7e=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=ps(),{deleteElements:r}=s7(),s=kp(t,L7e),i=kp(e);b.useEffect(()=>{if(s){const{edges:a,getNodes:l}=n.getState(),c=l().filter(h=>h.selected),d=a.filter(h=>h.selected);r({nodes:c,edges:d}),n.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function F7e(t){const e=ps();b.useEffect(()=>{let n;const r=()=>{if(!t.current)return;const s=YN(t.current);(s.height===0||s.width===0)&&e.getState().onError?.("004",Gl.error004()),e.setState({width:s.width||500,height:s.height||500})};return r(),window.addEventListener("resize",r),t.current&&(n=new ResizeObserver(()=>r()),n.observe(t.current)),()=>{window.removeEventListener("resize",r),n&&t.current&&n.unobserve(t.current)}},[])}const i7={position:"absolute",width:"100%",height:"100%",top:0,left:0},q7e=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,V1=t=>({x:t.x,y:t.y,zoom:t.k}),hh=(t,e)=>t.target.closest(`.${e}`),yD=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),bD=t=>{const e=t.ctrlKey&&Ay()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},$7e=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),H7e=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:a=!1,panOnScrollSpeed:l=.5,panOnScrollMode:c=Wu.Free,zoomOnDoubleClick:d=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:g,translateExtent:x,minZoom:y,maxZoom:w,zoomActivationKeyCode:S,preventScrolling:k=!0,children:j,noWheelClassName:N,noPanClassName:T})=>{const E=b.useRef(),_=ps(),A=b.useRef(!1),L=b.useRef(!1),P=b.useRef(null),B=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:$,d3Selection:U,d3ZoomHandler:te,userSelectionActive:z}=hr($7e,ks),Q=kp(S),F=b.useRef(0),Y=b.useRef(!1),J=b.useRef();return F7e(P),b.useEffect(()=>{if(P.current){const X=P.current.getBoundingClientRect(),R=yW().scaleExtent([y,w]).translateExtent(x),ie=ma(P.current).call(R),G=Fl.translate(g.x,g.y).scale(gf(g.zoom,y,w)),I=[[0,0],[X.width,X.height]],V=R.constrain()(G,I,x);R.transform(ie,V),R.wheelDelta(bD),_.setState({d3Zoom:R,d3Selection:ie,d3ZoomHandler:ie.on("wheel.zoom"),transform:[V.x,V.y,V.k],domNode:P.current.closest(".react-flow")})}},[]),b.useEffect(()=>{U&&$&&(a&&!Q&&!z?U.on("wheel.zoom",X=>{if(hh(X,N))return!1;X.preventDefault(),X.stopImmediatePropagation();const R=U.property("__zoom").k||1;if(X.ctrlKey&&i){const se=Ha(X),re=bD(X),oe=R*Math.pow(2,re);$.scaleTo(U,oe,se,X);return}const ie=X.deltaMode===1?20:1;let G=c===Wu.Vertical?0:X.deltaX*ie,I=c===Wu.Horizontal?0:X.deltaY*ie;!Ay()&&X.shiftKey&&c!==Wu.Vertical&&(G=X.deltaY*ie,I=0),$.translateBy(U,-(G/R)*l,-(I/R)*l,{internal:!0});const V=V1(U.property("__zoom")),{onViewportChangeStart:ee,onViewportChange:ne,onViewportChangeEnd:W}=_.getState();clearTimeout(J.current),Y.current||(Y.current=!0,e?.(X,V),ee?.(V)),Y.current&&(t?.(X,V),ne?.(V),J.current=setTimeout(()=>{n?.(X,V),W?.(V),Y.current=!1},150))},{passive:!1}):typeof te<"u"&&U.on("wheel.zoom",function(X,R){if(!k&&X.type==="wheel"&&!X.ctrlKey||hh(X,N))return null;X.preventDefault(),te.call(this,X,R)},{passive:!1}))},[z,a,c,U,$,te,Q,i,k,N,e,t,n]),b.useEffect(()=>{$&&$.on("start",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;F.current=X.sourceEvent?.button;const{onViewportChangeStart:R}=_.getState(),ie=V1(X.transform);A.current=!0,B.current=ie,X.sourceEvent?.type==="mousedown"&&_.setState({paneDragging:!0}),R?.(ie),e?.(X.sourceEvent,ie)})},[$,e]),b.useEffect(()=>{$&&(z&&!A.current?$.on("zoom",null):z||$.on("zoom",X=>{const{onViewportChange:R}=_.getState();if(_.setState({transform:[X.transform.x,X.transform.y,X.transform.k]}),L.current=!!(r&&yD(m,F.current??0)),(t||R)&&!X.sourceEvent?.internal){const ie=V1(X.transform);R?.(ie),t?.(X.sourceEvent,ie)}}))},[z,$,t,m,r]),b.useEffect(()=>{$&&$.on("end",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;const{onViewportChangeEnd:R}=_.getState();if(A.current=!1,_.setState({paneDragging:!1}),r&&yD(m,F.current??0)&&!L.current&&r(X.sourceEvent),L.current=!1,(n||R)&&q7e(B.current,X.transform)){const ie=V1(X.transform);B.current=ie,clearTimeout(E.current),E.current=setTimeout(()=>{R?.(ie),n?.(X.sourceEvent,ie)},a?150:0)}})},[$,a,m,n,r]),b.useEffect(()=>{$&&$.filter(X=>{const R=Q||s,ie=i&&X.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&X.button===1&&X.type==="mousedown"&&(hh(X,"react-flow__node")||hh(X,"react-flow__edge")))return!0;if(!m&&!R&&!a&&!d&&!i||z||!d&&X.type==="dblclick"||hh(X,N)&&X.type==="wheel"||hh(X,T)&&(X.type!=="wheel"||a&&X.type==="wheel"&&!Q)||!i&&X.ctrlKey&&X.type==="wheel"||!R&&!a&&!ie&&X.type==="wheel"||!m&&(X.type==="mousedown"||X.type==="touchstart")||Array.isArray(m)&&!m.includes(X.button)&&X.type==="mousedown")return!1;const G=Array.isArray(m)&&m.includes(X.button)||!X.button||X.button<=1;return(!X.ctrlKey||X.type==="wheel")&&G})},[z,$,s,i,a,d,m,h,Q]),ae.createElement("div",{className:"react-flow__renderer",ref:P,style:i7},j)},Q7e=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function V7e(){const{userSelectionActive:t,userSelectionRect:e}=hr(Q7e,ks);return t&&e?ae.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function wD(t,e){const n=e.parentNode||e.parentId,r=t.find(s=>s.id===n);if(r){const s=e.position.x+e.width-r.width,i=e.position.y+e.height-r.height;if(s>0||i>0||e.position.x<0||e.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,s>0&&(r.style.width+=s),i>0&&(r.style.height+=i),e.position.x<0){const a=Math.abs(e.position.x);r.position.x=r.position.x-a,r.style.width+=a,e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);r.position.y=r.position.y-a,r.style.height+=a,e.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function YW(t,e){if(t.some(r=>r.type==="reset"))return t.filter(r=>r.type==="reset").map(r=>r.item);const n=t.filter(r=>r.type==="add").map(r=>r.item);return e.reduce((r,s)=>{const i=t.filter(l=>l.id===s.id);if(i.length===0)return r.push(s),r;const a={...s};for(const l of i)if(l)switch(l.type){case"select":{a.selected=l.selected;break}case"position":{typeof l.position<"u"&&(a.position=l.position),typeof l.positionAbsolute<"u"&&(a.positionAbsolute=l.positionAbsolute),typeof l.dragging<"u"&&(a.dragging=l.dragging),a.expandParent&&wD(r,a);break}case"dimensions":{typeof l.dimensions<"u"&&(a.width=l.dimensions.width,a.height=l.dimensions.height),typeof l.updateStyle<"u"&&(a.style={...a.style||{},...l.dimensions}),typeof l.resizing=="boolean"&&(a.resizing=l.resizing),a.expandParent&&wD(r,a);break}case"remove":return r}return r.push(a),r},n)}function KW(t,e){return YW(t,e)}function U7e(t,e){return YW(t,e)}const Pc=(t,e)=>({id:t,type:"select",selected:e});function Eh(t,e){return t.reduce((n,r)=>{const s=e.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(Pc(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(Pc(r.id,!1))),n},[])}const d5=(t,e)=>n=>{n.target===e.current&&t?.(n)},W7e=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),ZW=b.memo(({isSelecting:t,selectionMode:e=Sp.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:a,onPaneScroll:l,onPaneMouseEnter:c,onPaneMouseMove:d,onPaneMouseLeave:h,children:m})=>{const g=b.useRef(null),x=ps(),y=b.useRef(0),w=b.useRef(0),S=b.useRef(),{userSelectionActive:k,elementsSelectable:j,dragging:N}=hr(W7e,ks),T=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,w.current=0},E=te=>{i?.(te),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},_=te=>{if(Array.isArray(n)&&n?.includes(2)){te.preventDefault();return}a?.(te)},A=l?te=>l(te):void 0,L=te=>{const{resetSelectedElements:z,domNode:Q}=x.getState();if(S.current=Q?.getBoundingClientRect(),!j||!t||te.button!==0||te.target!==g.current||!S.current)return;const{x:F,y:Y}=Hc(te,S.current);z(),x.setState({userSelectionRect:{width:0,height:0,startX:F,startY:Y,x:F,y:Y}}),r?.(te)},P=te=>{const{userSelectionRect:z,nodeInternals:Q,edges:F,transform:Y,onNodesChange:J,onEdgesChange:X,nodeOrigin:R,getNodes:ie}=x.getState();if(!t||!S.current||!z)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=Hc(te,S.current),I=z.startX??0,V=z.startY??0,ee={...z,x:G.xoe.id),re=W.map(oe=>oe.id);if(y.current!==re.length){y.current=re.length;const oe=Eh(ne,re);oe.length&&J?.(oe)}if(w.current!==se.length){w.current=se.length;const oe=Eh(F,se);oe.length&&X?.(oe)}x.setState({userSelectionRect:ee})},B=te=>{if(te.button!==0)return;const{userSelectionRect:z}=x.getState();!k&&z&&te.target===g.current&&E?.(te),x.setState({nodesSelectionActive:y.current>0}),T(),s?.(te)},$=te=>{k&&(x.setState({nodesSelectionActive:y.current>0}),s?.(te)),T()},U=j&&(t||k);return ae.createElement("div",{className:Bs(["react-flow__pane",{dragging:N,selection:t}]),onClick:U?void 0:d5(E,g),onContextMenu:d5(_,g),onWheel:d5(A,g),onMouseEnter:U?void 0:c,onMouseDown:U?L:void 0,onMouseMove:U?P:d,onMouseUp:U?B:void 0,onMouseLeave:U?$:h,ref:g,style:i7},m,ae.createElement(V7e,null))});ZW.displayName="Pane";function JW(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const r=e.get(n);return r?r.selected?!0:JW(r,e):!1}function SD(t,e,n){let r=t;do{if(r?.matches(e))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function G7e(t,e,n,r){return Array.from(t.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!JW(s,t))&&(s.draggable||e&&typeof s.draggable>"u")).map(s=>({id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(s.positionAbsolute?.x??0),y:n.y-(s.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}))}function X7e(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function eG(t,e,n,r,s=[0,0],i){const a=X7e(t,t.extent||r);let l=a;const c=t.parentNode||t.parentId;if(t.extent==="parent"&&!t.expandParent)if(c&&t.width&&t.height){const m=n.get(c),{x:g,y:x}=td(m,s).positionAbsolute;l=m&&ka(g)&&ka(x)&&ka(m.width)&&ka(m.height)?[[g+t.width*s[0],x+t.height*s[1]],[g+m.width-t.width+t.width*s[0],x+m.height-t.height+t.height*s[1]]]:l}else i?.("005",Gl.error005()),l=a;else if(t.extent&&c&&t.extent!=="parent"){const m=n.get(c),{x:g,y:x}=td(m,s).positionAbsolute;l=[[t.extent[0][0]+g,t.extent[0][1]+x],[t.extent[1][0]+g,t.extent[1][1]+x]]}let d={x:0,y:0};if(c){const m=n.get(c);d=td(m,s).positionAbsolute}const h=l&&l!=="parent"?KN(e,l):e;return{position:{x:h.x-d.x,y:h.y-d.y},positionAbsolute:h}}function h5({nodeId:t,dragItems:e,nodeInternals:n}){const r=e.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[t?r.find(s=>s.id===t):r[0],r]}const kD=(t,e,n,r)=>{const s=e.querySelectorAll(t);if(!s||!s.length)return null;const i=Array.from(s),a=e.getBoundingClientRect(),l={x:a.width*r[0],y:a.height*r[1]};return i.map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(d.left-a.left-l.x)/n,y:(d.top-a.top-l.y)/n,...YN(c)}})};function s0(t,e,n){return n===void 0?n:r=>{const s=e().nodeInternals.get(t);s&&n(r,{...s})}}function aj({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeInternals:l,onError:c}=e.getState(),d=l.get(t);if(!d){c?.("012",Gl.error012(t));return}e.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):s([t])}function Y7e(){const t=ps();return b.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:i}=t.getState(),a=n.touches?n.touches[0].clientX:n.clientX,l=n.touches?n.touches[0].clientY:n.clientY,c={x:(a-r[0])/r[2],y:(l-r[1])/r[2]};return{xSnapped:i?s[0]*Math.round(c.x/s[0]):c.x,ySnapped:i?s[1]*Math.round(c.y/s[1]):c.y,...c}},[])}function f5(t){return(e,n,r)=>t?.(e,r)}function tG({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,selectNodesOnDrag:a}){const l=ps(),[c,d]=b.useState(!1),h=b.useRef([]),m=b.useRef({x:null,y:null}),g=b.useRef(0),x=b.useRef(null),y=b.useRef({x:0,y:0}),w=b.useRef(null),S=b.useRef(!1),k=b.useRef(!1),j=b.useRef(!1),N=Y7e();return b.useEffect(()=>{if(t?.current){const T=ma(t.current),E=({x:L,y:P})=>{const{nodeInternals:B,onNodeDrag:$,onSelectionDrag:U,updateNodePositions:te,nodeExtent:z,snapGrid:Q,snapToGrid:F,nodeOrigin:Y,onError:J}=l.getState();m.current={x:L,y:P};let X=!1,R={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&z){const G=tw(h.current,Y);R=wp(G)}if(h.current=h.current.map(G=>{const I={x:L-G.distance.x,y:P-G.distance.y};F&&(I.x=Q[0]*Math.round(I.x/Q[0]),I.y=Q[1]*Math.round(I.y/Q[1]));const V=[[z[0][0],z[0][1]],[z[1][0],z[1][1]]];h.current.length>1&&z&&!G.extent&&(V[0][0]=G.positionAbsolute.x-R.x+z[0][0],V[1][0]=G.positionAbsolute.x+(G.width??0)-R.x2+z[1][0],V[0][1]=G.positionAbsolute.y-R.y+z[0][1],V[1][1]=G.positionAbsolute.y+(G.height??0)-R.y2+z[1][1]);const ee=eG(G,I,B,V,Y,J);return X=X||G.position.x!==ee.position.x||G.position.y!==ee.position.y,G.position=ee.position,G.positionAbsolute=ee.positionAbsolute,G}),!X)return;te(h.current,!0,!0),d(!0);const ie=s?$:f5(U);if(ie&&w.current){const[G,I]=h5({nodeId:s,dragItems:h.current,nodeInternals:B});ie(w.current,G,I)}},_=()=>{if(!x.current)return;const[L,P]=wW(y.current,x.current);if(L!==0||P!==0){const{transform:B,panBy:$}=l.getState();m.current.x=(m.current.x??0)-L/B[2],m.current.y=(m.current.y??0)-P/B[2],$({x:L,y:P})&&E(m.current)}g.current=requestAnimationFrame(_)},A=L=>{const{nodeInternals:P,multiSelectionActive:B,nodesDraggable:$,unselectNodesAndEdges:U,onNodeDragStart:te,onSelectionDragStart:z}=l.getState();k.current=!0;const Q=s?te:f5(z);(!a||!i)&&!B&&s&&(P.get(s)?.selected||U()),s&&i&&a&&aj({id:s,store:l,nodeRef:t});const F=N(L);if(m.current=F,h.current=G7e(P,$,F,s),Q&&h.current){const[Y,J]=h5({nodeId:s,dragItems:h.current,nodeInternals:P});Q(L.sourceEvent,Y,J)}};if(e)T.on(".drag",null);else{const L=R6e().on("start",P=>{const{domNode:B,nodeDragThreshold:$}=l.getState();$===0&&A(P),j.current=!1;const U=N(P);m.current=U,x.current=B?.getBoundingClientRect()||null,y.current=Hc(P.sourceEvent,x.current)}).on("drag",P=>{const B=N(P),{autoPanOnNodeDrag:$,nodeDragThreshold:U}=l.getState();if(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1&&(j.current=!0),!j.current){if(!S.current&&k.current&&$&&(S.current=!0,_()),!k.current){const te=B.xSnapped-(m?.current?.x??0),z=B.ySnapped-(m?.current?.y??0);Math.sqrt(te*te+z*z)>U&&A(P)}(m.current.x!==B.xSnapped||m.current.y!==B.ySnapped)&&h.current&&k.current&&(w.current=P.sourceEvent,y.current=Hc(P.sourceEvent,x.current),E(B))}}).on("end",P=>{if(!(!k.current||j.current)&&(d(!1),S.current=!1,k.current=!1,cancelAnimationFrame(g.current),h.current)){const{updateNodePositions:B,nodeInternals:$,onNodeDragStop:U,onSelectionDragStop:te}=l.getState(),z=s?U:f5(te);if(B(h.current,!1,!1),z){const[Q,F]=h5({nodeId:s,dragItems:h.current,nodeInternals:$});z(P.sourceEvent,Q,F)}}}).filter(P=>{const B=P.target;return!P.button&&(!n||!SD(B,`.${n}`,t))&&(!r||SD(B,r,t))});return T.call(L),()=>{T.on(".drag",null)}}}},[t,e,n,r,i,l,s,a,N]),c}function nG(){const t=ps();return b.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:i,getNodes:a,snapToGrid:l,snapGrid:c,onError:d,nodesDraggable:h}=t.getState(),m=a().filter(j=>j.selected&&(j.draggable||h&&typeof j.draggable>"u")),g=l?c[0]:5,x=l?c[1]:5,y=n.isShiftPressed?4:1,w=n.x*g*y,S=n.y*x*y,k=m.map(j=>{if(j.positionAbsolute){const N={x:j.positionAbsolute.x+w,y:j.positionAbsolute.y+S};l&&(N.x=c[0]*Math.round(N.x/c[0]),N.y=c[1]*Math.round(N.y/c[1]));const{positionAbsolute:T,position:E}=eG(j,N,r,s,void 0,d);j.position=E,j.positionAbsolute=T}return j});i(k,!0,!1)},[])}const Qh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var i0=t=>{const e=({id:n,type:r,data:s,xPos:i,yPos:a,xPosOrigin:l,yPosOrigin:c,selected:d,onClick:h,onMouseEnter:m,onMouseMove:g,onMouseLeave:x,onContextMenu:y,onDoubleClick:w,style:S,className:k,isDraggable:j,isSelectable:N,isConnectable:T,isFocusable:E,selectNodesOnDrag:_,sourcePosition:A,targetPosition:L,hidden:P,resizeObserver:B,dragHandle:$,zIndex:U,isParent:te,noDragClassName:z,noPanClassName:Q,initialized:F,disableKeyboardA11y:Y,ariaLabel:J,rfId:X,hasHandleBounds:R})=>{const ie=ps(),G=b.useRef(null),I=b.useRef(null),V=b.useRef(A),ee=b.useRef(L),ne=b.useRef(r),W=N||j||h||m||g||x,se=nG(),re=s0(n,ie.getState,m),oe=s0(n,ie.getState,g),Te=s0(n,ie.getState,x),We=s0(n,ie.getState,y),Ye=s0(n,ie.getState,w),Je=Ue=>{const{nodeDragThreshold:He}=ie.getState();if(N&&(!_||!j||He>0)&&aj({id:n,store:ie,nodeRef:G}),h){const Ot=ie.getState().nodeInternals.get(n);Ot&&h(Ue,{...Ot})}},Oe=Ue=>{if(!tj(Ue)&&!Y)if(jW.includes(Ue.key)&&N){const He=Ue.key==="Escape";aj({id:n,store:ie,unselect:He,nodeRef:G})}else j&&d&&Object.prototype.hasOwnProperty.call(Qh,Ue.key)&&(ie.setState({ariaLiveMessage:`Moved selected node ${Ue.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),se({x:Qh[Ue.key].x,y:Qh[Ue.key].y,isShiftPressed:Ue.shiftKey}))};b.useEffect(()=>()=>{I.current&&(B?.unobserve(I.current),I.current=null)},[]),b.useEffect(()=>{if(G.current&&!P){const Ue=G.current;(!F||!R||I.current!==Ue)&&(I.current&&B?.unobserve(I.current),B?.observe(Ue),I.current=Ue)}},[P,F,R]),b.useEffect(()=>{const Ue=ne.current!==r,He=V.current!==A,Ot=ee.current!==L;G.current&&(Ue||He||Ot)&&(Ue&&(ne.current=r),He&&(V.current=A),Ot&&(ee.current=L),ie.getState().updateNodeDimensions([{id:n,nodeElement:G.current,forceUpdate:!0}]))},[n,r,A,L]);const Ve=tG({nodeRef:G,disabled:P||!j,noDragClassName:z,handleSelector:$,nodeId:n,isSelectable:N,selectNodesOnDrag:_});return P?null:ae.createElement("div",{className:Bs(["react-flow__node",`react-flow__node-${r}`,{[Q]:j},k,{selected:d,selectable:N,parent:te,dragging:Ve}]),ref:G,style:{zIndex:U,transform:`translate(${l}px,${c}px)`,pointerEvents:W?"all":"none",visibility:F?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:re,onMouseMove:oe,onMouseLeave:Te,onContextMenu:We,onClick:Je,onDoubleClick:Ye,onKeyDown:E?Oe:void 0,tabIndex:E?0:void 0,role:E?"button":void 0,"aria-describedby":Y?void 0:`${VW}-${X}`,"aria-label":J},ae.createElement(u7e,{value:n},ae.createElement(t,{id:n,data:s,type:r,xPos:i,yPos:a,selected:d,isConnectable:T,sourcePosition:A,targetPosition:L,dragging:Ve,dragHandle:$,zIndex:U})))};return e.displayName="NodeWrapper",b.memo(e)};const K7e=t=>{const e=t.getNodes().filter(n=>n.selected);return{...tw(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function Z7e({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=ps(),{width:s,height:i,x:a,y:l,transformString:c,userSelectionActive:d}=hr(K7e,ks),h=nG(),m=b.useRef(null);if(b.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]),tG({nodeRef:m}),d||!s||!i)return null;const g=t?y=>{const w=r.getState().getNodes().filter(S=>S.selected);t(y,w)}:void 0,x=y=>{Object.prototype.hasOwnProperty.call(Qh,y.key)&&h({x:Qh[y.key].x,y:Qh[y.key].y,isShiftPressed:y.shiftKey})};return ae.createElement("div",{className:Bs(["react-flow__nodesselection","react-flow__container",e]),style:{transform:c}},ae.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:s,height:i,top:l,left:a}}))}var J7e=b.memo(Z7e);const eCe=t=>t.nodesSelectionActive,rG=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,deleteKeyCode:l,onMove:c,onMoveStart:d,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:g,selectionMode:x,onSelectionStart:y,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:j,elementsSelectable:N,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:_,panOnScrollSpeed:A,panOnScrollMode:L,zoomOnDoubleClick:P,panOnDrag:B,defaultViewport:$,translateExtent:U,minZoom:te,maxZoom:z,preventScrolling:Q,onSelectionContextMenu:F,noWheelClassName:Y,noPanClassName:J,disableKeyboardA11y:X})=>{const R=hr(eCe),ie=kp(m),G=kp(k),I=G||B,V=G||_,ee=ie||g&&I!==!0;return B7e({deleteKeyCode:l,multiSelectionKeyCode:S}),ae.createElement(H7e,{onMove:c,onMoveStart:d,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:N,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:V,panOnScrollSpeed:A,panOnScrollMode:L,zoomOnDoubleClick:P,panOnDrag:!ie&&I,defaultViewport:$,translateExtent:U,minZoom:te,maxZoom:z,zoomActivationKeyCode:j,preventScrolling:Q,noWheelClassName:Y,noPanClassName:J},ae.createElement(ZW,{onSelectionStart:y,onSelectionEnd:w,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:I,isSelecting:!!ee,selectionMode:x},t,R&&ae.createElement(J7e,{onSelectionContextMenu:F,noPanClassName:J,disableKeyboardA11y:X})))};rG.displayName="FlowRenderer";var tCe=b.memo(rG);function nCe(t){return hr(b.useCallback(n=>t?MW(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function rCe(t){const e={input:i0(t.input||qW),default:i0(t.default||ij),output:i0(t.output||HW),group:i0(t.group||r7)},n={},r=Object.keys(t).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=i0(t[i]||ij),s),n);return{...e,...r}}const sCe=({x:t,y:e,width:n,height:r,origin:s})=>!n||!r?{x:t,y:e}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:t,y:e}:{x:t-n*s[0],y:e-r*s[1]},iCe=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),sG=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:i,onError:a}=hr(iCe,ks),l=nCe(t.onlyRenderVisibleElements),c=b.useRef(),d=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const g=m.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));i(g)});return c.current=h,h},[]);return b.useEffect(()=>()=>{c?.current?.disconnect()},[]),ae.createElement("div",{className:"react-flow__nodes",style:i7},l.map(h=>{let m=h.type||"default";t.nodeTypes[m]||(a?.("003",Gl.error003(m)),m="default");const g=t.nodeTypes[m]||t.nodeTypes.default,x=!!(h.draggable||e&&typeof h.draggable>"u"),y=!!(h.selectable||s&&typeof h.selectable>"u"),w=!!(h.connectable||n&&typeof h.connectable>"u"),S=!!(h.focusable||r&&typeof h.focusable>"u"),k=t.nodeExtent?KN(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,j=k?.x??0,N=k?.y??0,T=sCe({x:j,y:N,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return ae.createElement(g,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||wt.Bottom,targetPosition:h.targetPosition||wt.Top,hidden:h.hidden,xPos:j,yPos:N,xPosOrigin:T.x,yPosOrigin:T.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!h.selected,isDraggable:x,isSelectable:y,isConnectable:w,isFocusable:S,resizeObserver:d,dragHandle:h.dragHandle,zIndex:h[Lr]?.z??0,isParent:!!h[Lr]?.isParent,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!h[Lr]?.handleBounds})}))};sG.displayName="NodeRenderer";var aCe=b.memo(sG);const oCe=(t,e,n)=>n===wt.Left?t-e:n===wt.Right?t+e:t,lCe=(t,e,n)=>n===wt.Top?t-e:n===wt.Bottom?t+e:t,OD="react-flow__edgeupdater",jD=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:l})=>ae.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:Bs([OD,`${OD}-${l}`]),cx:oCe(e,r,t),cy:lCe(n,r,t),r,stroke:"transparent",fill:"transparent"}),cCe=()=>!0;var fh=t=>{const e=({id:n,className:r,type:s,data:i,onClick:a,onEdgeDoubleClick:l,selected:c,animated:d,label:h,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,style:S,source:k,target:j,sourceX:N,sourceY:T,targetX:E,targetY:_,sourcePosition:A,targetPosition:L,elementsSelectable:P,hidden:B,sourceHandleId:$,targetHandleId:U,onContextMenu:te,onMouseEnter:z,onMouseMove:Q,onMouseLeave:F,reconnectRadius:Y,onReconnect:J,onReconnectStart:X,onReconnectEnd:R,markerEnd:ie,markerStart:G,rfId:I,ariaLabel:V,isFocusable:ee,isReconnectable:ne,pathOptions:W,interactionWidth:se,disableKeyboardA11y:re})=>{const oe=b.useRef(null),[Te,We]=b.useState(!1),[Ye,Je]=b.useState(!1),Oe=ps(),Ve=b.useMemo(()=>`url('#${rj(G,I)}')`,[G,I]),Ue=b.useMemo(()=>`url('#${rj(ie,I)}')`,[ie,I]);if(B)return null;const He=Mt=>{const{edges:zn,addSelectedEdges:Fe,unselectNodesAndEdges:rt,multiSelectionActive:tn}=Oe.getState(),Rt=zn.find(ke=>ke.id===n);Rt&&(P&&(Oe.setState({nodesSelectionActive:!1}),Rt.selected&&tn?(rt({nodes:[],edges:[Rt]}),oe.current?.blur()):Fe([n])),a&&a(Mt,Rt))},Ot=r0(n,Oe.getState,l),xt=r0(n,Oe.getState,te),kn=r0(n,Oe.getState,z),It=r0(n,Oe.getState,Q),Yt=r0(n,Oe.getState,F),_t=(Mt,zn)=>{if(Mt.button!==0)return;const{edges:Fe,isValidConnection:rt}=Oe.getState(),tn=zn?j:k,Rt=(zn?U:$)||null,ke=zn?"target":"source",Pe=rt||cCe,it=zn,ot=Fe.find(pt=>pt.id===n);Je(!0),X?.(Mt,ot,ke);const nn=pt=>{Je(!1),R?.(pt,ot,ke)};IW({event:Mt,handleId:Rt,nodeId:tn,onConnect:pt=>J?.(ot,pt),isTarget:it,getState:Oe.getState,setState:Oe.setState,isValidConnection:Pe,edgeUpdaterType:ke,onReconnectEnd:nn})},mt=Mt=>_t(Mt,!0),Ne=Mt=>_t(Mt,!1),Ie=()=>We(!0),st=()=>We(!1),yt=!P&&!a,Pt=Mt=>{if(!re&&jW.includes(Mt.key)&&P){const{unselectNodesAndEdges:zn,addSelectedEdges:Fe,edges:rt}=Oe.getState();Mt.key==="Escape"?(oe.current?.blur(),zn({edges:[rt.find(Rt=>Rt.id===n)]})):Fe([n])}};return ae.createElement("g",{className:Bs(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:c,animated:d,inactive:yt,updating:Te}]),onClick:He,onDoubleClick:Ot,onContextMenu:xt,onMouseEnter:kn,onMouseMove:It,onMouseLeave:Yt,onKeyDown:ee?Pt:void 0,tabIndex:ee?0:void 0,role:ee?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":V===null?void 0:V||`Edge from ${k} to ${j}`,"aria-describedby":ee?`${UW}-${I}`:void 0,ref:oe},!Ye&&ae.createElement(t,{id:n,source:k,target:j,selected:c,animated:d,label:h,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,data:i,style:S,sourceX:N,sourceY:T,targetX:E,targetY:_,sourcePosition:A,targetPosition:L,sourceHandleId:$,targetHandleId:U,markerStart:Ve,markerEnd:Ue,pathOptions:W,interactionWidth:se}),ne&&ae.createElement(ae.Fragment,null,(ne==="source"||ne===!0)&&ae.createElement(jD,{position:A,centerX:N,centerY:T,radius:Y,onMouseDown:mt,onMouseEnter:Ie,onMouseOut:st,type:"source"}),(ne==="target"||ne===!0)&&ae.createElement(jD,{position:L,centerX:E,centerY:_,radius:Y,onMouseDown:Ne,onMouseEnter:Ie,onMouseOut:st,type:"target"})))};return e.displayName="EdgeWrapper",b.memo(e)};function uCe(t){const e={default:fh(t.default||Ry),straight:fh(t.bezier||e7),step:fh(t.step||JN),smoothstep:fh(t.step||ew),simplebezier:fh(t.simplebezier||ZN)},n={},r=Object.keys(t).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=fh(t[i]||Ry),s),n);return{...e,...r}}function ND(t,e,n=null){const r=(n?.x||0)+e.x,s=(n?.y||0)+e.y,i=n?.width||e.width,a=n?.height||e.height;switch(t){case wt.Top:return{x:r+i/2,y:s};case wt.Right:return{x:r+i,y:s+a/2};case wt.Bottom:return{x:r+i/2,y:s+a};case wt.Left:return{x:r,y:s+a/2}}}function CD(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const dCe=(t,e,n,r,s,i)=>{const a=ND(n,t,e),l=ND(i,r,s);return{sourceX:a.x,sourceY:a.y,targetX:l.x,targetY:l.y}};function hCe({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:i,width:a,height:l,transform:c}){const d={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+s),y2:Math.max(t.y+r,e.y+i)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const h=wp({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:a/c[2],height:l/c[2]}),m=Math.max(0,Math.min(h.x2,d.x2)-Math.max(h.x,d.x)),g=Math.max(0,Math.min(h.y2,d.y2)-Math.max(h.y,d.y));return Math.ceil(m*g)>0}function TD(t){const e=t?.[Lr]?.handleBounds||null,n=e&&t?.width&&t?.height&&typeof t?.positionAbsolute?.x<"u"&&typeof t?.positionAbsolute?.y<"u";return[{x:t?.positionAbsolute?.x||0,y:t?.positionAbsolute?.y||0,width:t?.width||0,height:t?.height||0},e,!!n]}const fCe=[{level:0,isMaxLevel:!0,edges:[]}];function mCe(t,e,n=!1){let r=-1;const s=t.reduce((a,l)=>{const c=ka(l.zIndex);let d=c?l.zIndex:0;if(n){const h=e.get(l.target),m=e.get(l.source),g=l.selected||h?.selected||m?.selected,x=Math.max(m?.[Lr]?.z||0,h?.[Lr]?.z||0,1e3);d=(c?l.zIndex:0)+(g?x:0)}return a[d]?a[d].push(l):a[d]=[l],r=d>r?d:r,a},{}),i=Object.entries(s).map(([a,l])=>{const c=+a;return{edges:l,level:c,isMaxLevel:c===r}});return i.length===0?fCe:i}function pCe(t,e,n){const r=hr(b.useCallback(s=>t?s.edges.filter(i=>{const a=e.get(i.source),l=e.get(i.target);return a?.width&&a?.height&&l?.width&&l?.height&&hCe({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:l.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:l.width,targetHeight:l.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[t,e]));return mCe(r,e,n)}const gCe=({color:t="none",strokeWidth:e=1})=>ae.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),xCe=({color:t="none",strokeWidth:e=1})=>ae.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),ED={[My.Arrow]:gCe,[My.ArrowClosed]:xCe};function vCe(t){const e=ps();return b.useMemo(()=>Object.prototype.hasOwnProperty.call(ED,t)?ED[t]:(e.getState().onError?.("009",Gl.error009(t)),null),[t])}const yCe=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=vCe(e);return c?ae.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0"},ae.createElement(c,{color:n,strokeWidth:a})):null},bCe=({defaultColor:t,rfId:e})=>n=>{const r=[];return n.edges.reduce((s,i)=>([i.markerStart,i.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const l=rj(a,e);r.includes(l)||(s.push({id:l,color:a.color||t,...a}),r.push(l))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},iG=({defaultColor:t,rfId:e})=>{const n=hr(b.useCallback(bCe({defaultColor:t,rfId:e}),[t,e]),(r,s)=>!(r.length!==s.length||r.some((i,a)=>i.id!==s[a].id)));return ae.createElement("defs",null,n.map(r=>ae.createElement(yCe,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};iG.displayName="MarkerDefinitions";var wCe=b.memo(iG);const SCe=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),aG=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:d,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,children:S,disableKeyboardA11y:k})=>{const{edgesFocusable:j,edgesUpdatable:N,elementsSelectable:T,width:E,height:_,connectionMode:A,nodeInternals:L,onError:P}=hr(SCe,ks),B=pCe(e,L,n);return E?ae.createElement(ae.Fragment,null,B.map(({level:$,edges:U,isMaxLevel:te})=>ae.createElement("svg",{key:$,style:{zIndex:$},width:E,height:_,className:"react-flow__edges react-flow__container"},te&&ae.createElement(wCe,{defaultColor:t,rfId:r}),ae.createElement("g",null,U.map(z=>{const[Q,F,Y]=TD(L.get(z.source)),[J,X,R]=TD(L.get(z.target));if(!Y||!R)return null;let ie=z.type||"default";s[ie]||(P?.("011",Gl.error011(ie)),ie="default");const G=s[ie]||s.default,I=A===pd.Strict?X.target:(X.target??[]).concat(X.source??[]),V=CD(F.source,z.sourceHandle),ee=CD(I,z.targetHandle),ne=V?.position||wt.Bottom,W=ee?.position||wt.Top,se=!!(z.focusable||j&&typeof z.focusable>"u"),re=z.reconnectable||z.updatable,oe=typeof g<"u"&&(re||N&&typeof re>"u");if(!V||!ee)return P?.("008",Gl.error008(V,z)),null;const{sourceX:Te,sourceY:We,targetX:Ye,targetY:Je}=dCe(Q,V,ne,J,ee,W);return ae.createElement(G,{key:z.id,id:z.id,className:Bs([z.className,i]),type:ie,data:z.data,selected:!!z.selected,animated:!!z.animated,hidden:!!z.hidden,label:z.label,labelStyle:z.labelStyle,labelShowBg:z.labelShowBg,labelBgStyle:z.labelBgStyle,labelBgPadding:z.labelBgPadding,labelBgBorderRadius:z.labelBgBorderRadius,style:z.style,source:z.source,target:z.target,sourceHandleId:z.sourceHandle,targetHandleId:z.targetHandle,markerEnd:z.markerEnd,markerStart:z.markerStart,sourceX:Te,sourceY:We,targetX:Ye,targetY:Je,sourcePosition:ne,targetPosition:W,elementsSelectable:T,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,onClick:h,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,rfId:r,ariaLabel:z.ariaLabel,isFocusable:se,isReconnectable:oe,pathOptions:"pathOptions"in z?z.pathOptions:void 0,interactionWidth:z.interactionWidth,disableKeyboardA11y:k})})))),S):null};aG.displayName="EdgeRenderer";var kCe=b.memo(aG);const OCe=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function jCe({children:t}){const e=hr(OCe);return ae.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function NCe(t){const e=s7(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const CCe={[wt.Left]:wt.Right,[wt.Right]:wt.Left,[wt.Top]:wt.Bottom,[wt.Bottom]:wt.Top},oG=({nodeId:t,handleType:e,style:n,type:r=Lc.Bezier,CustomComponent:s,connectionStatus:i})=>{const{fromNode:a,handleId:l,toX:c,toY:d,connectionMode:h}=hr(b.useCallback(_=>({fromNode:_.nodeInternals.get(t),handleId:_.connectionHandleId,toX:(_.connectionPosition.x-_.transform[0])/_.transform[2],toY:(_.connectionPosition.y-_.transform[1])/_.transform[2],connectionMode:_.connectionMode}),[t]),ks),m=a?.[Lr]?.handleBounds;let g=m?.[e];if(h===pd.Loose&&(g=g||m?.[e==="source"?"target":"source"]),!a||!g)return null;const x=l?g.find(_=>_.id===l):g[0],y=x?x.x+x.width/2:(a.width??0)/2,w=x?x.y+x.height/2:a.height??0,S=(a.positionAbsolute?.x??0)+y,k=(a.positionAbsolute?.y??0)+w,j=x?.position,N=j?CCe[j]:null;if(!j||!N)return null;if(s)return ae.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:x,fromX:S,fromY:k,toX:c,toY:d,fromPosition:j,toPosition:N,connectionStatus:i});let T="";const E={sourceX:S,sourceY:k,sourcePosition:j,targetX:c,targetY:d,targetPosition:N};return r===Lc.Bezier?[T]=_W(E):r===Lc.Step?[T]=nj({...E,borderRadius:0}):r===Lc.SmoothStep?[T]=nj(E):r===Lc.SimpleBezier?[T]=EW(E):T=`M${S},${k} ${c},${d}`,ae.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:n})};oG.displayName="ConnectionLine";const TCe=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function ECe({containerStyle:t,style:e,type:n,component:r}){const{nodeId:s,handleType:i,nodesConnectable:a,width:l,height:c,connectionStatus:d}=hr(TCe,ks);return!(s&&i&&l&&a)?null:ae.createElement("svg",{style:t,width:l,height:c,className:"react-flow__edges react-flow__connectionline react-flow__container"},ae.createElement("g",{className:Bs(["react-flow__connection",d])},ae.createElement(oG,{nodeId:s,handleType:i,style:e,type:n,CustomComponent:r,connectionStatus:d})))}function _D(t,e){return b.useRef(null),ps(),b.useMemo(()=>e(t),[t])}const lG=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:i,onNodeClick:a,onEdgeClick:l,onNodeDoubleClick:c,onEdgeDoubleClick:d,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,onSelectionContextMenu:y,onSelectionStart:w,onSelectionEnd:S,connectionLineType:k,connectionLineStyle:j,connectionLineComponent:N,connectionLineContainerStyle:T,selectionKeyCode:E,selectionOnDrag:_,selectionMode:A,multiSelectionKeyCode:L,panActivationKeyCode:P,zoomActivationKeyCode:B,deleteKeyCode:$,onlyRenderVisibleElements:U,elementsSelectable:te,selectNodesOnDrag:z,defaultViewport:Q,translateExtent:F,minZoom:Y,maxZoom:J,preventScrolling:X,defaultMarkerColor:R,zoomOnScroll:ie,zoomOnPinch:G,panOnScroll:I,panOnScrollSpeed:V,panOnScrollMode:ee,zoomOnDoubleClick:ne,panOnDrag:W,onPaneClick:se,onPaneMouseEnter:re,onPaneMouseMove:oe,onPaneMouseLeave:Te,onPaneScroll:We,onPaneContextMenu:Ye,onEdgeContextMenu:Je,onEdgeMouseEnter:Oe,onEdgeMouseMove:Ve,onEdgeMouseLeave:Ue,onReconnect:He,onReconnectStart:Ot,onReconnectEnd:xt,reconnectRadius:kn,noDragClassName:It,noWheelClassName:Yt,noPanClassName:_t,elevateEdgesOnSelect:mt,disableKeyboardA11y:Ne,nodeOrigin:Ie,nodeExtent:st,rfId:yt})=>{const Pt=_D(t,rCe),Mt=_D(e,uCe);return NCe(i),ae.createElement(tCe,{onPaneClick:se,onPaneMouseEnter:re,onPaneMouseMove:oe,onPaneMouseLeave:Te,onPaneContextMenu:Ye,onPaneScroll:We,deleteKeyCode:$,selectionKeyCode:E,selectionOnDrag:_,selectionMode:A,onSelectionStart:w,onSelectionEnd:S,multiSelectionKeyCode:L,panActivationKeyCode:P,zoomActivationKeyCode:B,elementsSelectable:te,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:ie,zoomOnPinch:G,zoomOnDoubleClick:ne,panOnScroll:I,panOnScrollSpeed:V,panOnScrollMode:ee,panOnDrag:W,defaultViewport:Q,translateExtent:F,minZoom:Y,maxZoom:J,onSelectionContextMenu:y,preventScrolling:X,noDragClassName:It,noWheelClassName:Yt,noPanClassName:_t,disableKeyboardA11y:Ne},ae.createElement(jCe,null,ae.createElement(kCe,{edgeTypes:Mt,onEdgeClick:l,onEdgeDoubleClick:d,onlyRenderVisibleElements:U,onEdgeContextMenu:Je,onEdgeMouseEnter:Oe,onEdgeMouseMove:Ve,onEdgeMouseLeave:Ue,onReconnect:He,onReconnectStart:Ot,onReconnectEnd:xt,reconnectRadius:kn,defaultMarkerColor:R,noPanClassName:_t,elevateEdgesOnSelect:!!mt,disableKeyboardA11y:Ne,rfId:yt},ae.createElement(ECe,{style:j,type:k,component:N,containerStyle:T})),ae.createElement("div",{className:"react-flow__edgelabel-renderer"}),ae.createElement(aCe,{nodeTypes:Pt,onNodeClick:a,onNodeDoubleClick:c,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,selectNodesOnDrag:z,onlyRenderVisibleElements:U,noPanClassName:_t,noDragClassName:It,disableKeyboardA11y:Ne,nodeOrigin:Ie,nodeExtent:st,rfId:yt})))};lG.displayName="GraphView";var _Ce=b.memo(lG);const oj=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ec={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:oj,nodeExtent:oj,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:pd.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:s7e,isValidConnection:void 0},ACe=()=>VOe((t,e)=>({...Ec,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:i}=e();t({nodeInternals:u5(n,r,s,i)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=e();t({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",i=typeof r<"u",a=s?u5(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:i?r:[],hasDefaultNodes:s,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:i,fitViewOnInitDone:a,fitViewOnInitOptions:l,domNode:c,nodeOrigin:d}=e(),h=c?.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{m22:g}=new window.DOMMatrixReadOnly(m.transform),x=n.reduce((w,S)=>{const k=s.get(S.id);if(k?.hidden)s.set(k.id,{...k,[Lr]:{...k[Lr],handleBounds:void 0}});else if(k){const j=YN(S.nodeElement);!!(j.width&&j.height&&(k.width!==j.width||k.height!==j.height||S.forceUpdate))&&(s.set(k.id,{...k,[Lr]:{...k[Lr],handleBounds:{source:kD(".source",S.nodeElement,g,d),target:kD(".target",S.nodeElement,g,d)}},...j}),w.push({id:k.id,type:"dimensions",dimensions:j}))}return w},[]);GW(s,d);const y=a||i&&!a&&XW(e,{initial:!0,...l});t({nodeInternals:new Map(s),fitViewOnInitDone:y}),x?.length>0&&r?.(x)},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:i}=e(),a=n.map(l=>{const c={id:l.id,type:"position",dragging:s};return r&&(c.positionAbsolute=l.positionAbsolute,c.position=l.position),c});i(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:a,getNodes:l,elevateNodesOnSelect:c}=e();if(n?.length){if(i){const d=KW(n,l()),h=u5(d,s,a,c);t({nodeInternals:h})}r?.(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,l=null;r?a=n.map(c=>Pc(c,!0)):(a=Eh(i(),n),l=Eh(s,[])),Q1({changedNodes:a,changedEdges:l,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,l=null;r?a=n.map(c=>Pc(c,!0)):(a=Eh(s,n),l=Eh(i(),[])),Q1({changedNodes:l,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:i}=e(),a=n||i(),l=r||s,c=a.map(h=>(h.selected=!1,Pc(h.id,!1))),d=l.map(h=>Pc(h.id,!1));Q1({changedNodes:c,changedEdges:d,get:e,set:t})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=e();r?.scaleExtent([n,s]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=e();r?.scaleExtent([s,n]),t({maxZoom:n})},setTranslateExtent:n=>{e().d3Zoom?.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=e(),i=r().filter(l=>l.selected).map(l=>Pc(l.id,!1)),a=n.filter(l=>l.selected).map(l=>Pc(l.id,!1));Q1({changedNodes:i,changedEdges:a,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(s=>{s.positionAbsolute=KN(s.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:i,d3Zoom:a,d3Selection:l,translateExtent:c}=e();if(!a||!l||!n.x&&!n.y)return!1;const d=Fl.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),h=[[0,0],[s,i]],m=a?.constrain()(d,h,c);return a.transform(l,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>t({connectionNodeId:Ec.connectionNodeId,connectionHandleId:Ec.connectionHandleId,connectionHandleType:Ec.connectionHandleType,connectionStatus:Ec.connectionStatus,connectionStartHandle:Ec.connectionStartHandle,connectionEndHandle:Ec.connectionEndHandle}),reset:()=>t({...Ec})}),Object.is),cG=({children:t})=>{const e=b.useRef(null);return e.current||(e.current=ACe()),ae.createElement(KNe,{value:e.current},t)};cG.displayName="ReactFlowProvider";const uG=({children:t})=>b.useContext(Zb)?ae.createElement(ae.Fragment,null,t):ae.createElement(cG,null,t);uG.displayName="ReactFlowWrapper";const MCe={input:qW,default:ij,output:HW,group:r7},RCe={default:Ry,straight:e7,step:JN,smoothstep:ew,simplebezier:ZN},DCe=[0,0],PCe=[15,15],zCe={x:0,y:0,zoom:1},ICe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},dG=b.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i=MCe,edgeTypes:a=RCe,onNodeClick:l,onEdgeClick:c,onInit:d,onMove:h,onMoveStart:m,onMoveEnd:g,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,onNodeMouseEnter:j,onNodeMouseMove:N,onNodeMouseLeave:T,onNodeContextMenu:E,onNodeDoubleClick:_,onNodeDragStart:A,onNodeDrag:L,onNodeDragStop:P,onNodesDelete:B,onEdgesDelete:$,onSelectionChange:U,onSelectionDragStart:te,onSelectionDrag:z,onSelectionDragStop:Q,onSelectionContextMenu:F,onSelectionStart:Y,onSelectionEnd:J,connectionMode:X=pd.Strict,connectionLineType:R=Lc.Bezier,connectionLineStyle:ie,connectionLineComponent:G,connectionLineContainerStyle:I,deleteKeyCode:V="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:ne=!1,selectionMode:W=Sp.Full,panActivationKeyCode:se="Space",multiSelectionKeyCode:re=Ay()?"Meta":"Control",zoomActivationKeyCode:oe=Ay()?"Meta":"Control",snapToGrid:Te=!1,snapGrid:We=PCe,onlyRenderVisibleElements:Ye=!1,selectNodesOnDrag:Je=!0,nodesDraggable:Oe,nodesConnectable:Ve,nodesFocusable:Ue,nodeOrigin:He=DCe,edgesFocusable:Ot,edgesUpdatable:xt,elementsSelectable:kn,defaultViewport:It=zCe,minZoom:Yt=.5,maxZoom:_t=2,translateExtent:mt=oj,preventScrolling:Ne=!0,nodeExtent:Ie,defaultMarkerColor:st="#b1b1b7",zoomOnScroll:yt=!0,zoomOnPinch:Pt=!0,panOnScroll:Mt=!1,panOnScrollSpeed:zn=.5,panOnScrollMode:Fe=Wu.Free,zoomOnDoubleClick:rt=!0,panOnDrag:tn=!0,onPaneClick:Rt,onPaneMouseEnter:ke,onPaneMouseMove:Pe,onPaneMouseLeave:it,onPaneScroll:ot,onPaneContextMenu:nn,children:Kt,onEdgeContextMenu:pt,onEdgeDoubleClick:xr,onEdgeMouseEnter:Ur,onEdgeMouseMove:Wr,onEdgeMouseLeave:vr,onEdgeUpdate:In,onEdgeUpdateStart:cr,onEdgeUpdateEnd:nr,onReconnect:gs,onReconnectStart:xs,onReconnectEnd:js,reconnectRadius:ge=10,edgeUpdaterRadius:Le=10,onNodesChange:Ct,onEdgesChange:vn,noDragClassName:Fr="nodrag",noWheelClassName:Cr="nowheel",noPanClassName:Tr="nopan",fitView:Ns=!1,fitViewOptions:Qf,connectOnClick:lw=!0,attributionPosition:cw,proOptions:Eg,defaultEdgeOptions:mu,elevateNodesOnSelect:Vf=!0,elevateEdgesOnSelect:ec=!1,disableKeyboardA11y:Yo=!1,autoPanOnConnect:pu=!0,autoPanOnNodeDrag:tc=!0,connectionRadius:Gr=20,isValidConnection:_g,onError:Ag,style:Ko,id:Zo,nodeDragThreshold:uw,...Mg},Rg)=>{const Uf=Zo||"1";return ae.createElement("div",{...Mg,style:{...Ko,...ICe},ref:Rg,className:Bs(["react-flow",s]),"data-testid":"rf__wrapper",id:Zo},ae.createElement(uG,null,ae.createElement(_Ce,{onInit:d,onMove:h,onMoveStart:m,onMoveEnd:g,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:j,onNodeMouseMove:N,onNodeMouseLeave:T,onNodeContextMenu:E,onNodeDoubleClick:_,nodeTypes:i,edgeTypes:a,connectionLineType:R,connectionLineStyle:ie,connectionLineComponent:G,connectionLineContainerStyle:I,selectionKeyCode:ee,selectionOnDrag:ne,selectionMode:W,deleteKeyCode:V,multiSelectionKeyCode:re,panActivationKeyCode:se,zoomActivationKeyCode:oe,onlyRenderVisibleElements:Ye,selectNodesOnDrag:Je,defaultViewport:It,translateExtent:mt,minZoom:Yt,maxZoom:_t,preventScrolling:Ne,zoomOnScroll:yt,zoomOnPinch:Pt,zoomOnDoubleClick:rt,panOnScroll:Mt,panOnScrollSpeed:zn,panOnScrollMode:Fe,panOnDrag:tn,onPaneClick:Rt,onPaneMouseEnter:ke,onPaneMouseMove:Pe,onPaneMouseLeave:it,onPaneScroll:ot,onPaneContextMenu:nn,onSelectionContextMenu:F,onSelectionStart:Y,onSelectionEnd:J,onEdgeContextMenu:pt,onEdgeDoubleClick:xr,onEdgeMouseEnter:Ur,onEdgeMouseMove:Wr,onEdgeMouseLeave:vr,onReconnect:gs??In,onReconnectStart:xs??cr,onReconnectEnd:js??nr,reconnectRadius:ge??Le,defaultMarkerColor:st,noDragClassName:Fr,noWheelClassName:Cr,noPanClassName:Tr,elevateEdgesOnSelect:ec,rfId:Uf,disableKeyboardA11y:Yo,nodeOrigin:He,nodeExtent:Ie}),ae.createElement(C7e,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,nodesDraggable:Oe,nodesConnectable:Ve,nodesFocusable:Ue,edgesFocusable:Ot,edgesUpdatable:xt,elementsSelectable:kn,elevateNodesOnSelect:Vf,minZoom:Yt,maxZoom:_t,nodeExtent:Ie,onNodesChange:Ct,onEdgesChange:vn,snapToGrid:Te,snapGrid:We,connectionMode:X,translateExtent:mt,connectOnClick:lw,defaultEdgeOptions:mu,fitView:Ns,fitViewOptions:Qf,onNodesDelete:B,onEdgesDelete:$,onNodeDragStart:A,onNodeDrag:L,onNodeDragStop:P,onSelectionDrag:z,onSelectionDragStart:te,onSelectionDragStop:Q,noPanClassName:Tr,nodeOrigin:He,rfId:Uf,autoPanOnConnect:pu,autoPanOnNodeDrag:tc,onError:Ag,connectionRadius:Gr,isValidConnection:_g,nodeDragThreshold:uw}),ae.createElement(j7e,{onSelectionChange:U}),Kt,ae.createElement(JNe,{proOptions:Eg,position:cw}),ae.createElement(M7e,{rfId:Uf,disableKeyboardA11y:Yo})))});dG.displayName="ReactFlow";function hG(t){return e=>{const[n,r]=b.useState(e),s=b.useCallback(i=>r(a=>t(i,a)),[]);return[n,r,s]}}const LCe=hG(KW),BCe=hG(U7e),fG=({id:t,x:e,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:d,borderRadius:h,shapeRendering:m,onClick:g,selected:x})=>{const{background:y,backgroundColor:w}=i||{},S=a||y||w;return ae.createElement("rect",{className:Bs(["react-flow__minimap-node",{selected:x},d]),x:e,y:n,rx:h,ry:h,width:r,height:s,fill:S,stroke:l,strokeWidth:c,shapeRendering:m,onClick:g?k=>g(k,t):void 0})};fG.displayName="MiniMapNode";var FCe=b.memo(fG);const qCe=t=>t.nodeOrigin,$Ce=t=>t.getNodes().filter(e=>!e.hidden&&e.width&&e.height),m5=t=>t instanceof Function?t:()=>t;function HCe({nodeStrokeColor:t="transparent",nodeColor:e="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:i=FCe,onClick:a}){const l=hr($Ce,ks),c=hr(qCe),d=m5(e),h=m5(t),m=m5(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ae.createElement(ae.Fragment,null,l.map(x=>{const{x:y,y:w}=td(x,c).positionAbsolute;return ae.createElement(i,{key:x.id,x:y,y:w,width:x.width,height:x.height,style:x.style,selected:x.selected,className:m(x),color:d(x),borderRadius:r,strokeColor:h(x),strokeWidth:s,shapeRendering:g,onClick:a,id:x.id})}))}var QCe=b.memo(HCe);const VCe=200,UCe=150,WCe=t=>{const e=t.getNodes(),n={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:n,boundingRect:e.length>0?n7e(tw(e,t.nodeOrigin),n):n,rfId:t.rfId}},GCe="react-flow__minimap-desc";function mG({style:t,className:e,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a=2,nodeComponent:l,maskColor:c="rgb(240, 240, 240, 0.6)",maskStrokeColor:d="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:w=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:j=10,offsetScale:N=5}){const T=ps(),E=b.useRef(null),{boundingRect:_,viewBB:A,rfId:L}=hr(WCe,ks),P=t?.width??VCe,B=t?.height??UCe,$=_.width/P,U=_.height/B,te=Math.max($,U),z=te*P,Q=te*B,F=N*te,Y=_.x-(z-_.width)/2-F,J=_.y-(Q-_.height)/2-F,X=z+F*2,R=Q+F*2,ie=`${GCe}-${L}`,G=b.useRef(0);G.current=te,b.useEffect(()=>{if(E.current){const ee=ma(E.current),ne=re=>{const{transform:oe,d3Selection:Te,d3Zoom:We}=T.getState();if(re.sourceEvent.type!=="wheel"||!Te||!We)return;const Ye=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*j,Je=oe[2]*Math.pow(2,Ye);We.scaleTo(Te,Je)},W=re=>{const{transform:oe,d3Selection:Te,d3Zoom:We,translateExtent:Ye,width:Je,height:Oe}=T.getState();if(re.sourceEvent.type!=="mousemove"||!Te||!We)return;const Ve=G.current*Math.max(1,oe[2])*(k?-1:1),Ue={x:oe[0]-re.sourceEvent.movementX*Ve,y:oe[1]-re.sourceEvent.movementY*Ve},He=[[0,0],[Je,Oe]],Ot=Fl.translate(Ue.x,Ue.y).scale(oe[2]),xt=We.constrain()(Ot,He,Ye);We.transform(Te,xt)},se=yW().on("zoom",y?W:null).on("zoom.wheel",w?ne:null);return ee.call(se),()=>{ee.on("zoom",null)}}},[y,w,k,j]);const I=g?ee=>{const ne=Ha(ee);g(ee,{x:ne[0],y:ne[1]})}:void 0,V=x?(ee,ne)=>{const W=T.getState().nodeInternals.get(ne);x(ee,W)}:void 0;return ae.createElement(Jb,{position:m,style:t,className:Bs(["react-flow__minimap",e]),"data-testid":"rf__minimap"},ae.createElement("svg",{width:P,height:B,viewBox:`${Y} ${J} ${X} ${R}`,role:"img","aria-labelledby":ie,ref:E,onClick:I},S&&ae.createElement("title",{id:ie},S),ae.createElement(QCe,{onClick:V,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),ae.createElement("path",{className:"react-flow__minimap-mask",d:`M${Y-F},${J-F}h${X+F*2}v${R+F*2}h${-X-F*2}z - M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:c,fillRule:"evenodd",stroke:d,strokeWidth:h,pointerEvents:"none"})))}mG.displayName="MiniMap";var XCe=b.memo(mG);function YCe(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ae.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function KCe(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ae.createElement("path",{d:"M0 0h32v4.2H0z"}))}function ZCe(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ae.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function JCe(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ae.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function e8e(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ae.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const p0=({children:t,className:e,...n})=>ae.createElement("button",{type:"button",className:Bs(["react-flow__controls-button",e]),...n},t);p0.displayName="ControlButton";const t8e=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),pG=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:d,children:h,position:m="bottom-left"})=>{const g=ps(),[x,y]=b.useState(!1),{isInteractive:w,minZoomReached:S,maxZoomReached:k}=hr(t8e,ks),{zoomIn:j,zoomOut:N,fitView:T}=s7();if(b.useEffect(()=>{y(!0)},[]),!x)return null;const E=()=>{j(),i?.()},_=()=>{N(),a?.()},A=()=>{T(s),l?.()},L=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),c?.(!w)};return ae.createElement(Jb,{className:Bs(["react-flow__controls",d]),position:m,style:t,"data-testid":"rf__controls"},e&&ae.createElement(ae.Fragment,null,ae.createElement(p0,{onClick:E,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},ae.createElement(YCe,null)),ae.createElement(p0,{onClick:_,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},ae.createElement(KCe,null))),n&&ae.createElement(p0,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},ae.createElement(ZCe,null)),r&&ae.createElement(p0,{className:"react-flow__controls-interactive",onClick:L,title:"toggle interactivity","aria-label":"toggle interactivity"},w?ae.createElement(e8e,null):ae.createElement(JCe,null)),h)};pG.displayName="Controls";var n8e=b.memo(pG),Ca;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Ca||(Ca={}));function r8e({color:t,dimensions:e,lineWidth:n}){return ae.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function s8e({color:t,radius:e}){return ae.createElement("circle",{cx:e,cy:e,r:e,fill:t})}const i8e={[Ca.Dots]:"#91919a",[Ca.Lines]:"#eee",[Ca.Cross]:"#e2e2e2"},a8e={[Ca.Dots]:1,[Ca.Lines]:1,[Ca.Cross]:6},o8e=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function gG({id:t,variant:e=Ca.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=2,color:a,style:l,className:c}){const d=b.useRef(null),{transform:h,patternId:m}=hr(o8e,ks),g=a||i8e[e],x=r||a8e[e],y=e===Ca.Dots,w=e===Ca.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*h[2]||1,S[1]*h[2]||1],j=x*h[2],N=w?[j,j]:k,T=y?[j/i,j/i]:[N[0]/i,N[1]/i];return ae.createElement("svg",{className:Bs(["react-flow__background",c]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},ae.createElement("pattern",{id:m+t,x:h[0]%k[0],y:h[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},y?ae.createElement(s8e,{color:g,radius:j/i}):ae.createElement(r8e,{dimensions:N,color:g,lineWidth:s})),ae.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+t})`}))}gG.displayName="Background";var l8e=b.memo(gG);function a7(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var p5,AD;function c8e(){if(AD)return p5;AD=1;var t=qz(),e=4;function n(r){return t(r,e)}return p5=n,p5}var g5,MD;function xG(){if(MD)return g5;MD=1;var t=FJ();function e(n){return typeof n=="function"?n:t}return g5=e,g5}var x5,RD;function vG(){if(RD)return x5;RD=1;var t=$z(),e=pj(),n=xG(),r=xd();function s(i,a){var l=r(i)?t:e;return l(i,n(a))}return x5=s,x5}var v5,DD;function yG(){return DD||(DD=1,v5=vG()),v5}var y5,PD;function u8e(){if(PD)return y5;PD=1;var t=pj();function e(n,r){var s=[];return t(n,function(i,a,l){r(i,a,l)&&s.push(i)}),s}return y5=e,y5}var b5,zD;function bG(){if(zD)return b5;zD=1;var t=qJ(),e=u8e(),n=gj(),r=xd();function s(i,a){var l=r(i)?t:e;return l(i,n(a,3))}return b5=s,b5}var w5,ID;function d8e(){if(ID)return w5;ID=1;var t=Object.prototype,e=t.hasOwnProperty;function n(r,s){return r!=null&&e.call(r,s)}return w5=n,w5}var S5,LD;function wG(){if(LD)return S5;LD=1;var t=d8e(),e=$J();function n(r,s){return r!=null&&e(r,s,t)}return S5=n,S5}var k5,BD;function h8e(){if(BD)return k5;BD=1;var t=Hz(),e=Qz(),n=Vz(),r=xd(),s=xj(),i=vj(),a=HJ(),l=yj(),c="[object Map]",d="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function g(x){if(x==null)return!0;if(s(x)&&(r(x)||typeof x=="string"||typeof x.splice=="function"||i(x)||l(x)||n(x)))return!x.length;var y=e(x);if(y==c||y==d)return!x.size;if(a(x))return!t(x).length;for(var w in x)if(m.call(x,w))return!1;return!0}return k5=g,k5}var O5,FD;function SG(){if(FD)return O5;FD=1;function t(e){return e===void 0}return O5=t,O5}var j5,qD;function f8e(){if(qD)return j5;qD=1;function t(e,n,r,s){var i=-1,a=e==null?0:e.length;for(s&&a&&(r=e[++i]);++i1?x.setNode(y,m):x.setNode(y)}),this},s.prototype.setNode=function(h,m){return t.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},s.prototype.node=function(h){return this._nodes[h]},s.prototype.hasNode=function(h){return t.has(this._nodes,h)},s.prototype.removeNode=function(h){var m=this;if(t.has(this._nodes,h)){var g=function(x){m.removeEdge(m._edgeObjs[x])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],t.each(this.children(h),function(x){m.setParent(x)}),delete this._children[h]),t.each(t.keys(this._in[h]),g),delete this._in[h],delete this._preds[h],t.each(t.keys(this._out[h]),g),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},s.prototype.setParent=function(h,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(m))m=n;else{m+="";for(var g=m;!t.isUndefined(g);g=this.parent(g))if(g===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},s.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},s.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},s.prototype.children=function(h){if(t.isUndefined(h)&&(h=n),this._isCompound){var m=this._children[h];if(m)return t.keys(m)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},s.prototype.predecessors=function(h){var m=this._preds[h];if(m)return t.keys(m)},s.prototype.successors=function(h){var m=this._sucs[h];if(m)return t.keys(m)},s.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return t.union(m,this.successors(h))},s.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},s.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var g=this;t.each(this._nodes,function(w,S){h(S)&&m.setNode(S,w)}),t.each(this._edgeObjs,function(w){m.hasNode(w.v)&&m.hasNode(w.w)&&m.setEdge(w,g.edge(w))});var x={};function y(w){var S=g.parent(w);return S===void 0||m.hasNode(S)?(x[w]=S,S):S in x?x[S]:y(S)}return this._isCompound&&t.each(m.nodes(),function(w){m.setParent(w,y(w))}),m},s.prototype.setDefaultEdgeLabel=function(h){return t.isFunction(h)||(h=t.constant(h)),this._defaultEdgeLabelFn=h,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return t.values(this._edgeObjs)},s.prototype.setPath=function(h,m){var g=this,x=arguments;return t.reduce(h,function(y,w){return x.length>1?g.setEdge(y,w,m):g.setEdge(y,w),w}),this},s.prototype.setEdge=function(){var h,m,g,x,y=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(h=w.v,m=w.w,g=w.name,arguments.length===2&&(x=arguments[1],y=!0)):(h=w,m=arguments[1],g=arguments[3],arguments.length>2&&(x=arguments[2],y=!0)),h=""+h,m=""+m,t.isUndefined(g)||(g=""+g);var S=l(this._isDirected,h,m,g);if(t.has(this._edgeLabels,S))return y&&(this._edgeLabels[S]=x),this;if(!t.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[S]=y?x:this._defaultEdgeLabelFn(h,m,g);var k=c(this._isDirected,h,m,g);return h=k.v,m=k.w,Object.freeze(k),this._edgeObjs[S]=k,i(this._preds[m],h),i(this._sucs[h],m),this._in[m][S]=k,this._out[h][S]=k,this._edgeCount++,this},s.prototype.edge=function(h,m,g){var x=arguments.length===1?d(this._isDirected,arguments[0]):l(this._isDirected,h,m,g);return this._edgeLabels[x]},s.prototype.hasEdge=function(h,m,g){var x=arguments.length===1?d(this._isDirected,arguments[0]):l(this._isDirected,h,m,g);return t.has(this._edgeLabels,x)},s.prototype.removeEdge=function(h,m,g){var x=arguments.length===1?d(this._isDirected,arguments[0]):l(this._isDirected,h,m,g),y=this._edgeObjs[x];return y&&(h=y.v,m=y.w,delete this._edgeLabels[x],delete this._edgeObjs[x],a(this._preds[m],h),a(this._sucs[h],m),delete this._in[m][x],delete this._out[h][x],this._edgeCount--),this},s.prototype.inEdges=function(h,m){var g=this._in[h];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.v===m}):x}},s.prototype.outEdges=function(h,m){var g=this._out[h];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.w===m}):x}},s.prototype.nodeEdges=function(h,m){var g=this.inEdges(h,m);if(g)return g.concat(this.outEdges(h,m))};function i(h,m){h[m]?h[m]++:h[m]=1}function a(h,m){--h[m]||delete h[m]}function l(h,m,g,x){var y=""+m,w=""+g;if(!h&&y>w){var S=y;y=w,w=S}return y+r+w+r+(t.isUndefined(x)?e:x)}function c(h,m,g,x){var y=""+m,w=""+g;if(!h&&y>w){var S=y;y=w,w=S}var k={v:y,w};return x&&(k.name=x),k}function d(h,m){return l(h,m.v,m.w,m.name)}return L5}var B5,tP;function S8e(){return tP||(tP=1,B5="2.1.8"),B5}var F5,nP;function k8e(){return nP||(nP=1,F5={Graph:o7(),version:S8e()}),F5}var q5,rP;function O8e(){if(rP)return q5;rP=1;var t=za(),e=o7();q5={write:n,read:i};function n(a){var l={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:r(a),edges:s(a)};return t.isUndefined(a.graph())||(l.value=t.clone(a.graph())),l}function r(a){return t.map(a.nodes(),function(l){var c=a.node(l),d=a.parent(l),h={v:l};return t.isUndefined(c)||(h.value=c),t.isUndefined(d)||(h.parent=d),h})}function s(a){return t.map(a.edges(),function(l){var c=a.edge(l),d={v:l.v,w:l.w};return t.isUndefined(l.name)||(d.name=l.name),t.isUndefined(c)||(d.value=c),d})}function i(a){var l=new e(a.options).setGraph(a.value);return t.each(a.nodes,function(c){l.setNode(c.v,c.value),c.parent&&l.setParent(c.v,c.parent)}),t.each(a.edges,function(c){l.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),l}return q5}var $5,sP;function j8e(){if(sP)return $5;sP=1;var t=za();$5=e;function e(n){var r={},s=[],i;function a(l){t.has(r,l)||(r[l]=!0,i.push(l),t.each(n.successors(l),a),t.each(n.predecessors(l),a))}return t.each(n.nodes(),function(l){i=[],a(l),i.length&&s.push(i)}),s}return $5}var H5,iP;function NG(){if(iP)return H5;iP=1;var t=za();H5=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(n){return n.key})},e.prototype.has=function(n){return t.has(this._keyIndices,n)},e.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(n,r){var s=this._keyIndices;if(n=String(n),!t.has(s,n)){var i=this._arr,a=i.length;return s[n]=a,i.push({key:n,priority:r}),this._decrease(a),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},e.prototype.decrease=function(n,r){var s=this._keyIndices[n];if(r>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[s].priority+" New: "+r);this._arr[s].priority=r,this._decrease(s)},e.prototype._heapify=function(n){var r=this._arr,s=2*n,i=s+1,a=n;s>1,!(r[i].priority0&&(m=h.removeMin(),g=d[m],g.distance!==Number.POSITIVE_INFINITY);)c(m).forEach(x);return d}return Q5}var V5,oP;function N8e(){if(oP)return V5;oP=1;var t=CG(),e=za();V5=n;function n(r,s,i){return e.transform(r.nodes(),function(a,l){a[l]=t(r,l,s,i)},{})}return V5}var U5,lP;function TG(){if(lP)return U5;lP=1;var t=za();U5=e;function e(n){var r=0,s=[],i={},a=[];function l(c){var d=i[c]={onStack:!0,lowlink:r,index:r++};if(s.push(c),n.successors(c).forEach(function(g){t.has(i,g)?i[g].onStack&&(d.lowlink=Math.min(d.lowlink,i[g].index)):(l(g),d.lowlink=Math.min(d.lowlink,i[g].lowlink))}),d.lowlink===d.index){var h=[],m;do m=s.pop(),i[m].onStack=!1,h.push(m);while(c!==m);a.push(h)}}return n.nodes().forEach(function(c){t.has(i,c)||l(c)}),a}return U5}var W5,cP;function C8e(){if(cP)return W5;cP=1;var t=za(),e=TG();W5=n;function n(r){return t.filter(e(r),function(s){return s.length>1||s.length===1&&r.hasEdge(s[0],s[0])})}return W5}var G5,uP;function T8e(){if(uP)return G5;uP=1;var t=za();G5=n;var e=t.constant(1);function n(s,i,a){return r(s,i||e,a||function(l){return s.outEdges(l)})}function r(s,i,a){var l={},c=s.nodes();return c.forEach(function(d){l[d]={},l[d][d]={distance:0},c.forEach(function(h){d!==h&&(l[d][h]={distance:Number.POSITIVE_INFINITY})}),a(d).forEach(function(h){var m=h.v===d?h.w:h.v,g=i(h);l[d][m]={distance:g,predecessor:d}})}),c.forEach(function(d){var h=l[d];c.forEach(function(m){var g=l[m];c.forEach(function(x){var y=g[d],w=h[x],S=g[x],k=y.distance+w.distance;k0;){if(d=c.removeMin(),t.has(l,d))a.setEdge(d,l[d]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(d).forEach(h)}return a}return e3}var t3,xP;function R8e(){return xP||(xP=1,t3={components:j8e(),dijkstra:CG(),dijkstraAll:N8e(),findCycles:C8e(),floydWarshall:T8e(),isAcyclic:E8e(),postorder:_8e(),preorder:A8e(),prim:M8e(),tarjan:TG(),topsort:EG()}),t3}var n3,vP;function D8e(){if(vP)return n3;vP=1;var t=k8e();return n3={Graph:t.Graph,json:O8e(),alg:R8e(),version:t.version},n3}var r3,yP;function Ja(){if(yP)return r3;yP=1;var t;if(typeof a7=="function")try{t=D8e()}catch{}return t||(t=window.graphlib),r3=t,r3}var s3,bP;function P8e(){if(bP)return s3;bP=1;var t=qz(),e=1,n=4;function r(s){return t(s,e|n)}return s3=r,s3}var i3,wP;function z8e(){if(wP)return i3;wP=1;var t=wj(),e=Yz(),n=Xz(),r=Ly(),s=Object.prototype,i=s.hasOwnProperty,a=t(function(l,c){l=Object(l);var d=-1,h=c.length,m=h>2?c[2]:void 0;for(m&&n(c[0],c[1],m)&&(h=1);++d1?i[l-1]:void 0,d=l>2?i[2]:void 0;for(c=r.length>3&&typeof c=="function"?(l--,c):void 0,d&&e(i[0],i[1],d)&&(c=l<3?void 0:c,l=1),s=Object(s);++a0;--S)if(w=h[S].dequeue(),w){g=g.concat(a(d,h,m,w,!0));break}}}return g}function a(d,h,m,g,x){var y=x?[]:void 0;return t.forEach(d.inEdges(g.v),function(w){var S=d.edge(w),k=d.node(w.v);x&&y.push({v:w.v,w:w.w}),k.out-=S,c(h,m,k)}),t.forEach(d.outEdges(g.v),function(w){var S=d.edge(w),k=w.w,j=d.node(k);j.in-=S,c(h,m,j)}),d.removeNode(g.v),y}function l(d,h){var m=new e,g=0,x=0;t.forEach(d.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),t.forEach(d.edges(),function(S){var k=m.edge(S.v,S.w)||0,j=h(S),N=k+j;m.setEdge(S.v,S.w,N),x=Math.max(x,m.node(S.v).out+=j),g=Math.max(g,m.node(S.w).in+=j)});var y=t.range(x+g+3).map(function(){return new n}),w=g+1;return t.forEach(m.nodes(),function(S){c(y,w,m.node(S))}),{graph:m,buckets:y,zeroIdx:w}}function c(d,h,m){m.out?m.in?d[m.out-m.in+h].enqueue(m):d[d.length-1].enqueue(m):d[0].enqueue(m)}return k3}var O3,FP;function Z8e(){if(FP)return O3;FP=1;var t=Nr(),e=K8e();O3={run:n,undo:s};function n(i){var a=i.graph().acyclicer==="greedy"?e(i,l(i)):r(i);t.forEach(a,function(c){var d=i.edge(c);i.removeEdge(c),d.forwardName=c.name,d.reversed=!0,i.setEdge(c.w,c.v,d,t.uniqueId("rev"))});function l(c){return function(d){return c.edge(d).weight}}}function r(i){var a=[],l={},c={};function d(h){t.has(c,h)||(c[h]=!0,l[h]=!0,t.forEach(i.outEdges(h),function(m){t.has(l,m.w)?a.push(m):d(m.w)}),delete l[h])}return t.forEach(i.nodes(),d),a}function s(i){t.forEach(i.edges(),function(a){var l=i.edge(a);if(l.reversed){i.removeEdge(a);var c=l.forwardName;delete l.reversed,delete l.forwardName,i.setEdge(a.w,a.v,l,c)}})}return O3}var j3,qP;function ji(){if(qP)return j3;qP=1;var t=Nr(),e=Ja().Graph;j3={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:i,predecessorWeights:a,intersectRect:l,buildLayerMatrix:c,normalizeRanks:d,removeEmptyRanks:h,addBorderNode:m,maxRank:g,partition:x,time:y,notime:w};function n(S,k,j,N){var T;do T=t.uniqueId(N);while(S.hasNode(T));return j.dummy=k,S.setNode(T,j),T}function r(S){var k=new e().setGraph(S.graph());return t.forEach(S.nodes(),function(j){k.setNode(j,S.node(j))}),t.forEach(S.edges(),function(j){var N=k.edge(j.v,j.w)||{weight:0,minlen:1},T=S.edge(j);k.setEdge(j.v,j.w,{weight:N.weight+T.weight,minlen:Math.max(N.minlen,T.minlen)})}),k}function s(S){var k=new e({multigraph:S.isMultigraph()}).setGraph(S.graph());return t.forEach(S.nodes(),function(j){S.children(j).length||k.setNode(j,S.node(j))}),t.forEach(S.edges(),function(j){k.setEdge(j,S.edge(j))}),k}function i(S){var k=t.map(S.nodes(),function(j){var N={};return t.forEach(S.outEdges(j),function(T){N[T.w]=(N[T.w]||0)+S.edge(T).weight}),N});return t.zipObject(S.nodes(),k)}function a(S){var k=t.map(S.nodes(),function(j){var N={};return t.forEach(S.inEdges(j),function(T){N[T.v]=(N[T.v]||0)+S.edge(T).weight}),N});return t.zipObject(S.nodes(),k)}function l(S,k){var j=S.x,N=S.y,T=k.x-j,E=k.y-N,_=S.width/2,A=S.height/2;if(!T&&!E)throw new Error("Not possible to find intersection inside of the rectangle");var L,P;return Math.abs(E)*_>Math.abs(T)*A?(E<0&&(A=-A),L=A*T/E,P=A):(T<0&&(_=-_),L=_,P=_*E/T),{x:j+L,y:N+P}}function c(S){var k=t.map(t.range(g(S)+1),function(){return[]});return t.forEach(S.nodes(),function(j){var N=S.node(j),T=N.rank;t.isUndefined(T)||(k[T][N.order]=j)}),k}function d(S){var k=t.min(t.map(S.nodes(),function(j){return S.node(j).rank}));t.forEach(S.nodes(),function(j){var N=S.node(j);t.has(N,"rank")&&(N.rank-=k)})}function h(S){var k=t.min(t.map(S.nodes(),function(E){return S.node(E).rank})),j=[];t.forEach(S.nodes(),function(E){var _=S.node(E).rank-k;j[_]||(j[_]=[]),j[_].push(E)});var N=0,T=S.graph().nodeRankFactor;t.forEach(j,function(E,_){t.isUndefined(E)&&_%T!==0?--N:N&&t.forEach(E,function(A){S.node(A).rank+=N})})}function m(S,k,j,N){var T={width:0,height:0};return arguments.length>=4&&(T.rank=j,T.order=N),n(S,"border",T,k)}function g(S){return t.max(t.map(S.nodes(),function(k){var j=S.node(k).rank;if(!t.isUndefined(j))return j}))}function x(S,k){var j={lhs:[],rhs:[]};return t.forEach(S,function(N){k(N)?j.lhs.push(N):j.rhs.push(N)}),j}function y(S,k){var j=t.now();try{return k()}finally{console.log(S+" time: "+(t.now()-j)+"ms")}}function w(S,k){return k()}return j3}var N3,$P;function J8e(){if($P)return N3;$P=1;var t=Nr(),e=ji();N3={run:n,undo:s};function n(i){i.graph().dummyChains=[],t.forEach(i.edges(),function(a){r(i,a)})}function r(i,a){var l=a.v,c=i.node(l).rank,d=a.w,h=i.node(d).rank,m=a.name,g=i.edge(a),x=g.labelRank;if(h!==c+1){i.removeEdge(a);var y,w,S;for(S=0,++c;cP.lim&&(B=P,$=!0);var U=t.filter(T.edges(),function(te){return $===j(N,N.node(te.v),B)&&$!==j(N,N.node(te.w),B)});return t.minBy(U,function(te){return n(T,te)})}function w(N,T,E,_){var A=E.v,L=E.w;N.removeEdge(A,L),N.setEdge(_.v,_.w,{}),m(N),c(N,T),S(N,T)}function S(N,T){var E=t.find(N.nodes(),function(A){return!T.node(A).parent}),_=s(N,E);_=_.slice(1),t.forEach(_,function(A){var L=N.node(A).parent,P=T.edge(A,L),B=!1;P||(P=T.edge(L,A),B=!0),T.node(A).rank=T.node(L).rank+(B?P.minlen:-P.minlen)})}function k(N,T,E){return N.hasEdge(T,E)}function j(N,T,E){return E.low<=T.lim&&T.lim<=E.lim}return E3}var _3,UP;function tTe(){if(UP)return _3;UP=1;var t=Dy(),e=t.longestPath,n=RG(),r=eTe();_3=s;function s(c){switch(c.graph().ranker){case"network-simplex":l(c);break;case"tight-tree":a(c);break;case"longest-path":i(c);break;default:l(c)}}var i=e;function a(c){e(c),n(c)}function l(c){r(c)}return _3}var A3,WP;function nTe(){if(WP)return A3;WP=1;var t=Nr();A3=e;function e(s){var i=r(s);t.forEach(s.graph().dummyChains,function(a){for(var l=s.node(a),c=l.edgeObj,d=n(s,i,c.v,c.w),h=d.path,m=d.lca,g=0,x=h[g],y=!0;a!==c.w;){if(l=s.node(a),y){for(;(x=h[g])!==m&&s.node(x).maxRankh||m>i[g].lim));for(x=g,g=l;(g=s.parent(g))!==x;)d.push(g);return{path:c.concat(d.reverse()),lca:x}}function r(s){var i={},a=0;function l(c){var d=a;t.forEach(s.children(c),l),i[c]={low:d,lim:a++}}return t.forEach(s.children(),l),i}return A3}var M3,GP;function rTe(){if(GP)return M3;GP=1;var t=Nr(),e=ji();M3={run:n,cleanup:a};function n(l){var c=e.addDummyNode(l,"root",{},"_root"),d=s(l),h=t.max(t.values(d))-1,m=2*h+1;l.graph().nestingRoot=c,t.forEach(l.edges(),function(x){l.edge(x).minlen*=m});var g=i(l)+1;t.forEach(l.children(),function(x){r(l,c,m,g,h,d,x)}),l.graph().nodeRankFactor=m}function r(l,c,d,h,m,g,x){var y=l.children(x);if(!y.length){x!==c&&l.setEdge(c,x,{weight:0,minlen:d});return}var w=e.addBorderNode(l,"_bt"),S=e.addBorderNode(l,"_bb"),k=l.node(x);l.setParent(w,x),k.borderTop=w,l.setParent(S,x),k.borderBottom=S,t.forEach(y,function(j){r(l,c,d,h,m,g,j);var N=l.node(j),T=N.borderTop?N.borderTop:j,E=N.borderBottom?N.borderBottom:j,_=N.borderTop?h:2*h,A=T!==E?1:m-g[x]+1;l.setEdge(w,T,{weight:_,minlen:A,nestingEdge:!0}),l.setEdge(E,S,{weight:_,minlen:A,nestingEdge:!0})}),l.parent(x)||l.setEdge(c,w,{weight:0,minlen:m+g[x]})}function s(l){var c={};function d(h,m){var g=l.children(h);g&&g.length&&t.forEach(g,function(x){d(x,m+1)}),c[h]=m}return t.forEach(l.children(),function(h){d(h,1)}),c}function i(l){return t.reduce(l.edges(),function(c,d){return c+l.edge(d).weight},0)}function a(l){var c=l.graph();l.removeNode(c.nestingRoot),delete c.nestingRoot,t.forEach(l.edges(),function(d){var h=l.edge(d);h.nestingEdge&&l.removeEdge(d)})}return M3}var R3,XP;function sTe(){if(XP)return R3;XP=1;var t=Nr(),e=ji();R3=n;function n(s){function i(a){var l=s.children(a),c=s.node(a);if(l.length&&t.forEach(l,i),t.has(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(var d=c.minRank,h=c.maxRank+1;d0;)x%2&&(y+=h[x+1]),x=x-1>>1,h[x]+=g.weight;m+=g.weight*y})),m}return z3}var I3,JP;function lTe(){if(JP)return I3;JP=1;var t=Nr();I3=e;function e(n,r){return t.map(r,function(s){var i=n.inEdges(s);if(i.length){var a=t.reduce(i,function(l,c){var d=n.edge(c),h=n.node(c.v);return{sum:l.sum+d.weight*h.order,weight:l.weight+d.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:s}})}return I3}var L3,ez;function cTe(){if(ez)return L3;ez=1;var t=Nr();L3=e;function e(s,i){var a={};t.forEach(s,function(c,d){var h=a[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:d};t.isUndefined(c.barycenter)||(h.barycenter=c.barycenter,h.weight=c.weight)}),t.forEach(i.edges(),function(c){var d=a[c.v],h=a[c.w];!t.isUndefined(d)&&!t.isUndefined(h)&&(h.indegree++,d.out.push(a[c.w]))});var l=t.filter(a,function(c){return!c.indegree});return n(l)}function n(s){var i=[];function a(d){return function(h){h.merged||(t.isUndefined(h.barycenter)||t.isUndefined(d.barycenter)||h.barycenter>=d.barycenter)&&r(d,h)}}function l(d){return function(h){h.in.push(d),--h.indegree===0&&s.push(h)}}for(;s.length;){var c=s.pop();i.push(c),t.forEach(c.in.reverse(),a(c)),t.forEach(c.out,l(c))}return t.map(t.filter(i,function(d){return!d.merged}),function(d){return t.pick(d,["vs","i","barycenter","weight"])})}function r(s,i){var a=0,l=0;s.weight&&(a+=s.barycenter*s.weight,l+=s.weight),i.weight&&(a+=i.barycenter*i.weight,l+=i.weight),s.vs=i.vs.concat(s.vs),s.barycenter=a/l,s.weight=l,s.i=Math.min(i.i,s.i),i.merged=!0}return L3}var B3,tz;function uTe(){if(tz)return B3;tz=1;var t=Nr(),e=ji();B3=n;function n(i,a){var l=e.partition(i,function(w){return t.has(w,"barycenter")}),c=l.lhs,d=t.sortBy(l.rhs,function(w){return-w.i}),h=[],m=0,g=0,x=0;c.sort(s(!!a)),x=r(h,d,x),t.forEach(c,function(w){x+=w.vs.length,h.push(w.vs),m+=w.barycenter*w.weight,g+=w.weight,x=r(h,d,x)});var y={vs:t.flatten(h,!0)};return g&&(y.barycenter=m/g,y.weight=g),y}function r(i,a,l){for(var c;a.length&&(c=t.last(a)).i<=l;)a.pop(),i.push(c.vs),l++;return l}function s(i){return function(a,l){return a.barycenterl.barycenter?1:i?l.i-a.i:a.i-l.i}}return B3}var F3,nz;function dTe(){if(nz)return F3;nz=1;var t=Nr(),e=lTe(),n=cTe(),r=uTe();F3=s;function s(l,c,d,h){var m=l.children(c),g=l.node(c),x=g?g.borderLeft:void 0,y=g?g.borderRight:void 0,w={};x&&(m=t.filter(m,function(E){return E!==x&&E!==y}));var S=e(l,m);t.forEach(S,function(E){if(l.children(E.v).length){var _=s(l,E.v,d,h);w[E.v]=_,t.has(_,"barycenter")&&a(E,_)}});var k=n(S,d);i(k,w);var j=r(k,h);if(x&&(j.vs=t.flatten([x,j.vs,y],!0),l.predecessors(x).length)){var N=l.node(l.predecessors(x)[0]),T=l.node(l.predecessors(y)[0]);t.has(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+N.order+T.order)/(j.weight+2),j.weight+=2}return j}function i(l,c){t.forEach(l,function(d){d.vs=t.flatten(d.vs.map(function(h){return c[h]?c[h].vs:h}),!0)})}function a(l,c){t.isUndefined(l.barycenter)?(l.barycenter=c.barycenter,l.weight=c.weight):(l.barycenter=(l.barycenter*l.weight+c.barycenter*c.weight)/(l.weight+c.weight),l.weight+=c.weight)}return F3}var q3,rz;function hTe(){if(rz)return q3;rz=1;var t=Nr(),e=Ja().Graph;q3=n;function n(s,i,a){var l=r(s),c=new e({compound:!0}).setGraph({root:l}).setDefaultNodeLabel(function(d){return s.node(d)});return t.forEach(s.nodes(),function(d){var h=s.node(d),m=s.parent(d);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(c.setNode(d),c.setParent(d,m||l),t.forEach(s[a](d),function(g){var x=g.v===d?g.w:g.v,y=c.edge(x,d),w=t.isUndefined(y)?0:y.weight;c.setEdge(x,d,{weight:s.edge(g).weight+w})}),t.has(h,"minRank")&&c.setNode(d,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),c}function r(s){for(var i;s.hasNode(i=t.uniqueId("_root")););return i}return q3}var $3,sz;function fTe(){if(sz)return $3;sz=1;var t=Nr();$3=e;function e(n,r,s){var i={},a;t.forEach(s,function(l){for(var c=n.parent(l),d,h;c;){if(d=n.parent(c),d?(h=i[d],i[d]=c):(h=a,a=c),h&&h!==c){r.setEdge(h,c);return}c=d}})}return $3}var H3,iz;function mTe(){if(iz)return H3;iz=1;var t=Nr(),e=aTe(),n=oTe(),r=dTe(),s=hTe(),i=fTe(),a=Ja().Graph,l=ji();H3=c;function c(g){var x=l.maxRank(g),y=d(g,t.range(1,x+1),"inEdges"),w=d(g,t.range(x-1,-1,-1),"outEdges"),S=e(g);m(g,S);for(var k=Number.POSITIVE_INFINITY,j,N=0,T=0;T<4;++N,++T){h(N%2?y:w,N%4>=2),S=l.buildLayerMatrix(g);var E=n(g,S);EB)&&a(N,te,$)})})}function E(_,A){var L=-1,P,B=0;return t.forEach(A,function($,U){if(k.node($).dummy==="border"){var te=k.predecessors($);te.length&&(P=k.node(te[0]).order,T(A,B,U,L,P),B=U,L=P)}T(A,B,A.length,P,_.length)}),A}return t.reduce(j,E),N}function i(k,j){if(k.node(j).dummy)return t.find(k.predecessors(j),function(N){return k.node(N).dummy})}function a(k,j,N){if(j>N){var T=j;j=N,N=T}var E=k[j];E||(k[j]=E={}),E[N]=!0}function l(k,j,N){if(j>N){var T=j;j=N,N=T}return t.has(k[j],N)}function c(k,j,N,T){var E={},_={},A={};return t.forEach(j,function(L){t.forEach(L,function(P,B){E[P]=P,_[P]=P,A[P]=B})}),t.forEach(j,function(L){var P=-1;t.forEach(L,function(B){var $=T(B);if($.length){$=t.sortBy($,function(F){return A[F]});for(var U=($.length-1)/2,te=Math.floor(U),z=Math.ceil(U);te<=z;++te){var Q=$[te];_[B]===B&&Po.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[o.jsx(ru,{type:"target",position:wt.Top}),o.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:t.content,children:t.label}),o.jsx(ru,{type:"source",position:wt.Bottom})]}));DG.displayName="EntityNode";const PG=b.memo(({data:t})=>o.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[o.jsx(ru,{type:"target",position:wt.Top}),o.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:t.content,children:t.label}),o.jsx(ru,{type:"source",position:wt.Bottom})]}));PG.displayName="ParagraphNode";const jTe={entity:DG,paragraph:PG};function NTe(t,e){const n=new hz.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const r=[],s=[];return t.forEach(i=>{n.setNode(i.id,{width:150,height:50})}),e.forEach(i=>{n.setEdge(i.source,i.target)}),hz.layout(n),t.forEach(i=>{const a=n.node(i.id);r.push({id:i.id,type:i.type,position:{x:a.x-75,y:a.y-25},data:{label:i.content.slice(0,20)+(i.content.length>20?"...":""),content:i.content}})}),e.forEach((i,a)=>{const l={id:`edge-${a}`,source:i.source,target:i.target,animated:t.length<=200&&i.weight>5,style:{strokeWidth:Math.min(i.weight/2,5),opacity:.6}};i.weight>10&&t.length<100&&(l.label=`${i.weight.toFixed(0)}`),s.push(l)}),{nodes:r,edges:s}}function CTe(){const t=Zi(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,a]=b.useState(""),[l,c]=b.useState("all"),[d,h]=b.useState(50),[m,g]=b.useState("50"),[x,y]=b.useState(!1),[w,S]=b.useState(!0),[k,j]=b.useState(!1),[N,T]=b.useState(!1),[E,_,A]=LCe([]),[L,P,B]=BCe([]),[$,U]=b.useState(0),[te,z]=b.useState(null),[Q,F]=b.useState(null),{toast:Y}=as(),J=b.useCallback(ne=>ne.type==="entity"?"#6366f1":ne.type==="paragraph"?"#10b981":"#6b7280",[]),X=b.useCallback(async(ne=!1)=>{try{if(!ne&&d>200){T(!0);return}n(!0);const[W,se]=await Promise.all([STe(d,l),kTe()]);if(s(se),W.nodes.length===0){Y({title:"提示",description:"知识库为空,请先导入知识数据"}),_([]),P([]);return}const{nodes:re,edges:oe}=NTe(W.nodes,W.edges);_(re),P(oe),U(re.length),se&&se.total_nodes>d&&Y({title:"提示",description:`知识图谱包含 ${se.total_nodes} 个节点,当前显示 ${re.length} 个`}),Y({title:"加载成功",description:`已加载 ${re.length} 个节点,${oe.length} 条边`})}catch(W){console.error("加载知识图谱失败:",W),Y({title:"加载失败",description:W instanceof Error?W.message:"未知错误",variant:"destructive"})}finally{n(!1)}},[d,l,Y]),R=b.useCallback(async()=>{if(!i.trim()){Y({title:"提示",description:"请输入搜索关键词"});return}try{const ne=await OTe(i);if(ne.length===0){Y({title:"未找到",description:"没有找到匹配的节点"});return}const W=new Set(ne.map(se=>se.id));_(se=>se.map(re=>({...re,style:{...re.style,opacity:W.has(re.id)?1:.3,filter:W.has(re.id)?"brightness(1.2)":"brightness(0.8)"}}))),Y({title:"搜索完成",description:`找到 ${ne.length} 个匹配节点`})}catch(ne){console.error("搜索失败:",ne),Y({title:"搜索失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}},[i,Y]),ie=b.useCallback(()=>{_(ne=>ne.map(W=>({...W,style:{...W.style,opacity:1,filter:"brightness(1)"}})))},[]),G=b.useCallback(()=>{S(!1),j(!0),X()},[X]),I=b.useCallback(()=>{T(!1),setTimeout(()=>{X(!0)},0)},[X]),V=b.useCallback((ne,W)=>{E.find(re=>re.id===W.id)&&z({id:W.id,type:W.type,content:W.data.content})},[E]);b.useEffect(()=>{w||k&&X()},[d,l,w,k]);const ee=b.useCallback((ne,W)=>{const se=E.find(Te=>Te.id===W.source),re=E.find(Te=>Te.id===W.target),oe=L.find(Te=>Te.id===W.id);se&&re&&oe&&F({source:{id:se.id,type:se.type,content:se.data.content},target:{id:re.id,type:re.type,content:re.data.content},edge:{source:W.source,target:W.target,weight:parseFloat(W.label||"0")}})},[E,L]);return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),o.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),r&&o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsxs(Xn,{variant:"outline",className:"gap-1",children:[o.jsx(ek,{className:"h-3 w-3"}),"节点: ",r.total_nodes]}),o.jsxs(Xn,{variant:"outline",className:"gap-1",children:[o.jsx(SI,{className:"h-3 w-3"}),"边: ",r.total_edges]}),o.jsxs(Xn,{variant:"outline",className:"gap-1",children:[o.jsx(Oa,{className:"h-3 w-3"}),"实体: ",r.entity_nodes]}),o.jsxs(Xn,{variant:"outline",className:"gap-1",children:[o.jsx(zl,{className:"h-3 w-3"}),"段落: ",r.paragraph_nodes]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[o.jsxs("div",{className:"flex-1 flex gap-2",children:[o.jsx(ze,{placeholder:"搜索节点内容...",value:i,onChange:ne=>a(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&R(),className:"flex-1"}),o.jsx(de,{onClick:R,size:"sm",children:o.jsx(Ni,{className:"h-4 w-4"})}),o.jsx(de,{onClick:ie,variant:"outline",size:"sm",children:"重置"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(Vt,{value:l,onValueChange:ne=>c(ne),children:[o.jsx($t,{className:"w-[120px]",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部节点"}),o.jsx(De,{value:"entity",children:"仅实体"}),o.jsx(De,{value:"paragraph",children:"仅段落"})]})]}),o.jsxs(Vt,{value:d===1e4?"all":x?"custom":d.toString(),onValueChange:ne=>{ne==="custom"?(y(!0),g(d.toString())):ne==="all"?(y(!1),h(1e4)):(y(!1),h(Number(ne)))},children:[o.jsx($t,{className:"w-[120px]",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"50",children:"50 节点"}),o.jsx(De,{value:"100",children:"100 节点"}),o.jsx(De,{value:"200",children:"200 节点"}),o.jsx(De,{value:"500",children:"500 节点"}),o.jsx(De,{value:"1000",children:"1000 节点"}),o.jsx(De,{value:"all",children:"全部 (最多10000)"}),o.jsx(De,{value:"custom",children:"自定义..."})]})]}),x&&o.jsx(ze,{type:"number",min:"50",value:m,onChange:ne=>g(ne.target.value),onBlur:()=>{const ne=parseInt(m);!isNaN(ne)&&ne>=50?h(ne):(g("50"),h(50))},onKeyDown:ne=>{if(ne.key==="Enter"){const W=parseInt(m);!isNaN(W)&&W>=50?h(W):(g("50"),h(50))}},placeholder:"最少50个",className:"w-[120px]"}),o.jsx(de,{onClick:()=>X(),variant:"outline",size:"sm",disabled:e,children:o.jsx(Ps,{className:xe("h-4 w-4",e&&"animate-spin")})})]})]})]}),o.jsx("div",{className:"flex-1 relative",children:e?o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx(Ps,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),o.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):E.length===0?o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx(ek,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),o.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):o.jsxs(dG,{nodes:E,edges:L,onNodesChange:A,onEdgesChange:B,onNodeClick:V,onEdgeClick:ee,nodeTypes:jTe,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:$<=500,nodesDraggable:$<=1e3,attributionPosition:"bottom-left",children:[o.jsx(l8e,{variant:Ca.Dots,gap:12,size:1}),o.jsx(n8e,{}),$<=500&&o.jsx(XCe,{nodeColor:J,nodeBorderRadius:8,pannable:!0,zoomable:!0}),o.jsxs(Jb,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[o.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),o.jsxs("div",{className:"space-y-2 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),o.jsx("span",{children:"实体节点"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),o.jsx("span",{children:"段落节点"})]}),$>200&&o.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[o.jsx("div",{className:"font-semibold",children:"性能模式"}),o.jsx("div",{children:"已禁用动画"}),$>500&&o.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),o.jsx(Dr,{open:!!te,onOpenChange:ne=>!ne&&z(null),children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsx(kr,{children:o.jsx(Or,{children:"节点详情"})}),te&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"grid grid-cols-2 gap-4",children:o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),o.jsx("div",{className:"mt-1",children:o.jsx(Xn,{variant:te.type==="entity"?"default":"secondary",children:te.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),o.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:te.id})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),o.jsx(gn,{className:"mt-1 h-40 p-3 bg-muted rounded",children:o.jsx("p",{className:"text-sm whitespace-pre-wrap",children:te.content})})]})]})]})}),o.jsx(Dr,{open:!!Q,onOpenChange:ne=>!ne&&F(null),children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[o.jsx(kr,{children:o.jsx(Or,{children:"边详情"})}),Q&&o.jsx(gn,{className:"flex-1 pr-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),o.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:Q.source.content}),o.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Q.source.id.slice(0,40),"..."]})]}),o.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),o.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),o.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:Q.target.content}),o.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Q.target.id.slice(0,40),"..."]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),o.jsx("div",{className:"mt-1",children:o.jsx(Xn,{variant:"outline",className:"text-base font-mono",children:Q.edge.weight.toFixed(4)})})]})]})})]})}),o.jsx(Dn,{open:w,onOpenChange:S,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"加载知识图谱"}),o.jsxs(_n,{children:["知识图谱的动态展示会消耗较多系统资源。",o.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{onClick:()=>t({to:"/"}),children:"取消 (返回首页)"}),o.jsx(An,{onClick:G,children:"确认加载"})]})]})}),o.jsx(Dn,{open:N,onOpenChange:T,children:o.jsxs(Nn,{children:[o.jsxs(Cn,{children:[o.jsx(En,{children:"⚠️ 节点数量较多"}),o.jsx(_n,{asChild:!0,children:o.jsxs("div",{children:[o.jsxs("p",{children:["您正在尝试加载 ",o.jsx("strong",{className:"text-orange-600",children:d>=1e4?"全部 (最多10000个)":d})," 个节点。"]}),o.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),o.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[o.jsx("li",{children:"页面加载时间较长"}),o.jsx("li",{children:"浏览器卡顿或崩溃"}),o.jsx("li",{children:"系统资源占用过高"})]}),o.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),o.jsxs(Tn,{children:[o.jsx(Mn,{onClick:()=>{T(!1),d>200&&(h(50),y(!1))},children:"取消"}),o.jsx(An,{onClick:I,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function mh(t,e,n){let r=n.initialDeps??[],s;function i(){var a,l,c,d;let h;n.key&&((a=n.debug)!=null&&a.call(n))&&(h=Date.now());const m=t();if(!(m.length!==r.length||m.some((y,w)=>r[w]!==y)))return s;r=m;let x;if(n.key&&((l=n.debug)!=null&&l.call(n))&&(x=Date.now()),s=e(...m),n.key&&((c=n.debug)!=null&&c.call(n))){const y=Math.round((Date.now()-h)*100)/100,w=Math.round((Date.now()-x)*100)/100,S=w/16,k=(j,N)=>{for(j=String(j);j.length0;)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 Ske=_U;J("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});J("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});J("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});J("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});J("\\@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}});J("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");J("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var UR={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};J("\\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 qe("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=UR[e.text],r==null||r>=n)throw new qe("Invalid base-"+n+" digit "+e.text);for(var s;(s=UR[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new qe("\\newcommand's first argument must be a macro name");var i=s[0].text,a=t.isDefined(i);if(a&&!e)throw new qe("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!a&&!n)throw new qe("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var l=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var c="",d=t.expandNextToken();d.text!=="]"&&d.text!=="EOF";)c+=d.text,d=t.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new qe("Invalid number of arguments: "+c);l=parseInt(c),s=t.consumeArg().tokens}return a&&r||t.macros.set(i,{tokens:s,numArgs:l}),""};J("\\newcommand",t=>UN(t,!1,!0,!1));J("\\renewcommand",t=>UN(t,!0,!1,!1));J("\\providecommand",t=>UN(t,!0,!0,!0));J("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});J("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});J("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),Qc[n],pr.math[n],pr.text[n]),""});J("\\bgroup","{");J("\\egroup","}");J("~","\\nobreakspace");J("\\lq","`");J("\\rq","'");J("\\aa","\\r a");J("\\AA","\\r A");J("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");J("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");J("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");J("ℬ","\\mathscr{B}");J("ℰ","\\mathscr{E}");J("ℱ","\\mathscr{F}");J("ℋ","\\mathscr{H}");J("ℐ","\\mathscr{I}");J("ℒ","\\mathscr{L}");J("ℳ","\\mathscr{M}");J("ℛ","\\mathscr{R}");J("ℭ","\\mathfrak{C}");J("ℌ","\\mathfrak{H}");J("ℨ","\\mathfrak{Z}");J("\\Bbbk","\\Bbb{k}");J("·","\\cdotp");J("\\llap","\\mathllap{\\textrm{#1}}");J("\\rlap","\\mathrlap{\\textrm{#1}}");J("\\clap","\\mathclap{\\textrm{#1}}");J("\\mathstrut","\\vphantom{(}");J("\\underbar","\\underline{\\text{#1}}");J("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');J("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");J("\\ne","\\neq");J("≠","\\neq");J("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");J("∉","\\notin");J("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");J("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");J("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");J("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");J("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");J("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");J("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");J("⟂","\\perp");J("‼","\\mathclose{!\\mkern-0.8mu!}");J("∌","\\notni");J("⌜","\\ulcorner");J("⌝","\\urcorner");J("⌞","\\llcorner");J("⌟","\\lrcorner");J("©","\\copyright");J("®","\\textregistered");J("️","\\textregistered");J("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');J("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');J("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');J("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');J("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");J("⋮","\\vdots");J("\\varGamma","\\mathit{\\Gamma}");J("\\varDelta","\\mathit{\\Delta}");J("\\varTheta","\\mathit{\\Theta}");J("\\varLambda","\\mathit{\\Lambda}");J("\\varXi","\\mathit{\\Xi}");J("\\varPi","\\mathit{\\Pi}");J("\\varSigma","\\mathit{\\Sigma}");J("\\varUpsilon","\\mathit{\\Upsilon}");J("\\varPhi","\\mathit{\\Phi}");J("\\varPsi","\\mathit{\\Psi}");J("\\varOmega","\\mathit{\\Omega}");J("\\substack","\\begin{subarray}{c}#1\\end{subarray}");J("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");J("\\boxed","\\fbox{$\\displaystyle{#1}$}");J("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");J("\\implies","\\DOTSB\\;\\Longrightarrow\\;");J("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");J("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");J("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var WR={",":"\\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"};J("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in WR?e=WR[n]:(n.slice(0,4)==="\\not"||n in pr.math&&["bin","rel"].includes(pr.math[n].group))&&(e="\\dotsb"),e});var WN={")":!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};J("\\dotso",function(t){var e=t.future().text;return e in WN?"\\ldots\\,":"\\ldots"});J("\\dotsc",function(t){var e=t.future().text;return e in WN&&e!==","?"\\ldots\\,":"\\ldots"});J("\\cdots",function(t){var e=t.future().text;return e in WN?"\\@cdots\\,":"\\@cdots"});J("\\dotsb","\\cdots");J("\\dotsm","\\cdots");J("\\dotsi","\\!\\cdots");J("\\dotsx","\\ldots\\,");J("\\DOTSI","\\relax");J("\\DOTSB","\\relax");J("\\DOTSX","\\relax");J("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");J("\\,","\\tmspace+{3mu}{.1667em}");J("\\thinspace","\\,");J("\\>","\\mskip{4mu}");J("\\:","\\tmspace+{4mu}{.2222em}");J("\\medspace","\\:");J("\\;","\\tmspace+{5mu}{.2777em}");J("\\thickspace","\\;");J("\\!","\\tmspace-{3mu}{.1667em}");J("\\negthinspace","\\!");J("\\negmedspace","\\tmspace-{4mu}{.2222em}");J("\\negthickspace","\\tmspace-{5mu}{.277em}");J("\\enspace","\\kern.5em ");J("\\enskip","\\hskip.5em\\relax");J("\\quad","\\hskip1em\\relax");J("\\qquad","\\hskip2em\\relax");J("\\tag","\\@ifstar\\tag@literal\\tag@paren");J("\\tag@paren","\\tag@literal{({#1})}");J("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new qe("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});J("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");J("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");J("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");J("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");J("\\newline","\\\\\\relax");J("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var $U=Xe(Mo["Main-Regular"][84][1]-.7*Mo["Main-Regular"][65][1]);J("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+$U+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");J("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+$U+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");J("\\hspace","\\@ifstar\\@hspacer\\@hspace");J("\\@hspace","\\hskip #1\\relax");J("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");J("\\ordinarycolon",":");J("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");J("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');J("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');J("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');J("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');J("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');J("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');J("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');J("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');J("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');J("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');J("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');J("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');J("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');J("∷","\\dblcolon");J("∹","\\eqcolon");J("≔","\\coloneqq");J("≕","\\eqqcolon");J("⩴","\\Coloneqq");J("\\ratio","\\vcentcolon");J("\\coloncolon","\\dblcolon");J("\\colonequals","\\coloneqq");J("\\coloncolonequals","\\Coloneqq");J("\\equalscolon","\\eqqcolon");J("\\equalscoloncolon","\\Eqqcolon");J("\\colonminus","\\coloneq");J("\\coloncolonminus","\\Coloneq");J("\\minuscolon","\\eqcolon");J("\\minuscoloncolon","\\Eqcolon");J("\\coloncolonapprox","\\Colonapprox");J("\\coloncolonsim","\\Colonsim");J("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");J("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");J("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");J("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");J("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");J("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");J("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");J("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");J("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");J("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");J("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");J("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");J("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");J("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");J("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");J("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");J("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");J("\\nleqq","\\html@mathml{\\@nleqq}{≰}");J("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");J("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");J("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");J("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");J("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");J("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");J("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");J("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");J("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");J("\\imath","\\html@mathml{\\@imath}{ı}");J("\\jmath","\\html@mathml{\\@jmath}{ȷ}");J("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");J("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");J("⟦","\\llbracket");J("⟧","\\rrbracket");J("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");J("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");J("⦃","\\lBrace");J("⦄","\\rBrace");J("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");J("⦵","\\minuso");J("\\darr","\\downarrow");J("\\dArr","\\Downarrow");J("\\Darr","\\Downarrow");J("\\lang","\\langle");J("\\rang","\\rangle");J("\\uarr","\\uparrow");J("\\uArr","\\Uparrow");J("\\Uarr","\\Uparrow");J("\\N","\\mathbb{N}");J("\\R","\\mathbb{R}");J("\\Z","\\mathbb{Z}");J("\\alef","\\aleph");J("\\alefsym","\\aleph");J("\\Alpha","\\mathrm{A}");J("\\Beta","\\mathrm{B}");J("\\bull","\\bullet");J("\\Chi","\\mathrm{X}");J("\\clubs","\\clubsuit");J("\\cnums","\\mathbb{C}");J("\\Complex","\\mathbb{C}");J("\\Dagger","\\ddagger");J("\\diamonds","\\diamondsuit");J("\\empty","\\emptyset");J("\\Epsilon","\\mathrm{E}");J("\\Eta","\\mathrm{H}");J("\\exist","\\exists");J("\\harr","\\leftrightarrow");J("\\hArr","\\Leftrightarrow");J("\\Harr","\\Leftrightarrow");J("\\hearts","\\heartsuit");J("\\image","\\Im");J("\\infin","\\infty");J("\\Iota","\\mathrm{I}");J("\\isin","\\in");J("\\Kappa","\\mathrm{K}");J("\\larr","\\leftarrow");J("\\lArr","\\Leftarrow");J("\\Larr","\\Leftarrow");J("\\lrarr","\\leftrightarrow");J("\\lrArr","\\Leftrightarrow");J("\\Lrarr","\\Leftrightarrow");J("\\Mu","\\mathrm{M}");J("\\natnums","\\mathbb{N}");J("\\Nu","\\mathrm{N}");J("\\Omicron","\\mathrm{O}");J("\\plusmn","\\pm");J("\\rarr","\\rightarrow");J("\\rArr","\\Rightarrow");J("\\Rarr","\\Rightarrow");J("\\real","\\Re");J("\\reals","\\mathbb{R}");J("\\Reals","\\mathbb{R}");J("\\Rho","\\mathrm{P}");J("\\sdot","\\cdot");J("\\sect","\\S");J("\\spades","\\spadesuit");J("\\sub","\\subset");J("\\sube","\\subseteq");J("\\supe","\\supseteq");J("\\Tau","\\mathrm{T}");J("\\thetasym","\\vartheta");J("\\weierp","\\wp");J("\\Zeta","\\mathrm{Z}");J("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");J("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");J("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");J("\\bra","\\mathinner{\\langle{#1}|}");J("\\ket","\\mathinner{|{#1}\\rangle}");J("\\braket","\\mathinner{\\langle{#1}\\rangle}");J("\\Bra","\\left\\langle#1\\right|");J("\\Ket","\\left|#1\\right\\rangle");var HU=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,a=e.macros.get("|"),l=e.macros.get("\\|");e.macros.beginGroup();var c=m=>g=>{t&&(g.macros.set("|",a),s.length&&g.macros.set("\\|",l));var x=m;if(!m&&s.length){var y=g.future();y.text==="|"&&(g.popToken(),x=!0)}return{tokens:x?s:r,numArgs:0}};e.macros.set("|",c(!1)),s.length&&e.macros.set("\\|",c(!0));var d=e.consumeArg().tokens,h=e.expandTokens([...i,...d,...n]);return e.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};J("\\bra@ket",HU(!1));J("\\bra@set",HU(!0));J("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");J("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");J("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");J("\\angln","{\\angl n}");J("\\blue","\\textcolor{##6495ed}{#1}");J("\\orange","\\textcolor{##ffa500}{#1}");J("\\pink","\\textcolor{##ff00af}{#1}");J("\\red","\\textcolor{##df0030}{#1}");J("\\green","\\textcolor{##28ae7b}{#1}");J("\\gray","\\textcolor{gray}{#1}");J("\\purple","\\textcolor{##9d38bd}{#1}");J("\\blueA","\\textcolor{##ccfaff}{#1}");J("\\blueB","\\textcolor{##80f6ff}{#1}");J("\\blueC","\\textcolor{##63d9ea}{#1}");J("\\blueD","\\textcolor{##11accd}{#1}");J("\\blueE","\\textcolor{##0c7f99}{#1}");J("\\tealA","\\textcolor{##94fff5}{#1}");J("\\tealB","\\textcolor{##26edd5}{#1}");J("\\tealC","\\textcolor{##01d1c1}{#1}");J("\\tealD","\\textcolor{##01a995}{#1}");J("\\tealE","\\textcolor{##208170}{#1}");J("\\greenA","\\textcolor{##b6ffb0}{#1}");J("\\greenB","\\textcolor{##8af281}{#1}");J("\\greenC","\\textcolor{##74cf70}{#1}");J("\\greenD","\\textcolor{##1fab54}{#1}");J("\\greenE","\\textcolor{##0d923f}{#1}");J("\\goldA","\\textcolor{##ffd0a9}{#1}");J("\\goldB","\\textcolor{##ffbb71}{#1}");J("\\goldC","\\textcolor{##ff9c39}{#1}");J("\\goldD","\\textcolor{##e07d10}{#1}");J("\\goldE","\\textcolor{##a75a05}{#1}");J("\\redA","\\textcolor{##fca9a9}{#1}");J("\\redB","\\textcolor{##ff8482}{#1}");J("\\redC","\\textcolor{##f9685d}{#1}");J("\\redD","\\textcolor{##e84d39}{#1}");J("\\redE","\\textcolor{##bc2612}{#1}");J("\\maroonA","\\textcolor{##ffbde0}{#1}");J("\\maroonB","\\textcolor{##ff92c6}{#1}");J("\\maroonC","\\textcolor{##ed5fa6}{#1}");J("\\maroonD","\\textcolor{##ca337c}{#1}");J("\\maroonE","\\textcolor{##9e034e}{#1}");J("\\purpleA","\\textcolor{##ddd7ff}{#1}");J("\\purpleB","\\textcolor{##c6b9fc}{#1}");J("\\purpleC","\\textcolor{##aa87ff}{#1}");J("\\purpleD","\\textcolor{##7854ab}{#1}");J("\\purpleE","\\textcolor{##543b78}{#1}");J("\\mintA","\\textcolor{##f5f9e8}{#1}");J("\\mintB","\\textcolor{##edf2df}{#1}");J("\\mintC","\\textcolor{##e0e5cc}{#1}");J("\\grayA","\\textcolor{##f6f7f7}{#1}");J("\\grayB","\\textcolor{##f0f1f2}{#1}");J("\\grayC","\\textcolor{##e3e5e6}{#1}");J("\\grayD","\\textcolor{##d6d8da}{#1}");J("\\grayE","\\textcolor{##babec2}{#1}");J("\\grayF","\\textcolor{##888d93}{#1}");J("\\grayG","\\textcolor{##626569}{#1}");J("\\grayH","\\textcolor{##3b3e40}{#1}");J("\\grayI","\\textcolor{##21242c}{#1}");J("\\kaBlue","\\textcolor{##314453}{#1}");J("\\kaGreen","\\textcolor{##71B307}{#1}");var QU={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class kke{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 wke(Ske,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new VR(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 Zi("EOF",r.loc)),this.pushTokens(s),new Zi("",xi.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,a=0,l=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++a;else if(i.text==="}"){if(--a,a===-1)throw new qe("Extra }",i)}else if(i.text==="EOF")throw new qe("Unexpected end of input in a macro argument, expected '"+(e&&r?e[l]:"}")+"'",i);if(e&&r)if((a===0||a===1&&e[l]==="{")&&i.text===e[l]){if(++l,l===e.length){n.splice(-l,l);break}}else l=0}while(a!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new qe("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new qe("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 qe("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,a=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var l=i.length-1;l>=0;--l){var c=i[l];if(c.text==="#"){if(l===0)throw new qe("Incomplete placeholder at end of macro body",c);if(c=i[--l],c.text==="#")i.splice(l+1,1);else if(/^[1-9]$/.test(c.text))i.splice(l,2,...a[+c.text-1]);else throw new qe("Not a valid argument number",c)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Zi(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var a=s.replace(/##/g,"");a.indexOf("#"+(i+1))!==-1;)++i;for(var l=new VR(s,this.settings),c=[],d=l.lex();d.text!=="EOF";)c.push(d),d=l.lex();c.reverse();var h={tokens:c,numArgs:i};return h}return s}isDefined(e){return this.macros.has(e)||Qc.hasOwnProperty(e)||pr.math.hasOwnProperty(e)||pr.text.hasOwnProperty(e)||QU.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Qc.hasOwnProperty(e)&&!Qc[e].primitive}}var GR=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Q1=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),c5={"́":{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"}},XR={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Kb{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 kke(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 qe("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 Zi("}")),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(Kb.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&Qc[s.text]&&Qc[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 l=pr[this.mode][n].group,c=xi.range(e),d;if(d3e.hasOwnProperty(l)){var h=l;d={type:"atom",mode:this.mode,family:h,loc:c,text:n}}else d={type:l,mode:this.mode,loc:c,text:n};a=d}else if(n.charCodeAt(0)>=128)this.settings.strict&&(JV(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),a={type:"textord",mode:"text",loc:xi.range(e),text:n};else return null;if(this.consume(),i)for(var m=0;md&&(d=h):h&&(d!==void 0&&d>-1&&c.push(` +`.repeat(d)||" "),d=-1,c.push(h))}return c.join("")}function KU(t,e,n){return t.type==="element"?eOe(t,e,n):t.type==="text"?n.whitespace==="normal"?ZU(t,n):tOe(t):[]}function eOe(t,e,n){const r=JU(t,n),s=t.children||[];let i=-1,a=[];if(Zke(t))return a;let l,c;for(KO(t)||sD(t)&&eD(e,t,sD)?c=` +`:Kke(t)?(l=2,c=2):YU(t)&&(l=1,c=1);++i{try{i(!0);const Oe=await dOe({page:a,page_size:h,is_registered:g==="all"?void 0:g==="registered",is_banned:y==="all"?void 0:y==="banned",format:S==="all"?void 0:S,sort_by:j,sort_order:T});e(Oe.data),d(Oe.total)}catch(Oe){const Ve=Oe instanceof Error?Oe.message:"加载表情包列表失败";X({title:"错误",description:Ve,variant:"destructive"})}finally{i(!1)}},[a,h,g,y,S,j,T,X]),U=async()=>{try{const Oe=await pOe();r(Oe.data)}catch(Oe){console.error("加载统计数据失败:",Oe)}};b.useEffect(()=>{z()},[z]),b.useEffect(()=>{U()},[]);const te=async Oe=>{try{const Ve=await hOe(Oe.id);A(Ve.data),q(!0)}catch(Ve){const Ue=Ve instanceof Error?Ve.message:"加载详情失败";X({title:"错误",description:Ue,variant:"destructive"})}},ne=Oe=>{A(Oe),H(!0)},G=Oe=>{A(Oe),ee(!0)},se=async()=>{if(_)try{await mOe(_.id),X({title:"成功",description:"表情包已删除"}),ee(!1),A(null),z(),U()}catch(Oe){const Ve=Oe instanceof Error?Oe.message:"删除失败";X({title:"错误",description:Ve,variant:"destructive"})}},re=async Oe=>{try{await gOe(Oe.id),X({title:"成功",description:"表情包已注册"}),z(),U()}catch(Ve){const Ue=Ve instanceof Error?Ve.message:"注册失败";X({title:"错误",description:Ue,variant:"destructive"})}},ae=async Oe=>{try{await xOe(Oe.id),X({title:"成功",description:"表情包已封禁"}),z(),U()}catch(Ve){const Ue=Ve instanceof Error?Ve.message:"封禁失败";X({title:"错误",description:Ue,variant:"destructive"})}},_e=Oe=>{const Ve=new Set(I);Ve.has(Oe)?Ve.delete(Oe):Ve.add(Oe),V(Ve)},Be=async()=>{try{const Oe=await vOe(Array.from(I));X({title:"批量删除完成",description:Oe.message}),V(new Set),$(!1),z(),U()}catch(Oe){X({title:"批量删除失败",description:Oe instanceof Error?Oe.message:"批量删除失败",variant:"destructive"})}},Ye=()=>{const Oe=parseInt(K),Ve=Math.ceil(c/h);Oe>=1&&Oe<=Ve?(l(Oe),Y("")):X({title:"无效的页码",description:`请输入1-${Ve}之间的页码`,variant:"destructive"})},Je=n?.formats?Object.keys(n.formats):[];return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsxs("div",{className:"mb-4 sm:mb-6",children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),o.jsx(pn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&o.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[o.jsx(Lt,{children:o.jsxs(En,{className:"pb-2",children:[o.jsx(Wr,{children:"总数"}),o.jsx(_n,{className:"text-2xl",children:n.total})]})}),o.jsx(Lt,{children:o.jsxs(En,{className:"pb-2",children:[o.jsx(Wr,{children:"已注册"}),o.jsx(_n,{className:"text-2xl text-green-600",children:n.registered})]})}),o.jsx(Lt,{children:o.jsxs(En,{className:"pb-2",children:[o.jsx(Wr,{children:"已封禁"}),o.jsx(_n,{className:"text-2xl text-red-600",children:n.banned})]})}),o.jsx(Lt,{children:o.jsxs(En,{className:"pb-2",children:[o.jsx(Wr,{children:"未注册"}),o.jsx(_n,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),o.jsxs(Lt,{children:[o.jsx(En,{children:o.jsxs(_n,{className:"flex items-center gap-2",children:[o.jsx(ok,{className:"h-5 w-5"}),"筛选和排序"]})}),o.jsxs(Xn,{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"排序方式"}),o.jsxs(Vt,{value:`${j}-${T}`,onValueChange:Oe=>{const[Ve,Ue]=Oe.split("-");N(Ve),E(Ue),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"usage_count-desc",children:"使用次数 (多→少)"}),o.jsx(De,{value:"usage_count-asc",children:"使用次数 (少→多)"}),o.jsx(De,{value:"register_time-desc",children:"注册时间 (新→旧)"}),o.jsx(De,{value:"register_time-asc",children:"注册时间 (旧→新)"}),o.jsx(De,{value:"record_time-desc",children:"记录时间 (新→旧)"}),o.jsx(De,{value:"record_time-asc",children:"记录时间 (旧→新)"}),o.jsx(De,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),o.jsx(De,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"注册状态"}),o.jsxs(Vt,{value:g,onValueChange:Oe=>{x(Oe),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),o.jsx(De,{value:"registered",children:"已注册"}),o.jsx(De,{value:"unregistered",children:"未注册"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"封禁状态"}),o.jsxs(Vt,{value:y,onValueChange:Oe=>{w(Oe),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),o.jsx(De,{value:"banned",children:"已封禁"}),o.jsx(De,{value:"unbanned",children:"未封禁"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"格式"}),o.jsxs(Vt,{value:S,onValueChange:Oe=>{k(Oe),l(1)},children:[o.jsx($t,{children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),Je.map(Oe=>o.jsxs(De,{value:Oe,children:[Oe.toUpperCase()," (",n?.formats[Oe],")"]},Oe))]})]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[I.size>0&&o.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",I.size," 个表情包"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),o.jsxs(Vt,{value:R,onValueChange:Oe=>ie(Oe),children:[o.jsx($t,{className:"w-24",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"small",children:"小"}),o.jsx(De,{value:"medium",children:"中"}),o.jsx(De,{value:"large",children:"大"})]})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:h.toString(),onValueChange:Oe=>{m(parseInt(Oe)),l(1),V(new Set)},children:[o.jsx($t,{id:"emoji-page-size",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"40",children:"40"}),o.jsx(De,{value:"60",children:"60"}),o.jsx(De,{value:"100",children:"100"})]})]}),I.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>V(new Set),children:"取消选择"}),o.jsxs(ue,{variant:"destructive",size:"sm",onClick:()=>$(!0),children:[o.jsx(Cn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(ue,{variant:"outline",size:"sm",onClick:z,disabled:s,children:[o.jsx(Qs,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),o.jsxs(Lt,{children:[o.jsxs(En,{children:[o.jsx(_n,{children:"表情包列表"}),o.jsxs(Wr,{children:["共 ",c," 个表情包,当前第 ",a," 页"]})]}),o.jsxs(Xn,{children:[t.length===0?o.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):o.jsx("div",{className:`grid gap-3 ${R==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":R==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:t.map(Oe=>o.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${I.has(Oe.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>_e(Oe.id),children:[o.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${I.has(Oe.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:o.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${I.has(Oe.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:I.has(Oe.id)&&o.jsx(Ya,{className:"h-3 w-3"})})}),o.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[Oe.is_registered&&o.jsx(tn,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),Oe.is_banned&&o.jsx(tn,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),o.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${R==="small"?"p-1":R==="medium"?"p-2":"p-3"}`,children:o.jsx("img",{src:eW(Oe.id),alt:"表情包",className:"w-full h-full object-contain",loading:"lazy",onError:Ve=>{const Ue=Ve.target;Ue.style.display="none";const $e=Ue.parentElement;$e&&($e.innerHTML='')}})}),o.jsxs("div",{className:`border-t bg-card ${R==="small"?"p-1":"p-2"}`,children:[o.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[o.jsx(tn,{variant:"outline",className:"text-[10px] px-1 py-0",children:Oe.format.toUpperCase()}),o.jsxs("span",{className:"font-mono",children:[Oe.usage_count,"次"]})]}),o.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${R==="small"?"flex-wrap":""}`,children:[o.jsx(ue,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ve=>{Ve.stopPropagation(),ne(Oe)},title:"编辑",children:o.jsx(F0,{className:"h-3 w-3"})}),o.jsx(ue,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ve=>{Ve.stopPropagation(),te(Oe)},title:"详情",children:o.jsx(Xi,{className:"h-3 w-3"})}),!Oe.is_registered&&o.jsx(ue,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Ve=>{Ve.stopPropagation(),re(Oe)},title:"注册",children:o.jsx(Ya,{className:"h-3 w-3"})}),!Oe.is_banned&&o.jsx(ue,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Ve=>{Ve.stopPropagation(),ae(Oe)},title:"封禁",children:o.jsx(tte,{className:"h-3 w-3"})}),o.jsx(ue,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Ve=>{Ve.stopPropagation(),G(Oe)},title:"删除",children:o.jsx(Cn,{className:"h-3 w-3"})})]})]})]},Oe.id))}),c>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(a-1)*h+1," 到"," ",Math.min(a*h,c)," 条,共 ",c," 条"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(Ip,{className:"h-4 w-4"})}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>l(Oe=>Math.max(1,Oe-1)),disabled:a===1,children:[o.jsx(wd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:K,onChange:Oe=>Y(Oe.target.value),onKeyDown:Oe=>Oe.key==="Enter"&&Ye(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(c/h)}),o.jsx(ue,{variant:"outline",size:"sm",onClick:Ye,disabled:!K,className:"h-8",children:"跳转"})]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>l(Oe=>Oe+1),disabled:a>=Math.ceil(c/h),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Zl,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(c/h)),disabled:a>=Math.ceil(c/h),className:"hidden sm:flex",children:o.jsx(Lp,{className:"h-4 w-4"})})]})]})]})]}),o.jsx(bOe,{emoji:_,open:D,onOpenChange:q}),o.jsx(wOe,{emoji:_,open:B,onOpenChange:H,onSuccess:()=>{z(),U()}})]})}),o.jsx(Fn,{open:L,onOpenChange:$,children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认批量删除"}),o.jsxs(zn,{children:["你确定要删除选中的 ",I.size," 个表情包吗?此操作不可撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:Be,children:"确认删除"})]})]})}),o.jsx(Er,{open:W,onOpenChange:ee,children:o.jsxs(wr,{children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"确认删除"}),o.jsx(Xr,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),o.jsxs(fs,{children:[o.jsx(ue,{variant:"outline",onClick:()=>ee(!1),children:"取消"}),o.jsx(ue,{variant:"destructive",onClick:se,children:"删除"})]})]})})]})}function bOe({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return o.jsx(Er,{open:e,onOpenChange:n,children:o.jsxs(wr,{className:"max-w-2xl max-h-[90vh]",children:[o.jsx(Sr,{children:o.jsx(kr,{children:"表情包详情"})}),o.jsx(pn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:o.jsx("img",{src:eW(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const a=i.parentElement;a&&(a.innerHTML='')}})})}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"ID"}),o.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"格式"}),o.jsx("div",{className:"mt-1",children:o.jsx(tn,{variant:"outline",children:t.format.toUpperCase()})})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"文件路径"}),o.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"哈希值"}),o.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"描述"}),t.description?o.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:o.jsx(uOe,{className:"prose-sm",children:t.description})}):o.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"情绪"}),o.jsx("div",{className:"mt-1",children:t.emotion?o.jsx("span",{className:"text-sm",children:t.emotion}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"状态"}),o.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&o.jsx(tn,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&o.jsx(tn,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&o.jsx(tn,{variant:"outline",children:"未注册"})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"使用次数"}),o.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"记录时间"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"注册时间"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),o.jsxs("div",{children:[o.jsx(he,{className:"text-muted-foreground",children:"最后使用"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function wOe({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState(""),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!1),{toast:g}=Lr();b.useEffect(()=>{t&&(i(t.emotion||""),l(t.is_registered),d(t.is_banned))},[t]);const x=async()=>{if(t)try{m(!0);const y=s.split(/[,,]/).map(w=>w.trim()).filter(Boolean).join(",");await fOe(t.id,{emotion:y||void 0,is_registered:a,is_banned:c}),g({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(y){const w=y instanceof Error?y.message:"保存失败";g({title:"错误",description:w,variant:"destructive"})}finally{m(!1)}};return t?o.jsx(Er,{open:e,onOpenChange:n,children:o.jsxs(wr,{className:"max-w-2xl",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"编辑表情包"}),o.jsx(Xr,{children:"修改表情包的情绪和状态信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx(he,{children:"情绪"}),o.jsx(Nr,{value:s,onChange:y=>i(y.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ci,{id:"is_registered",checked:a,onCheckedChange:y=>{y===!0?(l(!0),d(!1)):l(!1)}}),o.jsx(he,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ci,{id:"is_banned",checked:c,onCheckedChange:y=>{y===!0?(d(!0),l(!1)):d(!1)}}),o.jsx(he,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),o.jsxs(fs,{children:[o.jsx(ue,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(ue,{onClick:x,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}const pu="/api/webui/expression";async function SOe(){const t=await gt(`${pu}/chats`,{headers:Tt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取聊天列表失败")}return t.json()}async function kOe(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 gt(`${pu}/list?${e}`,{headers:Tt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function OOe(t){const e=await gt(`${pu}/${t}`,{headers:Tt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function jOe(t){const e=await gt(`${pu}/`,{method:"POST",headers:Tt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function NOe(t,e){const n=await gt(`${pu}/${t}`,{method:"PATCH",headers:Tt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function COe(t){const e=await gt(`${pu}/${t}`,{method:"DELETE",headers:Tt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function TOe(t){const e=await gt(`${pu}/batch/delete`,{method:"POST",headers:Tt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function EOe(){const t=await gt(`${pu}/stats/summary`,{headers:Tt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function _Oe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(1),[c,d]=b.useState(20),[h,m]=b.useState(""),[g,x]=b.useState(null),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[j,N]=b.useState(!1),[T,E]=b.useState(null),[_,A]=b.useState(new Set),[D,q]=b.useState(!1),[B,H]=b.useState(""),[W,ee]=b.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[I,V]=b.useState([]),[L,$]=b.useState(new Map),{toast:K}=Lr(),Y=async()=>{try{r(!0);const ae=await kOe({page:a,page_size:c,search:h||void 0});e(ae.data),i(ae.total)}catch(ae){K({title:"加载失败",description:ae instanceof Error?ae.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},R=async()=>{try{const ae=await EOe();ae?.data&&ee(ae.data)}catch(ae){console.error("加载统计数据失败:",ae)}},ie=async()=>{try{const ae=await SOe();if(ae?.data){V(ae.data);const _e=new Map;ae.data.forEach(Be=>{_e.set(Be.chat_id,Be.chat_name)}),$(_e)}}catch(ae){console.error("加载聊天列表失败:",ae)}},X=ae=>L.get(ae)||ae;b.useEffect(()=>{Y(),R(),ie()},[a,c,h]);const z=async ae=>{try{const _e=await OOe(ae.id);x(_e.data),w(!0)}catch(_e){K({title:"加载详情失败",description:_e instanceof Error?_e.message:"无法加载表达方式详情",variant:"destructive"})}},U=ae=>{x(ae),k(!0)},te=async ae=>{try{await COe(ae.id),K({title:"删除成功",description:`已删除表达方式: ${ae.situation}`}),E(null),Y(),R()}catch(_e){K({title:"删除失败",description:_e instanceof Error?_e.message:"无法删除表达方式",variant:"destructive"})}},ne=ae=>{const _e=new Set(_);_e.has(ae)?_e.delete(ae):_e.add(ae),A(_e)},G=()=>{_.size===t.length&&t.length>0?A(new Set):A(new Set(t.map(ae=>ae.id)))},se=async()=>{try{await TOe(Array.from(_)),K({title:"批量删除成功",description:`已删除 ${_.size} 个表达方式`}),A(new Set),q(!1),Y(),R()}catch(ae){K({title:"批量删除失败",description:ae instanceof Error?ae.message:"无法批量删除表达方式",variant:"destructive"})}},re=()=>{const ae=parseInt(B),_e=Math.ceil(s/c);ae>=1&&ae<=_e?(l(ae),H("")):K({title:"无效的页码",description:`请输入1-${_e}之间的页码`,variant:"destructive"})};return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsx("div",{className:"mb-4 sm:mb-6",children:o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[o.jsx(Gh,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),o.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),o.jsxs(ue,{onClick:()=>N(!0),className:"gap-2",children:[o.jsx(Is,{className:"h-4 w-4"}),"新增表达方式"]})]})}),o.jsx(pn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),o.jsx("div",{className:"text-2xl font-bold mt-1",children:W.total})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:W.recent_7days})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:W.chat_count})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx(he,{htmlFor:"search",children:"搜索"}),o.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(ii,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{id:"search",placeholder:"搜索情境、风格或上下文...",value:h,onChange:ae=>m(ae.target.value),className:"pl-9"})]})}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[o.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:_.size>0&&o.jsxs("span",{children:["已选择 ",_.size," 个表达方式"]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:c.toString(),onValueChange:ae=>{d(parseInt(ae)),l(1),A(new Set)},children:[o.jsx($t,{id:"page-size",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),_.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>A(new Set),children:"取消选择"}),o.jsxs(ue,{variant:"destructive",size:"sm",onClick:()=>q(!0),children:[o.jsx(Cn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card",children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(Af,{children:[o.jsx(Mf,{children:o.jsxs(zs,{children:[o.jsx(mn,{className:"w-12",children:o.jsx(Ci,{checked:_.size===t.length&&t.length>0,onCheckedChange:G})}),o.jsx(mn,{children:"情境"}),o.jsx(mn,{children:"风格"}),o.jsx(mn,{children:"聊天"}),o.jsx(mn,{className:"text-right",children:"操作"})]})}),o.jsx(Rf,{children:n?o.jsx(zs,{children:o.jsx(Yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?o.jsx(zs,{children:o.jsx(Yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(ae=>o.jsxs(zs,{children:[o.jsx(Yt,{children:o.jsx(Ci,{checked:_.has(ae.id),onCheckedChange:()=>ne(ae.id)})}),o.jsx(Yt,{className:"font-medium max-w-xs truncate",children:ae.situation}),o.jsx(Yt,{className:"max-w-xs truncate",children:ae.style}),o.jsx(Yt,{className:"max-w-[200px] truncate",title:X(ae.chat_id),style:{wordBreak:"keep-all"},children:o.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:X(ae.chat_id)})}),o.jsx(Yt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(ue,{variant:"default",size:"sm",onClick:()=>U(ae),children:[o.jsx(F0,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsx(ue,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>z(ae),title:"查看详情",children:o.jsx(Ji,{className:"h-4 w-4"})}),o.jsxs(ue,{size:"sm",onClick:()=>E(ae),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Cn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ae.id))})]})}),o.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(ae=>o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Ci,{checked:_.has(ae.id),onCheckedChange:()=>ne(ae.id),className:"mt-1"}),o.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),o.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:ae.situation,children:ae.situation})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),o.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:ae.style,children:ae.style})]})]})]}),o.jsxs("div",{className:"text-sm",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),o.jsx("p",{className:"text-sm truncate",title:X(ae.chat_id),style:{wordBreak:"keep-all"},children:X(ae.chat_id)})]}),o.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>U(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(F0,{className:"h-3 w-3 mr-1"}),"编辑"]}),o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>z(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:o.jsx(Ji,{className:"h-3 w-3"})}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>E(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[o.jsx(Cn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ae.id))}),s>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(Ip,{className:"h-4 w-4"})}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>l(a-1),disabled:a===1,children:[o.jsx(wd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:B,onChange:ae=>H(ae.target.value),onKeyDown:ae=>ae.key==="Enter"&&re(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),o.jsx(ue,{variant:"outline",size:"sm",onClick:re,disabled:!B,className:"h-8",children:"跳转"})]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>l(a+1),disabled:a>=Math.ceil(s/c),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Zl,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:o.jsx(Lp,{className:"h-4 w-4"})})]})]})]})]})}),o.jsx(AOe,{expression:g,open:y,onOpenChange:w,chatNameMap:L}),o.jsx(MOe,{open:j,onOpenChange:N,chatList:I,onSuccess:()=>{Y(),R(),N(!1)}}),o.jsx(ROe,{expression:g,open:S,onOpenChange:k,chatList:I,onSuccess:()=>{Y(),R(),k(!1)}}),o.jsx(Fn,{open:!!T,onOpenChange:()=>E(null),children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:['确定要删除表达方式 "',T?.situation,'" 吗? 此操作不可撤销。']})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>T&&te(T),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),o.jsx(DOe,{open:D,onOpenChange:q,onConfirm:se,count:_.size})]})}function AOe({expression:t,open:e,onOpenChange:n,chatNameMap:r}){if(!t)return null;const s=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-",i=a=>r.get(a)||a;return o.jsx(Er,{open:e,onOpenChange:n,children:o.jsxs(wr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"表达方式详情"}),o.jsx(Xr,{children:"查看表达方式的完整信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(t0,{label:"情境",value:t.situation}),o.jsx(t0,{label:"风格",value:t.style}),o.jsx(t0,{label:"聊天",value:i(t.chat_id)}),o.jsx(t0,{icon:lk,label:"记录ID",value:t.id.toString(),mono:!0})]}),o.jsx("div",{className:"grid grid-cols-2 gap-4",children:o.jsx(t0,{icon:Mh,label:"创建时间",value:s(t.create_date)})})]}),o.jsx(fs,{children:o.jsx(ue,{onClick:()=>n(!1),children:"关闭"})})]})})}function t0({icon:t,label:e,value:n,mono:r=!1}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(he,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&o.jsx(t,{className:"h-3 w-3"}),e]}),o.jsx("div",{className:xe("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function MOe({open:t,onOpenChange:e,chatList:n,onSuccess:r}){const[s,i]=b.useState({situation:"",style:"",chat_id:""}),[a,l]=b.useState(!1),{toast:c}=Lr(),d=async()=>{if(!s.situation||!s.style||!s.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{l(!0),await jOe(s),c({title:"创建成功",description:"表达方式已创建"}),i({situation:"",style:"",chat_id:""}),r()}catch(h){c({title:"创建失败",description:h instanceof Error?h.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return o.jsx(Er,{open:t,onOpenChange:e,children:o.jsxs(wr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"新增表达方式"}),o.jsx(Xr,{children:"创建新的表达方式记录"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(he,{htmlFor:"situation",children:["情境 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(Pe,{id:"situation",value:s.situation,onChange:h=>i({...s,situation:h.target.value}),placeholder:"描述使用场景"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(he,{htmlFor:"style",children:["风格 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(Pe,{id:"style",value:s.style,onChange:h=>i({...s,style:h.target.value}),placeholder:"描述表达风格"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(he,{htmlFor:"chat_id",children:["聊天 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsxs(Vt,{value:s.chat_id,onValueChange:h=>i({...s,chat_id:h}),children:[o.jsx($t,{children:o.jsx(Ut,{placeholder:"选择关联的聊天"})}),o.jsx(Ht,{children:n.map(h=>o.jsx(De,{value:h.chat_id,children:o.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[h.chat_name,h.is_group&&o.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},h.chat_id))})]})]})]}),o.jsxs(fs,{children:[o.jsx(ue,{variant:"outline",onClick:()=>e(!1),children:"取消"}),o.jsx(ue,{onClick:d,disabled:a,children:a?"创建中...":"创建"})]})]})})}function ROe({expression:t,open:e,onOpenChange:n,chatList:r,onSuccess:s}){const[i,a]=b.useState({}),[l,c]=b.useState(!1),{toast:d}=Lr();b.useEffect(()=>{t&&a({situation:t.situation,style:t.style,chat_id:t.chat_id})},[t]);const h=async()=>{if(t)try{c(!0),await NOe(t.id,i),d({title:"保存成功",description:"表达方式已更新"}),s()}catch(m){d({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?o.jsx(Er,{open:e,onOpenChange:n,children:o.jsxs(wr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"编辑表达方式"}),o.jsx(Xr,{children:"修改表达方式的信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit_situation",children:"情境"}),o.jsx(Pe,{id:"edit_situation",value:i.situation||"",onChange:m=>a({...i,situation:m.target.value}),placeholder:"描述使用场景"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit_style",children:"风格"}),o.jsx(Pe,{id:"edit_style",value:i.style||"",onChange:m=>a({...i,style:m.target.value}),placeholder:"描述表达风格"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit_chat_id",children:"聊天"}),o.jsxs(Vt,{value:i.chat_id||"",onValueChange:m=>a({...i,chat_id:m}),children:[o.jsx($t,{children:o.jsx(Ut,{placeholder:"选择关联的聊天"})}),o.jsx(Ht,{children:r.map(m=>o.jsx(De,{value:m.chat_id,children:o.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[m.chat_name,m.is_group&&o.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},m.chat_id))})]})]})]}),o.jsxs(fs,{children:[o.jsx(ue,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(ue,{onClick:h,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function DOe({open:t,onOpenChange:e,onConfirm:n,count:r}){return o.jsx(Fn,{open:t,onOpenChange:e,children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认批量删除"}),o.jsxs(zn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Qf="/api/webui/person";async function POe(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 gt(`${Qf}/list?${e}`,{headers:Tt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function zOe(t){const e=await gt(`${Qf}/${t}`,{headers:Tt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function IOe(t,e){const n=await gt(`${Qf}/${t}`,{method:"PATCH",headers:Tt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function LOe(t){const e=await gt(`${Qf}/${t}`,{method:"DELETE",headers:Tt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function BOe(){const t=await gt(`${Qf}/stats/summary`,{headers:Tt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function FOe(t){const e=await gt(`${Qf}/batch/delete`,{method:"POST",headers:Tt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function qOe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(1),[c,d]=b.useState(20),[h,m]=b.useState(""),[g,x]=b.useState(void 0),[y,w]=b.useState(void 0),[S,k]=b.useState(null),[j,N]=b.useState(!1),[T,E]=b.useState(!1),[_,A]=b.useState(null),[D,q]=b.useState({total:0,known:0,unknown:0,platforms:{}}),[B,H]=b.useState(new Set),[W,ee]=b.useState(!1),[I,V]=b.useState(""),{toast:L}=Lr(),$=async()=>{try{r(!0);const re=await POe({page:a,page_size:c,search:h||void 0,is_known:g,platform:y});e(re.data),i(re.total)}catch(re){L({title:"加载失败",description:re instanceof Error?re.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},K=async()=>{try{const re=await BOe();re?.data&&q(re.data)}catch(re){console.error("加载统计数据失败:",re)}};b.useEffect(()=>{$(),K()},[a,c,h,g,y]);const Y=async re=>{try{const ae=await zOe(re.person_id);k(ae.data),N(!0)}catch(ae){L({title:"加载详情失败",description:ae instanceof Error?ae.message:"无法加载人物详情",variant:"destructive"})}},R=re=>{k(re),E(!0)},ie=async re=>{try{await LOe(re.person_id),L({title:"删除成功",description:`已删除人物信息: ${re.person_name||re.nickname||re.user_id}`}),A(null),$(),K()}catch(ae){L({title:"删除失败",description:ae instanceof Error?ae.message:"无法删除人物信息",variant:"destructive"})}},X=b.useMemo(()=>Object.keys(D.platforms),[D.platforms]),z=re=>{const ae=new Set(B);ae.has(re)?ae.delete(re):ae.add(re),H(ae)},U=()=>{B.size===t.length&&t.length>0?H(new Set):H(new Set(t.map(re=>re.person_id)))},te=()=>{if(B.size===0){L({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ee(!0)},ne=async()=>{try{const re=await FOe(Array.from(B));L({title:"批量删除完成",description:re.message}),H(new Set),ee(!1),$(),K()}catch(re){L({title:"批量删除失败",description:re instanceof Error?re.message:"批量删除失败",variant:"destructive"})}},G=()=>{const re=parseInt(I),ae=Math.ceil(s/c);re>=1&&re<=ae?(l(re),V("")):L({title:"无效的页码",description:`请输入1-${ae}之间的页码`,variant:"destructive"})},se=re=>re?new Date(re*1e3).toLocaleString("zh-CN"):"-";return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsx("div",{className:"mb-4 sm:mb-6",children:o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[o.jsx(nte,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),o.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),o.jsx(pn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),o.jsx("div",{className:"text-2xl font-bold mt-1",children:D.total})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:D.known})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:D.unknown})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[o.jsxs("div",{className:"sm:col-span-2",children:[o.jsx(he,{htmlFor:"search",children:"搜索"}),o.jsxs("div",{className:"relative mt-1.5",children:[o.jsx(ii,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:h,onChange:re=>m(re.target.value),className:"pl-9"})]})]}),o.jsxs("div",{children:[o.jsx(he,{htmlFor:"filter-known",children:"认识状态"}),o.jsxs(Vt,{value:g===void 0?"all":g.toString(),onValueChange:re=>{x(re==="all"?void 0:re==="true"),l(1)},children:[o.jsx($t,{id:"filter-known",className:"mt-1.5",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部"}),o.jsx(De,{value:"true",children:"已认识"}),o.jsx(De,{value:"false",children:"未认识"})]})]})]}),o.jsxs("div",{children:[o.jsx(he,{htmlFor:"filter-platform",children:"平台"}),o.jsxs(Vt,{value:y||"all",onValueChange:re=>{w(re==="all"?void 0:re),l(1)},children:[o.jsx($t,{id:"filter-platform",className:"mt-1.5",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部平台"}),X.map(re=>o.jsxs(De,{value:re,children:[re," (",D.platforms[re],")"]},re))]})]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[o.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:B.size>0&&o.jsxs("span",{children:["已选择 ",B.size," 个人物"]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Vt,{value:c.toString(),onValueChange:re=>{d(parseInt(re)),l(1),H(new Set)},children:[o.jsx($t,{id:"page-size",className:"w-20",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"10",children:"10"}),o.jsx(De,{value:"20",children:"20"}),o.jsx(De,{value:"50",children:"50"}),o.jsx(De,{value:"100",children:"100"})]})]}),B.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>H(new Set),children:"取消选择"}),o.jsxs(ue,{variant:"destructive",size:"sm",onClick:te,children:[o.jsx(Cn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card",children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(Af,{children:[o.jsx(Mf,{children:o.jsxs(zs,{children:[o.jsx(mn,{className:"w-12",children:o.jsx(Ci,{checked:t.length>0&&B.size===t.length,onCheckedChange:U,"aria-label":"全选"})}),o.jsx(mn,{children:"状态"}),o.jsx(mn,{children:"名称"}),o.jsx(mn,{children:"昵称"}),o.jsx(mn,{children:"平台"}),o.jsx(mn,{children:"用户ID"}),o.jsx(mn,{children:"最后更新"}),o.jsx(mn,{className:"text-right",children:"操作"})]})}),o.jsx(Rf,{children:n?o.jsx(zs,{children:o.jsx(Yt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?o.jsx(zs,{children:o.jsx(Yt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(re=>o.jsxs(zs,{children:[o.jsx(Yt,{children:o.jsx(Ci,{checked:B.has(re.person_id),onCheckedChange:()=>z(re.person_id),"aria-label":`选择 ${re.person_name||re.nickname||re.user_id}`})}),o.jsx(Yt,{children:o.jsx("div",{className:xe("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"})}),o.jsx(Yt,{className:"font-medium",children:re.person_name||o.jsx("span",{className:"text-muted-foreground",children:"-"})}),o.jsx(Yt,{children:re.nickname||"-"}),o.jsx(Yt,{children:re.platform}),o.jsx(Yt,{className:"font-mono text-sm",children:re.user_id}),o.jsx(Yt,{className:"text-sm text-muted-foreground",children:se(re.last_know)}),o.jsx(Yt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(ue,{variant:"default",size:"sm",onClick:()=>Y(re),children:[o.jsx(Ji,{className:"h-4 w-4 mr-1"}),"详情"]}),o.jsxs(ue,{variant:"default",size:"sm",onClick:()=>R(re),children:[o.jsx(F0,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsxs(ue,{size:"sm",onClick:()=>A(re),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(Cn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},re.id))})]})}),o.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(re=>o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Ci,{checked:B.has(re.person_id),onCheckedChange:()=>z(re.person_id),className:"mt-1"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:xe("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"}),o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:re.person_name||o.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),re.nickname&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",re.nickname]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),o.jsx("p",{className:"font-medium text-xs",children:re.platform})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),o.jsx("p",{className:"font-mono text-xs truncate",title:re.user_id,children:re.user_id})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),o.jsx("p",{className:"text-xs",children:se(re.last_know)})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>Y(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(Ji,{className:"h-3 w-3 mr-1"}),"查看"]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>R(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(F0,{className:"h-3 w-3 mr-1"}),"编辑"]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>A(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[o.jsx(Cn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},re.id))}),s>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(Ip,{className:"h-4 w-4"})}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>l(a-1),disabled:a===1,children:[o.jsx(wd,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:I,onChange:re=>V(re.target.value),onKeyDown:re=>re.key==="Enter"&&G(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),o.jsx(ue,{variant:"outline",size:"sm",onClick:G,disabled:!I,className:"h-8",children:"跳转"})]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>l(a+1),disabled:a>=Math.ceil(s/c),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Zl,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:o.jsx(Lp,{className:"h-4 w-4"})})]})]})]})]})}),o.jsx($Oe,{person:S,open:j,onOpenChange:N}),o.jsx(HOe,{person:S,open:T,onOpenChange:E,onSuccess:()=>{$(),K(),E(!1)}}),o.jsx(Fn,{open:!!_,onOpenChange:()=>A(null),children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认删除"}),o.jsxs(zn,{children:['确定要删除人物信息 "',_?.person_name||_?.nickname||_?.user_id,'" 吗? 此操作不可撤销。']})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:()=>_&&ie(_),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),o.jsx(Fn,{open:W,onOpenChange:ee,children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"确认批量删除"}),o.jsxs(zn,{children:["确定要删除选中的 ",B.size," 个人物信息吗? 此操作不可撤销。"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{children:"取消"}),o.jsx(In,{onClick:ne,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function $Oe({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return o.jsx(Er,{open:e,onOpenChange:n,children:o.jsxs(wr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"人物详情"}),o.jsxs(Xr,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(kl,{icon:Lv,label:"人物名称",value:t.person_name}),o.jsx(kl,{icon:Gh,label:"昵称",value:t.nickname}),o.jsx(kl,{icon:lk,label:"用户ID",value:t.user_id,mono:!0}),o.jsx(kl,{icon:lk,label:"人物ID",value:t.person_id,mono:!0}),o.jsx(kl,{label:"平台",value:t.platform}),o.jsx(kl,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(he,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),o.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(he,{className:"text-xs text-muted-foreground",children:"个人印象"}),o.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(he,{className:"text-xs text-muted-foreground",children:"群昵称"}),o.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>o.jsxs("div",{className:"text-sm flex items-center gap-2",children:[o.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),o.jsx("span",{children:"→"}),o.jsx("span",{children:s.group_nick_name})]},i))})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[o.jsx(kl,{icon:Mh,label:"认识时间",value:r(t.know_times)}),o.jsx(kl,{icon:Mh,label:"首次记录",value:r(t.know_since)}),o.jsx(kl,{icon:Mh,label:"最后更新",value:r(t.last_know)})]})]}),o.jsx(fs,{children:o.jsx(ue,{onClick:()=>n(!1),children:"关闭"})})]})})}function kl({icon:t,label:e,value:n,mono:r=!1}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(he,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&o.jsx(t,{className:"h-3 w-3"}),e]}),o.jsx("div",{className:xe("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function HOe({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState({}),[a,l]=b.useState(!1),{toast:c}=Lr();b.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const d=async()=>{if(t)try{l(!0),await IOe(t.person_id,s),c({title:"保存成功",description:"人物信息已更新"}),r()}catch(h){c({title:"保存失败",description:h instanceof Error?h.message:"无法更新人物信息",variant:"destructive"})}finally{l(!1)}};return t?o.jsx(Er,{open:e,onOpenChange:n,children:o.jsxs(wr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"编辑人物信息"}),o.jsxs(Xr,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"person_name",children:"人物名称"}),o.jsx(Pe,{id:"person_name",value:s.person_name||"",onChange:h=>i({...s,person_name:h.target.value}),placeholder:"为这个人设置一个名称"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"nickname",children:"昵称"}),o.jsx(Pe,{id:"nickname",value:s.nickname||"",onChange:h=>i({...s,nickname:h.target.value}),placeholder:"昵称"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"name_reason",children:"名称设定原因"}),o.jsx(Nr,{id:"name_reason",value:s.name_reason||"",onChange:h=>i({...s,name_reason:h.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"memory_points",children:"个人印象"}),o.jsx(Nr,{id:"memory_points",value:s.memory_points||"",onChange:h=>i({...s,memory_points:h.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),o.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[o.jsxs("div",{children:[o.jsx(he,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),o.jsx(Ft,{id:"is_known",checked:s.is_known,onCheckedChange:h=>i({...s,is_known:h})})]})]}),o.jsxs(fs,{children:[o.jsx(ue,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(ue,{onClick:d,disabled:a,children:a?"保存中...":"保存"})]})]})}):null}function Ls(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n{let e;const n=new Set,r=(h,m)=>{const g=typeof h=="function"?h(e):h;if(!Object.is(g,e)){const x=e;e=m??(typeof g!="object"||g===null)?g:Object.assign({},e,g),n.forEach(y=>y(e,x))}},s=()=>e,c={setState:r,getState:s,getInitialState:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(QOe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=e=t(r,s,c);return c},VOe=t=>t?iD(t):iD,{useDebugValue:UOe}=oe,{useSyncExternalStoreWithSelector:WOe}=yJ,GOe=t=>t;function tW(t,e=GOe,n){const r=WOe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return UOe(r),r}const aD=(t,e)=>{const n=VOe(t),r=(s,i=e)=>tW(n,s,i);return Object.assign(r,n),r},XOe=(t,e)=>t?aD(t,e):aD;function ks(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,s]of t)if(!Object.is(s,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}var YOe={value:()=>{}};function Zb(){for(var t=0,e=arguments.length,n={},r;t=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}_v.prototype=Zb.prototype={constructor:_v,on:function(t,e){var n=this._,r=KOe(t+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),lD.hasOwnProperty(e)?{space:lD[e],local:t}:t}function JOe(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===ZO&&e.documentElement.namespaceURI===ZO?e.createElement(t):e.createElementNS(n,t)}}function eje(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function nW(t){var e=Jb(t);return(e.local?eje:JOe)(e)}function tje(){}function KN(t){return t==null?tje:function(){return this.querySelector(t)}}function nje(t){typeof t!="function"&&(t=KN(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s=N&&(N=j+1);!(E=S[N])&&++N=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function Cje(t){t||(t=Tje);function e(m,g){return m&&g?t(m.__data__,g.__data__):!m-!g}for(var n=this._groups,r=n.length,s=new Array(r),i=0;ie?1:t>=e?0:NaN}function Eje(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function _je(){return Array.from(this)}function Aje(){for(var t=this._groups,e=0,n=t.length;e1?this.each((e==null?$je:typeof e=="function"?Qje:Hje)(t,e,n??"")):mf(this.node(),t)}function mf(t,e){return t.style.getPropertyValue(e)||oW(t).getComputedStyle(t,null).getPropertyValue(e)}function Uje(t){return function(){delete this[t]}}function Wje(t,e){return function(){this[t]=e}}function Gje(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Xje(t,e){return arguments.length>1?this.each((e==null?Uje:typeof e=="function"?Gje:Wje)(t,e)):this.node()[t]}function lW(t){return t.trim().split(/^|\s+/)}function ZN(t){return t.classList||new cW(t)}function cW(t){this._node=t,this._names=lW(t.getAttribute("class")||"")}cW.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function uW(t,e){for(var n=ZN(t),r=-1,s=e.length;++r=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function k6e(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,i;n()=>t;function JO(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,dy:d,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:h}})}JO.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function R6e(t){return!t.ctrlKey&&!t.button}function D6e(){return this.parentNode}function P6e(t,e){return e??{x:t.x,y:t.y}}function z6e(){return navigator.maxTouchPoints||"ontouchstart"in this}function I6e(){var t=R6e,e=D6e,n=P6e,r=z6e,s={},i=Zb("start","drag","end"),a=0,l,c,d,h,m=0;function g(T){T.on("mousedown.drag",x).filter(r).on("touchstart.drag",S).on("touchmove.drag",k,M6e).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(T,E){if(!(h||!t.call(this,T,E))){var _=N(this,e.call(this,T,E),T,E,"mouse");_&&(va(T.view).on("mousemove.drag",y,kp).on("mouseup.drag",w,kp),mW(T.view),d5(T),d=!1,l=T.clientX,c=T.clientY,_("start",T))}}function y(T){if(Qh(T),!d){var E=T.clientX-l,_=T.clientY-c;d=E*E+_*_>m}s.mouse("drag",T)}function w(T){va(T.view).on("mousemove.drag mouseup.drag",null),pW(T.view,d),Qh(T),s.mouse("end",T)}function S(T,E){if(t.call(this,T,E)){var _=T.changedTouches,A=e.call(this,T,E),D=_.length,q,B;for(q=0;q=0&&t._call.call(void 0,e),t=t._next;--pf}function cD(){xd=(Dy=Op.now())+ew,pf=m0=0;try{B6e()}finally{pf=0,q6e(),xd=0}}function F6e(){var t=Op.now(),e=t-Dy;e>gW&&(ew-=e,Dy=t)}function q6e(){for(var t,e=Ry,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ry=n);p0=t,ej(r)}function ej(t){if(!pf){m0&&(m0=clearTimeout(m0));var e=t-xd;e>24?(t<1/0&&(m0=setTimeout(cD,t-Op.now()-ew)),n0&&(n0=clearInterval(n0))):(n0||(Dy=Op.now(),n0=setInterval(F6e,gW)),pf=1,xW(cD))}}function uD(t,e,n){var r=new Py;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var $6e=Zb("start","end","cancel","interrupt"),H6e=[],yW=0,dD=1,tj=2,Av=3,hD=4,nj=5,Mv=6;function tw(t,e,n,r,s,i){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;Q6e(t,n,{name:e,index:r,group:s,on:$6e,tween:H6e,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:yW})}function e7(t,e){var n=oo(t,e);if(n.state>yW)throw new Error("too late; already scheduled");return n}function Ko(t,e){var n=oo(t,e);if(n.state>Av)throw new Error("too late; already running");return n}function oo(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Q6e(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=vW(i,0,n.time);function i(d){n.state=dD,n.timer.restart(a,n.delay,n.time),n.delay<=d&&a(d-n.delay)}function a(d){var h,m,g,x;if(n.state!==dD)return c();for(h in r)if(x=r[h],x.name===n.name){if(x.state===Av)return uD(a);x.state===hD?(x.state=Mv,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete r[h]):+htj&&r.state=0&&(e=e.slice(0,n)),!e||e==="start"})}function bNe(t,e,n){var r,s,i=yNe(e)?e7:Ko;return function(){var a=i(this,t),l=a.on;l!==r&&(s=(r=l).copy()).on(e,n),a.on=s}}function wNe(t,e){var n=this._id;return arguments.length<2?oo(this.node(),n).on.on(t):this.each(bNe(n,t,e))}function SNe(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function kNe(){return this.on("end.remove",SNe(this._id))}function ONe(t){var e=this._name,n=this._id;typeof t!="function"&&(t=KN(t));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>t;function XNe(t,{sourceEvent:e,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function zl(t,e,n){this.k=t,this.x=e,this.y=n}zl.prototype={constructor:zl,scale:function(t){return t===1?this:new zl(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new zl(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $l=new zl(1,0,0);zl.prototype;function h5(t){t.stopImmediatePropagation()}function r0(t){t.preventDefault(),t.stopImmediatePropagation()}function YNe(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function KNe(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function fD(){return this.__zoom||$l}function ZNe(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function JNe(){return navigator.maxTouchPoints||"ontouchstart"in this}function e7e(t,e,n){var r=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function kW(){var t=YNe,e=KNe,n=e7e,r=ZNe,s=JNe,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=$J,d=Zb("start","zoom","end"),h,m,g,x=500,y=150,w=0,S=10;function k(I){I.property("__zoom",fD).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",q).on("dblclick.zoom",B).filter(s).on("touchstart.zoom",H).on("touchmove.zoom",W).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(I,V,L,$){var K=I.selection?I.selection():I;K.property("__zoom",fD),I!==K?E(I,V,L,$):K.interrupt().each(function(){_(this,arguments).event($).start().zoom(null,typeof V=="function"?V.apply(this,arguments):V).end()})},k.scaleBy=function(I,V,L,$){k.scaleTo(I,function(){var K=this.__zoom.k,Y=typeof V=="function"?V.apply(this,arguments):V;return K*Y},L,$)},k.scaleTo=function(I,V,L,$){k.transform(I,function(){var K=e.apply(this,arguments),Y=this.__zoom,R=L==null?T(K):typeof L=="function"?L.apply(this,arguments):L,ie=Y.invert(R),X=typeof V=="function"?V.apply(this,arguments):V;return n(N(j(Y,X),R,ie),K,a)},L,$)},k.translateBy=function(I,V,L,$){k.transform(I,function(){return n(this.__zoom.translate(typeof V=="function"?V.apply(this,arguments):V,typeof L=="function"?L.apply(this,arguments):L),e.apply(this,arguments),a)},null,$)},k.translateTo=function(I,V,L,$,K){k.transform(I,function(){var Y=e.apply(this,arguments),R=this.__zoom,ie=$==null?T(Y):typeof $=="function"?$.apply(this,arguments):$;return n($l.translate(ie[0],ie[1]).scale(R.k).translate(typeof V=="function"?-V.apply(this,arguments):-V,typeof L=="function"?-L.apply(this,arguments):-L),Y,a)},$,K)};function j(I,V){return V=Math.max(i[0],Math.min(i[1],V)),V===I.k?I:new zl(V,I.x,I.y)}function N(I,V,L){var $=V[0]-L[0]*I.k,K=V[1]-L[1]*I.k;return $===I.x&&K===I.y?I:new zl(I.k,$,K)}function T(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function E(I,V,L,$){I.on("start.zoom",function(){_(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event($).end()}).tween("zoom",function(){var K=this,Y=arguments,R=_(K,Y).event($),ie=e.apply(K,Y),X=L==null?T(ie):typeof L=="function"?L.apply(K,Y):L,z=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),U=K.__zoom,te=typeof V=="function"?V.apply(K,Y):V,ne=c(U.invert(X).concat(z/U.k),te.invert(X).concat(z/te.k));return function(G){if(G===1)G=te;else{var se=ne(G),re=z/se[2];G=new zl(re,X[0]-se[0]*re,X[1]-se[1]*re)}R.zoom(null,G)}})}function _(I,V,L){return!L&&I.__zooming||new A(I,V)}function A(I,V){this.that=I,this.args=V,this.active=0,this.sourceEvent=null,this.extent=e.apply(I,V),this.taps=0}A.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,V){return this.mouse&&I!=="mouse"&&(this.mouse[1]=V.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=V.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=V.invert(this.touch1[0])),this.that.__zoom=V,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var V=va(this.that).datum();d.call(I,this.that,new XNe(I,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:d}),V)}};function D(I,...V){if(!t.apply(this,arguments))return;var L=_(this,V).event(I),$=this.__zoom,K=Math.max(i[0],Math.min(i[1],$.k*Math.pow(2,r.apply(this,arguments)))),Y=Qa(I);if(L.wheel)(L.mouse[0][0]!==Y[0]||L.mouse[0][1]!==Y[1])&&(L.mouse[1]=$.invert(L.mouse[0]=Y)),clearTimeout(L.wheel);else{if($.k===K)return;L.mouse=[Y,$.invert(Y)],Rv(this),L.start()}r0(I),L.wheel=setTimeout(R,y),L.zoom("mouse",n(N(j($,K),L.mouse[0],L.mouse[1]),L.extent,a));function R(){L.wheel=null,L.end()}}function q(I,...V){if(g||!t.apply(this,arguments))return;var L=I.currentTarget,$=_(this,V,!0).event(I),K=va(I.view).on("mousemove.zoom",X,!0).on("mouseup.zoom",z,!0),Y=Qa(I,L),R=I.clientX,ie=I.clientY;mW(I.view),h5(I),$.mouse=[Y,this.__zoom.invert(Y)],Rv(this),$.start();function X(U){if(r0(U),!$.moved){var te=U.clientX-R,ne=U.clientY-ie;$.moved=te*te+ne*ne>w}$.event(U).zoom("mouse",n(N($.that.__zoom,$.mouse[0]=Qa(U,L),$.mouse[1]),$.extent,a))}function z(U){K.on("mousemove.zoom mouseup.zoom",null),pW(U.view,$.moved),r0(U),$.event(U).end()}}function B(I,...V){if(t.apply(this,arguments)){var L=this.__zoom,$=Qa(I.changedTouches?I.changedTouches[0]:I,this),K=L.invert($),Y=L.k*(I.shiftKey?.5:2),R=n(N(j(L,Y),$,K),e.apply(this,V),a);r0(I),l>0?va(this).transition().duration(l).call(E,R,$,I):va(this).call(k.transform,R,$,I)}}function H(I,...V){if(t.apply(this,arguments)){var L=I.touches,$=L.length,K=_(this,V,I.changedTouches.length===$).event(I),Y,R,ie,X;for(h5(I),R=0;R<$;++R)ie=L[R],X=Qa(ie,this),X=[X,this.__zoom.invert(X),ie.identifier],K.touch0?!K.touch1&&K.touch0[2]!==X[2]&&(K.touch1=X,K.taps=0):(K.touch0=X,Y=!0,K.taps=1+!!h);h&&(h=clearTimeout(h)),Y&&(K.taps<2&&(m=X[0],h=setTimeout(function(){h=null},x)),Rv(this),K.start())}}function W(I,...V){if(this.__zooming){var L=_(this,V).event(I),$=I.changedTouches,K=$.length,Y,R,ie,X;for(r0(I),Y=0;Y"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},OW=Yl.error001();function gr(t,e){const n=b.useContext(nw);if(n===null)throw new Error(OW);return tW(n,t,e)}const gs=()=>{const t=b.useContext(nw);if(t===null)throw new Error(OW);return b.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},n7e=t=>t.userSelectionActive?"none":"all";function rw({position:t,children:e,className:n,style:r,...s}){const i=gr(n7e),a=`${t}`.split("-");return oe.createElement("div",{className:Ls(["react-flow__panel",n,...a]),style:{...r,pointerEvents:i},...s},e)}function r7e({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:oe.createElement(rw,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},oe.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const s7e=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...h})=>{const m=b.useRef(null),[g,x]=b.useState({x:0,y:0,width:0,height:0}),y=Ls(["react-flow__edge-textwrapper",d]);return b.useEffect(()=>{if(m.current){const w=m.current.getBBox();x({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),typeof n>"u"||!n?null:oe.createElement("g",{transform:`translate(${t-g.width/2} ${e-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...h},s&&oe.createElement("rect",{width:g.width+2*a[0],x:-a[0],y:-a[1],height:g.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),oe.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:m,style:r},n),c)};var i7e=b.memo(s7e);const n7=t=>({width:t.offsetWidth,height:t.offsetHeight}),gf=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),r7=(t={x:0,y:0},e)=>({x:gf(t.x,e[0][0],e[1][0]),y:gf(t.y,e[0][1],e[1][1])}),mD=(t,e,n)=>tn?-gf(Math.abs(t-n),1,50)/50:0,jW=(t,e)=>{const n=mD(t.x,35,e.width-35)*20,r=mD(t.y,35,e.height-35)*20;return[n,r]},NW=t=>t.getRootNode?.()||window?.document,CW=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),jp=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),TW=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),pD=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),a7e=(t,e)=>TW(CW(jp(t),jp(e))),rj=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},o7e=t=>Ca(t.width)&&Ca(t.height)&&Ca(t.x)&&Ca(t.y),Ca=t=>!isNaN(t)&&isFinite(t),$r=Symbol.for("internals"),EW=["Enter"," ","Escape"],l7e=(t,e)=>{},c7e=t=>"nativeEvent"in t;function sj(t){const n=(c7e(t)?t.nativeEvent:t).composedPath?.()?.[0]||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n?.nodeName)||n?.hasAttribute("contenteditable")||!!n?.closest(".nokey")}const _W=t=>"clientX"in t,Wc=(t,e)=>{const n=_W(t),r=n?t.clientX:t.touches?.[0].clientX,s=n?t.clientY:t.touches?.[0].clientY;return{x:r-(e?.left??0),y:s-(e?.top??0)}},zy=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,kg=({id:t,path:e,labelX:n,labelY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:m,markerStart:g,interactionWidth:x=20})=>oe.createElement(oe.Fragment,null,oe.createElement("path",{id:t,style:h,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:g}),x&&oe.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),s&&Ca(n)&&Ca(r)?oe.createElement(i7e,{x:n,y:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d}):null);kg.displayName="BaseEdge";function s0(t,e,n){return n===void 0?n:r=>{const s=e().edges.find(i=>i.id===t);s&&n(r,{...s})}}function AW({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,i=n{const[S,k,j]=RW({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i});return oe.createElement(kg,{path:S,labelX:k,labelY:j,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:w})});s7.displayName="SimpleBezierEdge";const xD={[kt.Left]:{x:-1,y:0},[kt.Right]:{x:1,y:0},[kt.Top]:{x:0,y:-1},[kt.Bottom]:{x:0,y:1}},u7e=({source:t,sourcePosition:e=kt.Bottom,target:n})=>e===kt.Left||e===kt.Right?t.xMath.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function d7e({source:t,sourcePosition:e=kt.Bottom,target:n,targetPosition:r=kt.Top,center:s,offset:i}){const a=xD[e],l=xD[r],c={x:t.x+a.x*i,y:t.y+a.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},h=u7e({source:c,sourcePosition:e,target:d}),m=h.x!==0?"x":"y",g=h[m];let x=[],y,w;const S={x:0,y:0},k={x:0,y:0},[j,N,T,E]=AW({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[m]*l[m]===-1){y=s.x??j,w=s.y??N;const A=[{x:y,y:c.y},{x:y,y:d.y}],D=[{x:c.x,y:w},{x:d.x,y:w}];a[m]===g?x=m==="x"?A:D:x=m==="x"?D:A}else{const A=[{x:c.x,y:d.y}],D=[{x:d.x,y:c.y}];if(m==="x"?x=a.x===g?D:A:x=a.y===g?A:D,e===r){const ee=Math.abs(t[m]-n[m]);if(ee<=i){const I=Math.min(i-1,i-ee);a[m]===g?S[m]=(c[m]>t[m]?-1:1)*I:k[m]=(d[m]>n[m]?-1:1)*I}}if(e!==r){const ee=m==="x"?"y":"x",I=a[m]===l[ee],V=c[ee]>d[ee],L=c[ee]=W?(y=(q.x+B.x)/2,w=x[0].y):(y=x[0].x,w=(q.y+B.y)/2)}return[[t,{x:c.x+S.x,y:c.y+S.y},...x,{x:d.x+k.x,y:d.y+k.y},n],y,w,T,E]}function h7e(t,e,n,r){const s=Math.min(vD(t,e)/2,vD(e,n)/2,r),{x:i,y:a}=e;if(t.x===i&&i===n.x||t.y===a&&a===n.y)return`L${i} ${a}`;if(t.y===a){const d=t.x{let N="";return j>0&&j{const[k,j,N]=ij({sourceX:t,sourceY:e,sourcePosition:m,targetX:n,targetY:r,targetPosition:g,borderRadius:w?.borderRadius,offset:w?.offset});return oe.createElement(kg,{path:k,labelX:j,labelY:N,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:x,markerStart:y,interactionWidth:S})});sw.displayName="SmoothStepEdge";const i7=b.memo(t=>oe.createElement(sw,{...t,pathOptions:b.useMemo(()=>({borderRadius:0,offset:t.pathOptions?.offset}),[t.pathOptions?.offset])}));i7.displayName="StepEdge";function f7e({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,i,a,l]=AW({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,i,a,l]}const a7=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:m,markerStart:g,interactionWidth:x})=>{const[y,w,S]=f7e({sourceX:t,sourceY:e,targetX:n,targetY:r});return oe.createElement(kg,{path:y,labelX:w,labelY:S,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,style:h,markerEnd:m,markerStart:g,interactionWidth:x})});a7.displayName="StraightEdge";function W1(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function yD({pos:t,x1:e,y1:n,x2:r,y2:s,c:i}){switch(t){case kt.Left:return[e-W1(e-r,i),n];case kt.Right:return[e+W1(r-e,i),n];case kt.Top:return[e,n-W1(n-s,i)];case kt.Bottom:return[e,n+W1(s-n,i)]}}function DW({sourceX:t,sourceY:e,sourcePosition:n=kt.Bottom,targetX:r,targetY:s,targetPosition:i=kt.Top,curvature:a=.25}){const[l,c]=yD({pos:n,x1:t,y1:e,x2:r,y2:s,c:a}),[d,h]=yD({pos:i,x1:r,y1:s,x2:t,y2:e,c:a}),[m,g,x,y]=MW({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${t},${e} C${l},${c} ${d},${h} ${r},${s}`,m,g,x,y]}const Ly=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=kt.Bottom,targetPosition:i=kt.Top,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,pathOptions:w,interactionWidth:S})=>{const[k,j,N]=DW({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:w?.curvature});return oe.createElement(kg,{path:k,labelX:j,labelY:N,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:S})});Ly.displayName="BezierEdge";const o7=b.createContext(null),m7e=o7.Provider;o7.Consumer;const p7e=()=>b.useContext(o7),g7e=t=>"id"in t&&"source"in t&&"target"in t,x7e=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,aj=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,v7e=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),y7e=(t,e)=>{if(!t.source||!t.target)return e;let n;return g7e(t)?n={...t}:n={...t,id:x7e(t)},v7e(n,e)?e:e.concat(n)},oj=({x:t,y:e},[n,r,s],i,[a,l])=>{const c={x:(t-n)/s,y:(e-r)/s};return i?{x:a*Math.round(c.x/a),y:l*Math.round(c.y/l)}:c},PW=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r}),id=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],r=(t.height??0)*e[1],s={x:t.position.x-n,y:t.position.y-r};return{...s,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-r}:s}},iw=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,s)=>{const{x:i,y:a}=id(s,e).positionAbsolute;return CW(r,jp({x:i,y:a,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return TW(n)},zW=(t,e,[n,r,s]=[0,0,1],i=!1,a=!1,l=[0,0])=>{const c={x:(e.x-n)/s,y:(e.y-r)/s,width:e.width/s,height:e.height/s},d=[];return t.forEach(h=>{const{width:m,height:g,selectable:x=!0,hidden:y=!1}=h;if(a&&!x||y)return!1;const{positionAbsolute:w}=id(h,l),S={x:w.x,y:w.y,width:m||0,height:g||0},k=rj(c,S),j=typeof m>"u"||typeof g>"u"||m===null||g===null,N=i&&k>0,T=(m||0)*(g||0);(j||N||k>=T||h.dragging)&&d.push(h)}),d},IW=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},LW=(t,e,n,r,s,i=.1)=>{const a=e/(t.width*(1+i)),l=n/(t.height*(1+i)),c=Math.min(a,l),d=gf(c,r,s),h=t.x+t.width/2,m=t.y+t.height/2,g=e/2-h*d,x=n/2-m*d;return{x:g,y:x,zoom:d}},qu=(t,e=0)=>t.transition().duration(e);function bD(t,e,n,r){return(e[n]||[]).reduce((s,i)=>(`${t.id}-${i.id}-${n}`!==r&&s.push({id:i.id||null,type:n,nodeId:t.id,x:(t.positionAbsolute?.x??0)+i.x+i.width/2,y:(t.positionAbsolute?.y??0)+i.y+i.height/2}),s),[])}function b7e(t,e,n,r,s,i){const{x:a,y:l}=Wc(t),d=e.elementsFromPoint(a,l).find(y=>y.classList.contains("react-flow__handle"));if(d){const y=d.getAttribute("data-nodeid");if(y){const w=l7(void 0,d),S=d.getAttribute("data-handleid"),k=i({nodeId:y,id:S,type:w});if(k){const j=s.find(N=>N.nodeId===y&&N.type===w&&N.id===S);return{handle:{id:S,type:w,nodeId:y,x:j?.x||n.x,y:j?.y||n.y},validHandleResult:k}}}}let h=[],m=1/0;if(s.forEach(y=>{const w=Math.sqrt((y.x-n.x)**2+(y.y-n.y)**2);if(w<=r){const S=i(y);w<=m&&(wy.isValid),x=h.some(({handle:y})=>y.type==="target");return h.find(({handle:y,validHandleResult:w})=>x?y.type==="target":g?w.isValid:!0)||h[0]}const w7e={source:null,target:null,sourceHandle:null,targetHandle:null},BW=()=>({handleDomNode:null,isValid:!1,connection:w7e,endHandle:null});function FW(t,e,n,r,s,i,a){const l=s==="target",c=a.querySelector(`.react-flow__handle[data-id="${t?.nodeId}-${t?.id}-${t?.type}"]`),d={...BW(),handleDomNode:c};if(c){const h=l7(void 0,c),m=c.getAttribute("data-nodeid"),g=c.getAttribute("data-handleid"),x=c.classList.contains("connectable"),y=c.classList.contains("connectableend"),w={source:l?m:n,sourceHandle:l?g:r,target:l?n:m,targetHandle:l?r:g};d.connection=w,x&&y&&(e===vd.Strict?l&&h==="source"||!l&&h==="target":m!==n||g!==r)&&(d.endHandle={nodeId:m,handleId:g,type:h},d.isValid=i(w))}return d}function S7e({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((s,i)=>{if(i[$r]){const{handleBounds:a}=i[$r];let l=[],c=[];a&&(l=bD(i,a,"source",`${e}-${n}-${r}`),c=bD(i,a,"target",`${e}-${n}-${r}`)),s.push(...l,...c)}return s},[])}function l7(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function f5(t){t?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function k7e(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function qW({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:s,getState:i,setState:a,isValidConnection:l,edgeUpdaterType:c,onReconnectEnd:d}){const h=NW(t.target),{connectionMode:m,domNode:g,autoPanOnConnect:x,connectionRadius:y,onConnectStart:w,panBy:S,getNodes:k,cancelConnection:j}=i();let N=0,T;const{x:E,y:_}=Wc(t),A=h?.elementFromPoint(E,_),D=l7(c,A),q=g?.getBoundingClientRect();if(!q||!D)return;let B,H=Wc(t,q),W=!1,ee=null,I=!1,V=null;const L=S7e({nodes:k(),nodeId:n,handleId:e,handleType:D}),$=()=>{if(!x)return;const[R,ie]=jW(H,q);S({x:R,y:ie}),N=requestAnimationFrame($)};a({connectionPosition:H,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:D,connectionStartHandle:{nodeId:n,handleId:e,type:D},connectionEndHandle:null}),w?.(t,{nodeId:n,handleId:e,handleType:D});function K(R){const{transform:ie}=i();H=Wc(R,q);const{handle:X,validHandleResult:z}=b7e(R,h,oj(H,ie,!1,[1,1]),y,L,U=>FW(U,m,n,e,s?"target":"source",l,h));if(T=X,W||($(),W=!0),V=z.handleDomNode,ee=z.connection,I=z.isValid,a({connectionPosition:T&&I?PW({x:T.x,y:T.y},ie):H,connectionStatus:k7e(!!T,I),connectionEndHandle:z.endHandle}),!T&&!I&&!V)return f5(B);ee.source!==ee.target&&V&&(f5(B),B=V,V.classList.add("connecting","react-flow__handle-connecting"),V.classList.toggle("valid",I),V.classList.toggle("react-flow__handle-valid",I))}function Y(R){(T||V)&&ee&&I&&r?.(ee),i().onConnectEnd?.(R),c&&d?.(R),f5(B),j(),cancelAnimationFrame(N),W=!1,I=!1,ee=null,V=null,h.removeEventListener("mousemove",K),h.removeEventListener("mouseup",Y),h.removeEventListener("touchmove",K),h.removeEventListener("touchend",Y)}h.addEventListener("mousemove",K),h.addEventListener("mouseup",Y),h.addEventListener("touchmove",K),h.addEventListener("touchend",Y)}const wD=()=>!0,O7e=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),j7e=(t,e,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:i,connectionClickStartHandle:a}=r;return{connecting:s?.nodeId===t&&s?.handleId===e&&s?.type===n||i?.nodeId===t&&i?.handleId===e&&i?.type===n,clickConnecting:a?.nodeId===t&&a?.handleId===e&&a?.type===n}},$W=b.forwardRef(({type:t="source",position:e=kt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:d,onMouseDown:h,onTouchStart:m,...g},x)=>{const y=a||null,w=t==="target",S=gs(),k=p7e(),{connectOnClick:j,noPanClassName:N}=gr(O7e,ks),{connecting:T,clickConnecting:E}=gr(j7e(k,y,t),ks);k||S.getState().onError?.("010",Yl.error010());const _=q=>{const{defaultEdgeOptions:B,onConnect:H,hasDefaultEdges:W}=S.getState(),ee={...B,...q};if(W){const{edges:I,setEdges:V}=S.getState();V(y7e(ee,I))}H?.(ee),l?.(ee)},A=q=>{if(!k)return;const B=_W(q);s&&(B&&q.button===0||!B)&&qW({event:q,handleId:y,nodeId:k,onConnect:_,isTarget:w,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||wD}),B?h?.(q):m?.(q)},D=q=>{const{onClickConnectStart:B,onClickConnectEnd:H,connectionClickStartHandle:W,connectionMode:ee,isValidConnection:I}=S.getState();if(!k||!W&&!s)return;if(!W){B?.(q,{nodeId:k,handleId:y,handleType:t}),S.setState({connectionClickStartHandle:{nodeId:k,type:t,handleId:y}});return}const V=NW(q.target),L=n||I||wD,{connection:$,isValid:K}=FW({nodeId:k,id:y,type:t},ee,W.nodeId,W.handleId||null,W.type,L,V);K&&_($),H?.(q),S.setState({connectionClickStartHandle:null})};return oe.createElement("div",{"data-handleid":y,"data-nodeid":k,"data-handlepos":e,"data-id":`${k}-${y}-${t}`,className:Ls(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",N,d,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:i,connecting:E,connectionindicator:r&&(s&&!T||i&&T)}]),onMouseDown:A,onTouchStart:A,onClick:j?D:void 0,ref:x,...g},c)});$W.displayName="Handle";var au=b.memo($W);const HW=({data:t,isConnectable:e,targetPosition:n=kt.Top,sourcePosition:r=kt.Bottom})=>oe.createElement(oe.Fragment,null,oe.createElement(au,{type:"target",position:n,isConnectable:e}),t?.label,oe.createElement(au,{type:"source",position:r,isConnectable:e}));HW.displayName="DefaultNode";var lj=b.memo(HW);const QW=({data:t,isConnectable:e,sourcePosition:n=kt.Bottom})=>oe.createElement(oe.Fragment,null,t?.label,oe.createElement(au,{type:"source",position:n,isConnectable:e}));QW.displayName="InputNode";var VW=b.memo(QW);const UW=({data:t,isConnectable:e,targetPosition:n=kt.Top})=>oe.createElement(oe.Fragment,null,oe.createElement(au,{type:"target",position:n,isConnectable:e}),t?.label);UW.displayName="OutputNode";var WW=b.memo(UW);const c7=()=>null;c7.displayName="GroupNode";const N7e=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),G1=t=>t.id;function C7e(t,e){return ks(t.selectedNodes.map(G1),e.selectedNodes.map(G1))&&ks(t.selectedEdges.map(G1),e.selectedEdges.map(G1))}const GW=b.memo(({onSelectionChange:t})=>{const e=gs(),{selectedNodes:n,selectedEdges:r}=gr(N7e,C7e);return b.useEffect(()=>{const s={nodes:n,edges:r};t?.(s),e.getState().onSelectionChange.forEach(i=>i(s))},[n,r,t]),null});GW.displayName="SelectionListener";const T7e=t=>!!t.onSelectionChange;function E7e({onSelectionChange:t}){const e=gr(T7e);return t||e?oe.createElement(GW,{onSelectionChange:t}):null}const _7e=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function hh(t,e){b.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function on(t,e,n){b.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const A7e=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:i,onConnectEnd:a,onClickConnectStart:l,onClickConnectEnd:c,nodesDraggable:d,nodesConnectable:h,nodesFocusable:m,edgesFocusable:g,edgesUpdatable:x,elevateNodesOnSelect:y,minZoom:w,maxZoom:S,nodeExtent:k,onNodesChange:j,onEdgesChange:N,elementsSelectable:T,connectionMode:E,snapGrid:_,snapToGrid:A,translateExtent:D,connectOnClick:q,defaultEdgeOptions:B,fitView:H,fitViewOptions:W,onNodesDelete:ee,onEdgesDelete:I,onNodeDrag:V,onNodeDragStart:L,onNodeDragStop:$,onSelectionDrag:K,onSelectionDragStart:Y,onSelectionDragStop:R,noPanClassName:ie,nodeOrigin:X,rfId:z,autoPanOnConnect:U,autoPanOnNodeDrag:te,onError:ne,connectionRadius:G,isValidConnection:se,nodeDragThreshold:re})=>{const{setNodes:ae,setEdges:_e,setDefaultNodesAndEdges:Be,setMinZoom:Ye,setMaxZoom:Je,setTranslateExtent:Oe,setNodeExtent:Ve,reset:Ue}=gr(_7e,ks),$e=gs();return b.useEffect(()=>{const jt=r?.map(vt=>({...vt,...B}));return Be(n,jt),()=>{Ue()}},[]),on("defaultEdgeOptions",B,$e.setState),on("connectionMode",E,$e.setState),on("onConnect",s,$e.setState),on("onConnectStart",i,$e.setState),on("onConnectEnd",a,$e.setState),on("onClickConnectStart",l,$e.setState),on("onClickConnectEnd",c,$e.setState),on("nodesDraggable",d,$e.setState),on("nodesConnectable",h,$e.setState),on("nodesFocusable",m,$e.setState),on("edgesFocusable",g,$e.setState),on("edgesUpdatable",x,$e.setState),on("elementsSelectable",T,$e.setState),on("elevateNodesOnSelect",y,$e.setState),on("snapToGrid",A,$e.setState),on("snapGrid",_,$e.setState),on("onNodesChange",j,$e.setState),on("onEdgesChange",N,$e.setState),on("connectOnClick",q,$e.setState),on("fitViewOnInit",H,$e.setState),on("fitViewOnInitOptions",W,$e.setState),on("onNodesDelete",ee,$e.setState),on("onEdgesDelete",I,$e.setState),on("onNodeDrag",V,$e.setState),on("onNodeDragStart",L,$e.setState),on("onNodeDragStop",$,$e.setState),on("onSelectionDrag",K,$e.setState),on("onSelectionDragStart",Y,$e.setState),on("onSelectionDragStop",R,$e.setState),on("noPanClassName",ie,$e.setState),on("nodeOrigin",X,$e.setState),on("rfId",z,$e.setState),on("autoPanOnConnect",U,$e.setState),on("autoPanOnNodeDrag",te,$e.setState),on("onError",ne,$e.setState),on("connectionRadius",G,$e.setState),on("isValidConnection",se,$e.setState),on("nodeDragThreshold",re,$e.setState),hh(t,ae),hh(e,_e),hh(w,Ye),hh(S,Je),hh(D,Oe),hh(k,Ve),null},SD={display:"none"},M7e={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},XW="react-flow__node-desc",YW="react-flow__edge-desc",R7e="react-flow__aria-live",D7e=t=>t.ariaLiveMessage;function P7e({rfId:t}){const e=gr(D7e);return oe.createElement("div",{id:`${R7e}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:M7e},e)}function z7e({rfId:t,disableKeyboardA11y:e}){return oe.createElement(oe.Fragment,null,oe.createElement("div",{id:`${XW}-${t}`,style:SD},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),oe.createElement("div",{id:`${YW}-${t}`,style:SD},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&oe.createElement(P7e,{rfId:t}))}var Cp=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=b.useState(!1),s=b.useRef(!1),i=b.useRef(new Set([])),[a,l]=b.useMemo(()=>{if(t!==null){const d=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=d.reduce((m,g)=>m.concat(...g),[]);return[d,h]}return[[],[]]},[t]);return b.useEffect(()=>{const c=typeof document<"u"?document:null,d=e?.target||c;if(t!==null){const h=x=>{if(s.current=x.ctrlKey||x.metaKey||x.shiftKey,(!s.current||s.current&&!e.actInsideInputWithModifier)&&sj(x))return!1;const w=OD(x.code,l);i.current.add(x[w]),kD(a,i.current,!1)&&(x.preventDefault(),r(!0))},m=x=>{if((!s.current||s.current&&!e.actInsideInputWithModifier)&&sj(x))return!1;const w=OD(x.code,l);kD(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(x[w]),x.key==="Meta"&&i.current.clear(),s.current=!1},g=()=>{i.current.clear(),r(!1)};return d?.addEventListener("keydown",h),d?.addEventListener("keyup",m),window.addEventListener("blur",g),()=>{d?.removeEventListener("keydown",h),d?.removeEventListener("keyup",m),window.removeEventListener("blur",g)}}},[t,r]),n};function kD(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function OD(t,e){return e.includes(t)?"code":"key"}function KW(t,e,n,r){const s=t.parentNode||t.parentId;if(!s)return n;const i=e.get(s),a=id(i,r);return KW(i,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(i[$r]?.z??0)>(n.z??0)?i[$r]?.z??0:n.z??0},r)}function ZW(t,e,n){t.forEach(r=>{const s=r.parentNode||r.parentId;if(s&&!t.has(s))throw new Error(`Parent node ${s} not found`);if(s||n?.[r.id]){const{x:i,y:a,z:l}=KW(r,t,{...r.position,z:r[$r]?.z??0},e);r.positionAbsolute={x:i,y:a},r[$r].z=l,n?.[r.id]&&(r[$r].isParent=!0)}})}function m5(t,e,n,r){const s=new Map,i={},a=r?1e3:0;return t.forEach(l=>{const c=(Ca(l.zIndex)?l.zIndex:0)+(l.selected?a:0),d=e.get(l.id),h={...l,positionAbsolute:{x:l.position.x,y:l.position.y}},m=l.parentNode||l.parentId;m&&(i[m]=!0);const g=d?.type&&d?.type!==l.type;Object.defineProperty(h,$r,{enumerable:!1,value:{handleBounds:g?void 0:d?.[$r]?.handleBounds,z:c}}),s.set(l.id,h)}),ZW(s,n,i),s}function JW(t,e={}){const{getNodes:n,width:r,height:s,minZoom:i,maxZoom:a,d3Zoom:l,d3Selection:c,fitViewOnInitDone:d,fitViewOnInit:h,nodeOrigin:m}=t(),g=e.initial&&!d&&h;if(l&&c&&(g||!e.initial)){const y=n().filter(S=>{const k=e.includeHiddenNodes?S.width&&S.height:!S.hidden;return e.nodes?.length?k&&e.nodes.some(j=>j.id===S.id):k}),w=y.every(S=>S.width&&S.height);if(y.length>0&&w){const S=iw(y,m),{x:k,y:j,zoom:N}=LW(S,r,s,e.minZoom??i,e.maxZoom??a,e.padding??.1),T=$l.translate(k,j).scale(N);return typeof e.duration=="number"&&e.duration>0?l.transform(qu(c,e.duration),T):l.transform(c,T),!0}}return!1}function I7e(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[$r]:r[$r],selected:n.selected})}),new Map(e)}function L7e(t,e){return e.map(n=>{const r=t.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function X1({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:s,edges:i,onNodesChange:a,onEdgesChange:l,hasDefaultNodes:c,hasDefaultEdges:d}=n();t?.length&&(c&&r({nodeInternals:I7e(t,s)}),a?.(t)),e?.length&&(d&&r({edges:L7e(e,i)}),l?.(e))}const fh=()=>{},B7e={zoomIn:fh,zoomOut:fh,zoomTo:fh,getZoom:()=>1,setViewport:fh,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:fh,fitBounds:fh,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},F7e=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),q7e=()=>{const t=gs(),{d3Zoom:e,d3Selection:n}=gr(F7e,ks);return b.useMemo(()=>n&&e?{zoomIn:s=>e.scaleBy(qu(n,s?.duration),1.2),zoomOut:s=>e.scaleBy(qu(n,s?.duration),1/1.2),zoomTo:(s,i)=>e.scaleTo(qu(n,i?.duration),s),getZoom:()=>t.getState().transform[2],setViewport:(s,i)=>{const[a,l,c]=t.getState().transform,d=$l.translate(s.x??a,s.y??l).scale(s.zoom??c);e.transform(qu(n,i?.duration),d)},getViewport:()=>{const[s,i,a]=t.getState().transform;return{x:s,y:i,zoom:a}},fitView:s=>JW(t.getState,s),setCenter:(s,i,a)=>{const{width:l,height:c,maxZoom:d}=t.getState(),h=typeof a?.zoom<"u"?a.zoom:d,m=l/2-s*h,g=c/2-i*h,x=$l.translate(m,g).scale(h);e.transform(qu(n,a?.duration),x)},fitBounds:(s,i)=>{const{width:a,height:l,minZoom:c,maxZoom:d}=t.getState(),{x:h,y:m,zoom:g}=LW(s,a,l,c,d,i?.padding??.1),x=$l.translate(h,m).scale(g);e.transform(qu(n,i?.duration),x)},project:s=>{const{transform:i,snapToGrid:a,snapGrid:l}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),oj(s,i,a,l)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:a,snapGrid:l,domNode:c}=t.getState();if(!c)return s;const{x:d,y:h}=c.getBoundingClientRect(),m={x:s.x-d,y:s.y-h};return oj(m,i,a,l)},flowToScreenPosition:s=>{const{transform:i,domNode:a}=t.getState();if(!a)return s;const{x:l,y:c}=a.getBoundingClientRect(),d=PW(s,i);return{x:d.x+l,y:d.y+c}},viewportInitialized:!0}:B7e,[e,n])};function u7(){const t=q7e(),e=gs(),n=b.useCallback(()=>e.getState().getNodes().map(w=>({...w})),[]),r=b.useCallback(w=>e.getState().nodeInternals.get(w),[]),s=b.useCallback(()=>{const{edges:w=[]}=e.getState();return w.map(S=>({...S}))},[]),i=b.useCallback(w=>{const{edges:S=[]}=e.getState();return S.find(k=>k.id===w)},[]),a=b.useCallback(w=>{const{getNodes:S,setNodes:k,hasDefaultNodes:j,onNodesChange:N}=e.getState(),T=S(),E=typeof w=="function"?w(T):w;if(j)k(E);else if(N){const _=E.length===0?T.map(A=>({type:"remove",id:A.id})):E.map(A=>({item:A,type:"reset"}));N(_)}},[]),l=b.useCallback(w=>{const{edges:S=[],setEdges:k,hasDefaultEdges:j,onEdgesChange:N}=e.getState(),T=typeof w=="function"?w(S):w;if(j)k(T);else if(N){const E=T.length===0?S.map(_=>({type:"remove",id:_.id})):T.map(_=>({item:_,type:"reset"}));N(E)}},[]),c=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{getNodes:k,setNodes:j,hasDefaultNodes:N,onNodesChange:T}=e.getState();if(N){const _=[...k(),...S];j(_)}else if(T){const E=S.map(_=>({item:_,type:"add"}));T(E)}},[]),d=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{edges:k=[],setEdges:j,hasDefaultEdges:N,onEdgesChange:T}=e.getState();if(N)j([...k,...S]);else if(T){const E=S.map(_=>({item:_,type:"add"}));T(E)}},[]),h=b.useCallback(()=>{const{getNodes:w,edges:S=[],transform:k}=e.getState(),[j,N,T]=k;return{nodes:w().map(E=>({...E})),edges:S.map(E=>({...E})),viewport:{x:j,y:N,zoom:T}}},[]),m=b.useCallback(({nodes:w,edges:S})=>{const{nodeInternals:k,getNodes:j,edges:N,hasDefaultNodes:T,hasDefaultEdges:E,onNodesDelete:_,onEdgesDelete:A,onNodesChange:D,onEdgesChange:q}=e.getState(),B=(w||[]).map(V=>V.id),H=(S||[]).map(V=>V.id),W=j().reduce((V,L)=>{const $=L.parentNode||L.parentId,K=!B.includes(L.id)&&$&&V.find(R=>R.id===$);return(typeof L.deletable=="boolean"?L.deletable:!0)&&(B.includes(L.id)||K)&&V.push(L),V},[]),ee=N.filter(V=>typeof V.deletable=="boolean"?V.deletable:!0),I=ee.filter(V=>H.includes(V.id));if(W||I){const V=IW(W,ee),L=[...I,...V],$=L.reduce((K,Y)=>(K.includes(Y.id)||K.push(Y.id),K),[]);if((E||T)&&(E&&e.setState({edges:N.filter(K=>!$.includes(K.id))}),T&&(W.forEach(K=>{k.delete(K.id)}),e.setState({nodeInternals:new Map(k)}))),$.length>0&&(A?.(L),q&&q($.map(K=>({id:K,type:"remove"})))),W.length>0&&(_?.(W),D)){const K=W.map(Y=>({id:Y.id,type:"remove"}));D(K)}}},[]),g=b.useCallback(w=>{const S=o7e(w),k=S?null:e.getState().nodeInternals.get(w.id);return!S&&!k?[null,null,S]:[S?w:pD(k),k,S]},[]),x=b.useCallback((w,S=!0,k)=>{const[j,N,T]=g(w);return j?(k||e.getState().getNodes()).filter(E=>{if(!T&&(E.id===N.id||!E.positionAbsolute))return!1;const _=pD(E),A=rj(_,j);return S&&A>0||A>=j.width*j.height}):[]},[]),y=b.useCallback((w,S,k=!0)=>{const[j]=g(w);if(!j)return!1;const N=rj(j,S);return k&&N>0||N>=j.width*j.height},[]);return b.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:s,getEdge:i,setNodes:a,setEdges:l,addNodes:c,addEdges:d,toObject:h,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:y}),[t,n,r,s,i,a,l,c,d,h,m,x,y])}const $7e={actInsideInputWithModifier:!1};var H7e=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=gs(),{deleteElements:r}=u7(),s=Cp(t,$7e),i=Cp(e);b.useEffect(()=>{if(s){const{edges:a,getNodes:l}=n.getState(),c=l().filter(h=>h.selected),d=a.filter(h=>h.selected);r({nodes:c,edges:d}),n.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function Q7e(t){const e=gs();b.useEffect(()=>{let n;const r=()=>{if(!t.current)return;const s=n7(t.current);(s.height===0||s.width===0)&&e.getState().onError?.("004",Yl.error004()),e.setState({width:s.width||500,height:s.height||500})};return r(),window.addEventListener("resize",r),t.current&&(n=new ResizeObserver(()=>r()),n.observe(t.current)),()=>{window.removeEventListener("resize",r),n&&t.current&&n.unobserve(t.current)}},[])}const d7={position:"absolute",width:"100%",height:"100%",top:0,left:0},V7e=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,Y1=t=>({x:t.x,y:t.y,zoom:t.k}),mh=(t,e)=>t.target.closest(`.${e}`),jD=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),ND=t=>{const e=t.ctrlKey&&zy()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},U7e=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),W7e=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:a=!1,panOnScrollSpeed:l=.5,panOnScrollMode:c=Yu.Free,zoomOnDoubleClick:d=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:g,translateExtent:x,minZoom:y,maxZoom:w,zoomActivationKeyCode:S,preventScrolling:k=!0,children:j,noWheelClassName:N,noPanClassName:T})=>{const E=b.useRef(),_=gs(),A=b.useRef(!1),D=b.useRef(!1),q=b.useRef(null),B=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:H,d3Selection:W,d3ZoomHandler:ee,userSelectionActive:I}=gr(U7e,ks),V=Cp(S),L=b.useRef(0),$=b.useRef(!1),K=b.useRef();return Q7e(q),b.useEffect(()=>{if(q.current){const Y=q.current.getBoundingClientRect(),R=kW().scaleExtent([y,w]).translateExtent(x),ie=va(q.current).call(R),X=$l.translate(g.x,g.y).scale(gf(g.zoom,y,w)),z=[[0,0],[Y.width,Y.height]],U=R.constrain()(X,z,x);R.transform(ie,U),R.wheelDelta(ND),_.setState({d3Zoom:R,d3Selection:ie,d3ZoomHandler:ie.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:q.current.closest(".react-flow")})}},[]),b.useEffect(()=>{W&&H&&(a&&!V&&!I?W.on("wheel.zoom",Y=>{if(mh(Y,N))return!1;Y.preventDefault(),Y.stopImmediatePropagation();const R=W.property("__zoom").k||1;if(Y.ctrlKey&&i){const se=Qa(Y),re=ND(Y),ae=R*Math.pow(2,re);H.scaleTo(W,ae,se,Y);return}const ie=Y.deltaMode===1?20:1;let X=c===Yu.Vertical?0:Y.deltaX*ie,z=c===Yu.Horizontal?0:Y.deltaY*ie;!zy()&&Y.shiftKey&&c!==Yu.Vertical&&(X=Y.deltaY*ie,z=0),H.translateBy(W,-(X/R)*l,-(z/R)*l,{internal:!0});const U=Y1(W.property("__zoom")),{onViewportChangeStart:te,onViewportChange:ne,onViewportChangeEnd:G}=_.getState();clearTimeout(K.current),$.current||($.current=!0,e?.(Y,U),te?.(U)),$.current&&(t?.(Y,U),ne?.(U),K.current=setTimeout(()=>{n?.(Y,U),G?.(U),$.current=!1},150))},{passive:!1}):typeof ee<"u"&&W.on("wheel.zoom",function(Y,R){if(!k&&Y.type==="wheel"&&!Y.ctrlKey||mh(Y,N))return null;Y.preventDefault(),ee.call(this,Y,R)},{passive:!1}))},[I,a,c,W,H,ee,V,i,k,N,e,t,n]),b.useEffect(()=>{H&&H.on("start",Y=>{if(!Y.sourceEvent||Y.sourceEvent.internal)return null;L.current=Y.sourceEvent?.button;const{onViewportChangeStart:R}=_.getState(),ie=Y1(Y.transform);A.current=!0,B.current=ie,Y.sourceEvent?.type==="mousedown"&&_.setState({paneDragging:!0}),R?.(ie),e?.(Y.sourceEvent,ie)})},[H,e]),b.useEffect(()=>{H&&(I&&!A.current?H.on("zoom",null):I||H.on("zoom",Y=>{const{onViewportChange:R}=_.getState();if(_.setState({transform:[Y.transform.x,Y.transform.y,Y.transform.k]}),D.current=!!(r&&jD(m,L.current??0)),(t||R)&&!Y.sourceEvent?.internal){const ie=Y1(Y.transform);R?.(ie),t?.(Y.sourceEvent,ie)}}))},[I,H,t,m,r]),b.useEffect(()=>{H&&H.on("end",Y=>{if(!Y.sourceEvent||Y.sourceEvent.internal)return null;const{onViewportChangeEnd:R}=_.getState();if(A.current=!1,_.setState({paneDragging:!1}),r&&jD(m,L.current??0)&&!D.current&&r(Y.sourceEvent),D.current=!1,(n||R)&&V7e(B.current,Y.transform)){const ie=Y1(Y.transform);B.current=ie,clearTimeout(E.current),E.current=setTimeout(()=>{R?.(ie),n?.(Y.sourceEvent,ie)},a?150:0)}})},[H,a,m,n,r]),b.useEffect(()=>{H&&H.filter(Y=>{const R=V||s,ie=i&&Y.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&Y.button===1&&Y.type==="mousedown"&&(mh(Y,"react-flow__node")||mh(Y,"react-flow__edge")))return!0;if(!m&&!R&&!a&&!d&&!i||I||!d&&Y.type==="dblclick"||mh(Y,N)&&Y.type==="wheel"||mh(Y,T)&&(Y.type!=="wheel"||a&&Y.type==="wheel"&&!V)||!i&&Y.ctrlKey&&Y.type==="wheel"||!R&&!a&&!ie&&Y.type==="wheel"||!m&&(Y.type==="mousedown"||Y.type==="touchstart")||Array.isArray(m)&&!m.includes(Y.button)&&Y.type==="mousedown")return!1;const X=Array.isArray(m)&&m.includes(Y.button)||!Y.button||Y.button<=1;return(!Y.ctrlKey||Y.type==="wheel")&&X})},[I,H,s,i,a,d,m,h,V]),oe.createElement("div",{className:"react-flow__renderer",ref:q,style:d7},j)},G7e=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function X7e(){const{userSelectionActive:t,userSelectionRect:e}=gr(G7e,ks);return t&&e?oe.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function CD(t,e){const n=e.parentNode||e.parentId,r=t.find(s=>s.id===n);if(r){const s=e.position.x+e.width-r.width,i=e.position.y+e.height-r.height;if(s>0||i>0||e.position.x<0||e.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,s>0&&(r.style.width+=s),i>0&&(r.style.height+=i),e.position.x<0){const a=Math.abs(e.position.x);r.position.x=r.position.x-a,r.style.width+=a,e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);r.position.y=r.position.y-a,r.style.height+=a,e.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function eG(t,e){if(t.some(r=>r.type==="reset"))return t.filter(r=>r.type==="reset").map(r=>r.item);const n=t.filter(r=>r.type==="add").map(r=>r.item);return e.reduce((r,s)=>{const i=t.filter(l=>l.id===s.id);if(i.length===0)return r.push(s),r;const a={...s};for(const l of i)if(l)switch(l.type){case"select":{a.selected=l.selected;break}case"position":{typeof l.position<"u"&&(a.position=l.position),typeof l.positionAbsolute<"u"&&(a.positionAbsolute=l.positionAbsolute),typeof l.dragging<"u"&&(a.dragging=l.dragging),a.expandParent&&CD(r,a);break}case"dimensions":{typeof l.dimensions<"u"&&(a.width=l.dimensions.width,a.height=l.dimensions.height),typeof l.updateStyle<"u"&&(a.style={...a.style||{},...l.dimensions}),typeof l.resizing=="boolean"&&(a.resizing=l.resizing),a.expandParent&&CD(r,a);break}case"remove":return r}return r.push(a),r},n)}function tG(t,e){return eG(t,e)}function Y7e(t,e){return eG(t,e)}const Lc=(t,e)=>({id:t,type:"select",selected:e});function Ah(t,e){return t.reduce((n,r)=>{const s=e.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(Lc(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(Lc(r.id,!1))),n},[])}const p5=(t,e)=>n=>{n.target===e.current&&t?.(n)},K7e=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),nG=b.memo(({isSelecting:t,selectionMode:e=Np.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:a,onPaneScroll:l,onPaneMouseEnter:c,onPaneMouseMove:d,onPaneMouseLeave:h,children:m})=>{const g=b.useRef(null),x=gs(),y=b.useRef(0),w=b.useRef(0),S=b.useRef(),{userSelectionActive:k,elementsSelectable:j,dragging:N}=gr(K7e,ks),T=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,w.current=0},E=ee=>{i?.(ee),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},_=ee=>{if(Array.isArray(n)&&n?.includes(2)){ee.preventDefault();return}a?.(ee)},A=l?ee=>l(ee):void 0,D=ee=>{const{resetSelectedElements:I,domNode:V}=x.getState();if(S.current=V?.getBoundingClientRect(),!j||!t||ee.button!==0||ee.target!==g.current||!S.current)return;const{x:L,y:$}=Wc(ee,S.current);I(),x.setState({userSelectionRect:{width:0,height:0,startX:L,startY:$,x:L,y:$}}),r?.(ee)},q=ee=>{const{userSelectionRect:I,nodeInternals:V,edges:L,transform:$,onNodesChange:K,onEdgesChange:Y,nodeOrigin:R,getNodes:ie}=x.getState();if(!t||!S.current||!I)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const X=Wc(ee,S.current),z=I.startX??0,U=I.startY??0,te={...I,x:X.xae.id),re=G.map(ae=>ae.id);if(y.current!==re.length){y.current=re.length;const ae=Ah(ne,re);ae.length&&K?.(ae)}if(w.current!==se.length){w.current=se.length;const ae=Ah(L,se);ae.length&&Y?.(ae)}x.setState({userSelectionRect:te})},B=ee=>{if(ee.button!==0)return;const{userSelectionRect:I}=x.getState();!k&&I&&ee.target===g.current&&E?.(ee),x.setState({nodesSelectionActive:y.current>0}),T(),s?.(ee)},H=ee=>{k&&(x.setState({nodesSelectionActive:y.current>0}),s?.(ee)),T()},W=j&&(t||k);return oe.createElement("div",{className:Ls(["react-flow__pane",{dragging:N,selection:t}]),onClick:W?void 0:p5(E,g),onContextMenu:p5(_,g),onWheel:p5(A,g),onMouseEnter:W?void 0:c,onMouseDown:W?D:void 0,onMouseMove:W?q:d,onMouseUp:W?B:void 0,onMouseLeave:W?H:h,ref:g,style:d7},m,oe.createElement(X7e,null))});nG.displayName="Pane";function rG(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const r=e.get(n);return r?r.selected?!0:rG(r,e):!1}function TD(t,e,n){let r=t;do{if(r?.matches(e))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function Z7e(t,e,n,r){return Array.from(t.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!rG(s,t))&&(s.draggable||e&&typeof s.draggable>"u")).map(s=>({id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(s.positionAbsolute?.x??0),y:n.y-(s.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}))}function J7e(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function sG(t,e,n,r,s=[0,0],i){const a=J7e(t,t.extent||r);let l=a;const c=t.parentNode||t.parentId;if(t.extent==="parent"&&!t.expandParent)if(c&&t.width&&t.height){const m=n.get(c),{x:g,y:x}=id(m,s).positionAbsolute;l=m&&Ca(g)&&Ca(x)&&Ca(m.width)&&Ca(m.height)?[[g+t.width*s[0],x+t.height*s[1]],[g+m.width-t.width+t.width*s[0],x+m.height-t.height+t.height*s[1]]]:l}else i?.("005",Yl.error005()),l=a;else if(t.extent&&c&&t.extent!=="parent"){const m=n.get(c),{x:g,y:x}=id(m,s).positionAbsolute;l=[[t.extent[0][0]+g,t.extent[0][1]+x],[t.extent[1][0]+g,t.extent[1][1]+x]]}let d={x:0,y:0};if(c){const m=n.get(c);d=id(m,s).positionAbsolute}const h=l&&l!=="parent"?r7(e,l):e;return{position:{x:h.x-d.x,y:h.y-d.y},positionAbsolute:h}}function g5({nodeId:t,dragItems:e,nodeInternals:n}){const r=e.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[t?r.find(s=>s.id===t):r[0],r]}const ED=(t,e,n,r)=>{const s=e.querySelectorAll(t);if(!s||!s.length)return null;const i=Array.from(s),a=e.getBoundingClientRect(),l={x:a.width*r[0],y:a.height*r[1]};return i.map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(d.left-a.left-l.x)/n,y:(d.top-a.top-l.y)/n,...n7(c)}})};function i0(t,e,n){return n===void 0?n:r=>{const s=e().nodeInternals.get(t);s&&n(r,{...s})}}function cj({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeInternals:l,onError:c}=e.getState(),d=l.get(t);if(!d){c?.("012",Yl.error012(t));return}e.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):s([t])}function eCe(){const t=gs();return b.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:i}=t.getState(),a=n.touches?n.touches[0].clientX:n.clientX,l=n.touches?n.touches[0].clientY:n.clientY,c={x:(a-r[0])/r[2],y:(l-r[1])/r[2]};return{xSnapped:i?s[0]*Math.round(c.x/s[0]):c.x,ySnapped:i?s[1]*Math.round(c.y/s[1]):c.y,...c}},[])}function x5(t){return(e,n,r)=>t?.(e,r)}function iG({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,selectNodesOnDrag:a}){const l=gs(),[c,d]=b.useState(!1),h=b.useRef([]),m=b.useRef({x:null,y:null}),g=b.useRef(0),x=b.useRef(null),y=b.useRef({x:0,y:0}),w=b.useRef(null),S=b.useRef(!1),k=b.useRef(!1),j=b.useRef(!1),N=eCe();return b.useEffect(()=>{if(t?.current){const T=va(t.current),E=({x:D,y:q})=>{const{nodeInternals:B,onNodeDrag:H,onSelectionDrag:W,updateNodePositions:ee,nodeExtent:I,snapGrid:V,snapToGrid:L,nodeOrigin:$,onError:K}=l.getState();m.current={x:D,y:q};let Y=!1,R={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&I){const X=iw(h.current,$);R=jp(X)}if(h.current=h.current.map(X=>{const z={x:D-X.distance.x,y:q-X.distance.y};L&&(z.x=V[0]*Math.round(z.x/V[0]),z.y=V[1]*Math.round(z.y/V[1]));const U=[[I[0][0],I[0][1]],[I[1][0],I[1][1]]];h.current.length>1&&I&&!X.extent&&(U[0][0]=X.positionAbsolute.x-R.x+I[0][0],U[1][0]=X.positionAbsolute.x+(X.width??0)-R.x2+I[1][0],U[0][1]=X.positionAbsolute.y-R.y+I[0][1],U[1][1]=X.positionAbsolute.y+(X.height??0)-R.y2+I[1][1]);const te=sG(X,z,B,U,$,K);return Y=Y||X.position.x!==te.position.x||X.position.y!==te.position.y,X.position=te.position,X.positionAbsolute=te.positionAbsolute,X}),!Y)return;ee(h.current,!0,!0),d(!0);const ie=s?H:x5(W);if(ie&&w.current){const[X,z]=g5({nodeId:s,dragItems:h.current,nodeInternals:B});ie(w.current,X,z)}},_=()=>{if(!x.current)return;const[D,q]=jW(y.current,x.current);if(D!==0||q!==0){const{transform:B,panBy:H}=l.getState();m.current.x=(m.current.x??0)-D/B[2],m.current.y=(m.current.y??0)-q/B[2],H({x:D,y:q})&&E(m.current)}g.current=requestAnimationFrame(_)},A=D=>{const{nodeInternals:q,multiSelectionActive:B,nodesDraggable:H,unselectNodesAndEdges:W,onNodeDragStart:ee,onSelectionDragStart:I}=l.getState();k.current=!0;const V=s?ee:x5(I);(!a||!i)&&!B&&s&&(q.get(s)?.selected||W()),s&&i&&a&&cj({id:s,store:l,nodeRef:t});const L=N(D);if(m.current=L,h.current=Z7e(q,H,L,s),V&&h.current){const[$,K]=g5({nodeId:s,dragItems:h.current,nodeInternals:q});V(D.sourceEvent,$,K)}};if(e)T.on(".drag",null);else{const D=I6e().on("start",q=>{const{domNode:B,nodeDragThreshold:H}=l.getState();H===0&&A(q),j.current=!1;const W=N(q);m.current=W,x.current=B?.getBoundingClientRect()||null,y.current=Wc(q.sourceEvent,x.current)}).on("drag",q=>{const B=N(q),{autoPanOnNodeDrag:H,nodeDragThreshold:W}=l.getState();if(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1&&(j.current=!0),!j.current){if(!S.current&&k.current&&H&&(S.current=!0,_()),!k.current){const ee=B.xSnapped-(m?.current?.x??0),I=B.ySnapped-(m?.current?.y??0);Math.sqrt(ee*ee+I*I)>W&&A(q)}(m.current.x!==B.xSnapped||m.current.y!==B.ySnapped)&&h.current&&k.current&&(w.current=q.sourceEvent,y.current=Wc(q.sourceEvent,x.current),E(B))}}).on("end",q=>{if(!(!k.current||j.current)&&(d(!1),S.current=!1,k.current=!1,cancelAnimationFrame(g.current),h.current)){const{updateNodePositions:B,nodeInternals:H,onNodeDragStop:W,onSelectionDragStop:ee}=l.getState(),I=s?W:x5(ee);if(B(h.current,!1,!1),I){const[V,L]=g5({nodeId:s,dragItems:h.current,nodeInternals:H});I(q.sourceEvent,V,L)}}}).filter(q=>{const B=q.target;return!q.button&&(!n||!TD(B,`.${n}`,t))&&(!r||TD(B,r,t))});return T.call(D),()=>{T.on(".drag",null)}}}},[t,e,n,r,i,l,s,a,N]),c}function aG(){const t=gs();return b.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:i,getNodes:a,snapToGrid:l,snapGrid:c,onError:d,nodesDraggable:h}=t.getState(),m=a().filter(j=>j.selected&&(j.draggable||h&&typeof j.draggable>"u")),g=l?c[0]:5,x=l?c[1]:5,y=n.isShiftPressed?4:1,w=n.x*g*y,S=n.y*x*y,k=m.map(j=>{if(j.positionAbsolute){const N={x:j.positionAbsolute.x+w,y:j.positionAbsolute.y+S};l&&(N.x=c[0]*Math.round(N.x/c[0]),N.y=c[1]*Math.round(N.y/c[1]));const{positionAbsolute:T,position:E}=sG(j,N,r,s,void 0,d);j.position=E,j.positionAbsolute=T}return j});i(k,!0,!1)},[])}const Vh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var a0=t=>{const e=({id:n,type:r,data:s,xPos:i,yPos:a,xPosOrigin:l,yPosOrigin:c,selected:d,onClick:h,onMouseEnter:m,onMouseMove:g,onMouseLeave:x,onContextMenu:y,onDoubleClick:w,style:S,className:k,isDraggable:j,isSelectable:N,isConnectable:T,isFocusable:E,selectNodesOnDrag:_,sourcePosition:A,targetPosition:D,hidden:q,resizeObserver:B,dragHandle:H,zIndex:W,isParent:ee,noDragClassName:I,noPanClassName:V,initialized:L,disableKeyboardA11y:$,ariaLabel:K,rfId:Y,hasHandleBounds:R})=>{const ie=gs(),X=b.useRef(null),z=b.useRef(null),U=b.useRef(A),te=b.useRef(D),ne=b.useRef(r),G=N||j||h||m||g||x,se=aG(),re=i0(n,ie.getState,m),ae=i0(n,ie.getState,g),_e=i0(n,ie.getState,x),Be=i0(n,ie.getState,y),Ye=i0(n,ie.getState,w),Je=Ue=>{const{nodeDragThreshold:$e}=ie.getState();if(N&&(!_||!j||$e>0)&&cj({id:n,store:ie,nodeRef:X}),h){const jt=ie.getState().nodeInternals.get(n);jt&&h(Ue,{...jt})}},Oe=Ue=>{if(!sj(Ue)&&!$)if(EW.includes(Ue.key)&&N){const $e=Ue.key==="Escape";cj({id:n,store:ie,unselect:$e,nodeRef:X})}else j&&d&&Object.prototype.hasOwnProperty.call(Vh,Ue.key)&&(ie.setState({ariaLiveMessage:`Moved selected node ${Ue.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),se({x:Vh[Ue.key].x,y:Vh[Ue.key].y,isShiftPressed:Ue.shiftKey}))};b.useEffect(()=>()=>{z.current&&(B?.unobserve(z.current),z.current=null)},[]),b.useEffect(()=>{if(X.current&&!q){const Ue=X.current;(!L||!R||z.current!==Ue)&&(z.current&&B?.unobserve(z.current),B?.observe(Ue),z.current=Ue)}},[q,L,R]),b.useEffect(()=>{const Ue=ne.current!==r,$e=U.current!==A,jt=te.current!==D;X.current&&(Ue||$e||jt)&&(Ue&&(ne.current=r),$e&&(U.current=A),jt&&(te.current=D),ie.getState().updateNodeDimensions([{id:n,nodeElement:X.current,forceUpdate:!0}]))},[n,r,A,D]);const Ve=iG({nodeRef:X,disabled:q||!j,noDragClassName:I,handleSelector:H,nodeId:n,isSelectable:N,selectNodesOnDrag:_});return q?null:oe.createElement("div",{className:Ls(["react-flow__node",`react-flow__node-${r}`,{[V]:j},k,{selected:d,selectable:N,parent:ee,dragging:Ve}]),ref:X,style:{zIndex:W,transform:`translate(${l}px,${c}px)`,pointerEvents:G?"all":"none",visibility:L?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:re,onMouseMove:ae,onMouseLeave:_e,onContextMenu:Be,onClick:Je,onDoubleClick:Ye,onKeyDown:E?Oe:void 0,tabIndex:E?0:void 0,role:E?"button":void 0,"aria-describedby":$?void 0:`${XW}-${Y}`,"aria-label":K},oe.createElement(m7e,{value:n},oe.createElement(t,{id:n,data:s,type:r,xPos:i,yPos:a,selected:d,isConnectable:T,sourcePosition:A,targetPosition:D,dragging:Ve,dragHandle:H,zIndex:W})))};return e.displayName="NodeWrapper",b.memo(e)};const tCe=t=>{const e=t.getNodes().filter(n=>n.selected);return{...iw(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function nCe({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=gs(),{width:s,height:i,x:a,y:l,transformString:c,userSelectionActive:d}=gr(tCe,ks),h=aG(),m=b.useRef(null);if(b.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]),iG({nodeRef:m}),d||!s||!i)return null;const g=t?y=>{const w=r.getState().getNodes().filter(S=>S.selected);t(y,w)}:void 0,x=y=>{Object.prototype.hasOwnProperty.call(Vh,y.key)&&h({x:Vh[y.key].x,y:Vh[y.key].y,isShiftPressed:y.shiftKey})};return oe.createElement("div",{className:Ls(["react-flow__nodesselection","react-flow__container",e]),style:{transform:c}},oe.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:s,height:i,top:l,left:a}}))}var rCe=b.memo(nCe);const sCe=t=>t.nodesSelectionActive,oG=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,deleteKeyCode:l,onMove:c,onMoveStart:d,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:g,selectionMode:x,onSelectionStart:y,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:j,elementsSelectable:N,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:_,panOnScrollSpeed:A,panOnScrollMode:D,zoomOnDoubleClick:q,panOnDrag:B,defaultViewport:H,translateExtent:W,minZoom:ee,maxZoom:I,preventScrolling:V,onSelectionContextMenu:L,noWheelClassName:$,noPanClassName:K,disableKeyboardA11y:Y})=>{const R=gr(sCe),ie=Cp(m),X=Cp(k),z=X||B,U=X||_,te=ie||g&&z!==!0;return H7e({deleteKeyCode:l,multiSelectionKeyCode:S}),oe.createElement(W7e,{onMove:c,onMoveStart:d,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:N,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:U,panOnScrollSpeed:A,panOnScrollMode:D,zoomOnDoubleClick:q,panOnDrag:!ie&&z,defaultViewport:H,translateExtent:W,minZoom:ee,maxZoom:I,zoomActivationKeyCode:j,preventScrolling:V,noWheelClassName:$,noPanClassName:K},oe.createElement(nG,{onSelectionStart:y,onSelectionEnd:w,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:z,isSelecting:!!te,selectionMode:x},t,R&&oe.createElement(rCe,{onSelectionContextMenu:L,noPanClassName:K,disableKeyboardA11y:Y})))};oG.displayName="FlowRenderer";var iCe=b.memo(oG);function aCe(t){return gr(b.useCallback(n=>t?zW(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function oCe(t){const e={input:a0(t.input||VW),default:a0(t.default||lj),output:a0(t.output||WW),group:a0(t.group||c7)},n={},r=Object.keys(t).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=a0(t[i]||lj),s),n);return{...e,...r}}const lCe=({x:t,y:e,width:n,height:r,origin:s})=>!n||!r?{x:t,y:e}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:t,y:e}:{x:t-n*s[0],y:e-r*s[1]},cCe=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),lG=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:i,onError:a}=gr(cCe,ks),l=aCe(t.onlyRenderVisibleElements),c=b.useRef(),d=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const g=m.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));i(g)});return c.current=h,h},[]);return b.useEffect(()=>()=>{c?.current?.disconnect()},[]),oe.createElement("div",{className:"react-flow__nodes",style:d7},l.map(h=>{let m=h.type||"default";t.nodeTypes[m]||(a?.("003",Yl.error003(m)),m="default");const g=t.nodeTypes[m]||t.nodeTypes.default,x=!!(h.draggable||e&&typeof h.draggable>"u"),y=!!(h.selectable||s&&typeof h.selectable>"u"),w=!!(h.connectable||n&&typeof h.connectable>"u"),S=!!(h.focusable||r&&typeof h.focusable>"u"),k=t.nodeExtent?r7(h.positionAbsolute,t.nodeExtent):h.positionAbsolute,j=k?.x??0,N=k?.y??0,T=lCe({x:j,y:N,width:h.width??0,height:h.height??0,origin:t.nodeOrigin});return oe.createElement(g,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||kt.Bottom,targetPosition:h.targetPosition||kt.Top,hidden:h.hidden,xPos:j,yPos:N,xPosOrigin:T.x,yPosOrigin:T.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!h.selected,isDraggable:x,isSelectable:y,isConnectable:w,isFocusable:S,resizeObserver:d,dragHandle:h.dragHandle,zIndex:h[$r]?.z??0,isParent:!!h[$r]?.isParent,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!h.width&&!!h.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!h[$r]?.handleBounds})}))};lG.displayName="NodeRenderer";var uCe=b.memo(lG);const dCe=(t,e,n)=>n===kt.Left?t-e:n===kt.Right?t+e:t,hCe=(t,e,n)=>n===kt.Top?t-e:n===kt.Bottom?t+e:t,_D="react-flow__edgeupdater",AD=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:l})=>oe.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:Ls([_D,`${_D}-${l}`]),cx:dCe(e,r,t),cy:hCe(n,r,t),r,stroke:"transparent",fill:"transparent"}),fCe=()=>!0;var ph=t=>{const e=({id:n,className:r,type:s,data:i,onClick:a,onEdgeDoubleClick:l,selected:c,animated:d,label:h,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,style:S,source:k,target:j,sourceX:N,sourceY:T,targetX:E,targetY:_,sourcePosition:A,targetPosition:D,elementsSelectable:q,hidden:B,sourceHandleId:H,targetHandleId:W,onContextMenu:ee,onMouseEnter:I,onMouseMove:V,onMouseLeave:L,reconnectRadius:$,onReconnect:K,onReconnectStart:Y,onReconnectEnd:R,markerEnd:ie,markerStart:X,rfId:z,ariaLabel:U,isFocusable:te,isReconnectable:ne,pathOptions:G,interactionWidth:se,disableKeyboardA11y:re})=>{const ae=b.useRef(null),[_e,Be]=b.useState(!1),[Ye,Je]=b.useState(!1),Oe=gs(),Ve=b.useMemo(()=>`url('#${aj(X,z)}')`,[X,z]),Ue=b.useMemo(()=>`url('#${aj(ie,z)}')`,[ie,z]);if(B)return null;const $e=Rt=>{const{edges:Hn,addSelectedEdges:We,unselectNodesAndEdges:ot,multiSelectionActive:dn}=Oe.getState(),Pt=Hn.find(xn=>xn.id===n);Pt&&(q&&(Oe.setState({nodesSelectionActive:!1}),Pt.selected&&dn?(ot({nodes:[],edges:[Pt]}),ae.current?.blur()):We([n])),a&&a(Rt,Pt))},jt=s0(n,Oe.getState,l),vt=s0(n,Oe.getState,ee),$n=s0(n,Oe.getState,I),qt=s0(n,Oe.getState,V),un=s0(n,Oe.getState,L),Mt=(Rt,Hn)=>{if(Rt.button!==0)return;const{edges:We,isValidConnection:ot}=Oe.getState(),dn=Hn?j:k,Pt=(Hn?W:H)||null,xn=Hn?"target":"source",dt=ot||fCe,rn=Hn,wt=We.find(lt=>lt.id===n);Je(!0),Y?.(Rt,wt,xn);const Wt=lt=>{Je(!1),R?.(lt,wt,xn)};qW({event:Rt,handleId:Pt,nodeId:dn,onConnect:lt=>K?.(wt,lt),isTarget:rn,getState:Oe.getState,setState:Oe.setState,isValidConnection:dt,edgeUpdaterType:xn,onReconnectEnd:Wt})},ct=Rt=>Mt(Rt,!0),Ne=Rt=>Mt(Rt,!1),ze=()=>Be(!0),rt=()=>Be(!1),bt=!q&&!a,zt=Rt=>{if(!re&&EW.includes(Rt.key)&&q){const{unselectNodesAndEdges:Hn,addSelectedEdges:We,edges:ot}=Oe.getState();Rt.key==="Escape"?(ae.current?.blur(),Hn({edges:[ot.find(Pt=>Pt.id===n)]})):We([n])}};return oe.createElement("g",{className:Ls(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:c,animated:d,inactive:bt,updating:_e}]),onClick:$e,onDoubleClick:jt,onContextMenu:vt,onMouseEnter:$n,onMouseMove:qt,onMouseLeave:un,onKeyDown:te?zt:void 0,tabIndex:te?0:void 0,role:te?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":U===null?void 0:U||`Edge from ${k} to ${j}`,"aria-describedby":te?`${YW}-${z}`:void 0,ref:ae},!Ye&&oe.createElement(t,{id:n,source:k,target:j,selected:c,animated:d,label:h,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,data:i,style:S,sourceX:N,sourceY:T,targetX:E,targetY:_,sourcePosition:A,targetPosition:D,sourceHandleId:H,targetHandleId:W,markerStart:Ve,markerEnd:Ue,pathOptions:G,interactionWidth:se}),ne&&oe.createElement(oe.Fragment,null,(ne==="source"||ne===!0)&&oe.createElement(AD,{position:A,centerX:N,centerY:T,radius:$,onMouseDown:ct,onMouseEnter:ze,onMouseOut:rt,type:"source"}),(ne==="target"||ne===!0)&&oe.createElement(AD,{position:D,centerX:E,centerY:_,radius:$,onMouseDown:Ne,onMouseEnter:ze,onMouseOut:rt,type:"target"})))};return e.displayName="EdgeWrapper",b.memo(e)};function mCe(t){const e={default:ph(t.default||Ly),straight:ph(t.bezier||a7),step:ph(t.step||i7),smoothstep:ph(t.step||sw),simplebezier:ph(t.simplebezier||s7)},n={},r=Object.keys(t).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=ph(t[i]||Ly),s),n);return{...e,...r}}function MD(t,e,n=null){const r=(n?.x||0)+e.x,s=(n?.y||0)+e.y,i=n?.width||e.width,a=n?.height||e.height;switch(t){case kt.Top:return{x:r+i/2,y:s};case kt.Right:return{x:r+i,y:s+a/2};case kt.Bottom:return{x:r+i/2,y:s+a};case kt.Left:return{x:r,y:s+a/2}}}function RD(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const pCe=(t,e,n,r,s,i)=>{const a=MD(n,t,e),l=MD(i,r,s);return{sourceX:a.x,sourceY:a.y,targetX:l.x,targetY:l.y}};function gCe({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:i,width:a,height:l,transform:c}){const d={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+s),y2:Math.max(t.y+r,e.y+i)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const h=jp({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:a/c[2],height:l/c[2]}),m=Math.max(0,Math.min(h.x2,d.x2)-Math.max(h.x,d.x)),g=Math.max(0,Math.min(h.y2,d.y2)-Math.max(h.y,d.y));return Math.ceil(m*g)>0}function DD(t){const e=t?.[$r]?.handleBounds||null,n=e&&t?.width&&t?.height&&typeof t?.positionAbsolute?.x<"u"&&typeof t?.positionAbsolute?.y<"u";return[{x:t?.positionAbsolute?.x||0,y:t?.positionAbsolute?.y||0,width:t?.width||0,height:t?.height||0},e,!!n]}const xCe=[{level:0,isMaxLevel:!0,edges:[]}];function vCe(t,e,n=!1){let r=-1;const s=t.reduce((a,l)=>{const c=Ca(l.zIndex);let d=c?l.zIndex:0;if(n){const h=e.get(l.target),m=e.get(l.source),g=l.selected||h?.selected||m?.selected,x=Math.max(m?.[$r]?.z||0,h?.[$r]?.z||0,1e3);d=(c?l.zIndex:0)+(g?x:0)}return a[d]?a[d].push(l):a[d]=[l],r=d>r?d:r,a},{}),i=Object.entries(s).map(([a,l])=>{const c=+a;return{edges:l,level:c,isMaxLevel:c===r}});return i.length===0?xCe:i}function yCe(t,e,n){const r=gr(b.useCallback(s=>t?s.edges.filter(i=>{const a=e.get(i.source),l=e.get(i.target);return a?.width&&a?.height&&l?.width&&l?.height&&gCe({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:l.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:l.width,targetHeight:l.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[t,e]));return vCe(r,e,n)}const bCe=({color:t="none",strokeWidth:e=1})=>oe.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),wCe=({color:t="none",strokeWidth:e=1})=>oe.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),PD={[Iy.Arrow]:bCe,[Iy.ArrowClosed]:wCe};function SCe(t){const e=gs();return b.useMemo(()=>Object.prototype.hasOwnProperty.call(PD,t)?PD[t]:(e.getState().onError?.("009",Yl.error009(t)),null),[t])}const kCe=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=SCe(e);return c?oe.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0"},oe.createElement(c,{color:n,strokeWidth:a})):null},OCe=({defaultColor:t,rfId:e})=>n=>{const r=[];return n.edges.reduce((s,i)=>([i.markerStart,i.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const l=aj(a,e);r.includes(l)||(s.push({id:l,color:a.color||t,...a}),r.push(l))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},cG=({defaultColor:t,rfId:e})=>{const n=gr(b.useCallback(OCe({defaultColor:t,rfId:e}),[t,e]),(r,s)=>!(r.length!==s.length||r.some((i,a)=>i.id!==s[a].id)));return oe.createElement("defs",null,n.map(r=>oe.createElement(kCe,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};cG.displayName="MarkerDefinitions";var jCe=b.memo(cG);const NCe=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),uG=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:d,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,children:S,disableKeyboardA11y:k})=>{const{edgesFocusable:j,edgesUpdatable:N,elementsSelectable:T,width:E,height:_,connectionMode:A,nodeInternals:D,onError:q}=gr(NCe,ks),B=yCe(e,D,n);return E?oe.createElement(oe.Fragment,null,B.map(({level:H,edges:W,isMaxLevel:ee})=>oe.createElement("svg",{key:H,style:{zIndex:H},width:E,height:_,className:"react-flow__edges react-flow__container"},ee&&oe.createElement(jCe,{defaultColor:t,rfId:r}),oe.createElement("g",null,W.map(I=>{const[V,L,$]=DD(D.get(I.source)),[K,Y,R]=DD(D.get(I.target));if(!$||!R)return null;let ie=I.type||"default";s[ie]||(q?.("011",Yl.error011(ie)),ie="default");const X=s[ie]||s.default,z=A===vd.Strict?Y.target:(Y.target??[]).concat(Y.source??[]),U=RD(L.source,I.sourceHandle),te=RD(z,I.targetHandle),ne=U?.position||kt.Bottom,G=te?.position||kt.Top,se=!!(I.focusable||j&&typeof I.focusable>"u"),re=I.reconnectable||I.updatable,ae=typeof g<"u"&&(re||N&&typeof re>"u");if(!U||!te)return q?.("008",Yl.error008(U,I)),null;const{sourceX:_e,sourceY:Be,targetX:Ye,targetY:Je}=pCe(V,U,ne,K,te,G);return oe.createElement(X,{key:I.id,id:I.id,className:Ls([I.className,i]),type:ie,data:I.data,selected:!!I.selected,animated:!!I.animated,hidden:!!I.hidden,label:I.label,labelStyle:I.labelStyle,labelShowBg:I.labelShowBg,labelBgStyle:I.labelBgStyle,labelBgPadding:I.labelBgPadding,labelBgBorderRadius:I.labelBgBorderRadius,style:I.style,source:I.source,target:I.target,sourceHandleId:I.sourceHandle,targetHandleId:I.targetHandle,markerEnd:I.markerEnd,markerStart:I.markerStart,sourceX:_e,sourceY:Be,targetX:Ye,targetY:Je,sourcePosition:ne,targetPosition:G,elementsSelectable:T,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,onClick:h,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,rfId:r,ariaLabel:I.ariaLabel,isFocusable:se,isReconnectable:ae,pathOptions:"pathOptions"in I?I.pathOptions:void 0,interactionWidth:I.interactionWidth,disableKeyboardA11y:k})})))),S):null};uG.displayName="EdgeRenderer";var CCe=b.memo(uG);const TCe=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function ECe({children:t}){const e=gr(TCe);return oe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function _Ce(t){const e=u7(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const ACe={[kt.Left]:kt.Right,[kt.Right]:kt.Left,[kt.Top]:kt.Bottom,[kt.Bottom]:kt.Top},dG=({nodeId:t,handleType:e,style:n,type:r=qc.Bezier,CustomComponent:s,connectionStatus:i})=>{const{fromNode:a,handleId:l,toX:c,toY:d,connectionMode:h}=gr(b.useCallback(_=>({fromNode:_.nodeInternals.get(t),handleId:_.connectionHandleId,toX:(_.connectionPosition.x-_.transform[0])/_.transform[2],toY:(_.connectionPosition.y-_.transform[1])/_.transform[2],connectionMode:_.connectionMode}),[t]),ks),m=a?.[$r]?.handleBounds;let g=m?.[e];if(h===vd.Loose&&(g=g||m?.[e==="source"?"target":"source"]),!a||!g)return null;const x=l?g.find(_=>_.id===l):g[0],y=x?x.x+x.width/2:(a.width??0)/2,w=x?x.y+x.height/2:a.height??0,S=(a.positionAbsolute?.x??0)+y,k=(a.positionAbsolute?.y??0)+w,j=x?.position,N=j?ACe[j]:null;if(!j||!N)return null;if(s)return oe.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:x,fromX:S,fromY:k,toX:c,toY:d,fromPosition:j,toPosition:N,connectionStatus:i});let T="";const E={sourceX:S,sourceY:k,sourcePosition:j,targetX:c,targetY:d,targetPosition:N};return r===qc.Bezier?[T]=DW(E):r===qc.Step?[T]=ij({...E,borderRadius:0}):r===qc.SmoothStep?[T]=ij(E):r===qc.SimpleBezier?[T]=RW(E):T=`M${S},${k} ${c},${d}`,oe.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:n})};dG.displayName="ConnectionLine";const MCe=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function RCe({containerStyle:t,style:e,type:n,component:r}){const{nodeId:s,handleType:i,nodesConnectable:a,width:l,height:c,connectionStatus:d}=gr(MCe,ks);return!(s&&i&&l&&a)?null:oe.createElement("svg",{style:t,width:l,height:c,className:"react-flow__edges react-flow__connectionline react-flow__container"},oe.createElement("g",{className:Ls(["react-flow__connection",d])},oe.createElement(dG,{nodeId:s,handleType:i,style:e,type:n,CustomComponent:r,connectionStatus:d})))}function zD(t,e){return b.useRef(null),gs(),b.useMemo(()=>e(t),[t])}const hG=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:i,onNodeClick:a,onEdgeClick:l,onNodeDoubleClick:c,onEdgeDoubleClick:d,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,onSelectionContextMenu:y,onSelectionStart:w,onSelectionEnd:S,connectionLineType:k,connectionLineStyle:j,connectionLineComponent:N,connectionLineContainerStyle:T,selectionKeyCode:E,selectionOnDrag:_,selectionMode:A,multiSelectionKeyCode:D,panActivationKeyCode:q,zoomActivationKeyCode:B,deleteKeyCode:H,onlyRenderVisibleElements:W,elementsSelectable:ee,selectNodesOnDrag:I,defaultViewport:V,translateExtent:L,minZoom:$,maxZoom:K,preventScrolling:Y,defaultMarkerColor:R,zoomOnScroll:ie,zoomOnPinch:X,panOnScroll:z,panOnScrollSpeed:U,panOnScrollMode:te,zoomOnDoubleClick:ne,panOnDrag:G,onPaneClick:se,onPaneMouseEnter:re,onPaneMouseMove:ae,onPaneMouseLeave:_e,onPaneScroll:Be,onPaneContextMenu:Ye,onEdgeContextMenu:Je,onEdgeMouseEnter:Oe,onEdgeMouseMove:Ve,onEdgeMouseLeave:Ue,onReconnect:$e,onReconnectStart:jt,onReconnectEnd:vt,reconnectRadius:$n,noDragClassName:qt,noWheelClassName:un,noPanClassName:Mt,elevateEdgesOnSelect:ct,disableKeyboardA11y:Ne,nodeOrigin:ze,nodeExtent:rt,rfId:bt})=>{const zt=zD(t,oCe),Rt=zD(e,mCe);return _Ce(i),oe.createElement(iCe,{onPaneClick:se,onPaneMouseEnter:re,onPaneMouseMove:ae,onPaneMouseLeave:_e,onPaneContextMenu:Ye,onPaneScroll:Be,deleteKeyCode:H,selectionKeyCode:E,selectionOnDrag:_,selectionMode:A,onSelectionStart:w,onSelectionEnd:S,multiSelectionKeyCode:D,panActivationKeyCode:q,zoomActivationKeyCode:B,elementsSelectable:ee,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:ie,zoomOnPinch:X,zoomOnDoubleClick:ne,panOnScroll:z,panOnScrollSpeed:U,panOnScrollMode:te,panOnDrag:G,defaultViewport:V,translateExtent:L,minZoom:$,maxZoom:K,onSelectionContextMenu:y,preventScrolling:Y,noDragClassName:qt,noWheelClassName:un,noPanClassName:Mt,disableKeyboardA11y:Ne},oe.createElement(ECe,null,oe.createElement(CCe,{edgeTypes:Rt,onEdgeClick:l,onEdgeDoubleClick:d,onlyRenderVisibleElements:W,onEdgeContextMenu:Je,onEdgeMouseEnter:Oe,onEdgeMouseMove:Ve,onEdgeMouseLeave:Ue,onReconnect:$e,onReconnectStart:jt,onReconnectEnd:vt,reconnectRadius:$n,defaultMarkerColor:R,noPanClassName:Mt,elevateEdgesOnSelect:!!ct,disableKeyboardA11y:Ne,rfId:bt},oe.createElement(RCe,{style:j,type:k,component:N,containerStyle:T})),oe.createElement("div",{className:"react-flow__edgelabel-renderer"}),oe.createElement(uCe,{nodeTypes:zt,onNodeClick:a,onNodeDoubleClick:c,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,selectNodesOnDrag:I,onlyRenderVisibleElements:W,noPanClassName:Mt,noDragClassName:qt,disableKeyboardA11y:Ne,nodeOrigin:ze,nodeExtent:rt,rfId:bt})))};hG.displayName="GraphView";var DCe=b.memo(hG);const uj=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Mc={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:uj,nodeExtent:uj,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:vd.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:l7e,isValidConnection:void 0},PCe=()=>XOe((t,e)=>({...Mc,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:i}=e();t({nodeInternals:m5(n,r,s,i)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=e();t({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",i=typeof r<"u",a=s?m5(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:i?r:[],hasDefaultNodes:s,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:i,fitViewOnInitDone:a,fitViewOnInitOptions:l,domNode:c,nodeOrigin:d}=e(),h=c?.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{m22:g}=new window.DOMMatrixReadOnly(m.transform),x=n.reduce((w,S)=>{const k=s.get(S.id);if(k?.hidden)s.set(k.id,{...k,[$r]:{...k[$r],handleBounds:void 0}});else if(k){const j=n7(S.nodeElement);!!(j.width&&j.height&&(k.width!==j.width||k.height!==j.height||S.forceUpdate))&&(s.set(k.id,{...k,[$r]:{...k[$r],handleBounds:{source:ED(".source",S.nodeElement,g,d),target:ED(".target",S.nodeElement,g,d)}},...j}),w.push({id:k.id,type:"dimensions",dimensions:j}))}return w},[]);ZW(s,d);const y=a||i&&!a&&JW(e,{initial:!0,...l});t({nodeInternals:new Map(s),fitViewOnInitDone:y}),x?.length>0&&r?.(x)},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:i}=e(),a=n.map(l=>{const c={id:l.id,type:"position",dragging:s};return r&&(c.positionAbsolute=l.positionAbsolute,c.position=l.position),c});i(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:a,getNodes:l,elevateNodesOnSelect:c}=e();if(n?.length){if(i){const d=tG(n,l()),h=m5(d,s,a,c);t({nodeInternals:h})}r?.(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,l=null;r?a=n.map(c=>Lc(c,!0)):(a=Ah(i(),n),l=Ah(s,[])),X1({changedNodes:a,changedEdges:l,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,l=null;r?a=n.map(c=>Lc(c,!0)):(a=Ah(s,n),l=Ah(i(),[])),X1({changedNodes:l,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:i}=e(),a=n||i(),l=r||s,c=a.map(h=>(h.selected=!1,Lc(h.id,!1))),d=l.map(h=>Lc(h.id,!1));X1({changedNodes:c,changedEdges:d,get:e,set:t})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=e();r?.scaleExtent([n,s]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=e();r?.scaleExtent([s,n]),t({maxZoom:n})},setTranslateExtent:n=>{e().d3Zoom?.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=e(),i=r().filter(l=>l.selected).map(l=>Lc(l.id,!1)),a=n.filter(l=>l.selected).map(l=>Lc(l.id,!1));X1({changedNodes:i,changedEdges:a,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(s=>{s.positionAbsolute=r7(s.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:i,d3Zoom:a,d3Selection:l,translateExtent:c}=e();if(!a||!l||!n.x&&!n.y)return!1;const d=$l.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),h=[[0,0],[s,i]],m=a?.constrain()(d,h,c);return a.transform(l,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>t({connectionNodeId:Mc.connectionNodeId,connectionHandleId:Mc.connectionHandleId,connectionHandleType:Mc.connectionHandleType,connectionStatus:Mc.connectionStatus,connectionStartHandle:Mc.connectionStartHandle,connectionEndHandle:Mc.connectionEndHandle}),reset:()=>t({...Mc})}),Object.is),fG=({children:t})=>{const e=b.useRef(null);return e.current||(e.current=PCe()),oe.createElement(t7e,{value:e.current},t)};fG.displayName="ReactFlowProvider";const mG=({children:t})=>b.useContext(nw)?oe.createElement(oe.Fragment,null,t):oe.createElement(fG,null,t);mG.displayName="ReactFlowWrapper";const zCe={input:VW,default:lj,output:WW,group:c7},ICe={default:Ly,straight:a7,step:i7,smoothstep:sw,simplebezier:s7},LCe=[0,0],BCe=[15,15],FCe={x:0,y:0,zoom:1},qCe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},pG=b.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i=zCe,edgeTypes:a=ICe,onNodeClick:l,onEdgeClick:c,onInit:d,onMove:h,onMoveStart:m,onMoveEnd:g,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,onNodeMouseEnter:j,onNodeMouseMove:N,onNodeMouseLeave:T,onNodeContextMenu:E,onNodeDoubleClick:_,onNodeDragStart:A,onNodeDrag:D,onNodeDragStop:q,onNodesDelete:B,onEdgesDelete:H,onSelectionChange:W,onSelectionDragStart:ee,onSelectionDrag:I,onSelectionDragStop:V,onSelectionContextMenu:L,onSelectionStart:$,onSelectionEnd:K,connectionMode:Y=vd.Strict,connectionLineType:R=qc.Bezier,connectionLineStyle:ie,connectionLineComponent:X,connectionLineContainerStyle:z,deleteKeyCode:U="Backspace",selectionKeyCode:te="Shift",selectionOnDrag:ne=!1,selectionMode:G=Np.Full,panActivationKeyCode:se="Space",multiSelectionKeyCode:re=zy()?"Meta":"Control",zoomActivationKeyCode:ae=zy()?"Meta":"Control",snapToGrid:_e=!1,snapGrid:Be=BCe,onlyRenderVisibleElements:Ye=!1,selectNodesOnDrag:Je=!0,nodesDraggable:Oe,nodesConnectable:Ve,nodesFocusable:Ue,nodeOrigin:$e=LCe,edgesFocusable:jt,edgesUpdatable:vt,elementsSelectable:$n,defaultViewport:qt=FCe,minZoom:un=.5,maxZoom:Mt=2,translateExtent:ct=uj,preventScrolling:Ne=!0,nodeExtent:ze,defaultMarkerColor:rt="#b1b1b7",zoomOnScroll:bt=!0,zoomOnPinch:zt=!0,panOnScroll:Rt=!1,panOnScrollSpeed:Hn=.5,panOnScrollMode:We=Yu.Free,zoomOnDoubleClick:ot=!0,panOnDrag:dn=!0,onPaneClick:Pt,onPaneMouseEnter:xn,onPaneMouseMove:dt,onPaneMouseLeave:rn,onPaneScroll:wt,onPaneContextMenu:Wt,children:Gt,onEdgeContextMenu:lt,onEdgeDoubleClick:ve,onEdgeMouseEnter:He,onEdgeMouseMove:ht,onEdgeMouseLeave:vn,onEdgeUpdate:Qn,onEdgeUpdateStart:fr,onEdgeUpdateEnd:ar,onReconnect:xs,onReconnectStart:vs,onReconnectEnd:js,reconnectRadius:ge=10,edgeUpdaterRadius:Ie=10,onNodesChange:Et,onEdgesChange:kn,noDragClassName:Hr="nodrag",noWheelClassName:Mr="nowheel",noPanClassName:Rr="nopan",fitView:Ns=!1,fitViewOptions:Vf,connectOnClick:hw=!0,attributionPosition:fw,proOptions:Dg,defaultEdgeOptions:xu,elevateNodesOnSelect:Uf=!0,elevateEdgesOnSelect:rc=!1,disableKeyboardA11y:Jo=!1,autoPanOnConnect:vu=!0,autoPanOnNodeDrag:sc=!0,connectionRadius:Kr=20,isValidConnection:Pg,onError:zg,style:el,id:tl,nodeDragThreshold:mw,...Ig},Lg)=>{const Wf=tl||"1";return oe.createElement("div",{...Ig,style:{...el,...qCe},ref:Lg,className:Ls(["react-flow",s]),"data-testid":"rf__wrapper",id:tl},oe.createElement(mG,null,oe.createElement(DCe,{onInit:d,onMove:h,onMoveStart:m,onMoveEnd:g,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:j,onNodeMouseMove:N,onNodeMouseLeave:T,onNodeContextMenu:E,onNodeDoubleClick:_,nodeTypes:i,edgeTypes:a,connectionLineType:R,connectionLineStyle:ie,connectionLineComponent:X,connectionLineContainerStyle:z,selectionKeyCode:te,selectionOnDrag:ne,selectionMode:G,deleteKeyCode:U,multiSelectionKeyCode:re,panActivationKeyCode:se,zoomActivationKeyCode:ae,onlyRenderVisibleElements:Ye,selectNodesOnDrag:Je,defaultViewport:qt,translateExtent:ct,minZoom:un,maxZoom:Mt,preventScrolling:Ne,zoomOnScroll:bt,zoomOnPinch:zt,zoomOnDoubleClick:ot,panOnScroll:Rt,panOnScrollSpeed:Hn,panOnScrollMode:We,panOnDrag:dn,onPaneClick:Pt,onPaneMouseEnter:xn,onPaneMouseMove:dt,onPaneMouseLeave:rn,onPaneScroll:wt,onPaneContextMenu:Wt,onSelectionContextMenu:L,onSelectionStart:$,onSelectionEnd:K,onEdgeContextMenu:lt,onEdgeDoubleClick:ve,onEdgeMouseEnter:He,onEdgeMouseMove:ht,onEdgeMouseLeave:vn,onReconnect:xs??Qn,onReconnectStart:vs??fr,onReconnectEnd:js??ar,reconnectRadius:ge??Ie,defaultMarkerColor:rt,noDragClassName:Hr,noWheelClassName:Mr,noPanClassName:Rr,elevateEdgesOnSelect:rc,rfId:Wf,disableKeyboardA11y:Jo,nodeOrigin:$e,nodeExtent:ze}),oe.createElement(A7e,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,nodesDraggable:Oe,nodesConnectable:Ve,nodesFocusable:Ue,edgesFocusable:jt,edgesUpdatable:vt,elementsSelectable:$n,elevateNodesOnSelect:Uf,minZoom:un,maxZoom:Mt,nodeExtent:ze,onNodesChange:Et,onEdgesChange:kn,snapToGrid:_e,snapGrid:Be,connectionMode:Y,translateExtent:ct,connectOnClick:hw,defaultEdgeOptions:xu,fitView:Ns,fitViewOptions:Vf,onNodesDelete:B,onEdgesDelete:H,onNodeDragStart:A,onNodeDrag:D,onNodeDragStop:q,onSelectionDrag:I,onSelectionDragStart:ee,onSelectionDragStop:V,noPanClassName:Rr,nodeOrigin:$e,rfId:Wf,autoPanOnConnect:vu,autoPanOnNodeDrag:sc,onError:zg,connectionRadius:Kr,isValidConnection:Pg,nodeDragThreshold:mw}),oe.createElement(E7e,{onSelectionChange:W}),Gt,oe.createElement(r7e,{proOptions:Dg,position:fw}),oe.createElement(z7e,{rfId:Wf,disableKeyboardA11y:Jo})))});pG.displayName="ReactFlow";function gG(t){return e=>{const[n,r]=b.useState(e),s=b.useCallback(i=>r(a=>t(i,a)),[]);return[n,r,s]}}const $Ce=gG(tG),HCe=gG(Y7e),xG=({id:t,x:e,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:d,borderRadius:h,shapeRendering:m,onClick:g,selected:x})=>{const{background:y,backgroundColor:w}=i||{},S=a||y||w;return oe.createElement("rect",{className:Ls(["react-flow__minimap-node",{selected:x},d]),x:e,y:n,rx:h,ry:h,width:r,height:s,fill:S,stroke:l,strokeWidth:c,shapeRendering:m,onClick:g?k=>g(k,t):void 0})};xG.displayName="MiniMapNode";var QCe=b.memo(xG);const VCe=t=>t.nodeOrigin,UCe=t=>t.getNodes().filter(e=>!e.hidden&&e.width&&e.height),v5=t=>t instanceof Function?t:()=>t;function WCe({nodeStrokeColor:t="transparent",nodeColor:e="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:i=QCe,onClick:a}){const l=gr(UCe,ks),c=gr(VCe),d=v5(e),h=v5(t),m=v5(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return oe.createElement(oe.Fragment,null,l.map(x=>{const{x:y,y:w}=id(x,c).positionAbsolute;return oe.createElement(i,{key:x.id,x:y,y:w,width:x.width,height:x.height,style:x.style,selected:x.selected,className:m(x),color:d(x),borderRadius:r,strokeColor:h(x),strokeWidth:s,shapeRendering:g,onClick:a,id:x.id})}))}var GCe=b.memo(WCe);const XCe=200,YCe=150,KCe=t=>{const e=t.getNodes(),n={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:n,boundingRect:e.length>0?a7e(iw(e,t.nodeOrigin),n):n,rfId:t.rfId}},ZCe="react-flow__minimap-desc";function vG({style:t,className:e,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a=2,nodeComponent:l,maskColor:c="rgb(240, 240, 240, 0.6)",maskStrokeColor:d="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:w=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:j=10,offsetScale:N=5}){const T=gs(),E=b.useRef(null),{boundingRect:_,viewBB:A,rfId:D}=gr(KCe,ks),q=t?.width??XCe,B=t?.height??YCe,H=_.width/q,W=_.height/B,ee=Math.max(H,W),I=ee*q,V=ee*B,L=N*ee,$=_.x-(I-_.width)/2-L,K=_.y-(V-_.height)/2-L,Y=I+L*2,R=V+L*2,ie=`${ZCe}-${D}`,X=b.useRef(0);X.current=ee,b.useEffect(()=>{if(E.current){const te=va(E.current),ne=re=>{const{transform:ae,d3Selection:_e,d3Zoom:Be}=T.getState();if(re.sourceEvent.type!=="wheel"||!_e||!Be)return;const Ye=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*j,Je=ae[2]*Math.pow(2,Ye);Be.scaleTo(_e,Je)},G=re=>{const{transform:ae,d3Selection:_e,d3Zoom:Be,translateExtent:Ye,width:Je,height:Oe}=T.getState();if(re.sourceEvent.type!=="mousemove"||!_e||!Be)return;const Ve=X.current*Math.max(1,ae[2])*(k?-1:1),Ue={x:ae[0]-re.sourceEvent.movementX*Ve,y:ae[1]-re.sourceEvent.movementY*Ve},$e=[[0,0],[Je,Oe]],jt=$l.translate(Ue.x,Ue.y).scale(ae[2]),vt=Be.constrain()(jt,$e,Ye);Be.transform(_e,vt)},se=kW().on("zoom",y?G:null).on("zoom.wheel",w?ne:null);return te.call(se),()=>{te.on("zoom",null)}}},[y,w,k,j]);const z=g?te=>{const ne=Qa(te);g(te,{x:ne[0],y:ne[1]})}:void 0,U=x?(te,ne)=>{const G=T.getState().nodeInternals.get(ne);x(te,G)}:void 0;return oe.createElement(rw,{position:m,style:t,className:Ls(["react-flow__minimap",e]),"data-testid":"rf__minimap"},oe.createElement("svg",{width:q,height:B,viewBox:`${$} ${K} ${Y} ${R}`,role:"img","aria-labelledby":ie,ref:E,onClick:z},S&&oe.createElement("title",{id:ie},S),oe.createElement(GCe,{onClick:U,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),oe.createElement("path",{className:"react-flow__minimap-mask",d:`M${$-L},${K-L}h${Y+L*2}v${R+L*2}h${-Y-L*2}z + M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:c,fillRule:"evenodd",stroke:d,strokeWidth:h,pointerEvents:"none"})))}vG.displayName="MiniMap";var JCe=b.memo(vG);function e8e(){return oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},oe.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function t8e(){return oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},oe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function n8e(){return oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},oe.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function r8e(){return oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},oe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function s8e(){return oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},oe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const g0=({children:t,className:e,...n})=>oe.createElement("button",{type:"button",className:Ls(["react-flow__controls-button",e]),...n},t);g0.displayName="ControlButton";const i8e=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),yG=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:d,children:h,position:m="bottom-left"})=>{const g=gs(),[x,y]=b.useState(!1),{isInteractive:w,minZoomReached:S,maxZoomReached:k}=gr(i8e,ks),{zoomIn:j,zoomOut:N,fitView:T}=u7();if(b.useEffect(()=>{y(!0)},[]),!x)return null;const E=()=>{j(),i?.()},_=()=>{N(),a?.()},A=()=>{T(s),l?.()},D=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),c?.(!w)};return oe.createElement(rw,{className:Ls(["react-flow__controls",d]),position:m,style:t,"data-testid":"rf__controls"},e&&oe.createElement(oe.Fragment,null,oe.createElement(g0,{onClick:E,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},oe.createElement(e8e,null)),oe.createElement(g0,{onClick:_,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},oe.createElement(t8e,null))),n&&oe.createElement(g0,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},oe.createElement(n8e,null)),r&&oe.createElement(g0,{className:"react-flow__controls-interactive",onClick:D,title:"toggle interactivity","aria-label":"toggle interactivity"},w?oe.createElement(s8e,null):oe.createElement(r8e,null)),h)};yG.displayName="Controls";var a8e=b.memo(yG),Ea;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Ea||(Ea={}));function o8e({color:t,dimensions:e,lineWidth:n}){return oe.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function l8e({color:t,radius:e}){return oe.createElement("circle",{cx:e,cy:e,r:e,fill:t})}const c8e={[Ea.Dots]:"#91919a",[Ea.Lines]:"#eee",[Ea.Cross]:"#e2e2e2"},u8e={[Ea.Dots]:1,[Ea.Lines]:1,[Ea.Cross]:6},d8e=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function bG({id:t,variant:e=Ea.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=2,color:a,style:l,className:c}){const d=b.useRef(null),{transform:h,patternId:m}=gr(d8e,ks),g=a||c8e[e],x=r||u8e[e],y=e===Ea.Dots,w=e===Ea.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*h[2]||1,S[1]*h[2]||1],j=x*h[2],N=w?[j,j]:k,T=y?[j/i,j/i]:[N[0]/i,N[1]/i];return oe.createElement("svg",{className:Ls(["react-flow__background",c]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:d,"data-testid":"rf__background"},oe.createElement("pattern",{id:m+t,x:h[0]%k[0],y:h[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},y?oe.createElement(l8e,{color:g,radius:j/i}):oe.createElement(o8e,{dimensions:N,color:g,lineWidth:s})),oe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+t})`}))}bG.displayName="Background";var h8e=b.memo(bG);function h7(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var y5,ID;function f8e(){if(ID)return y5;ID=1;var t=Vz(),e=4;function n(r){return t(r,e)}return y5=n,y5}var b5,LD;function wG(){if(LD)return b5;LD=1;var t=HJ();function e(n){return typeof n=="function"?n:t}return b5=e,b5}var w5,BD;function SG(){if(BD)return w5;BD=1;var t=Uz(),e=wj(),n=wG(),r=bd();function s(i,a){var l=r(i)?t:e;return l(i,n(a))}return w5=s,w5}var S5,FD;function kG(){return FD||(FD=1,S5=SG()),S5}var k5,qD;function m8e(){if(qD)return k5;qD=1;var t=wj();function e(n,r){var s=[];return t(n,function(i,a,l){r(i,a,l)&&s.push(i)}),s}return k5=e,k5}var O5,$D;function OG(){if($D)return O5;$D=1;var t=QJ(),e=m8e(),n=Sj(),r=bd();function s(i,a){var l=r(i)?t:e;return l(i,n(a,3))}return O5=s,O5}var j5,HD;function p8e(){if(HD)return j5;HD=1;var t=Object.prototype,e=t.hasOwnProperty;function n(r,s){return r!=null&&e.call(r,s)}return j5=n,j5}var N5,QD;function jG(){if(QD)return N5;QD=1;var t=p8e(),e=VJ();function n(r,s){return r!=null&&e(r,s,t)}return N5=n,N5}var C5,VD;function g8e(){if(VD)return C5;VD=1;var t=Wz(),e=Gz(),n=Xz(),r=bd(),s=kj(),i=Oj(),a=UJ(),l=jj(),c="[object Map]",d="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function g(x){if(x==null)return!0;if(s(x)&&(r(x)||typeof x=="string"||typeof x.splice=="function"||i(x)||l(x)||n(x)))return!x.length;var y=e(x);if(y==c||y==d)return!x.size;if(a(x))return!t(x).length;for(var w in x)if(m.call(x,w))return!1;return!0}return C5=g,C5}var T5,UD;function NG(){if(UD)return T5;UD=1;function t(e){return e===void 0}return T5=t,T5}var E5,WD;function x8e(){if(WD)return E5;WD=1;function t(e,n,r,s){var i=-1,a=e==null?0:e.length;for(s&&a&&(r=e[++i]);++i1?x.setNode(y,m):x.setNode(y)}),this},s.prototype.setNode=function(h,m){return t.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},s.prototype.node=function(h){return this._nodes[h]},s.prototype.hasNode=function(h){return t.has(this._nodes,h)},s.prototype.removeNode=function(h){var m=this;if(t.has(this._nodes,h)){var g=function(x){m.removeEdge(m._edgeObjs[x])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],t.each(this.children(h),function(x){m.setParent(x)}),delete this._children[h]),t.each(t.keys(this._in[h]),g),delete this._in[h],delete this._preds[h],t.each(t.keys(this._out[h]),g),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},s.prototype.setParent=function(h,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(m))m=n;else{m+="";for(var g=m;!t.isUndefined(g);g=this.parent(g))if(g===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},s.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},s.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},s.prototype.children=function(h){if(t.isUndefined(h)&&(h=n),this._isCompound){var m=this._children[h];if(m)return t.keys(m)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},s.prototype.predecessors=function(h){var m=this._preds[h];if(m)return t.keys(m)},s.prototype.successors=function(h){var m=this._sucs[h];if(m)return t.keys(m)},s.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return t.union(m,this.successors(h))},s.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},s.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var g=this;t.each(this._nodes,function(w,S){h(S)&&m.setNode(S,w)}),t.each(this._edgeObjs,function(w){m.hasNode(w.v)&&m.hasNode(w.w)&&m.setEdge(w,g.edge(w))});var x={};function y(w){var S=g.parent(w);return S===void 0||m.hasNode(S)?(x[w]=S,S):S in x?x[S]:y(S)}return this._isCompound&&t.each(m.nodes(),function(w){m.setParent(w,y(w))}),m},s.prototype.setDefaultEdgeLabel=function(h){return t.isFunction(h)||(h=t.constant(h)),this._defaultEdgeLabelFn=h,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return t.values(this._edgeObjs)},s.prototype.setPath=function(h,m){var g=this,x=arguments;return t.reduce(h,function(y,w){return x.length>1?g.setEdge(y,w,m):g.setEdge(y,w),w}),this},s.prototype.setEdge=function(){var h,m,g,x,y=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(h=w.v,m=w.w,g=w.name,arguments.length===2&&(x=arguments[1],y=!0)):(h=w,m=arguments[1],g=arguments[3],arguments.length>2&&(x=arguments[2],y=!0)),h=""+h,m=""+m,t.isUndefined(g)||(g=""+g);var S=l(this._isDirected,h,m,g);if(t.has(this._edgeLabels,S))return y&&(this._edgeLabels[S]=x),this;if(!t.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[S]=y?x:this._defaultEdgeLabelFn(h,m,g);var k=c(this._isDirected,h,m,g);return h=k.v,m=k.w,Object.freeze(k),this._edgeObjs[S]=k,i(this._preds[m],h),i(this._sucs[h],m),this._in[m][S]=k,this._out[h][S]=k,this._edgeCount++,this},s.prototype.edge=function(h,m,g){var x=arguments.length===1?d(this._isDirected,arguments[0]):l(this._isDirected,h,m,g);return this._edgeLabels[x]},s.prototype.hasEdge=function(h,m,g){var x=arguments.length===1?d(this._isDirected,arguments[0]):l(this._isDirected,h,m,g);return t.has(this._edgeLabels,x)},s.prototype.removeEdge=function(h,m,g){var x=arguments.length===1?d(this._isDirected,arguments[0]):l(this._isDirected,h,m,g),y=this._edgeObjs[x];return y&&(h=y.v,m=y.w,delete this._edgeLabels[x],delete this._edgeObjs[x],a(this._preds[m],h),a(this._sucs[h],m),delete this._in[m][x],delete this._out[h][x],this._edgeCount--),this},s.prototype.inEdges=function(h,m){var g=this._in[h];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.v===m}):x}},s.prototype.outEdges=function(h,m){var g=this._out[h];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.w===m}):x}},s.prototype.nodeEdges=function(h,m){var g=this.inEdges(h,m);if(g)return g.concat(this.outEdges(h,m))};function i(h,m){h[m]?h[m]++:h[m]=1}function a(h,m){--h[m]||delete h[m]}function l(h,m,g,x){var y=""+m,w=""+g;if(!h&&y>w){var S=y;y=w,w=S}return y+r+w+r+(t.isUndefined(x)?e:x)}function c(h,m,g,x){var y=""+m,w=""+g;if(!h&&y>w){var S=y;y=w,w=S}var k={v:y,w};return x&&(k.name=x),k}function d(h,m){return l(h,m.v,m.w,m.name)}return $5}var H5,oP;function N8e(){return oP||(oP=1,H5="2.1.8"),H5}var Q5,lP;function C8e(){return lP||(lP=1,Q5={Graph:f7(),version:N8e()}),Q5}var V5,cP;function T8e(){if(cP)return V5;cP=1;var t=Ia(),e=f7();V5={write:n,read:i};function n(a){var l={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:r(a),edges:s(a)};return t.isUndefined(a.graph())||(l.value=t.clone(a.graph())),l}function r(a){return t.map(a.nodes(),function(l){var c=a.node(l),d=a.parent(l),h={v:l};return t.isUndefined(c)||(h.value=c),t.isUndefined(d)||(h.parent=d),h})}function s(a){return t.map(a.edges(),function(l){var c=a.edge(l),d={v:l.v,w:l.w};return t.isUndefined(l.name)||(d.name=l.name),t.isUndefined(c)||(d.value=c),d})}function i(a){var l=new e(a.options).setGraph(a.value);return t.each(a.nodes,function(c){l.setNode(c.v,c.value),c.parent&&l.setParent(c.v,c.parent)}),t.each(a.edges,function(c){l.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),l}return V5}var U5,uP;function E8e(){if(uP)return U5;uP=1;var t=Ia();U5=e;function e(n){var r={},s=[],i;function a(l){t.has(r,l)||(r[l]=!0,i.push(l),t.each(n.successors(l),a),t.each(n.predecessors(l),a))}return t.each(n.nodes(),function(l){i=[],a(l),i.length&&s.push(i)}),s}return U5}var W5,dP;function _G(){if(dP)return W5;dP=1;var t=Ia();W5=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(n){return n.key})},e.prototype.has=function(n){return t.has(this._keyIndices,n)},e.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(n,r){var s=this._keyIndices;if(n=String(n),!t.has(s,n)){var i=this._arr,a=i.length;return s[n]=a,i.push({key:n,priority:r}),this._decrease(a),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},e.prototype.decrease=function(n,r){var s=this._keyIndices[n];if(r>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[s].priority+" New: "+r);this._arr[s].priority=r,this._decrease(s)},e.prototype._heapify=function(n){var r=this._arr,s=2*n,i=s+1,a=n;s>1,!(r[i].priority0&&(m=h.removeMin(),g=d[m],g.distance!==Number.POSITIVE_INFINITY);)c(m).forEach(x);return d}return G5}var X5,fP;function _8e(){if(fP)return X5;fP=1;var t=AG(),e=Ia();X5=n;function n(r,s,i){return e.transform(r.nodes(),function(a,l){a[l]=t(r,l,s,i)},{})}return X5}var Y5,mP;function MG(){if(mP)return Y5;mP=1;var t=Ia();Y5=e;function e(n){var r=0,s=[],i={},a=[];function l(c){var d=i[c]={onStack:!0,lowlink:r,index:r++};if(s.push(c),n.successors(c).forEach(function(g){t.has(i,g)?i[g].onStack&&(d.lowlink=Math.min(d.lowlink,i[g].index)):(l(g),d.lowlink=Math.min(d.lowlink,i[g].lowlink))}),d.lowlink===d.index){var h=[],m;do m=s.pop(),i[m].onStack=!1,h.push(m);while(c!==m);a.push(h)}}return n.nodes().forEach(function(c){t.has(i,c)||l(c)}),a}return Y5}var K5,pP;function A8e(){if(pP)return K5;pP=1;var t=Ia(),e=MG();K5=n;function n(r){return t.filter(e(r),function(s){return s.length>1||s.length===1&&r.hasEdge(s[0],s[0])})}return K5}var Z5,gP;function M8e(){if(gP)return Z5;gP=1;var t=Ia();Z5=n;var e=t.constant(1);function n(s,i,a){return r(s,i||e,a||function(l){return s.outEdges(l)})}function r(s,i,a){var l={},c=s.nodes();return c.forEach(function(d){l[d]={},l[d][d]={distance:0},c.forEach(function(h){d!==h&&(l[d][h]={distance:Number.POSITIVE_INFINITY})}),a(d).forEach(function(h){var m=h.v===d?h.w:h.v,g=i(h);l[d][m]={distance:g,predecessor:d}})}),c.forEach(function(d){var h=l[d];c.forEach(function(m){var g=l[m];c.forEach(function(x){var y=g[d],w=h[x],S=g[x],k=y.distance+w.distance;k0;){if(d=c.removeMin(),t.has(l,d))a.setEdge(d,l[d]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(d).forEach(h)}return a}return s3}var i3,kP;function I8e(){return kP||(kP=1,i3={components:E8e(),dijkstra:AG(),dijkstraAll:_8e(),findCycles:A8e(),floydWarshall:M8e(),isAcyclic:R8e(),postorder:D8e(),preorder:P8e(),prim:z8e(),tarjan:MG(),topsort:RG()}),i3}var a3,OP;function L8e(){if(OP)return a3;OP=1;var t=C8e();return a3={Graph:t.Graph,json:T8e(),alg:I8e(),version:t.version},a3}var o3,jP;function to(){if(jP)return o3;jP=1;var t;if(typeof h7=="function")try{t=L8e()}catch{}return t||(t=window.graphlib),o3=t,o3}var l3,NP;function B8e(){if(NP)return l3;NP=1;var t=Vz(),e=1,n=4;function r(s){return t(s,e|n)}return l3=r,l3}var c3,CP;function F8e(){if(CP)return c3;CP=1;var t=Cj(),e=eI(),n=Jz(),r=Hy(),s=Object.prototype,i=s.hasOwnProperty,a=t(function(l,c){l=Object(l);var d=-1,h=c.length,m=h>2?c[2]:void 0;for(m&&n(c[0],c[1],m)&&(h=1);++d1?i[l-1]:void 0,d=l>2?i[2]:void 0;for(c=r.length>3&&typeof c=="function"?(l--,c):void 0,d&&e(i[0],i[1],d)&&(c=l<3?void 0:c,l=1),s=Object(s);++a0;--S)if(w=h[S].dequeue(),w){g=g.concat(a(d,h,m,w,!0));break}}}return g}function a(d,h,m,g,x){var y=x?[]:void 0;return t.forEach(d.inEdges(g.v),function(w){var S=d.edge(w),k=d.node(w.v);x&&y.push({v:w.v,w:w.w}),k.out-=S,c(h,m,k)}),t.forEach(d.outEdges(g.v),function(w){var S=d.edge(w),k=w.w,j=d.node(k);j.in-=S,c(h,m,j)}),d.removeNode(g.v),y}function l(d,h){var m=new e,g=0,x=0;t.forEach(d.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),t.forEach(d.edges(),function(S){var k=m.edge(S.v,S.w)||0,j=h(S),N=k+j;m.setEdge(S.v,S.w,N),x=Math.max(x,m.node(S.v).out+=j),g=Math.max(g,m.node(S.w).in+=j)});var y=t.range(x+g+3).map(function(){return new n}),w=g+1;return t.forEach(m.nodes(),function(S){c(y,w,m.node(S))}),{graph:m,buckets:y,zeroIdx:w}}function c(d,h,m){m.out?m.in?d[m.out-m.in+h].enqueue(m):d[d.length-1].enqueue(m):d[0].enqueue(m)}return C3}var T3,UP;function nTe(){if(UP)return T3;UP=1;var t=Ar(),e=tTe();T3={run:n,undo:s};function n(i){var a=i.graph().acyclicer==="greedy"?e(i,l(i)):r(i);t.forEach(a,function(c){var d=i.edge(c);i.removeEdge(c),d.forwardName=c.name,d.reversed=!0,i.setEdge(c.w,c.v,d,t.uniqueId("rev"))});function l(c){return function(d){return c.edge(d).weight}}}function r(i){var a=[],l={},c={};function d(h){t.has(c,h)||(c[h]=!0,l[h]=!0,t.forEach(i.outEdges(h),function(m){t.has(l,m.w)?a.push(m):d(m.w)}),delete l[h])}return t.forEach(i.nodes(),d),a}function s(i){t.forEach(i.edges(),function(a){var l=i.edge(a);if(l.reversed){i.removeEdge(a);var c=l.forwardName;delete l.reversed,delete l.forwardName,i.setEdge(a.w,a.v,l,c)}})}return T3}var E3,WP;function Ti(){if(WP)return E3;WP=1;var t=Ar(),e=to().Graph;E3={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:i,predecessorWeights:a,intersectRect:l,buildLayerMatrix:c,normalizeRanks:d,removeEmptyRanks:h,addBorderNode:m,maxRank:g,partition:x,time:y,notime:w};function n(S,k,j,N){var T;do T=t.uniqueId(N);while(S.hasNode(T));return j.dummy=k,S.setNode(T,j),T}function r(S){var k=new e().setGraph(S.graph());return t.forEach(S.nodes(),function(j){k.setNode(j,S.node(j))}),t.forEach(S.edges(),function(j){var N=k.edge(j.v,j.w)||{weight:0,minlen:1},T=S.edge(j);k.setEdge(j.v,j.w,{weight:N.weight+T.weight,minlen:Math.max(N.minlen,T.minlen)})}),k}function s(S){var k=new e({multigraph:S.isMultigraph()}).setGraph(S.graph());return t.forEach(S.nodes(),function(j){S.children(j).length||k.setNode(j,S.node(j))}),t.forEach(S.edges(),function(j){k.setEdge(j,S.edge(j))}),k}function i(S){var k=t.map(S.nodes(),function(j){var N={};return t.forEach(S.outEdges(j),function(T){N[T.w]=(N[T.w]||0)+S.edge(T).weight}),N});return t.zipObject(S.nodes(),k)}function a(S){var k=t.map(S.nodes(),function(j){var N={};return t.forEach(S.inEdges(j),function(T){N[T.v]=(N[T.v]||0)+S.edge(T).weight}),N});return t.zipObject(S.nodes(),k)}function l(S,k){var j=S.x,N=S.y,T=k.x-j,E=k.y-N,_=S.width/2,A=S.height/2;if(!T&&!E)throw new Error("Not possible to find intersection inside of the rectangle");var D,q;return Math.abs(E)*_>Math.abs(T)*A?(E<0&&(A=-A),D=A*T/E,q=A):(T<0&&(_=-_),D=_,q=_*E/T),{x:j+D,y:N+q}}function c(S){var k=t.map(t.range(g(S)+1),function(){return[]});return t.forEach(S.nodes(),function(j){var N=S.node(j),T=N.rank;t.isUndefined(T)||(k[T][N.order]=j)}),k}function d(S){var k=t.min(t.map(S.nodes(),function(j){return S.node(j).rank}));t.forEach(S.nodes(),function(j){var N=S.node(j);t.has(N,"rank")&&(N.rank-=k)})}function h(S){var k=t.min(t.map(S.nodes(),function(E){return S.node(E).rank})),j=[];t.forEach(S.nodes(),function(E){var _=S.node(E).rank-k;j[_]||(j[_]=[]),j[_].push(E)});var N=0,T=S.graph().nodeRankFactor;t.forEach(j,function(E,_){t.isUndefined(E)&&_%T!==0?--N:N&&t.forEach(E,function(A){S.node(A).rank+=N})})}function m(S,k,j,N){var T={width:0,height:0};return arguments.length>=4&&(T.rank=j,T.order=N),n(S,"border",T,k)}function g(S){return t.max(t.map(S.nodes(),function(k){var j=S.node(k).rank;if(!t.isUndefined(j))return j}))}function x(S,k){var j={lhs:[],rhs:[]};return t.forEach(S,function(N){k(N)?j.lhs.push(N):j.rhs.push(N)}),j}function y(S,k){var j=t.now();try{return k()}finally{console.log(S+" time: "+(t.now()-j)+"ms")}}function w(S,k){return k()}return E3}var _3,GP;function rTe(){if(GP)return _3;GP=1;var t=Ar(),e=Ti();_3={run:n,undo:s};function n(i){i.graph().dummyChains=[],t.forEach(i.edges(),function(a){r(i,a)})}function r(i,a){var l=a.v,c=i.node(l).rank,d=a.w,h=i.node(d).rank,m=a.name,g=i.edge(a),x=g.labelRank;if(h!==c+1){i.removeEdge(a);var y,w,S;for(S=0,++c;cq.lim&&(B=q,H=!0);var W=t.filter(T.edges(),function(ee){return H===j(N,N.node(ee.v),B)&&H!==j(N,N.node(ee.w),B)});return t.minBy(W,function(ee){return n(T,ee)})}function w(N,T,E,_){var A=E.v,D=E.w;N.removeEdge(A,D),N.setEdge(_.v,_.w,{}),m(N),c(N,T),S(N,T)}function S(N,T){var E=t.find(N.nodes(),function(A){return!T.node(A).parent}),_=s(N,E);_=_.slice(1),t.forEach(_,function(A){var D=N.node(A).parent,q=T.edge(A,D),B=!1;q||(q=T.edge(D,A),B=!0),T.node(A).rank=T.node(D).rank+(B?q.minlen:-q.minlen)})}function k(N,T,E){return N.hasEdge(T,E)}function j(N,T,E){return E.low<=T.lim&&T.lim<=E.lim}return R3}var D3,ZP;function iTe(){if(ZP)return D3;ZP=1;var t=By(),e=t.longestPath,n=IG(),r=sTe();D3=s;function s(c){switch(c.graph().ranker){case"network-simplex":l(c);break;case"tight-tree":a(c);break;case"longest-path":i(c);break;default:l(c)}}var i=e;function a(c){e(c),n(c)}function l(c){r(c)}return D3}var P3,JP;function aTe(){if(JP)return P3;JP=1;var t=Ar();P3=e;function e(s){var i=r(s);t.forEach(s.graph().dummyChains,function(a){for(var l=s.node(a),c=l.edgeObj,d=n(s,i,c.v,c.w),h=d.path,m=d.lca,g=0,x=h[g],y=!0;a!==c.w;){if(l=s.node(a),y){for(;(x=h[g])!==m&&s.node(x).maxRankh||m>i[g].lim));for(x=g,g=l;(g=s.parent(g))!==x;)d.push(g);return{path:c.concat(d.reverse()),lca:x}}function r(s){var i={},a=0;function l(c){var d=a;t.forEach(s.children(c),l),i[c]={low:d,lim:a++}}return t.forEach(s.children(),l),i}return P3}var z3,ez;function oTe(){if(ez)return z3;ez=1;var t=Ar(),e=Ti();z3={run:n,cleanup:a};function n(l){var c=e.addDummyNode(l,"root",{},"_root"),d=s(l),h=t.max(t.values(d))-1,m=2*h+1;l.graph().nestingRoot=c,t.forEach(l.edges(),function(x){l.edge(x).minlen*=m});var g=i(l)+1;t.forEach(l.children(),function(x){r(l,c,m,g,h,d,x)}),l.graph().nodeRankFactor=m}function r(l,c,d,h,m,g,x){var y=l.children(x);if(!y.length){x!==c&&l.setEdge(c,x,{weight:0,minlen:d});return}var w=e.addBorderNode(l,"_bt"),S=e.addBorderNode(l,"_bb"),k=l.node(x);l.setParent(w,x),k.borderTop=w,l.setParent(S,x),k.borderBottom=S,t.forEach(y,function(j){r(l,c,d,h,m,g,j);var N=l.node(j),T=N.borderTop?N.borderTop:j,E=N.borderBottom?N.borderBottom:j,_=N.borderTop?h:2*h,A=T!==E?1:m-g[x]+1;l.setEdge(w,T,{weight:_,minlen:A,nestingEdge:!0}),l.setEdge(E,S,{weight:_,minlen:A,nestingEdge:!0})}),l.parent(x)||l.setEdge(c,w,{weight:0,minlen:m+g[x]})}function s(l){var c={};function d(h,m){var g=l.children(h);g&&g.length&&t.forEach(g,function(x){d(x,m+1)}),c[h]=m}return t.forEach(l.children(),function(h){d(h,1)}),c}function i(l){return t.reduce(l.edges(),function(c,d){return c+l.edge(d).weight},0)}function a(l){var c=l.graph();l.removeNode(c.nestingRoot),delete c.nestingRoot,t.forEach(l.edges(),function(d){var h=l.edge(d);h.nestingEdge&&l.removeEdge(d)})}return z3}var I3,tz;function lTe(){if(tz)return I3;tz=1;var t=Ar(),e=Ti();I3=n;function n(s){function i(a){var l=s.children(a),c=s.node(a);if(l.length&&t.forEach(l,i),t.has(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(var d=c.minRank,h=c.maxRank+1;d0;)x%2&&(y+=h[x+1]),x=x-1>>1,h[x]+=g.weight;m+=g.weight*y})),m}return F3}var q3,iz;function hTe(){if(iz)return q3;iz=1;var t=Ar();q3=e;function e(n,r){return t.map(r,function(s){var i=n.inEdges(s);if(i.length){var a=t.reduce(i,function(l,c){var d=n.edge(c),h=n.node(c.v);return{sum:l.sum+d.weight*h.order,weight:l.weight+d.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:s}})}return q3}var $3,az;function fTe(){if(az)return $3;az=1;var t=Ar();$3=e;function e(s,i){var a={};t.forEach(s,function(c,d){var h=a[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:d};t.isUndefined(c.barycenter)||(h.barycenter=c.barycenter,h.weight=c.weight)}),t.forEach(i.edges(),function(c){var d=a[c.v],h=a[c.w];!t.isUndefined(d)&&!t.isUndefined(h)&&(h.indegree++,d.out.push(a[c.w]))});var l=t.filter(a,function(c){return!c.indegree});return n(l)}function n(s){var i=[];function a(d){return function(h){h.merged||(t.isUndefined(h.barycenter)||t.isUndefined(d.barycenter)||h.barycenter>=d.barycenter)&&r(d,h)}}function l(d){return function(h){h.in.push(d),--h.indegree===0&&s.push(h)}}for(;s.length;){var c=s.pop();i.push(c),t.forEach(c.in.reverse(),a(c)),t.forEach(c.out,l(c))}return t.map(t.filter(i,function(d){return!d.merged}),function(d){return t.pick(d,["vs","i","barycenter","weight"])})}function r(s,i){var a=0,l=0;s.weight&&(a+=s.barycenter*s.weight,l+=s.weight),i.weight&&(a+=i.barycenter*i.weight,l+=i.weight),s.vs=i.vs.concat(s.vs),s.barycenter=a/l,s.weight=l,s.i=Math.min(i.i,s.i),i.merged=!0}return $3}var H3,oz;function mTe(){if(oz)return H3;oz=1;var t=Ar(),e=Ti();H3=n;function n(i,a){var l=e.partition(i,function(w){return t.has(w,"barycenter")}),c=l.lhs,d=t.sortBy(l.rhs,function(w){return-w.i}),h=[],m=0,g=0,x=0;c.sort(s(!!a)),x=r(h,d,x),t.forEach(c,function(w){x+=w.vs.length,h.push(w.vs),m+=w.barycenter*w.weight,g+=w.weight,x=r(h,d,x)});var y={vs:t.flatten(h,!0)};return g&&(y.barycenter=m/g,y.weight=g),y}function r(i,a,l){for(var c;a.length&&(c=t.last(a)).i<=l;)a.pop(),i.push(c.vs),l++;return l}function s(i){return function(a,l){return a.barycenterl.barycenter?1:i?l.i-a.i:a.i-l.i}}return H3}var Q3,lz;function pTe(){if(lz)return Q3;lz=1;var t=Ar(),e=hTe(),n=fTe(),r=mTe();Q3=s;function s(l,c,d,h){var m=l.children(c),g=l.node(c),x=g?g.borderLeft:void 0,y=g?g.borderRight:void 0,w={};x&&(m=t.filter(m,function(E){return E!==x&&E!==y}));var S=e(l,m);t.forEach(S,function(E){if(l.children(E.v).length){var _=s(l,E.v,d,h);w[E.v]=_,t.has(_,"barycenter")&&a(E,_)}});var k=n(S,d);i(k,w);var j=r(k,h);if(x&&(j.vs=t.flatten([x,j.vs,y],!0),l.predecessors(x).length)){var N=l.node(l.predecessors(x)[0]),T=l.node(l.predecessors(y)[0]);t.has(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+N.order+T.order)/(j.weight+2),j.weight+=2}return j}function i(l,c){t.forEach(l,function(d){d.vs=t.flatten(d.vs.map(function(h){return c[h]?c[h].vs:h}),!0)})}function a(l,c){t.isUndefined(l.barycenter)?(l.barycenter=c.barycenter,l.weight=c.weight):(l.barycenter=(l.barycenter*l.weight+c.barycenter*c.weight)/(l.weight+c.weight),l.weight+=c.weight)}return Q3}var V3,cz;function gTe(){if(cz)return V3;cz=1;var t=Ar(),e=to().Graph;V3=n;function n(s,i,a){var l=r(s),c=new e({compound:!0}).setGraph({root:l}).setDefaultNodeLabel(function(d){return s.node(d)});return t.forEach(s.nodes(),function(d){var h=s.node(d),m=s.parent(d);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(c.setNode(d),c.setParent(d,m||l),t.forEach(s[a](d),function(g){var x=g.v===d?g.w:g.v,y=c.edge(x,d),w=t.isUndefined(y)?0:y.weight;c.setEdge(x,d,{weight:s.edge(g).weight+w})}),t.has(h,"minRank")&&c.setNode(d,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),c}function r(s){for(var i;s.hasNode(i=t.uniqueId("_root")););return i}return V3}var U3,uz;function xTe(){if(uz)return U3;uz=1;var t=Ar();U3=e;function e(n,r,s){var i={},a;t.forEach(s,function(l){for(var c=n.parent(l),d,h;c;){if(d=n.parent(c),d?(h=i[d],i[d]=c):(h=a,a=c),h&&h!==c){r.setEdge(h,c);return}c=d}})}return U3}var W3,dz;function vTe(){if(dz)return W3;dz=1;var t=Ar(),e=uTe(),n=dTe(),r=pTe(),s=gTe(),i=xTe(),a=to().Graph,l=Ti();W3=c;function c(g){var x=l.maxRank(g),y=d(g,t.range(1,x+1),"inEdges"),w=d(g,t.range(x-1,-1,-1),"outEdges"),S=e(g);m(g,S);for(var k=Number.POSITIVE_INFINITY,j,N=0,T=0;T<4;++N,++T){h(N%2?y:w,N%4>=2),S=l.buildLayerMatrix(g);var E=n(g,S);EB)&&a(N,ee,H)})})}function E(_,A){var D=-1,q,B=0;return t.forEach(A,function(H,W){if(k.node(H).dummy==="border"){var ee=k.predecessors(H);ee.length&&(q=k.node(ee[0]).order,T(A,B,W,D,q),B=W,D=q)}T(A,B,A.length,q,_.length)}),A}return t.reduce(j,E),N}function i(k,j){if(k.node(j).dummy)return t.find(k.predecessors(j),function(N){return k.node(N).dummy})}function a(k,j,N){if(j>N){var T=j;j=N,N=T}var E=k[j];E||(k[j]=E={}),E[N]=!0}function l(k,j,N){if(j>N){var T=j;j=N,N=T}return t.has(k[j],N)}function c(k,j,N,T){var E={},_={},A={};return t.forEach(j,function(D){t.forEach(D,function(q,B){E[q]=q,_[q]=q,A[q]=B})}),t.forEach(j,function(D){var q=-1;t.forEach(D,function(B){var H=T(B);if(H.length){H=t.sortBy(H,function(L){return A[L]});for(var W=(H.length-1)/2,ee=Math.floor(W),I=Math.ceil(W);ee<=I;++ee){var V=H[ee];_[B]===B&&qo.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[o.jsx(au,{type:"target",position:kt.Top}),o.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:t.content,children:t.label}),o.jsx(au,{type:"source",position:kt.Bottom})]}));LG.displayName="EntityNode";const BG=b.memo(({data:t})=>o.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[o.jsx(au,{type:"target",position:kt.Top}),o.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:t.content,children:t.label}),o.jsx(au,{type:"source",position:kt.Bottom})]}));BG.displayName="ParagraphNode";const ETe={entity:LG,paragraph:BG};function _Te(t,e){const n=new vz.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const r=[],s=[];return t.forEach(i=>{n.setNode(i.id,{width:150,height:50})}),e.forEach(i=>{n.setEdge(i.source,i.target)}),vz.layout(n),t.forEach(i=>{const a=n.node(i.id);r.push({id:i.id,type:i.type,position:{x:a.x-75,y:a.y-25},data:{label:i.content.slice(0,20)+(i.content.length>20?"...":""),content:i.content}})}),e.forEach((i,a)=>{const l={id:`edge-${a}`,source:i.source,target:i.target,animated:t.length<=200&&i.weight>5,style:{strokeWidth:Math.min(i.weight/2,5),opacity:.6}};i.weight>10&&t.length<100&&(l.label=`${i.weight.toFixed(0)}`),s.push(l)}),{nodes:r,edges:s}}function ATe(){const t=na(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,a]=b.useState(""),[l,c]=b.useState("all"),[d,h]=b.useState(50),[m,g]=b.useState("50"),[x,y]=b.useState(!1),[w,S]=b.useState(!0),[k,j]=b.useState(!1),[N,T]=b.useState(!1),[E,_,A]=$Ce([]),[D,q,B]=HCe([]),[H,W]=b.useState(0),[ee,I]=b.useState(null),[V,L]=b.useState(null),{toast:$}=Lr(),K=b.useCallback(ne=>ne.type==="entity"?"#6366f1":ne.type==="paragraph"?"#10b981":"#6b7280",[]),Y=b.useCallback(async(ne=!1)=>{try{if(!ne&&d>200){T(!0);return}n(!0);const[G,se]=await Promise.all([NTe(d,l),CTe()]);if(s(se),G.nodes.length===0){$({title:"提示",description:"知识库为空,请先导入知识数据"}),_([]),q([]);return}const{nodes:re,edges:ae}=_Te(G.nodes,G.edges);_(re),q(ae),W(re.length),se&&se.total_nodes>d&&$({title:"提示",description:`知识图谱包含 ${se.total_nodes} 个节点,当前显示 ${re.length} 个`}),$({title:"加载成功",description:`已加载 ${re.length} 个节点,${ae.length} 条边`})}catch(G){console.error("加载知识图谱失败:",G),$({title:"加载失败",description:G instanceof Error?G.message:"未知错误",variant:"destructive"})}finally{n(!1)}},[d,l,$]),R=b.useCallback(async()=>{if(!i.trim()){$({title:"提示",description:"请输入搜索关键词"});return}try{const ne=await TTe(i);if(ne.length===0){$({title:"未找到",description:"没有找到匹配的节点"});return}const G=new Set(ne.map(se=>se.id));_(se=>se.map(re=>({...re,style:{...re.style,opacity:G.has(re.id)?1:.3,filter:G.has(re.id)?"brightness(1.2)":"brightness(0.8)"}}))),$({title:"搜索完成",description:`找到 ${ne.length} 个匹配节点`})}catch(ne){console.error("搜索失败:",ne),$({title:"搜索失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}},[i,$]),ie=b.useCallback(()=>{_(ne=>ne.map(G=>({...G,style:{...G.style,opacity:1,filter:"brightness(1)"}})))},[]),X=b.useCallback(()=>{S(!1),j(!0),Y()},[Y]),z=b.useCallback(()=>{T(!1),setTimeout(()=>{Y(!0)},0)},[Y]),U=b.useCallback((ne,G)=>{E.find(re=>re.id===G.id)&&I({id:G.id,type:G.type,content:G.data.content})},[E]);b.useEffect(()=>{w||k&&Y()},[d,l,w,k]);const te=b.useCallback((ne,G)=>{const se=E.find(_e=>_e.id===G.source),re=E.find(_e=>_e.id===G.target),ae=D.find(_e=>_e.id===G.id);se&&re&&ae&&L({source:{id:se.id,type:se.type,content:se.data.content},target:{id:re.id,type:re.type,content:re.data.content},edge:{source:G.source,target:G.target,weight:parseFloat(G.label||"0")}})},[E,D]);return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),o.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),r&&o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsxs(tn,{variant:"outline",className:"gap-1",children:[o.jsx(sk,{className:"h-3 w-3"}),"节点: ",r.total_nodes]}),o.jsxs(tn,{variant:"outline",className:"gap-1",children:[o.jsx(NI,{className:"h-3 w-3"}),"边: ",r.total_edges]}),o.jsxs(tn,{variant:"outline",className:"gap-1",children:[o.jsx(Xi,{className:"h-3 w-3"}),"实体: ",r.entity_nodes]}),o.jsxs(tn,{variant:"outline",className:"gap-1",children:[o.jsx(Po,{className:"h-3 w-3"}),"段落: ",r.paragraph_nodes]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[o.jsxs("div",{className:"flex-1 flex gap-2",children:[o.jsx(Pe,{placeholder:"搜索节点内容...",value:i,onChange:ne=>a(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&R(),className:"flex-1"}),o.jsx(ue,{onClick:R,size:"sm",children:o.jsx(ii,{className:"h-4 w-4"})}),o.jsx(ue,{onClick:ie,variant:"outline",size:"sm",children:"重置"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(Vt,{value:l,onValueChange:ne=>c(ne),children:[o.jsx($t,{className:"w-[120px]",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部节点"}),o.jsx(De,{value:"entity",children:"仅实体"}),o.jsx(De,{value:"paragraph",children:"仅段落"})]})]}),o.jsxs(Vt,{value:d===1e4?"all":x?"custom":d.toString(),onValueChange:ne=>{ne==="custom"?(y(!0),g(d.toString())):ne==="all"?(y(!1),h(1e4)):(y(!1),h(Number(ne)))},children:[o.jsx($t,{className:"w-[120px]",children:o.jsx(Ut,{})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"50",children:"50 节点"}),o.jsx(De,{value:"100",children:"100 节点"}),o.jsx(De,{value:"200",children:"200 节点"}),o.jsx(De,{value:"500",children:"500 节点"}),o.jsx(De,{value:"1000",children:"1000 节点"}),o.jsx(De,{value:"all",children:"全部 (最多10000)"}),o.jsx(De,{value:"custom",children:"自定义..."})]})]}),x&&o.jsx(Pe,{type:"number",min:"50",value:m,onChange:ne=>g(ne.target.value),onBlur:()=>{const ne=parseInt(m);!isNaN(ne)&&ne>=50?h(ne):(g("50"),h(50))},onKeyDown:ne=>{if(ne.key==="Enter"){const G=parseInt(m);!isNaN(G)&&G>=50?h(G):(g("50"),h(50))}},placeholder:"最少50个",className:"w-[120px]"}),o.jsx(ue,{onClick:()=>Y(),variant:"outline",size:"sm",disabled:e,children:o.jsx(Qs,{className:xe("h-4 w-4",e&&"animate-spin")})})]})]})]}),o.jsx("div",{className:"flex-1 relative",children:e?o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx(Qs,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),o.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):E.length===0?o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx(sk,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),o.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):o.jsxs(pG,{nodes:E,edges:D,onNodesChange:A,onEdgesChange:B,onNodeClick:U,onEdgeClick:te,nodeTypes:ETe,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:H<=500,nodesDraggable:H<=1e3,attributionPosition:"bottom-left",children:[o.jsx(h8e,{variant:Ea.Dots,gap:12,size:1}),o.jsx(a8e,{}),H<=500&&o.jsx(JCe,{nodeColor:K,nodeBorderRadius:8,pannable:!0,zoomable:!0}),o.jsxs(rw,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[o.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),o.jsxs("div",{className:"space-y-2 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),o.jsx("span",{children:"实体节点"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),o.jsx("span",{children:"段落节点"})]}),H>200&&o.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[o.jsx("div",{className:"font-semibold",children:"性能模式"}),o.jsx("div",{children:"已禁用动画"}),H>500&&o.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),o.jsx(Er,{open:!!ee,onOpenChange:ne=>!ne&&I(null),children:o.jsxs(wr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsx(Sr,{children:o.jsx(kr,{children:"节点详情"})}),ee&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"grid grid-cols-2 gap-4",children:o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),o.jsx("div",{className:"mt-1",children:o.jsx(tn,{variant:ee.type==="entity"?"default":"secondary",children:ee.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),o.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:ee.id})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),o.jsx(pn,{className:"mt-1 h-40 p-3 bg-muted rounded",children:o.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ee.content})})]})]})]})}),o.jsx(Er,{open:!!V,onOpenChange:ne=>!ne&&L(null),children:o.jsxs(wr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[o.jsx(Sr,{children:o.jsx(kr,{children:"边详情"})}),V&&o.jsx(pn,{className:"flex-1 pr-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),o.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:V.source.content}),o.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[V.source.id.slice(0,40),"..."]})]}),o.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),o.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),o.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:V.target.content}),o.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[V.target.id.slice(0,40),"..."]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),o.jsx("div",{className:"mt-1",children:o.jsx(tn,{variant:"outline",className:"text-base font-mono",children:V.edge.weight.toFixed(4)})})]})]})})]})}),o.jsx(Fn,{open:w,onOpenChange:S,children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"加载知识图谱"}),o.jsxs(zn,{children:["知识图谱的动态展示会消耗较多系统资源。",o.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{onClick:()=>t({to:"/"}),children:"取消 (返回首页)"}),o.jsx(In,{onClick:X,children:"确认加载"})]})]})}),o.jsx(Fn,{open:N,onOpenChange:T,children:o.jsxs(Mn,{children:[o.jsxs(Rn,{children:[o.jsx(Pn,{children:"⚠️ 节点数量较多"}),o.jsx(zn,{asChild:!0,children:o.jsxs("div",{children:[o.jsxs("p",{children:["您正在尝试加载 ",o.jsx("strong",{className:"text-orange-600",children:d>=1e4?"全部 (最多10000个)":d})," 个节点。"]}),o.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),o.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[o.jsx("li",{children:"页面加载时间较长"}),o.jsx("li",{children:"浏览器卡顿或崩溃"}),o.jsx("li",{children:"系统资源占用过高"})]}),o.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),o.jsxs(Dn,{children:[o.jsx(Ln,{onClick:()=>{T(!1),d>200&&(h(50),y(!1))},children:"取消"}),o.jsx(In,{onClick:z,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function gh(t,e,n){let r=n.initialDeps??[],s;function i(){var a,l,c,d;let h;n.key&&((a=n.debug)!=null&&a.call(n))&&(h=Date.now());const m=t();if(!(m.length!==r.length||m.some((y,w)=>r[w]!==y)))return s;r=m;let x;if(n.key&&((l=n.debug)!=null&&l.call(n))&&(x=Date.now()),s=e(...m),n.key&&((c=n.debug)!=null&&c.call(n))){const y=Math.round((Date.now()-h)*100)/100,w=Math.round((Date.now()-x)*100)/100,S=w/16,k=(j,N)=>{for(j=String(j);j.length{r=a},i}function fz(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const TTe=(t,e)=>Math.abs(t-e)<1.01,ETe=(t,e,n)=>{let r;return function(...s){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,s),n)}},mz=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},_Te=t=>t,ATe=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let s=e;s<=n;s++)r.push(s);return r},MTe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const s=a=>{const{width:l,height:c}=a;e({width:Math.round(l),height:Math.round(c)})};if(s(mz(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c?.borderBoxSize){const d=c.borderBoxSize[0];if(d){s({width:d.inlineSize,height:d.blockSize});return}}s(mz(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},pz={passive:!0},gz=typeof window>"u"?!0:"onscrollend"in window,RTe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let s=0;const i=t.options.useScrollendEvent&&gz?()=>{}:ETe(r,()=>{e(s,!1)},t.options.isScrollingResetDelay),a=h=>()=>{const{horizontal:m,isRtl:g}=t.options;s=m?n.scrollLeft*(g&&-1||1):n.scrollTop,i(),e(s,h)},l=a(!0),c=a(!1);c(),n.addEventListener("scroll",l,pz);const d=t.options.useScrollendEvent&&gz;return d&&n.addEventListener("scrollend",c,pz),()=>{n.removeEventListener("scroll",l),d&&n.removeEventListener("scrollend",c)}},DTe=(t,e,n)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},PTe=(t,{adjustments:e=0,behavior:n},r)=>{var s,i;const a=t+e;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class zTe{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const a=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:_Te,rangeExtractor:ATe,onChange:()=>{},measureElement:DTe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=mh(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,i=new Map;for(let a=r-1;a>=0;a--){const l=n[a];if(s.has(l.lane))continue;const c=i.get(l.lane);if(c==null||l.end>c.end?i.set(l.lane,l):l.enda.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=mh(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,s,i,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a}),{key:!1}),this.getMeasurements=mh(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a},l)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const d=this.measurementsCache.slice(0,c);for(let h=c;hthis.options.debug}),this.calculateRange=mh(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?ITe({measurements:n,outerSize:r,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=mh(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,i,a)=>i===null||a===null?[]:n({startIndex:i,endIndex:a,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const s=this.indexFromElement(n),i=this.measurementsCache[s];if(!i)return;const a=i.key,l=this.elementsCache.get(a);l!==n&&(l&&this.observer.unobserve(l),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(s,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const s=this.measurementsCache[n];if(!s)return;const i=this.itemSizeCache.get(s.key)??s.size,a=r-i;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start{if(!n){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(n,void 0)},this.getVirtualItems=mh(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,a=n.length;ithis.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return fz(r[zG(0,r.length-1,s=>fz(r[s]).start,n)])},this.getOffsetForAlignment=(n,r,s=0)=>{const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const l=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.measurementsCache[n];if(!s)return;const i=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(s.end>=a+i-this.options.scrollPaddingEnd)r="end";else if(s.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const l=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(n,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1));let i=0;const a=10,l=d=>{if(!this.targetWindow)return;const h=this.getOffsetForIndex(n,d);if(!h){console.warn("Failed to get offset for index:",n);return}const[m,g]=h;this._scrollToOffset(m,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const x=this.getScrollOffset(),y=this.getOffsetForIndex(n,g);if(!y){console.warn("Failed to get offset for index:",n);return}TTe(y[0],x)||c(g)})},c=d=>{this.targetWindow&&(i++,il(d)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};l(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((n=r[r.length-1])==null?void 0:n.end)??0;else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(l=>l===null);){const l=r[a];i[l.lane]===null&&(i[l.lane]=l.end),a--}s=Math.max(...i.filter(l=>l!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const zG=(t,e,n,r)=>{for(;t<=e;){const s=(t+e)/2|0,i=n(s);if(ir)e=s-1;else return s}return t>0?t-1:0};function ITe({measurements:t,outerSize:e,scrollOffset:n,lanes:r}){const s=t.length-1,i=c=>t[c].start;if(t.length<=r)return{startIndex:0,endIndex:s};let a=zG(0,s,i,n),l=a;if(r===1)for(;l1){const c=Array(r).fill(0);for(;lh=0&&d.some(h=>h>=n);){const h=t[a];d[h.lane]=h.start,a--}a=Math.max(0,a-a%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:a,endIndex:l}}const xz=typeof document<"u"?b.useLayoutEffect:b.useEffect;function LTe(t){const e=b.useReducer(()=>({}),{})[1],n={...t,onChange:(s,i)=>{var a;i?pa.flushSync(e):e(),(a=t.onChange)==null||a.call(t,s,i)}},[r]=b.useState(()=>new zTe(n));return r.setOptions(n),xz(()=>r._didMount(),[]),xz(()=>r._willUpdate()),r}function BTe(t){return LTe({observeElementRect:MTe,observeElementOffset:RTe,scrollToFn:PTe,...t})}function FTe(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 qTe={},g0={};function Gu(t,e){try{const r=(qTe[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in g0?g0[r]:vz(r,r.split(":"))}catch{if(t in g0)return g0[t];const n=t?.match($Te);return n?vz(t,n.slice(1)):NaN}}const $Te=/([+-]\d\d):?(\d\d)?/;function vz(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return g0[t]=n*60+r>0?n*60+r+s:n*60-r-s}class Mo extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Gu(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)),IG(this),lj(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new Mo(...n,e):new Mo(Date.now(),e)}withTimeZone(e){return new Mo(+this,e)}getTimezoneOffset(){const e=-Gu(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),lj(this),+this}[Symbol.for("constructDateFrom")](e){return new Mo(+new Date(e),this.timeZone)}}const yz=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!yz.test(t))return;const e=t.replace(yz,"$1UTC");Mo.prototype[e]&&(t.startsWith("get")?Mo.prototype[t]=function(){return this.internal[e]()}:(Mo.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),HTe(this),+this},Mo.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),lj(this),+this}))});function lj(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Gu(t.timeZone,t)*60))}function HTe(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()),IG(t)}function IG(t){const e=Gu(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),a=s-i,l=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();a&&l&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+a);const c=s-n;c&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+c);const d=new Date(+t);d.setUTCSeconds(0);const h=s>0?d.getSeconds():(d.getSeconds()-60)%60,m=Math.round(-(Gu(t.timeZone,t)*60))%60;(m||h)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+m+h));const g=Gu(t.timeZone,t),x=g>0?Math.floor(g):Math.ceil(g),w=-new Date(+t).getTimezoneOffset()-x,S=x!==n,k=w-c;if(S&&k){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+k);const j=Gu(t.timeZone,t),N=j>0?Math.floor(j):Math.ceil(j),T=x-N;T&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+T),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+T))}}class Fs extends Mo{static tz(e,...n){return n.length?new Fs(...n,e):new Fs(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} (${FTe(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 Fs(+this,e)}[Symbol.for("constructDateFrom")](e){return new Fs(+new Date(e),this.timeZone)}}const LG=6048e5,QTe=864e5,bz=Symbol.for("constructDateFrom");function is(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&bz in t?t[bz](e):t instanceof Date?new t.constructor(e):new Date(e)}function tr(t,e){return is(e||t,t)}function BG(t,e,n){const r=tr(t,n?.in);return isNaN(e)?is(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function FG(t,e,n){const r=tr(t,n?.in);if(isNaN(e))return is(t,NaN);if(!e)return r;const s=r.getDate(),i=is(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const a=i.getDate();return s>=a?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let VTe={};function yg(){return VTe}function su(t,e){const n=yg(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=tr(t,e?.in),i=s.getDay(),a=(i=i.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function wz(t){const e=tr(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 Od(t,...e){const n=is.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function jp(t,e){const n=tr(t,e?.in);return n.setHours(0,0,0,0),n}function $G(t,e,n){const[r,s]=Od(n?.in,t,e),i=jp(r),a=jp(s),l=+i-wz(i),c=+a-wz(a);return Math.round((l-c)/QTe)}function UTe(t,e){const n=qG(t,e),r=is(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Op(r)}function WTe(t,e,n){return BG(t,e*7,n)}function GTe(t,e,n){return FG(t,e*12,n)}function XTe(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=is.bind(null,s));const i=tr(s,r);(!n||n{!r&&typeof s=="object"&&(r=is.bind(null,s));const i=tr(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),is(r,n||NaN)}function KTe(t,e,n){const[r,s]=Od(n?.in,t,e);return+jp(r)==+jp(s)}function HG(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function ZTe(t){return!(!HG(t)&&typeof t!="number"||isNaN(+tr(t)))}function JTe(t,e,n){const[r,s]=Od(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),a=r.getMonth()-s.getMonth();return i*12+a}function e9e(t,e){const n=tr(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function QG(t,e){const[n,r]=Od(t,e.start,e.end);return{start:n,end:r}}function t9e(t,e){const{start:n,end:r}=QG(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setDate(1);let l=1;const c=[];for(;+a<=i;)c.push(is(n,a)),a.setMonth(a.getMonth()+l);return s?c.reverse():c}function n9e(t,e){const n=tr(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function r9e(t,e){const n=tr(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function VG(t,e){const n=tr(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function s9e(t,e){const{start:n,end:r}=QG(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setMonth(0,1);let l=1;const c=[];for(;+a<=i;)c.push(is(n,a)),a.setFullYear(a.getFullYear()+l);return s?c.reverse():c}function UG(t,e){const n=yg(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=tr(t,e?.in),i=s.getDay(),a=(i{let r;const s=a9e[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 Vh(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const l9e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},c9e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},u9e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},d9e={date:Vh({formats:l9e,defaultWidth:"full"}),time:Vh({formats:c9e,defaultWidth:"full"}),dateTime:Vh({formats:u9e,defaultWidth:"full"})},h9e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},f9e=(t,e,n,r)=>h9e[t];function ko(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,l=n?.width?String(n.width):a;s=t.formattingValues[l]||t.formattingValues[a]}else{const a=t.defaultWidth,l=n?.width?String(n.width):t.defaultWidth;s=t.values[l]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const m9e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},p9e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},g9e={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"]},x9e={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"]},v9e={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"}},y9e={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"}},b9e=(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"},w9e={ordinalNumber:b9e,era:ko({values:m9e,defaultWidth:"wide"}),quarter:ko({values:p9e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ko({values:g9e,defaultWidth:"wide"}),day:ko({values:x9e,defaultWidth:"wide"}),dayPeriod:ko({values:v9e,defaultWidth:"wide",formattingValues:y9e,defaultFormattingWidth:"wide"})};function Oo(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const a=i[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?k9e(l,m=>m.test(a)):S9e(l,m=>m.test(a));let d;d=t.valueCallback?t.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const h=e.slice(a.length);return{value:d,rest:h}}}function S9e(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function k9e(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let a=t.valueCallback?t.valueCallback(i[0]):i[0];a=n.valueCallback?n.valueCallback(a):a;const l=e.slice(s.length);return{value:a,rest:l}}}const O9e=/^(\d+)(th|st|nd|rd)?/i,j9e=/\d+/i,N9e={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},C9e={any:[/^b/i,/^(a|c)/i]},T9e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},E9e={any:[/1/i,/2/i,/3/i,/4/i]},_9e={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},A9e={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]},M9e={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},R9e={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]},D9e={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},P9e={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}},z9e={ordinalNumber:WG({matchPattern:O9e,parsePattern:j9e,valueCallback:t=>parseInt(t,10)}),era:Oo({matchPatterns:N9e,defaultMatchWidth:"wide",parsePatterns:C9e,defaultParseWidth:"any"}),quarter:Oo({matchPatterns:T9e,defaultMatchWidth:"wide",parsePatterns:E9e,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Oo({matchPatterns:_9e,defaultMatchWidth:"wide",parsePatterns:A9e,defaultParseWidth:"any"}),day:Oo({matchPatterns:M9e,defaultMatchWidth:"wide",parsePatterns:R9e,defaultParseWidth:"any"}),dayPeriod:Oo({matchPatterns:D9e,defaultMatchWidth:"any",parsePatterns:P9e,defaultParseWidth:"any"})},c7={code:"en-US",formatDistance:o9e,formatLong:d9e,formatRelative:f9e,localize:w9e,match:z9e,options:{weekStartsOn:0,firstWeekContainsDate:1}};function I9e(t,e){const n=tr(t,e?.in);return $G(n,VG(n))+1}function GG(t,e){const n=tr(t,e?.in),r=+Op(n)-+UTe(n);return Math.round(r/LG)+1}function XG(t,e){const n=tr(t,e?.in),r=n.getFullYear(),s=yg(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=is(e?.in||t,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const l=su(a,e),c=is(e?.in||t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const d=su(c,e);return+n>=+l?r+1:+n>=+d?r:r-1}function L9e(t,e){const n=yg(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=XG(t,e),i=is(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),su(i,e)}function YG(t,e){const n=tr(t,e?.in),r=+su(n,e)-+L9e(n,e);return Math.round(r/LG)+1}function Wn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const _c={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Wn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Wn(n+1,2)},d(t,e){return Wn(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 Wn(t.getHours()%12||12,e.length)},H(t,e){return Wn(t.getHours(),e.length)},m(t,e){return Wn(t.getMinutes(),e.length)},s(t,e){return Wn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Wn(s,e.length)}},ph={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Sz={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 _c.y(t,e)},Y:function(t,e,n,r){const s=XG(t,r),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return Wn(a,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Wn(i,e.length)},R:function(t,e){const n=qG(t);return Wn(n,e.length)},u:function(t,e){const n=t.getFullYear();return Wn(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 Wn(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 Wn(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 _c.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 Wn(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=YG(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):Wn(s,e.length)},I:function(t,e,n){const r=GG(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Wn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):_c.d(t,e)},D:function(t,e,n){const r=I9e(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Wn(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 Wn(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 Wn(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 Wn(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=ph.noon:r===0?s=ph.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=ph.evening:r>=12?s=ph.afternoon:r>=4?s=ph.morning:s=ph.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 _c.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):_c.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Wn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Wn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):_c.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):_c.s(t,e)},S:function(t,e){return _c.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return Oz(r);case"XXXX":case"XX":return Bu(r);case"XXXXX":case"XXX":default:return Bu(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return Oz(r);case"xxxx":case"xx":return Bu(r);case"xxxxx":case"xxx":default:return Bu(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+kz(r,":");case"OOOO":default:return"GMT"+Bu(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+kz(r,":");case"zzzz":default:return"GMT"+Bu(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Wn(r,e.length)},T:function(t,e,n){return Wn(+t,e.length)}};function kz(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+Wn(i,2)}function Oz(t,e){return t%60===0?(t>0?"-":"+")+Wn(Math.abs(t)/60,2):Bu(t,e)}function Bu(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Wn(Math.trunc(r/60),2),i=Wn(r%60,2);return n+s+e+i}const jz=(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"})}},KG=(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"})}},B9e=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return jz(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}}",jz(r,e)).replace("{{time}}",KG(s,e))},F9e={p:KG,P:B9e},q9e=/^D+$/,$9e=/^Y+$/,H9e=["D","DD","YY","YYYY"];function Q9e(t){return q9e.test(t)}function V9e(t){return $9e.test(t)}function U9e(t,e,n){const r=W9e(t,e,n);if(console.warn(r),H9e.includes(t))throw new RangeError(r)}function W9e(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 G9e=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,X9e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Y9e=/^'([^]*?)'?$/,K9e=/''/g,Z9e=/[a-zA-Z]/;function Ev(t,e,n){const r=yg(),s=n?.locale??r.locale??c7,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,l=tr(t,n?.in);if(!ZTe(l))throw new RangeError("Invalid time value");let c=e.match(X9e).map(h=>{const m=h[0];if(m==="p"||m==="P"){const g=F9e[m];return g(h,s.formatLong)}return h}).join("").match(G9e).map(h=>{if(h==="''")return{isToken:!1,value:"'"};const m=h[0];if(m==="'")return{isToken:!1,value:J9e(h)};if(Sz[m])return{isToken:!0,value:h};if(m.match(Z9e))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:h}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return c.map(h=>{if(!h.isToken)return h.value;const m=h.value;(!n?.useAdditionalWeekYearTokens&&V9e(m)||!n?.useAdditionalDayOfYearTokens&&Q9e(m))&&U9e(m,e,String(t));const g=Sz[m[0]];return g(l,m,s.localize,d)}).join("")}function J9e(t){const e=t.match(Y9e);return e?e[1].replace(K9e,"'"):t}function eEe(t,e){const n=tr(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=is(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function tEe(t,e){return tr(t,e?.in).getMonth()}function nEe(t,e){return tr(t,e?.in).getFullYear()}function rEe(t,e){return+tr(t)>+tr(e)}function sEe(t,e){return+tr(t)<+tr(e)}function iEe(t,e,n){const[r,s]=Od(n?.in,t,e);return+su(r,n)==+su(s,n)}function aEe(t,e,n){const[r,s]=Od(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function oEe(t,e,n){const[r,s]=Od(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function lEe(t,e,n){const r=tr(t,n?.in),s=r.getFullYear(),i=r.getDate(),a=is(t,0);a.setFullYear(s,e,15),a.setHours(0,0,0,0);const l=eEe(a);return r.setMonth(e,Math.min(i,l)),r}function cEe(t,e,n){const r=tr(t,n?.in);return isNaN(+r)?is(t,NaN):(r.setFullYear(e),r)}const Nz=5,uEe=4;function dEe(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,Nz*7-1);return e.getMonth(t)===e.getMonth(i)?Nz:uEe}function ZG(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 hEe(t,e){const n=ZG(t,e),r=dEe(t,e);return e.addDays(n,r*7-1)}class Ki{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Fs.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 Fs(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):BG(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):FG(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):WTe(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):GTe(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):$G(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):JTe(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):t9e(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):s9e(r),i=new Set(s.map(l=>this.getYear(l)));if(i.size===s.length)return s;const a=[];return i.forEach(l=>{a.push(new Date(l,0,1))}),a},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):hEe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):i9e(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):e9e(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):UG(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):r9e(r),this.format=(r,s,i)=>{const a=this.overrides?.format?this.overrides.format(r,s,this.options):Ev(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(a):a},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):GG(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):tEe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):nEe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):YG(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):rEe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):sEe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):HG(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):KTe(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):aEe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):oEe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):XTe(r),this.min=r=>this.overrides?.min?this.overrides.min(r):YTe(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):lEe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):cEe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):ZG(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):jp(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Op(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):n9e(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):su(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):VG(r),this.options={locale:c7,...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&&Ki.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&Ki.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const a=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,a)}}Ki.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Xo=new Ki;class JG{constructor(e,n,r=Xo){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class fEe{constructor(e,n){this.date=e,this.weeks=n}}class mEe{constructor(e,n){this.days=n,this.weekNumber=e}}function pEe(t){return ae.createElement("button",{...t})}function gEe(t){return ae.createElement("span",{...t})}function xEe(t){const{size:e=24,orientation:n="left",className:r}=t;return ae.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&ae.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&ae.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&ae.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&ae.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function vEe(t){const{day:e,modifiers:n,...r}=t;return ae.createElement("td",{...r})}function yEe(t){const{day:e,modifiers:n,...r}=t,s=ae.useRef(null);return ae.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),ae.createElement("button",{ref:s,...r})}var jt;(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"})(jt||(jt={}));var Ar;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(Ar||(Ar={}));var Ua;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Ua||(Ua={}));var Hi;(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"})(Hi||(Hi={}));function bEe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,a=[s[jt.Dropdown],n].join(" "),l=e?.find(({value:c})=>c===i.value);return ae.createElement("span",{"data-disabled":i.disabled,className:s[jt.DropdownRoot]},ae.createElement(r.Select,{className:a,...i},e?.map(({value:c,label:d,disabled:h})=>ae.createElement(r.Option,{key:c,value:c,disabled:h},d))),ae.createElement("span",{className:s[jt.CaptionLabel],"aria-hidden":!0},l?.label,ae.createElement(r.Chevron,{orientation:"down",size:18,className:s[jt.Chevron]})))}function wEe(t){return ae.createElement("div",{...t})}function SEe(t){return ae.createElement("div",{...t})}function kEe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return ae.createElement("div",{...r},t.children)}function OEe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return ae.createElement("div",{...r})}function jEe(t){return ae.createElement("table",{...t})}function NEe(t){return ae.createElement("div",{...t})}const eX=b.createContext(void 0);function bg(){const t=b.useContext(eX);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function CEe(t){const{components:e}=bg();return ae.createElement(e.Dropdown,{...t})}function TEe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:a,classNames:l,labels:{labelPrevious:c,labelNext:d}}=bg(),h=b.useCallback(g=>{s&&n?.(g)},[s,n]),m=b.useCallback(g=>{r&&e?.(g)},[r,e]);return ae.createElement("nav",{...i},ae.createElement(a.PreviousMonthButton,{type:"button",className:l[jt.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:m},ae.createElement(a.Chevron,{disabled:r?void 0:!0,className:l[jt.Chevron],orientation:"left"})),ae.createElement(a.NextMonthButton,{type:"button",className:l[jt.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":d(s),onClick:h},ae.createElement(a.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[jt.Chevron]})))}function EEe(t){const{components:e}=bg();return ae.createElement(e.Button,{...t})}function _Ee(t){return ae.createElement("option",{...t})}function AEe(t){const{components:e}=bg();return ae.createElement(e.Button,{...t})}function MEe(t){const{rootRef:e,...n}=t;return ae.createElement("div",{...n,ref:e})}function REe(t){return ae.createElement("select",{...t})}function DEe(t){const{week:e,...n}=t;return ae.createElement("tr",{...n})}function PEe(t){return ae.createElement("th",{...t})}function zEe(t){return ae.createElement("thead",{"aria-hidden":!0},ae.createElement("tr",{...t}))}function IEe(t){const{week:e,...n}=t;return ae.createElement("th",{...n})}function LEe(t){return ae.createElement("th",{...t})}function BEe(t){return ae.createElement("tbody",{...t})}function FEe(t){const{components:e}=bg();return ae.createElement(e.Dropdown,{...t})}const qEe=Object.freeze(Object.defineProperty({__proto__:null,Button:pEe,CaptionLabel:gEe,Chevron:xEe,Day:vEe,DayButton:yEe,Dropdown:bEe,DropdownNav:wEe,Footer:SEe,Month:kEe,MonthCaption:OEe,MonthGrid:jEe,Months:NEe,MonthsDropdown:CEe,Nav:TEe,NextMonthButton:EEe,Option:_Ee,PreviousMonthButton:AEe,Root:MEe,Select:REe,Week:DEe,WeekNumber:IEe,WeekNumberHeader:LEe,Weekday:PEe,Weekdays:zEe,Weeks:BEe,YearsDropdown:FEe},Symbol.toStringTag,{value:"Module"}));function Dl(t,e,n=!1,r=Xo){let{from:s,to:i}=t;const{differenceInCalendarDays:a,isSameDay:l}=r;return s&&i?(a(i,s)<0&&([s,i]=[i,s]),a(e,s)>=(n?1:0)&&a(i,e)>=(n?1:0)):!n&&i?l(i,e):!n&&s?l(s,e):!1}function tX(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function u7(t){return!!(t&&typeof t=="object"&&"from"in t)}function nX(t){return!!(t&&typeof t=="object"&&"after"in t)}function rX(t){return!!(t&&typeof t=="object"&&"before"in t)}function sX(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function iX(t,e){return Array.isArray(t)&&t.every(e.isDate)}function Pl(t,e,n=Xo){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:a}=n;return r.some(l=>{if(typeof l=="boolean")return l;if(n.isDate(l))return s(t,l);if(iX(l,n))return l.includes(t);if(u7(l))return Dl(l,t,!1,n);if(sX(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(t.getDay()):l.dayOfWeek===t.getDay();if(tX(l)){const c=i(l.before,t),d=i(l.after,t),h=c>0,m=d<0;return a(l.before,l.after)?m&&h:h||m}return nX(l)?i(t,l.after)>0:rX(l)?i(l.before,t)>0:typeof l=="function"?l(t):!1})}function $Ee(t,e,n,r,s){const{disabled:i,hidden:a,modifiers:l,showOutsideDays:c,broadcastCalendar:d,today:h}=e,{isSameDay:m,isSameMonth:g,startOfMonth:x,isBefore:y,endOfMonth:w,isAfter:S}=s,k=n&&x(n),j=r&&w(r),N={[Ar.focused]:[],[Ar.outside]:[],[Ar.disabled]:[],[Ar.hidden]:[],[Ar.today]:[]},T={};for(const E of t){const{date:_,displayMonth:A}=E,L=!!(A&&!g(_,A)),P=!!(k&&y(_,k)),B=!!(j&&S(_,j)),$=!!(i&&Pl(_,i,s)),U=!!(a&&Pl(_,a,s))||P||B||!d&&!c&&L||d&&c===!1&&L,te=m(_,h??s.today());L&&N.outside.push(E),$&&N.disabled.push(E),U&&N.hidden.push(E),te&&N.today.push(E),l&&Object.keys(l).forEach(z=>{const Q=l?.[z];Q&&Pl(_,Q,s)&&(T[z]?T[z].push(E):T[z]=[E])})}return E=>{const _={[Ar.focused]:!1,[Ar.disabled]:!1,[Ar.hidden]:!1,[Ar.outside]:!1,[Ar.today]:!1},A={};for(const L in N){const P=N[L];_[L]=P.some(B=>B===E)}for(const L in T)A[L]=T[L].some(P=>P===E);return{..._,...A}}}function HEe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[Ar[i]]?s.push(e[Ar[i]]):e[Ua[i]]&&s.push(e[Ua[i]]),s),[e[jt.Day]])}function QEe(t){return{...qEe,...t}}function VEe(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 d7(){const t={};for(const e in jt)t[jt[e]]=`rdp-${jt[e]}`;for(const e in Ar)t[Ar[e]]=`rdp-${Ar[e]}`;for(const e in Ua)t[Ua[e]]=`rdp-${Ua[e]}`;for(const e in Hi)t[Hi[e]]=`rdp-${Hi[e]}`;return t}function aX(t,e,n){return(n??new Ki(e)).formatMonthYear(t)}const UEe=aX;function WEe(t,e,n){return(n??new Ki(e)).format(t,"d")}function GEe(t,e=Xo){return e.format(t,"LLLL")}function XEe(t,e,n){return(n??new Ki(e)).format(t,"cccccc")}function YEe(t,e=Xo){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function KEe(){return""}function oX(t,e=Xo){return e.format(t,"yyyy")}const ZEe=oX,JEe=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:aX,formatDay:WEe,formatMonthCaption:UEe,formatMonthDropdown:GEe,formatWeekNumber:YEe,formatWeekNumberHeader:KEe,formatWeekdayName:XEe,formatYearCaption:ZEe,formatYearDropdown:oX},Symbol.toStringTag,{value:"Module"}));function e_e(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...JEe,...t}}function t_e(t,e,n,r,s){const{startOfMonth:i,startOfYear:a,endOfYear:l,eachMonthOfInterval:c,getMonth:d}=s;return c({start:a(t),end:l(t)}).map(g=>{const x=r.formatMonthDropdown(g,s),y=d(g),w=e&&gi(n)||!1;return{value:y,label:x,disabled:w}})}function n_e(t,e={},n={}){let r={...e?.[jt.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function r_e(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let a=0;a<7;a++){const l=t.addDays(s,a);i.push(l)}return i}function s_e(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:a,eachYearOfInterval:l,getYear:c}=r,d=i(t),h=a(e),m=l({start:d,end:h});return s&&m.reverse(),m.map(g=>{const x=n.formatYearDropdown(g,r);return{value:c(g),label:x,disabled:!1}})}function lX(t,e,n,r){let s=(r??new Ki(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const i_e=lX;function cX(t,e,n){return(n??new Ki(e)).formatMonthYear(t)}const a_e=cX;function o_e(t,e,n,r){let s=(r??new Ki(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function l_e(t){return"Choose the Month"}function c_e(){return""}function u_e(t){return"Go to the Next Month"}function d_e(t){return"Go to the Previous Month"}function h_e(t,e,n){return(n??new Ki(e)).format(t,"cccc")}function f_e(t,e){return`Week ${t}`}function m_e(t){return"Week Number"}function p_e(t){return"Choose the Year"}const g_e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:a_e,labelDay:i_e,labelDayButton:lX,labelGrid:cX,labelGridcell:o_e,labelMonthDropdown:l_e,labelNav:c_e,labelNext:u_e,labelPrevious:d_e,labelWeekNumber:f_e,labelWeekNumberHeader:m_e,labelWeekday:h_e,labelYearDropdown:p_e},Symbol.toStringTag,{value:"Module"})),wg=t=>t instanceof HTMLElement?t:null,Y3=t=>[...t.querySelectorAll("[data-animated-month]")??[]],x_e=t=>wg(t.querySelector("[data-animated-month]")),K3=t=>wg(t.querySelector("[data-animated-caption]")),Z3=t=>wg(t.querySelector("[data-animated-weeks]")),v_e=t=>wg(t.querySelector("[data-animated-nav]")),y_e=t=>wg(t.querySelector("[data-animated-weekdays]"));function b_e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const a=b.useRef(null),l=b.useRef(r),c=b.useRef(!1);b.useLayoutEffect(()=>{const d=l.current;if(l.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||d.length===0||r.length!==d.length)return;const h=i.isSameMonth(r[0].date,d[0].date),m=i.isAfter(r[0].date,d[0].date),g=m?n[Hi.caption_after_enter]:n[Hi.caption_before_enter],x=m?n[Hi.weeks_after_enter]:n[Hi.weeks_before_enter],y=a.current,w=t.current.cloneNode(!0);if(w instanceof HTMLElement?(Y3(w).forEach(N=>{if(!(N instanceof HTMLElement))return;const T=x_e(N);T&&N.contains(T)&&N.removeChild(T);const E=K3(N);E&&E.classList.remove(g);const _=Z3(N);_&&_.classList.remove(x)}),a.current=w):a.current=null,c.current||h||s)return;const S=y instanceof HTMLElement?Y3(y):[],k=Y3(t.current);if(k?.every(j=>j instanceof HTMLElement)&&S&&S.every(j=>j instanceof HTMLElement)){c.current=!0,t.current.style.isolation="isolate";const j=v_e(t.current);j&&(j.style.zIndex="1"),k.forEach((N,T)=>{const E=S[T];if(!E)return;N.style.position="relative",N.style.overflow="hidden";const _=K3(N);_&&_.classList.add(g);const A=Z3(N);A&&A.classList.add(x);const L=()=>{c.current=!1,t.current&&(t.current.style.isolation=""),j&&(j.style.zIndex=""),_&&_.classList.remove(g),A&&A.classList.remove(x),N.style.position="",N.style.overflow="",N.contains(E)&&N.removeChild(E)};E.style.pointerEvents="none",E.style.position="absolute",E.style.overflow="hidden",E.setAttribute("aria-hidden","true");const P=y_e(E);P&&(P.style.opacity="0");const B=K3(E);B&&(B.classList.add(m?n[Hi.caption_before_exit]:n[Hi.caption_after_exit]),B.addEventListener("animationend",L));const $=Z3(E);$&&$.classList.add(m?n[Hi.weeks_before_exit]:n[Hi.weeks_after_exit]),N.insertBefore(E,N.firstChild)})}})}function w_e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:a,fixedWeeks:l,broadcastCalendar:c}=n??{},{addDays:d,differenceInCalendarDays:h,differenceInCalendarMonths:m,endOfBroadcastWeek:g,endOfISOWeek:x,endOfMonth:y,endOfWeek:w,isAfter:S,startOfBroadcastWeek:k,startOfISOWeek:j,startOfWeek:N}=r,T=c?k(s,r):a?j(s):N(s),E=c?g(i):a?x(y(i)):w(y(i)),_=h(E,T),A=m(i,s)+1,L=[];for(let $=0;$<=_;$++){const U=d(T,$);if(e&&S(U,e))break;L.push(U)}const B=(c?35:42)*A;if(l&&L.length{const s=r.weeks.reduce((i,a)=>i.concat(a.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function k_e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let a=0;ae)break;i.push(l)}return i}function Cz(t,e,n,r){const{month:s,defaultMonth:i,today:a=r.today(),numberOfMonths:l=1}=t;let c=s||i||a;const{differenceInCalendarMonths:d,addMonths:h,startOfMonth:m}=r;if(n&&d(n,c){const k=n.broadcastCalendar?m(S,r):n.ISOWeek?g(S):x(S),j=n.broadcastCalendar?i(S):n.ISOWeek?a(l(S)):c(l(S)),N=e.filter(A=>A>=k&&A<=j),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&N.length{const P=T-N.length;return L>j&&L<=s(j,P)});N.push(...A)}const E=N.reduce((A,L)=>{const P=n.ISOWeek?d(L):h(L),B=A.find(U=>U.weekNumber===P),$=new JG(L,S,r);return B?B.days.push($):A.push(new mEe(P,[$])),A},[]),_=new fEe(S,E);return w.push(_),w},[]);return n.reverseMonths?y.reverse():y}function j_e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:a,endOfMonth:l,addYears:c,endOfYear:d,newDate:h,today:m}=e,{fromYear:g,toYear:x,fromMonth:y,toMonth:w}=t;!n&&y&&(n=y),!n&&g&&(n=e.newDate(g,0,1)),!r&&w&&(r=w),!r&&x&&(r=h(x,11,31));const S=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=a(n):g?n=h(g,0,1):!n&&S&&(n=s(c(t.today??m(),-100))),r?r=l(r):x?r=h(x,11,31):!r&&S&&(r=d(t.today??m())),[n&&i(n),r&&i(r)]}function N_e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:a,addMonths:l,differenceInCalendarMonths:c}=r,d=s?i:1,h=a(t);if(!e)return l(h,d);if(!(c(e,t)n.concat(r.weeks.slice()),e.slice())}function nw(t,e){const[n,r]=b.useState(t);return[e===void 0?n:e,r]}function E_e(t,e){const[n,r]=j_e(t,e),{startOfMonth:s,endOfMonth:i}=e,a=Cz(t,n,r,e),[l,c]=nw(a,t.month?a:void 0);b.useEffect(()=>{const _=Cz(t,n,r,e);c(_)},[t.timeZone]);const d=k_e(l,r,t,e),h=w_e(d,t.endMonth?i(t.endMonth):void 0,t,e),m=O_e(d,h,t,e),g=T_e(m),x=S_e(m),y=C_e(l,n,t,e),w=N_e(l,r,t,e),{disableNavigation:S,onMonthChange:k}=t,j=_=>g.some(A=>A.days.some(L=>L.isEqualTo(_))),N=_=>{if(S)return;let A=s(_);n&&As(r)&&(A=s(r)),c(A),k?.(A)};return{months:m,weeks:g,days:x,navStart:n,navEnd:r,previousMonth:y,nextMonth:w,goToMonth:N,goToDay:_=>{j(_)||N(_.date)}}}var xo;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(xo||(xo={}));function Tz(t){return!t[Ar.disabled]&&!t[Ar.hidden]&&!t[Ar.outside]}function __e(t,e,n,r){let s,i=-1;for(const a of t){const l=e(a);Tz(l)&&(l[Ar.focused]&&iTz(e(a)))),s}function A_e(t,e,n,r,s,i,a){const{ISOWeek:l,broadcastCalendar:c}=i,{addDays:d,addMonths:h,addWeeks:m,addYears:g,endOfBroadcastWeek:x,endOfISOWeek:y,endOfWeek:w,max:S,min:k,startOfBroadcastWeek:j,startOfISOWeek:N,startOfWeek:T}=a;let _={day:d,week:m,month:h,year:g,startOfWeek:A=>c?j(A,a):l?N(A):T(A),endOfWeek:A=>c?x(A):l?y(A):w(A)}[t](n,e==="after"?1:-1);return e==="before"&&r?_=S([r,_]):e==="after"&&s&&(_=k([s,_])),_}function uX(t,e,n,r,s,i,a,l=0){if(l>365)return;const c=A_e(t,e,n.date,r,s,i,a),d=!!(i.disabled&&Pl(c,i.disabled,a)),h=!!(i.hidden&&Pl(c,i.hidden,a)),m=c,g=new JG(c,m,a);return!d&&!h?g:uX(t,e,g,r,s,i,a,l+1)}function M_e(t,e,n,r,s){const{autoFocus:i}=t,[a,l]=b.useState(),c=__e(e.days,n,r||(()=>!1),a),[d,h]=b.useState(i?c:void 0);return{isFocusTarget:w=>!!c?.isEqualTo(w),setFocused:h,focused:d,blur:()=>{l(d),h(void 0)},moveFocus:(w,S)=>{if(!d)return;const k=uX(w,S,d,e.navStart,e.navEnd,t,s);k&&(t.disableNavigation&&!e.days.some(N=>N.isEqualTo(k))||(e.goToDay(k),h(k)))}}}function R_e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=nw(n,s?n:void 0),l=s?n:i,{isSameDay:c}=e,d=x=>l?.some(y=>c(y,x))??!1,{min:h,max:m}=t;return{selected:l,select:(x,y,w)=>{let S=[...l??[]];if(d(x)){if(l?.length===h||r&&l?.length===1)return;S=l?.filter(k=>!c(k,x))}else l?.length===m?S=[x]:S=[...S,x];return s||a(S),s?.(S,x,y,w),S},isSelected:d}}function D_e(t,e,n=0,r=0,s=!1,i=Xo){const{from:a,to:l}=e||{},{isSameDay:c,isAfter:d,isBefore:h}=i;let m;if(!a&&!l)m={from:t,to:n>0?void 0:t};else if(a&&!l)c(a,t)?n===0?m={from:a,to:t}:s?m={from:a,to:void 0}:m=void 0:h(t,a)?m={from:t,to:a}:m={from:a,to:t};else if(a&&l)if(c(a,t)&&c(l,t))s?m={from:a,to:l}:m=void 0;else if(c(a,t))m={from:a,to:n>0?void 0:t};else if(c(l,t))m={from:t,to:n>0?void 0:t};else if(h(t,a))m={from:t,to:l};else if(d(t,a))m={from:a,to:t};else if(d(t,l))m={from:a,to:t};else throw new Error("Invalid range");if(m?.from&&m?.to){const g=i.differenceInCalendarDays(m.to,m.from);r>0&&g>r?m={from:t,to:void 0}:n>1&&gtypeof l!="function").some(l=>typeof l=="boolean"?l:n.isDate(l)?Dl(t,l,!1,n):iX(l,n)?l.some(c=>Dl(t,c,!1,n)):u7(l)?l.from&&l.to?Ez(t,{from:l.from,to:l.to},n):!1:sX(l)?P_e(t,l.dayOfWeek,n):tX(l)?n.isAfter(l.before,l.after)?Ez(t,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):Pl(t.from,l,n)||Pl(t.to,l,n):nX(l)||rX(l)?Pl(t.from,l,n)||Pl(t.to,l,n):!1))return!0;const a=r.filter(l=>typeof l=="function");if(a.length){let l=t.from;const c=n.differenceInCalendarDays(t.to,t.from);for(let d=0;d<=c;d++){if(a.some(h=>h(l)))return!0;l=n.addDays(l,1)}}return!1}function I_e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:a}=t,[l,c]=nw(s,a?s:void 0),d=a?s:l;return{selected:d,select:(g,x,y)=>{const{min:w,max:S}=t,k=g?D_e(g,d,w,S,i,e):void 0;return r&&n&&k?.from&&k.to&&z_e({from:k.from,to:k.to},n,e)&&(k.from=g,k.to=void 0),a||c(k),a?.(k,g,x,y),k},isSelected:g=>d&&Dl(d,g,!1,e)}}function L_e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=nw(n,s?n:void 0),l=s?n:i,{isSameDay:c}=e;return{selected:l,select:(m,g,x)=>{let y=m;return!r&&l&&l&&c(m,l)&&(y=void 0),s||a(y),s?.(y,m,g,x),y},isSelected:m=>l?c(l,m):!1}}function B_e(t,e){const n=L_e(t,e),r=R_e(t,e),s=I_e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function F_e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new Fs(e.today,e.timeZone)),e.month&&(e.month=new Fs(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new Fs(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new Fs(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new Fs(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new Fs(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(Pe=>new Fs(Pe,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new Fs(e.selected.from,e.timeZone):void 0,to:e.selected.to?new Fs(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:a,classNames:l}=b.useMemo(()=>{const Pe={...c7,...e.locale};return{dateLib:new Ki({locale:Pe,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:QEe(e.components),formatters:e_e(e.formatters),labels:{...g_e,...e.labels},locale:Pe,classNames:{...d7(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:c,mode:d,navLayout:h,numberOfMonths:m=1,onDayBlur:g,onDayClick:x,onDayFocus:y,onDayKeyDown:w,onDayMouseEnter:S,onDayMouseLeave:k,onNextClick:j,onPrevClick:N,showWeekNumber:T,styles:E}=e,{formatCaption:_,formatDay:A,formatMonthDropdown:L,formatWeekNumber:P,formatWeekNumberHeader:B,formatWeekdayName:$,formatYearDropdown:U}=r,te=E_e(e,i),{days:z,months:Q,navStart:F,navEnd:Y,previousMonth:J,nextMonth:X,goToMonth:R}=te,ie=$Ee(z,e,F,Y,i),{isSelected:G,select:I,selected:V}=B_e(e,i)??{},{blur:ee,focused:ne,isFocusTarget:W,moveFocus:se,setFocused:re}=M_e(e,te,ie,G??(()=>!1),i),{labelDayButton:oe,labelGridcell:Te,labelGrid:We,labelMonthDropdown:Ye,labelNav:Je,labelPrevious:Oe,labelNext:Ve,labelWeekday:Ue,labelWeekNumber:He,labelWeekNumberHeader:Ot,labelYearDropdown:xt}=s,kn=b.useMemo(()=>r_e(i,e.ISOWeek),[i,e.ISOWeek]),It=d!==void 0||x!==void 0,Yt=b.useCallback(()=>{J&&(R(J),N?.(J))},[J,R,N]),_t=b.useCallback(()=>{X&&(R(X),j?.(X))},[R,X,j]),mt=b.useCallback((Pe,it)=>ot=>{ot.preventDefault(),ot.stopPropagation(),re(Pe),I?.(Pe.date,it,ot),x?.(Pe.date,it,ot)},[I,x,re]),Ne=b.useCallback((Pe,it)=>ot=>{re(Pe),y?.(Pe.date,it,ot)},[y,re]),Ie=b.useCallback((Pe,it)=>ot=>{ee(),g?.(Pe.date,it,ot)},[ee,g]),st=b.useCallback((Pe,it)=>ot=>{const nn={ArrowLeft:[ot.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[ot.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[ot.shiftKey?"year":"week","after"],ArrowUp:[ot.shiftKey?"year":"week","before"],PageUp:[ot.shiftKey?"year":"month","before"],PageDown:[ot.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(nn[ot.key]){ot.preventDefault(),ot.stopPropagation();const[Kt,pt]=nn[ot.key];se(Kt,pt)}w?.(Pe.date,it,ot)},[se,w,e.dir]),yt=b.useCallback((Pe,it)=>ot=>{S?.(Pe.date,it,ot)},[S]),Pt=b.useCallback((Pe,it)=>ot=>{k?.(Pe.date,it,ot)},[k]),Mt=b.useCallback(Pe=>it=>{const ot=Number(it.target.value),nn=i.setMonth(i.startOfMonth(Pe),ot);R(nn)},[i,R]),zn=b.useCallback(Pe=>it=>{const ot=Number(it.target.value),nn=i.setYear(i.startOfMonth(Pe),ot);R(nn)},[i,R]),{className:Fe,style:rt}=b.useMemo(()=>({className:[l[jt.Root],e.className].filter(Boolean).join(" "),style:{...E?.[jt.Root],...e.style}}),[l,e.className,e.style,E]),tn=VEe(e),Rt=b.useRef(null);b_e(Rt,!!e.animate,{classNames:l,months:Q,focused:ne,dateLib:i});const ke={dayPickerProps:e,selected:V,select:I,isSelected:G,months:Q,nextMonth:X,previousMonth:J,goToMonth:R,getModifiers:ie,components:n,classNames:l,styles:E,labels:s,formatters:r};return ae.createElement(eX.Provider,{value:ke},ae.createElement(n.Root,{rootRef:e.animate?Rt:void 0,className:Fe,style:rt,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"],...tn},ae.createElement(n.Months,{className:l[jt.Months],style:E?.[jt.Months]},!e.hideNavigation&&!h&&ae.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[jt.Nav],style:E?.[jt.Nav],"aria-label":Je(),onPreviousClick:Yt,onNextClick:_t,previousMonth:J,nextMonth:X}),Q.map((Pe,it)=>ae.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:l[jt.Month],style:E?.[jt.Month],key:it,displayIndex:it,calendarMonth:Pe},h==="around"&&!e.hideNavigation&&it===0&&ae.createElement(n.PreviousMonthButton,{type:"button",className:l[jt.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":Oe(J),onClick:Yt,"data-animated-button":e.animate?"true":void 0},ae.createElement(n.Chevron,{disabled:J?void 0:!0,className:l[jt.Chevron],orientation:e.dir==="rtl"?"right":"left"})),ae.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:l[jt.MonthCaption],style:E?.[jt.MonthCaption],calendarMonth:Pe,displayIndex:it},c?.startsWith("dropdown")?ae.createElement(n.DropdownNav,{className:l[jt.Dropdowns],style:E?.[jt.Dropdowns]},(()=>{const ot=c==="dropdown"||c==="dropdown-months"?ae.createElement(n.MonthsDropdown,{key:"month",className:l[jt.MonthsDropdown],"aria-label":Ye(),classNames:l,components:n,disabled:!!e.disableNavigation,onChange:Mt(Pe.date),options:t_e(Pe.date,F,Y,r,i),style:E?.[jt.Dropdown],value:i.getMonth(Pe.date)}):ae.createElement("span",{key:"month"},L(Pe.date,i)),nn=c==="dropdown"||c==="dropdown-years"?ae.createElement(n.YearsDropdown,{key:"year",className:l[jt.YearsDropdown],"aria-label":xt(i.options),classNames:l,components:n,disabled:!!e.disableNavigation,onChange:zn(Pe.date),options:s_e(F,Y,r,i,!!e.reverseYears),style:E?.[jt.Dropdown],value:i.getYear(Pe.date)}):ae.createElement("span",{key:"year"},U(Pe.date,i));return i.getMonthYearOrder()==="year-first"?[nn,ot]:[ot,nn]})(),ae.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"}},_(Pe.date,i.options,i))):ae.createElement(n.CaptionLabel,{className:l[jt.CaptionLabel],role:"status","aria-live":"polite"},_(Pe.date,i.options,i))),h==="around"&&!e.hideNavigation&&it===m-1&&ae.createElement(n.NextMonthButton,{type:"button",className:l[jt.NextMonthButton],tabIndex:X?void 0:-1,"aria-disabled":X?void 0:!0,"aria-label":Ve(X),onClick:_t,"data-animated-button":e.animate?"true":void 0},ae.createElement(n.Chevron,{disabled:X?void 0:!0,className:l[jt.Chevron],orientation:e.dir==="rtl"?"left":"right"})),it===m-1&&h==="after"&&!e.hideNavigation&&ae.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[jt.Nav],style:E?.[jt.Nav],"aria-label":Je(),onPreviousClick:Yt,onNextClick:_t,previousMonth:J,nextMonth:X}),ae.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":d==="multiple"||d==="range","aria-label":We(Pe.date,i.options,i)||void 0,className:l[jt.MonthGrid],style:E?.[jt.MonthGrid]},!e.hideWeekdays&&ae.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:l[jt.Weekdays],style:E?.[jt.Weekdays]},T&&ae.createElement(n.WeekNumberHeader,{"aria-label":Ot(i.options),className:l[jt.WeekNumberHeader],style:E?.[jt.WeekNumberHeader],scope:"col"},B()),kn.map(ot=>ae.createElement(n.Weekday,{"aria-label":Ue(ot,i.options,i),className:l[jt.Weekday],key:String(ot),style:E?.[jt.Weekday],scope:"col"},$(ot,i.options,i)))),ae.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:l[jt.Weeks],style:E?.[jt.Weeks]},Pe.weeks.map(ot=>ae.createElement(n.Week,{className:l[jt.Week],key:ot.weekNumber,style:E?.[jt.Week],week:ot},T&&ae.createElement(n.WeekNumber,{week:ot,style:E?.[jt.WeekNumber],"aria-label":He(ot.weekNumber,{locale:a}),className:l[jt.WeekNumber],scope:"row",role:"rowheader"},P(ot.weekNumber,i)),ot.days.map(nn=>{const{date:Kt}=nn,pt=ie(nn);if(pt[Ar.focused]=!pt.hidden&&!!ne?.isEqualTo(nn),pt[Ua.selected]=G?.(Kt)||pt.selected,u7(V)){const{from:vr,to:In}=V;pt[Ua.range_start]=!!(vr&&In&&i.isSameDay(Kt,vr)),pt[Ua.range_end]=!!(vr&&In&&i.isSameDay(Kt,In)),pt[Ua.range_middle]=Dl(V,Kt,!0,i)}const xr=n_e(pt,E,e.modifiersStyles),Ur=HEe(pt,l,e.modifiersClassNames),Wr=!It&&!pt.hidden?Te(Kt,pt,i.options,i):void 0;return ae.createElement(n.Day,{key:`${i.format(Kt,"yyyy-MM-dd")}_${i.format(nn.displayMonth,"yyyy-MM")}`,day:nn,modifiers:pt,className:Ur.join(" "),style:xr,role:"gridcell","aria-selected":pt.selected||void 0,"aria-label":Wr,"data-day":i.format(Kt,"yyyy-MM-dd"),"data-month":nn.outside?i.format(Kt,"yyyy-MM"):void 0,"data-selected":pt.selected||void 0,"data-disabled":pt.disabled||void 0,"data-hidden":pt.hidden||void 0,"data-outside":nn.outside||void 0,"data-focused":pt.focused||void 0,"data-today":pt.today||void 0},!pt.hidden&&It?ae.createElement(n.DayButton,{className:l[jt.DayButton],style:E?.[jt.DayButton],type:"button",day:nn,modifiers:pt,disabled:pt.disabled||void 0,tabIndex:W(nn)?0:-1,"aria-label":oe(Kt,pt,i.options,i),onClick:mt(nn,pt),onBlur:Ie(nn,pt),onFocus:Ne(nn,pt),onKeyDown:st(nn,pt),onMouseEnter:yt(nn,pt),onMouseLeave:Pt(nn,pt)},A(Kt,i.options,i)):!pt.hidden&&A(nn.date,i.options,i))})))))))),e.footer&&ae.createElement(n.Footer,{className:l[jt.Footer],style:E?.[jt.Footer],role:"status","aria-live":"polite"},e.footer)))}function _z({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:a,...l}){const c=d7();return o.jsx(F_e,{showOutsideDays:n,className:xe("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:d=>d.toLocaleString("default",{month:"short"}),...i},classNames:{root:xe("w-fit",c.root),months:xe("relative flex flex-col gap-4 md:flex-row",c.months),month:xe("flex w-full flex-col gap-4",c.month),nav:xe("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:xe(I0({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_previous),button_next:xe(I0({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_next),month_caption:xe("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",c.month_caption),dropdowns:xe("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:xe("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",c.dropdown_root),dropdown:xe("bg-popover absolute inset-0 opacity-0",c.dropdown),caption_label:xe("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",c.caption_label),table:"w-full border-collapse",weekdays:xe("flex",c.weekdays),weekday:xe("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",c.weekday),week:xe("mt-2 flex w-full",c.week),week_number_header:xe("w-[--cell-size] select-none",c.week_number_header),week_number:xe("text-muted-foreground select-none text-[0.8rem]",c.week_number),day:xe("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",c.day),range_start:xe("bg-accent rounded-l-md",c.range_start),range_middle:xe("rounded-none",c.range_middle),range_end:xe("bg-accent rounded-r-md",c.range_end),today:xe("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",c.today),outside:xe("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:xe("text-muted-foreground opacity-50",c.disabled),hidden:xe("invisible",c.hidden),...e},components:{Root:({className:d,rootRef:h,...m})=>o.jsx("div",{"data-slot":"calendar",ref:h,className:xe(d),...m}),Chevron:({className:d,orientation:h,...m})=>h==="left"?o.jsx(vd,{className:xe("size-4",d),...m}):h==="right"?o.jsx(yd,{className:xe("size-4",d),...m}):o.jsx(nd,{className:xe("size-4",d),...m}),DayButton:q_e,WeekNumber:({children:d,...h})=>o.jsx("td",{...h,children:o.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:d})}),...a},...l})}function q_e({className:t,day:e,modifiers:n,...r}){const s=d7(),i=b.useRef(null);return b.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),o.jsx(de,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:xe("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 $_e{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 Oh=new $_e;typeof window<"u"&&Oh.connect();const H_e={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}} 年"}},Q_e=(t,e,n)=>{let r;const s=H_e[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},V_e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},U_e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},W_e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},G_e={date:Vh({formats:V_e,defaultWidth:"full"}),time:Vh({formats:U_e,defaultWidth:"full"}),dateTime:Vh({formats:W_e,defaultWidth:"full"})};function Az(t,e,n){const r="eeee p";return iEe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const X_e={lastWeek:Az,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Az,other:"PP p"},Y_e=(t,e,n,r)=>{const s=X_e[t];return typeof s=="function"?s(e,n,r):s},K_e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},Z_e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},J_e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},eAe={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},tAe={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:"夜间"}},nAe={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:"夜间"}},rAe=(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()}},sAe={ordinalNumber:rAe,era:ko({values:K_e,defaultWidth:"wide"}),quarter:ko({values:Z_e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ko({values:J_e,defaultWidth:"wide"}),day:ko({values:eAe,defaultWidth:"wide"}),dayPeriod:ko({values:tAe,defaultWidth:"wide",formattingValues:nAe,defaultFormattingWidth:"wide"})},iAe=/^(第\s*)?\d+(日|时|分|秒)?/i,aAe=/\d+/i,oAe={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},lAe={any:[/^(前)/i,/^(公元)/i]},cAe={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},uAe={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},dAe={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},hAe={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]},fAe={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},mAe={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},pAe={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},gAe={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},xAe={ordinalNumber:WG({matchPattern:iAe,parsePattern:aAe,valueCallback:t=>parseInt(t,10)}),era:Oo({matchPatterns:oAe,defaultMatchWidth:"wide",parsePatterns:lAe,defaultParseWidth:"any"}),quarter:Oo({matchPatterns:cAe,defaultMatchWidth:"wide",parsePatterns:uAe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Oo({matchPatterns:dAe,defaultMatchWidth:"wide",parsePatterns:hAe,defaultParseWidth:"any"}),day:Oo({matchPatterns:fAe,defaultMatchWidth:"wide",parsePatterns:mAe,defaultParseWidth:"any"}),dayPeriod:Oo({matchPatterns:pAe,defaultMatchWidth:"any",parsePatterns:gAe,defaultParseWidth:"any"})},U1={code:"zh-CN",formatDistance:Q_e,formatLong:G_e,formatRelative:Y_e,localize:sAe,match:xAe,options:{weekStartsOn:1,firstWeekContainsDate:4}},W1={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function vAe(){const[t,e]=b.useState([]),[n,r]=b.useState(""),[s,i]=b.useState("all"),[a,l]=b.useState("all"),[c,d]=b.useState(void 0),[h,m]=b.useState(void 0),[g,x]=b.useState(!0),[y,w]=b.useState(!1),[S,k]=b.useState("xs"),[j,N]=b.useState(4),T=b.useRef(null);b.useEffect(()=>{const F=Oh.getAllLogs();e(F);const Y=Oh.onLog(()=>{e(Oh.getAllLogs())}),J=Oh.onConnectionChange(X=>{w(X)});return()=>{Y(),J()}},[]);const E=b.useMemo(()=>{const F=new Set(t.map(Y=>Y.module));return Array.from(F).sort()},[t]),_=F=>{switch(F){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"}},A=F=>{switch(F){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"}},L=()=>{window.location.reload()},P=()=>{Oh.clearLogs(),e([])},B=()=>{const F=te.map(R=>`${R.timestamp} [${R.level.padEnd(8)}] [${R.module}] ${R.message}`).join(` -`),Y=new Blob([F],{type:"text/plain;charset=utf-8"}),J=URL.createObjectURL(Y),X=document.createElement("a");X.href=J,X.download=`logs-${Ev(new Date,"yyyy-MM-dd-HHmmss")}.txt`,X.click(),URL.revokeObjectURL(J)},$=()=>{x(!g)},U=()=>{d(void 0),m(void 0)},te=b.useMemo(()=>t.filter(F=>{const Y=n===""||F.message.toLowerCase().includes(n.toLowerCase())||F.module.toLowerCase().includes(n.toLowerCase()),J=s==="all"||F.level===s,X=a==="all"||F.module===a;let R=!0;if(c||h){const ie=new Date(F.timestamp);if(c){const G=new Date(c);G.setHours(0,0,0,0),R=R&&ie>=G}if(h){const G=new Date(h);G.setHours(23,59,59,999),R=R&&ie<=G}}return Y&&J&&X&&R}),[t,n,s,a,c,h]),z=W1[S].rowHeight+j,Q=BTe({count:te.length,getScrollElement:()=>T.current,estimateSize:()=>z,overscan:15});return b.useEffect(()=>{g&&te.length>0&&Q.scrollToIndex(te.length-1,{align:"end",behavior:"auto"})},[te.length,g,Q]),o.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex-shrink-0 space-y-4 p-3 sm:p-4 lg:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:xe("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",y?"bg-green-500 animate-pulse":"bg-red-500")}),o.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:y?"已连接":"未连接"})]})]}),o.jsx(qt,{className:"p-3 sm:p-4",children:o.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(Ni,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{placeholder:"搜索日志...",value:n,onChange:F=>r(F.target.value),className:"pl-9 h-9 text-sm"})]}),o.jsxs(Vt,{value:s,onValueChange:i,children:[o.jsxs($t,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[o.jsx(sk,{className:"h-4 w-4 mr-2"}),o.jsx(Ut,{placeholder:"级别"})]}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部级别"}),o.jsx(De,{value:"DEBUG",children:"DEBUG"}),o.jsx(De,{value:"INFO",children:"INFO"}),o.jsx(De,{value:"WARNING",children:"WARNING"}),o.jsx(De,{value:"ERROR",children:"ERROR"}),o.jsx(De,{value:"CRITICAL",children:"CRITICAL"})]})]}),o.jsxs(Vt,{value:a,onValueChange:l,children:[o.jsxs($t,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[o.jsx(sk,{className:"h-4 w-4 mr-2"}),o.jsx(Ut,{placeholder:"模块"})]}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部模块"}),E.map(F=>o.jsx(De,{value:F,children:F},F))]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",className:xe("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!c&&"text-muted-foreground"),children:[o.jsx(w9,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"text-xs sm:text-sm",children:c?Ev(c,"PPP",{locale:U1}):"开始日期"})]})}),o.jsx(Xa,{className:"w-auto p-0",align:"start",children:o.jsx(_z,{mode:"single",selected:c,onSelect:d,initialFocus:!0,locale:U1})})]}),o.jsxs(zo,{children:[o.jsx(Io,{asChild:!0,children:o.jsxs(de,{variant:"outline",size:"sm",className:xe("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!h&&"text-muted-foreground"),children:[o.jsx(w9,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"text-xs sm:text-sm",children:h?Ev(h,"PPP",{locale:U1}):"结束日期"})]})}),o.jsx(Xa,{className:"w-auto p-0",align:"start",children:o.jsx(_z,{mode:"single",selected:h,onSelect:m,initialFocus:!0,locale:U1})})]}),(c||h)&&o.jsxs(de,{variant:"outline",size:"sm",onClick:U,className:"w-full sm:w-auto h-9",children:[o.jsx(_p,{className:"h-4 w-4 sm:mr-2"}),o.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),o.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsxs(de,{variant:g?"default":"outline",size:"sm",onClick:$,className:"flex-1 sm:flex-none h-9",children:[g?o.jsx(tte,{className:"h-4 w-4"}):o.jsx(nte,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:g?"自动滚动":"已暂停"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:L,className:"flex-1 sm:flex-none h-9",children:[o.jsx(Ps,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:P,className:"flex-1 sm:flex-none h-9",children:[o.jsx(Sn,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:B,className:"flex-1 sm:flex-none h-9",children:[o.jsx(Ku,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),o.jsx("div",{className:"flex-1 hidden sm:block"}),o.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[o.jsxs("span",{className:"font-mono",children:[te.length," / ",t.length]}),o.jsx("span",{className:"ml-1",children:"条日志"})]})]}),o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6 pt-2 border-t border-border/50",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(rte,{className:"h-4 w-4"}),o.jsx("span",{children:"字号"})]}),o.jsx("div",{className:"flex gap-1",children:Object.keys(W1).map(F=>o.jsx(de,{variant:S===F?"default":"outline",size:"sm",onClick:()=>k(F),className:"h-7 px-3 text-xs",children:W1[F].label},F))})]}),o.jsxs("div",{className:"flex items-center gap-3 flex-1 max-w-xs",children:[o.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"行距"}),o.jsx(Bp,{value:[j],onValueChange:([F])=>N(F),min:0,max:12,step:2,className:"flex-1"}),o.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[j,"px"]})]})]})]})})]}),o.jsx("div",{className:"flex-1 min-h-0 px-3 sm:px-4 lg:px-6 pb-3 sm:pb-4 lg:pb-6",children:o.jsx(qt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full",children:o.jsx(gn,{viewportRef:T,className:"h-full",children:o.jsx("div",{className:xe("p-2 sm:p-3 font-mono relative",W1[S].class),style:{height:`${Q.getTotalSize()}px`},children:te.length===0?o.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):Q.getVirtualItems().map(F=>{const Y=te[F.index];return o.jsxs("div",{"data-index":F.index,ref:Q.measureElement,className:xe("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",A(Y.level)),style:{transform:`translateY(${F.start}px)`,paddingTop:`${j/2}px`,paddingBottom:`${j/2}px`},children:[o.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-600",children:Y.timestamp}),o.jsxs("span",{className:xe("font-semibold",_(Y.level)),children:["[",Y.level,"]"]})]}),o.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate",children:Y.module}),o.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words",children:Y.message})]}),o.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:Y.timestamp}),o.jsxs("span",{className:xe("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",_(Y.level)),children:["[",Y.level,"]"]}),o.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:Y.module}),o.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:Y.message})]})]},F.key)})})})})})]})}const yAe="Mai-with-u",bAe="plugin-repo",wAe="main",SAe="plugin_details.json";async function kAe(){try{const t=await St("/api/webui/plugins/fetch-raw",{method:"POST",headers:Dt(),body:JSON.stringify({owner:yAe,repo:bAe,branch:wAe,file_path:SAe})});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 OAe(){try{const t=await St("/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 jAe(){try{const t=await St("/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 NAe(t,e,n){const r=t.split(".").map(l=>parseInt(l)||0),s=r[0]||0,i=r[1]||0,a=r[2]||0;if(n.version_majorparseInt(m)||0),c=l[0]||0,d=l[1]||0,h=l[2]||0;if(n.version_major>c||n.version_major===c&&n.version_minor>d||n.version_major===c&&n.version_minor===d&&n.version_patch>h)return!1}return!0}function CAe(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const a=JSON.parse(i.data);t(a)}catch(a){console.error("Failed to parse progress data:",a)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function G1(){try{const t=await St("/api/webui/plugins/installed",{headers:Dt()});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 X1(t,e){return e.some(n=>n.id===t)}function Y1(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function TAe(t,e,n="main"){const r=await St("/api/webui/plugins/install",{method:"POST",headers:Dt(),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 EAe(t){const e=await St("/api/webui/plugins/uninstall",{method:"POST",headers:Dt(),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 _Ae(t,e,n="main"){const r=await St("/api/webui/plugins/update",{method:"POST",headers:Dt(),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 Sg="https://maibot-plugin-stats.maibot-webui.workers.dev";async function dX(t){try{const e=await fetch(`${Sg}/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 AAe(t,e){try{const n=e||h7(),r=await fetch(`${Sg}/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 MAe(t,e){try{const n=e||h7(),r=await fetch(`${Sg}/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 RAe(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||h7(),i=await fetch(`${Sg}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),a=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...a}:{success:!1,error:a.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function DAe(t){try{const e=await fetch(`${Sg}/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 PAe(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const k=await dX(t);k&&r(k),i(!1)};b.useEffect(()=>{x()},[t]);const y=async()=>{const k=await AAe(t);k.success?(g({title:"已点赞",description:"感谢你的支持!"}),x()):g({title:"点赞失败",description:k.error||"未知错误",variant:"destructive"})},w=async()=>{const k=await MAe(t);k.success?(g({title:"已反馈",description:"感谢你的反馈!"}),x()):g({title:"操作失败",description:k.error||"未知错误",variant:"destructive"})},S=async()=>{if(a===0){g({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const k=await RAe(t,a,c||void 0);k.success?(g({title:"评分成功",description:"感谢你的评价!"}),m(!1),l(0),d(""),x()):g({title:"评分失败",description:k.error||"未知错误",variant:"destructive"})};return s?o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ku,{className:"h-4 w-4"}),o.jsx("span",{children:"-"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ac,{className:"h-4 w-4"}),o.jsx("span",{children:"-"})]})]}):n?e?o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[o.jsx(Ku,{className:"h-4 w-4"}),o.jsx("span",{children:n.downloads.toLocaleString()})]}),o.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[o.jsx(Ac,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsx("span",{children:n.rating.toFixed(1)})]}),o.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[o.jsx(y4,{className:"h-4 w-4"}),o.jsx("span",{children:n.likes})]})]}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(Ku,{className:"h-5 w-5 text-muted-foreground mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(Ac,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),o.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(y4,{className:"h-5 w-5 text-green-500 mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.likes}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(S9,{className:"h-5 w-5 text-red-500 mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(de,{variant:"outline",size:"sm",onClick:y,children:[o.jsx(y4,{className:"h-4 w-4 mr-1"}),"点赞"]}),o.jsxs(de,{variant:"outline",size:"sm",onClick:w,children:[o.jsx(S9,{className:"h-4 w-4 mr-1"}),"点踩"]}),o.jsxs(Dr,{open:h,onOpenChange:m,children:[o.jsx(Of,{asChild:!0,children:o.jsxs(de,{variant:"default",size:"sm",children:[o.jsx(Ac,{className:"h-4 w-4 mr-1"}),"评分"]})}),o.jsxs(Sr,{children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"为插件评分"}),o.jsx(ss,{children:"分享你的使用体验,帮助其他用户"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(k=>o.jsx("button",{onClick:()=>l(k),className:"focus:outline-none",children:o.jsx(Ac,{className:`h-8 w-8 transition-colors ${k<=a?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},k))}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[a===0&&"点击星星进行评分",a===1&&"很差",a===2&&"一般",a===3&&"还行",a===4&&"不错",a===5&&"非常好"]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),o.jsx(Mr,{value:c,onChange:k=>d(k.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),o.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[c.length," / 500"]})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>m(!1),children:"取消"}),o.jsx(de,{onClick:S,disabled:a===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),o.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((k,j)=>o.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(N=>o.jsx(Ac,{className:`h-3 w-3 ${N<=k.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},N))}),o.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(k.created_at).toLocaleDateString()})]}),k.comment&&o.jsx("p",{className:"text-sm text-muted-foreground",children:k.comment})]},j))})]})]}):null}const Mz={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function IAe(){const t=Zi(),[e,n]=b.useState(null),[r,s]=b.useState(""),[i,a]=b.useState("all"),[l,c]=b.useState("all"),[d,h]=b.useState(!0),[m,g]=b.useState([]),[x,y]=b.useState(!0),[w,S]=b.useState(null),[k,j]=b.useState(null),[N,T]=b.useState(null),[E,_]=b.useState(null),[,A]=b.useState([]),[L,P]=b.useState({}),{toast:B}=as(),$=async R=>{const ie=R.map(async V=>{try{const ee=await dX(V.id);return{id:V.id,stats:ee}}catch(ee){return console.warn(`Failed to load stats for ${V.id}:`,ee),{id:V.id,stats:null}}}),G=await Promise.all(ie),I={};G.forEach(({id:V,stats:ee})=>{ee&&(I[V]=ee)}),P(I)};b.useEffect(()=>{let R=null,ie=!1;return(async()=>{if(R=CAe(I=>{ie||(T(I),I.stage==="success"?setTimeout(()=>{ie||T(null)},2e3):I.stage==="error"&&(y(!1),S(I.error||"加载失败")))},I=>{console.error("WebSocket error:",I),ie||B({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(I=>{if(!R){I();return}const V=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),I()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),I()):setTimeout(V,100)};V()}),!ie){const I=await OAe();j(I),I.installed||B({title:"Git 未安装",description:I.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!ie){const I=await jAe();_(I)}if(!ie)try{y(!0),S(null);const I=await kAe();if(!ie){const V=await G1();A(V);const ee=I.map(ne=>{const W=X1(ne.id,V),se=Y1(ne.id,V);return{...ne,installed:W,installed_version:se}});for(const ne of V)!ee.some(se=>se.id===ne.id)&&ne.manifest&&ee.push({id:ne.id,manifest:{manifest_version:ne.manifest.manifest_version||1,name:ne.manifest.name,version:ne.manifest.version,description:ne.manifest.description||"",author:ne.manifest.author,license:ne.manifest.license||"Unknown",host_application:ne.manifest.host_application,homepage_url:ne.manifest.homepage_url,repository_url:ne.manifest.repository_url,keywords:ne.manifest.keywords||[],categories:ne.manifest.categories||[],default_locale:ne.manifest.default_locale||"zh-CN",locales_path:ne.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ne.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});g(ee),$(ee)}}catch(I){if(!ie){const V=I instanceof Error?I.message:"加载插件列表失败";S(V),B({title:"加载失败",description:V,variant:"destructive"})}}finally{ie||y(!1)}})(),()=>{ie=!0,R&&R.close()}},[B]);const U=R=>{if(!R.installed&&E&&!te(R))return o.jsxs(Xn,{variant:"destructive",className:"gap-1",children:[o.jsx(Uc,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const ie=R.installed_version?.trim(),G=R.manifest.version?.trim();if(ie!==G){const I=ie?.split(".").map(Number)||[0,0,0],V=G?.split(".").map(Number)||[0,0,0];for(let ee=0;ee<3;ee++){if((V[ee]||0)>(I[ee]||0))return o.jsxs(Xn,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[o.jsx(Uc,{className:"h-3 w-3"}),"可更新"]});if((V[ee]||0)<(I[ee]||0))break}}return o.jsxs(Xn,{variant:"default",className:"gap-1",children:[o.jsx(Vc,{className:"h-3 w-3"}),"已安装"]})}return null},te=R=>!E||!R.manifest?.host_application?!0:NAe(R.manifest.host_application.min_version,R.manifest.host_application.max_version,E),z=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const ie=R.installed_version.trim(),G=R.manifest.version.trim();if(ie===G)return!1;const I=ie.split(".").map(Number),V=G.split(".").map(Number);for(let ee=0;ee<3;ee++){if((V[ee]||0)>(I[ee]||0))return!0;if((V[ee]||0)<(I[ee]||0))return!1}return!1},Q=m.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const ie=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(ee=>ee.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let I=!0;l==="installed"?I=R.installed===!0:l==="updates"&&(I=R.installed===!0&&z(R));const V=!d||!E||te(R);return ie&&G&&I&&V}),F=()=>{n(null)},Y=async R=>{if(!k?.installed){B({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(E&&!te(R)){B({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await TAe(R.id,R.manifest.repository_url||"","main"),DAe(R.id).catch(G=>{console.warn("Failed to record download:",G)}),B({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const ie=await G1();A(ie),g(G=>G.map(I=>{if(I.id===R.id){const V=X1(I.id,ie),ee=Y1(I.id,ie);return{...I,installed:V,installed_version:ee}}return I}))}catch(ie){B({title:"安装失败",description:ie instanceof Error?ie.message:"未知错误",variant:"destructive"})}},J=async R=>{try{await EAe(R.id),B({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const ie=await G1();A(ie),g(G=>G.map(I=>{if(I.id===R.id){const V=X1(I.id,ie),ee=Y1(I.id,ie);return{...I,installed:V,installed_version:ee}}return I}))}catch(ie){B({title:"卸载失败",description:ie instanceof Error?ie.message:"未知错误",variant:"destructive"})}},X=async R=>{if(!k?.installed){B({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const ie=await _Ae(R.id,R.manifest.repository_url||"","main");B({title:"更新成功",description:`${R.manifest.name} 已从 ${ie.old_version} 更新到 ${ie.new_version}`});const G=await G1();A(G),g(I=>I.map(V=>{if(V.id===R.id){const ee=X1(V.id,G),ne=Y1(V.id,G);return{...V,installed:ee,installed_version:ne}}return V}))}catch(ie){B({title:"更新失败",description:ie instanceof Error?ie.message:"未知错误",variant:"destructive"})}};return o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),o.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),o.jsxs(de,{onClick:()=>t({to:"/plugin-mirrors"}),children:[o.jsx(ste,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),k&&!k.installed&&o.jsxs(qt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[o.jsx(Fn,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Wa,{className:"h-5 w-5 text-orange-600"}),o.jsxs("div",{children:[o.jsx(qn,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),o.jsx(ts,{className:"text-orange-800 dark:text-orange-200",children:k.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),o.jsx(Gn,{children:o.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",o.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),o.jsx(qt,{className:"p-4",children:o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(Ni,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ze,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),o.jsxs(Vt,{value:i,onValueChange:a,children:[o.jsx($t,{className:"w-full sm:w-[200px]",children:o.jsx(Ut,{placeholder:"选择分类"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部分类"}),o.jsx(De,{value:"Group Management",children:"群组管理"}),o.jsx(De,{value:"Entertainment & Interaction",children:"娱乐互动"}),o.jsx(De,{value:"Utility Tools",children:"实用工具"}),o.jsx(De,{value:"Content Generation",children:"内容生成"}),o.jsx(De,{value:"Multimedia",children:"多媒体"}),o.jsx(De,{value:"External Integration",children:"外部集成"}),o.jsx(De,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),o.jsx(De,{value:"Other",children:"其他"})]})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Oi,{id:"compatible-only",checked:d,onCheckedChange:R=>h(R===!0)}),o.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),o.jsx(ja,{value:l,onValueChange:c,className:"w-full",children:o.jsxs(Wi,{className:"grid w-full grid-cols-3",children:[o.jsxs(Lt,{value:"all",children:["全部插件 (",m.filter(R=>{if(!R.manifest)return!1;const ie=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(V=>V.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),I=!d||!E||te(R);return ie&&G&&I}).length,")"]}),o.jsxs(Lt,{value:"installed",children:["已安装 (",m.filter(R=>{if(!R.manifest)return!1;const ie=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(V=>V.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),I=!d||!E||te(R);return R.installed&&ie&&G&&I}).length,")"]}),o.jsxs(Lt,{value:"updates",children:["可更新 (",m.filter(R=>{if(!R.manifest)return!1;const ie=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(V=>V.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),I=!d||!E||te(R);return R.installed&&z(R)&&ie&&G&&I}).length,")"]})]})}),N&&N.stage==="loading"&&o.jsx(qt,{className:"p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Po,{className:"h-4 w-4 animate-spin"}),o.jsxs("span",{className:"text-sm font-medium",children:[N.operation==="fetch"&&"加载插件列表",N.operation==="install"&&`安装插件${N.plugin_id?`: ${N.plugin_id}`:""}`,N.operation==="uninstall"&&`卸载插件${N.plugin_id?`: ${N.plugin_id}`:""}`,N.operation==="update"&&`更新插件${N.plugin_id?`: ${N.plugin_id}`:""}`]})]}),o.jsxs("span",{className:"text-sm font-medium",children:[N.progress,"%"]})]}),o.jsx(Lp,{value:N.progress,className:"h-2"}),o.jsx("div",{className:"text-xs text-muted-foreground",children:N.message}),N.operation==="fetch"&&N.total_plugins>0&&o.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",N.loaded_plugins," / ",N.total_plugins," 个插件"]})]})}),N&&N.stage==="error"&&N.error&&o.jsx(qt,{className:"border-destructive bg-destructive/10",children:o.jsx(Fn,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Wa,{className:"h-5 w-5 text-destructive"}),o.jsxs("div",{children:[o.jsx(qn,{className:"text-lg text-destructive",children:"加载失败"}),o.jsx(ts,{className:"text-destructive/80",children:N.error})]})]})})}),x?o.jsxs("div",{className:"flex items-center justify-center py-12",children:[o.jsx(Po,{className:"h-8 w-8 animate-spin text-muted-foreground"}),o.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):w?o.jsx(qt,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Wa,{className:"h-12 w-12 text-destructive mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:w}),o.jsx(de,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):Q.length===0?o.jsx(qt,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Ni,{className:"h-12 w-12 text-muted-foreground mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Q.map(R=>o.jsxs(qt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[o.jsxs(Fn,{children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx(qn,{className:"text-xl",children:R.manifest?.name||R.id}),o.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&o.jsx(Xn,{variant:"secondary",className:"text-xs whitespace-nowrap",children:Mz[R.manifest.categories[0]]||R.manifest.categories[0]}),U(R)]})]}),o.jsx(ts,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),o.jsx(Gn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ku,{className:"h-4 w-4"}),o.jsx("span",{children:(L[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ac,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsx("span",{children:(L[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(ie=>o.jsx(Xn,{variant:"outline",className:"text-xs",children:ie},ie)),R.manifest?.keywords&&R.manifest.keywords.length>3&&o.jsxs(Xn,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),o.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[o.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{children:"支持:"}),o.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),o.jsx(lL,{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[o.jsx(de,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?z(R)?o.jsxs(de,{size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>X(R),children:[o.jsx(Ps,{className:"h-4 w-4 mr-1"}),"更新"]}):o.jsxs(de,{variant:"destructive",size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>J(R),children:[o.jsx(Sn,{className:"h-4 w-4 mr-1"}),"卸载"]}):o.jsxs(de,{size:"sm",disabled:!k?.installed||N?.operation==="install"||E!==null&&!te(R),title:k?.installed?E!==null&&!te(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${E?.version})`:void 0:"Git 未安装",onClick:()=>Y(R),children:[o.jsx(Ku,{className:"h-4 w-4 mr-1"}),N?.operation==="install"&&N?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),o.jsx(Dr,{open:e!==null,onOpenChange:F,children:e&&e.manifest&&o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsx(kr,{children:o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"space-y-2 flex-1",children:[o.jsx(Or,{className:"text-2xl",children:e.manifest.name}),o.jsxs(ss,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&o.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:o.jsx(Ah,{className:"h-3 w-3 inline"})})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&o.jsx(Xn,{variant:"secondary",children:Mz[e.manifest.categories[0]]||e.manifest.categories[0]}),U(e)]})]})}),o.jsxs("div",{className:"space-y-6",children:[o.jsx(zAe,{pluginId:e.id}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"版本"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"下载量"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:(L[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"评分"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ac,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[(L[e.id]?.rating??e.rating??0).toFixed(1)," (",L[e.id]?.rating_count??e.review_count??0,")"]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"许可证"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),o.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>o.jsx(Xn,{variant:"outline",children:R},R))})]}),e.detailed_description&&o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),o.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),o.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"font-medium",children:"主页: "}),o.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"font-medium",children:"仓库: "}),o.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),o.jsxs(ws,{children:[e.manifest.homepage_url&&o.jsxs(de,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[o.jsx(Ah,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&o.jsxs(de,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[o.jsx(Ah,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function LAe(){return o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(de,{variant:"outline",size:"sm",children:[o.jsx(Ps,{className:"h-4 w-4 mr-2"}),"刷新"]}),o.jsxs(de,{size:"sm",children:[o.jsx(Xu,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"已安装插件"}),o.jsx(Gh,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"已启用"}),o.jsx(Vc,{className:"h-4 w-4 text-green-600"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"已禁用"}),o.jsx(Uc,{className:"h-4 w-4 text-orange-600"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(qn,{className:"text-sm font-medium",children:"可更新"}),o.jsx(Ps,{className:"h-4 w-4 text-blue-600"})]}),o.jsxs(Gn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),o.jsxs(qt,{children:[o.jsxs(Fn,{children:[o.jsx(qn,{children:"已安装的插件"}),o.jsx(ts,{children:"查看和管理已安装插件的配置"})]}),o.jsx(Gn,{children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[o.jsx(Gh,{className:"h-16 w-16 text-muted-foreground/50"}),o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),o.jsx("div",{className:"flex gap-2",children:o.jsx(de,{variant:"outline",asChild:!0,children:o.jsxs("a",{href:"/plugins",children:[o.jsx(Ah,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),o.jsx(qt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:o.jsx(Gn,{className:"pt-6",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Uc,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),o.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",o.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function BAe(){const t=Zi(),{toast:e}=as(),[n,r]=b.useState([]),[s,i]=b.useState(!0),[a,l]=b.useState(null),[c,d]=b.useState(null),[h,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S=b.useCallback(async()=>{try{i(!0),l(null);const A=localStorage.getItem("access-token"),L=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${A}`}});if(!L.ok)throw new Error("获取镜像源列表失败");const P=await L.json();r(P.mirrors||[])}catch(A){const L=A instanceof Error?A.message:"加载镜像源失败";l(L),e({title:"加载失败",description:L,variant:"destructive"})}finally{i(!1)}},[e]);b.useEffect(()=>{S()},[S]);const k=async()=>{try{const A=localStorage.getItem("access-token"),L=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"},body:JSON.stringify(y)});if(!L.ok){const P=await L.json();throw new Error(P.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),m(!1),w({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S()}catch(A){e({title:"添加失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},j=async()=>{if(c)try{const A=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${c.id}`,{method:"PUT",headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"},body:JSON.stringify({name:y.name,raw_prefix:y.raw_prefix,clone_prefix:y.clone_prefix,enabled:y.enabled,priority:y.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),x(!1),d(null),S()}catch(A){e({title:"更新失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},N=async A=>{if(confirm("确定要删除这个镜像源吗?"))try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A}`,{method:"DELETE",headers:{Authorization:`Bearer ${L}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),S()}catch(L){e({title:"删除失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},T=async A=>{try{const L=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",headers:{Authorization:`Bearer ${L}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!A.enabled})})).ok)throw new Error("更新状态失败");S()}catch(L){e({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},E=A=>{d(A),w({id:A.id,name:A.name,raw_prefix:A.raw_prefix,clone_prefix:A.clone_prefix,enabled:A.enabled,priority:A.priority}),x(!0)},_=async(A,L)=>{const P=L==="up"?A.priority-1:A.priority+1;if(!(P<1))try{const B=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",headers:{Authorization:`Bearer ${B}`,"Content-Type":"application/json"},body:JSON.stringify({priority:P})})).ok)throw new Error("更新优先级失败");S()}catch(B){e({title:"更新失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}};return o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx(de,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:o.jsx(wI,{className:"h-5 w-5"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),o.jsxs(de,{onClick:()=>m(!0),children:[o.jsx(Ls,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?o.jsx(qt,{className:"p-6",children:o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(Po,{className:"h-8 w-8 animate-spin text-primary"})})}):a?o.jsx(qt,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Wa,{className:"h-12 w-12 text-destructive mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:a}),o.jsx(de,{onClick:S,children:"重新加载"})]})}):o.jsxs(qt,{children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(_f,{children:[o.jsx(Af,{children:o.jsxs(Is,{children:[o.jsx(pn,{children:"状态"}),o.jsx(pn,{children:"名称"}),o.jsx(pn,{children:"ID"}),o.jsx(pn,{children:"优先级"}),o.jsx(pn,{className:"text-right",children:"操作"})]})}),o.jsx(Mf,{children:n.map(A=>o.jsxs(Is,{children:[o.jsx(Gt,{children:o.jsx(Bt,{checked:A.enabled,onCheckedChange:()=>T(A)})}),o.jsx(Gt,{children:o.jsxs("div",{children:[o.jsx("div",{className:"font-medium",children:A.name}),o.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",A.raw_prefix]})]})}),o.jsx(Gt,{children:o.jsx(Xn,{variant:"outline",children:A.id})}),o.jsx(Gt,{children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-mono",children:A.priority}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx(de,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>_(A,"up"),disabled:A.priority===1,children:o.jsx(P0,{className:"h-3 w-3"})}),o.jsx(de,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>_(A,"down"),children:o.jsx(nd,{className:"h-3 w-3"})})]})]})}),o.jsx(Gt,{className:"text-right",children:o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[o.jsx(de,{variant:"ghost",size:"icon",onClick:()=>E(A),children:o.jsx(Yu,{className:"h-4 w-4"})}),o.jsx(de,{variant:"ghost",size:"icon",onClick:()=>N(A.id),children:o.jsx(Sn,{className:"h-4 w-4 text-destructive"})})]})})]},A.id))})]})}),o.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(A=>o.jsx(qt,{className:"p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h3",{className:"font-semibold",children:A.name}),A.enabled&&o.jsx(Xn,{variant:"default",className:"text-xs",children:"启用"})]}),o.jsx(Xn,{variant:"outline",className:"mt-1 text-xs",children:A.id})]}),o.jsx(Bt,{checked:A.enabled,onCheckedChange:()=>T(A)})]}),o.jsxs("div",{className:"text-sm space-y-1",children:[o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"Raw: "}),o.jsx("span",{className:"break-all",children:A.raw_prefix})]}),o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"优先级: "}),o.jsx("span",{className:"font-mono",children:A.priority})]})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[o.jsxs(de,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>E(A),children:[o.jsx(Yu,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>_(A,"up"),disabled:A.priority===1,children:o.jsx(P0,{className:"h-4 w-4"})}),o.jsx(de,{variant:"outline",size:"sm",onClick:()=>_(A,"down"),children:o.jsx(nd,{className:"h-4 w-4"})}),o.jsx(de,{variant:"destructive",size:"sm",onClick:()=>N(A.id),children:o.jsx(Sn,{className:"h-4 w-4"})})]})]})},A.id))})]}),o.jsx(Dr,{open:h,onOpenChange:m,children:o.jsxs(Sr,{className:"max-w-lg",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"添加镜像源"}),o.jsx(ss,{children:"添加新的 Git 镜像源配置"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-id",children:"镜像源 ID *"}),o.jsx(ze,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:A=>w({...y,id:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-name",children:"名称 *"}),o.jsx(ze,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:A=>w({...y,name:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),o.jsx(ze,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:A=>w({...y,raw_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-clone",children:"克隆前缀 *"}),o.jsx(ze,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:A=>w({...y,clone_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-priority",children:"优先级"}),o.jsx(ze,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:A=>w({...y,priority:parseInt(A.target.value)||1})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"add-enabled",checked:y.enabled,onCheckedChange:A=>w({...y,enabled:A})}),o.jsx(he,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>m(!1),children:"取消"}),o.jsx(de,{onClick:k,children:"添加"})]})]})}),o.jsx(Dr,{open:g,onOpenChange:x,children:o.jsxs(Sr,{className:"max-w-lg",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑镜像源"}),o.jsx(ss,{children:"修改镜像源配置"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"镜像源 ID"}),o.jsx(ze,{value:y.id,disabled:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-name",children:"名称 *"}),o.jsx(ze,{id:"edit-name",value:y.name,onChange:A=>w({...y,name:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),o.jsx(ze,{id:"edit-raw",value:y.raw_prefix,onChange:A=>w({...y,raw_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-clone",children:"克隆前缀 *"}),o.jsx(ze,{id:"edit-clone",value:y.clone_prefix,onChange:A=>w({...y,clone_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-priority",children:"优先级"}),o.jsx(ze,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:A=>w({...y,priority:parseInt(A.target.value)||1})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Bt,{id:"edit-enabled",checked:y.enabled,onCheckedChange:A=>w({...y,enabled:A})}),o.jsx(he,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),o.jsxs(ws,{children:[o.jsx(de,{variant:"outline",onClick:()=>x(!1),children:"取消"}),o.jsx(de,{onClick:j,children:"保存"})]})]})})]})})}function FAe(t,e=[]){let n=[];function r(i,a){const l=b.createContext(a);l.displayName=i+"Context";const c=n.length;n=[...n,a];const d=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[c]||l,S=b.useMemo(()=>y,Object.values(y));return o.jsx(w.Provider,{value:S,children:x})};d.displayName=i+"Provider";function h(m,g){const x=g?.[t]?.[c]||l,y=b.useContext(x);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[d,h]}const s=()=>{const i=n.map(a=>b.createContext(a));return function(l){const c=l?.[t]||i;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,qAe(s,...e)]}function qAe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((l,{useScope:c,scopeName:d})=>{const m=c(i)[`__scope${d}`];return{...l,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var $Ae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],f7=$Ae.reduce((t,e)=>{const n=Fy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),HAe=gJ();function QAe(){return HAe.useSyncExternalStore(VAe,()=>!0,()=>!1)}function VAe(){return()=>{}}var m7="Avatar",[UAe]=FAe(m7),[WAe,hX]=UAe(m7),fX=b.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[s,i]=b.useState("idle");return o.jsx(WAe,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:o.jsx(f7.span,{...r,ref:e})})});fX.displayName=m7;var mX="AvatarImage",pX=b.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:s=()=>{},...i}=t,a=hX(mX,n),l=GAe(r,i),c=Rs(d=>{s(d),a.onImageLoadingStatusChange(d)});return Uh(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?o.jsx(f7.img,{...i,ref:e,src:r}):null});pX.displayName=mX;var gX="AvatarFallback",xX=b.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...s}=t,i=hX(gX,n),[a,l]=b.useState(r===void 0);return b.useEffect(()=>{if(r!==void 0){const c=window.setTimeout(()=>l(!0),r);return()=>window.clearTimeout(c)}},[r]),a&&i.imageLoadingStatus!=="loaded"?o.jsx(f7.span,{...s,ref:e}):null});xX.displayName=gX;function Rz(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function GAe(t,{referrerPolicy:e,crossOrigin:n}){const r=QAe(),s=b.useRef(null),i=r?(s.current||(s.current=new window.Image),s.current):null,[a,l]=b.useState(()=>Rz(i,t));return Uh(()=>{l(Rz(i,t))},[i,t]),Uh(()=>{const c=m=>()=>{l(m)};if(!i)return;const d=c("loaded"),h=c("error");return i.addEventListener("load",d),i.addEventListener("error",h),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",d),i.removeEventListener("error",h)}},[i,n,e]),a}var vX=fX,yX=pX,bX=xX;const _v=b.forwardRef(({className:t,...e},n)=>o.jsx(vX,{ref:n,className:xe("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));_v.displayName=vX.displayName;const XAe=b.forwardRef(({className:t,...e},n)=>o.jsx(yX,{ref:n,className:xe("aspect-square h-full w-full",t),...e}));XAe.displayName=yX.displayName;const Av=b.forwardRef(({className:t,...e},n)=>o.jsx(bX,{ref:n,className:xe("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));Av.displayName=bX.displayName;function YAe(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function KAe(){const t="maibot_webui_user_id";let e=localStorage.getItem(t);return e||(e=YAe(),localStorage.setItem(t,e)),e}function ZAe(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function JAe(t){localStorage.setItem("maibot_webui_user_name",t)}function eMe(){const[t,e]=b.useState([]),[n,r]=b.useState(""),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!0),[g,x]=b.useState(ZAe()),[y,w]=b.useState(!1),[S,k]=b.useState(""),[j,N]=b.useState({}),T=b.useRef(KAe()),E=b.useRef(null),_=b.useRef(null),A=b.useRef(null),L=b.useRef(0),P=b.useRef(new Set),{toast:B}=as(),$=I=>(L.current+=1,`${I}-${Date.now()}-${L.current}-${Math.random().toString(36).substr(2,9)}`),U=b.useCallback(()=>{_.current?.scrollIntoView({behavior:"smooth"})},[]);b.useEffect(()=>{U()},[t,U]);const te=b.useCallback(async()=>{m(!0);try{const I=`/api/chat/history?user_id=${T.current}&limit=50`;console.log("[Chat] 正在加载历史消息:",I);const V=await fetch(I);if(console.log("[Chat] 历史消息响应状态:",V.status,V.statusText),console.log("[Chat] 响应 Content-Type:",V.headers.get("content-type")),V.ok){const ee=await V.text();console.log("[Chat] 响应内容前100字符:",ee.substring(0,100));try{const ne=JSON.parse(ee);if(console.log("[Chat] 解析后的数据:",ne),ne.messages&&ne.messages.length>0){const W=ne.messages.map(se=>({id:se.id,type:se.type,content:se.content,timestamp:se.timestamp,sender:{name:se.sender_name||(se.is_bot?"麦麦":"WebUI用户"),user_id:se.user_id,is_bot:se.is_bot}}));e(W),console.log("[Chat] 已加载历史消息数量:",W.length),W.forEach(se=>{if(se.type==="bot"){const re=`bot-${se.content}-${Math.floor(se.timestamp*1e3)}`;P.current.add(re)}})}else console.log("[Chat] 没有历史消息")}catch(ne){console.error("[Chat] JSON 解析失败:",ne),console.error("[Chat] 原始响应内容:",ee)}}else{console.error("[Chat] 响应失败:",V.status);const ee=await V.text();console.error("[Chat] 错误响应内容:",ee.substring(0,200))}}catch(I){console.error("[Chat] 加载历史消息失败:",I)}finally{m(!1)}},[]),z=b.useCallback(()=>{if(E.current?.readyState===WebSocket.OPEN||E.current?.readyState===WebSocket.CONNECTING){console.log("WebSocket 已存在,跳过连接");return}l(!0);const V=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/chat/ws?user_id=${encodeURIComponent(T.current)}&user_name=${encodeURIComponent(g)}`;console.log("正在连接 WebSocket:",V);try{const ee=new WebSocket(V);E.current=ee,ee.onopen=()=>{i(!0),l(!1),console.log("WebSocket 已连接")},ee.onmessage=ne=>{try{const W=JSON.parse(ne.data);switch(W.type){case"session_info":N({session_id:W.session_id,user_id:W.user_id,user_name:W.user_name,bot_name:W.bot_name});break;case"system":e(se=>[...se,{id:$("sys"),type:"system",content:W.content||"",timestamp:W.timestamp||Date.now()/1e3}]);break;case"user_message":e(se=>[...se,{id:W.message_id||$("user"),type:"user",content:W.content||"",timestamp:W.timestamp||Date.now()/1e3,sender:W.sender}]);break;case"bot_message":{d(!1);const se=`bot-${W.content}-${Math.floor((W.timestamp||0)*1e3)}`;if(P.current.has(se)){console.log("跳过重复的机器人消息");break}if(P.current.add(se),P.current.size>100){const re=P.current.values().next().value;re&&P.current.delete(re)}e(re=>[...re,{id:$("bot"),type:"bot",content:W.content||"",timestamp:W.timestamp||Date.now()/1e3,sender:W.sender}]);break}case"typing":d(W.is_typing||!1);break;case"error":e(se=>[...se,{id:$("error"),type:"error",content:W.content||"发生错误",timestamp:W.timestamp||Date.now()/1e3}]),B({title:"错误",description:W.content,variant:"destructive"});break;case"pong":break;default:console.log("未知消息类型:",W.type)}}catch(W){console.error("解析消息失败:",W)}},ee.onclose=()=>{i(!1),l(!1),E.current=null,console.log("WebSocket 已断开"),A.current&&clearTimeout(A.current),A.current=window.setTimeout(()=>{Q.current||z()},5e3)},ee.onerror=ne=>{console.error("WebSocket 错误:",ne),l(!1)}}catch(ee){console.error("创建 WebSocket 失败:",ee),l(!1)}},[B,g]),Q=b.useRef(!1);b.useEffect(()=>{Q.current=!1,te();const I=setTimeout(()=>{Q.current||z()},100),V=setInterval(()=>{E.current?.readyState===WebSocket.OPEN&&E.current.send(JSON.stringify({type:"ping"}))},3e4);return()=>{Q.current=!0,clearTimeout(I),clearInterval(V),A.current&&(clearTimeout(A.current),A.current=null),E.current&&(E.current.close(),E.current=null)}},[z,te]);const F=b.useCallback(()=>{!n.trim()||!E.current||E.current.readyState!==WebSocket.OPEN||(E.current.send(JSON.stringify({type:"message",content:n.trim(),user_name:g})),r(""))},[n,g]),Y=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),F())},J=()=>{k(g),w(!0)},X=()=>{const I=S.trim()||"WebUI用户";x(I),JAe(I),w(!1),E.current?.readyState===WebSocket.OPEN&&E.current.send(JSON.stringify({type:"update_nickname",user_name:I}))},R=()=>{k(""),w(!1)},ie=I=>new Date(I*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),G=()=>{E.current&&E.current.close(),z()};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"shrink-0 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[o.jsx(_v,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:o.jsx(Av,{className:"bg-primary/10 text-primary",children:o.jsx(a0,{className:"h-4 w-4 sm:h-5 sm:w-5"})})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h1",{className:"text-base sm:text-lg font-semibold truncate",children:j.bot_name||"麦麦"}),o.jsx("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:s?o.jsxs(o.Fragment,{children:[o.jsx(ite,{className:"h-3 w-3 text-green-500"}),o.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):a?o.jsxs(o.Fragment,{children:[o.jsx(Po,{className:"h-3 w-3 animate-spin"}),o.jsx("span",{children:"连接中..."})]}):o.jsxs(o.Fragment,{children:[o.jsx(ate,{className:"h-3 w-3 text-red-500"}),o.jsx("span",{className:"text-red-600 dark:text-red-400",children:"未连接"})]})})]})]}),o.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h&&o.jsx(Po,{className:"h-4 w-4 animate-spin text-muted-foreground"}),o.jsx(de,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:G,disabled:a,title:"重新连接",children:o.jsx(Ps,{className:xe("h-4 w-4",a&&"animate-spin")})})]})]}),o.jsxs("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:[o.jsx(Dv,{className:"h-3 w-3"}),o.jsx("span",{children:"当前身份:"}),y?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ze,{value:S,onChange:I=>k(I.target.value),onKeyDown:I=>{I.key==="Enter"&&X(),I.key==="Escape"&&R()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),o.jsx(de,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:X,children:"保存"}),o.jsx(de,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:R,children:"取消"})]}):o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"font-medium text-foreground",children:g}),o.jsx(de,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:J,title:"修改昵称",children:o.jsx(ote,{className:"h-3 w-3"})})]})]})]})}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(gn,{className:"h-full",children:o.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[t.length===0&&!h&&o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[o.jsx(a0,{className:"h-12 w-12 mb-4 opacity-50"}),o.jsxs("p",{className:"text-sm",children:["开始与 ",j.bot_name||"麦麦"," 对话吧!"]})]}),t.map(I=>o.jsxs("div",{className:xe("flex gap-2 sm:gap-3",I.type==="user"&&"flex-row-reverse",I.type==="system"&&"justify-center",I.type==="error"&&"justify-center"),children:[I.type==="system"&&o.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:I.content}),I.type==="error"&&o.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 px-3 py-1 rounded-full max-w-[90%]",children:I.content}),(I.type==="user"||I.type==="bot")&&o.jsxs(o.Fragment,{children:[o.jsx(_v,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:o.jsx(Av,{className:xe("text-xs",I.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:I.type==="bot"?o.jsx(a0,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):o.jsx(Dv,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),o.jsxs("div",{className:xe("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",I.type==="user"&&"items-end"),children:[o.jsxs("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[o.jsx("span",{className:"hidden sm:inline",children:I.sender?.name||(I.type==="bot"?j.bot_name:g)}),o.jsx("span",{children:ie(I.timestamp)})]}),o.jsx("div",{className:xe("rounded-2xl px-3 py-2 text-sm whitespace-pre-wrap break-words",I.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:I.content})]})]})]},I.id)),c&&o.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[o.jsx(_v,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:o.jsx(Av,{className:"bg-primary/10 text-primary",children:o.jsx(a0,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),o.jsx("div",{className:"bg-muted rounded-2xl rounded-tl-sm px-4 py-3",children:o.jsxs("div",{className:"flex gap-1",children:[o.jsx("span",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),o.jsx("span",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),o.jsx("span",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})})]}),o.jsx("div",{ref:_})]})})}),o.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ze,{value:n,onChange:I=>r(I.target.value),onKeyDown:Y,placeholder:s?"输入消息...":"等待连接...",disabled:!s,className:"flex-1 h-10 sm:h-10"}),o.jsx(de,{onClick:F,disabled:!s||!n.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:o.jsx(lte,{className:"h-4 w-4"})})]})})})]})}const tMe=kf("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"}}),wX=b.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>o.jsx("kbd",{className:xe(tMe({size:e,className:t})),ref:i,...s,children:n?o.jsx("abbr",{title:n,children:r}):r}));wX.displayName="Kbd";const nMe=[{icon:D0,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:zl,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:kI,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:OI,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:_j,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Wh,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:jI,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:cte,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:Gh,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Pv,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Xu,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function rMe({open:t,onOpenChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState(0),a=Zi(),l=nMe.filter(h=>h.title.toLowerCase().includes(n.toLowerCase())||h.description.toLowerCase().includes(n.toLowerCase())||h.category.toLowerCase().includes(n.toLowerCase()));b.useEffect(()=>{t&&(r(""),i(0))},[t]);const c=b.useCallback(h=>{a({to:h}),e(!1)},[a,e]),d=b.useCallback(h=>{h.key==="ArrowDown"?(h.preventDefault(),i(m=>(m+1)%l.length)):h.key==="ArrowUp"?(h.preventDefault(),i(m=>(m-1+l.length)%l.length)):h.key==="Enter"&&l[s]&&(h.preventDefault(),c(l[s].path))},[l,s,c]);return o.jsx(Dr,{open:t,onOpenChange:e,children:o.jsxs(Sr,{className:"max-w-2xl p-0 gap-0",children:[o.jsxs(kr,{className:"px-4 pt-4 pb-0",children:[o.jsx(Or,{className:"sr-only",children:"搜索"}),o.jsxs("div",{className:"relative",children:[o.jsx(Ni,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),o.jsx(ze,{value:n,onChange:h=>{r(h.target.value),i(0)},onKeyDown:d,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),o.jsx("div",{className:"border-t",children:o.jsx(gn,{className:"h-[400px]",children:l.length>0?o.jsx("div",{className:"p-2",children:l.map((h,m)=>{const g=h.icon;return o.jsxs("button",{onClick:()=>c(h.path),onMouseEnter:()=>i(m),className:xe("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",m===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[o.jsx(g,{className:"h-5 w-5 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium text-sm",children:h.title}),o.jsx("div",{className:"text-xs text-muted-foreground truncate",children:h.description})]}),o.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:h.category})]},h.path)})}):o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o.jsx(Ni,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),o.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function sMe(t){const e=iMe(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,l=b.Children.toArray(i),c=l.find(oMe);if(c){const d=c.props.children,h=l.map(m=>m===c?b.Children.count(d)>1?b.Children.only(null):b.isValidElement(d)?d.props.children:null:m);return o.jsx(e,{...a,ref:s,children:b.isValidElement(d)?b.cloneElement(d,void 0,h):null})}return o.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function iMe(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=cMe(s),l=lMe(i,s.props);return s.type!==b.Fragment&&(l.ref=r?Qc(r,a):a),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var aMe=Symbol("radix.slottable");function oMe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===aMe}function lMe(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function cMe(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 cj=["Enter"," "],uMe=["ArrowDown","PageUp","Home"],SX=["ArrowUp","PageDown","End"],dMe=[...uMe,...SX],hMe={ltr:[...cj,"ArrowRight"],rtl:[...cj,"ArrowLeft"]},fMe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},kg="Menu",[Np,mMe,pMe]=By(kg),[jd,kX]=Ra(kg,[pMe,vf,eb]),Og=vf(),OX=eb(),[jX,fu]=jd(kg),[gMe,jg]=jd(kg),NX=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:a=!0}=t,l=Og(e),[c,d]=b.useState(null),h=b.useRef(!1),m=Rs(i),g=Ep(s);return b.useEffect(()=>{const x=()=>{h.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>h.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),o.jsx(Vy,{...l,children:o.jsx(jX,{scope:e,open:n,onOpenChange:m,content:c,onContentChange:d,children:o.jsx(gMe,{scope:e,onClose:b.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:h,dir:g,modal:a,children:r})})})};NX.displayName=kg;var xMe="MenuAnchor",p7=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Og(n);return o.jsx(Uy,{...s,...r,ref:e})});p7.displayName=xMe;var g7="MenuPortal",[vMe,CX]=jd(g7,{forceMount:void 0}),TX=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=fu(g7,e);return o.jsx(vMe,{scope:e,forceMount:n,children:o.jsx(ii,{present:n||i.open,children:o.jsx(Qy,{asChild:!0,container:s,children:r})})})};TX.displayName=g7;var Ta="MenuContent",[yMe,x7]=jd(Ta),EX=b.forwardRef((t,e)=>{const n=CX(Ta,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=fu(Ta,t.__scopeMenu),a=jg(Ta,t.__scopeMenu);return o.jsx(Np.Provider,{scope:t.__scopeMenu,children:o.jsx(ii,{present:r||i.open,children:o.jsx(Np.Slot,{scope:t.__scopeMenu,children:a.modal?o.jsx(bMe,{...s,ref:e}):o.jsx(wMe,{...s,ref:e})})})})}),bMe=b.forwardRef((t,e)=>{const n=fu(Ta,t.__scopeMenu),r=b.useRef(null),s=Yn(e,r);return b.useEffect(()=>{const i=r.current;if(i)return hI(i)},[]),o.jsx(v7,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:nt(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),wMe=b.forwardRef((t,e)=>{const n=fu(Ta,t.__scopeMenu);return o.jsx(v7,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),SMe=sMe("MenuContent.ScrollLock"),v7=b.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:g,onDismiss:x,disableOutsideScroll:y,...w}=t,S=fu(Ta,n),k=jg(Ta,n),j=Og(n),N=OX(n),T=mMe(n),[E,_]=b.useState(null),A=b.useRef(null),L=Yn(e,A,S.onContentChange),P=b.useRef(0),B=b.useRef(""),$=b.useRef(0),U=b.useRef(null),te=b.useRef("right"),z=b.useRef(0),Q=y?fI:b.Fragment,F=y?{as:SMe,allowPinchZoom:!0}:void 0,Y=X=>{const R=B.current+X,ie=T().filter(W=>!W.disabled),G=document.activeElement,I=ie.find(W=>W.ref.current===G)?.textValue,V=ie.map(W=>W.textValue),ee=DMe(V,R,I),ne=ie.find(W=>W.textValue===ee)?.ref.current;(function W(se){B.current=se,window.clearTimeout(P.current),se!==""&&(P.current=window.setTimeout(()=>W(""),1e3))})(R),ne&&setTimeout(()=>ne.focus())};b.useEffect(()=>()=>window.clearTimeout(P.current),[]),mI();const J=b.useCallback(X=>te.current===U.current?.side&&zMe(X,U.current?.area),[]);return o.jsx(yMe,{scope:n,searchRef:B,onItemEnter:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),onItemLeave:b.useCallback(X=>{J(X)||(A.current?.focus(),_(null))},[J]),onTriggerLeave:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),pointerGraceTimerRef:$,onPointerGraceIntentChange:b.useCallback(X=>{U.current=X},[]),children:o.jsx(Q,{...F,children:o.jsx(pI,{asChild:!0,trapped:s,onMountAutoFocus:nt(i,X=>{X.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:o.jsx(Cj,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:g,onDismiss:x,children:o.jsx(mL,{asChild:!0,...N,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:_,onEntryFocus:nt(c,X=>{k.isUsingKeyboardRef.current||X.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(Tj,{role:"menu","aria-orientation":"vertical","data-state":UX(S.open),"data-radix-menu-content":"",dir:k.dir,...j,...w,ref:L,style:{outline:"none",...w.style},onKeyDown:nt(w.onKeyDown,X=>{const ie=X.target.closest("[data-radix-menu-content]")===X.currentTarget,G=X.ctrlKey||X.altKey||X.metaKey,I=X.key.length===1;ie&&(X.key==="Tab"&&X.preventDefault(),!G&&I&&Y(X.key));const V=A.current;if(X.target!==V||!dMe.includes(X.key))return;X.preventDefault();const ne=T().filter(W=>!W.disabled).map(W=>W.ref.current);SX.includes(X.key)&&ne.reverse(),MMe(ne)}),onBlur:nt(t.onBlur,X=>{X.currentTarget.contains(X.target)||(window.clearTimeout(P.current),B.current="")}),onPointerMove:nt(t.onPointerMove,Cp(X=>{const R=X.target,ie=z.current!==X.clientX;if(X.currentTarget.contains(R)&&ie){const G=X.clientX>z.current?"right":"left";te.current=G,z.current=X.clientX}}))})})})})})})});EX.displayName=Ta;var kMe="MenuGroup",y7=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{role:"group",...r,ref:e})});y7.displayName=kMe;var OMe="MenuLabel",_X=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});_X.displayName=OMe;var Py="MenuItem",Dz="menu.itemSelect",rw=b.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=b.useRef(null),a=jg(Py,t.__scopeMenu),l=x7(Py,t.__scopeMenu),c=Yn(e,i),d=b.useRef(!1),h=()=>{const m=i.current;if(!n&&m){const g=new CustomEvent(Dz,{bubbles:!0,cancelable:!0});m.addEventListener(Dz,x=>r?.(x),{once:!0}),xI(m,g),g.defaultPrevented?d.current=!1:a.onClose()}};return o.jsx(AX,{...s,ref:c,disabled:n,onClick:nt(t.onClick,h),onPointerDown:m=>{t.onPointerDown?.(m),d.current=!0},onPointerUp:nt(t.onPointerUp,m=>{d.current||m.currentTarget?.click()}),onKeyDown:nt(t.onKeyDown,m=>{const g=l.searchRef.current!=="";n||g&&m.key===" "||cj.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});rw.displayName=Py;var AX=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,a=x7(Py,n),l=OX(n),c=b.useRef(null),d=Yn(e,c),[h,m]=b.useState(!1),[g,x]=b.useState("");return b.useEffect(()=>{const y=c.current;y&&x((y.textContent??"").trim())},[i.children]),o.jsx(Np.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:o.jsx(pL,{asChild:!0,...l,focusable:!r,children:o.jsx(xn.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:d,onPointerMove:nt(t.onPointerMove,Cp(y=>{r?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:nt(t.onPointerLeave,Cp(y=>a.onItemLeave(y))),onFocus:nt(t.onFocus,()=>m(!0)),onBlur:nt(t.onBlur,()=>m(!1))})})})}),jMe="MenuCheckboxItem",MX=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return o.jsx(IX,{scope:t.__scopeMenu,checked:n,children:o.jsx(rw,{role:"menuitemcheckbox","aria-checked":zy(n)?"mixed":n,...s,ref:e,"data-state":S7(n),onSelect:nt(s.onSelect,()=>r?.(zy(n)?!0:!n),{checkForDefaultPrevented:!1})})})});MX.displayName=jMe;var RX="MenuRadioGroup",[NMe,CMe]=jd(RX,{value:void 0,onValueChange:()=>{}}),DX=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=Rs(r);return o.jsx(NMe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:o.jsx(y7,{...s,ref:e})})});DX.displayName=RX;var PX="MenuRadioItem",zX=b.forwardRef((t,e)=>{const{value:n,...r}=t,s=CMe(PX,t.__scopeMenu),i=n===s.value;return o.jsx(IX,{scope:t.__scopeMenu,checked:i,children:o.jsx(rw,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":S7(i),onSelect:nt(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});zX.displayName=PX;var b7="MenuItemIndicator",[IX,TMe]=jd(b7,{checked:!1}),LX=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=TMe(b7,n);return o.jsx(ii,{present:r||zy(i.checked)||i.checked===!0,children:o.jsx(xn.span,{...s,ref:e,"data-state":S7(i.checked)})})});LX.displayName=b7;var EMe="MenuSeparator",BX=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});BX.displayName=EMe;var _Me="MenuArrow",FX=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Og(n);return o.jsx(Ej,{...s,...r,ref:e})});FX.displayName=_Me;var w7="MenuSub",[AMe,qX]=jd(w7),$X=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=fu(w7,e),a=Og(e),[l,c]=b.useState(null),[d,h]=b.useState(null),m=Rs(s);return b.useEffect(()=>(i.open===!1&&m(!1),()=>m(!1)),[i.open,m]),o.jsx(Vy,{...a,children:o.jsx(jX,{scope:e,open:r,onOpenChange:m,content:d,onContentChange:h,children:o.jsx(AMe,{scope:e,contentId:Ui(),triggerId:Ui(),trigger:l,onTriggerChange:c,children:n})})})};$X.displayName=w7;var x0="MenuSubTrigger",HX=b.forwardRef((t,e)=>{const n=fu(x0,t.__scopeMenu),r=jg(x0,t.__scopeMenu),s=qX(x0,t.__scopeMenu),i=x7(x0,t.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,d={__scopeMenu:t.__scopeMenu},h=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>h,[h]),b.useEffect(()=>{const m=l.current;return()=>{window.clearTimeout(m),c(null)}},[l,c]),o.jsx(p7,{asChild:!0,...d,children:o.jsx(AX,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":UX(n.open),...t,ref:Qc(e,s.onTriggerChange),onClick:m=>{t.onClick?.(m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:nt(t.onPointerMove,Cp(m=>{i.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),h()},100))})),onPointerLeave:nt(t.onPointerLeave,Cp(m=>{h();const g=n.content?.getBoundingClientRect();if(g){const x=n.content?.dataset.side,y=x==="right",w=y?-5:5,S=g[y?"left":"right"],k=g[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+w,y:m.clientY},{x:S,y:g.top},{x:k,y:g.top},{x:k,y:g.bottom},{x:S,y:g.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:nt(t.onKeyDown,m=>{const g=i.searchRef.current!=="";t.disabled||g&&m.key===" "||hMe[r.dir].includes(m.key)&&(n.onOpenChange(!0),n.content?.focus(),m.preventDefault())})})})});HX.displayName=x0;var QX="MenuSubContent",VX=b.forwardRef((t,e)=>{const n=CX(Ta,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=fu(Ta,t.__scopeMenu),a=jg(Ta,t.__scopeMenu),l=qX(QX,t.__scopeMenu),c=b.useRef(null),d=Yn(e,c);return o.jsx(Np.Provider,{scope:t.__scopeMenu,children:o.jsx(ii,{present:r||i.open,children:o.jsx(Np.Slot,{scope:t.__scopeMenu,children:o.jsx(v7,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:d,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{a.isUsingKeyboardRef.current&&c.current?.focus(),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:nt(t.onFocusOutside,h=>{h.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:nt(t.onEscapeKeyDown,h=>{a.onClose(),h.preventDefault()}),onKeyDown:nt(t.onKeyDown,h=>{const m=h.currentTarget.contains(h.target),g=fMe[a.dir].includes(h.key);m&&g&&(i.onOpenChange(!1),l.trigger?.focus(),h.preventDefault())})})})})})});VX.displayName=QX;function UX(t){return t?"open":"closed"}function zy(t){return t==="indeterminate"}function S7(t){return zy(t)?"indeterminate":t?"checked":"unchecked"}function MMe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function RMe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function DMe(t,e,n){const s=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=RMe(t,Math.max(i,0));s.length===1&&(a=a.filter(d=>d!==n));const c=a.find(d=>d.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function PMe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-d)*(r-h)/(g-h)+d&&(s=!s)}return s}function zMe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return PMe(n,e)}function Cp(t){return e=>e.pointerType==="mouse"?t(e):void 0}var IMe=NX,LMe=p7,BMe=TX,FMe=EX,qMe=y7,$Me=_X,HMe=rw,QMe=MX,VMe=DX,UMe=zX,WMe=LX,GMe=BX,XMe=FX,YMe=$X,KMe=HX,ZMe=VX,k7="ContextMenu",[JMe]=Ra(k7,[kX]),Gs=kX(),[eRe,WX]=JMe(k7),GX=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[a,l]=b.useState(!1),c=Gs(e),d=Rs(r),h=b.useCallback(m=>{l(m),d(m)},[d]);return o.jsx(eRe,{scope:e,open:a,onOpenChange:h,modal:i,children:o.jsx(IMe,{...c,dir:s,open:a,onOpenChange:h,modal:i,children:n})})};GX.displayName=k7;var XX="ContextMenuTrigger",YX=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=WX(XX,n),a=Gs(n),l=b.useRef({x:0,y:0}),c=b.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=b.useRef(0),h=b.useCallback(()=>window.clearTimeout(d.current),[]),m=g=>{l.current={x:g.clientX,y:g.clientY},i.onOpenChange(!0)};return b.useEffect(()=>h,[h]),b.useEffect(()=>void(r&&h()),[r,h]),o.jsxs(o.Fragment,{children:[o.jsx(LMe,{...a,virtualRef:c}),o.jsx(xn.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:nt(t.onContextMenu,g=>{h(),m(g),g.preventDefault()}),onPointerDown:r?t.onPointerDown:nt(t.onPointerDown,K1(g=>{h(),d.current=window.setTimeout(()=>m(g),700)})),onPointerMove:r?t.onPointerMove:nt(t.onPointerMove,K1(h)),onPointerCancel:r?t.onPointerCancel:nt(t.onPointerCancel,K1(h)),onPointerUp:r?t.onPointerUp:nt(t.onPointerUp,K1(h))})]})});YX.displayName=XX;var tRe="ContextMenuPortal",KX=t=>{const{__scopeContextMenu:e,...n}=t,r=Gs(e);return o.jsx(BMe,{...r,...n})};KX.displayName=tRe;var ZX="ContextMenuContent",JX=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=WX(ZX,n),i=Gs(n),a=b.useRef(!1);return o.jsx(FMe,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{t.onCloseAutoFocus?.(l),!l.defaultPrevented&&a.current&&l.preventDefault(),a.current=!1},onInteractOutside:l=>{t.onInteractOutside?.(l),!l.defaultPrevented&&!s.modal&&(a.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});JX.displayName=ZX;var nRe="ContextMenuGroup",rRe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(qMe,{...s,...r,ref:e})});rRe.displayName=nRe;var sRe="ContextMenuLabel",eY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx($Me,{...s,...r,ref:e})});eY.displayName=sRe;var iRe="ContextMenuItem",tY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(HMe,{...s,...r,ref:e})});tY.displayName=iRe;var aRe="ContextMenuCheckboxItem",nY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(QMe,{...s,...r,ref:e})});nY.displayName=aRe;var oRe="ContextMenuRadioGroup",lRe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(VMe,{...s,...r,ref:e})});lRe.displayName=oRe;var cRe="ContextMenuRadioItem",rY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(UMe,{...s,...r,ref:e})});rY.displayName=cRe;var uRe="ContextMenuItemIndicator",sY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(WMe,{...s,...r,ref:e})});sY.displayName=uRe;var dRe="ContextMenuSeparator",iY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(GMe,{...s,...r,ref:e})});iY.displayName=dRe;var hRe="ContextMenuArrow",fRe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(XMe,{...s,...r,ref:e})});fRe.displayName=hRe;var aY="ContextMenuSub",oY=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,a=Gs(e),[l,c]=Xl({prop:s,defaultProp:i??!1,onChange:r,caller:aY});return o.jsx(YMe,{...a,open:l,onOpenChange:c,children:n})};oY.displayName=aY;var mRe="ContextMenuSubTrigger",lY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(KMe,{...s,...r,ref:e})});lY.displayName=mRe;var pRe="ContextMenuSubContent",cY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Gs(n);return o.jsx(ZMe,{...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)"}})});cY.displayName=pRe;function K1(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var gRe=GX,xRe=YX,vRe=KX,uY=JX,dY=eY,hY=tY,fY=nY,mY=rY,pY=sY,gY=iY,yRe=oY,xY=lY,vY=cY;const bRe=gRe,wRe=xRe,SRe=yRe,yY=b.forwardRef(({className:t,inset:e,children:n,...r},s)=>o.jsxs(xY,{ref:s,className:xe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,o.jsx(yd,{className:"ml-auto h-4 w-4"})]}));yY.displayName=xY.displayName;const bY=b.forwardRef(({className:t,...e},n)=>o.jsx(vY,{ref:n,className:xe("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}));bY.displayName=vY.displayName;const wY=b.forwardRef(({className:t,...e},n)=>o.jsx(vRe,{children:o.jsx(uY,{ref:n,className:xe("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})}));wY.displayName=uY.displayName;const qa=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(hY,{ref:r,className:xe("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}));qa.displayName=hY.displayName;const kRe=b.forwardRef(({className:t,children:e,checked:n,...r},s)=>o.jsxs(fY,{ref:s,className:xe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(pY,{children:o.jsx(Ro,{className:"h-4 w-4"})})}),e]}));kRe.displayName=fY.displayName;const ORe=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(mY,{ref:r,className:xe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(pY,{children:o.jsx(ute,{className:"h-2 w-2 fill-current"})})}),e]}));ORe.displayName=mY.displayName;const jRe=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(dY,{ref:r,className:xe("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));jRe.displayName=dY.displayName;const v0=b.forwardRef(({className:t,...e},n)=>o.jsx(gY,{ref:n,className:xe("-mx-1 my-1 h-px bg-border",t),...e}));v0.displayName=gY.displayName;const jh=({className:t,...e})=>o.jsx("span",{className:xe("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});jh.displayName="ContextMenuShortcut";var NRe=Symbol("radix.slottable");function CRe(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=NRe,e}var[sw]=Ra("Tooltip",[vf]),iw=vf(),SY="TooltipProvider",TRe=700,uj="tooltip.open",[ERe,O7]=sw(SY),kY=t=>{const{__scopeTooltip:e,delayDuration:n=TRe,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,a=b.useRef(!0),l=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),o.jsx(ERe,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:b.useCallback(d=>{l.current=d},[]),disableHoverableContent:s,children:i})};kY.displayName=SY;var Tp="Tooltip",[_Re,Ng]=sw(Tp),OY=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=t,c=O7(Tp,t.__scopeTooltip),d=iw(e),[h,m]=b.useState(null),g=Ui(),x=b.useRef(0),y=a??c.disableHoverableContent,w=l??c.delayDuration,S=b.useRef(!1),[k,j]=Xl({prop:r,defaultProp:s??!1,onChange:A=>{A?(c.onOpen(),document.dispatchEvent(new CustomEvent(uj))):c.onClose(),i?.(A)},caller:Tp}),N=b.useMemo(()=>k?S.current?"delayed-open":"instant-open":"closed",[k]),T=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,S.current=!1,j(!0)},[j]),E=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,j(!1)},[j]),_=b.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,j(!0),x.current=0},w)},[w,j]);return b.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),o.jsx(Vy,{...d,children:o.jsx(_Re,{scope:e,contentId:g,open:k,stateAttribute:N,trigger:h,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?_():T()},[c.isOpenDelayedRef,_,T]),onTriggerLeave:b.useCallback(()=>{y?E():(window.clearTimeout(x.current),x.current=0)},[E,y]),onOpen:T,onClose:E,disableHoverableContent:y,children:n})})};OY.displayName=Tp;var dj="TooltipTrigger",jY=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Ng(dj,n),i=O7(dj,n),a=iw(n),l=b.useRef(null),c=Yn(e,l,s.onTriggerChange),d=b.useRef(!1),h=b.useRef(!1),m=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(Uy,{asChild:!0,...a,children:o.jsx(xn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:nt(t.onPointerMove,g=>{g.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),h.current=!0)}),onPointerLeave:nt(t.onPointerLeave,()=>{s.onTriggerLeave(),h.current=!1}),onPointerDown:nt(t.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:nt(t.onFocus,()=>{d.current||s.onOpen()}),onBlur:nt(t.onBlur,s.onClose),onClick:nt(t.onClick,s.onClose)})})});jY.displayName=dj;var j7="TooltipPortal",[ARe,MRe]=sw(j7,{forceMount:void 0}),NY=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=Ng(j7,e);return o.jsx(ARe,{scope:e,forceMount:n,children:o.jsx(ii,{present:n||i.open,children:o.jsx(Qy,{asChild:!0,container:s,children:r})})})};NY.displayName=j7;var xf="TooltipContent",CY=b.forwardRef((t,e)=>{const n=MRe(xf,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=Ng(xf,t.__scopeTooltip);return o.jsx(ii,{present:r||a.open,children:a.disableHoverableContent?o.jsx(TY,{side:s,...i,ref:e}):o.jsx(RRe,{side:s,...i,ref:e})})}),RRe=b.forwardRef((t,e)=>{const n=Ng(xf,t.__scopeTooltip),r=O7(xf,t.__scopeTooltip),s=b.useRef(null),i=Yn(e,s),[a,l]=b.useState(null),{trigger:c,onClose:d}=n,h=s.current,{onPointerInTransitChange:m}=r,g=b.useCallback(()=>{l(null),m(!1)},[m]),x=b.useCallback((y,w)=>{const S=y.currentTarget,k={x:y.clientX,y:y.clientY},j=LRe(k,S.getBoundingClientRect()),N=BRe(k,j),T=FRe(w.getBoundingClientRect()),E=$Re([...N,...T]);l(E),m(!0)},[m]);return b.useEffect(()=>()=>g(),[g]),b.useEffect(()=>{if(c&&h){const y=S=>x(S,h),w=S=>x(S,c);return c.addEventListener("pointerleave",y),h.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",y),h.removeEventListener("pointerleave",w)}}},[c,h,x,g]),b.useEffect(()=>{if(a){const y=w=>{const S=w.target,k={x:w.clientX,y:w.clientY},j=c?.contains(S)||h?.contains(S),N=!qRe(k,a);j?g():N&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,h,a,d,g]),o.jsx(TY,{...t,ref:i})}),[DRe,PRe]=sw(Tp,{isInside:!1}),zRe=CRe("TooltipContent"),TY=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=t,c=Ng(xf,n),d=iw(n),{onClose:h}=c;return b.useEffect(()=>(document.addEventListener(uj,h),()=>document.removeEventListener(uj,h)),[h]),b.useEffect(()=>{if(c.trigger){const m=g=>{g.target?.contains(c.trigger)&&h()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,h]),o.jsx(Cj,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:h,children:o.jsxs(Tj,{"data-state":c.stateAttribute,...d,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(zRe,{children:r}),o.jsx(DRe,{scope:n,isInside:!0,children:o.jsx(Dee,{id:c.contentId,role:"tooltip",children:s||r})})]})})});CY.displayName=xf;var EY="TooltipArrow",IRe=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=iw(n);return PRe(EY,n).isInside?null:o.jsx(Ej,{...s,...r,ref:e})});IRe.displayName=EY;function LRe(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 BRe(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 FRe(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 qRe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-d)*(r-h)/(g-h)+d&&(s=!s)}return s}function $Re(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),HRe(e)}function HRe(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var QRe=kY,VRe=OY,URe=jY,WRe=NY,_Y=CY;const GRe=QRe,XRe=VRe,YRe=URe,AY=b.forwardRef(({className:t,sideOffset:e=4,...n},r)=>o.jsx(WRe,{children:o.jsx(_Y,{ref:r,sideOffset:e,className:xe("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})}));AY.displayName=_Y.displayName;function KRe({children:t}){uie();const[e,n]=b.useState(!0),[r,s]=b.useState(!1),[i,a]=b.useState(!1),{theme:l,setTheme:c}=Vj(),d=xJ(),h=Zi();b.useEffect(()=>{const w=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),a(!0))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[]);const m=[{title:"概览",items:[{icon:D0,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:zl,label:"麦麦主程序配置",path:"/config/bot"},{icon:kI,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:OI,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:k9,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:_j,label:"表情包管理",path:"/resource/emoji"},{icon:Wh,label:"表达方式管理",path:"/resource/expression"},{icon:jI,label:"人物信息管理",path:"/resource/person"},{icon:SI,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:Gh,label:"插件市场",path:"/plugins"},{icon:k9,label:"插件配置",path:"/plugin-config"},{icon:Pv,label:"日志查看器",path:"/logs"},{icon:Wh,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:Xu,label:"系统设置",path:"/settings"}]}],x=l==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":l,y=()=>{localStorage.removeItem("access-token"),h({to:"/auth"})};return o.jsx(GRe,{delayDuration:300,children:o.jsxs("div",{className:"flex h-screen overflow-hidden",children:[o.jsxs("aside",{className:xe("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[o.jsx("div",{className:"flex h-16 items-center border-b px-4",children:o.jsxs("div",{className:xe("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[o.jsxs("div",{className:xe("flex items-baseline gap-2",!e&&"lg:hidden"),children:[o.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),o.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:Fse()})]}),!e&&o.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),o.jsx(gn,{className:xe("flex-1 overflow-x-hidden",!e&&"lg:w-16"),children:o.jsx("nav",{className:xe("p-4",!e&&"lg:p-2 lg:w-16"),children:o.jsx("ul",{className:xe("space-y-6",!e&&"lg:space-y-3 lg:w-full"),children:m.map((w,S)=>o.jsxs("li",{children:[o.jsx("div",{className:xe("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:o.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:w.title})}),!e&&S>0&&o.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),o.jsx("ul",{className:"space-y-1",children:w.items.map(k=>{const j=d({to:k.path}),N=k.icon,T=o.jsxs(o.Fragment,{children:[j&&o.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),o.jsxs("div",{className:xe("flex items-center transition-all duration-300",e?"gap-3":"gap-3 lg:gap-0"),children:[o.jsx(N,{className:xe("h-5 w-5 flex-shrink-0",j&&"text-primary"),strokeWidth:2,fill:"none"}),o.jsx("span",{className:xe("text-sm font-medium whitespace-nowrap transition-all duration-300",j&&"font-semibold",e?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:k.label})]})]});return o.jsx("li",{className:"relative",children:o.jsxs(XRe,{children:[o.jsx(YRe,{asChild:!0,children:o.jsx(vJ,{to:k.path,"data-tour":k.tourId,className:xe("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",j?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>s(!1),children:T})}),!e&&o.jsx(AY,{side:"right",className:"hidden lg:block",children:o.jsx("p",{children:k.label})})]})},k.path)})})]},w.title))})})})]}),r&&o.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),o.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[o.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:o.jsx(dte,{className:"h-5 w-5"})}),o.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:o.jsx(vd,{className:xe("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{onClick:()=>a(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[o.jsx(Ni,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),o.jsxs(wX,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[o.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),o.jsx(rMe,{open:i,onOpenChange:a}),o.jsxs(de,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[o.jsx(hte,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),o.jsx("button",{onClick:w=>{jse(x==="dark"?"light":"dark",c,w)},className:"rounded-lg p-2 hover:bg-accent",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?o.jsx(nk,{className:"h-5 w-5"}):o.jsx(rk,{className:"h-5 w-5"})}),o.jsx("div",{className:"h-6 w-px bg-border"}),o.jsxs(de,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[o.jsx(O9,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),o.jsxs(bRe,{children:[o.jsx(wRe,{asChild:!0,children:o.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),o.jsxs(wY,{className:"w-64",children:[o.jsxs(qa,{onClick:()=>h({to:"/"}),children:[o.jsx(D0,{className:"mr-2 h-4 w-4"}),"首页"]}),o.jsxs(qa,{onClick:()=>h({to:"/settings"}),children:[o.jsx(Xu,{className:"mr-2 h-4 w-4"}),"系统设置"]}),o.jsxs(qa,{onClick:()=>h({to:"/logs"}),children:[o.jsx(Pv,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),o.jsx(v0,{}),o.jsxs(SRe,{children:[o.jsxs(yY,{children:[o.jsx(yI,{className:"mr-2 h-4 w-4"}),"切换主题"]}),o.jsxs(bY,{className:"w-48",children:[o.jsxs(qa,{onClick:()=>c("light"),disabled:l==="light",children:[o.jsx(nk,{className:"mr-2 h-4 w-4"}),"浅色",l==="light"&&o.jsx(jh,{children:"✓"})]}),o.jsxs(qa,{onClick:()=>c("dark"),disabled:l==="dark",children:[o.jsx(rk,{className:"mr-2 h-4 w-4"}),"深色",l==="dark"&&o.jsx(jh,{children:"✓"})]}),o.jsxs(qa,{onClick:()=>c("system"),disabled:l==="system",children:[o.jsx(Xu,{className:"mr-2 h-4 w-4"}),"跟随系统",l==="system"&&o.jsx(jh,{children:"✓"})]})]})]}),o.jsx(v0,{}),o.jsxs(qa,{onClick:()=>window.location.reload(),children:[o.jsx(fte,{className:"mr-2 h-4 w-4"}),"刷新页面",o.jsx(jh,{children:"⌘R"})]}),o.jsxs(qa,{onClick:()=>a(!0),children:[o.jsx(Ni,{className:"mr-2 h-4 w-4"}),"搜索",o.jsx(jh,{children:"⌘K"})]}),o.jsx(v0,{}),o.jsxs(qa,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[o.jsx(Ah,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),o.jsx(v0,{}),o.jsxs(qa,{onClick:y,className:"text-destructive focus:text-destructive",children:[o.jsx(O9,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}var aw="Collapsible",[ZRe]=Ra(aw),[JRe,N7]=ZRe(aw),MY=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:a,...l}=t,[c,d]=Xl({prop:r,defaultProp:s??!1,onChange:a,caller:aw});return o.jsx(JRe,{scope:n,disabled:i,contentId:Ui(),open:c,onOpenToggle:b.useCallback(()=>d(h=>!h),[d]),children:o.jsx(xn.div,{"data-state":T7(c),"data-disabled":i?"":void 0,...l,ref:e})})});MY.displayName=aw;var RY="CollapsibleTrigger",DY=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=N7(RY,n);return o.jsx(xn.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":T7(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:nt(t.onClick,s.onOpenToggle)})});DY.displayName=RY;var C7="CollapsibleContent",PY=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=N7(C7,t.__scopeCollapsible);return o.jsx(ii,{present:n||s.open,children:({present:i})=>o.jsx(eDe,{...r,ref:e,present:i})})});PY.displayName=C7;var eDe=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=t,a=N7(C7,n),[l,c]=b.useState(r),d=b.useRef(null),h=Yn(e,d),m=b.useRef(0),g=m.current,x=b.useRef(0),y=x.current,w=a.open||l,S=b.useRef(w),k=b.useRef(void 0);return b.useEffect(()=>{const j=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(j)},[]),Uh(()=>{const j=d.current;if(j){k.current=k.current||{transitionDuration:j.style.transitionDuration,animationName:j.style.animationName},j.style.transitionDuration="0s",j.style.animationName="none";const N=j.getBoundingClientRect();m.current=N.height,x.current=N.width,S.current||(j.style.transitionDuration=k.current.transitionDuration,j.style.animationName=k.current.animationName),c(r)}},[a.open,r]),o.jsx(xn.div,{"data-state":T7(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!w,...i,ref:h,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...t.style},children:w&&s})});function T7(t){return t?"open":"closed"}var tDe=MY;const Pz=tDe,zz=DY,Iz=PY;function nDe(t){const e=t.split(` -`).slice(1),n=[];for(const r of e){const s=r.trim();if(!s.startsWith("at "))continue;const i=s.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);i?n.push({functionName:i[1]||"",fileName:i[2],lineNumber:i[3],columnNumber:i[4],raw:s}):n.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:s})}return n}function rDe({error:t,errorInfo:e}){const[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),c=t.stack?nDe(t.stack):[],d=async()=>{const h=` + color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return(d=n?.onChange)==null||d.call(n,s),s}return i.updateDeps=a=>{r=a},i}function yz(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const MTe=(t,e)=>Math.abs(t-e)<1.01,RTe=(t,e,n)=>{let r;return function(...s){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,s),n)}},bz=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},DTe=t=>t,PTe=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let s=e;s<=n;s++)r.push(s);return r},zTe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const s=a=>{const{width:l,height:c}=a;e({width:Math.round(l),height:Math.round(c)})};if(s(bz(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c?.borderBoxSize){const d=c.borderBoxSize[0];if(d){s({width:d.inlineSize,height:d.blockSize});return}}s(bz(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},wz={passive:!0},Sz=typeof window>"u"?!0:"onscrollend"in window,ITe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let s=0;const i=t.options.useScrollendEvent&&Sz?()=>{}:RTe(r,()=>{e(s,!1)},t.options.isScrollingResetDelay),a=h=>()=>{const{horizontal:m,isRtl:g}=t.options;s=m?n.scrollLeft*(g&&-1||1):n.scrollTop,i(),e(s,h)},l=a(!0),c=a(!1);c(),n.addEventListener("scroll",l,wz);const d=t.options.useScrollendEvent&&Sz;return d&&n.addEventListener("scrollend",c,wz),()=>{n.removeEventListener("scroll",l),d&&n.removeEventListener("scrollend",c)}},LTe=(t,e,n)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},BTe=(t,{adjustments:e=0,behavior:n},r)=>{var s,i;const a=t+e;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class FTe{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const a=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:DTe,rangeExtractor:PTe,onChange:()=>{},measureElement:LTe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=gh(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,i=new Map;for(let a=r-1;a>=0;a--){const l=n[a];if(s.has(l.lane))continue;const c=i.get(l.lane);if(c==null||l.end>c.end?i.set(l.lane,l):l.enda.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=gh(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,s,i,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a}),{key:!1}),this.getMeasurements=gh(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a},l)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const d=this.measurementsCache.slice(0,c);for(let h=c;hthis.options.debug}),this.calculateRange=gh(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?qTe({measurements:n,outerSize:r,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=gh(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,i,a)=>i===null||a===null?[]:n({startIndex:i,endIndex:a,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const s=this.indexFromElement(n),i=this.measurementsCache[s];if(!i)return;const a=i.key,l=this.elementsCache.get(a);l!==n&&(l&&this.observer.unobserve(l),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(s,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const s=this.measurementsCache[n];if(!s)return;const i=this.itemSizeCache.get(s.key)??s.size,a=r-i;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start{if(!n){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(n,void 0)},this.getVirtualItems=gh(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,a=n.length;ithis.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return yz(r[FG(0,r.length-1,s=>yz(r[s]).start,n)])},this.getOffsetForAlignment=(n,r,s=0)=>{const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const l=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.measurementsCache[n];if(!s)return;const i=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(s.end>=a+i-this.options.scrollPaddingEnd)r="end";else if(s.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const l=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(n,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1));let i=0;const a=10,l=d=>{if(!this.targetWindow)return;const h=this.getOffsetForIndex(n,d);if(!h){console.warn("Failed to get offset for index:",n);return}const[m,g]=h;this._scrollToOffset(m,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const x=this.getScrollOffset(),y=this.getOffsetForIndex(n,g);if(!y){console.warn("Failed to get offset for index:",n);return}MTe(y[0],x)||c(g)})},c=d=>{this.targetWindow&&(i++,il(d)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};l(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((n=r[r.length-1])==null?void 0:n.end)??0;else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(l=>l===null);){const l=r[a];i[l.lane]===null&&(i[l.lane]=l.end),a--}s=Math.max(...i.filter(l=>l!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const FG=(t,e,n,r)=>{for(;t<=e;){const s=(t+e)/2|0,i=n(s);if(ir)e=s-1;else return s}return t>0?t-1:0};function qTe({measurements:t,outerSize:e,scrollOffset:n,lanes:r}){const s=t.length-1,i=c=>t[c].start;if(t.length<=r)return{startIndex:0,endIndex:s};let a=FG(0,s,i,n),l=a;if(r===1)for(;l1){const c=Array(r).fill(0);for(;lh=0&&d.some(h=>h>=n);){const h=t[a];d[h.lane]=h.start,a--}a=Math.max(0,a-a%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:a,endIndex:l}}const kz=typeof document<"u"?b.useLayoutEffect:b.useEffect;function $Te(t){const e=b.useReducer(()=>({}),{})[1],n={...t,onChange:(s,i)=>{var a;i?ya.flushSync(e):e(),(a=t.onChange)==null||a.call(t,s,i)}},[r]=b.useState(()=>new FTe(n));return r.setOptions(n),kz(()=>r._didMount(),[]),kz(()=>r._willUpdate()),r}function HTe(t){return $Te({observeElementRect:zTe,observeElementOffset:ITe,scrollToFn:BTe,...t})}function QTe(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 VTe={},x0={};function Ku(t,e){try{const r=(VTe[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in x0?x0[r]:Oz(r,r.split(":"))}catch{if(t in x0)return x0[t];const n=t?.match(UTe);return n?Oz(t,n.slice(1)):NaN}}const UTe=/([+-]\d\d):?(\d\d)?/;function Oz(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return x0[t]=n*60+r>0?n*60+r+s:n*60-r-s}class Do extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Ku(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)),qG(this),dj(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new Do(...n,e):new Do(Date.now(),e)}withTimeZone(e){return new Do(+this,e)}getTimezoneOffset(){const e=-Ku(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),dj(this),+this}[Symbol.for("constructDateFrom")](e){return new Do(+new Date(e),this.timeZone)}}const jz=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!jz.test(t))return;const e=t.replace(jz,"$1UTC");Do.prototype[e]&&(t.startsWith("get")?Do.prototype[t]=function(){return this.internal[e]()}:(Do.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),WTe(this),+this},Do.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),dj(this),+this}))});function dj(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Ku(t.timeZone,t)*60))}function WTe(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()),qG(t)}function qG(t){const e=Ku(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),a=s-i,l=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();a&&l&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+a);const c=s-n;c&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+c);const d=new Date(+t);d.setUTCSeconds(0);const h=s>0?d.getSeconds():(d.getSeconds()-60)%60,m=Math.round(-(Ku(t.timeZone,t)*60))%60;(m||h)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+m+h));const g=Ku(t.timeZone,t),x=g>0?Math.floor(g):Math.ceil(g),w=-new Date(+t).getTimezoneOffset()-x,S=x!==n,k=w-c;if(S&&k){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+k);const j=Ku(t.timeZone,t),N=j>0?Math.floor(j):Math.ceil(j),T=x-N;T&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+T),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+T))}}class Bs extends Do{static tz(e,...n){return n.length?new Bs(...n,e):new Bs(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} (${QTe(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 Bs(+this,e)}[Symbol.for("constructDateFrom")](e){return new Bs(+new Date(e),this.timeZone)}}const $G=6048e5,GTe=864e5,Nz=Symbol.for("constructDateFrom");function as(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Nz in t?t[Nz](e):t instanceof Date?new t.constructor(e):new Date(e)}function ir(t,e){return as(e||t,t)}function HG(t,e,n){const r=ir(t,n?.in);return isNaN(e)?as(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function QG(t,e,n){const r=ir(t,n?.in);if(isNaN(e))return as(t,NaN);if(!e)return r;const s=r.getDate(),i=as(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const a=i.getDate();return s>=a?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let XTe={};function Og(){return XTe}function ou(t,e){const n=Og(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=ir(t,e?.in),i=s.getDay(),a=(i=i.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function Cz(t){const e=ir(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 Nd(t,...e){const n=as.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function Ep(t,e){const n=ir(t,e?.in);return n.setHours(0,0,0,0),n}function UG(t,e,n){const[r,s]=Nd(n?.in,t,e),i=Ep(r),a=Ep(s),l=+i-Cz(i),c=+a-Cz(a);return Math.round((l-c)/GTe)}function YTe(t,e){const n=VG(t,e),r=as(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Tp(r)}function KTe(t,e,n){return HG(t,e*7,n)}function ZTe(t,e,n){return QG(t,e*12,n)}function JTe(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=as.bind(null,s));const i=ir(s,r);(!n||n{!r&&typeof s=="object"&&(r=as.bind(null,s));const i=ir(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),as(r,n||NaN)}function t9e(t,e,n){const[r,s]=Nd(n?.in,t,e);return+Ep(r)==+Ep(s)}function WG(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function n9e(t){return!(!WG(t)&&typeof t!="number"||isNaN(+ir(t)))}function r9e(t,e,n){const[r,s]=Nd(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),a=r.getMonth()-s.getMonth();return i*12+a}function s9e(t,e){const n=ir(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function GG(t,e){const[n,r]=Nd(t,e.start,e.end);return{start:n,end:r}}function i9e(t,e){const{start:n,end:r}=GG(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setDate(1);let l=1;const c=[];for(;+a<=i;)c.push(as(n,a)),a.setMonth(a.getMonth()+l);return s?c.reverse():c}function a9e(t,e){const n=ir(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function o9e(t,e){const n=ir(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function XG(t,e){const n=ir(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function l9e(t,e){const{start:n,end:r}=GG(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setMonth(0,1);let l=1;const c=[];for(;+a<=i;)c.push(as(n,a)),a.setFullYear(a.getFullYear()+l);return s?c.reverse():c}function YG(t,e){const n=Og(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=ir(t,e?.in),i=s.getDay(),a=(i{let r;const s=u9e[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Uh(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const h9e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},f9e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},m9e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},p9e={date:Uh({formats:h9e,defaultWidth:"full"}),time:Uh({formats:f9e,defaultWidth:"full"}),dateTime:Uh({formats:m9e,defaultWidth:"full"})},g9e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},x9e=(t,e,n,r)=>g9e[t];function jo(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,l=n?.width?String(n.width):a;s=t.formattingValues[l]||t.formattingValues[a]}else{const a=t.defaultWidth,l=n?.width?String(n.width):t.defaultWidth;s=t.values[l]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const v9e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},y9e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},b9e={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"]},w9e={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"]},S9e={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"}},k9e={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"}},O9e=(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"},j9e={ordinalNumber:O9e,era:jo({values:v9e,defaultWidth:"wide"}),quarter:jo({values:y9e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:jo({values:b9e,defaultWidth:"wide"}),day:jo({values:w9e,defaultWidth:"wide"}),dayPeriod:jo({values:S9e,defaultWidth:"wide",formattingValues:k9e,defaultFormattingWidth:"wide"})};function No(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const a=i[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?C9e(l,m=>m.test(a)):N9e(l,m=>m.test(a));let d;d=t.valueCallback?t.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const h=e.slice(a.length);return{value:d,rest:h}}}function N9e(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function C9e(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let a=t.valueCallback?t.valueCallback(i[0]):i[0];a=n.valueCallback?n.valueCallback(a):a;const l=e.slice(s.length);return{value:a,rest:l}}}const T9e=/^(\d+)(th|st|nd|rd)?/i,E9e=/\d+/i,_9e={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},A9e={any:[/^b/i,/^(a|c)/i]},M9e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},R9e={any:[/1/i,/2/i,/3/i,/4/i]},D9e={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},P9e={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]},z9e={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},I9e={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]},L9e={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},B9e={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}},F9e={ordinalNumber:KG({matchPattern:T9e,parsePattern:E9e,valueCallback:t=>parseInt(t,10)}),era:No({matchPatterns:_9e,defaultMatchWidth:"wide",parsePatterns:A9e,defaultParseWidth:"any"}),quarter:No({matchPatterns:M9e,defaultMatchWidth:"wide",parsePatterns:R9e,defaultParseWidth:"any",valueCallback:t=>t+1}),month:No({matchPatterns:D9e,defaultMatchWidth:"wide",parsePatterns:P9e,defaultParseWidth:"any"}),day:No({matchPatterns:z9e,defaultMatchWidth:"wide",parsePatterns:I9e,defaultParseWidth:"any"}),dayPeriod:No({matchPatterns:L9e,defaultMatchWidth:"any",parsePatterns:B9e,defaultParseWidth:"any"})},p7={code:"en-US",formatDistance:d9e,formatLong:p9e,formatRelative:x9e,localize:j9e,match:F9e,options:{weekStartsOn:0,firstWeekContainsDate:1}};function q9e(t,e){const n=ir(t,e?.in);return UG(n,XG(n))+1}function ZG(t,e){const n=ir(t,e?.in),r=+Tp(n)-+YTe(n);return Math.round(r/$G)+1}function JG(t,e){const n=ir(t,e?.in),r=n.getFullYear(),s=Og(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=as(e?.in||t,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const l=ou(a,e),c=as(e?.in||t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const d=ou(c,e);return+n>=+l?r+1:+n>=+d?r:r-1}function $9e(t,e){const n=Og(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=JG(t,e),i=as(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),ou(i,e)}function eX(t,e){const n=ir(t,e?.in),r=+ou(n,e)-+$9e(n,e);return Math.round(r/$G)+1}function Jn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Rc={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Jn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Jn(n+1,2)},d(t,e){return Jn(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 Jn(t.getHours()%12||12,e.length)},H(t,e){return Jn(t.getHours(),e.length)},m(t,e){return Jn(t.getMinutes(),e.length)},s(t,e){return Jn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Jn(s,e.length)}},xh={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Tz={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 Rc.y(t,e)},Y:function(t,e,n,r){const s=JG(t,r),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return Jn(a,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Jn(i,e.length)},R:function(t,e){const n=VG(t);return Jn(n,e.length)},u:function(t,e){const n=t.getFullYear();return Jn(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 Jn(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 Jn(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 Rc.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 Jn(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=eX(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):Jn(s,e.length)},I:function(t,e,n){const r=ZG(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Jn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Rc.d(t,e)},D:function(t,e,n){const r=q9e(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Jn(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 Jn(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 Jn(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 Jn(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=xh.noon:r===0?s=xh.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=xh.evening:r>=12?s=xh.afternoon:r>=4?s=xh.morning:s=xh.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 Rc.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Rc.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Jn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Jn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Rc.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Rc.s(t,e)},S:function(t,e){return Rc.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return _z(r);case"XXXX":case"XX":return $u(r);case"XXXXX":case"XXX":default:return $u(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return _z(r);case"xxxx":case"xx":return $u(r);case"xxxxx":case"xxx":default:return $u(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ez(r,":");case"OOOO":default:return"GMT"+$u(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ez(r,":");case"zzzz":default:return"GMT"+$u(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Jn(r,e.length)},T:function(t,e,n){return Jn(+t,e.length)}};function Ez(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+Jn(i,2)}function _z(t,e){return t%60===0?(t>0?"-":"+")+Jn(Math.abs(t)/60,2):$u(t,e)}function $u(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Jn(Math.trunc(r/60),2),i=Jn(r%60,2);return n+s+e+i}const Az=(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"})}},tX=(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"})}},H9e=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return Az(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}}",Az(r,e)).replace("{{time}}",tX(s,e))},Q9e={p:tX,P:H9e},V9e=/^D+$/,U9e=/^Y+$/,W9e=["D","DD","YY","YYYY"];function G9e(t){return V9e.test(t)}function X9e(t){return U9e.test(t)}function Y9e(t,e,n){const r=K9e(t,e,n);if(console.warn(r),W9e.includes(t))throw new RangeError(r)}function K9e(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 Z9e=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,J9e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,eEe=/^'([^]*?)'?$/,tEe=/''/g,nEe=/[a-zA-Z]/;function Dv(t,e,n){const r=Og(),s=n?.locale??r.locale??p7,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,l=ir(t,n?.in);if(!n9e(l))throw new RangeError("Invalid time value");let c=e.match(J9e).map(h=>{const m=h[0];if(m==="p"||m==="P"){const g=Q9e[m];return g(h,s.formatLong)}return h}).join("").match(Z9e).map(h=>{if(h==="''")return{isToken:!1,value:"'"};const m=h[0];if(m==="'")return{isToken:!1,value:rEe(h)};if(Tz[m])return{isToken:!0,value:h};if(m.match(nEe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:h}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return c.map(h=>{if(!h.isToken)return h.value;const m=h.value;(!n?.useAdditionalWeekYearTokens&&X9e(m)||!n?.useAdditionalDayOfYearTokens&&G9e(m))&&Y9e(m,e,String(t));const g=Tz[m[0]];return g(l,m,s.localize,d)}).join("")}function rEe(t){const e=t.match(eEe);return e?e[1].replace(tEe,"'"):t}function sEe(t,e){const n=ir(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=as(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function iEe(t,e){return ir(t,e?.in).getMonth()}function aEe(t,e){return ir(t,e?.in).getFullYear()}function oEe(t,e){return+ir(t)>+ir(e)}function lEe(t,e){return+ir(t)<+ir(e)}function cEe(t,e,n){const[r,s]=Nd(n?.in,t,e);return+ou(r,n)==+ou(s,n)}function uEe(t,e,n){const[r,s]=Nd(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function dEe(t,e,n){const[r,s]=Nd(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function hEe(t,e,n){const r=ir(t,n?.in),s=r.getFullYear(),i=r.getDate(),a=as(t,0);a.setFullYear(s,e,15),a.setHours(0,0,0,0);const l=sEe(a);return r.setMonth(e,Math.min(i,l)),r}function fEe(t,e,n){const r=ir(t,n?.in);return isNaN(+r)?as(t,NaN):(r.setFullYear(e),r)}const Mz=5,mEe=4;function pEe(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,Mz*7-1);return e.getMonth(t)===e.getMonth(i)?Mz:mEe}function nX(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 gEe(t,e){const n=nX(t,e),r=pEe(t,e);return e.addDays(n,r*7-1)}class ta{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Bs.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 Bs(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):HG(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):QG(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):KTe(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):ZTe(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):UG(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):r9e(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):i9e(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):l9e(r),i=new Set(s.map(l=>this.getYear(l)));if(i.size===s.length)return s;const a=[];return i.forEach(l=>{a.push(new Date(l,0,1))}),a},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):gEe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):c9e(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):s9e(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):YG(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):o9e(r),this.format=(r,s,i)=>{const a=this.overrides?.format?this.overrides.format(r,s,this.options):Dv(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(a):a},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):ZG(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):iEe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):aEe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):eX(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):oEe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):lEe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):WG(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):t9e(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):uEe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):dEe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):JTe(r),this.min=r=>this.overrides?.min?this.overrides.min(r):e9e(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):hEe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):fEe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):nX(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Ep(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Tp(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):a9e(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):ou(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):XG(r),this.options={locale:p7,...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&&ta.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&ta.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const a=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,a)}}ta.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 Zo=new ta;class rX{constructor(e,n,r=Zo){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 xEe{constructor(e,n){this.date=e,this.weeks=n}}class vEe{constructor(e,n){this.days=n,this.weekNumber=e}}function yEe(t){return oe.createElement("button",{...t})}function bEe(t){return oe.createElement("span",{...t})}function wEe(t){const{size:e=24,orientation:n="left",className:r}=t;return oe.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&oe.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&oe.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&oe.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&oe.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function SEe(t){const{day:e,modifiers:n,...r}=t;return oe.createElement("td",{...r})}function kEe(t){const{day:e,modifiers:n,...r}=t,s=oe.useRef(null);return oe.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),oe.createElement("button",{ref:s,...r})}var Nt;(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"})(Nt||(Nt={}));var zr;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(zr||(zr={}));var Wa;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Wa||(Wa={}));var Vi;(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"})(Vi||(Vi={}));function OEe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,a=[s[Nt.Dropdown],n].join(" "),l=e?.find(({value:c})=>c===i.value);return oe.createElement("span",{"data-disabled":i.disabled,className:s[Nt.DropdownRoot]},oe.createElement(r.Select,{className:a,...i},e?.map(({value:c,label:d,disabled:h})=>oe.createElement(r.Option,{key:c,value:c,disabled:h},d))),oe.createElement("span",{className:s[Nt.CaptionLabel],"aria-hidden":!0},l?.label,oe.createElement(r.Chevron,{orientation:"down",size:18,className:s[Nt.Chevron]})))}function jEe(t){return oe.createElement("div",{...t})}function NEe(t){return oe.createElement("div",{...t})}function CEe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return oe.createElement("div",{...r},t.children)}function TEe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return oe.createElement("div",{...r})}function EEe(t){return oe.createElement("table",{...t})}function _Ee(t){return oe.createElement("div",{...t})}const sX=b.createContext(void 0);function jg(){const t=b.useContext(sX);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function AEe(t){const{components:e}=jg();return oe.createElement(e.Dropdown,{...t})}function MEe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:a,classNames:l,labels:{labelPrevious:c,labelNext:d}}=jg(),h=b.useCallback(g=>{s&&n?.(g)},[s,n]),m=b.useCallback(g=>{r&&e?.(g)},[r,e]);return oe.createElement("nav",{...i},oe.createElement(a.PreviousMonthButton,{type:"button",className:l[Nt.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:m},oe.createElement(a.Chevron,{disabled:r?void 0:!0,className:l[Nt.Chevron],orientation:"left"})),oe.createElement(a.NextMonthButton,{type:"button",className:l[Nt.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":d(s),onClick:h},oe.createElement(a.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[Nt.Chevron]})))}function REe(t){const{components:e}=jg();return oe.createElement(e.Button,{...t})}function DEe(t){return oe.createElement("option",{...t})}function PEe(t){const{components:e}=jg();return oe.createElement(e.Button,{...t})}function zEe(t){const{rootRef:e,...n}=t;return oe.createElement("div",{...n,ref:e})}function IEe(t){return oe.createElement("select",{...t})}function LEe(t){const{week:e,...n}=t;return oe.createElement("tr",{...n})}function BEe(t){return oe.createElement("th",{...t})}function FEe(t){return oe.createElement("thead",{"aria-hidden":!0},oe.createElement("tr",{...t}))}function qEe(t){const{week:e,...n}=t;return oe.createElement("th",{...n})}function $Ee(t){return oe.createElement("th",{...t})}function HEe(t){return oe.createElement("tbody",{...t})}function QEe(t){const{components:e}=jg();return oe.createElement(e.Dropdown,{...t})}const VEe=Object.freeze(Object.defineProperty({__proto__:null,Button:yEe,CaptionLabel:bEe,Chevron:wEe,Day:SEe,DayButton:kEe,Dropdown:OEe,DropdownNav:jEe,Footer:NEe,Month:CEe,MonthCaption:TEe,MonthGrid:EEe,Months:_Ee,MonthsDropdown:AEe,Nav:MEe,NextMonthButton:REe,Option:DEe,PreviousMonthButton:PEe,Root:zEe,Select:IEe,Week:LEe,WeekNumber:qEe,WeekNumberHeader:$Ee,Weekday:BEe,Weekdays:FEe,Weeks:HEe,YearsDropdown:QEe},Symbol.toStringTag,{value:"Module"}));function Il(t,e,n=!1,r=Zo){let{from:s,to:i}=t;const{differenceInCalendarDays:a,isSameDay:l}=r;return s&&i?(a(i,s)<0&&([s,i]=[i,s]),a(e,s)>=(n?1:0)&&a(i,e)>=(n?1:0)):!n&&i?l(i,e):!n&&s?l(s,e):!1}function iX(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function g7(t){return!!(t&&typeof t=="object"&&"from"in t)}function aX(t){return!!(t&&typeof t=="object"&&"after"in t)}function oX(t){return!!(t&&typeof t=="object"&&"before"in t)}function lX(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function cX(t,e){return Array.isArray(t)&&t.every(e.isDate)}function Ll(t,e,n=Zo){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:a}=n;return r.some(l=>{if(typeof l=="boolean")return l;if(n.isDate(l))return s(t,l);if(cX(l,n))return l.includes(t);if(g7(l))return Il(l,t,!1,n);if(lX(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(t.getDay()):l.dayOfWeek===t.getDay();if(iX(l)){const c=i(l.before,t),d=i(l.after,t),h=c>0,m=d<0;return a(l.before,l.after)?m&&h:h||m}return aX(l)?i(t,l.after)>0:oX(l)?i(l.before,t)>0:typeof l=="function"?l(t):!1})}function UEe(t,e,n,r,s){const{disabled:i,hidden:a,modifiers:l,showOutsideDays:c,broadcastCalendar:d,today:h}=e,{isSameDay:m,isSameMonth:g,startOfMonth:x,isBefore:y,endOfMonth:w,isAfter:S}=s,k=n&&x(n),j=r&&w(r),N={[zr.focused]:[],[zr.outside]:[],[zr.disabled]:[],[zr.hidden]:[],[zr.today]:[]},T={};for(const E of t){const{date:_,displayMonth:A}=E,D=!!(A&&!g(_,A)),q=!!(k&&y(_,k)),B=!!(j&&S(_,j)),H=!!(i&&Ll(_,i,s)),W=!!(a&&Ll(_,a,s))||q||B||!d&&!c&&D||d&&c===!1&&D,ee=m(_,h??s.today());D&&N.outside.push(E),H&&N.disabled.push(E),W&&N.hidden.push(E),ee&&N.today.push(E),l&&Object.keys(l).forEach(I=>{const V=l?.[I];V&&Ll(_,V,s)&&(T[I]?T[I].push(E):T[I]=[E])})}return E=>{const _={[zr.focused]:!1,[zr.disabled]:!1,[zr.hidden]:!1,[zr.outside]:!1,[zr.today]:!1},A={};for(const D in N){const q=N[D];_[D]=q.some(B=>B===E)}for(const D in T)A[D]=T[D].some(q=>q===E);return{..._,...A}}}function WEe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[zr[i]]?s.push(e[zr[i]]):e[Wa[i]]&&s.push(e[Wa[i]]),s),[e[Nt.Day]])}function GEe(t){return{...VEe,...t}}function XEe(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 x7(){const t={};for(const e in Nt)t[Nt[e]]=`rdp-${Nt[e]}`;for(const e in zr)t[zr[e]]=`rdp-${zr[e]}`;for(const e in Wa)t[Wa[e]]=`rdp-${Wa[e]}`;for(const e in Vi)t[Vi[e]]=`rdp-${Vi[e]}`;return t}function uX(t,e,n){return(n??new ta(e)).formatMonthYear(t)}const YEe=uX;function KEe(t,e,n){return(n??new ta(e)).format(t,"d")}function ZEe(t,e=Zo){return e.format(t,"LLLL")}function JEe(t,e,n){return(n??new ta(e)).format(t,"cccccc")}function e_e(t,e=Zo){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function t_e(){return""}function dX(t,e=Zo){return e.format(t,"yyyy")}const n_e=dX,r_e=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:uX,formatDay:KEe,formatMonthCaption:YEe,formatMonthDropdown:ZEe,formatWeekNumber:e_e,formatWeekNumberHeader:t_e,formatWeekdayName:JEe,formatYearCaption:n_e,formatYearDropdown:dX},Symbol.toStringTag,{value:"Module"}));function s_e(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...r_e,...t}}function i_e(t,e,n,r,s){const{startOfMonth:i,startOfYear:a,endOfYear:l,eachMonthOfInterval:c,getMonth:d}=s;return c({start:a(t),end:l(t)}).map(g=>{const x=r.formatMonthDropdown(g,s),y=d(g),w=e&&gi(n)||!1;return{value:y,label:x,disabled:w}})}function a_e(t,e={},n={}){let r={...e?.[Nt.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function o_e(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let a=0;a<7;a++){const l=t.addDays(s,a);i.push(l)}return i}function l_e(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:a,eachYearOfInterval:l,getYear:c}=r,d=i(t),h=a(e),m=l({start:d,end:h});return s&&m.reverse(),m.map(g=>{const x=n.formatYearDropdown(g,r);return{value:c(g),label:x,disabled:!1}})}function hX(t,e,n,r){let s=(r??new ta(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const c_e=hX;function fX(t,e,n){return(n??new ta(e)).formatMonthYear(t)}const u_e=fX;function d_e(t,e,n,r){let s=(r??new ta(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function h_e(t){return"Choose the Month"}function f_e(){return""}function m_e(t){return"Go to the Next Month"}function p_e(t){return"Go to the Previous Month"}function g_e(t,e,n){return(n??new ta(e)).format(t,"cccc")}function x_e(t,e){return`Week ${t}`}function v_e(t){return"Week Number"}function y_e(t){return"Choose the Year"}const b_e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:u_e,labelDay:c_e,labelDayButton:hX,labelGrid:fX,labelGridcell:d_e,labelMonthDropdown:h_e,labelNav:f_e,labelNext:m_e,labelPrevious:p_e,labelWeekNumber:x_e,labelWeekNumberHeader:v_e,labelWeekday:g_e,labelYearDropdown:y_e},Symbol.toStringTag,{value:"Module"})),Ng=t=>t instanceof HTMLElement?t:null,ek=t=>[...t.querySelectorAll("[data-animated-month]")??[]],w_e=t=>Ng(t.querySelector("[data-animated-month]")),tk=t=>Ng(t.querySelector("[data-animated-caption]")),nk=t=>Ng(t.querySelector("[data-animated-weeks]")),S_e=t=>Ng(t.querySelector("[data-animated-nav]")),k_e=t=>Ng(t.querySelector("[data-animated-weekdays]"));function O_e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const a=b.useRef(null),l=b.useRef(r),c=b.useRef(!1);b.useLayoutEffect(()=>{const d=l.current;if(l.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||d.length===0||r.length!==d.length)return;const h=i.isSameMonth(r[0].date,d[0].date),m=i.isAfter(r[0].date,d[0].date),g=m?n[Vi.caption_after_enter]:n[Vi.caption_before_enter],x=m?n[Vi.weeks_after_enter]:n[Vi.weeks_before_enter],y=a.current,w=t.current.cloneNode(!0);if(w instanceof HTMLElement?(ek(w).forEach(N=>{if(!(N instanceof HTMLElement))return;const T=w_e(N);T&&N.contains(T)&&N.removeChild(T);const E=tk(N);E&&E.classList.remove(g);const _=nk(N);_&&_.classList.remove(x)}),a.current=w):a.current=null,c.current||h||s)return;const S=y instanceof HTMLElement?ek(y):[],k=ek(t.current);if(k?.every(j=>j instanceof HTMLElement)&&S&&S.every(j=>j instanceof HTMLElement)){c.current=!0,t.current.style.isolation="isolate";const j=S_e(t.current);j&&(j.style.zIndex="1"),k.forEach((N,T)=>{const E=S[T];if(!E)return;N.style.position="relative",N.style.overflow="hidden";const _=tk(N);_&&_.classList.add(g);const A=nk(N);A&&A.classList.add(x);const D=()=>{c.current=!1,t.current&&(t.current.style.isolation=""),j&&(j.style.zIndex=""),_&&_.classList.remove(g),A&&A.classList.remove(x),N.style.position="",N.style.overflow="",N.contains(E)&&N.removeChild(E)};E.style.pointerEvents="none",E.style.position="absolute",E.style.overflow="hidden",E.setAttribute("aria-hidden","true");const q=k_e(E);q&&(q.style.opacity="0");const B=tk(E);B&&(B.classList.add(m?n[Vi.caption_before_exit]:n[Vi.caption_after_exit]),B.addEventListener("animationend",D));const H=nk(E);H&&H.classList.add(m?n[Vi.weeks_before_exit]:n[Vi.weeks_after_exit]),N.insertBefore(E,N.firstChild)})}})}function j_e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:a,fixedWeeks:l,broadcastCalendar:c}=n??{},{addDays:d,differenceInCalendarDays:h,differenceInCalendarMonths:m,endOfBroadcastWeek:g,endOfISOWeek:x,endOfMonth:y,endOfWeek:w,isAfter:S,startOfBroadcastWeek:k,startOfISOWeek:j,startOfWeek:N}=r,T=c?k(s,r):a?j(s):N(s),E=c?g(i):a?x(y(i)):w(y(i)),_=h(E,T),A=m(i,s)+1,D=[];for(let H=0;H<=_;H++){const W=d(T,H);if(e&&S(W,e))break;D.push(W)}const B=(c?35:42)*A;if(l&&D.length{const s=r.weeks.reduce((i,a)=>i.concat(a.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function C_e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let a=0;ae)break;i.push(l)}return i}function Rz(t,e,n,r){const{month:s,defaultMonth:i,today:a=r.today(),numberOfMonths:l=1}=t;let c=s||i||a;const{differenceInCalendarMonths:d,addMonths:h,startOfMonth:m}=r;if(n&&d(n,c){const k=n.broadcastCalendar?m(S,r):n.ISOWeek?g(S):x(S),j=n.broadcastCalendar?i(S):n.ISOWeek?a(l(S)):c(l(S)),N=e.filter(A=>A>=k&&A<=j),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&N.length{const q=T-N.length;return D>j&&D<=s(j,q)});N.push(...A)}const E=N.reduce((A,D)=>{const q=n.ISOWeek?d(D):h(D),B=A.find(W=>W.weekNumber===q),H=new rX(D,S,r);return B?B.days.push(H):A.push(new vEe(q,[H])),A},[]),_=new xEe(S,E);return w.push(_),w},[]);return n.reverseMonths?y.reverse():y}function E_e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:a,endOfMonth:l,addYears:c,endOfYear:d,newDate:h,today:m}=e,{fromYear:g,toYear:x,fromMonth:y,toMonth:w}=t;!n&&y&&(n=y),!n&&g&&(n=e.newDate(g,0,1)),!r&&w&&(r=w),!r&&x&&(r=h(x,11,31));const S=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=a(n):g?n=h(g,0,1):!n&&S&&(n=s(c(t.today??m(),-100))),r?r=l(r):x?r=h(x,11,31):!r&&S&&(r=d(t.today??m())),[n&&i(n),r&&i(r)]}function __e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:a,addMonths:l,differenceInCalendarMonths:c}=r,d=s?i:1,h=a(t);if(!e)return l(h,d);if(!(c(e,t)n.concat(r.weeks.slice()),e.slice())}function aw(t,e){const[n,r]=b.useState(t);return[e===void 0?n:e,r]}function R_e(t,e){const[n,r]=E_e(t,e),{startOfMonth:s,endOfMonth:i}=e,a=Rz(t,n,r,e),[l,c]=aw(a,t.month?a:void 0);b.useEffect(()=>{const _=Rz(t,n,r,e);c(_)},[t.timeZone]);const d=C_e(l,r,t,e),h=j_e(d,t.endMonth?i(t.endMonth):void 0,t,e),m=T_e(d,h,t,e),g=M_e(m),x=N_e(m),y=A_e(l,n,t,e),w=__e(l,r,t,e),{disableNavigation:S,onMonthChange:k}=t,j=_=>g.some(A=>A.days.some(D=>D.isEqualTo(_))),N=_=>{if(S)return;let A=s(_);n&&As(r)&&(A=s(r)),c(A),k?.(A)};return{months:m,weeks:g,days:x,navStart:n,navEnd:r,previousMonth:y,nextMonth:w,goToMonth:N,goToDay:_=>{j(_)||N(_.date)}}}var yo;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(yo||(yo={}));function Dz(t){return!t[zr.disabled]&&!t[zr.hidden]&&!t[zr.outside]}function D_e(t,e,n,r){let s,i=-1;for(const a of t){const l=e(a);Dz(l)&&(l[zr.focused]&&iDz(e(a)))),s}function P_e(t,e,n,r,s,i,a){const{ISOWeek:l,broadcastCalendar:c}=i,{addDays:d,addMonths:h,addWeeks:m,addYears:g,endOfBroadcastWeek:x,endOfISOWeek:y,endOfWeek:w,max:S,min:k,startOfBroadcastWeek:j,startOfISOWeek:N,startOfWeek:T}=a;let _={day:d,week:m,month:h,year:g,startOfWeek:A=>c?j(A,a):l?N(A):T(A),endOfWeek:A=>c?x(A):l?y(A):w(A)}[t](n,e==="after"?1:-1);return e==="before"&&r?_=S([r,_]):e==="after"&&s&&(_=k([s,_])),_}function mX(t,e,n,r,s,i,a,l=0){if(l>365)return;const c=P_e(t,e,n.date,r,s,i,a),d=!!(i.disabled&&Ll(c,i.disabled,a)),h=!!(i.hidden&&Ll(c,i.hidden,a)),m=c,g=new rX(c,m,a);return!d&&!h?g:mX(t,e,g,r,s,i,a,l+1)}function z_e(t,e,n,r,s){const{autoFocus:i}=t,[a,l]=b.useState(),c=D_e(e.days,n,r||(()=>!1),a),[d,h]=b.useState(i?c:void 0);return{isFocusTarget:w=>!!c?.isEqualTo(w),setFocused:h,focused:d,blur:()=>{l(d),h(void 0)},moveFocus:(w,S)=>{if(!d)return;const k=mX(w,S,d,e.navStart,e.navEnd,t,s);k&&(t.disableNavigation&&!e.days.some(N=>N.isEqualTo(k))||(e.goToDay(k),h(k)))}}}function I_e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=aw(n,s?n:void 0),l=s?n:i,{isSameDay:c}=e,d=x=>l?.some(y=>c(y,x))??!1,{min:h,max:m}=t;return{selected:l,select:(x,y,w)=>{let S=[...l??[]];if(d(x)){if(l?.length===h||r&&l?.length===1)return;S=l?.filter(k=>!c(k,x))}else l?.length===m?S=[x]:S=[...S,x];return s||a(S),s?.(S,x,y,w),S},isSelected:d}}function L_e(t,e,n=0,r=0,s=!1,i=Zo){const{from:a,to:l}=e||{},{isSameDay:c,isAfter:d,isBefore:h}=i;let m;if(!a&&!l)m={from:t,to:n>0?void 0:t};else if(a&&!l)c(a,t)?n===0?m={from:a,to:t}:s?m={from:a,to:void 0}:m=void 0:h(t,a)?m={from:t,to:a}:m={from:a,to:t};else if(a&&l)if(c(a,t)&&c(l,t))s?m={from:a,to:l}:m=void 0;else if(c(a,t))m={from:a,to:n>0?void 0:t};else if(c(l,t))m={from:t,to:n>0?void 0:t};else if(h(t,a))m={from:t,to:l};else if(d(t,a))m={from:a,to:t};else if(d(t,l))m={from:a,to:t};else throw new Error("Invalid range");if(m?.from&&m?.to){const g=i.differenceInCalendarDays(m.to,m.from);r>0&&g>r?m={from:t,to:void 0}:n>1&&gtypeof l!="function").some(l=>typeof l=="boolean"?l:n.isDate(l)?Il(t,l,!1,n):cX(l,n)?l.some(c=>Il(t,c,!1,n)):g7(l)?l.from&&l.to?Pz(t,{from:l.from,to:l.to},n):!1:lX(l)?B_e(t,l.dayOfWeek,n):iX(l)?n.isAfter(l.before,l.after)?Pz(t,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):Ll(t.from,l,n)||Ll(t.to,l,n):aX(l)||oX(l)?Ll(t.from,l,n)||Ll(t.to,l,n):!1))return!0;const a=r.filter(l=>typeof l=="function");if(a.length){let l=t.from;const c=n.differenceInCalendarDays(t.to,t.from);for(let d=0;d<=c;d++){if(a.some(h=>h(l)))return!0;l=n.addDays(l,1)}}return!1}function q_e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:a}=t,[l,c]=aw(s,a?s:void 0),d=a?s:l;return{selected:d,select:(g,x,y)=>{const{min:w,max:S}=t,k=g?L_e(g,d,w,S,i,e):void 0;return r&&n&&k?.from&&k.to&&F_e({from:k.from,to:k.to},n,e)&&(k.from=g,k.to=void 0),a||c(k),a?.(k,g,x,y),k},isSelected:g=>d&&Il(d,g,!1,e)}}function $_e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=aw(n,s?n:void 0),l=s?n:i,{isSameDay:c}=e;return{selected:l,select:(m,g,x)=>{let y=m;return!r&&l&&l&&c(m,l)&&(y=void 0),s||a(y),s?.(y,m,g,x),y},isSelected:m=>l?c(l,m):!1}}function H_e(t,e){const n=$_e(t,e),r=I_e(t,e),s=q_e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function Q_e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new Bs(e.today,e.timeZone)),e.month&&(e.month=new Bs(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new Bs(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new Bs(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new Bs(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new Bs(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(dt=>new Bs(dt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new Bs(e.selected.from,e.timeZone):void 0,to:e.selected.to?new Bs(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:a,classNames:l}=b.useMemo(()=>{const dt={...p7,...e.locale};return{dateLib:new ta({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:GEe(e.components),formatters:s_e(e.formatters),labels:{...b_e,...e.labels},locale:dt,classNames:{...x7(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:c,mode:d,navLayout:h,numberOfMonths:m=1,onDayBlur:g,onDayClick:x,onDayFocus:y,onDayKeyDown:w,onDayMouseEnter:S,onDayMouseLeave:k,onNextClick:j,onPrevClick:N,showWeekNumber:T,styles:E}=e,{formatCaption:_,formatDay:A,formatMonthDropdown:D,formatWeekNumber:q,formatWeekNumberHeader:B,formatWeekdayName:H,formatYearDropdown:W}=r,ee=R_e(e,i),{days:I,months:V,navStart:L,navEnd:$,previousMonth:K,nextMonth:Y,goToMonth:R}=ee,ie=UEe(I,e,L,$,i),{isSelected:X,select:z,selected:U}=H_e(e,i)??{},{blur:te,focused:ne,isFocusTarget:G,moveFocus:se,setFocused:re}=z_e(e,ee,ie,X??(()=>!1),i),{labelDayButton:ae,labelGridcell:_e,labelGrid:Be,labelMonthDropdown:Ye,labelNav:Je,labelPrevious:Oe,labelNext:Ve,labelWeekday:Ue,labelWeekNumber:$e,labelWeekNumberHeader:jt,labelYearDropdown:vt}=s,$n=b.useMemo(()=>o_e(i,e.ISOWeek),[i,e.ISOWeek]),qt=d!==void 0||x!==void 0,un=b.useCallback(()=>{K&&(R(K),N?.(K))},[K,R,N]),Mt=b.useCallback(()=>{Y&&(R(Y),j?.(Y))},[R,Y,j]),ct=b.useCallback((dt,rn)=>wt=>{wt.preventDefault(),wt.stopPropagation(),re(dt),z?.(dt.date,rn,wt),x?.(dt.date,rn,wt)},[z,x,re]),Ne=b.useCallback((dt,rn)=>wt=>{re(dt),y?.(dt.date,rn,wt)},[y,re]),ze=b.useCallback((dt,rn)=>wt=>{te(),g?.(dt.date,rn,wt)},[te,g]),rt=b.useCallback((dt,rn)=>wt=>{const Wt={ArrowLeft:[wt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[wt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[wt.shiftKey?"year":"week","after"],ArrowUp:[wt.shiftKey?"year":"week","before"],PageUp:[wt.shiftKey?"year":"month","before"],PageDown:[wt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Wt[wt.key]){wt.preventDefault(),wt.stopPropagation();const[Gt,lt]=Wt[wt.key];se(Gt,lt)}w?.(dt.date,rn,wt)},[se,w,e.dir]),bt=b.useCallback((dt,rn)=>wt=>{S?.(dt.date,rn,wt)},[S]),zt=b.useCallback((dt,rn)=>wt=>{k?.(dt.date,rn,wt)},[k]),Rt=b.useCallback(dt=>rn=>{const wt=Number(rn.target.value),Wt=i.setMonth(i.startOfMonth(dt),wt);R(Wt)},[i,R]),Hn=b.useCallback(dt=>rn=>{const wt=Number(rn.target.value),Wt=i.setYear(i.startOfMonth(dt),wt);R(Wt)},[i,R]),{className:We,style:ot}=b.useMemo(()=>({className:[l[Nt.Root],e.className].filter(Boolean).join(" "),style:{...E?.[Nt.Root],...e.style}}),[l,e.className,e.style,E]),dn=XEe(e),Pt=b.useRef(null);O_e(Pt,!!e.animate,{classNames:l,months:V,focused:ne,dateLib:i});const xn={dayPickerProps:e,selected:U,select:z,isSelected:X,months:V,nextMonth:Y,previousMonth:K,goToMonth:R,getModifiers:ie,components:n,classNames:l,styles:E,labels:s,formatters:r};return oe.createElement(sX.Provider,{value:xn},oe.createElement(n.Root,{rootRef:e.animate?Pt:void 0,className:We,style:ot,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"],...dn},oe.createElement(n.Months,{className:l[Nt.Months],style:E?.[Nt.Months]},!e.hideNavigation&&!h&&oe.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[Nt.Nav],style:E?.[Nt.Nav],"aria-label":Je(),onPreviousClick:un,onNextClick:Mt,previousMonth:K,nextMonth:Y}),V.map((dt,rn)=>oe.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:l[Nt.Month],style:E?.[Nt.Month],key:rn,displayIndex:rn,calendarMonth:dt},h==="around"&&!e.hideNavigation&&rn===0&&oe.createElement(n.PreviousMonthButton,{type:"button",className:l[Nt.PreviousMonthButton],tabIndex:K?void 0:-1,"aria-disabled":K?void 0:!0,"aria-label":Oe(K),onClick:un,"data-animated-button":e.animate?"true":void 0},oe.createElement(n.Chevron,{disabled:K?void 0:!0,className:l[Nt.Chevron],orientation:e.dir==="rtl"?"right":"left"})),oe.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:l[Nt.MonthCaption],style:E?.[Nt.MonthCaption],calendarMonth:dt,displayIndex:rn},c?.startsWith("dropdown")?oe.createElement(n.DropdownNav,{className:l[Nt.Dropdowns],style:E?.[Nt.Dropdowns]},(()=>{const wt=c==="dropdown"||c==="dropdown-months"?oe.createElement(n.MonthsDropdown,{key:"month",className:l[Nt.MonthsDropdown],"aria-label":Ye(),classNames:l,components:n,disabled:!!e.disableNavigation,onChange:Rt(dt.date),options:i_e(dt.date,L,$,r,i),style:E?.[Nt.Dropdown],value:i.getMonth(dt.date)}):oe.createElement("span",{key:"month"},D(dt.date,i)),Wt=c==="dropdown"||c==="dropdown-years"?oe.createElement(n.YearsDropdown,{key:"year",className:l[Nt.YearsDropdown],"aria-label":vt(i.options),classNames:l,components:n,disabled:!!e.disableNavigation,onChange:Hn(dt.date),options:l_e(L,$,r,i,!!e.reverseYears),style:E?.[Nt.Dropdown],value:i.getYear(dt.date)}):oe.createElement("span",{key:"year"},W(dt.date,i));return i.getMonthYearOrder()==="year-first"?[Wt,wt]:[wt,Wt]})(),oe.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"}},_(dt.date,i.options,i))):oe.createElement(n.CaptionLabel,{className:l[Nt.CaptionLabel],role:"status","aria-live":"polite"},_(dt.date,i.options,i))),h==="around"&&!e.hideNavigation&&rn===m-1&&oe.createElement(n.NextMonthButton,{type:"button",className:l[Nt.NextMonthButton],tabIndex:Y?void 0:-1,"aria-disabled":Y?void 0:!0,"aria-label":Ve(Y),onClick:Mt,"data-animated-button":e.animate?"true":void 0},oe.createElement(n.Chevron,{disabled:Y?void 0:!0,className:l[Nt.Chevron],orientation:e.dir==="rtl"?"left":"right"})),rn===m-1&&h==="after"&&!e.hideNavigation&&oe.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[Nt.Nav],style:E?.[Nt.Nav],"aria-label":Je(),onPreviousClick:un,onNextClick:Mt,previousMonth:K,nextMonth:Y}),oe.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":d==="multiple"||d==="range","aria-label":Be(dt.date,i.options,i)||void 0,className:l[Nt.MonthGrid],style:E?.[Nt.MonthGrid]},!e.hideWeekdays&&oe.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:l[Nt.Weekdays],style:E?.[Nt.Weekdays]},T&&oe.createElement(n.WeekNumberHeader,{"aria-label":jt(i.options),className:l[Nt.WeekNumberHeader],style:E?.[Nt.WeekNumberHeader],scope:"col"},B()),$n.map(wt=>oe.createElement(n.Weekday,{"aria-label":Ue(wt,i.options,i),className:l[Nt.Weekday],key:String(wt),style:E?.[Nt.Weekday],scope:"col"},H(wt,i.options,i)))),oe.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:l[Nt.Weeks],style:E?.[Nt.Weeks]},dt.weeks.map(wt=>oe.createElement(n.Week,{className:l[Nt.Week],key:wt.weekNumber,style:E?.[Nt.Week],week:wt},T&&oe.createElement(n.WeekNumber,{week:wt,style:E?.[Nt.WeekNumber],"aria-label":$e(wt.weekNumber,{locale:a}),className:l[Nt.WeekNumber],scope:"row",role:"rowheader"},q(wt.weekNumber,i)),wt.days.map(Wt=>{const{date:Gt}=Wt,lt=ie(Wt);if(lt[zr.focused]=!lt.hidden&&!!ne?.isEqualTo(Wt),lt[Wa.selected]=X?.(Gt)||lt.selected,g7(U)){const{from:vn,to:Qn}=U;lt[Wa.range_start]=!!(vn&&Qn&&i.isSameDay(Gt,vn)),lt[Wa.range_end]=!!(vn&&Qn&&i.isSameDay(Gt,Qn)),lt[Wa.range_middle]=Il(U,Gt,!0,i)}const ve=a_e(lt,E,e.modifiersStyles),He=WEe(lt,l,e.modifiersClassNames),ht=!qt&&!lt.hidden?_e(Gt,lt,i.options,i):void 0;return oe.createElement(n.Day,{key:`${i.format(Gt,"yyyy-MM-dd")}_${i.format(Wt.displayMonth,"yyyy-MM")}`,day:Wt,modifiers:lt,className:He.join(" "),style:ve,role:"gridcell","aria-selected":lt.selected||void 0,"aria-label":ht,"data-day":i.format(Gt,"yyyy-MM-dd"),"data-month":Wt.outside?i.format(Gt,"yyyy-MM"):void 0,"data-selected":lt.selected||void 0,"data-disabled":lt.disabled||void 0,"data-hidden":lt.hidden||void 0,"data-outside":Wt.outside||void 0,"data-focused":lt.focused||void 0,"data-today":lt.today||void 0},!lt.hidden&&qt?oe.createElement(n.DayButton,{className:l[Nt.DayButton],style:E?.[Nt.DayButton],type:"button",day:Wt,modifiers:lt,disabled:lt.disabled||void 0,tabIndex:G(Wt)?0:-1,"aria-label":ae(Gt,lt,i.options,i),onClick:ct(Wt,lt),onBlur:ze(Wt,lt),onFocus:Ne(Wt,lt),onKeyDown:rt(Wt,lt),onMouseEnter:bt(Wt,lt),onMouseLeave:zt(Wt,lt)},A(Gt,i.options,i)):!lt.hidden&&A(Wt.date,i.options,i))})))))))),e.footer&&oe.createElement(n.Footer,{className:l[Nt.Footer],style:E?.[Nt.Footer],role:"status","aria-live":"polite"},e.footer)))}function zz({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:a,...l}){const c=x7();return o.jsx(Q_e,{showOutsideDays:n,className:xe("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:d=>d.toLocaleString("default",{month:"short"}),...i},classNames:{root:xe("w-fit",c.root),months:xe("relative flex flex-col gap-4 md:flex-row",c.months),month:xe("flex w-full flex-col gap-4",c.month),nav:xe("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:xe(q0({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_previous),button_next:xe(q0({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_next),month_caption:xe("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",c.month_caption),dropdowns:xe("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:xe("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",c.dropdown_root),dropdown:xe("bg-popover absolute inset-0 opacity-0",c.dropdown),caption_label:xe("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",c.caption_label),table:"w-full border-collapse",weekdays:xe("flex",c.weekdays),weekday:xe("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",c.weekday),week:xe("mt-2 flex w-full",c.week),week_number_header:xe("w-[--cell-size] select-none",c.week_number_header),week_number:xe("text-muted-foreground select-none text-[0.8rem]",c.week_number),day:xe("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",c.day),range_start:xe("bg-accent rounded-l-md",c.range_start),range_middle:xe("rounded-none",c.range_middle),range_end:xe("bg-accent rounded-r-md",c.range_end),today:xe("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",c.today),outside:xe("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:xe("text-muted-foreground opacity-50",c.disabled),hidden:xe("invisible",c.hidden),...e},components:{Root:({className:d,rootRef:h,...m})=>o.jsx("div",{"data-slot":"calendar",ref:h,className:xe(d),...m}),Chevron:({className:d,orientation:h,...m})=>h==="left"?o.jsx(wd,{className:xe("size-4",d),...m}):h==="right"?o.jsx(Zl,{className:xe("size-4",d),...m}):o.jsx(Xc,{className:xe("size-4",d),...m}),DayButton:V_e,WeekNumber:({children:d,...h})=>o.jsx("td",{...h,children:o.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:d})}),...a},...l})}function V_e({className:t,day:e,modifiers:n,...r}){const s=x7(),i=b.useRef(null);return b.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),o.jsx(ue,{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:xe("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 U_e{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 Nh=new U_e;typeof window<"u"&&Nh.connect();const W_e={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}} 年"}},G_e=(t,e,n)=>{let r;const s=W_e[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},X_e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},Y_e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},K_e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Z_e={date:Uh({formats:X_e,defaultWidth:"full"}),time:Uh({formats:Y_e,defaultWidth:"full"}),dateTime:Uh({formats:K_e,defaultWidth:"full"})};function Iz(t,e,n){const r="eeee p";return cEe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const J_e={lastWeek:Iz,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Iz,other:"PP p"},eAe=(t,e,n,r)=>{const s=J_e[t];return typeof s=="function"?s(e,n,r):s},tAe={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},nAe={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},rAe={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},sAe={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},iAe={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:"夜间"}},aAe={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:"夜间"}},oAe=(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()}},lAe={ordinalNumber:oAe,era:jo({values:tAe,defaultWidth:"wide"}),quarter:jo({values:nAe,defaultWidth:"wide",argumentCallback:t=>t-1}),month:jo({values:rAe,defaultWidth:"wide"}),day:jo({values:sAe,defaultWidth:"wide"}),dayPeriod:jo({values:iAe,defaultWidth:"wide",formattingValues:aAe,defaultFormattingWidth:"wide"})},cAe=/^(第\s*)?\d+(日|时|分|秒)?/i,uAe=/\d+/i,dAe={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},hAe={any:[/^(前)/i,/^(公元)/i]},fAe={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},mAe={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},pAe={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},gAe={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]},xAe={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},vAe={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},yAe={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},bAe={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},wAe={ordinalNumber:KG({matchPattern:cAe,parsePattern:uAe,valueCallback:t=>parseInt(t,10)}),era:No({matchPatterns:dAe,defaultMatchWidth:"wide",parsePatterns:hAe,defaultParseWidth:"any"}),quarter:No({matchPatterns:fAe,defaultMatchWidth:"wide",parsePatterns:mAe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:No({matchPatterns:pAe,defaultMatchWidth:"wide",parsePatterns:gAe,defaultParseWidth:"any"}),day:No({matchPatterns:xAe,defaultMatchWidth:"wide",parsePatterns:vAe,defaultParseWidth:"any"}),dayPeriod:No({matchPatterns:yAe,defaultMatchWidth:"any",parsePatterns:bAe,defaultParseWidth:"any"})},K1={code:"zh-CN",formatDistance:G_e,formatLong:Z_e,formatRelative:eAe,localize:lAe,match:wAe,options:{weekStartsOn:1,firstWeekContainsDate:4}},Z1={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function SAe(){const[t,e]=b.useState([]),[n,r]=b.useState(""),[s,i]=b.useState("all"),[a,l]=b.useState("all"),[c,d]=b.useState(void 0),[h,m]=b.useState(void 0),[g,x]=b.useState(!0),[y,w]=b.useState(!1),[S,k]=b.useState("xs"),[j,N]=b.useState(4),T=b.useRef(null);b.useEffect(()=>{const L=Nh.getAllLogs();e(L);const $=Nh.onLog(()=>{e(Nh.getAllLogs())}),K=Nh.onConnectionChange(Y=>{w(Y)});return()=>{$(),K()}},[]);const E=b.useMemo(()=>{const L=new Set(t.map($=>$.module));return Array.from(L).sort()},[t]),_=L=>{switch(L){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"}},A=L=>{switch(L){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()},q=()=>{Nh.clearLogs(),e([])},B=()=>{const L=ee.map(R=>`${R.timestamp} [${R.level.padEnd(8)}] [${R.module}] ${R.message}`).join(` +`),$=new Blob([L],{type:"text/plain;charset=utf-8"}),K=URL.createObjectURL($),Y=document.createElement("a");Y.href=K,Y.download=`logs-${Dv(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Y.click(),URL.revokeObjectURL(K)},H=()=>{x(!g)},W=()=>{d(void 0),m(void 0)},ee=b.useMemo(()=>t.filter(L=>{const $=n===""||L.message.toLowerCase().includes(n.toLowerCase())||L.module.toLowerCase().includes(n.toLowerCase()),K=s==="all"||L.level===s,Y=a==="all"||L.module===a;let R=!0;if(c||h){const ie=new Date(L.timestamp);if(c){const X=new Date(c);X.setHours(0,0,0,0),R=R&&ie>=X}if(h){const X=new Date(h);X.setHours(23,59,59,999),R=R&&ie<=X}}return $&&K&&Y&&R}),[t,n,s,a,c,h]),I=Z1[S].rowHeight+j,V=HTe({count:ee.length,getScrollElement:()=>T.current,estimateSize:()=>I,overscan:15});return b.useEffect(()=>{g&&ee.length>0&&V.scrollToIndex(ee.length-1,{align:"end",behavior:"auto"})},[ee.length,g,V]),o.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex-shrink-0 space-y-4 p-3 sm:p-4 lg:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:xe("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",y?"bg-green-500 animate-pulse":"bg-red-500")}),o.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:y?"已连接":"未连接"})]})]}),o.jsx(Lt,{className:"p-3 sm:p-4",children:o.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索日志...",value:n,onChange:L=>r(L.target.value),className:"pl-9 h-9 text-sm"})]}),o.jsxs(Vt,{value:s,onValueChange:i,children:[o.jsxs($t,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[o.jsx(ok,{className:"h-4 w-4 mr-2"}),o.jsx(Ut,{placeholder:"级别"})]}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部级别"}),o.jsx(De,{value:"DEBUG",children:"DEBUG"}),o.jsx(De,{value:"INFO",children:"INFO"}),o.jsx(De,{value:"WARNING",children:"WARNING"}),o.jsx(De,{value:"ERROR",children:"ERROR"}),o.jsx(De,{value:"CRITICAL",children:"CRITICAL"})]})]}),o.jsxs(Vt,{value:a,onValueChange:l,children:[o.jsxs($t,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[o.jsx(ok,{className:"h-4 w-4 mr-2"}),o.jsx(Ut,{placeholder:"模块"})]}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部模块"}),E.map(L=>o.jsx(De,{value:L,children:L},L))]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[o.jsxs(Bo,{children:[o.jsx(Fo,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",className:xe("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!c&&"text-muted-foreground"),children:[o.jsx(C9,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"text-xs sm:text-sm",children:c?Dv(c,"PPP",{locale:K1}):"开始日期"})]})}),o.jsx(Ka,{className:"w-auto p-0",align:"start",children:o.jsx(zz,{mode:"single",selected:c,onSelect:d,initialFocus:!0,locale:K1})})]}),o.jsxs(Bo,{children:[o.jsx(Fo,{asChild:!0,children:o.jsxs(ue,{variant:"outline",size:"sm",className:xe("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!h&&"text-muted-foreground"),children:[o.jsx(C9,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"text-xs sm:text-sm",children:h?Dv(h,"PPP",{locale:K1}):"结束日期"})]})}),o.jsx(Ka,{className:"w-auto p-0",align:"start",children:o.jsx(zz,{mode:"single",selected:h,onSelect:m,initialFocus:!0,locale:K1})})]}),(c||h)&&o.jsxs(ue,{variant:"outline",size:"sm",onClick:W,className:"w-full sm:w-auto h-9",children:[o.jsx(Pp,{className:"h-4 w-4 sm:mr-2"}),o.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),o.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsxs(ue,{variant:g?"default":"outline",size:"sm",onClick:H,className:"flex-1 sm:flex-none h-9",children:[g?o.jsx(rte,{className:"h-4 w-4"}):o.jsx(ste,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:g?"自动滚动":"已暂停"})]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:D,className:"flex-1 sm:flex-none h-9",children:[o.jsx(Qs,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:q,className:"flex-1 sm:flex-none h-9",children:[o.jsx(Cn,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:B,className:"flex-1 sm:flex-none h-9",children:[o.jsx(td,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),o.jsx("div",{className:"flex-1 hidden sm:block"}),o.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[o.jsxs("span",{className:"font-mono",children:[ee.length," / ",t.length]}),o.jsx("span",{className:"ml-1",children:"条日志"})]})]}),o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6 pt-2 border-t border-border/50",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(ite,{className:"h-4 w-4"}),o.jsx("span",{children:"字号"})]}),o.jsx("div",{className:"flex gap-1",children:Object.keys(Z1).map(L=>o.jsx(ue,{variant:S===L?"default":"outline",size:"sm",onClick:()=>k(L),className:"h-7 px-3 text-xs",children:Z1[L].label},L))})]}),o.jsxs("div",{className:"flex items-center gap-3 flex-1 max-w-xs",children:[o.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"行距"}),o.jsx(Nf,{value:[j],onValueChange:([L])=>N(L),min:0,max:12,step:2,className:"flex-1"}),o.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[j,"px"]})]})]})]})})]}),o.jsx("div",{className:"flex-1 min-h-0 px-3 sm:px-4 lg:px-6 pb-3 sm:pb-4 lg:pb-6",children:o.jsx(Lt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full",children:o.jsx(pn,{viewportRef:T,className:"h-full",children:o.jsx("div",{className:xe("p-2 sm:p-3 font-mono relative",Z1[S].class),style:{height:`${V.getTotalSize()}px`},children:ee.length===0?o.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):V.getVirtualItems().map(L=>{const $=ee[L.index];return o.jsxs("div",{"data-index":L.index,ref:V.measureElement,className:xe("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",A($.level)),style:{transform:`translateY(${L.start}px)`,paddingTop:`${j/2}px`,paddingBottom:`${j/2}px`},children:[o.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-600",children:$.timestamp}),o.jsxs("span",{className:xe("font-semibold",_($.level)),children:["[",$.level,"]"]})]}),o.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate",children:$.module}),o.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words",children:$.message})]}),o.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:$.timestamp}),o.jsxs("span",{className:xe("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",_($.level)),children:["[",$.level,"]"]}),o.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:$.module}),o.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:$.message})]})]},L.key)})})})})})]})}const kAe="Mai-with-u",OAe="plugin-repo",jAe="main",NAe="plugin_details.json";async function CAe(){try{const t=await gt("/api/webui/plugins/fetch-raw",{method:"POST",headers:Tt(),body:JSON.stringify({owner:kAe,repo:OAe,branch:jAe,file_path:NAe})});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 TAe(){try{const t=await gt("/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 EAe(){try{const t=await gt("/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 _Ae(t,e,n){const r=t.split(".").map(l=>parseInt(l)||0),s=r[0]||0,i=r[1]||0,a=r[2]||0;if(n.version_majorparseInt(m)||0),c=l[0]||0,d=l[1]||0,h=l[2]||0;if(n.version_major>c||n.version_major===c&&n.version_minor>d||n.version_major===c&&n.version_minor===d&&n.version_patch>h)return!1}return!0}function AAe(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const a=JSON.parse(i.data);t(a)}catch(a){console.error("Failed to parse progress data:",a)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function v0(){try{const t=await gt("/api/webui/plugins/installed",{headers:Tt()});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 J1(t,e){return e.some(n=>n.id===t)}function ev(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function MAe(t,e,n="main"){const r=await gt("/api/webui/plugins/install",{method:"POST",headers:Tt(),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 RAe(t){const e=await gt("/api/webui/plugins/uninstall",{method:"POST",headers:Tt(),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 DAe(t,e,n="main"){const r=await gt("/api/webui/plugins/update",{method:"POST",headers:Tt(),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 PAe(t){const e=await gt(`/api/webui/plugins/config/${t}/schema`,{headers:Tt()});if(!e.ok){const r=await e.json();throw new Error(r.detail||"获取配置 Schema 失败")}const n=await e.json();if(!n.success)throw new Error(n.message||"获取配置 Schema 失败");return n.schema}async function zAe(t){const e=await gt(`/api/webui/plugins/config/${t}`,{headers:Tt()});if(!e.ok){const r=await e.json();throw new Error(r.detail||"获取配置失败")}const n=await e.json();if(!n.success)throw new Error(n.message||"获取配置失败");return n.config}async function IAe(t,e){const n=await gt(`/api/webui/plugins/config/${t}`,{method:"PUT",headers:Tt(),body:JSON.stringify({config:e})});if(!n.ok){const r=await n.json();throw new Error(r.detail||"保存配置失败")}return await n.json()}async function LAe(t){const e=await gt(`/api/webui/plugins/config/${t}/reset`,{method:"POST",headers:Tt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"重置配置失败")}return await e.json()}async function BAe(t){const e=await gt(`/api/webui/plugins/config/${t}/toggle`,{method:"POST",headers:Tt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"切换状态失败")}return await e.json()}const Cg="https://maibot-plugin-stats.maibot-webui.workers.dev";async function pX(t){try{const e=await fetch(`${Cg}/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 FAe(t,e){try{const n=e||v7(),r=await fetch(`${Cg}/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 qAe(t,e){try{const n=e||v7(),r=await fetch(`${Cg}/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 $Ae(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||v7(),i=await fetch(`${Cg}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),a=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...a}:{success:!1,error:a.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function HAe(t){try{const e=await fetch(`${Cg}/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 QAe(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const k=await pX(t);k&&r(k),i(!1)};b.useEffect(()=>{x()},[t]);const y=async()=>{const k=await FAe(t);k.success?(g({title:"已点赞",description:"感谢你的支持!"}),x()):g({title:"点赞失败",description:k.error||"未知错误",variant:"destructive"})},w=async()=>{const k=await qAe(t);k.success?(g({title:"已反馈",description:"感谢你的反馈!"}),x()):g({title:"操作失败",description:k.error||"未知错误",variant:"destructive"})},S=async()=>{if(a===0){g({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const k=await $Ae(t,a,c||void 0);k.success?(g({title:"评分成功",description:"感谢你的评价!"}),m(!1),l(0),d(""),x()):g({title:"评分失败",description:k.error||"未知错误",variant:"destructive"})};return s?o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(td,{className:"h-4 w-4"}),o.jsx("span",{children:"-"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Dc,{className:"h-4 w-4"}),o.jsx("span",{children:"-"})]})]}):n?e?o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[o.jsx(td,{className:"h-4 w-4"}),o.jsx("span",{children:n.downloads.toLocaleString()})]}),o.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[o.jsx(Dc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsx("span",{children:n.rating.toFixed(1)})]}),o.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[o.jsx(k4,{className:"h-4 w-4"}),o.jsx("span",{children:n.likes})]})]}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(td,{className:"h-5 w-5 text-muted-foreground mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(Dc,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),o.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(k4,{className:"h-5 w-5 text-green-500 mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.likes}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(T9,{className:"h-5 w-5 text-red-500 mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(ue,{variant:"outline",size:"sm",onClick:y,children:[o.jsx(k4,{className:"h-4 w-4 mr-1"}),"点赞"]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:w,children:[o.jsx(T9,{className:"h-4 w-4 mr-1"}),"点踩"]}),o.jsxs(Er,{open:h,onOpenChange:m,children:[o.jsx(Of,{asChild:!0,children:o.jsxs(ue,{variant:"default",size:"sm",children:[o.jsx(Dc,{className:"h-4 w-4 mr-1"}),"评分"]})}),o.jsxs(wr,{children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"为插件评分"}),o.jsx(Xr,{children:"分享你的使用体验,帮助其他用户"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(k=>o.jsx("button",{onClick:()=>l(k),className:"focus:outline-none",children:o.jsx(Dc,{className:`h-8 w-8 transition-colors ${k<=a?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},k))}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[a===0&&"点击星星进行评分",a===1&&"很差",a===2&&"一般",a===3&&"还行",a===4&&"不错",a===5&&"非常好"]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),o.jsx(Nr,{value:c,onChange:k=>d(k.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),o.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[c.length," / 500"]})]})]}),o.jsxs(fs,{children:[o.jsx(ue,{variant:"outline",onClick:()=>m(!1),children:"取消"}),o.jsx(ue,{onClick:S,disabled:a===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),o.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((k,j)=>o.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(N=>o.jsx(Dc,{className:`h-3 w-3 ${N<=k.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},N))}),o.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(k.created_at).toLocaleDateString()})]}),k.comment&&o.jsx("p",{className:"text-sm text-muted-foreground",children:k.comment})]},j))})]})]}):null}const Lz={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function UAe(){const t=na(),[e,n]=b.useState(null),[r,s]=b.useState(""),[i,a]=b.useState("all"),[l,c]=b.useState("all"),[d,h]=b.useState(!0),[m,g]=b.useState([]),[x,y]=b.useState(!0),[w,S]=b.useState(null),[k,j]=b.useState(null),[N,T]=b.useState(null),[E,_]=b.useState(null),[,A]=b.useState([]),[D,q]=b.useState({}),{toast:B}=Lr(),H=async R=>{const ie=R.map(async U=>{try{const te=await pX(U.id);return{id:U.id,stats:te}}catch(te){return console.warn(`Failed to load stats for ${U.id}:`,te),{id:U.id,stats:null}}}),X=await Promise.all(ie),z={};X.forEach(({id:U,stats:te})=>{te&&(z[U]=te)}),q(z)};b.useEffect(()=>{let R=null,ie=!1;return(async()=>{if(R=AAe(z=>{ie||(T(z),z.stage==="success"?setTimeout(()=>{ie||T(null)},2e3):z.stage==="error"&&(y(!1),S(z.error||"加载失败")))},z=>{console.error("WebSocket error:",z),ie||B({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(z=>{if(!R){z();return}const U=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),z()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),z()):setTimeout(U,100)};U()}),!ie){const z=await TAe();j(z),z.installed||B({title:"Git 未安装",description:z.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!ie){const z=await EAe();_(z)}if(!ie)try{y(!0),S(null);const z=await CAe();if(!ie){const U=await v0();A(U);const te=z.map(ne=>{const G=J1(ne.id,U),se=ev(ne.id,U);return{...ne,installed:G,installed_version:se}});for(const ne of U)!te.some(se=>se.id===ne.id)&&ne.manifest&&te.push({id:ne.id,manifest:{manifest_version:ne.manifest.manifest_version||1,name:ne.manifest.name,version:ne.manifest.version,description:ne.manifest.description||"",author:ne.manifest.author,license:ne.manifest.license||"Unknown",host_application:ne.manifest.host_application,homepage_url:ne.manifest.homepage_url,repository_url:ne.manifest.repository_url,keywords:ne.manifest.keywords||[],categories:ne.manifest.categories||[],default_locale:ne.manifest.default_locale||"zh-CN",locales_path:ne.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ne.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});g(te),H(te)}}catch(z){if(!ie){const U=z instanceof Error?z.message:"加载插件列表失败";S(U),B({title:"加载失败",description:U,variant:"destructive"})}}finally{ie||y(!1)}})(),()=>{ie=!0,R&&R.close()}},[B]);const W=R=>{if(!R.installed&&E&&!ee(R))return o.jsxs(tn,{variant:"destructive",className:"gap-1",children:[o.jsx(Lo,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const ie=R.installed_version?.trim(),X=R.manifest.version?.trim();if(ie!==X){const z=ie?.split(".").map(Number)||[0,0,0],U=X?.split(".").map(Number)||[0,0,0];for(let te=0;te<3;te++){if((U[te]||0)>(z[te]||0))return o.jsxs(tn,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[o.jsx(Lo,{className:"h-3 w-3"}),"可更新"]});if((U[te]||0)<(z[te]||0))break}}return o.jsxs(tn,{variant:"default",className:"gap-1",children:[o.jsx(Ya,{className:"h-3 w-3"}),"已安装"]})}return null},ee=R=>!E||!R.manifest?.host_application?!0:_Ae(R.manifest.host_application.min_version,R.manifest.host_application.max_version,E),I=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const ie=R.installed_version.trim(),X=R.manifest.version.trim();if(ie===X)return!1;const z=ie.split(".").map(Number),U=X.split(".").map(Number);for(let te=0;te<3;te++){if((U[te]||0)>(z[te]||0))return!0;if((U[te]||0)<(z[te]||0))return!1}return!1},V=m.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const ie=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(te=>te.toLowerCase().includes(r.toLowerCase())),X=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let z=!0;l==="installed"?z=R.installed===!0:l==="updates"&&(z=R.installed===!0&&I(R));const U=!d||!E||ee(R);return ie&&X&&z&&U}),L=()=>{n(null)},$=async R=>{if(!k?.installed){B({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(E&&!ee(R)){B({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await MAe(R.id,R.manifest.repository_url||"","main"),HAe(R.id).catch(X=>{console.warn("Failed to record download:",X)}),B({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const ie=await v0();A(ie),g(X=>X.map(z=>{if(z.id===R.id){const U=J1(z.id,ie),te=ev(z.id,ie);return{...z,installed:U,installed_version:te}}return z}))}catch(ie){B({title:"安装失败",description:ie instanceof Error?ie.message:"未知错误",variant:"destructive"})}},K=async R=>{try{await RAe(R.id),B({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const ie=await v0();A(ie),g(X=>X.map(z=>{if(z.id===R.id){const U=J1(z.id,ie),te=ev(z.id,ie);return{...z,installed:U,installed_version:te}}return z}))}catch(ie){B({title:"卸载失败",description:ie instanceof Error?ie.message:"未知错误",variant:"destructive"})}},Y=async R=>{if(!k?.installed){B({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const ie=await DAe(R.id,R.manifest.repository_url||"","main");B({title:"更新成功",description:`${R.manifest.name} 已从 ${ie.old_version} 更新到 ${ie.new_version}`});const X=await v0();A(X),g(z=>z.map(U=>{if(U.id===R.id){const te=J1(U.id,X),ne=ev(U.id,X);return{...U,installed:te,installed_version:ne}}return U}))}catch(ie){B({title:"更新失败",description:ie instanceof Error?ie.message:"未知错误",variant:"destructive"})}};return o.jsx(pn,{className:"h-full",children:o.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),o.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),o.jsxs(ue,{onClick:()=>t({to:"/plugin-mirrors"}),children:[o.jsx(ate,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),k&&!k.installed&&o.jsxs(Lt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[o.jsx(En,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ga,{className:"h-5 w-5 text-orange-600"}),o.jsxs("div",{children:[o.jsx(_n,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),o.jsx(Wr,{className:"text-orange-800 dark:text-orange-200",children:k.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),o.jsx(Xn,{children:o.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",o.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),o.jsx(Lt,{className:"p-4",children:o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),o.jsxs(Vt,{value:i,onValueChange:a,children:[o.jsx($t,{className:"w-full sm:w-[200px]",children:o.jsx(Ut,{placeholder:"选择分类"})}),o.jsxs(Ht,{children:[o.jsx(De,{value:"all",children:"全部分类"}),o.jsx(De,{value:"Group Management",children:"群组管理"}),o.jsx(De,{value:"Entertainment & Interaction",children:"娱乐互动"}),o.jsx(De,{value:"Utility Tools",children:"实用工具"}),o.jsx(De,{value:"Content Generation",children:"内容生成"}),o.jsx(De,{value:"Multimedia",children:"多媒体"}),o.jsx(De,{value:"External Integration",children:"外部集成"}),o.jsx(De,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),o.jsx(De,{value:"Other",children:"其他"})]})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ci,{id:"compatible-only",checked:d,onCheckedChange:R=>h(R===!0)}),o.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),o.jsx(Yi,{value:l,onValueChange:c,className:"w-full",children:o.jsxs(ji,{className:"grid w-full grid-cols-3",children:[o.jsxs(Bt,{value:"all",children:["全部插件 (",m.filter(R=>{if(!R.manifest)return!1;const ie=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),X=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),z=!d||!E||ee(R);return ie&&X&&z}).length,")"]}),o.jsxs(Bt,{value:"installed",children:["已安装 (",m.filter(R=>{if(!R.manifest)return!1;const ie=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),X=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),z=!d||!E||ee(R);return R.installed&&ie&&X&&z}).length,")"]}),o.jsxs(Bt,{value:"updates",children:["可更新 (",m.filter(R=>{if(!R.manifest)return!1;const ie=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),X=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),z=!d||!E||ee(R);return R.installed&&I(R)&&ie&&X&&z}).length,")"]})]})}),N&&N.stage==="loading"&&o.jsx(Lt,{className:"p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Us,{className:"h-4 w-4 animate-spin"}),o.jsxs("span",{className:"text-sm font-medium",children:[N.operation==="fetch"&&"加载插件列表",N.operation==="install"&&`安装插件${N.plugin_id?`: ${N.plugin_id}`:""}`,N.operation==="uninstall"&&`卸载插件${N.plugin_id?`: ${N.plugin_id}`:""}`,N.operation==="update"&&`更新插件${N.plugin_id?`: ${N.plugin_id}`:""}`]})]}),o.jsxs("span",{className:"text-sm font-medium",children:[N.progress,"%"]})]}),o.jsx(Qp,{value:N.progress,className:"h-2"}),o.jsx("div",{className:"text-xs text-muted-foreground",children:N.message}),N.operation==="fetch"&&N.total_plugins>0&&o.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",N.loaded_plugins," / ",N.total_plugins," 个插件"]})]})}),N&&N.stage==="error"&&N.error&&o.jsx(Lt,{className:"border-destructive bg-destructive/10",children:o.jsx(En,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ga,{className:"h-5 w-5 text-destructive"}),o.jsxs("div",{children:[o.jsx(_n,{className:"text-lg text-destructive",children:"加载失败"}),o.jsx(Wr,{className:"text-destructive/80",children:N.error})]})]})})}),x?o.jsxs("div",{className:"flex items-center justify-center py-12",children:[o.jsx(Us,{className:"h-8 w-8 animate-spin text-muted-foreground"}),o.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):w?o.jsx(Lt,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Ga,{className:"h-12 w-12 text-destructive mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:w}),o.jsx(ue,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):V.length===0?o.jsx(Lt,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(ii,{className:"h-12 w-12 text-muted-foreground mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:V.map(R=>o.jsxs(Lt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[o.jsxs(En,{children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx(_n,{className:"text-xl",children:R.manifest?.name||R.id}),o.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&o.jsx(tn,{variant:"secondary",className:"text-xs whitespace-nowrap",children:Lz[R.manifest.categories[0]]||R.manifest.categories[0]}),W(R)]})]}),o.jsx(Wr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),o.jsx(Xn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(td,{className:"h-4 w-4"}),o.jsx("span",{children:(D[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Dc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsx("span",{children:(D[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(ie=>o.jsx(tn,{variant:"outline",className:"text-xs",children:ie},ie)),R.manifest?.keywords&&R.manifest.keywords.length>3&&o.jsxs(tn,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),o.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[o.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{children:"支持:"}),o.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),o.jsx(hL,{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?I(R)?o.jsxs(ue,{size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>Y(R),children:[o.jsx(Qs,{className:"h-4 w-4 mr-1"}),"更新"]}):o.jsxs(ue,{variant:"destructive",size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>K(R),children:[o.jsx(Cn,{className:"h-4 w-4 mr-1"}),"卸载"]}):o.jsxs(ue,{size:"sm",disabled:!k?.installed||N?.operation==="install"||E!==null&&!ee(R),title:k?.installed?E!==null&&!ee(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${E?.version})`:void 0:"Git 未安装",onClick:()=>$(R),children:[o.jsx(td,{className:"h-4 w-4 mr-1"}),N?.operation==="install"&&N?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),o.jsx(Er,{open:e!==null,onOpenChange:L,children:e&&e.manifest&&o.jsxs(wr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsx(Sr,{children:o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"space-y-2 flex-1",children:[o.jsx(kr,{className:"text-2xl",children:e.manifest.name}),o.jsxs(Xr,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&o.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:o.jsx(w0,{className:"h-3 w-3 inline"})})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&o.jsx(tn,{variant:"secondary",children:Lz[e.manifest.categories[0]]||e.manifest.categories[0]}),W(e)]})]})}),o.jsxs("div",{className:"space-y-6",children:[o.jsx(VAe,{pluginId:e.id}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"版本"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"下载量"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:(D[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"评分"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Dc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[(D[e.id]?.rating??e.rating??0).toFixed(1)," (",D[e.id]?.rating_count??e.review_count??0,")"]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"许可证"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),o.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>o.jsx(tn,{variant:"outline",children:R},R))})]}),e.detailed_description&&o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),o.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),o.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"font-medium",children:"主页: "}),o.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"font-medium",children:"仓库: "}),o.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),o.jsxs(fs,{children:[e.manifest.homepage_url&&o.jsxs(ue,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[o.jsx(w0,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&o.jsxs(ue,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[o.jsx(w0,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}var ow="Collapsible",[WAe]=Da(ow),[GAe,y7]=WAe(ow),gX=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:a,...l}=t,[c,d]=Kl({prop:r,defaultProp:s??!1,onChange:a,caller:ow});return o.jsx(GAe,{scope:n,disabled:i,contentId:Gi(),open:c,onOpenToggle:b.useCallback(()=>d(h=>!h),[d]),children:o.jsx(Sn.div,{"data-state":w7(c),"data-disabled":i?"":void 0,...l,ref:e})})});gX.displayName=ow;var xX="CollapsibleTrigger",vX=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=y7(xX,n);return o.jsx(Sn.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":w7(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:nt(t.onClick,s.onOpenToggle)})});vX.displayName=xX;var b7="CollapsibleContent",yX=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=y7(b7,t.__scopeCollapsible);return o.jsx(oi,{present:n||s.open,children:({present:i})=>o.jsx(XAe,{...r,ref:e,present:i})})});yX.displayName=b7;var XAe=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=t,a=y7(b7,n),[l,c]=b.useState(r),d=b.useRef(null),h=er(e,d),m=b.useRef(0),g=m.current,x=b.useRef(0),y=x.current,w=a.open||l,S=b.useRef(w),k=b.useRef(void 0);return b.useEffect(()=>{const j=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(j)},[]),Wh(()=>{const j=d.current;if(j){k.current=k.current||{transitionDuration:j.style.transitionDuration,animationName:j.style.animationName},j.style.transitionDuration="0s",j.style.animationName="none";const N=j.getBoundingClientRect();m.current=N.height,x.current=N.width,S.current||(j.style.transitionDuration=k.current.transitionDuration,j.style.animationName=k.current.animationName),c(r)}},[a.open,r]),o.jsx(Sn.div,{"data-state":w7(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!w,...i,ref:h,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...t.style},children:w&&s})});function w7(t){return t?"open":"closed"}var YAe=gX;const hj=YAe,fj=vX,mj=yX;function KAe({field:t,value:e,onChange:n}){const[r,s]=b.useState(!1);switch(t.ui_type){case"switch":return o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(he,{children:t.label}),t.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:t.hint})]}),o.jsx(Ft,{checked:!!e,onCheckedChange:n,disabled:t.disabled})]});case"number":return o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:t.label}),o.jsx(Pe,{type:"number",value:e??t.default,onChange:i=>n(parseFloat(i.target.value)||0),min:t.min,max:t.max,step:t.step??1,placeholder:t.placeholder,disabled:t.disabled}),t.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:t.hint})]});case"slider":return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(he,{children:t.label}),o.jsx("span",{className:"text-sm text-muted-foreground",children:e??t.default})]}),o.jsx(Nf,{value:[e??t.default],onValueChange:i=>n(i[0]),min:t.min??0,max:t.max??100,step:t.step??1,disabled:t.disabled}),t.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:t.hint})]});case"select":return o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:t.label}),o.jsxs(Vt,{value:String(e??t.default),onValueChange:n,disabled:t.disabled,children:[o.jsx($t,{children:o.jsx(Ut,{placeholder:t.placeholder??"请选择"})}),o.jsx(Ht,{children:t.choices?.map(i=>o.jsx(De,{value:String(i),children:String(i)},String(i)))})]}),t.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:t.hint})]});case"textarea":return o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:t.label}),o.jsx(Nr,{value:e??t.default,onChange:i=>n(i.target.value),placeholder:t.placeholder,rows:t.rows??3,disabled:t.disabled}),t.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:t.hint})]});case"password":return o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:t.label}),o.jsxs("div",{className:"relative",children:[o.jsx(Pe,{type:r?"text":"password",value:e??"",onChange:i=>n(i.target.value),placeholder:t.placeholder,disabled:t.disabled,className:"pr-10"}),o.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>s(!r),children:r?o.jsx(I0,{className:"h-4 w-4"}):o.jsx(Ji,{className:"h-4 w-4"})})]}),t.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:t.hint})]});case"text":default:return o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:t.label}),o.jsx(Pe,{type:"text",value:e??t.default??"",onChange:i=>n(i.target.value),placeholder:t.placeholder,maxLength:t.max_length,disabled:t.disabled}),t.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:t.hint})]})}}function Bz({section:t,config:e,onChange:n}){const[r,s]=b.useState(!t.collapsed),i=Object.entries(t.fields).filter(([,a])=>!a.hidden).sort(([,a],[,l])=>a.order-l.order);return o.jsx(hj,{open:r,onOpenChange:s,children:o.jsxs(Lt,{children:[o.jsx(fj,{asChild:!0,children:o.jsxs(En,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[r?o.jsx(Xc,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(Zl,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(_n,{className:"text-lg",children:t.title})]}),o.jsxs(tn,{variant:"secondary",className:"text-xs",children:[i.length," 项"]})]}),t.description&&o.jsx(Wr,{className:"ml-6",children:t.description})]})}),o.jsx(mj,{children:o.jsx(Xn,{className:"space-y-4 pt-0",children:i.map(([a,l])=>o.jsx(KAe,{field:l,value:e[t.name]?.[a],onChange:c=>n(t.name,a,c),sectionName:t.name},a))})})]})})}function ZAe({plugin:t,onBack:e}){const{toast:n}=Lr(),[r,s]=b.useState(null),[i,a]=b.useState({}),[l,c]=b.useState({}),[d,h]=b.useState(!0),[m,g]=b.useState(!1),[x,y]=b.useState(!1),[w,S]=b.useState(!1),k=b.useCallback(async()=>{h(!0);try{const[D,q]=await Promise.all([PAe(t.id),zAe(t.id)]);s(D),a(q),c(JSON.parse(JSON.stringify(q)))}catch(D){n({title:"加载配置失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}finally{h(!1)}},[t.id,n]);b.useEffect(()=>{k()},[k]),b.useEffect(()=>{y(JSON.stringify(i)!==JSON.stringify(l))},[i,l]);const j=(D,q,B)=>{a(H=>({...H,[D]:{...H[D]||{},[q]:B}}))},N=async()=>{g(!0);try{await IAe(t.id,i),c(JSON.parse(JSON.stringify(i))),n({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(D){n({title:"保存失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}finally{g(!1)}},T=async()=>{try{await LAe(t.id),n({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),S(!1),k()}catch(D){n({title:"重置失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}},E=async()=>{try{const D=await BAe(t.id);n({title:D.message,description:D.note}),k()}catch(D){n({title:"切换状态失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}};if(d)return o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx(Us,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!r)return o.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[o.jsx(Lo,{className:"h-12 w-12 text-muted-foreground"}),o.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),o.jsxs(ue,{onClick:e,variant:"outline",children:[o.jsx(Bv,{className:"h-4 w-4 mr-2"}),"返回"]})]});const _=Object.values(r.sections).sort((D,q)=>D.order-q.order),A=i.plugin?.enabled!==!1;return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(ue,{variant:"ghost",size:"icon",onClick:e,children:o.jsx(Bv,{className:"h-5 w-5"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:r.plugin_info.name||t.manifest.name}),o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[o.jsx(tn,{variant:A?"default":"secondary",children:A?"已启用":"已禁用"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",r.plugin_info.version||t.manifest.version]})]})]})]}),o.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[o.jsxs(ue,{variant:"outline",size:"sm",onClick:E,children:[o.jsx(Dp,{className:"h-4 w-4 mr-2"}),A?"禁用":"启用"]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>S(!0),children:[o.jsx(zj,{className:"h-4 w-4 mr-2"}),"重置"]}),o.jsxs(ue,{size:"sm",onClick:N,disabled:!x||m,children:[m?o.jsx(Us,{className:"h-4 w-4 mr-2 animate-spin"}):o.jsx(zp,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),x&&o.jsx(Lt,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:o.jsx(Xn,{className:"py-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Xi,{className:"h-4 w-4 text-orange-600"}),o.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),r.layout.type==="tabs"&&r.layout.tabs.length>0?o.jsxs(Yi,{defaultValue:r.layout.tabs[0]?.id,children:[o.jsx(ji,{children:r.layout.tabs.map(D=>o.jsxs(Bt,{value:D.id,children:[D.title,D.badge&&o.jsx(tn,{variant:"secondary",className:"ml-2 text-xs",children:D.badge})]},D.id))}),r.layout.tabs.map(D=>o.jsx(ln,{value:D.id,className:"space-y-4 mt-4",children:D.sections.map(q=>{const B=r.sections[q];return B?o.jsx(Bz,{section:B,config:i,onChange:j},q):null})},D.id))]}):o.jsx("div",{className:"space-y-4",children:_.map(D=>o.jsx(Bz,{section:D,config:i,onChange:j},D.name))}),o.jsx(Er,{open:w,onOpenChange:S,children:o.jsxs(wr,{children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"确认重置配置"}),o.jsx(Xr,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),o.jsxs(fs,{children:[o.jsx(ue,{variant:"outline",onClick:()=>S(!1),children:"取消"}),o.jsx(ue,{variant:"destructive",onClick:T,children:"确认重置"})]})]})})]})}function JAe(){const{toast:t}=Lr(),[e,n]=b.useState([]),[r,s]=b.useState(!0),[i,a]=b.useState(""),[l,c]=b.useState(null),d=async()=>{s(!0);try{const x=await v0();n(x)}catch(x){t({title:"加载插件列表失败",description:x instanceof Error?x.message:"未知错误",variant:"destructive"})}finally{s(!1)}};b.useEffect(()=>{d()},[]);const h=e.filter(x=>{const y=i.toLowerCase();return x.id.toLowerCase().includes(y)||x.manifest.name.toLowerCase().includes(y)||x.manifest.description?.toLowerCase().includes(y)}),m=e.length,g=0;return l?o.jsx(pn,{className:"h-full",children:o.jsx("div",{className:"p-4 sm:p-6",children:o.jsx(ZAe,{plugin:l,onBack:()=>c(null)})})}):o.jsx(pn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),o.jsxs(ue,{variant:"outline",size:"sm",onClick:d,children:[o.jsx(Qs,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),"刷新"]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[o.jsxs(Lt,{children:[o.jsxs(En,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(_n,{className:"text-sm font-medium",children:"已安装插件"}),o.jsx(ed,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(Xn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:e.length}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r?"正在加载...":"个插件"})]})]}),o.jsxs(Lt,{children:[o.jsxs(En,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(_n,{className:"text-sm font-medium",children:"已启用"}),o.jsx(Ya,{className:"h-4 w-4 text-green-600"})]}),o.jsxs(Xn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:m}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),o.jsxs(Lt,{children:[o.jsxs(En,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(_n,{className:"text-sm font-medium",children:"已禁用"}),o.jsx(Lo,{className:"h-4 w-4 text-orange-600"})]}),o.jsxs(Xn,{children:[o.jsx("div",{className:"text-2xl font-bold",children:g}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]})]}),o.jsxs("div",{className:"relative",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索插件...",value:i,onChange:x=>a(x.target.value),className:"pl-9"})]}),o.jsxs(Lt,{children:[o.jsxs(En,{children:[o.jsx(_n,{children:"已安装的插件"}),o.jsx(Wr,{children:"点击插件查看和编辑配置"})]}),o.jsx(Xn,{children:r?o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(Us,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):h.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[o.jsx(ed,{className:"h-16 w-16 text-muted-foreground/50"}),o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:i?"没有找到匹配的插件":"暂无已安装的插件"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:i?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):o.jsx("div",{className:"space-y-2",children:h.map(x=>o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>c(x),children:[o.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[o.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:o.jsx(ed,{className:"h-5 w-5 text-primary"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h3",{className:"font-medium truncate",children:x.manifest.name}),o.jsxs(tn,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",x.manifest.version]})]}),o.jsx("p",{className:"text-sm text-muted-foreground truncate",children:x.manifest.description||"暂无描述"})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx(ue,{variant:"ghost",size:"sm",children:o.jsx(Vc,{className:"h-4 w-4"})}),o.jsx(Zl,{className:"h-4 w-4 text-muted-foreground"})]})]},x.id))})})]})]})})}function eMe(){const t=na(),{toast:e}=Lr(),[n,r]=b.useState([]),[s,i]=b.useState(!0),[a,l]=b.useState(null),[c,d]=b.useState(null),[h,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S=b.useCallback(async()=>{try{i(!0),l(null);const A=localStorage.getItem("access-token"),D=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${A}`}});if(!D.ok)throw new Error("获取镜像源列表失败");const q=await D.json();r(q.mirrors||[])}catch(A){const D=A instanceof Error?A.message:"加载镜像源失败";l(D),e({title:"加载失败",description:D,variant:"destructive"})}finally{i(!1)}},[e]);b.useEffect(()=>{S()},[S]);const k=async()=>{try{const A=localStorage.getItem("access-token"),D=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"},body:JSON.stringify(y)});if(!D.ok){const q=await D.json();throw new Error(q.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),m(!1),w({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S()}catch(A){e({title:"添加失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},j=async()=>{if(c)try{const A=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${c.id}`,{method:"PUT",headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"},body:JSON.stringify({name:y.name,raw_prefix:y.raw_prefix,clone_prefix:y.clone_prefix,enabled:y.enabled,priority:y.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),x(!1),d(null),S()}catch(A){e({title:"更新失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},N=async A=>{if(confirm("确定要删除这个镜像源吗?"))try{const D=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A}`,{method:"DELETE",headers:{Authorization:`Bearer ${D}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),S()}catch(D){e({title:"删除失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}},T=async A=>{try{const D=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",headers:{Authorization:`Bearer ${D}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!A.enabled})})).ok)throw new Error("更新状态失败");S()}catch(D){e({title:"更新失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}},E=A=>{d(A),w({id:A.id,name:A.name,raw_prefix:A.raw_prefix,clone_prefix:A.clone_prefix,enabled:A.enabled,priority:A.priority}),x(!0)},_=async(A,D)=>{const q=D==="up"?A.priority-1:A.priority+1;if(!(q<1))try{const B=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",headers:{Authorization:`Bearer ${B}`,"Content-Type":"application/json"},body:JSON.stringify({priority:q})})).ok)throw new Error("更新优先级失败");S()}catch(B){e({title:"更新失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}};return o.jsx(pn,{className:"h-full",children:o.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:o.jsx(Bv,{className:"h-5 w-5"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),o.jsxs(ue,{onClick:()=>m(!0),children:[o.jsx(Is,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?o.jsx(Lt,{className:"p-6",children:o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(Us,{className:"h-8 w-8 animate-spin text-primary"})})}):a?o.jsx(Lt,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Ga,{className:"h-12 w-12 text-destructive mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:a}),o.jsx(ue,{onClick:S,children:"重新加载"})]})}):o.jsxs(Lt,{children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(Af,{children:[o.jsx(Mf,{children:o.jsxs(zs,{children:[o.jsx(mn,{children:"状态"}),o.jsx(mn,{children:"名称"}),o.jsx(mn,{children:"ID"}),o.jsx(mn,{children:"优先级"}),o.jsx(mn,{className:"text-right",children:"操作"})]})}),o.jsx(Rf,{children:n.map(A=>o.jsxs(zs,{children:[o.jsx(Yt,{children:o.jsx(Ft,{checked:A.enabled,onCheckedChange:()=>T(A)})}),o.jsx(Yt,{children:o.jsxs("div",{children:[o.jsx("div",{className:"font-medium",children:A.name}),o.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",A.raw_prefix]})]})}),o.jsx(Yt,{children:o.jsx(tn,{variant:"outline",children:A.id})}),o.jsx(Yt,{children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-mono",children:A.priority}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx(ue,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>_(A,"up"),disabled:A.priority===1,children:o.jsx(B0,{className:"h-3 w-3"})}),o.jsx(ue,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>_(A,"down"),children:o.jsx(Xc,{className:"h-3 w-3"})})]})]})}),o.jsx(Yt,{className:"text-right",children:o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[o.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>E(A),children:o.jsx(Ju,{className:"h-4 w-4"})}),o.jsx(ue,{variant:"ghost",size:"icon",onClick:()=>N(A.id),children:o.jsx(Cn,{className:"h-4 w-4 text-destructive"})})]})})]},A.id))})]})}),o.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(A=>o.jsx(Lt,{className:"p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h3",{className:"font-semibold",children:A.name}),A.enabled&&o.jsx(tn,{variant:"default",className:"text-xs",children:"启用"})]}),o.jsx(tn,{variant:"outline",className:"mt-1 text-xs",children:A.id})]}),o.jsx(Ft,{checked:A.enabled,onCheckedChange:()=>T(A)})]}),o.jsxs("div",{className:"text-sm space-y-1",children:[o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"Raw: "}),o.jsx("span",{className:"break-all",children:A.raw_prefix})]}),o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"优先级: "}),o.jsx("span",{className:"font-mono",children:A.priority})]})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[o.jsxs(ue,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>E(A),children:[o.jsx(Ju,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>_(A,"up"),disabled:A.priority===1,children:o.jsx(B0,{className:"h-4 w-4"})}),o.jsx(ue,{variant:"outline",size:"sm",onClick:()=>_(A,"down"),children:o.jsx(Xc,{className:"h-4 w-4"})}),o.jsx(ue,{variant:"destructive",size:"sm",onClick:()=>N(A.id),children:o.jsx(Cn,{className:"h-4 w-4"})})]})]})},A.id))})]}),o.jsx(Er,{open:h,onOpenChange:m,children:o.jsxs(wr,{className:"max-w-lg",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"添加镜像源"}),o.jsx(Xr,{children:"添加新的 Git 镜像源配置"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-id",children:"镜像源 ID *"}),o.jsx(Pe,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:A=>w({...y,id:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-name",children:"名称 *"}),o.jsx(Pe,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:A=>w({...y,name:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),o.jsx(Pe,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:A=>w({...y,raw_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-clone",children:"克隆前缀 *"}),o.jsx(Pe,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:A=>w({...y,clone_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"add-priority",children:"优先级"}),o.jsx(Pe,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:A=>w({...y,priority:parseInt(A.target.value)||1})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"add-enabled",checked:y.enabled,onCheckedChange:A=>w({...y,enabled:A})}),o.jsx(he,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),o.jsxs(fs,{children:[o.jsx(ue,{variant:"outline",onClick:()=>m(!1),children:"取消"}),o.jsx(ue,{onClick:k,children:"添加"})]})]})}),o.jsx(Er,{open:g,onOpenChange:x,children:o.jsxs(wr,{className:"max-w-lg",children:[o.jsxs(Sr,{children:[o.jsx(kr,{children:"编辑镜像源"}),o.jsx(Xr,{children:"修改镜像源配置"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{children:"镜像源 ID"}),o.jsx(Pe,{value:y.id,disabled:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-name",children:"名称 *"}),o.jsx(Pe,{id:"edit-name",value:y.name,onChange:A=>w({...y,name:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),o.jsx(Pe,{id:"edit-raw",value:y.raw_prefix,onChange:A=>w({...y,raw_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-clone",children:"克隆前缀 *"}),o.jsx(Pe,{id:"edit-clone",value:y.clone_prefix,onChange:A=>w({...y,clone_prefix:A.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(he,{htmlFor:"edit-priority",children:"优先级"}),o.jsx(Pe,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:A=>w({...y,priority:parseInt(A.target.value)||1})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ft,{id:"edit-enabled",checked:y.enabled,onCheckedChange:A=>w({...y,enabled:A})}),o.jsx(he,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),o.jsxs(fs,{children:[o.jsx(ue,{variant:"outline",onClick:()=>x(!1),children:"取消"}),o.jsx(ue,{onClick:j,children:"保存"})]})]})})]})})}function tMe(t,e=[]){let n=[];function r(i,a){const l=b.createContext(a);l.displayName=i+"Context";const c=n.length;n=[...n,a];const d=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[c]||l,S=b.useMemo(()=>y,Object.values(y));return o.jsx(w.Provider,{value:S,children:x})};d.displayName=i+"Provider";function h(m,g){const x=g?.[t]?.[c]||l,y=b.useContext(x);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[d,h]}const s=()=>{const i=n.map(a=>b.createContext(a));return function(l){const c=l?.[t]||i;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,nMe(s,...e)]}function nMe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((l,{useScope:c,scopeName:d})=>{const m=c(i)[`__scope${d}`];return{...l,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var rMe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],S7=rMe.reduce((t,e)=>{const n=Vy(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),sMe=bJ();function iMe(){return sMe.useSyncExternalStore(aMe,()=>!0,()=>!1)}function aMe(){return()=>{}}var k7="Avatar",[oMe]=tMe(k7),[lMe,bX]=oMe(k7),wX=b.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[s,i]=b.useState("idle");return o.jsx(lMe,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:o.jsx(S7.span,{...r,ref:e})})});wX.displayName=k7;var SX="AvatarImage",kX=b.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:s=()=>{},...i}=t,a=bX(SX,n),l=cMe(r,i),c=Rs(d=>{s(d),a.onImageLoadingStatusChange(d)});return Wh(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?o.jsx(S7.img,{...i,ref:e,src:r}):null});kX.displayName=SX;var OX="AvatarFallback",jX=b.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...s}=t,i=bX(OX,n),[a,l]=b.useState(r===void 0);return b.useEffect(()=>{if(r!==void 0){const c=window.setTimeout(()=>l(!0),r);return()=>window.clearTimeout(c)}},[r]),a&&i.imageLoadingStatus!=="loaded"?o.jsx(S7.span,{...s,ref:e}):null});jX.displayName=OX;function Fz(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function cMe(t,{referrerPolicy:e,crossOrigin:n}){const r=iMe(),s=b.useRef(null),i=r?(s.current||(s.current=new window.Image),s.current):null,[a,l]=b.useState(()=>Fz(i,t));return Wh(()=>{l(Fz(i,t))},[i,t]),Wh(()=>{const c=m=>()=>{l(m)};if(!i)return;const d=c("loaded"),h=c("error");return i.addEventListener("load",d),i.addEventListener("error",h),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",d),i.removeEventListener("error",h)}},[i,n,e]),a}var NX=wX,CX=kX,TX=jX;const Pv=b.forwardRef(({className:t,...e},n)=>o.jsx(NX,{ref:n,className:xe("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));Pv.displayName=NX.displayName;const uMe=b.forwardRef(({className:t,...e},n)=>o.jsx(CX,{ref:n,className:xe("aspect-square h-full w-full",t),...e}));uMe.displayName=CX.displayName;const zv=b.forwardRef(({className:t,...e},n)=>o.jsx(TX,{ref:n,className:xe("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));zv.displayName=TX.displayName;function dMe(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function hMe(){const t="maibot_webui_user_id";let e=localStorage.getItem(t);return e||(e=dMe(),localStorage.setItem(t,e)),e}function fMe(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function mMe(t){localStorage.setItem("maibot_webui_user_name",t)}function pMe(){const[t,e]=b.useState([]),[n,r]=b.useState(""),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,d]=b.useState(!1),[h,m]=b.useState(!0),[g,x]=b.useState(fMe()),[y,w]=b.useState(!1),[S,k]=b.useState(""),[j,N]=b.useState({}),T=b.useRef(hMe()),E=b.useRef(null),_=b.useRef(null),A=b.useRef(null),D=b.useRef(0),q=b.useRef(new Set),{toast:B}=Lr(),H=z=>(D.current+=1,`${z}-${Date.now()}-${D.current}-${Math.random().toString(36).substr(2,9)}`),W=b.useCallback(()=>{_.current?.scrollIntoView({behavior:"smooth"})},[]);b.useEffect(()=>{W()},[t,W]);const ee=b.useCallback(async()=>{m(!0);try{const z=`/api/chat/history?user_id=${T.current}&limit=50`;console.log("[Chat] 正在加载历史消息:",z);const U=await fetch(z);if(console.log("[Chat] 历史消息响应状态:",U.status,U.statusText),console.log("[Chat] 响应 Content-Type:",U.headers.get("content-type")),U.ok){const te=await U.text();console.log("[Chat] 响应内容前100字符:",te.substring(0,100));try{const ne=JSON.parse(te);if(console.log("[Chat] 解析后的数据:",ne),ne.messages&&ne.messages.length>0){const G=ne.messages.map(se=>({id:se.id,type:se.type,content:se.content,timestamp:se.timestamp,sender:{name:se.sender_name||(se.is_bot?"麦麦":"WebUI用户"),user_id:se.user_id,is_bot:se.is_bot}}));e(G),console.log("[Chat] 已加载历史消息数量:",G.length),G.forEach(se=>{if(se.type==="bot"){const re=`bot-${se.content}-${Math.floor(se.timestamp*1e3)}`;q.current.add(re)}})}else console.log("[Chat] 没有历史消息")}catch(ne){console.error("[Chat] JSON 解析失败:",ne),console.error("[Chat] 原始响应内容:",te)}}else{console.error("[Chat] 响应失败:",U.status);const te=await U.text();console.error("[Chat] 错误响应内容:",te.substring(0,200))}}catch(z){console.error("[Chat] 加载历史消息失败:",z)}finally{m(!1)}},[]),I=b.useCallback(()=>{if(E.current?.readyState===WebSocket.OPEN||E.current?.readyState===WebSocket.CONNECTING){console.log("WebSocket 已存在,跳过连接");return}l(!0);const U=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/chat/ws?user_id=${encodeURIComponent(T.current)}&user_name=${encodeURIComponent(g)}`;console.log("正在连接 WebSocket:",U);try{const te=new WebSocket(U);E.current=te,te.onopen=()=>{i(!0),l(!1),console.log("WebSocket 已连接")},te.onmessage=ne=>{try{const G=JSON.parse(ne.data);switch(G.type){case"session_info":N({session_id:G.session_id,user_id:G.user_id,user_name:G.user_name,bot_name:G.bot_name});break;case"system":e(se=>[...se,{id:H("sys"),type:"system",content:G.content||"",timestamp:G.timestamp||Date.now()/1e3}]);break;case"user_message":e(se=>[...se,{id:G.message_id||H("user"),type:"user",content:G.content||"",timestamp:G.timestamp||Date.now()/1e3,sender:G.sender}]);break;case"bot_message":{d(!1);const se=`bot-${G.content}-${Math.floor((G.timestamp||0)*1e3)}`;if(q.current.has(se)){console.log("跳过重复的机器人消息");break}if(q.current.add(se),q.current.size>100){const re=q.current.values().next().value;re&&q.current.delete(re)}e(re=>[...re,{id:H("bot"),type:"bot",content:G.content||"",timestamp:G.timestamp||Date.now()/1e3,sender:G.sender}]);break}case"typing":d(G.is_typing||!1);break;case"error":e(se=>[...se,{id:H("error"),type:"error",content:G.content||"发生错误",timestamp:G.timestamp||Date.now()/1e3}]),B({title:"错误",description:G.content,variant:"destructive"});break;case"pong":break;default:console.log("未知消息类型:",G.type)}}catch(G){console.error("解析消息失败:",G)}},te.onclose=()=>{i(!1),l(!1),E.current=null,console.log("WebSocket 已断开"),A.current&&clearTimeout(A.current),A.current=window.setTimeout(()=>{V.current||I()},5e3)},te.onerror=ne=>{console.error("WebSocket 错误:",ne),l(!1)}}catch(te){console.error("创建 WebSocket 失败:",te),l(!1)}},[B,g]),V=b.useRef(!1);b.useEffect(()=>{V.current=!1,ee();const z=setTimeout(()=>{V.current||I()},100),U=setInterval(()=>{E.current?.readyState===WebSocket.OPEN&&E.current.send(JSON.stringify({type:"ping"}))},3e4);return()=>{V.current=!0,clearTimeout(z),clearInterval(U),A.current&&(clearTimeout(A.current),A.current=null),E.current&&(E.current.close(),E.current=null)}},[I,ee]);const L=b.useCallback(()=>{!n.trim()||!E.current||E.current.readyState!==WebSocket.OPEN||(E.current.send(JSON.stringify({type:"message",content:n.trim(),user_name:g})),r(""))},[n,g]),$=z=>{z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),L())},K=()=>{k(g),w(!0)},Y=()=>{const z=S.trim()||"WebUI用户";x(z),mMe(z),w(!1),E.current?.readyState===WebSocket.OPEN&&E.current.send(JSON.stringify({type:"update_nickname",user_name:z}))},R=()=>{k(""),w(!1)},ie=z=>new Date(z*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),X=()=>{E.current&&E.current.close(),I()};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"shrink-0 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[o.jsx(Pv,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:o.jsx(zv,{className:"bg-primary/10 text-primary",children:o.jsx(o0,{className:"h-4 w-4 sm:h-5 sm:w-5"})})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h1",{className:"text-base sm:text-lg font-semibold truncate",children:j.bot_name||"麦麦"}),o.jsx("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:s?o.jsxs(o.Fragment,{children:[o.jsx(ote,{className:"h-3 w-3 text-green-500"}),o.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):a?o.jsxs(o.Fragment,{children:[o.jsx(Us,{className:"h-3 w-3 animate-spin"}),o.jsx("span",{children:"连接中..."})]}):o.jsxs(o.Fragment,{children:[o.jsx(lte,{className:"h-3 w-3 text-red-500"}),o.jsx("span",{className:"text-red-600 dark:text-red-400",children:"未连接"})]})})]})]}),o.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h&&o.jsx(Us,{className:"h-4 w-4 animate-spin text-muted-foreground"}),o.jsx(ue,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:X,disabled:a,title:"重新连接",children:o.jsx(Qs,{className:xe("h-4 w-4",a&&"animate-spin")})})]})]}),o.jsxs("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:[o.jsx(Lv,{className:"h-3 w-3"}),o.jsx("span",{children:"当前身份:"}),y?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{value:S,onChange:z=>k(z.target.value),onKeyDown:z=>{z.key==="Enter"&&Y(),z.key==="Escape"&&R()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),o.jsx(ue,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:Y,children:"保存"}),o.jsx(ue,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:R,children:"取消"})]}):o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"font-medium text-foreground",children:g}),o.jsx(ue,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:K,title:"修改昵称",children:o.jsx(cte,{className:"h-3 w-3"})})]})]})]})}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(pn,{className:"h-full",children:o.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[t.length===0&&!h&&o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[o.jsx(o0,{className:"h-12 w-12 mb-4 opacity-50"}),o.jsxs("p",{className:"text-sm",children:["开始与 ",j.bot_name||"麦麦"," 对话吧!"]})]}),t.map(z=>o.jsxs("div",{className:xe("flex gap-2 sm:gap-3",z.type==="user"&&"flex-row-reverse",z.type==="system"&&"justify-center",z.type==="error"&&"justify-center"),children:[z.type==="system"&&o.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:z.content}),z.type==="error"&&o.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 px-3 py-1 rounded-full max-w-[90%]",children:z.content}),(z.type==="user"||z.type==="bot")&&o.jsxs(o.Fragment,{children:[o.jsx(Pv,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:o.jsx(zv,{className:xe("text-xs",z.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:z.type==="bot"?o.jsx(o0,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):o.jsx(Lv,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),o.jsxs("div",{className:xe("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",z.type==="user"&&"items-end"),children:[o.jsxs("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[o.jsx("span",{className:"hidden sm:inline",children:z.sender?.name||(z.type==="bot"?j.bot_name:g)}),o.jsx("span",{children:ie(z.timestamp)})]}),o.jsx("div",{className:xe("rounded-2xl px-3 py-2 text-sm whitespace-pre-wrap break-words",z.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:z.content})]})]})]},z.id)),c&&o.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[o.jsx(Pv,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:o.jsx(zv,{className:"bg-primary/10 text-primary",children:o.jsx(o0,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),o.jsx("div",{className:"bg-muted rounded-2xl rounded-tl-sm px-4 py-3",children:o.jsxs("div",{className:"flex gap-1",children:[o.jsx("span",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),o.jsx("span",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),o.jsx("span",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})})]}),o.jsx("div",{ref:_})]})})}),o.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{value:n,onChange:z=>r(z.target.value),onKeyDown:$,placeholder:s?"输入消息...":"等待连接...",disabled:!s,className:"flex-1 h-10 sm:h-10"}),o.jsx(ue,{onClick:L,disabled:!s||!n.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:o.jsx(ute,{className:"h-4 w-4"})})]})})})]})}const gMe=kf("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"}}),EX=b.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>o.jsx("kbd",{className:xe(gMe({size:e,className:t})),ref:i,...s,children:n?o.jsx("abbr",{title:n,children:r}):r}));EX.displayName="Kbd";const xMe=[{icon:L0,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Po,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:CI,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:TI,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Ij,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Gh,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:EI,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:dte,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:ed,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Fv,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Vc,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function vMe({open:t,onOpenChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState(0),a=na(),l=xMe.filter(h=>h.title.toLowerCase().includes(n.toLowerCase())||h.description.toLowerCase().includes(n.toLowerCase())||h.category.toLowerCase().includes(n.toLowerCase()));b.useEffect(()=>{t&&(r(""),i(0))},[t]);const c=b.useCallback(h=>{a({to:h}),e(!1)},[a,e]),d=b.useCallback(h=>{h.key==="ArrowDown"?(h.preventDefault(),i(m=>(m+1)%l.length)):h.key==="ArrowUp"?(h.preventDefault(),i(m=>(m-1+l.length)%l.length)):h.key==="Enter"&&l[s]&&(h.preventDefault(),c(l[s].path))},[l,s,c]);return o.jsx(Er,{open:t,onOpenChange:e,children:o.jsxs(wr,{className:"max-w-2xl p-0 gap-0",children:[o.jsxs(Sr,{className:"px-4 pt-4 pb-0",children:[o.jsx(kr,{className:"sr-only",children:"搜索"}),o.jsxs("div",{className:"relative",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),o.jsx(Pe,{value:n,onChange:h=>{r(h.target.value),i(0)},onKeyDown:d,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),o.jsx("div",{className:"border-t",children:o.jsx(pn,{className:"h-[400px]",children:l.length>0?o.jsx("div",{className:"p-2",children:l.map((h,m)=>{const g=h.icon;return o.jsxs("button",{onClick:()=>c(h.path),onMouseEnter:()=>i(m),className:xe("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",m===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[o.jsx(g,{className:"h-5 w-5 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium text-sm",children:h.title}),o.jsx("div",{className:"text-xs text-muted-foreground truncate",children:h.description})]}),o.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:h.category})]},h.path)})}):o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o.jsx(ii,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),o.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function yMe(t){const e=bMe(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,l=b.Children.toArray(i),c=l.find(SMe);if(c){const d=c.props.children,h=l.map(m=>m===c?b.Children.count(d)>1?b.Children.only(null):b.isValidElement(d)?d.props.children:null:m);return o.jsx(e,{...a,ref:s,children:b.isValidElement(d)?b.cloneElement(d,void 0,h):null})}return o.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function bMe(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=OMe(s),l=kMe(i,s.props);return s.type!==b.Fragment&&(l.ref=r?Gc(r,a):a),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var wMe=Symbol("radix.slottable");function SMe(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===wMe}function kMe(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function OMe(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 pj=["Enter"," "],jMe=["ArrowDown","PageUp","Home"],_X=["ArrowUp","PageDown","End"],NMe=[...jMe,..._X],CMe={ltr:[...pj,"ArrowRight"],rtl:[...pj,"ArrowLeft"]},TMe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Tg="Menu",[_p,EMe,_Me]=Qy(Tg),[Cd,AX]=Da(Tg,[_Me,vf,sb]),Eg=vf(),MX=sb(),[RX,gu]=Cd(Tg),[AMe,_g]=Cd(Tg),DX=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:a=!0}=t,l=Eg(e),[c,d]=b.useState(null),h=b.useRef(!1),m=Rs(i),g=Rp(s);return b.useEffect(()=>{const x=()=>{h.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>h.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),o.jsx(Yy,{...l,children:o.jsx(RX,{scope:e,open:n,onOpenChange:m,content:c,onContentChange:d,children:o.jsx(AMe,{scope:e,onClose:b.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:h,dir:g,modal:a,children:r})})})};DX.displayName=Tg;var MMe="MenuAnchor",O7=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Eg(n);return o.jsx(Ky,{...s,...r,ref:e})});O7.displayName=MMe;var j7="MenuPortal",[RMe,PX]=Cd(j7,{forceMount:void 0}),zX=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=gu(j7,e);return o.jsx(RMe,{scope:e,forceMount:n,children:o.jsx(oi,{present:n||i.open,children:o.jsx(Xy,{asChild:!0,container:s,children:r})})})};zX.displayName=j7;var _a="MenuContent",[DMe,N7]=Cd(_a),IX=b.forwardRef((t,e)=>{const n=PX(_a,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=gu(_a,t.__scopeMenu),a=_g(_a,t.__scopeMenu);return o.jsx(_p.Provider,{scope:t.__scopeMenu,children:o.jsx(oi,{present:r||i.open,children:o.jsx(_p.Slot,{scope:t.__scopeMenu,children:a.modal?o.jsx(PMe,{...s,ref:e}):o.jsx(zMe,{...s,ref:e})})})})}),PMe=b.forwardRef((t,e)=>{const n=gu(_a,t.__scopeMenu),r=b.useRef(null),s=er(e,r);return b.useEffect(()=>{const i=r.current;if(i)return gI(i)},[]),o.jsx(C7,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:nt(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),zMe=b.forwardRef((t,e)=>{const n=gu(_a,t.__scopeMenu);return o.jsx(C7,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),IMe=yMe("MenuContent.ScrollLock"),C7=b.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:g,onDismiss:x,disableOutsideScroll:y,...w}=t,S=gu(_a,n),k=_g(_a,n),j=Eg(n),N=MX(n),T=EMe(n),[E,_]=b.useState(null),A=b.useRef(null),D=er(e,A,S.onContentChange),q=b.useRef(0),B=b.useRef(""),H=b.useRef(0),W=b.useRef(null),ee=b.useRef("right"),I=b.useRef(0),V=y?xI:b.Fragment,L=y?{as:IMe,allowPinchZoom:!0}:void 0,$=Y=>{const R=B.current+Y,ie=T().filter(G=>!G.disabled),X=document.activeElement,z=ie.find(G=>G.ref.current===X)?.textValue,U=ie.map(G=>G.textValue),te=XMe(U,R,z),ne=ie.find(G=>G.textValue===te)?.ref.current;(function G(se){B.current=se,window.clearTimeout(q.current),se!==""&&(q.current=window.setTimeout(()=>G(""),1e3))})(R),ne&&setTimeout(()=>ne.focus())};b.useEffect(()=>()=>window.clearTimeout(q.current),[]),vI();const K=b.useCallback(Y=>ee.current===W.current?.side&&KMe(Y,W.current?.area),[]);return o.jsx(DMe,{scope:n,searchRef:B,onItemEnter:b.useCallback(Y=>{K(Y)&&Y.preventDefault()},[K]),onItemLeave:b.useCallback(Y=>{K(Y)||(A.current?.focus(),_(null))},[K]),onTriggerLeave:b.useCallback(Y=>{K(Y)&&Y.preventDefault()},[K]),pointerGraceTimerRef:H,onPointerGraceIntentChange:b.useCallback(Y=>{W.current=Y},[]),children:o.jsx(V,{...L,children:o.jsx(yI,{asChild:!0,trapped:s,onMountAutoFocus:nt(i,Y=>{Y.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:o.jsx(Rj,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:g,onDismiss:x,children:o.jsx(vL,{asChild:!0,...N,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:_,onEntryFocus:nt(c,Y=>{k.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(Dj,{role:"menu","aria-orientation":"vertical","data-state":eY(S.open),"data-radix-menu-content":"",dir:k.dir,...j,...w,ref:D,style:{outline:"none",...w.style},onKeyDown:nt(w.onKeyDown,Y=>{const ie=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,X=Y.ctrlKey||Y.altKey||Y.metaKey,z=Y.key.length===1;ie&&(Y.key==="Tab"&&Y.preventDefault(),!X&&z&&$(Y.key));const U=A.current;if(Y.target!==U||!NMe.includes(Y.key))return;Y.preventDefault();const ne=T().filter(G=>!G.disabled).map(G=>G.ref.current);_X.includes(Y.key)&&ne.reverse(),WMe(ne)}),onBlur:nt(t.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(q.current),B.current="")}),onPointerMove:nt(t.onPointerMove,Ap(Y=>{const R=Y.target,ie=I.current!==Y.clientX;if(Y.currentTarget.contains(R)&&ie){const X=Y.clientX>I.current?"right":"left";ee.current=X,I.current=Y.clientX}}))})})})})})})});IX.displayName=_a;var LMe="MenuGroup",T7=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(Sn.div,{role:"group",...r,ref:e})});T7.displayName=LMe;var BMe="MenuLabel",LX=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(Sn.div,{...r,ref:e})});LX.displayName=BMe;var Fy="MenuItem",qz="menu.itemSelect",lw=b.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=b.useRef(null),a=_g(Fy,t.__scopeMenu),l=N7(Fy,t.__scopeMenu),c=er(e,i),d=b.useRef(!1),h=()=>{const m=i.current;if(!n&&m){const g=new CustomEvent(qz,{bubbles:!0,cancelable:!0});m.addEventListener(qz,x=>r?.(x),{once:!0}),wI(m,g),g.defaultPrevented?d.current=!1:a.onClose()}};return o.jsx(BX,{...s,ref:c,disabled:n,onClick:nt(t.onClick,h),onPointerDown:m=>{t.onPointerDown?.(m),d.current=!0},onPointerUp:nt(t.onPointerUp,m=>{d.current||m.currentTarget?.click()}),onKeyDown:nt(t.onKeyDown,m=>{const g=l.searchRef.current!=="";n||g&&m.key===" "||pj.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});lw.displayName=Fy;var BX=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,a=N7(Fy,n),l=MX(n),c=b.useRef(null),d=er(e,c),[h,m]=b.useState(!1),[g,x]=b.useState("");return b.useEffect(()=>{const y=c.current;y&&x((y.textContent??"").trim())},[i.children]),o.jsx(_p.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:o.jsx(yL,{asChild:!0,...l,focusable:!r,children:o.jsx(Sn.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:d,onPointerMove:nt(t.onPointerMove,Ap(y=>{r?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:nt(t.onPointerLeave,Ap(y=>a.onItemLeave(y))),onFocus:nt(t.onFocus,()=>m(!0)),onBlur:nt(t.onBlur,()=>m(!1))})})})}),FMe="MenuCheckboxItem",FX=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return o.jsx(VX,{scope:t.__scopeMenu,checked:n,children:o.jsx(lw,{role:"menuitemcheckbox","aria-checked":qy(n)?"mixed":n,...s,ref:e,"data-state":A7(n),onSelect:nt(s.onSelect,()=>r?.(qy(n)?!0:!n),{checkForDefaultPrevented:!1})})})});FX.displayName=FMe;var qX="MenuRadioGroup",[qMe,$Me]=Cd(qX,{value:void 0,onValueChange:()=>{}}),$X=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=Rs(r);return o.jsx(qMe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:o.jsx(T7,{...s,ref:e})})});$X.displayName=qX;var HX="MenuRadioItem",QX=b.forwardRef((t,e)=>{const{value:n,...r}=t,s=$Me(HX,t.__scopeMenu),i=n===s.value;return o.jsx(VX,{scope:t.__scopeMenu,checked:i,children:o.jsx(lw,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":A7(i),onSelect:nt(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});QX.displayName=HX;var E7="MenuItemIndicator",[VX,HMe]=Cd(E7,{checked:!1}),UX=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=HMe(E7,n);return o.jsx(oi,{present:r||qy(i.checked)||i.checked===!0,children:o.jsx(Sn.span,{...s,ref:e,"data-state":A7(i.checked)})})});UX.displayName=E7;var QMe="MenuSeparator",WX=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(Sn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});WX.displayName=QMe;var VMe="MenuArrow",GX=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Eg(n);return o.jsx(Pj,{...s,...r,ref:e})});GX.displayName=VMe;var _7="MenuSub",[UMe,XX]=Cd(_7),YX=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=gu(_7,e),a=Eg(e),[l,c]=b.useState(null),[d,h]=b.useState(null),m=Rs(s);return b.useEffect(()=>(i.open===!1&&m(!1),()=>m(!1)),[i.open,m]),o.jsx(Yy,{...a,children:o.jsx(RX,{scope:e,open:r,onOpenChange:m,content:d,onContentChange:h,children:o.jsx(UMe,{scope:e,contentId:Gi(),triggerId:Gi(),trigger:l,onTriggerChange:c,children:n})})})};YX.displayName=_7;var y0="MenuSubTrigger",KX=b.forwardRef((t,e)=>{const n=gu(y0,t.__scopeMenu),r=_g(y0,t.__scopeMenu),s=XX(y0,t.__scopeMenu),i=N7(y0,t.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,d={__scopeMenu:t.__scopeMenu},h=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>h,[h]),b.useEffect(()=>{const m=l.current;return()=>{window.clearTimeout(m),c(null)}},[l,c]),o.jsx(O7,{asChild:!0,...d,children:o.jsx(BX,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":eY(n.open),...t,ref:Gc(e,s.onTriggerChange),onClick:m=>{t.onClick?.(m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:nt(t.onPointerMove,Ap(m=>{i.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),h()},100))})),onPointerLeave:nt(t.onPointerLeave,Ap(m=>{h();const g=n.content?.getBoundingClientRect();if(g){const x=n.content?.dataset.side,y=x==="right",w=y?-5:5,S=g[y?"left":"right"],k=g[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+w,y:m.clientY},{x:S,y:g.top},{x:k,y:g.top},{x:k,y:g.bottom},{x:S,y:g.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:nt(t.onKeyDown,m=>{const g=i.searchRef.current!=="";t.disabled||g&&m.key===" "||CMe[r.dir].includes(m.key)&&(n.onOpenChange(!0),n.content?.focus(),m.preventDefault())})})})});KX.displayName=y0;var ZX="MenuSubContent",JX=b.forwardRef((t,e)=>{const n=PX(_a,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=gu(_a,t.__scopeMenu),a=_g(_a,t.__scopeMenu),l=XX(ZX,t.__scopeMenu),c=b.useRef(null),d=er(e,c);return o.jsx(_p.Provider,{scope:t.__scopeMenu,children:o.jsx(oi,{present:r||i.open,children:o.jsx(_p.Slot,{scope:t.__scopeMenu,children:o.jsx(C7,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:d,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{a.isUsingKeyboardRef.current&&c.current?.focus(),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:nt(t.onFocusOutside,h=>{h.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:nt(t.onEscapeKeyDown,h=>{a.onClose(),h.preventDefault()}),onKeyDown:nt(t.onKeyDown,h=>{const m=h.currentTarget.contains(h.target),g=TMe[a.dir].includes(h.key);m&&g&&(i.onOpenChange(!1),l.trigger?.focus(),h.preventDefault())})})})})})});JX.displayName=ZX;function eY(t){return t?"open":"closed"}function qy(t){return t==="indeterminate"}function A7(t){return qy(t)?"indeterminate":t?"checked":"unchecked"}function WMe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function GMe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function XMe(t,e,n){const s=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=GMe(t,Math.max(i,0));s.length===1&&(a=a.filter(d=>d!==n));const c=a.find(d=>d.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function YMe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-d)*(r-h)/(g-h)+d&&(s=!s)}return s}function KMe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return YMe(n,e)}function Ap(t){return e=>e.pointerType==="mouse"?t(e):void 0}var ZMe=DX,JMe=O7,eRe=zX,tRe=IX,nRe=T7,rRe=LX,sRe=lw,iRe=FX,aRe=$X,oRe=QX,lRe=UX,cRe=WX,uRe=GX,dRe=YX,hRe=KX,fRe=JX,M7="ContextMenu",[mRe]=Da(M7,[AX]),Xs=AX(),[pRe,tY]=mRe(M7),nY=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[a,l]=b.useState(!1),c=Xs(e),d=Rs(r),h=b.useCallback(m=>{l(m),d(m)},[d]);return o.jsx(pRe,{scope:e,open:a,onOpenChange:h,modal:i,children:o.jsx(ZMe,{...c,dir:s,open:a,onOpenChange:h,modal:i,children:n})})};nY.displayName=M7;var rY="ContextMenuTrigger",sY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=tY(rY,n),a=Xs(n),l=b.useRef({x:0,y:0}),c=b.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=b.useRef(0),h=b.useCallback(()=>window.clearTimeout(d.current),[]),m=g=>{l.current={x:g.clientX,y:g.clientY},i.onOpenChange(!0)};return b.useEffect(()=>h,[h]),b.useEffect(()=>void(r&&h()),[r,h]),o.jsxs(o.Fragment,{children:[o.jsx(JMe,{...a,virtualRef:c}),o.jsx(Sn.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:nt(t.onContextMenu,g=>{h(),m(g),g.preventDefault()}),onPointerDown:r?t.onPointerDown:nt(t.onPointerDown,tv(g=>{h(),d.current=window.setTimeout(()=>m(g),700)})),onPointerMove:r?t.onPointerMove:nt(t.onPointerMove,tv(h)),onPointerCancel:r?t.onPointerCancel:nt(t.onPointerCancel,tv(h)),onPointerUp:r?t.onPointerUp:nt(t.onPointerUp,tv(h))})]})});sY.displayName=rY;var gRe="ContextMenuPortal",iY=t=>{const{__scopeContextMenu:e,...n}=t,r=Xs(e);return o.jsx(eRe,{...r,...n})};iY.displayName=gRe;var aY="ContextMenuContent",oY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=tY(aY,n),i=Xs(n),a=b.useRef(!1);return o.jsx(tRe,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{t.onCloseAutoFocus?.(l),!l.defaultPrevented&&a.current&&l.preventDefault(),a.current=!1},onInteractOutside:l=>{t.onInteractOutside?.(l),!l.defaultPrevented&&!s.modal&&(a.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});oY.displayName=aY;var xRe="ContextMenuGroup",vRe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Xs(n);return o.jsx(nRe,{...s,...r,ref:e})});vRe.displayName=xRe;var yRe="ContextMenuLabel",lY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Xs(n);return o.jsx(rRe,{...s,...r,ref:e})});lY.displayName=yRe;var bRe="ContextMenuItem",cY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Xs(n);return o.jsx(sRe,{...s,...r,ref:e})});cY.displayName=bRe;var wRe="ContextMenuCheckboxItem",uY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Xs(n);return o.jsx(iRe,{...s,...r,ref:e})});uY.displayName=wRe;var SRe="ContextMenuRadioGroup",kRe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Xs(n);return o.jsx(aRe,{...s,...r,ref:e})});kRe.displayName=SRe;var ORe="ContextMenuRadioItem",dY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Xs(n);return o.jsx(oRe,{...s,...r,ref:e})});dY.displayName=ORe;var jRe="ContextMenuItemIndicator",hY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Xs(n);return o.jsx(lRe,{...s,...r,ref:e})});hY.displayName=jRe;var NRe="ContextMenuSeparator",fY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Xs(n);return o.jsx(cRe,{...s,...r,ref:e})});fY.displayName=NRe;var CRe="ContextMenuArrow",TRe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Xs(n);return o.jsx(uRe,{...s,...r,ref:e})});TRe.displayName=CRe;var mY="ContextMenuSub",pY=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,a=Xs(e),[l,c]=Kl({prop:s,defaultProp:i??!1,onChange:r,caller:mY});return o.jsx(dRe,{...a,open:l,onOpenChange:c,children:n})};pY.displayName=mY;var ERe="ContextMenuSubTrigger",gY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Xs(n);return o.jsx(hRe,{...s,...r,ref:e})});gY.displayName=ERe;var _Re="ContextMenuSubContent",xY=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Xs(n);return o.jsx(fRe,{...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)"}})});xY.displayName=_Re;function tv(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var ARe=nY,MRe=sY,RRe=iY,vY=oY,yY=lY,bY=cY,wY=uY,SY=dY,kY=hY,OY=fY,DRe=pY,jY=gY,NY=xY;const PRe=ARe,zRe=MRe,IRe=DRe,CY=b.forwardRef(({className:t,inset:e,children:n,...r},s)=>o.jsxs(jY,{ref:s,className:xe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,o.jsx(Zl,{className:"ml-auto h-4 w-4"})]}));CY.displayName=jY.displayName;const TY=b.forwardRef(({className:t,...e},n)=>o.jsx(NY,{ref:n,className:xe("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}));TY.displayName=NY.displayName;const EY=b.forwardRef(({className:t,...e},n)=>o.jsx(RRe,{children:o.jsx(vY,{ref:n,className:xe("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})}));EY.displayName=vY.displayName;const $a=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(bY,{ref:r,className:xe("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}));$a.displayName=bY.displayName;const LRe=b.forwardRef(({className:t,children:e,checked:n,...r},s)=>o.jsxs(wY,{ref:s,className:xe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(kY,{children:o.jsx(zo,{className:"h-4 w-4"})})}),e]}));LRe.displayName=wY.displayName;const BRe=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(SY,{ref:r,className:xe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(kY,{children:o.jsx(hte,{className:"h-2 w-2 fill-current"})})}),e]}));BRe.displayName=SY.displayName;const FRe=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(yY,{ref:r,className:xe("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));FRe.displayName=yY.displayName;const b0=b.forwardRef(({className:t,...e},n)=>o.jsx(OY,{ref:n,className:xe("-mx-1 my-1 h-px bg-border",t),...e}));b0.displayName=OY.displayName;const Ch=({className:t,...e})=>o.jsx("span",{className:xe("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});Ch.displayName="ContextMenuShortcut";var qRe=Symbol("radix.slottable");function $Re(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=qRe,e}var[cw]=Da("Tooltip",[vf]),uw=vf(),_Y="TooltipProvider",HRe=700,gj="tooltip.open",[QRe,R7]=cw(_Y),AY=t=>{const{__scopeTooltip:e,delayDuration:n=HRe,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,a=b.useRef(!0),l=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),o.jsx(QRe,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:b.useCallback(d=>{l.current=d},[]),disableHoverableContent:s,children:i})};AY.displayName=_Y;var Mp="Tooltip",[VRe,Ag]=cw(Mp),MY=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=t,c=R7(Mp,t.__scopeTooltip),d=uw(e),[h,m]=b.useState(null),g=Gi(),x=b.useRef(0),y=a??c.disableHoverableContent,w=l??c.delayDuration,S=b.useRef(!1),[k,j]=Kl({prop:r,defaultProp:s??!1,onChange:A=>{A?(c.onOpen(),document.dispatchEvent(new CustomEvent(gj))):c.onClose(),i?.(A)},caller:Mp}),N=b.useMemo(()=>k?S.current?"delayed-open":"instant-open":"closed",[k]),T=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,S.current=!1,j(!0)},[j]),E=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,j(!1)},[j]),_=b.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,j(!0),x.current=0},w)},[w,j]);return b.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),o.jsx(Yy,{...d,children:o.jsx(VRe,{scope:e,contentId:g,open:k,stateAttribute:N,trigger:h,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?_():T()},[c.isOpenDelayedRef,_,T]),onTriggerLeave:b.useCallback(()=>{y?E():(window.clearTimeout(x.current),x.current=0)},[E,y]),onOpen:T,onClose:E,disableHoverableContent:y,children:n})})};MY.displayName=Mp;var xj="TooltipTrigger",RY=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Ag(xj,n),i=R7(xj,n),a=uw(n),l=b.useRef(null),c=er(e,l,s.onTriggerChange),d=b.useRef(!1),h=b.useRef(!1),m=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(Ky,{asChild:!0,...a,children:o.jsx(Sn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:nt(t.onPointerMove,g=>{g.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),h.current=!0)}),onPointerLeave:nt(t.onPointerLeave,()=>{s.onTriggerLeave(),h.current=!1}),onPointerDown:nt(t.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:nt(t.onFocus,()=>{d.current||s.onOpen()}),onBlur:nt(t.onBlur,s.onClose),onClick:nt(t.onClick,s.onClose)})})});RY.displayName=xj;var D7="TooltipPortal",[URe,WRe]=cw(D7,{forceMount:void 0}),DY=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=Ag(D7,e);return o.jsx(URe,{scope:e,forceMount:n,children:o.jsx(oi,{present:n||i.open,children:o.jsx(Xy,{asChild:!0,container:s,children:r})})})};DY.displayName=D7;var xf="TooltipContent",PY=b.forwardRef((t,e)=>{const n=WRe(xf,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=Ag(xf,t.__scopeTooltip);return o.jsx(oi,{present:r||a.open,children:a.disableHoverableContent?o.jsx(zY,{side:s,...i,ref:e}):o.jsx(GRe,{side:s,...i,ref:e})})}),GRe=b.forwardRef((t,e)=>{const n=Ag(xf,t.__scopeTooltip),r=R7(xf,t.__scopeTooltip),s=b.useRef(null),i=er(e,s),[a,l]=b.useState(null),{trigger:c,onClose:d}=n,h=s.current,{onPointerInTransitChange:m}=r,g=b.useCallback(()=>{l(null),m(!1)},[m]),x=b.useCallback((y,w)=>{const S=y.currentTarget,k={x:y.clientX,y:y.clientY},j=JRe(k,S.getBoundingClientRect()),N=eDe(k,j),T=tDe(w.getBoundingClientRect()),E=rDe([...N,...T]);l(E),m(!0)},[m]);return b.useEffect(()=>()=>g(),[g]),b.useEffect(()=>{if(c&&h){const y=S=>x(S,h),w=S=>x(S,c);return c.addEventListener("pointerleave",y),h.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",y),h.removeEventListener("pointerleave",w)}}},[c,h,x,g]),b.useEffect(()=>{if(a){const y=w=>{const S=w.target,k={x:w.clientX,y:w.clientY},j=c?.contains(S)||h?.contains(S),N=!nDe(k,a);j?g():N&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,h,a,d,g]),o.jsx(zY,{...t,ref:i})}),[XRe,YRe]=cw(Mp,{isInside:!1}),KRe=$Re("TooltipContent"),zY=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=t,c=Ag(xf,n),d=uw(n),{onClose:h}=c;return b.useEffect(()=>(document.addEventListener(gj,h),()=>document.removeEventListener(gj,h)),[h]),b.useEffect(()=>{if(c.trigger){const m=g=>{g.target?.contains(c.trigger)&&h()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,h]),o.jsx(Rj,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:h,children:o.jsxs(Dj,{"data-state":c.stateAttribute,...d,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(KRe,{children:r}),o.jsx(XRe,{scope:n,isInside:!0,children:o.jsx(Iee,{id:c.contentId,role:"tooltip",children:s||r})})]})})});PY.displayName=xf;var IY="TooltipArrow",ZRe=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=uw(n);return YRe(IY,n).isInside?null:o.jsx(Pj,{...s,...r,ref:e})});ZRe.displayName=IY;function JRe(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 eDe(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 tDe(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 nDe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-d)*(r-h)/(g-h)+d&&(s=!s)}return s}function rDe(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),sDe(e)}function sDe(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var iDe=AY,aDe=MY,oDe=RY,lDe=DY,LY=PY;const cDe=iDe,uDe=aDe,dDe=oDe,BY=b.forwardRef(({className:t,sideOffset:e=4,...n},r)=>o.jsx(lDe,{children:o.jsx(LY,{ref:r,sideOffset:e,className:xe("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})}));BY.displayName=LY.displayName;function hDe({children:t}){mie();const[e,n]=b.useState(!0),[r,s]=b.useState(!1),[i,a]=b.useState(!1),{theme:l,setTheme:c}=Kj(),d=wJ(),h=na();b.useEffect(()=>{const w=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),a(!0))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[]);const m=[{title:"概览",items:[{icon:L0,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Po,label:"麦麦主程序配置",path:"/config/bot"},{icon:CI,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:TI,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:E9,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Ij,label:"表情包管理",path:"/resource/emoji"},{icon:Gh,label:"表达方式管理",path:"/resource/expression"},{icon:EI,label:"人物信息管理",path:"/resource/person"},{icon:NI,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:ed,label:"插件市场",path:"/plugins"},{icon:E9,label:"插件配置",path:"/plugin-config"},{icon:Fv,label:"日志查看器",path:"/logs"},{icon:Gh,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:Vc,label:"系统设置",path:"/settings"}]}],x=l==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":l,y=()=>{localStorage.removeItem("access-token"),h({to:"/auth"})};return o.jsx(cDe,{delayDuration:300,children:o.jsxs("div",{className:"flex h-screen overflow-hidden",children:[o.jsxs("aside",{className:xe("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[o.jsx("div",{className:"flex h-16 items-center border-b px-4",children:o.jsxs("div",{className:xe("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[o.jsxs("div",{className:xe("flex items-baseline gap-2",!e&&"lg:hidden"),children:[o.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),o.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:Qse()})]}),!e&&o.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),o.jsx(pn,{className:xe("flex-1 overflow-x-hidden",!e&&"lg:w-16"),children:o.jsx("nav",{className:xe("p-4",!e&&"lg:p-2 lg:w-16"),children:o.jsx("ul",{className:xe("space-y-6",!e&&"lg:space-y-3 lg:w-full"),children:m.map((w,S)=>o.jsxs("li",{children:[o.jsx("div",{className:xe("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:o.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:w.title})}),!e&&S>0&&o.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),o.jsx("ul",{className:"space-y-1",children:w.items.map(k=>{const j=d({to:k.path}),N=k.icon,T=o.jsxs(o.Fragment,{children:[j&&o.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),o.jsxs("div",{className:xe("flex items-center transition-all duration-300",e?"gap-3":"gap-3 lg:gap-0"),children:[o.jsx(N,{className:xe("h-5 w-5 flex-shrink-0",j&&"text-primary"),strokeWidth:2,fill:"none"}),o.jsx("span",{className:xe("text-sm font-medium whitespace-nowrap transition-all duration-300",j&&"font-semibold",e?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:k.label})]})]});return o.jsx("li",{className:"relative",children:o.jsxs(uDe,{children:[o.jsx(dDe,{asChild:!0,children:o.jsx(rv,{to:k.path,"data-tour":k.tourId,className:xe("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",j?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>s(!1),children:T})}),!e&&o.jsx(BY,{side:"right",className:"hidden lg:block",children:o.jsx("p",{children:k.label})})]})},k.path)})})]},w.title))})})})]}),r&&o.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),o.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[o.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:o.jsx(fte,{className:"h-5 w-5"})}),o.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:o.jsx(wd,{className:xe("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{onClick:()=>a(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),o.jsxs(EX,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[o.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),o.jsx(vMe,{open:i,onOpenChange:a}),o.jsxs(ue,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[o.jsx(mte,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),o.jsx("button",{onClick:w=>{Dse(x==="dark"?"light":"dark",c,w)},className:"rounded-lg p-2 hover:bg-accent",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?o.jsx(ik,{className:"h-5 w-5"}):o.jsx(ak,{className:"h-5 w-5"})}),o.jsx("div",{className:"h-6 w-px bg-border"}),o.jsxs(ue,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[o.jsx(_9,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),o.jsxs(PRe,{children:[o.jsx(zRe,{asChild:!0,children:o.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),o.jsxs(EY,{className:"w-64",children:[o.jsxs($a,{onClick:()=>h({to:"/"}),children:[o.jsx(L0,{className:"mr-2 h-4 w-4"}),"首页"]}),o.jsxs($a,{onClick:()=>h({to:"/settings"}),children:[o.jsx(Vc,{className:"mr-2 h-4 w-4"}),"系统设置"]}),o.jsxs($a,{onClick:()=>h({to:"/logs"}),children:[o.jsx(Fv,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),o.jsx(b0,{}),o.jsxs(IRe,{children:[o.jsxs(CY,{children:[o.jsx(kI,{className:"mr-2 h-4 w-4"}),"切换主题"]}),o.jsxs(TY,{className:"w-48",children:[o.jsxs($a,{onClick:()=>c("light"),disabled:l==="light",children:[o.jsx(ik,{className:"mr-2 h-4 w-4"}),"浅色",l==="light"&&o.jsx(Ch,{children:"✓"})]}),o.jsxs($a,{onClick:()=>c("dark"),disabled:l==="dark",children:[o.jsx(ak,{className:"mr-2 h-4 w-4"}),"深色",l==="dark"&&o.jsx(Ch,{children:"✓"})]}),o.jsxs($a,{onClick:()=>c("system"),disabled:l==="system",children:[o.jsx(Vc,{className:"mr-2 h-4 w-4"}),"跟随系统",l==="system"&&o.jsx(Ch,{children:"✓"})]})]})]}),o.jsx(b0,{}),o.jsxs($a,{onClick:()=>window.location.reload(),children:[o.jsx(pte,{className:"mr-2 h-4 w-4"}),"刷新页面",o.jsx(Ch,{children:"⌘R"})]}),o.jsxs($a,{onClick:()=>a(!0),children:[o.jsx(ii,{className:"mr-2 h-4 w-4"}),"搜索",o.jsx(Ch,{children:"⌘K"})]}),o.jsx(b0,{}),o.jsxs($a,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[o.jsx(w0,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),o.jsx(b0,{}),o.jsxs($a,{onClick:y,className:"text-destructive focus:text-destructive",children:[o.jsx(_9,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}function fDe(t){const e=t.split(` +`).slice(1),n=[];for(const r of e){const s=r.trim();if(!s.startsWith("at "))continue;const i=s.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);i?n.push({functionName:i[1]||"",fileName:i[2],lineNumber:i[3],columnNumber:i[4],raw:s}):n.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:s})}return n}function mDe({error:t,errorInfo:e}){const[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),c=t.stack?fDe(t.stack):[],d=async()=>{const h=` Error: ${t.name} Message: ${t.message} @@ -404,4 +404,4 @@ ${e?.componentStack||"No component stack available"} URL: ${window.location.href} User Agent: ${navigator.userAgent} Time: ${new Date().toISOString()} - `.trim();try{await navigator.clipboard.writeText(h),l(!0),setTimeout(()=>l(!1),2e3)}catch(m){console.error("Failed to copy:",m)}};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs(ga,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[o.jsx(Wa,{className:"h-4 w-4"}),o.jsxs(xa,{className:"font-mono text-sm",children:[o.jsxs("span",{className:"font-semibold",children:[t.name,":"]})," ",t.message]})]}),c.length>0&&o.jsxs(Pz,{open:n,onOpenChange:r,children:[o.jsx(zz,{asChild:!0,children:o.jsxs(de,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[o.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[o.jsx(mte,{className:"h-4 w-4"}),"Stack Trace (",c.length," frames)"]}),n?o.jsx(P0,{className:"h-4 w-4"}):o.jsx(nd,{className:"h-4 w-4"})]})}),o.jsx(Iz,{children:o.jsx(gn,{className:"h-[280px] rounded-md border bg-muted/30",children:o.jsx("div",{className:"p-3 space-y-1",children:c.map((h,m)=>o.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[m+1,"."]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-primary font-medium",children:h.functionName}),h.fileName&&o.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[h.fileName,h.lineNumber&&o.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",h.lineNumber,":",h.columnNumber]})]})]})]})},m))})})})]}),e?.componentStack&&o.jsxs(Pz,{open:s,onOpenChange:i,children:[o.jsx(zz,{asChild:!0,children:o.jsxs(de,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[o.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[o.jsx(Wa,{className:"h-4 w-4"}),"Component Stack"]}),s?o.jsx(P0,{className:"h-4 w-4"}):o.jsx(nd,{className:"h-4 w-4"})]})}),o.jsx(Iz,{children:o.jsx(gn,{className:"h-[200px] rounded-md border bg-muted/30",children:o.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:e.componentStack})})})]}),o.jsx(de,{variant:"outline",size:"sm",onClick:d,className:"w-full",children:a?o.jsxs(o.Fragment,{children:[o.jsx(Ro,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):o.jsxs(o.Fragment,{children:[o.jsx(Mv,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function zY({error:t,errorInfo:e}){const n=()=>{window.location.href="/"},r=()=>{window.location.reload()};return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:o.jsxs(qt,{className:"w-full max-w-2xl shadow-lg",children:[o.jsxs(Fn,{className:"text-center pb-2",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:o.jsx(Wa,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),o.jsx(qn,{className:"text-2xl font-bold",children:"页面出现了问题"}),o.jsx(ts,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),o.jsxs(Gn,{className:"space-y-4",children:[o.jsx(rDe,{error:t,errorInfo:e}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[o.jsxs(de,{onClick:r,className:"flex-1",children:[o.jsx(Ps,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),o.jsxs(de,{onClick:n,variant:"outline",className:"flex-1",children:[o.jsx(D0,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),o.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class sDe extends b.Component{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("ErrorBoundary caught an error:",e,n),this.setState({errorInfo:n})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:o.jsx(zY,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function IY({error:t}){return o.jsx(zY,{error:t,errorInfo:null})}const Cg=yJ({component:()=>o.jsxs(o.Fragment,{children:[o.jsx(Bz,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!CB())throw wJ({to:"/auth"})}}),iDe=ms({getParentRoute:()=>Cg,path:"/auth",component:die}),aDe=ms({getParentRoute:()=>Cg,path:"/setup",component:Die}),Xs=ms({getParentRoute:()=>Cg,id:"protected",component:()=>o.jsx(KRe,{children:o.jsx(Bz,{})}),errorComponent:({error:t})=>o.jsx(IY,{error:t})}),oDe=ms({getParentRoute:()=>Xs,path:"/",component:kse}),lDe=ms({getParentRoute:()=>Xs,path:"/config/bot",component:M0e}),cDe=ms({getParentRoute:()=>Xs,path:"/config/modelProvider",component:Zxe}),uDe=ms({getParentRoute:()=>Xs,path:"/config/model",component:Hve}),dDe=ms({getParentRoute:()=>Xs,path:"/config/adapter",component:Vve}),hDe=ms({getParentRoute:()=>Xs,path:"/resource/emoji",component:pOe}),fDe=ms({getParentRoute:()=>Xs,path:"/resource/expression",component:NOe}),mDe=ms({getParentRoute:()=>Xs,path:"/resource/person",component:IOe}),pDe=ms({getParentRoute:()=>Xs,path:"/resource/knowledge-graph",component:CTe}),gDe=ms({getParentRoute:()=>Xs,path:"/logs",component:vAe}),xDe=ms({getParentRoute:()=>Xs,path:"/chat",component:eMe}),vDe=ms({getParentRoute:()=>Xs,path:"/plugins",component:IAe}),yDe=ms({getParentRoute:()=>Xs,path:"/plugin-config",component:LAe}),bDe=ms({getParentRoute:()=>Xs,path:"/plugin-mirrors",component:BAe}),wDe=ms({getParentRoute:()=>Xs,path:"/settings",component:rie}),SDe=ms({getParentRoute:()=>Cg,path:"*",component:_B}),kDe=Cg.addChildren([iDe,aDe,Xs.addChildren([oDe,lDe,cDe,uDe,dDe,hDe,fDe,mDe,pDe,vDe,yDe,bDe,gDe,xDe,wDe]),SDe]),ODe=bJ({routeTree:kDe,defaultNotFoundComponent:_B,defaultErrorComponent:({error:t})=>o.jsx(IY,{error:t})});function jDe({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=b.useState(()=>localStorage.getItem(n)||e);b.useEffect(()=>{const l=window.document.documentElement;if(l.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";l.classList.add(c);return}l.classList.add(s)},[s]),b.useEffect(()=>{const l=localStorage.getItem("accent-color");if(l){const c=document.documentElement,h={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[l];h&&(c.style.setProperty("--primary",h.hsl),h.gradient?(c.style.setProperty("--primary-gradient",h.gradient),c.classList.add("has-gradient")):(c.style.removeProperty("--primary-gradient"),c.classList.remove("has-gradient")))}},[]);const a={theme:s,setTheme:l=>{localStorage.setItem(n,l),i(l)}};return o.jsx(KL.Provider,{...r,value:a,children:t})}function NDe({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,a]=b.useState(()=>{const h=localStorage.getItem(r);return h!==null?h==="true":e}),[l,c]=b.useState(()=>{const h=localStorage.getItem(s);return h!==null?h==="true":n});b.useEffect(()=>{const h=document.documentElement;i?h.classList.remove("no-animations"):h.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),b.useEffect(()=>{localStorage.setItem(s,String(l))},[l,s]);const d={enableAnimations:i,setEnableAnimations:a,enableWavesBackground:l,setEnableWavesBackground:c};return o.jsx(ZL.Provider,{value:d,children:t})}var E7="ToastProvider",[_7,CDe,TDe]=By("Toast"),[LY]=Ra("Toast",[TDe]),[EDe,ow]=LY(E7),BY=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=t,[l,c]=b.useState(null),[d,h]=b.useState(0),m=b.useRef(!1),g=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${E7}\`. Expected non-empty \`string\`.`),o.jsx(_7.Provider,{scope:e,children:o.jsx(EDe,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:b.useCallback(()=>h(x=>x+1),[]),onToastRemove:b.useCallback(()=>h(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:a})})};BY.displayName=E7;var FY="ToastViewport",_De=["F8"],hj="toast.viewportPause",fj="toast.viewportResume",qY=b.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=_De,label:s="Notifications ({hotkey})",...i}=t,a=ow(FY,n),l=CDe(n),c=b.useRef(null),d=b.useRef(null),h=b.useRef(null),m=b.useRef(null),g=Yn(e,m,a.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;b.useEffect(()=>{const S=k=>{r.length!==0&&r.every(N=>k[N]||k.code===N)&&m.current?.focus()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[r]),b.useEffect(()=>{const S=c.current,k=m.current;if(y&&S&&k){const j=()=>{if(!a.isClosePausedRef.current){const _=new CustomEvent(hj);k.dispatchEvent(_),a.isClosePausedRef.current=!0}},N=()=>{if(a.isClosePausedRef.current){const _=new CustomEvent(fj);k.dispatchEvent(_),a.isClosePausedRef.current=!1}},T=_=>{!S.contains(_.relatedTarget)&&N()},E=()=>{S.contains(document.activeElement)||N()};return S.addEventListener("focusin",j),S.addEventListener("focusout",T),S.addEventListener("pointermove",j),S.addEventListener("pointerleave",E),window.addEventListener("blur",j),window.addEventListener("focus",N),()=>{S.removeEventListener("focusin",j),S.removeEventListener("focusout",T),S.removeEventListener("pointermove",j),S.removeEventListener("pointerleave",E),window.removeEventListener("blur",j),window.removeEventListener("focus",N)}}},[y,a.isClosePausedRef]);const w=b.useCallback(({tabbingDirection:S})=>{const j=l().map(N=>{const T=N.ref.current,E=[T,...HDe(T)];return S==="forwards"?E:E.reverse()});return(S==="forwards"?j.reverse():j).flat()},[l]);return b.useEffect(()=>{const S=m.current;if(S){const k=j=>{const N=j.altKey||j.ctrlKey||j.metaKey;if(j.key==="Tab"&&!N){const E=document.activeElement,_=j.shiftKey;if(j.target===S&&_){d.current?.focus();return}const P=w({tabbingDirection:_?"backwards":"forwards"}),B=P.findIndex($=>$===E);J3(P.slice(B+1))?j.preventDefault():_?d.current?.focus():h.current?.focus()}};return S.addEventListener("keydown",k),()=>S.removeEventListener("keydown",k)}},[l,w]),o.jsxs(Pee,{ref:c,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&o.jsx(mj,{ref:d,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"forwards"});J3(S)}}),o.jsx(_7.Slot,{scope:n,children:o.jsx(xn.ol,{tabIndex:-1,...i,ref:g})}),y&&o.jsx(mj,{ref:h,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"backwards"});J3(S)}})]})});qY.displayName=FY;var $Y="ToastFocusProxy",mj=b.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=ow($Y,n);return o.jsx(vI,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{const l=a.relatedTarget;!i.viewport?.contains(l)&&r()}})});mj.displayName=$Y;var Tg="Toast",ADe="toast.swipeStart",MDe="toast.swipeMove",RDe="toast.swipeCancel",DDe="toast.swipeEnd",HY=b.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=t,[l,c]=Xl({prop:r,defaultProp:s??!0,onChange:i,caller:Tg});return o.jsx(ii,{present:n||l,children:o.jsx(IDe,{open:l,...a,ref:e,onClose:()=>c(!1),onPause:Rs(t.onPause),onResume:Rs(t.onResume),onSwipeStart:nt(t.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:nt(t.onSwipeMove,d=>{const{x:h,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${h}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:nt(t.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:nt(t.onSwipeEnd,d=>{const{x:h,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${h}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),c(!1)})})})});HY.displayName=Tg;var[PDe,zDe]=LY(Tg,{onClose(){}}),IDe=b.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:h,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:x,...y}=t,w=ow(Tg,n),[S,k]=b.useState(null),j=Yn(e,z=>k(z)),N=b.useRef(null),T=b.useRef(null),E=s||w.duration,_=b.useRef(0),A=b.useRef(E),L=b.useRef(0),{onToastAdd:P,onToastRemove:B}=w,$=Rs(()=>{S?.contains(document.activeElement)&&w.viewport?.focus(),a()}),U=b.useCallback(z=>{!z||z===1/0||(window.clearTimeout(L.current),_.current=new Date().getTime(),L.current=window.setTimeout($,z))},[$]);b.useEffect(()=>{const z=w.viewport;if(z){const Q=()=>{U(A.current),d?.()},F=()=>{const Y=new Date().getTime()-_.current;A.current=A.current-Y,window.clearTimeout(L.current),c?.()};return z.addEventListener(hj,F),z.addEventListener(fj,Q),()=>{z.removeEventListener(hj,F),z.removeEventListener(fj,Q)}}},[w.viewport,E,c,d,U]),b.useEffect(()=>{i&&!w.isClosePausedRef.current&&U(E)},[i,E,w.isClosePausedRef,U]),b.useEffect(()=>(P(),()=>B()),[P,B]);const te=b.useMemo(()=>S?YY(S):null,[S]);return w.viewport?o.jsxs(o.Fragment,{children:[te&&o.jsx(LDe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:te}),o.jsx(PDe,{scope:n,onClose:$,children:pa.createPortal(o.jsx(_7.ItemSlot,{scope:n,children:o.jsx(zee,{asChild:!0,onEscapeKeyDown:nt(l,()=>{w.isFocusedToastEscapeKeyDownRef.current||$(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:o.jsx(xn.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":w.swipeDirection,...y,ref:j,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:nt(t.onKeyDown,z=>{z.key==="Escape"&&(l?.(z.nativeEvent),z.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:nt(t.onPointerDown,z=>{z.button===0&&(N.current={x:z.clientX,y:z.clientY})}),onPointerMove:nt(t.onPointerMove,z=>{if(!N.current)return;const Q=z.clientX-N.current.x,F=z.clientY-N.current.y,Y=!!T.current,J=["left","right"].includes(w.swipeDirection),X=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,R=J?X(0,Q):0,ie=J?0:X(0,F),G=z.pointerType==="touch"?10:2,I={x:R,y:ie},V={originalEvent:z,delta:I};Y?(T.current=I,Z1(MDe,m,V,{discrete:!1})):Lz(I,w.swipeDirection,G)?(T.current=I,Z1(ADe,h,V,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(Q)>G||Math.abs(F)>G)&&(N.current=null)}),onPointerUp:nt(t.onPointerUp,z=>{const Q=T.current,F=z.target;if(F.hasPointerCapture(z.pointerId)&&F.releasePointerCapture(z.pointerId),T.current=null,N.current=null,Q){const Y=z.currentTarget,J={originalEvent:z,delta:Q};Lz(Q,w.swipeDirection,w.swipeThreshold)?Z1(DDe,x,J,{discrete:!0}):Z1(RDe,g,J,{discrete:!0}),Y.addEventListener("click",X=>X.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),LDe=t=>{const{__scopeToast:e,children:n,...r}=t,s=ow(Tg,e),[i,a]=b.useState(!1),[l,c]=b.useState(!1);return qDe(()=>a(!0)),b.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:o.jsx(Qy,{asChild:!0,children:o.jsx(vI,{...r,children:i&&o.jsxs(o.Fragment,{children:[s.label," ",n]})})})},BDe="ToastTitle",QY=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});QY.displayName=BDe;var FDe="ToastDescription",VY=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});VY.displayName=FDe;var UY="ToastAction",WY=b.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?o.jsx(XY,{altText:n,asChild:!0,children:o.jsx(A7,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${UY}\`. Expected non-empty \`string\`.`),null)});WY.displayName=UY;var GY="ToastClose",A7=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=zDe(GY,n);return o.jsx(XY,{asChild:!0,children:o.jsx(xn.button,{type:"button",...r,ref:e,onClick:nt(t.onClick,s.onClose)})})});A7.displayName=GY;var XY=b.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return o.jsx(xn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function YY(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),$De(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=r.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...YY(r))}}),e}function Z1(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?xI(s,i):s.dispatchEvent(i)}var Lz=(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 qDe(t=()=>{}){const e=Rs(t);Uh(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function $De(t){return t.nodeType===t.ELEMENT_NODE}function HDe(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 J3(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var QDe=BY,KY=qY,ZY=HY,JY=QY,eK=VY,tK=WY,nK=A7;const VDe=QDe,rK=b.forwardRef(({className:t,...e},n)=>o.jsx(KY,{ref:n,className:xe("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",t),...e}));rK.displayName=KY.displayName;const UDe=kf("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),sK=b.forwardRef(({className:t,variant:e,...n},r)=>o.jsx(ZY,{ref:r,className:xe(UDe({variant:e}),t),...n}));sK.displayName=ZY.displayName;const WDe=b.forwardRef(({className:t,...e},n)=>o.jsx(tK,{ref:n,className:xe("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}));WDe.displayName=tK.displayName;const iK=b.forwardRef(({className:t,...e},n)=>o.jsx(nK,{ref:n,className:xe("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:o.jsx(_p,{className:"h-4 w-4"})}));iK.displayName=nK.displayName;const aK=b.forwardRef(({className:t,...e},n)=>o.jsx(JY,{ref:n,className:xe("text-sm font-semibold [&+div]:text-xs",t),...e}));aK.displayName=JY.displayName;const oK=b.forwardRef(({className:t,...e},n)=>o.jsx(eK,{ref:n,className:xe("text-sm opacity-90",t),...e}));oK.displayName=eK.displayName;function GDe(){const{toasts:t}=as();return o.jsxs(VDe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return o.jsxs(sK,{...i,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(aK,{children:n}),r&&o.jsx(oK,{children:r})]}),s,o.jsx(iK,{})]},e)}),o.jsx(rK,{})]})}yte.createRoot(document.getElementById("root")).render(o.jsx(b.StrictMode,{children:o.jsx(sDe,{children:o.jsx(jDe,{defaultTheme:"system",children:o.jsx(NDe,{children:o.jsxs(Spe,{children:[o.jsx(SJ,{router:ODe}),o.jsx(Yxe,{}),o.jsx(GDe,{})]})})})})})); + `.trim();try{await navigator.clipboard.writeText(h),l(!0),setTimeout(()=>l(!1),2e3)}catch(m){console.error("Failed to copy:",m)}};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs(ba,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[o.jsx(Ga,{className:"h-4 w-4"}),o.jsxs(wa,{className:"font-mono text-sm",children:[o.jsxs("span",{className:"font-semibold",children:[t.name,":"]})," ",t.message]})]}),c.length>0&&o.jsxs(hj,{open:n,onOpenChange:r,children:[o.jsx(fj,{asChild:!0,children:o.jsxs(ue,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[o.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[o.jsx(gte,{className:"h-4 w-4"}),"Stack Trace (",c.length," frames)"]}),n?o.jsx(B0,{className:"h-4 w-4"}):o.jsx(Xc,{className:"h-4 w-4"})]})}),o.jsx(mj,{children:o.jsx(pn,{className:"h-[280px] rounded-md border bg-muted/30",children:o.jsx("div",{className:"p-3 space-y-1",children:c.map((h,m)=>o.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[m+1,"."]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-primary font-medium",children:h.functionName}),h.fileName&&o.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[h.fileName,h.lineNumber&&o.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",h.lineNumber,":",h.columnNumber]})]})]})]})},m))})})})]}),e?.componentStack&&o.jsxs(hj,{open:s,onOpenChange:i,children:[o.jsx(fj,{asChild:!0,children:o.jsxs(ue,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[o.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[o.jsx(Ga,{className:"h-4 w-4"}),"Component Stack"]}),s?o.jsx(B0,{className:"h-4 w-4"}):o.jsx(Xc,{className:"h-4 w-4"})]})}),o.jsx(mj,{children:o.jsx(pn,{className:"h-[200px] rounded-md border bg-muted/30",children:o.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:e.componentStack})})})]}),o.jsx(ue,{variant:"outline",size:"sm",onClick:d,className:"w-full",children:a?o.jsxs(o.Fragment,{children:[o.jsx(zo,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):o.jsxs(o.Fragment,{children:[o.jsx(Iv,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function FY({error:t,errorInfo:e}){const n=()=>{window.location.href="/"},r=()=>{window.location.reload()};return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:o.jsxs(Lt,{className:"w-full max-w-2xl shadow-lg",children:[o.jsxs(En,{className:"text-center pb-2",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:o.jsx(Ga,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),o.jsx(_n,{className:"text-2xl font-bold",children:"页面出现了问题"}),o.jsx(Wr,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),o.jsxs(Xn,{className:"space-y-4",children:[o.jsx(mDe,{error:t,errorInfo:e}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[o.jsxs(ue,{onClick:r,className:"flex-1",children:[o.jsx(Qs,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),o.jsxs(ue,{onClick:n,variant:"outline",className:"flex-1",children:[o.jsx(L0,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),o.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class pDe extends b.Component{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("ErrorBoundary caught an error:",e,n),this.setState({errorInfo:n})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:o.jsx(FY,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function qY({error:t}){return o.jsx(FY,{error:t,errorInfo:null})}const Mg=SJ({component:()=>o.jsxs(o.Fragment,{children:[o.jsx(Hz,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!AB())throw OJ({to:"/auth"})}}),gDe=ps({getParentRoute:()=>Mg,path:"/auth",component:pie}),xDe=ps({getParentRoute:()=>Mg,path:"/setup",component:Iie}),Ys=ps({getParentRoute:()=>Mg,id:"protected",component:()=>o.jsx(hDe,{children:o.jsx(Hz,{})}),errorComponent:({error:t})=>o.jsx(qY,{error:t})}),vDe=ps({getParentRoute:()=>Ys,path:"/",component:Mse}),yDe=ps({getParentRoute:()=>Ys,path:"/config/bot",component:z0e}),bDe=ps({getParentRoute:()=>Ys,path:"/config/modelProvider",component:n1e}),wDe=ps({getParentRoute:()=>Ys,path:"/config/model",component:Wve}),SDe=ps({getParentRoute:()=>Ys,path:"/config/adapter",component:Xve}),kDe=ps({getParentRoute:()=>Ys,path:"/resource/emoji",component:yOe}),ODe=ps({getParentRoute:()=>Ys,path:"/resource/expression",component:_Oe}),jDe=ps({getParentRoute:()=>Ys,path:"/resource/person",component:qOe}),NDe=ps({getParentRoute:()=>Ys,path:"/resource/knowledge-graph",component:ATe}),CDe=ps({getParentRoute:()=>Ys,path:"/logs",component:SAe}),TDe=ps({getParentRoute:()=>Ys,path:"/chat",component:pMe}),EDe=ps({getParentRoute:()=>Ys,path:"/plugins",component:UAe}),_De=ps({getParentRoute:()=>Ys,path:"/plugin-config",component:JAe}),ADe=ps({getParentRoute:()=>Ys,path:"/plugin-mirrors",component:eMe}),MDe=ps({getParentRoute:()=>Ys,path:"/settings",component:oie}),RDe=ps({getParentRoute:()=>Mg,path:"*",component:DB}),DDe=Mg.addChildren([gDe,xDe,Ys.addChildren([vDe,yDe,bDe,wDe,SDe,kDe,ODe,jDe,NDe,EDe,_De,ADe,CDe,TDe,MDe]),RDe]),PDe=kJ({routeTree:DDe,defaultNotFoundComponent:DB,defaultErrorComponent:({error:t})=>o.jsx(qY,{error:t})});function zDe({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=b.useState(()=>localStorage.getItem(n)||e);b.useEffect(()=>{const l=window.document.documentElement;if(l.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";l.classList.add(c);return}l.classList.add(s)},[s]),b.useEffect(()=>{const l=localStorage.getItem("accent-color");if(l){const c=document.documentElement,h={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[l];h&&(c.style.setProperty("--primary",h.hsl),h.gradient?(c.style.setProperty("--primary-gradient",h.gradient),c.classList.add("has-gradient")):(c.style.removeProperty("--primary-gradient"),c.classList.remove("has-gradient")))}},[]);const a={theme:s,setTheme:l=>{localStorage.setItem(n,l),i(l)}};return o.jsx(tB.Provider,{...r,value:a,children:t})}function IDe({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,a]=b.useState(()=>{const h=localStorage.getItem(r);return h!==null?h==="true":e}),[l,c]=b.useState(()=>{const h=localStorage.getItem(s);return h!==null?h==="true":n});b.useEffect(()=>{const h=document.documentElement;i?h.classList.remove("no-animations"):h.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),b.useEffect(()=>{localStorage.setItem(s,String(l))},[l,s]);const d={enableAnimations:i,setEnableAnimations:a,enableWavesBackground:l,setEnableWavesBackground:c};return o.jsx(nB.Provider,{value:d,children:t})}var P7="ToastProvider",[z7,LDe,BDe]=Qy("Toast"),[$Y]=Da("Toast",[BDe]),[FDe,dw]=$Y(P7),HY=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=t,[l,c]=b.useState(null),[d,h]=b.useState(0),m=b.useRef(!1),g=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${P7}\`. Expected non-empty \`string\`.`),o.jsx(z7.Provider,{scope:e,children:o.jsx(FDe,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:b.useCallback(()=>h(x=>x+1),[]),onToastRemove:b.useCallback(()=>h(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:a})})};HY.displayName=P7;var QY="ToastViewport",qDe=["F8"],vj="toast.viewportPause",yj="toast.viewportResume",VY=b.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=qDe,label:s="Notifications ({hotkey})",...i}=t,a=dw(QY,n),l=LDe(n),c=b.useRef(null),d=b.useRef(null),h=b.useRef(null),m=b.useRef(null),g=er(e,m,a.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;b.useEffect(()=>{const S=k=>{r.length!==0&&r.every(N=>k[N]||k.code===N)&&m.current?.focus()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[r]),b.useEffect(()=>{const S=c.current,k=m.current;if(y&&S&&k){const j=()=>{if(!a.isClosePausedRef.current){const _=new CustomEvent(vj);k.dispatchEvent(_),a.isClosePausedRef.current=!0}},N=()=>{if(a.isClosePausedRef.current){const _=new CustomEvent(yj);k.dispatchEvent(_),a.isClosePausedRef.current=!1}},T=_=>{!S.contains(_.relatedTarget)&&N()},E=()=>{S.contains(document.activeElement)||N()};return S.addEventListener("focusin",j),S.addEventListener("focusout",T),S.addEventListener("pointermove",j),S.addEventListener("pointerleave",E),window.addEventListener("blur",j),window.addEventListener("focus",N),()=>{S.removeEventListener("focusin",j),S.removeEventListener("focusout",T),S.removeEventListener("pointermove",j),S.removeEventListener("pointerleave",E),window.removeEventListener("blur",j),window.removeEventListener("focus",N)}}},[y,a.isClosePausedRef]);const w=b.useCallback(({tabbingDirection:S})=>{const j=l().map(N=>{const T=N.ref.current,E=[T,...ePe(T)];return S==="forwards"?E:E.reverse()});return(S==="forwards"?j.reverse():j).flat()},[l]);return b.useEffect(()=>{const S=m.current;if(S){const k=j=>{const N=j.altKey||j.ctrlKey||j.metaKey;if(j.key==="Tab"&&!N){const E=document.activeElement,_=j.shiftKey;if(j.target===S&&_){d.current?.focus();return}const q=w({tabbingDirection:_?"backwards":"forwards"}),B=q.findIndex(H=>H===E);rk(q.slice(B+1))?j.preventDefault():_?d.current?.focus():h.current?.focus()}};return S.addEventListener("keydown",k),()=>S.removeEventListener("keydown",k)}},[l,w]),o.jsxs(Lee,{ref:c,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&o.jsx(bj,{ref:d,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"forwards"});rk(S)}}),o.jsx(z7.Slot,{scope:n,children:o.jsx(Sn.ol,{tabIndex:-1,...i,ref:g})}),y&&o.jsx(bj,{ref:h,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"backwards"});rk(S)}})]})});VY.displayName=QY;var UY="ToastFocusProxy",bj=b.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=dw(UY,n);return o.jsx(SI,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{const l=a.relatedTarget;!i.viewport?.contains(l)&&r()}})});bj.displayName=UY;var Rg="Toast",$De="toast.swipeStart",HDe="toast.swipeMove",QDe="toast.swipeCancel",VDe="toast.swipeEnd",WY=b.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=t,[l,c]=Kl({prop:r,defaultProp:s??!0,onChange:i,caller:Rg});return o.jsx(oi,{present:n||l,children:o.jsx(GDe,{open:l,...a,ref:e,onClose:()=>c(!1),onPause:Rs(t.onPause),onResume:Rs(t.onResume),onSwipeStart:nt(t.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:nt(t.onSwipeMove,d=>{const{x:h,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${h}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:nt(t.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:nt(t.onSwipeEnd,d=>{const{x:h,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${h}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),c(!1)})})})});WY.displayName=Rg;var[UDe,WDe]=$Y(Rg,{onClose(){}}),GDe=b.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:h,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:x,...y}=t,w=dw(Rg,n),[S,k]=b.useState(null),j=er(e,I=>k(I)),N=b.useRef(null),T=b.useRef(null),E=s||w.duration,_=b.useRef(0),A=b.useRef(E),D=b.useRef(0),{onToastAdd:q,onToastRemove:B}=w,H=Rs(()=>{S?.contains(document.activeElement)&&w.viewport?.focus(),a()}),W=b.useCallback(I=>{!I||I===1/0||(window.clearTimeout(D.current),_.current=new Date().getTime(),D.current=window.setTimeout(H,I))},[H]);b.useEffect(()=>{const I=w.viewport;if(I){const V=()=>{W(A.current),d?.()},L=()=>{const $=new Date().getTime()-_.current;A.current=A.current-$,window.clearTimeout(D.current),c?.()};return I.addEventListener(vj,L),I.addEventListener(yj,V),()=>{I.removeEventListener(vj,L),I.removeEventListener(yj,V)}}},[w.viewport,E,c,d,W]),b.useEffect(()=>{i&&!w.isClosePausedRef.current&&W(E)},[i,E,w.isClosePausedRef,W]),b.useEffect(()=>(q(),()=>B()),[q,B]);const ee=b.useMemo(()=>S?eK(S):null,[S]);return w.viewport?o.jsxs(o.Fragment,{children:[ee&&o.jsx(XDe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:ee}),o.jsx(UDe,{scope:n,onClose:H,children:ya.createPortal(o.jsx(z7.ItemSlot,{scope:n,children:o.jsx(Bee,{asChild:!0,onEscapeKeyDown:nt(l,()=>{w.isFocusedToastEscapeKeyDownRef.current||H(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:o.jsx(Sn.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":w.swipeDirection,...y,ref:j,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:nt(t.onKeyDown,I=>{I.key==="Escape"&&(l?.(I.nativeEvent),I.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,H()))}),onPointerDown:nt(t.onPointerDown,I=>{I.button===0&&(N.current={x:I.clientX,y:I.clientY})}),onPointerMove:nt(t.onPointerMove,I=>{if(!N.current)return;const V=I.clientX-N.current.x,L=I.clientY-N.current.y,$=!!T.current,K=["left","right"].includes(w.swipeDirection),Y=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,R=K?Y(0,V):0,ie=K?0:Y(0,L),X=I.pointerType==="touch"?10:2,z={x:R,y:ie},U={originalEvent:I,delta:z};$?(T.current=z,nv(HDe,m,U,{discrete:!1})):$z(z,w.swipeDirection,X)?(T.current=z,nv($De,h,U,{discrete:!1}),I.target.setPointerCapture(I.pointerId)):(Math.abs(V)>X||Math.abs(L)>X)&&(N.current=null)}),onPointerUp:nt(t.onPointerUp,I=>{const V=T.current,L=I.target;if(L.hasPointerCapture(I.pointerId)&&L.releasePointerCapture(I.pointerId),T.current=null,N.current=null,V){const $=I.currentTarget,K={originalEvent:I,delta:V};$z(V,w.swipeDirection,w.swipeThreshold)?nv(VDe,x,K,{discrete:!0}):nv(QDe,g,K,{discrete:!0}),$.addEventListener("click",Y=>Y.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),XDe=t=>{const{__scopeToast:e,children:n,...r}=t,s=dw(Rg,e),[i,a]=b.useState(!1),[l,c]=b.useState(!1);return ZDe(()=>a(!0)),b.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:o.jsx(Xy,{asChild:!0,children:o.jsx(SI,{...r,children:i&&o.jsxs(o.Fragment,{children:[s.label," ",n]})})})},YDe="ToastTitle",GY=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(Sn.div,{...r,ref:e})});GY.displayName=YDe;var KDe="ToastDescription",XY=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(Sn.div,{...r,ref:e})});XY.displayName=KDe;var YY="ToastAction",KY=b.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?o.jsx(JY,{altText:n,asChild:!0,children:o.jsx(I7,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${YY}\`. Expected non-empty \`string\`.`),null)});KY.displayName=YY;var ZY="ToastClose",I7=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=WDe(ZY,n);return o.jsx(JY,{asChild:!0,children:o.jsx(Sn.button,{type:"button",...r,ref:e,onClick:nt(t.onClick,s.onClose)})})});I7.displayName=ZY;var JY=b.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return o.jsx(Sn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function eK(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),JDe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=r.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...eK(r))}}),e}function nv(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?wI(s,i):s.dispatchEvent(i)}var $z=(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 ZDe(t=()=>{}){const e=Rs(t);Wh(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function JDe(t){return t.nodeType===t.ELEMENT_NODE}function ePe(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 rk(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var tPe=HY,tK=VY,nK=WY,rK=GY,sK=XY,iK=KY,aK=I7;const nPe=tPe,oK=b.forwardRef(({className:t,...e},n)=>o.jsx(tK,{ref:n,className:xe("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",t),...e}));oK.displayName=tK.displayName;const rPe=kf("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),lK=b.forwardRef(({className:t,variant:e,...n},r)=>o.jsx(nK,{ref:r,className:xe(rPe({variant:e}),t),...n}));lK.displayName=nK.displayName;const sPe=b.forwardRef(({className:t,...e},n)=>o.jsx(iK,{ref:n,className:xe("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}));sPe.displayName=iK.displayName;const cK=b.forwardRef(({className:t,...e},n)=>o.jsx(aK,{ref:n,className:xe("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:o.jsx(Pp,{className:"h-4 w-4"})}));cK.displayName=aK.displayName;const uK=b.forwardRef(({className:t,...e},n)=>o.jsx(rK,{ref:n,className:xe("text-sm font-semibold [&+div]:text-xs",t),...e}));uK.displayName=rK.displayName;const dK=b.forwardRef(({className:t,...e},n)=>o.jsx(sK,{ref:n,className:xe("text-sm opacity-90",t),...e}));dK.displayName=sK.displayName;function iPe(){const{toasts:t}=Lr();return o.jsxs(nPe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return o.jsxs(lK,{...i,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(uK,{children:n}),r&&o.jsx(dK,{children:r})]}),s,o.jsx(cK,{})]},e)}),o.jsx(oK,{})]})}wte.createRoot(document.getElementById("root")).render(o.jsx(b.StrictMode,{children:o.jsx(pDe,{children:o.jsx(zDe,{defaultTheme:"system",children:o.jsx(IDe,{children:o.jsxs(Npe,{children:[o.jsx(jJ,{router:PDe}),o.jsx(e1e,{}),o.jsx(iPe,{})]})})})})})); diff --git a/webui/dist/assets/index-Rqzi5c1P.css b/webui/dist/assets/index-Rqzi5c1P.css deleted file mode 100644 index fe11943e..00000000 --- a/webui/dist/assets/index-Rqzi5c1P.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[1px\]{width:1px}.w-\[65px\]{width:65px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/50{border-color:#f59e0b80}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:text-yellow-800:hover{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-yellow-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:pb-4{padding-bottom:1rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}.lg\:pb-6{padding-bottom:1.5rem}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%} diff --git a/webui/dist/assets/index-_a_MShLH.css b/webui/dist/assets/index-_a_MShLH.css new file mode 100644 index 00000000..6cfb460f --- /dev/null +++ b/webui/dist/assets/index-_a_MShLH.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[1px\]{width:1px}.w-\[65px\]{width:65px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/50{border-color:#f59e0b80}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:text-yellow-800:hover{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-yellow-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:pb-4{padding-bottom:1rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}.lg\:pb-6{padding-bottom:1.5rem}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%} diff --git a/webui/dist/index.html b/webui/dist/index.html index 2dc900c9..059f7ffb 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -7,13 +7,13 @@ MaiBot Dashboard - + - - + +