@siteboon/claude-code-ui 1.10.3 → 1.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,932 @@
1
+ import{j as t,S as _n,F as Cs,T as _l,P as zl,E as er,V as Ss,a as Qa,g as Iu,R as Au,D as br,b as ms,G as Xa,W as Za,l as Fl,h as ga,c as $l,C as Mu,d as Tu,e as rn,f as Du,i as Pu,u as Lu,k as Oi,s as Ru,m as _u,n as zu,o as Fu,p as Ol,q as Bl,r as Wl,t as $u,v as Ou,w as Bu,x as Wu,y as Uu}from"./vendor-codemirror-B7BYDWj-.js";import{b as Hu,g as zn,a as f,R as fr,B as qu,c as Vu,d as Bi,u as Gu,e as Ku}from"./vendor-react-7V_UDHjJ.js";import{r as Ju,a as Yu,b as Qu,c as Xu}from"./vendor-xterm-jI4BCHEb.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var Yn={},Wi;function Zu(){if(Wi)return Yn;Wi=1;var e=Hu();return Yn.createRoot=e.createRoot,Yn.hydrateRoot=e.hydrateRoot,Yn}var em=Zu();const tm=zn(em);/**
2
+ * @license lucide-react v0.515.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const rm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nm=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,n,s)=>s?s.toUpperCase():n.toLowerCase()),Ui=e=>{const r=nm(e);return r.charAt(0).toUpperCase()+r.slice(1)},Ul=(...e)=>e.filter((r,n,s)=>!!r&&r.trim()!==""&&s.indexOf(r)===n).join(" ").trim(),sm=e=>{for(const r in e)if(r.startsWith("aria-")||r==="role"||r==="title")return!0};/**
7
+ * @license lucide-react v0.515.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */var am={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"};/**
12
+ * @license lucide-react v0.515.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const im=f.forwardRef(({color:e="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:i,iconNode:o,...l},c)=>f.createElement("svg",{ref:c,...am,width:r,height:r,stroke:e,strokeWidth:s?Number(n)*24/Number(r):n,className:Ul("lucide",a),...!i&&!sm(l)&&{"aria-hidden":"true"},...l},[...o.map(([d,u])=>f.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
17
+ * @license lucide-react v0.515.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const pe=(e,r)=>{const n=f.forwardRef(({className:s,...a},i)=>f.createElement(im,{ref:i,iconNode:r,className:Ul(`lucide-${rm(Ui(e))}`,`lucide-${e}`,s),...a}));return n.displayName=Ui(e),n};/**
22
+ * @license lucide-react v0.515.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const om=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Hl=pe("arrow-down",om);/**
27
+ * @license lucide-react v0.515.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const lm=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ei=pe("arrow-right",lm);/**
32
+ * @license lucide-react v0.515.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const cm=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],dm=pe("arrow-up-down",cm);/**
37
+ * @license lucide-react v0.515.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const um=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],mm=pe("arrow-up",um);/**
42
+ * @license lucide-react v0.515.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const pm=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],ql=pe("brain",pm);/**
47
+ * @license lucide-react v0.515.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const hm=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Fr=pe("check",hm);/**
52
+ * @license lucide-react v0.515.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const fm=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Zt=pe("chevron-down",fm);/**
57
+ * @license lucide-react v0.515.0 - ISC
58
+ *
59
+ * This source code is licensed under the ISC license.
60
+ * See the LICENSE file in the root directory of this source tree.
61
+ */const gm=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],xm=pe("chevron-left",gm);/**
62
+ * @license lucide-react v0.515.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */const bm=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Er=pe("chevron-right",bm);/**
67
+ * @license lucide-react v0.515.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const ym=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],km=pe("chevron-up",ym);/**
72
+ * @license lucide-react v0.515.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const vm=[["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"}]],ti=pe("circle-alert",vm);/**
77
+ * @license lucide-react v0.515.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const wm=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Fn=pe("circle-check-big",wm);/**
82
+ * @license lucide-react v0.515.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const jm=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Nm=pe("circle-check",jm);/**
87
+ * @license lucide-react v0.515.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */const Cm=[["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"}]],Sm=pe("circle-help",Cm);/**
92
+ * @license lucide-react v0.515.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const Em=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Zr=pe("circle",Em);/**
97
+ * @license lucide-react v0.515.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const Im=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Tn=pe("clock",Im);/**
102
+ * @license lucide-react v0.515.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const Am=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Mm=pe("columns-2",Am);/**
107
+ * @license lucide-react v0.515.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const Tm=[["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"}]],Vl=pe("copy",Tm);/**
112
+ * @license lucide-react v0.515.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const Dm=[["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"}]],ps=pe("download",Dm);/**
117
+ * @license lucide-react v0.515.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */const Pm=[["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"}]],Lm=pe("external-link",Pm);/**
122
+ * @license lucide-react v0.515.0 - ISC
123
+ *
124
+ * This source code is licensed under the ISC license.
125
+ * See the LICENSE file in the root directory of this source tree.
126
+ */const Rm=[["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"}]],$n=pe("eye",Rm);/**
127
+ * @license lucide-react v0.515.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */const _m=[["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"}]],zm=pe("eye-off",_m);/**
132
+ * @license lucide-react v0.515.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */const Fm=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],$m=pe("file-code",Fm);/**
137
+ * @license lucide-react v0.515.0 - ISC
138
+ *
139
+ * This source code is licensed under the ISC license.
140
+ * See the LICENSE file in the root directory of this source tree.
141
+ */const Om=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],$t=pe("file-text",Om);/**
142
+ * @license lucide-react v0.515.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */const Bm=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],Hi=pe("file",Bm);/**
147
+ * @license lucide-react v0.515.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const Wm=[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]],Gl=pe("flag",Wm);/**
152
+ * @license lucide-react v0.515.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */const Um=[["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"}]],$r=pe("folder-open",Um);/**
157
+ * @license lucide-react v0.515.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const Hm=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Qn=pe("folder-plus",Hm);/**
162
+ * @license lucide-react v0.515.0 - ISC
163
+ *
164
+ * This source code is licensed under the ISC license.
165
+ * See the LICENSE file in the root directory of this source tree.
166
+ */const qm=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],or=pe("folder",qm);/**
167
+ * @license lucide-react v0.515.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */const Vm=[["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"}]],Gm=pe("funnel",Vm);/**
172
+ * @license lucide-react v0.515.0 - ISC
173
+ *
174
+ * This source code is licensed under the ISC license.
175
+ * See the LICENSE file in the root directory of this source tree.
176
+ */const Km=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],xa=pe("git-branch",Km);/**
177
+ * @license lucide-react v0.515.0 - ISC
178
+ *
179
+ * This source code is licensed under the ISC license.
180
+ * See the LICENSE file in the root directory of this source tree.
181
+ */const Jm=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],qi=pe("git-commit-horizontal",Jm);/**
182
+ * @license lucide-react v0.515.0 - ISC
183
+ *
184
+ * This source code is licensed under the ISC license.
185
+ * See the LICENSE file in the root directory of this source tree.
186
+ */const Ym=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Qm=pe("github",Ym);/**
187
+ * @license lucide-react v0.515.0 - ISC
188
+ *
189
+ * This source code is licensed under the ISC license.
190
+ * See the LICENSE file in the root directory of this source tree.
191
+ */const Xm=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],$s=pe("globe",Xm);/**
192
+ * @license lucide-react v0.515.0 - ISC
193
+ *
194
+ * This source code is licensed under the ISC license.
195
+ * See the LICENSE file in the root directory of this source tree.
196
+ */const Zm=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],ep=pe("grid-3x3",Zm);/**
197
+ * @license lucide-react v0.515.0 - ISC
198
+ *
199
+ * This source code is licensed under the ISC license.
200
+ * See the LICENSE file in the root directory of this source tree.
201
+ */const tp=[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Vi=pe("history",tp);/**
202
+ * @license lucide-react v0.515.0 - ISC
203
+ *
204
+ * This source code is licensed under the ISC license.
205
+ * See the LICENSE file in the root directory of this source tree.
206
+ */const rp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],np=pe("info",rp);/**
207
+ * @license lucide-react v0.515.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */const sp=[["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"}]],Kl=pe("key",sp);/**
212
+ * @license lucide-react v0.515.0 - ISC
213
+ *
214
+ * This source code is licensed under the ISC license.
215
+ * See the LICENSE file in the root directory of this source tree.
216
+ */const ap=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],ip=pe("languages",ap);/**
217
+ * @license lucide-react v0.515.0 - ISC
218
+ *
219
+ * This source code is licensed under the ISC license.
220
+ * See the LICENSE file in the root directory of this source tree.
221
+ */const op=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],hs=pe("list",op);/**
222
+ * @license lucide-react v0.515.0 - ISC
223
+ *
224
+ * This source code is licensed under the ISC license.
225
+ * See the LICENSE file in the root directory of this source tree.
226
+ */const lp=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],cp=pe("loader-circle",lp);/**
227
+ * @license lucide-react v0.515.0 - ISC
228
+ *
229
+ * This source code is licensed under the ISC license.
230
+ * See the LICENSE file in the root directory of this source tree.
231
+ */const dp=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],Xn=pe("log-in",dp);/**
232
+ * @license lucide-react v0.515.0 - ISC
233
+ *
234
+ * This source code is licensed under the ISC license.
235
+ * See the LICENSE file in the root directory of this source tree.
236
+ */const up=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],ri=pe("maximize-2",up);/**
237
+ * @license lucide-react v0.515.0 - ISC
238
+ *
239
+ * This source code is licensed under the ISC license.
240
+ * See the LICENSE file in the root directory of this source tree.
241
+ */const mp=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],Dn=pe("message-square",mp);/**
242
+ * @license lucide-react v0.515.0 - ISC
243
+ *
244
+ * This source code is licensed under the ISC license.
245
+ * See the LICENSE file in the root directory of this source tree.
246
+ */const pp=[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]],ds=pe("mic",pp);/**
247
+ * @license lucide-react v0.515.0 - ISC
248
+ *
249
+ * This source code is licensed under the ISC license.
250
+ * See the LICENSE file in the root directory of this source tree.
251
+ */const hp=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Jl=pe("minimize-2",hp);/**
252
+ * @license lucide-react v0.515.0 - ISC
253
+ *
254
+ * This source code is licensed under the ISC license.
255
+ * See the LICENSE file in the root directory of this source tree.
256
+ */const fp=[["path",{d:"M5 12h14",key:"1ays0h"}]],gp=pe("minus",fp);/**
257
+ * @license lucide-react v0.515.0 - ISC
258
+ *
259
+ * This source code is licensed under the ISC license.
260
+ * See the LICENSE file in the root directory of this source tree.
261
+ */const xp=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],ba=pe("moon",xp);/**
262
+ * @license lucide-react v0.515.0 - ISC
263
+ *
264
+ * This source code is licensed under the ISC license.
265
+ * See the LICENSE file in the root directory of this source tree.
266
+ */const bp=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],Yl=pe("pause",bp);/**
267
+ * @license lucide-react v0.515.0 - ISC
268
+ *
269
+ * This source code is licensed under the ISC license.
270
+ * See the LICENSE file in the root directory of this source tree.
271
+ */const yp=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],ya=pe("pen-line",yp);/**
272
+ * @license lucide-react v0.515.0 - ISC
273
+ *
274
+ * This source code is licensed under the ISC license.
275
+ * See the LICENSE file in the root directory of this source tree.
276
+ */const kp=[["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"}]],vp=pe("pen",kp);/**
277
+ * @license lucide-react v0.515.0 - ISC
278
+ *
279
+ * This source code is licensed under the ISC license.
280
+ * See the LICENSE file in the root directory of this source tree.
281
+ */const wp=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],jp=pe("play",wp);/**
282
+ * @license lucide-react v0.515.0 - ISC
283
+ *
284
+ * This source code is licensed under the ISC license.
285
+ * See the LICENSE file in the root directory of this source tree.
286
+ */const Np=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Dt=pe("plus",Np);/**
287
+ * @license lucide-react v0.515.0 - ISC
288
+ *
289
+ * This source code is licensed under the ISC license.
290
+ * See the LICENSE file in the root directory of this source tree.
291
+ */const Cp=[["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"}]],Sr=pe("refresh-cw",Cp);/**
292
+ * @license lucide-react v0.515.0 - ISC
293
+ *
294
+ * This source code is licensed under the ISC license.
295
+ * See the LICENSE file in the root directory of this source tree.
296
+ */const Sp=[["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"}]],fs=pe("save",Sp);/**
297
+ * @license lucide-react v0.515.0 - ISC
298
+ *
299
+ * This source code is licensed under the ISC license.
300
+ * See the LICENSE file in the root directory of this source tree.
301
+ */const Ep=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],nn=pe("search",Ep);/**
302
+ * @license lucide-react v0.515.0 - ISC
303
+ *
304
+ * This source code is licensed under the ISC license.
305
+ * See the LICENSE file in the root directory of this source tree.
306
+ */const Ip=[["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"}]],Gi=pe("server",Ip);/**
307
+ * @license lucide-react v0.515.0 - ISC
308
+ *
309
+ * This source code is licensed under the ISC license.
310
+ * See the LICENSE file in the root directory of this source tree.
311
+ */const Ap=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Wr=pe("settings",Ap);/**
312
+ * @license lucide-react v0.515.0 - ISC
313
+ *
314
+ * This source code is licensed under the ISC license.
315
+ * See the LICENSE file in the root directory of this source tree.
316
+ */const Mp=[["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"}]],Tp=pe("settings-2",Mp);/**
317
+ * @license lucide-react v0.515.0 - ISC
318
+ *
319
+ * This source code is licensed under the ISC license.
320
+ * See the LICENSE file in the root directory of this source tree.
321
+ */const Dp=[["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"}]],Os=pe("shield",Dp);/**
322
+ * @license lucide-react v0.515.0 - ISC
323
+ *
324
+ * This source code is licensed under the ISC license.
325
+ * See the LICENSE file in the root directory of this source tree.
326
+ */const Pp=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],Ir=pe("sparkles",Pp);/**
327
+ * @license lucide-react v0.515.0 - ISC
328
+ *
329
+ * This source code is licensed under the ISC license.
330
+ * See the LICENSE file in the root directory of this source tree.
331
+ */const Lp=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Rp=pe("square-check-big",Lp);/**
332
+ * @license lucide-react v0.515.0 - ISC
333
+ *
334
+ * This source code is licensed under the ISC license.
335
+ * See the LICENSE file in the root directory of this source tree.
336
+ */const _p=[["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"}]],zp=pe("square-pen",_p);/**
337
+ * @license lucide-react v0.515.0 - ISC
338
+ *
339
+ * This source code is licensed under the ISC license.
340
+ * See the LICENSE file in the root directory of this source tree.
341
+ */const Fp=[["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"}]],Ki=pe("star",Fp);/**
342
+ * @license lucide-react v0.515.0 - ISC
343
+ *
344
+ * This source code is licensed under the ISC license.
345
+ * See the LICENSE file in the root directory of this source tree.
346
+ */const $p=[["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"}]],ka=pe("sun",$p);/**
347
+ * @license lucide-react v0.515.0 - ISC
348
+ *
349
+ * This source code is licensed under the ISC license.
350
+ * See the LICENSE file in the root directory of this source tree.
351
+ */const Op=[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],Bp=pe("table-properties",Op);/**
352
+ * @license lucide-react v0.515.0 - ISC
353
+ *
354
+ * This source code is licensed under the ISC license.
355
+ * See the LICENSE file in the root directory of this source tree.
356
+ */const Wp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Up=pe("target",Wp);/**
357
+ * @license lucide-react v0.515.0 - ISC
358
+ *
359
+ * This source code is licensed under the ISC license.
360
+ * See the LICENSE file in the root directory of this source tree.
361
+ */const Hp=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],sn=pe("terminal",Hp);/**
362
+ * @license lucide-react v0.515.0 - ISC
363
+ *
364
+ * This source code is licensed under the ISC license.
365
+ * See the LICENSE file in the root directory of this source tree.
366
+ */const qp=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],nr=pe("trash-2",qp);/**
367
+ * @license lucide-react v0.515.0 - ISC
368
+ *
369
+ * This source code is licensed under the ISC license.
370
+ * See the LICENSE file in the root directory of this source tree.
371
+ */const Vp=[["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"}]],En=pe("triangle-alert",Vp);/**
372
+ * @license lucide-react v0.515.0 - ISC
373
+ *
374
+ * This source code is licensed under the ISC license.
375
+ * See the LICENSE file in the root directory of this source tree.
376
+ */const Gp=[["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"}]],Zn=pe("upload",Gp);/**
377
+ * @license lucide-react v0.515.0 - ISC
378
+ *
379
+ * This source code is licensed under the ISC license.
380
+ * See the LICENSE file in the root directory of this source tree.
381
+ */const Kp=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ct=pe("x",Kp);/**
382
+ * @license lucide-react v0.515.0 - ISC
383
+ *
384
+ * This source code is licensed under the ISC license.
385
+ * See the LICENSE file in the root directory of this source tree.
386
+ */const Jp=[["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"}]],va=pe("zap",Jp);function Ql(e){var r,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(r=0;r<a;r++)e[r]&&(n=Ql(e[r]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function Xl(){for(var e,r,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(r=Ql(e))&&(s&&(s+=" "),s+=r);return s}const ni="-",Yp=e=>{const r=Xp(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{const l=o.split(ni);return l[0]===""&&l.length!==1&&l.shift(),Zl(l,r)||Qp(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&s[o]?[...c,...s[o]]:c}}},Zl=(e,r)=>{if(e.length===0)return r.classGroupId;const n=e[0],s=r.nextPart.get(n),a=s?Zl(e.slice(1),s):void 0;if(a)return a;if(r.validators.length===0)return;const i=e.join(ni);return r.validators.find(({validator:o})=>o(i))?.classGroupId},Ji=/^\[(.+)\]$/,Qp=e=>{if(Ji.test(e)){const r=Ji.exec(e)[1],n=r?.substring(0,r.indexOf(":"));if(n)return"arbitrary.."+n}},Xp=e=>{const{theme:r,classGroups:n}=e,s={nextPart:new Map,validators:[]};for(const a in n)wa(n[a],s,a,r);return s},wa=(e,r,n,s)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?r:Yi(r,a);i.classGroupId=n;return}if(typeof a=="function"){if(Zp(a)){wa(a(s),r,n,s);return}r.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,o])=>{wa(o,Yi(r,i),n,s)})})},Yi=(e,r)=>{let n=e;return r.split(ni).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},Zp=e=>e.isThemeGetter,eh=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,n=new Map,s=new Map;const a=(i,o)=>{n.set(i,o),r++,r>e&&(r=0,s=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=s.get(i))!==void 0)return a(i,o),o},set(i,o){n.has(i)?n.set(i,o):a(i,o)}}},ja="!",Na=":",th=Na.length,rh=e=>{const{prefix:r,experimentalParseClassName:n}=e;let s=a=>{const i=[];let o=0,l=0,c=0,d;for(let g=0;g<a.length;g++){let x=a[g];if(o===0&&l===0){if(x===Na){i.push(a.slice(c,g)),c=g+th;continue}if(x==="/"){d=g;continue}}x==="["?o++:x==="]"?o--:x==="("?l++:x===")"&&l--}const u=i.length===0?a:a.substring(c),m=nh(u),h=m!==u,p=d&&d>c?d-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:p}};if(r){const a=r+Na,i=s;s=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const a=s;s=i=>n({className:i,parseClassName:a})}return s},nh=e=>e.endsWith(ja)?e.substring(0,e.length-1):e.startsWith(ja)?e.substring(1):e,sh=e=>{const r=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const a=[];let i=[];return s.forEach(o=>{o[0]==="["||r[o]?(a.push(...i.sort(),o),i=[]):i.push(o)}),a.push(...i.sort()),a}},ah=e=>({cache:eh(e.cacheSize),parseClassName:rh(e),sortModifiers:sh(e),...Yp(e)}),ih=/\s+/,oh=(e,r)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a,sortModifiers:i}=r,o=[],l=e.trim().split(ih);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:h,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:x}=n(u);if(m){c=u+(c.length>0?" "+c:c);continue}let b=!!x,k=s(b?g.substring(0,x):g);if(!k){if(!b){c=u+(c.length>0?" "+c:c);continue}if(k=s(g),!k){c=u+(c.length>0?" "+c:c);continue}b=!1}const N=i(h).join(":"),y=p?N+ja:N,P=y+k;if(o.includes(P))continue;o.push(P);const W=a(k,b);for(let M=0;M<W.length;++M){const B=W[M];o.push(y+B)}c=u+(c.length>0?" "+c:c)}return c};function lh(){let e=0,r,n,s="";for(;e<arguments.length;)(r=arguments[e++])&&(n=ec(r))&&(s&&(s+=" "),s+=n);return s}const ec=e=>{if(typeof e=="string")return e;let r,n="";for(let s=0;s<e.length;s++)e[s]&&(r=ec(e[s]))&&(n&&(n+=" "),n+=r);return n};function ch(e,...r){let n,s,a,i=o;function o(c){const d=r.reduce((u,m)=>m(u),e());return n=ah(d),s=n.cache.get,a=n.cache.set,i=l,l(c)}function l(c){const d=s(c);if(d)return d;const u=oh(c,n);return a(c,u),u}return function(){return i(lh.apply(null,arguments))}}const jt=e=>{const r=n=>n[e]||[];return r.isThemeGetter=!0,r},tc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,dh=/^\d+\/\d+$/,uh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,mh=/\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$/,ph=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,hh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Kr=e=>dh.test(e),Ge=e=>!!e&&!Number.isNaN(Number(e)),wr=e=>!!e&&Number.isInteger(Number(e)),Bs=e=>e.endsWith("%")&&Ge(e.slice(0,-1)),pr=e=>uh.test(e),gh=()=>!0,xh=e=>mh.test(e)&&!ph.test(e),nc=()=>!1,bh=e=>hh.test(e),yh=e=>fh.test(e),kh=e=>!je(e)&&!Ne(e),vh=e=>un(e,ic,nc),je=e=>tc.test(e),Pr=e=>un(e,oc,xh),Ws=e=>un(e,Sh,Ge),Qi=e=>un(e,sc,nc),wh=e=>un(e,ac,yh),es=e=>un(e,lc,bh),Ne=e=>rc.test(e),bn=e=>mn(e,oc),jh=e=>mn(e,Eh),Xi=e=>mn(e,sc),Nh=e=>mn(e,ic),Ch=e=>mn(e,ac),ts=e=>mn(e,lc,!0),un=(e,r,n)=>{const s=tc.exec(e);return s?s[1]?r(s[1]):n(s[2]):!1},mn=(e,r,n=!1)=>{const s=rc.exec(e);return s?s[1]?r(s[1]):n:!1},sc=e=>e==="position"||e==="percentage",ac=e=>e==="image"||e==="url",ic=e=>e==="length"||e==="size"||e==="bg-size",oc=e=>e==="length",Sh=e=>e==="number",Eh=e=>e==="family-name",lc=e=>e==="shadow",Ih=()=>{const e=jt("color"),r=jt("font"),n=jt("text"),s=jt("font-weight"),a=jt("tracking"),i=jt("leading"),o=jt("breakpoint"),l=jt("container"),c=jt("spacing"),d=jt("radius"),u=jt("shadow"),m=jt("inset-shadow"),h=jt("text-shadow"),p=jt("drop-shadow"),g=jt("blur"),x=jt("perspective"),b=jt("aspect"),k=jt("ease"),N=jt("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...P(),Ne,je],M=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],L=()=>[Ne,je,c],U=()=>[Kr,"full","auto",...L()],j=()=>[wr,"none","subgrid",Ne,je],R=()=>["auto",{span:["full",wr,Ne,je]},wr,Ne,je],D=()=>[wr,"auto",Ne,je],_=()=>["auto","min","max","fr",Ne,je],C=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...L()],Z=()=>[Kr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],F=()=>[e,Ne,je],ce=()=>[...P(),Xi,Qi,{position:[Ne,je]}],v=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ue=()=>["auto","cover","contain",Nh,vh,{size:[Ne,je]}],fe=()=>[Bs,bn,Pr],w=()=>["","none","full",d,Ne,je],J=()=>["",Ge,bn,Pr],he=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[Ge,Bs,Xi,Qi],Pe=()=>["","none",g,Ne,je],X=()=>["none",Ge,Ne,je],le=()=>["none",Ge,Ne,je],ke=()=>[Ge,Ne,je],ge=()=>[Kr,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pr],breakpoint:[pr],color:[gh],container:[pr],"drop-shadow":[pr],ease:["in","out","in-out"],font:[kh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pr],shadow:[pr],spacing:["px",Ge],text:[pr],"text-shadow":[pr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Kr,je,Ne,b]}],container:["container"],columns:[{columns:[Ge,je,Ne,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:W()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{start:U()}],end:[{end:U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[wr,"auto",Ne,je]}],basis:[{basis:[Kr,"full","auto",l,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,Kr,"auto","initial","none",je]}],grow:[{grow:["",Ge,Ne,je]}],shrink:[{shrink:["",Ge,Ne,je]}],order:[{order:[wr,"first","last","none",Ne,je]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:R()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:R()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":_()}],"auto-rows":[{"auto-rows":_()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...C(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...C()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":C()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],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:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],w:[{w:[l,"screen",...Z()]}],"min-w":[{"min-w":[l,"screen","none",...Z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",n,bn,Pr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Ne,Ws]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Bs,je]}],"font-family":[{font:[jh,je,r]}],"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:[a,Ne,je]}],"line-clamp":[{"line-clamp":[Ge,"none",Ne,Ws]}],leading:[{leading:[i,...L()]}],"list-image":[{"list-image":["none",Ne,je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ne,je]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",Ne,Pr]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Ge,"auto",Ne,je]}],"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",Ne,je]}],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",Ne,je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ce()}],"bg-repeat":[{bg:v()}],"bg-size":[{bg:ue()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},wr,Ne,je],radial:["",Ne,je],conic:[wr,Ne,je]},Ch,wh]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:fe()}],"gradient-via-pos":[{via:fe()}],"gradient-to-pos":[{to:fe()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:w()}],"rounded-s":[{"rounded-s":w()}],"rounded-e":[{"rounded-e":w()}],"rounded-t":[{"rounded-t":w()}],"rounded-r":[{"rounded-r":w()}],"rounded-b":[{"rounded-b":w()}],"rounded-l":[{"rounded-l":w()}],"rounded-ss":[{"rounded-ss":w()}],"rounded-se":[{"rounded-se":w()}],"rounded-ee":[{"rounded-ee":w()}],"rounded-es":[{"rounded-es":w()}],"rounded-tl":[{"rounded-tl":w()}],"rounded-tr":[{"rounded-tr":w()}],"rounded-br":[{"rounded-br":w()}],"rounded-bl":[{"rounded-bl":w()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,Ne,je]}],"outline-w":[{outline:["",Ge,bn,Pr]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",u,ts,es]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",m,ts,es]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Ge,Pr]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",h,ts,es]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Ge,Ne,je]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"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":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[Ne,je]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"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":P()}],"mask-image-conic-pos":[{"mask-conic":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:v()}],"mask-size":[{mask:ue()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ne,je]}],filter:[{filter:["","none",Ne,je]}],blur:[{blur:Pe()}],brightness:[{brightness:[Ge,Ne,je]}],contrast:[{contrast:[Ge,Ne,je]}],"drop-shadow":[{"drop-shadow":["","none",p,ts,es]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Ge,Ne,je]}],"hue-rotate":[{"hue-rotate":[Ge,Ne,je]}],invert:[{invert:["",Ge,Ne,je]}],saturate:[{saturate:[Ge,Ne,je]}],sepia:[{sepia:["",Ge,Ne,je]}],"backdrop-filter":[{"backdrop-filter":["","none",Ne,je]}],"backdrop-blur":[{"backdrop-blur":Pe()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,Ne,je]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,Ne,je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,Ne,je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,Ne,je]}],"backdrop-invert":[{"backdrop-invert":["",Ge,Ne,je]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,Ne,je]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,Ne,je]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,Ne,je]}],"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",Ne,je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",Ne,je]}],ease:[{ease:["linear","initial",k,Ne,je]}],delay:[{delay:[Ge,Ne,je]}],animate:[{animate:["none",N,Ne,je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,Ne,je]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:X()}],"rotate-x":[{"rotate-x":X()}],"rotate-y":[{"rotate-y":X()}],"rotate-z":[{"rotate-z":X()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[Ne,je,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"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",Ne,je]}],"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",Ne,je]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Ge,bn,Pr,Ws]}],stroke:[{stroke:["none",...F()]}],"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"]}},Ah=ch(Ih);function Me(...e){return Ah(Xl(e))}const si=f.forwardRef(({className:e,children:r,...n},s)=>t.jsx("div",{ref:s,className:Me("relative overflow-hidden",e),...n,children:t.jsx("div",{className:"h-full w-full rounded-[inherit] overflow-auto",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:r})}));si.displayName="ScrollArea";const Zi=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,eo=Xl,cc=(e,r)=>n=>{var s;if(r?.variants==null)return eo(e,n?.class,n?.className);const{variants:a,defaultVariants:i}=r,o=Object.keys(a).map(d=>{const u=n?.[d],m=i?.[d];if(u===null)return null;const h=Zi(u)||Zi(m);return a[d][h]}),l=n&&Object.entries(n).reduce((d,u)=>{let[m,h]=u;return h===void 0||(d[m]=h),d},{}),c=r==null||(s=r.compoundVariants)===null||s===void 0?void 0:s.reduce((d,u)=>{let{class:m,className:h,...p}=u;return Object.entries(p).every(g=>{let[x,b]=g;return Array.isArray(b)?b.includes({...i,...l}[x]):{...i,...l}[x]===b})?[...d,m,h]:d},[]);return eo(e,o,c,n?.class,n?.className)},Mh=cc("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"}}),Le=f.forwardRef(({className:e,variant:r,size:n,...s},a)=>t.jsx("button",{className:Me(Mh({variant:r,size:n,className:e})),ref:a,...s}));Le.displayName="Button";const Th=cc("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 Or({className:e,variant:r,...n}){return t.jsx("div",{className:Me(Th({variant:r}),e),...n})}const Et=f.forwardRef(({className:e,type:r,...n},s)=>t.jsx("input",{type:r,className:Me("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm 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",e),ref:s,...n}));Et.displayName="Input";const lr=({className:e="w-5 h-5"})=>t.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),hr=({className:e="w-5 h-5"})=>t.jsx("img",{src:"/icons/cursor.svg",alt:"Cursor",className:e}),Dh=({status:e="not-configured",size:r="sm",className:n="",showLabel:s=!1})=>{const i=(()=>{switch(e){case"fully-configured":return{icon:Fn,color:"text-green-500 dark:text-green-400",bgColor:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"};case"taskmaster-only":return{icon:Wr,color:"text-blue-500 dark:text-blue-400",bgColor:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"};case"mcp-only":return{icon:ti,color:"text-amber-500 dark:text-amber-400",bgColor:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"};case"not-configured":case"error":default:return{icon:ct,color:"text-gray-400 dark:text-gray-500",bgColor:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"}}})(),o=i.icon,l={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},c={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"};return s?t.jsxs("div",{className:Me("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",i.bgColor,i.color,n),title:i.title,children:[t.jsx(o,{className:l[r]}),t.jsx("span",{className:"font-medium",children:i.label})]}):t.jsx("div",{className:Me("inline-flex items-center justify-center rounded-full transition-colors",i.bgColor,c[r],n),title:i.title,children:t.jsx(o,{className:Me(l[r],i.color)})})},Fe=(e,r={})=>{const n=localStorage.getItem("auth-token"),s={"Content-Type":"application/json"};return n&&(s.Authorization=`Bearer ${n}`),fetch(e,{...r,headers:{...s,...r.headers}})},Ue={auth:{status:()=>fetch("/api/auth/status"),login:(e,r)=>fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:r})}),register:(e,r)=>fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:r})}),user:()=>Fe("/api/auth/user"),logout:()=>Fe("/api/auth/logout",{method:"POST"})},config:()=>Fe("/api/config"),projects:()=>Fe("/api/projects"),sessions:(e,r=5,n=0)=>Fe(`/api/projects/${e}/sessions?limit=${r}&offset=${n}`),sessionMessages:(e,r,n=null,s=0)=>{const a=new URLSearchParams;n!==null&&(a.append("limit",n),a.append("offset",s));const i=a.toString(),o=`/api/projects/${e}/sessions/${r}/messages${i?`?${i}`:""}`;return Fe(o)},renameProject:(e,r)=>Fe(`/api/projects/${e}/rename`,{method:"PUT",body:JSON.stringify({displayName:r})}),deleteSession:(e,r)=>Fe(`/api/projects/${e}/sessions/${r}`,{method:"DELETE"}),deleteProject:e=>Fe(`/api/projects/${e}`,{method:"DELETE"}),createProject:e=>Fe("/api/projects/create",{method:"POST",body:JSON.stringify({path:e})}),readFile:(e,r)=>Fe(`/api/projects/${e}/file?filePath=${encodeURIComponent(r)}`),saveFile:(e,r,n)=>Fe(`/api/projects/${e}/file`,{method:"PUT",body:JSON.stringify({filePath:r,content:n})}),getFiles:e=>Fe(`/api/projects/${e}/files`),transcribe:e=>Fe("/api/transcribe",{method:"POST",body:e,headers:{}}),taskmaster:{init:e=>Fe(`/api/taskmaster/init/${e}`,{method:"POST"}),addTask:(e,{prompt:r,title:n,description:s,priority:a,dependencies:i})=>Fe(`/api/taskmaster/add-task/${e}`,{method:"POST",body:JSON.stringify({prompt:r,title:n,description:s,priority:a,dependencies:i})}),parsePRD:(e,{fileName:r,numTasks:n,append:s})=>Fe(`/api/taskmaster/parse-prd/${e}`,{method:"POST",body:JSON.stringify({fileName:r,numTasks:n,append:s})}),getTemplates:()=>Fe("/api/taskmaster/prd-templates"),applyTemplate:(e,{templateId:r,fileName:n,customizations:s})=>Fe(`/api/taskmaster/apply-template/${e}`,{method:"POST",body:JSON.stringify({templateId:r,fileName:n,customizations:s})}),updateTask:(e,r,n)=>Fe(`/api/taskmaster/update-task/${e}/${r}`,{method:"PUT",body:JSON.stringify(n)})},browseFilesystem:(e=null)=>{const r=new URLSearchParams;return e&&r.append("path",e),Fe(`/api/browse-filesystem?${r}`)},get:e=>Fe(`/api${e}`)},dc=f.createContext({user:null,token:null,login:()=>{},register:()=>{},logout:()=>{},isLoading:!0,needsSetup:!1,error:null}),Es=()=>{const e=f.useContext(dc);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},Ph=({children:e})=>{const[r,n]=f.useState(null),[s,a]=f.useState(localStorage.getItem("auth-token")),[i,o]=f.useState(!0),[l,c]=f.useState(!1),[d,u]=f.useState(null);f.useEffect(()=>{m()},[]);const m=async()=>{try{if(o(!0),u(null),(await(await Ue.auth.status()).json()).needsSetup){c(!0),o(!1);return}if(s)try{const N=await Ue.auth.user();if(N.ok){const y=await N.json();n(y.user),c(!1)}else localStorage.removeItem("auth-token"),a(null),n(null)}catch(N){console.error("Token verification failed:",N),localStorage.removeItem("auth-token"),a(null),n(null)}}catch(b){console.error("Auth status check failed:",b),u("Failed to check authentication status")}finally{o(!1)}},x={user:r,token:s,login:async(b,k)=>{try{u(null);const N=await Ue.auth.login(b,k),y=await N.json();return N.ok?(a(y.token),n(y.user),localStorage.setItem("auth-token",y.token),{success:!0}):(u(y.error||"Login failed"),{success:!1,error:y.error||"Login failed"})}catch(N){console.error("Login error:",N);const y="Network error. Please try again.";return u(y),{success:!1,error:y}}},register:async(b,k)=>{try{u(null);const N=await Ue.auth.register(b,k),y=await N.json();return N.ok?(a(y.token),n(y.user),c(!1),localStorage.setItem("auth-token",y.token),{success:!0}):(u(y.error||"Registration failed"),{success:!1,error:y.error||"Registration failed"})}catch(N){console.error("Registration error:",N);const y="Network error. Please try again.";return u(y),{success:!1,error:y}}},logout:()=>{a(null),n(null),localStorage.removeItem("auth-token"),s&&Ue.auth.logout().catch(b=>{console.error("Logout endpoint error:",b)})},isLoading:i,needsSetup:l,error:d};return t.jsx(dc.Provider,{value:x,children:e})};function Lh(){const[e,r]=f.useState(null),[n,s]=f.useState([]),[a,i]=f.useState(!1),o=f.useRef(null);f.useEffect(()=>(l(),()=>{o.current&&clearTimeout(o.current),e&&e.close()}),[]);const l=async()=>{try{const d=localStorage.getItem("auth-token");if(!d){console.warn("No authentication token found for WebSocket connection");return}let u;try{if(u=(await(await fetch("/api/config",{headers:{Authorization:`Bearer ${d}`}})).json()).wsUrl,u.includes("localhost")&&!window.location.hostname.includes("localhost")){const x=window.location.protocol==="https:"?"wss:":"ws:",b=window.location.port==="3001"?"3002":window.location.port;u=`${x}//${window.location.hostname}:${b}`}}catch{console.warn("Could not fetch server config, falling back to current host with API server port");const g=window.location.protocol==="https:"?"wss:":"ws:",x=window.location.port==="3001"?"3002":window.location.port;u=`${g}//${window.location.hostname}:${x}`}const m=`${u}/ws?token=${encodeURIComponent(d)}`,h=new WebSocket(m);h.onopen=()=>{i(!0),r(h)},h.onmessage=p=>{try{const g=JSON.parse(p.data);s(x=>[...x,g])}catch(g){console.error("Error parsing WebSocket message:",g)}},h.onclose=()=>{i(!1),r(null),o.current=setTimeout(()=>{l()},3e3)},h.onerror=p=>{console.error("WebSocket error:",p)}}catch(d){console.error("Error creating WebSocket connection:",d)}};return{ws:e,sendMessage:d=>{e&&a?e.send(JSON.stringify(d)):console.warn("WebSocket not connected")},messages:n,isConnected:a}}const uc=f.createContext({ws:null,sendMessage:()=>{},messages:[],isConnected:!1}),mc=()=>{const e=f.useContext(uc);if(!e)throw new Error("useWebSocketContext must be used within a WebSocketProvider");return e},Rh=({children:e})=>{const r=Lh();return t.jsx(uc.Provider,{value:r,children:e})},pc=f.createContext({projects:[],currentProject:null,projectTaskMaster:null,mcpServerStatus:null,tasks:[],nextTask:null,isLoading:!1,isLoadingTasks:!1,isLoadingMCP:!1,error:null,refreshProjects:()=>{},setCurrentProject:()=>{},refreshTasks:()=>{},refreshMCPStatus:()=>{},clearError:()=>{}}),On=()=>{const e=f.useContext(pc);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e},_h=({children:e})=>{const{messages:r}=mc(),{user:n,token:s,isLoading:a}=Es(),[i,o]=f.useState([]),[l,c]=f.useState(null),[d,u]=f.useState(null),[m,h]=f.useState(null),[p,g]=f.useState([]),[x,b]=f.useState(null),[k,N]=f.useState(!1),[y,P]=f.useState(!1),[W,M]=f.useState(!1),[B,L]=f.useState(null),U=(z,Z)=>{console.error(`TaskMaster ${Z} error:`,z),L({message:z.message||`Failed to ${Z}`,context:Z,timestamp:new Date().toISOString()})},j=f.useCallback(()=>{L(null)},[]),R=f.useCallback(async()=>{if(!n||!s){o([]),c(null);return}try{N(!0),j();const z=await Ue.get("/projects");if(!z.ok)throw new Error(`Failed to fetch projects: ${z.status}`);const Z=await z.json();if(!Array.isArray(Z)){console.error("Projects API returned non-array data:",Z),o([]);return}const F=Z.map(ce=>({...ce,taskMasterConfigured:ce.taskmaster?.hasTaskmaster||!1,taskMasterStatus:ce.taskmaster?.status||"not-configured",taskCount:ce.taskmaster?.metadata?.taskCount||0,completedCount:ce.taskmaster?.metadata?.completed||0}));if(o(F),l){const ce=F.find(v=>v.name===l.name);ce&&(c(ce),u(ce.taskmaster))}}catch(z){U(z,"load projects")}finally{N(!1)}},[n,s]),D=f.useCallback(async z=>{try{if(c(z),g([]),b(null),u(null),z?.name)try{const Z=await Ue.get(`/taskmaster/detect/${encodeURIComponent(z.name)}`);if(Z.ok){const F=await Z.json();u(F.taskmaster)}else console.warn("Individual TaskMaster detection failed, using project data:",Z.status),u(z.taskmaster||null)}catch(Z){console.warn("TaskMaster detection error, using project data:",Z.message),u(z.taskmaster||null)}else u(null)}catch(Z){console.error("Error in setCurrentProject:",Z),U(Z,"set current project"),u(z?.taskmaster||null)}},[]),_=f.useCallback(async()=>{if(!n||!s){h(null);return}try{M(!0),j();const z=await Ue.get("/mcp-utils/taskmaster-server");h(z)}catch(z){U(z,"check MCP server status")}finally{M(!1)}},[n,s]),C=f.useCallback(async()=>{if(!l){g([]),b(null);return}if(!n||!s){g([]),b(null);return}try{P(!0),j();const z=await Ue.get(`/taskmaster/tasks/${encodeURIComponent(l.name)}`);if(!z.ok){const ce=await z.json();throw new Error(ce.message||"Failed to load tasks")}const Z=await z.json();g(Z.tasks||[]);const F=Z.tasks?.find(ce=>ce.status==="pending"||ce.status==="in-progress")||null;b(F)}catch(z){console.error("Error loading tasks:",z),U(z,"load tasks"),g([]),b(null)}finally{P(!1)}},[l,n,s]);f.useEffect(()=>{!a&&n&&s?(R(),_()):console.log("Auth not ready or no user, skipping project load:",{authLoading:a,user:!!n,token:!!s})},[R,_,a,n,s]),f.useEffect(()=>{n&&s&&j()},[n,s,j]),f.useEffect(()=>{l?.name&&n&&s&&C()},[l?.name,n,s,C]),f.useEffect(()=>{const z=r[r.length-1];if(z)switch(z.type){case"taskmaster-project-updated":z.projectName&&R();break;case"taskmaster-tasks-updated":z.projectName===l?.name&&C();break;case"taskmaster-mcp-status-changed":_();break}},[r,R,C,_,l]);const V={projects:i,currentProject:l,projectTaskMaster:d,mcpServerStatus:m,tasks:p,nextTask:x,isLoading:k,isLoadingTasks:y,isLoadingMCP:W,error:B,refreshProjects:R,setCurrentProject:D,refreshTasks:C,refreshMCPStatus:_,clearError:j};return t.jsx(pc.Provider,{value:V,children:e})},hc=f.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Bn=()=>{const e=f.useContext(hc);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},zh=({children:e})=>{const[r,n]=f.useState(()=>{const p=localStorage.getItem("tasks-enabled");return p!==null?JSON.parse(p):!0}),[s,a]=f.useState(null),[i,o]=f.useState(null),[l,c]=f.useState(null),[d,u]=f.useState(!0);f.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(r))},[r]),f.useEffect(()=>{setTimeout(async()=>{try{const g=await Ue.get("/taskmaster/installation-status");if(g.ok){const x=await g.json();c(x),a(x.installation?.isInstalled||!1),o(x.isReady||!1);const b=localStorage.getItem("tasks-enabled");!x.installation?.isInstalled&&!b&&n(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(g){console.error("Error checking TaskMaster installation:",g),a(!1),o(!1)}finally{u(!1)}},0)},[]);const h={tasksEnabled:r,setTasksEnabled:n,toggleTasksEnabled:()=>{n(p=>!p)},isTaskMasterInstalled:s,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:d};return t.jsx(hc.Provider,{value:h,children:e})},to=(e,r)=>{const n=new Date(e),s=r;if(isNaN(n.getTime()))return"Unknown";const a=s-n,i=Math.floor(a/1e3),o=Math.floor(a/(1e3*60)),l=Math.floor(a/(1e3*60*60)),c=Math.floor(a/(1e3*60*60*24));return i<60?"Just now":o===1?"1 min ago":o<60?`${o} mins ago`:l===1?"1 hour ago":l<24?`${l} hours ago`:c===1?"1 day ago":c<7?`${c} days ago`:n.toLocaleDateString()};function ro({projects:e,selectedProject:r,selectedSession:n,onProjectSelect:s,onSessionSelect:a,onNewSession:i,onSessionDelete:o,onProjectDelete:l,isLoading:c,onRefresh:d,onShowSettings:u,updateAvailable:m,latestVersion:h,currentVersion:p,releaseInfo:g,onShowVersionModal:x,isPWA:b,isMobile:k,onToggleSidebar:N}){const[y,P]=f.useState(new Set),[W,M]=f.useState(null),[B,L]=f.useState(!1),[U,j]=f.useState(""),[R,D]=f.useState(""),[_,C]=f.useState(!1),[V,z]=f.useState({}),[Z,F]=f.useState({}),[ce,v]=f.useState(new Set),[ue,fe]=f.useState(new Date),[w,J]=f.useState("name"),[he,ye]=f.useState(!1),[re,Pe]=f.useState(null),[X,le]=f.useState(""),[ke,ge]=f.useState({}),[Ie,Ke]=f.useState(""),[et,st]=f.useState(!1),[ft,tt]=f.useState([]),[xe,qe]=f.useState([]),[it,ve]=f.useState(-1),{setCurrentProject:Ct,mcpServerStatus:Q}=On(),{tasksEnabled:de}=Bn(),[T,O]=f.useState(()=>{try{const I=localStorage.getItem("starredProjects");return I?new Set(JSON.parse(I)):new Set}catch(I){return console.error("Error loading starred projects:",I),new Set}}),ne=I=>E=>{E.target.closest(".overflow-y-auto")||E.target.closest("[data-scroll-container]")||(E.preventDefault(),E.stopPropagation(),I())};f.useEffect(()=>{const I=setInterval(()=>{fe(new Date)},6e4);return()=>clearInterval(I)},[]),f.useEffect(()=>{F({}),v(new Set)},[e]),f.useEffect(()=>{n&&r&&P(I=>new Set([...I,r.name]))},[n,r]),f.useEffect(()=>{if(e.length>0&&!c){const I=new Set;e.forEach(E=>{E.sessions&&E.sessions.length>=0&&I.add(E.name)}),v(I)}},[e,c]),f.useEffect(()=>{const I=()=>{try{const ae=localStorage.getItem("claude-settings");if(ae){const q=JSON.parse(ae);J(q.projectSortOrder||"name")}}catch(ae){console.error("Error loading sort order:",ae)}};I();const E=ae=>{ae.key==="claude-settings"&&I()};window.addEventListener("storage",E);const $=setInterval(()=>{document.hasFocus()&&I()},1e3);return()=>{window.removeEventListener("storage",E),clearInterval($)}},[]),f.useEffect(()=>{(async()=>{try{const E=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]"),ae=await(await Ue.browseFilesystem()).json();if(ae.suggestions){const q=ae.suggestions.map(at=>({name:at.name,path:at.path})),_e=[...E.map(at=>({name:at.split("/").pop(),path:at})),...q];tt(_e)}else tt(E.map(q=>({name:q.split("/").pop(),path:q})))}catch(E){console.error("Error loading paths:",E);const $=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]");tt($.map(ae=>({name:ae.split("/").pop(),path:ae})))}})()},[]),f.useEffect(()=>{const I=R.trim();if(I.length===0){st(!1);return}st(!0),(async()=>{const $=ft.filter(q=>q.name.toLowerCase().includes(I.toLowerCase())||q.path.toLowerCase().includes(I.toLowerCase()));if(I.includes("/")&&I.length>1)try{let q;if(I.endsWith("/"))q=I.slice(0,-1);else{const _e=I.lastIndexOf("/");q=I.substring(0,_e)}if(q&&q!==""){const at=await(await Ue.browseFilesystem(q)).json();if(at.suggestions){const St=I.substring(I.lastIndexOf("/")+1),wt=[...at.suggestions.filter(Mt=>{const _t=Mt.name;return St?_t.toLowerCase().startsWith(St.toLowerCase()):!0}).map(Mt=>({name:Mt.name,path:Mt.path})).slice(0,8),...$].slice(0,8);qe(wt),ve(-1);return}}}catch(q){console.debug("Dynamic browsing failed:",q.message)}qe($.slice(0,8)),ve(-1)})()},[R,ft]);const Ce=I=>{D(I.path),st(!1),ve(-1)},De=I=>{try{const E=JSON.parse(localStorage.getItem("recentProjectPaths")||"[]"),$=[I,...E.filter(ae=>ae!==I)].slice(0,10);localStorage.setItem("recentProjectPaths",JSON.stringify($))}catch(E){console.error("Error saving recent paths:",E)}},ee=I=>{const E=new Set;y.has(I)||E.add(I),P(E)},me=(I,E)=>{a({...I,__projectName:E})},oe=I=>{const E=new Set(T);E.has(I)?E.delete(I):E.add(I),O(E);try{localStorage.setItem("starredProjects",JSON.stringify([...E]))}catch($){console.error("Error saving starred projects:",$)}},we=I=>T.has(I),Ee=I=>{const E=[...I.sessions||[],...Z[I.name]||[]].map(q=>({...q,__provider:"claude"})),$=(I.cursorSessions||[]).map(q=>({...q,__provider:"cursor"})),ae=q=>new Date(q.__provider==="cursor"?q.createdAt:q.lastActivity);return[...E,...$].sort((q,_e)=>ae(_e)-ae(q))},Be=I=>{const E=Ee(I);return E.length===0?new Date(0):E.reduce((ae,q)=>{const _e=new Date(q.lastActivity);return _e>ae?_e:ae},new Date(0))},ze=[...e].sort((I,E)=>{const $=we(I.name),ae=we(E.name);if($&&!ae)return-1;if(!$&&ae)return 1;if(w==="date")return Be(E)-Be(I);{const q=I.displayName||I.name,_e=E.displayName||E.name;return q.localeCompare(_e)}}),Xe=I=>{M(I.name),j(I.displayName)},gt=()=>{M(null),j("")},ot=async I=>{try{(await Ue.renameProject(I,U)).ok?window.refreshProjects?window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(E){console.error("Error renaming project:",E)}M(null),j("")},vt=async(I,E)=>{if(confirm("Are you sure you want to delete this session? This action cannot be undone."))try{(await Ue.deleteSession(I,E)).ok?o&&o(E):(console.error("Failed to delete session"),alert("Failed to delete session. Please try again."))}catch($){console.error("Error deleting session:",$),alert("Error deleting session. Please try again.")}},Gt=async I=>{if(confirm("Are you sure you want to delete this empty project? This action cannot be undone."))try{const E=await Ue.deleteProject(I);if(E.ok)l&&l(I);else{const $=await E.json();console.error("Failed to delete project"),alert($.error||"Failed to delete project. Please try again.")}}catch(E){console.error("Error deleting project:",E),alert("Error deleting project. Please try again.")}},Kt=async()=>{if(!R.trim()){alert("Please enter a project path");return}C(!0);try{const I=await Ue.createProject(R.trim());if(I.ok){const E=await I.json();De(R.trim()),L(!1),D(""),setShowSuggestions(!1),window.refreshProjects?window.refreshProjects():window.location.reload()}else{const E=await I.json();alert(E.error||"Failed to create project. Please try again.")}}catch(I){console.error("Error creating project:",I),alert("Error creating project. Please try again.")}finally{C(!1)}},Nt=()=>{L(!1),D(""),setShowSuggestions(!1)},Wt=async I=>{if(!(!(I.sessionMeta?.hasMore!==!1)||V[I.name])){z($=>({...$,[I.name]:!0}));try{const $=(I.sessions?.length||0)+(Z[I.name]?.length||0),ae=await Ue.sessions(I.name,5,$);if(ae.ok){const q=await ae.json();F(_e=>({..._e,[I.name]:[..._e[I.name]||[],...q.sessions]})),q.hasMore===!1&&(I.sessionMeta={...I.sessionMeta,hasMore:!1})}}catch($){console.error("Error loading more sessions:",$)}finally{z($=>({...$,[I.name]:!1}))}}},Jt=ze.filter(I=>{if(!Ie.trim())return!0;const E=Ie.toLowerCase(),$=(I.displayName||I.name).toLowerCase(),ae=I.name.toLowerCase();return $.includes(E)||ae.includes(E)}),Rt=I=>{s(I),Ct(I)};return t.jsxs("div",{className:"h-full flex flex-col bg-card md:select-none",style:b&&k?{paddingTop:"44px"}:{},children:[t.jsxs("div",{className:"md:p-4 md:border-b md:border-border",children:[t.jsxs("div",{className:"hidden md:flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:t.jsx(Dn,{className:"w-4 h-4 text-primary-foreground"})}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg font-bold text-foreground",children:"Claude Code UI"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"AI coding assistant interface"})]})]}),N&&t.jsx(Le,{variant:"ghost",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200",onClick:N,title:"Hide sidebar",children:t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),t.jsx("div",{className:"md:hidden p-3 border-b border-border",style:b&&k?{paddingTop:"16px"}:{},children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center",children:t.jsx(Dn,{className:"w-4 h-4 text-primary-foreground"})}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Claude Code UI"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Projects"})]})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{className:"w-8 h-8 rounded-md bg-background border border-border flex items-center justify-center active:scale-95 transition-all duration-150",onClick:async()=>{ye(!0);try{await d()}finally{ye(!1)}},disabled:he,children:t.jsx(Sr,{className:`w-4 h-4 text-foreground ${he?"animate-spin":""}`})}),t.jsx("button",{className:"w-8 h-8 rounded-md bg-primary text-primary-foreground flex items-center justify-center active:scale-95 transition-all duration-150",onClick:()=>L(!0),children:t.jsx(Qn,{className:"w-4 h-4"})})]})]})})]}),B&&t.jsxs("div",{className:"md:p-3 md:border-b md:border-border md:bg-muted/30",children:[t.jsxs("div",{className:"hidden md:block space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t.jsx(Qn,{className:"w-4 h-4"}),"Create New Project"]}),t.jsxs("div",{className:"relative",children:[t.jsx(Et,{value:R,onChange:I=>D(I.target.value),placeholder:"/path/to/project or relative/path",className:"text-sm focus:ring-2 focus:ring-primary/20",autoFocus:!0,onKeyDown:I=>{if(et&&xe.length>0){if(I.key==="ArrowDown")I.preventDefault(),ve(E=>E<xe.length-1?E+1:0);else if(I.key==="ArrowUp")I.preventDefault(),ve(E=>E>0?E-1:xe.length-1);else if(I.key==="Enter"){I.preventDefault(),it>=0?Ce(xe[it]):xe.length>0?Ce(xe[0]):Kt();return}else if(I.key==="Escape"){I.preventDefault(),st(!1);return}else if(I.key==="Tab"){I.preventDefault(),it>=0?Ce(xe[it]):xe.length>0&&Ce(xe[0]);return}}I.key==="Enter"&&Kt(),I.key==="Escape"&&Nt()}}),et&&xe.length>0&&t.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-popover border border-border rounded-md shadow-lg max-h-48 overflow-y-auto z-50",children:xe.map((I,E)=>t.jsx("div",{className:`px-3 py-2 cursor-pointer border-b border-border last:border-b-0 ${E===it?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:$=>{$.preventDefault(),$.stopPropagation()},onClick:$=>{$.preventDefault(),$.stopPropagation(),Ce(I)},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(or,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-sm",children:I.name}),t.jsx("div",{className:"text-xs text-muted-foreground font-mono",children:I.path})]})]})},I.path))})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Le,{size:"sm",onClick:Kt,disabled:!R.trim()||_,className:"flex-1 h-8 text-xs hover:bg-primary/90 transition-colors",children:_?"Creating...":"Create Project"}),t.jsx(Le,{size:"sm",variant:"outline",onClick:Nt,disabled:_,className:"h-8 text-xs hover:bg-accent transition-colors",children:"Cancel"})]})]}),t.jsx("div",{className:"md:hidden fixed inset-0 z-[70] bg-black/50 backdrop-blur-sm flex items-end justify-center px-4 pb-24",children:t.jsxs("div",{className:"w-full max-w-sm bg-card rounded-t-lg border-t border-border p-4 space-y-4 animate-in slide-in-from-bottom duration-300",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-6 h-6 bg-primary/10 rounded-md flex items-center justify-center",children:t.jsx(Qn,{className:"w-3 h-3 text-primary"})}),t.jsx("div",{children:t.jsx("h2",{className:"text-base font-semibold text-foreground",children:"New Project"})})]}),t.jsx("button",{onClick:Nt,disabled:_,className:"w-6 h-6 rounded-md bg-muted flex items-center justify-center active:scale-95 transition-transform",children:t.jsx(ct,{className:"w-3 h-3"})})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"relative",children:[t.jsx(Et,{value:R,onChange:I=>D(I.target.value),placeholder:"/path/to/project or relative/path",className:"text-sm h-10 rounded-md focus:border-primary transition-colors",autoFocus:!0,onKeyDown:I=>{if(et&&xe.length>0){if(I.key==="ArrowDown")I.preventDefault(),ve(E=>E<xe.length-1?E+1:0);else if(I.key==="ArrowUp")I.preventDefault(),ve(E=>E>0?E-1:xe.length-1);else if(I.key==="Enter"){I.preventDefault(),it>=0?Ce(xe[it]):xe.length>0?Ce(xe[0]):Kt();return}else if(I.key==="Escape"){I.preventDefault(),st(!1);return}}I.key==="Enter"&&Kt(),I.key==="Escape"&&Nt()},style:{fontSize:"16px",WebkitAppearance:"none"}}),et&&xe.length>0&&t.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-popover border border-border rounded-md shadow-lg max-h-40 overflow-y-auto",children:xe.map((I,E)=>t.jsx("div",{className:`px-3 py-2.5 cursor-pointer border-b border-border last:border-b-0 active:scale-95 transition-all ${E===it?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:$=>{$.preventDefault(),$.stopPropagation()},onClick:$=>{$.preventDefault(),$.stopPropagation(),Ce(I)},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(or,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-sm",children:I.name}),t.jsx("div",{className:"text-xs text-muted-foreground font-mono",children:I.path})]})]})},I.path))})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Le,{onClick:Nt,disabled:_,variant:"outline",className:"flex-1 h-9 text-sm rounded-md active:scale-95 transition-transform",children:"Cancel"}),t.jsx(Le,{onClick:Kt,disabled:!R.trim()||_,className:"flex-1 h-9 text-sm rounded-md bg-primary hover:bg-primary/90 active:scale-95 transition-all",children:_?"Creating...":"Create"})]})]}),t.jsx("div",{className:"h-4"})]})})]}),e.length>0&&!c&&t.jsxs("div",{className:"px-3 md:px-4 py-2 border-b border-border space-y-2",children:[t.jsxs("div",{className:"relative",children:[t.jsx(nn,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),t.jsx(Et,{type:"text",placeholder:"Search projects...",value:Ie,onChange:I=>Ke(I.target.value),className:"pl-9 h-9 text-sm bg-muted/50 border-0 focus:bg-background focus:ring-1 focus:ring-primary/20"}),Ie&&t.jsx("button",{onClick:()=>Ke(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 hover:bg-accent rounded",children:t.jsx(ct,{className:"w-3 h-3 text-muted-foreground"})})]}),!k&&t.jsxs("div",{className:"flex gap-2",children:[t.jsxs(Le,{variant:"default",size:"sm",className:"flex-1 h-8 text-xs bg-primary hover:bg-primary/90 transition-all duration-200",onClick:()=>L(!0),title:"Create new project (Ctrl+N)",children:[t.jsx(Qn,{className:"w-3.5 h-3.5 mr-1.5"}),"New Project"]}),t.jsx(Le,{variant:"outline",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200 group",onClick:async()=>{ye(!0);try{await d()}finally{ye(!1)}},disabled:he,title:"Refresh projects and sessions (Ctrl+R)",children:t.jsx(Sr,{className:`w-3.5 h-3.5 ${he?"animate-spin":""} group-hover:rotate-180 transition-transform duration-300`})})]})]}),t.jsx(si,{className:"flex-1 md:px-2 md:py-3 overflow-y-auto overscroll-contain",children:t.jsx("div",{className:"md:space-y-1 pb-safe-area-inset-bottom",children:c?t.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[t.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:t.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),t.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"Loading projects..."}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Fetching your Claude projects and sessions"})]}):e.length===0?t.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[t.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:t.jsx(or,{className:"w-6 h-6 text-muted-foreground"})}),t.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"No projects found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Run Claude CLI in a project directory to get started"})]}):Jt.length===0?t.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[t.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:t.jsx(nn,{className:"w-6 h-6 text-muted-foreground"})}),t.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"No matching projects"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Try adjusting your search term"})]}):Jt.map(I=>{const E=y.has(I.name),$=r?.name===I.name,ae=we(I.name);return t.jsxs("div",{className:"md:space-y-1",children:[t.jsxs("div",{className:"group md:group",children:[t.jsx("div",{className:"md:hidden",children:t.jsx("div",{className:Me("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",$&&"bg-primary/5 border-primary/20",ae&&!$&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:()=>{ee(I.name)},onTouchEnd:ne(()=>ee(I.name)),children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[t.jsx("div",{className:Me("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",E?"bg-primary/10":"bg-muted"),children:E?t.jsx($r,{className:"w-4 h-4 text-primary"}):t.jsx(or,{className:"w-4 h-4 text-muted-foreground"})}),t.jsx("div",{className:"min-w-0 flex-1",children:W===I.name?t.jsx("input",{type:"text",value:U,onChange:q=>j(q.target.value),className:"w-full px-3 py-2 text-sm border-2 border-primary/40 focus:border-primary rounded-lg bg-background text-foreground shadow-sm focus:shadow-md transition-all duration-200 focus:outline-none",placeholder:"Project name",autoFocus:!0,autoComplete:"off",onClick:q=>q.stopPropagation(),onKeyDown:q=>{q.key==="Enter"&&ot(I.name),q.key==="Escape"&&gt()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between min-w-0 flex-1",children:[t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:I.displayName}),de&&t.jsx(Dh,{status:(()=>{const q=I.taskmaster?.hasTaskmaster,_e=Q?.hasMCPServer&&Q?.isConfigured;return q&&_e?"fully-configured":q?"taskmaster-only":_e?"mcp-only":"not-configured"})(),size:"xs",className:"hidden md:inline-flex flex-shrink-0 ml-2"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:(()=>{const q=Ee(I).length,at=I.sessionMeta?.hasMore!==!1&&q>=5?`${q}+`:q;return`${at} session${at===1?"":"s"}`})()})]})})]}),t.jsx("div",{className:"flex items-center gap-1",children:W===I.name?t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"w-8 h-8 rounded-lg bg-green-500 dark:bg-green-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:q=>{q.stopPropagation(),ot(I.name)},children:t.jsx(Fr,{className:"w-4 h-4 text-white"})}),t.jsx("button",{className:"w-8 h-8 rounded-lg bg-gray-500 dark:bg-gray-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:q=>{q.stopPropagation(),gt()},children:t.jsx(ct,{className:"w-4 h-4 text-white"})})]}):t.jsxs(t.Fragment,{children:[t.jsx("button",{className:Me("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",ae?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:q=>{q.stopPropagation(),oe(I.name)},onTouchEnd:ne(()=>oe(I.name)),title:ae?"Remove from favorites":"Add to favorites",children:t.jsx(Ki,{className:Me("w-4 h-4 transition-colors",ae?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),Ee(I).length===0&&t.jsx("button",{className:"w-8 h-8 rounded-lg bg-red-500/10 dark:bg-red-900/30 flex items-center justify-center active:scale-90 border border-red-200 dark:border-red-800",onClick:q=>{q.stopPropagation(),Gt(I.name)},onTouchEnd:ne(()=>Gt(I.name)),children:t.jsx(nr,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),t.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center active:scale-90 border border-primary/20 dark:border-primary/30",onClick:q=>{q.stopPropagation(),Xe(I)},onTouchEnd:ne(()=>Xe(I)),children:t.jsx(ya,{className:"w-4 h-4 text-primary"})}),t.jsx("div",{className:"w-6 h-6 rounded-md bg-muted/30 flex items-center justify-center",children:E?t.jsx(Zt,{className:"w-3 h-3 text-muted-foreground"}):t.jsx(Er,{className:"w-3 h-3 text-muted-foreground"})})]})})]})})}),t.jsxs(Le,{variant:"ghost",className:Me("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",$&&"bg-accent text-accent-foreground",ae&&!$&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:()=>{r?.name!==I.name&&Rt(I),ee(I.name)},onTouchEnd:ne(()=>{r?.name!==I.name&&Rt(I),ee(I.name)}),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[E?t.jsx($r,{className:"w-4 h-4 text-primary flex-shrink-0"}):t.jsx(or,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),t.jsx("div",{className:"min-w-0 flex-1 text-left",children:W===I.name?t.jsxs("div",{className:"space-y-1",children:[t.jsx("input",{type:"text",value:U,onChange:q=>j(q.target.value),className:"w-full px-2 py-1 text-sm border border-border rounded bg-background text-foreground focus:ring-2 focus:ring-primary/20",placeholder:"Project name",autoFocus:!0,onKeyDown:q=>{q.key==="Enter"&&ot(I.name),q.key==="Escape"&&gt()}}),t.jsx("div",{className:"text-xs text-muted-foreground truncate",title:I.fullPath,children:I.fullPath})]}):t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-semibold truncate text-foreground",title:I.displayName,children:I.displayName}),t.jsxs("div",{className:"text-xs text-muted-foreground",children:[(()=>{const q=Ee(I).length;return I.sessionMeta?.hasMore!==!1&&q>=5?`${q}+`:q})(),I.fullPath!==I.displayName&&t.jsxs("span",{className:"ml-1 opacity-60",title:I.fullPath,children:["• ",I.fullPath.length>25?"..."+I.fullPath.slice(-22):I.fullPath]})]})]})})]}),t.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:W===I.name?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-6 h-6 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:q=>{q.stopPropagation(),ot(I.name)},children:t.jsx(Fr,{className:"w-3 h-3"})}),t.jsx("div",{className:"w-6 h-6 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:q=>{q.stopPropagation(),gt()},children:t.jsx(ct,{className:"w-3 h-3"})})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:Me("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",ae?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:q=>{q.stopPropagation(),oe(I.name)},title:ae?"Remove from favorites":"Add to favorites",children:t.jsx(Ki,{className:Me("w-3 h-3 transition-colors",ae?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),t.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-accent flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:q=>{q.stopPropagation(),Xe(I)},title:"Rename project (F2)",children:t.jsx(ya,{className:"w-3 h-3"})}),Ee(I).length===0&&t.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:q=>{q.stopPropagation(),Gt(I.name)},title:"Delete empty project (Delete)",children:t.jsx(nr,{className:"w-3 h-3 text-red-600 dark:text-red-400"})}),E?t.jsx(Zt,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"}):t.jsx(Er,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]}),E&&t.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[ce.has(I.name)?Ee(I).length===0&&!V[I.name]?t.jsx("div",{className:"py-2 px-3 text-left",children:t.jsx("p",{className:"text-xs text-muted-foreground",children:"No sessions yet"})}):Ee(I).map(q=>{const _e=q.__provider==="cursor",at=new Date(_e?q.createdAt:q.lastActivity),Tr=Math.floor((ue-at)/(1e3*60))<10,wt=_e?q.name||"Untitled Session":q.summary||"New Session",Mt=_e?q.createdAt:q.lastActivity,_t=q.messageCount||0;return t.jsxs("div",{className:"group relative",children:[Tr&&t.jsx("div",{className:"absolute left-0 top-1/2 transform -translate-y-1/2 -translate-x-1",children:t.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"})}),t.jsx("div",{className:"md:hidden",children:t.jsx("div",{className:Me("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",n?.id===q.id?"bg-primary/5 border-primary/20":Tr?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:()=>{Rt(I),me(q,I.name)},onTouchEnd:ne(()=>{Rt(I),me(q,I.name)}),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:Me("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",n?.id===q.id?"bg-primary/10":"bg-muted/50"),children:_e?t.jsx(hr,{className:"w-3 h-3"}):t.jsx(lr,{className:"w-3 h-3"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:wt}),t.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[t.jsx(Tn,{className:"w-2.5 h-2.5 text-muted-foreground"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:to(Mt,ue)}),_t>0&&t.jsx(Or,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:_t}),t.jsx("span",{className:"ml-1 opacity-70",children:_e?t.jsx(hr,{className:"w-3 h-3"}):t.jsx(lr,{className:"w-3 h-3"})})]})]}),!_e&&t.jsx("button",{className:"w-5 h-5 rounded-md bg-red-50 dark:bg-red-900/20 flex items-center justify-center active:scale-95 transition-transform opacity-70 ml-1",onClick:xt=>{xt.stopPropagation(),vt(I.name,q.id)},onTouchEnd:ne(()=>vt(I.name,q.id)),children:t.jsx(nr,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})]})})}),t.jsxs("div",{className:"hidden md:block",children:[t.jsx(Le,{variant:"ghost",className:Me("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",n?.id===q.id&&"bg-accent text-accent-foreground"),onClick:()=>me(q,I.name),onTouchEnd:ne(()=>me(q,I.name)),children:t.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[_e?t.jsx(hr,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}):t.jsx(lr,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:wt}),t.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[t.jsx(Tn,{className:"w-2.5 h-2.5 text-muted-foreground"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:to(Mt,ue)}),_t>0&&t.jsx(Or,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:_t}),t.jsx("span",{className:"ml-1 opacity-70",children:_e?t.jsx(hr,{className:"w-3 h-3"}):t.jsx(lr,{className:"w-3 h-3"})})]})]})]})}),!_e&&t.jsx("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all duration-200",children:re===q.id?t.jsxs(t.Fragment,{children:[t.jsx("input",{type:"text",value:X,onChange:xt=>le(xt.target.value),onKeyDown:xt=>{xt.stopPropagation(),xt.key==="Enter"?updateSessionSummary(I.name,q.id,X):xt.key==="Escape"&&(Pe(null),le(""))},onClick:xt=>xt.stopPropagation(),className:"w-32 px-2 py-1 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),t.jsx("button",{className:"w-6 h-6 bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40 rounded flex items-center justify-center",onClick:xt=>{xt.stopPropagation(),updateSessionSummary(I.name,q.id,X)},title:"Save",children:t.jsx(Fr,{className:"w-3 h-3 text-green-600 dark:text-green-400"})}),t.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:xt=>{xt.stopPropagation(),Pe(null),le("")},title:"Cancel",children:t.jsx(ct,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})})]}):t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:xt=>{xt.stopPropagation(),Pe(q.id),le(q.summary||"New Session")},title:"Manually edit session name",children:t.jsx(vp,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),t.jsx("button",{className:"w-6 h-6 bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40 rounded flex items-center justify-center",onClick:xt=>{xt.stopPropagation(),vt(I.name,q.id)},title:"Delete this session permanently",children:t.jsx(nr,{className:"w-3 h-3 text-red-600 dark:text-red-400"})})]})})]})]},q.id)}):Array.from({length:3}).map((q,_e)=>t.jsx("div",{className:"p-2 rounded-md",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("div",{className:"w-3 h-3 bg-muted rounded-full animate-pulse mt-0.5"}),t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("div",{className:"h-3 bg-muted rounded animate-pulse",style:{width:`${60+_e*15}%`}}),t.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-1/2"})]})]})},_e)),Ee(I).length>0&&I.sessionMeta?.hasMore!==!1&&t.jsx(Le,{variant:"ghost",size:"sm",className:"w-full justify-center gap-2 mt-2 text-muted-foreground",onClick:()=>Wt(I),disabled:V[I.name],children:V[I.name]?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-3 h-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),"Loading..."]}):t.jsxs(t.Fragment,{children:[t.jsx(Zt,{className:"w-3 h-3"}),"Show more sessions"]})}),t.jsx("div",{className:"md:hidden px-3 pb-2",children:t.jsxs("button",{className:"w-full h-8 bg-primary hover:bg-primary/90 text-primary-foreground rounded-md flex items-center justify-center gap-2 font-medium text-xs active:scale-[0.98] transition-all duration-150",onClick:()=>{Rt(I),i(I)},children:[t.jsx(Dt,{className:"w-3 h-3"}),"New Session"]})}),t.jsxs(Le,{variant:"default",size:"sm",className:"hidden md:flex w-full justify-start gap-2 mt-1 h-8 text-xs font-medium bg-primary hover:bg-primary/90 text-primary-foreground transition-colors",onClick:()=>i(I),children:[t.jsx(Dt,{className:"w-3 h-3"}),"New Session"]})]})]},I.name)})})}),m&&t.jsxs("div",{className:"md:p-2 border-t border-border/50 flex-shrink-0",children:[t.jsx("div",{className:"hidden md:block",children:t.jsxs(Le,{variant:"ghost",className:"w-full justify-start gap-3 p-3 h-auto font-normal text-left hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors duration-200 border border-blue-200 dark:border-blue-700 rounded-lg mb-2",onClick:x,children:[t.jsxs("div",{className:"relative",children:[t.jsx("svg",{className:"w-4 h-4 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})}),t.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:g?.title||`Version ${h}`}),t.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:"Update available"})]})]})}),t.jsx("div",{className:"md:hidden p-3 pb-2",children:t.jsxs("button",{className:"w-full h-12 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700 rounded-xl flex items-center justify-start gap-3 px-4 active:scale-[0.98] transition-all duration-150",onClick:x,children:[t.jsxs("div",{className:"relative",children:[t.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})}),t.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),t.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[t.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:g?.title||`Version ${h}`}),t.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:"Update available"})]})]})})]}),t.jsxs("div",{className:"md:p-2 md:border-t md:border-border flex-shrink-0",children:[t.jsx("div",{className:"md:hidden p-4 pb-20 border-t border-border/50",children:t.jsxs("button",{className:"w-full h-14 bg-muted/50 hover:bg-muted/70 rounded-2xl flex items-center justify-start gap-4 px-4 active:scale-[0.98] transition-all duration-150",onClick:u,children:[t.jsx("div",{className:"w-10 h-10 rounded-2xl bg-background/80 flex items-center justify-center",children:t.jsx(Wr,{className:"w-5 h-5 text-muted-foreground"})}),t.jsx("span",{className:"text-lg font-medium text-foreground",children:"Settings"})]})}),t.jsxs(Le,{variant:"ghost",className:"hidden md:flex w-full justify-start gap-2 p-2 h-auto font-normal text-muted-foreground hover:text-foreground hover:bg-accent transition-colors duration-200",onClick:u,children:[t.jsx(Wr,{className:"w-3 h-3"}),t.jsx("span",{className:"text-xs",children:"Settings"})]})]})]})}function Fh(e,r){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $h=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Oh=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bh={};function no(e,r){return(Bh.jsx?Oh:$h).test(e)}const Wh=/[ \t\n\f\r]/g;function Uh(e){return typeof e=="object"?e.type==="text"?so(e.value):!1:so(e)}function so(e){return e.replace(Wh,"")===""}class Wn{constructor(r,n,s){this.normal=n,this.property=r,s&&(this.space=s)}}Wn.prototype.normal={};Wn.prototype.property={};Wn.prototype.space=void 0;function fc(e,r){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new Wn(n,s,r)}function Ca(e){return e.toLowerCase()}class Bt{constructor(r,n){this.attribute=n,this.property=r}}Bt.prototype.attribute="";Bt.prototype.booleanish=!1;Bt.prototype.boolean=!1;Bt.prototype.commaOrSpaceSeparated=!1;Bt.prototype.commaSeparated=!1;Bt.prototype.defined=!1;Bt.prototype.mustUseProperty=!1;Bt.prototype.number=!1;Bt.prototype.overloadedBoolean=!1;Bt.prototype.property="";Bt.prototype.spaceSeparated=!1;Bt.prototype.space=void 0;let Hh=0;const He=qr(),yt=qr(),Sa=qr(),se=qr(),mt=qr(),en=qr(),Ut=qr();function qr(){return 2**++Hh}const Ea=Object.freeze(Object.defineProperty({__proto__:null,boolean:He,booleanish:yt,commaOrSpaceSeparated:Ut,commaSeparated:en,number:se,overloadedBoolean:Sa,spaceSeparated:mt},Symbol.toStringTag,{value:"Module"})),Us=Object.keys(Ea);class ai extends Bt{constructor(r,n,s,a){let i=-1;if(super(r,n),ao(this,"space",a),typeof s=="number")for(;++i<Us.length;){const o=Us[i];ao(this,Us[i],(s&Ea[o])===Ea[o])}}}ai.prototype.defined=!0;function ao(e,r,n){n&&(e[r]=n)}function pn(e){const r={},n={};for(const[s,a]of Object.entries(e.properties)){const i=new ai(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),r[s]=i,n[Ca(s)]=s,n[Ca(i.attribute)]=s}return new Wn(r,n,e.space)}const gc=pn({properties:{ariaActiveDescendant:null,ariaAtomic:yt,ariaAutoComplete:null,ariaBusy:yt,ariaChecked:yt,ariaColCount:se,ariaColIndex:se,ariaColSpan:se,ariaControls:mt,ariaCurrent:null,ariaDescribedBy:mt,ariaDetails:null,ariaDisabled:yt,ariaDropEffect:mt,ariaErrorMessage:null,ariaExpanded:yt,ariaFlowTo:mt,ariaGrabbed:yt,ariaHasPopup:null,ariaHidden:yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:mt,ariaLevel:se,ariaLive:null,ariaModal:yt,ariaMultiLine:yt,ariaMultiSelectable:yt,ariaOrientation:null,ariaOwns:mt,ariaPlaceholder:null,ariaPosInSet:se,ariaPressed:yt,ariaReadOnly:yt,ariaRelevant:null,ariaRequired:yt,ariaRoleDescription:mt,ariaRowCount:se,ariaRowIndex:se,ariaRowSpan:se,ariaSelected:yt,ariaSetSize:se,ariaSort:null,ariaValueMax:se,ariaValueMin:se,ariaValueNow:se,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function xc(e,r){return r in e?e[r]:r}function bc(e,r){return xc(e,r.toLowerCase())}const qh=pn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:en,acceptCharset:mt,accessKey:mt,action:null,allow:null,allowFullScreen:He,allowPaymentRequest:He,allowUserMedia:He,alt:null,as:null,async:He,autoCapitalize:null,autoComplete:mt,autoFocus:He,autoPlay:He,blocking:mt,capture:null,charSet:null,checked:He,cite:null,className:mt,cols:se,colSpan:null,content:null,contentEditable:yt,controls:He,controlsList:mt,coords:se|en,crossOrigin:null,data:null,dateTime:null,decoding:null,default:He,defer:He,dir:null,dirName:null,disabled:He,download:Sa,draggable:yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:He,formTarget:null,headers:mt,height:se,hidden:Sa,high:se,href:null,hrefLang:null,htmlFor:mt,httpEquiv:mt,id:null,imageSizes:null,imageSrcSet:null,inert:He,inputMode:null,integrity:null,is:null,isMap:He,itemId:null,itemProp:mt,itemRef:mt,itemScope:He,itemType:mt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:He,low:se,manifest:null,max:null,maxLength:se,media:null,method:null,min:null,minLength:se,multiple:He,muted:He,name:null,nonce:null,noModule:He,noValidate:He,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:He,optimum:se,pattern:null,ping:mt,placeholder:null,playsInline:He,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:He,referrerPolicy:null,rel:mt,required:He,reversed:He,rows:se,rowSpan:se,sandbox:mt,scope:null,scoped:He,seamless:He,selected:He,shadowRootClonable:He,shadowRootDelegatesFocus:He,shadowRootMode:null,shape:null,size:se,sizes:null,slot:null,span:se,spellCheck:yt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:se,step:null,style:null,tabIndex:se,target:null,title:null,translate:null,type:null,typeMustMatch:He,useMap:null,value:yt,width:se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:mt,axis:null,background:null,bgColor:null,border:se,borderColor:null,bottomMargin:se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:He,declare:He,event:null,face:null,frame:null,frameBorder:null,hSpace:se,leftMargin:se,link:null,longDesc:null,lowSrc:null,marginHeight:se,marginWidth:se,noResize:He,noHref:He,noShade:He,noWrap:He,object:null,profile:null,prompt:null,rev:null,rightMargin:se,rules:null,scheme:null,scrolling:yt,standby:null,summary:null,text:null,topMargin:se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:He,disableRemotePlayback:He,prefix:null,property:null,results:se,security:null,unselectable:null},space:"html",transform:bc}),Vh=pn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ut,accentHeight:se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:se,amplitude:se,arabicForm:null,ascent:se,attributeName:null,attributeType:null,azimuth:se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:se,by:null,calcMode:null,capHeight:se,className:mt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:se,diffuseConstant:se,direction:null,display:null,dur:null,divisor:se,dominantBaseline:null,download:He,dx:null,dy:null,edgeMode:null,editable:null,elevation:se,enableBackground:null,end:null,event:null,exponent:se,externalResourcesRequired:null,fill:null,fillOpacity:se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:en,g2:en,glyphName:en,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:se,horizOriginX:se,horizOriginY:se,id:null,ideographic:se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:se,k:se,k1:se,k2:se,k3:se,k4:se,kernelMatrix:Ut,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:se,overlineThickness:se,paintOrder:null,panose1:null,path:null,pathLength:se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:mt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:se,pointsAtY:se,pointsAtZ:se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ut,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ut,rev:Ut,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ut,requiredFeatures:Ut,requiredFonts:Ut,requiredFormats:Ut,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:se,specularExponent:se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:se,strikethroughThickness:se,string:null,stroke:null,strokeDashArray:Ut,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:se,strokeOpacity:se,strokeWidth:null,style:null,surfaceScale:se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ut,tabIndex:se,tableValues:null,target:null,targetX:se,targetY:se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ut,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:se,underlineThickness:se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:se,values:null,vAlphabetic:se,vMathematical:se,vectorEffect:null,vHanging:se,vIdeographic:se,version:null,vertAdvY:se,vertOriginX:se,vertOriginY:se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:xc}),yc=pn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,r){return"xlink:"+r.slice(5).toLowerCase()}}),kc=pn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:bc}),vc=pn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),Gh={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Kh=/[A-Z]/g,io=/-[a-z]/g,Jh=/^data[-\w.:]+$/i;function Yh(e,r){const n=Ca(r);let s=r,a=Bt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Jh.test(r)){if(r.charAt(4)==="-"){const i=r.slice(5).replace(io,Xh);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=r.slice(4);if(!io.test(i)){let o=i.replace(Kh,Qh);o.charAt(0)!=="-"&&(o="-"+o),r="data"+o}}a=ai}return new a(s,r)}function Qh(e){return"-"+e.toLowerCase()}function Xh(e){return e.charAt(1).toUpperCase()}const Zh=fc([gc,qh,yc,kc,vc],"html"),ii=fc([gc,Vh,yc,kc,vc],"svg");function e0(e){return e.join(" ").trim()}var Jr={},Hs,oo;function t0(){if(oo)return Hs;oo=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
387
+ `,d="/",u="*",m="",h="comment",p="declaration";Hs=function(x,b){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];b=b||{};var k=1,N=1;function y(_){var C=_.match(r);C&&(k+=C.length);var V=_.lastIndexOf(c);N=~V?_.length-V:N+_.length}function P(){var _={line:k,column:N};return function(C){return C.position=new W(_),L(),C}}function W(_){this.start=_,this.end={line:k,column:N},this.source=b.source}W.prototype.content=x;function M(_){var C=new Error(b.source+":"+k+":"+N+": "+_);if(C.reason=_,C.filename=b.source,C.line=k,C.column=N,C.source=x,!b.silent)throw C}function B(_){var C=_.exec(x);if(C){var V=C[0];return y(V),x=x.slice(V.length),C}}function L(){B(n)}function U(_){var C;for(_=_||[];C=j();)C!==!1&&_.push(C);return _}function j(){var _=P();if(!(d!=x.charAt(0)||u!=x.charAt(1))){for(var C=2;m!=x.charAt(C)&&(u!=x.charAt(C)||d!=x.charAt(C+1));)++C;if(C+=2,m===x.charAt(C-1))return M("End of comment missing");var V=x.slice(2,C-2);return N+=2,y(V),x=x.slice(C),N+=2,_({type:h,comment:V})}}function R(){var _=P(),C=B(s);if(C){if(j(),!B(a))return M("property missing ':'");var V=B(i),z=_({type:p,property:g(C[0].replace(e,m)),value:V?g(V[0].replace(e,m)):m});return B(o),z}}function D(){var _=[];U(_);for(var C;C=R();)C!==!1&&(_.push(C),U(_));return _}return L(),D()};function g(x){return x?x.replace(l,m):m}return Hs}var lo;function r0(){if(lo)return Jr;lo=1;var e=Jr&&Jr.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.default=n;var r=e(t0());function n(s,a){var i=null;if(!s||typeof s!="string")return i;var o=(0,r.default)(s),l=typeof a=="function";return o.forEach(function(c){if(c.type==="declaration"){var d=c.property,u=c.value;l?a(d,u,c):u&&(i=i||{},i[d]=u)}}),i}return Jr}var yn={},co;function n0(){if(co)return yn;co=1,Object.defineProperty(yn,"__esModule",{value:!0}),yn.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(d){return!d||n.test(d)||e.test(d)},o=function(d,u){return u.toUpperCase()},l=function(d,u){return"".concat(u,"-")},c=function(d,u){return u===void 0&&(u={}),i(d)?d:(d=d.toLowerCase(),u.reactCompat?d=d.replace(a,l):d=d.replace(s,l),d.replace(r,o))};return yn.camelCase=c,yn}var kn,uo;function s0(){if(uo)return kn;uo=1;var e=kn&&kn.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},r=e(r0()),n=n0();function s(a,i){var o={};return!a||typeof a!="string"||(0,r.default)(a,function(l,c){l&&c&&(o[(0,n.camelCase)(l,i)]=c)}),o}return s.default=s,kn=s,kn}var a0=s0();const i0=zn(a0),wc=jc("end"),oi=jc("start");function jc(e){return r;function r(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function o0(e){const r=oi(e),n=wc(e);if(r&&n)return{start:r,end:n}}function In(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?mo(e.position):"start"in e||"end"in e?mo(e):"line"in e||"column"in e?Ia(e):""}function Ia(e){return po(e&&e.line)+":"+po(e&&e.column)}function mo(e){return Ia(e&&e.start)+"-"+Ia(e&&e.end)}function po(e){return e&&typeof e=="number"?e:1}class At extends Error{constructor(r,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",i={},o=!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 r=="string"?a=r:!i.cause&&r&&(o=!0,a=r.message,i.cause=r),!i.ruleId&&!i.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?i.ruleId=s:(i.source=s.slice(0,c),i.ruleId=s.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=a,this.line=l?l.line:void 0,this.name=In(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=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}At.prototype.file="";At.prototype.name="";At.prototype.reason="";At.prototype.message="";At.prototype.stack="";At.prototype.column=void 0;At.prototype.line=void 0;At.prototype.ancestors=void 0;At.prototype.cause=void 0;At.prototype.fatal=void 0;At.prototype.place=void 0;At.prototype.ruleId=void 0;At.prototype.source=void 0;const li={}.hasOwnProperty,l0=new Map,c0=/[A-Z]/g,d0=new Set(["table","tbody","thead","tfoot","tr"]),u0=new Set(["td","th"]),Nc="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function m0(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=r.filePath||void 0;let s;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=k0(n,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=y0(n,r.jsx,r.jsxs)}const a={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?ii:Zh,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},i=Cc(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function Cc(e,r,n){if(r.type==="element")return p0(e,r,n);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return h0(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return g0(e,r,n);if(r.type==="mdxjsEsm")return f0(e,r);if(r.type==="root")return x0(e,r,n);if(r.type==="text")return b0(e,r)}function p0(e,r,n){const s=e.schema;let a=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=ii,e.schema=a),e.ancestors.push(r);const i=Ec(e,r.tagName,!1),o=v0(e,r);let l=di(e,r);return d0.has(r.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Uh(c):!0})),Sc(e,o,i,r),ci(o,l),e.ancestors.pop(),e.schema=s,e.create(r,i,o,n)}function h0(e,r){if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Pn(e,r.position)}function f0(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);Pn(e,r.position)}function g0(e,r,n){const s=e.schema;let a=s;r.name==="svg"&&s.space==="html"&&(a=ii,e.schema=a),e.ancestors.push(r);const i=r.name===null?e.Fragment:Ec(e,r.name,!0),o=w0(e,r),l=di(e,r);return Sc(e,o,i,r),ci(o,l),e.ancestors.pop(),e.schema=s,e.create(r,i,o,n)}function x0(e,r,n){const s={};return ci(s,di(e,r)),e.create(r,e.Fragment,s,n)}function b0(e,r){return r.value}function Sc(e,r,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(r.node=s)}function ci(e,r){if(r.length>0){const n=r.length>1?r:r[0];n&&(e.children=n)}}function y0(e,r,n){return s;function s(a,i,o,l){const d=Array.isArray(o.children)?n:r;return l?d(i,o,l):d(i,o)}}function k0(e,r){return n;function n(s,a,i,o){const l=Array.isArray(i.children),c=oi(s);return r(a,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function v0(e,r){const n={};let s,a;for(a in r.properties)if(a!=="children"&&li.call(r.properties,a)){const i=j0(e,a,r.properties[a]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&u0.has(r.tagName)?s=l:n[o]=l}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function w0(e,r){const n={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Pn(e,r.position);else{const a=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else Pn(e,r.position);else i=s.value===null?!0:s.value;n[a]=i}return n}function di(e,r){const n=[];let s=-1;const a=e.passKeys?new Map:l0;for(;++s<r.children.length;){const i=r.children[s];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=a.get(c)||0;o=c+"-"+d,a.set(c,d+1)}}const l=Cc(e,i,o);l!==void 0&&n.push(l)}return n}function j0(e,r,n){const s=Yh(e.schema,r);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?Fh(n):e0(n)),s.property==="style"){let a=typeof n=="object"?n:N0(e,String(n));return e.stylePropertyNameCase==="css"&&(a=C0(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?Gh[s.property]||s.property:s.attribute,n]}}function N0(e,r){try{return i0(r,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new At("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Nc+"#cannot-parse-style-attribute",a}}function Ec(e,r,n){let s;if(!n)s={type:"Literal",value:r};else if(r.includes(".")){const a=r.split(".");let i=-1,o;for(;++i<a.length;){const l=no(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}s=o}else s=no(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const a=s.value;return li.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);Pn(e)}function Pn(e,r){const n=new At("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Nc+"#cannot-handle-mdx-estrees-without-createevaluater",n}function C0(e){const r={};let n;for(n in e)li.call(e,n)&&(r[S0(n)]=e[n]);return r}function S0(e){let r=e.replace(c0,E0);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function E0(e){return"-"+e.toLowerCase()}const qs={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},I0={};function ui(e,r){const n=I0,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Ic(e,s,a)}function Ic(e,r,n){if(A0(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ho(e.children,r,n)}return Array.isArray(e)?ho(e,r,n):""}function ho(e,r,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=Ic(e[a],r,n);return s.join("")}function A0(e){return!!(e&&typeof e=="object")}const fo=document.createElement("i");function mi(e){const r="&"+e+";";fo.innerHTML=r;const n=fo.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===r?!1:n}function Vt(e,r,n,s){const a=e.length;let i=0,o;if(r<0?r=-r>a?0:a+r:r=r>a?a:r,n=n>0?n:0,s.length<1e4)o=Array.from(s),o.unshift(r,n),e.splice(...o);else for(n&&e.splice(r,n);i<s.length;)o=s.slice(i,i+1e4),o.unshift(r,0),e.splice(...o),i+=1e4,r+=1e4}function Xt(e,r){return e.length>0?(Vt(e,e.length,0,r),e):r}const go={}.hasOwnProperty;function Ac(e){const r={};let n=-1;for(;++n<e.length;)M0(r,e[n]);return r}function M0(e,r){let n;for(n in r){const a=(go.call(e,n)?e[n]:void 0)||(e[n]={}),i=r[n];let o;if(i)for(o in i){go.call(a,o)||(a[o]=[]);const l=i[o];T0(a[o],Array.isArray(l)?l:l?[l]:[])}}}function T0(e,r){let n=-1;const s=[];for(;++n<r.length;)(r[n].add==="after"?e:s).push(r[n]);Vt(e,0,0,s)}function Mc(e,r){const n=Number.parseInt(e,r);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function sr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pt=Ar(/[A-Za-z]/),It=Ar(/[\dA-Za-z]/),D0=Ar(/[#-'*+\--9=?A-Z^-~]/);function gs(e){return e!==null&&(e<32||e===127)}const Aa=Ar(/\d/),P0=Ar(/[\dA-Fa-f]/),L0=Ar(/[!-/:-@[-`{-~]/);function Re(e){return e!==null&&e<-2}function dt(e){return e!==null&&(e<0||e===32)}function Qe(e){return e===-2||e===-1||e===32}const Is=Ar(new RegExp("\\p{P}|\\p{S}","u")),Ur=Ar(/\s/);function Ar(e){return r;function r(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function hn(e){const r=[];let n=-1,s=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&It(e.charCodeAt(n+1))&&It(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),a=1):o="�"}else o=String.fromCharCode(i);o&&(r.push(e.slice(s,n),encodeURIComponent(o)),s=n+a+1,o=""),a&&(n+=a,a=0)}return r.join("")+e.slice(s)}function nt(e,r,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Qe(c)?(e.enter(n),l(c)):r(c)}function l(c){return Qe(c)&&i++<a?(e.consume(c),l):(e.exit(n),r(c))}}const R0={tokenize:_0};function _0(e){const r=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return r;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),nt(e,r,"linePrefix")}function a(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Re(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const z0={tokenize:F0},xo={tokenize:$0};function F0(e){const r=this,n=[];let s=0,a,i,o;return l;function l(y){if(s<n.length){const P=n[s];return r.containerState=P[1],e.attempt(P[0].continuation,c,d)(y)}return d(y)}function c(y){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,a&&N();const P=r.events.length;let W=P,M;for(;W--;)if(r.events[W][0]==="exit"&&r.events[W][1].type==="chunkFlow"){M=r.events[W][1].end;break}k(s);let B=P;for(;B<r.events.length;)r.events[B][1].end={...M},B++;return Vt(r.events,W+1,0,r.events.slice(P)),r.events.length=B,d(y)}return l(y)}function d(y){if(s===n.length){if(!a)return h(y);if(a.currentConstruct&&a.currentConstruct.concrete)return g(y);r.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(xo,u,m)(y)}function u(y){return a&&N(),k(s),h(y)}function m(y){return r.parser.lazy[r.now().line]=s!==n.length,o=r.now().offset,g(y)}function h(y){return r.containerState={},e.attempt(xo,p,g)(y)}function p(y){return s++,n.push([r.currentConstruct,r.containerState]),h(y)}function g(y){if(y===null){a&&N(),k(0),e.consume(y);return}return a=a||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),x(y)}function x(y){if(y===null){b(e.exit("chunkFlow"),!0),k(0),e.consume(y);return}return Re(y)?(e.consume(y),b(e.exit("chunkFlow")),s=0,r.interrupt=void 0,l):(e.consume(y),x)}function b(y,P){const W=r.sliceStream(y);if(P&&W.push(null),y.previous=i,i&&(i.next=y),i=y,a.defineSkip(y.start),a.write(W),r.parser.lazy[y.start.line]){let M=a.events.length;for(;M--;)if(a.events[M][1].start.offset<o&&(!a.events[M][1].end||a.events[M][1].end.offset>o))return;const B=r.events.length;let L=B,U,j;for(;L--;)if(r.events[L][0]==="exit"&&r.events[L][1].type==="chunkFlow"){if(U){j=r.events[L][1].end;break}U=!0}for(k(s),M=B;M<r.events.length;)r.events[M][1].end={...j},M++;Vt(r.events,L+1,0,r.events.slice(B)),r.events.length=M}}function k(y){let P=n.length;for(;P-- >y;){const W=n[P];r.containerState=W[1],W[0].exit.call(r,e)}n.length=y}function N(){a.write([null]),i=void 0,a=void 0,r.containerState._closeFlow=void 0}}function $0(e,r,n){return nt(e,e.attempt(this.parser.constructs.document,r,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function an(e){if(e===null||dt(e)||Ur(e))return 1;if(Is(e))return 2}function As(e,r,n){const s=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!s.includes(i)&&(r=i(r,n),s.push(i))}return r}const Ma={name:"attention",resolveAll:O0,tokenize:B0};function O0(e,r){let n=-1,s,a,i,o,l,c,d,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&r.sliceSerialize(e[s][1]).charCodeAt(0)===r.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[s][1].end},h={...e[n][1].start};bo(m,-c),bo(h,c),o={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[s][1].end={...o.start},e[n][1].start={...l.end},d=[],e[s][1].end.offset-e[s][1].start.offset&&(d=Xt(d,[["enter",e[s][1],r],["exit",e[s][1],r]])),d=Xt(d,[["enter",a,r],["enter",o,r],["exit",o,r],["enter",i,r]]),d=Xt(d,As(r.parser.constructs.insideSpan.null,e.slice(s+1,n),r)),d=Xt(d,[["exit",i,r],["enter",l,r],["exit",l,r],["exit",a,r]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,d=Xt(d,[["enter",e[n][1],r],["exit",e[n][1],r]])):u=0,Vt(e,s-1,n-s+3,d),n=s+d.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function B0(e,r){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=an(s);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const d=e.exit("attentionSequence"),u=an(c),m=!u||u===2&&a||n.includes(c),h=!a||a===2&&u||n.includes(s);return d._open=!!(i===42?m:m&&(a||!h)),d._close=!!(i===42?h:h&&(u||!m)),r(c)}}function bo(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const W0={name:"autolink",tokenize:U0};function U0(e,r,n){let s=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Pt(p)?(e.consume(p),o):p===64?n(p):d(p)}function o(p){return p===43||p===45||p===46||It(p)?(s=1,l(p)):d(p)}function l(p){return p===58?(e.consume(p),s=0,c):(p===43||p===45||p===46||It(p))&&s++<32?(e.consume(p),l):(s=0,d(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),r):p===null||p===32||p===60||gs(p)?n(p):(e.consume(p),c)}function d(p){return p===64?(e.consume(p),u):D0(p)?(e.consume(p),d):n(p)}function u(p){return It(p)?m(p):n(p)}function m(p){return p===46?(e.consume(p),s=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),r):h(p)}function h(p){if((p===45||It(p))&&s++<63){const g=p===45?h:m;return e.consume(p),g}return n(p)}}const Un={partial:!0,tokenize:H0};function H0(e,r,n){return s;function s(i){return Qe(i)?nt(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||Re(i)?r(i):n(i)}}const Tc={continuation:{tokenize:V0},exit:G0,name:"blockQuote",tokenize:q0};function q0(e,r,n){const s=this;return a;function a(o){if(o===62){const l=s.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Qe(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(o))}}function V0(e,r,n){const s=this;return a;function a(o){return Qe(o)?nt(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(Tc,r,n)(o)}}function G0(e){e.exit("blockQuote")}const Dc={name:"characterEscape",tokenize:K0};function K0(e,r,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return L0(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):n(i)}}const Pc={name:"characterReference",tokenize:J0};function J0(e,r,n){const s=this;let a=0,i,o;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),c}function c(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,o=It,u(m))}function d(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=P0,u):(e.enter("characterReferenceValue"),i=7,o=Aa,u(m))}function u(m){if(m===59&&a){const h=e.exit("characterReferenceValue");return o===It&&!mi(s.sliceSerialize(h))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return o(m)&&a++<i?(e.consume(m),u):n(m)}}const yo={partial:!0,tokenize:Q0},ko={concrete:!0,name:"codeFenced",tokenize:Y0};function Y0(e,r,n){const s=this,a={partial:!0,tokenize:W};let i=0,o=0,l;return c;function c(M){return d(M)}function d(M){const B=s.events[s.events.length-1];return i=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,l=M,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(M)}function u(M){return M===l?(o++,e.consume(M),u):o<3?n(M):(e.exit("codeFencedFenceSequence"),Qe(M)?nt(e,m,"whitespace")(M):m(M))}function m(M){return M===null||Re(M)?(e.exit("codeFencedFence"),s.interrupt?r(M):e.check(yo,x,P)(M)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(M))}function h(M){return M===null||Re(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(M)):Qe(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),nt(e,p,"whitespace")(M)):M===96&&M===l?n(M):(e.consume(M),h)}function p(M){return M===null||Re(M)?m(M):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(M))}function g(M){return M===null||Re(M)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(M)):M===96&&M===l?n(M):(e.consume(M),g)}function x(M){return e.attempt(a,P,b)(M)}function b(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),k}function k(M){return i>0&&Qe(M)?nt(e,N,"linePrefix",i+1)(M):N(M)}function N(M){return M===null||Re(M)?e.check(yo,x,P)(M):(e.enter("codeFlowValue"),y(M))}function y(M){return M===null||Re(M)?(e.exit("codeFlowValue"),N(M)):(e.consume(M),y)}function P(M){return e.exit("codeFenced"),r(M)}function W(M,B,L){let U=0;return j;function j(V){return M.enter("lineEnding"),M.consume(V),M.exit("lineEnding"),R}function R(V){return M.enter("codeFencedFence"),Qe(V)?nt(M,D,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):D(V)}function D(V){return V===l?(M.enter("codeFencedFenceSequence"),_(V)):L(V)}function _(V){return V===l?(U++,M.consume(V),_):U>=o?(M.exit("codeFencedFenceSequence"),Qe(V)?nt(M,C,"whitespace")(V):C(V)):L(V)}function C(V){return V===null||Re(V)?(M.exit("codeFencedFence"),B(V)):L(V)}}}function Q0(e,r,n){const s=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):r(o)}}const Vs={name:"codeIndented",tokenize:Z0},X0={partial:!0,tokenize:ef};function Z0(e,r,n){const s=this;return a;function a(d){return e.enter("codeIndented"),nt(e,i,"linePrefix",5)(d)}function i(d){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(d):n(d)}function o(d){return d===null?c(d):Re(d)?e.attempt(X0,o,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||Re(d)?(e.exit("codeFlowValue"),o(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),r(d)}}function ef(e,r,n){const s=this;return a;function a(o){return s.parser.lazy[s.now().line]?n(o):Re(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):nt(e,i,"linePrefix",5)(o)}function i(o){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(o):Re(o)?a(o):n(o)}}const tf={name:"codeText",previous:nf,resolve:rf,tokenize:sf};function rf(e){let r=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(s=n;++s<r;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[r][1].type="codeTextPadding",n+=2,r-=2;break}}for(s=n-1,r++;++s<=r;)a===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(a=s):(s===r||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),r-=s-a-2,s=a+2),a=void 0);return e}function nf(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sf(e,r,n){let s=0,a,i;return o;function o(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),s++,l):(e.exit("codeTextSequence"),c(m))}function c(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),c):m===96?(i=e.enter("codeTextSequence"),a=0,u(m)):Re(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(m))}function d(m){return m===null||m===32||m===96||Re(m)?(e.exit("codeTextData"),c(m)):(e.consume(m),d)}function u(m){return m===96?(e.consume(m),a++,u):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(i.type="codeTextData",d(m))}}class af{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,n,s){const a=n||0;this.setCursor(Math.trunc(r));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&vn(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),vn(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),vn(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const n=this.left.splice(r,Number.POSITIVE_INFINITY);vn(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);vn(this.left,n.reverse())}}}function vn(e,r){let n=0;if(r.length<1e4)e.push(...r);else for(;n<r.length;)e.push(...r.slice(n,n+1e4)),n+=1e4}function Lc(e){const r={};let n=-1,s,a,i,o,l,c,d;const u=new af(e);for(;++n<u.length;){for(;n in r;)n=r[n];if(s=u.get(n),n&&s[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(c=s[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,of(u,n)),n=r[n],d=!0);else if(s[1]._container){for(i=n,a=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(u.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(s[1].end={...u.get(a)[1].start},l=u.slice(a,n),l.unshift(s),u.splice(a,n-a+1,l))}}return Vt(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!d}function of(e,r){const n=e.get(r)[1],s=e.get(r)[2];let a=r-1;const i=[];let o=n._tokenizer;o||(o=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],d={};let u,m,h=-1,p=n,g=0,x=0;const b=[x];for(;p;){for(;e.get(++a)[1]!==p;);i.push(a),p._tokenizer||(u=s.sliceStream(p),p.next||u.push(null),m&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=p,p=p.next}for(p=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(x=h+1,b.push(x),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),h=b.length;h--;){const k=l.slice(b[h],b[h+1]),N=i.pop();c.push([N,N+k.length-1]),e.splice(N,2,k)}for(c.reverse(),h=-1;++h<c.length;)d[g+c[h][0]]=g+c[h][1],g+=c[h][1]-c[h][0]-1;return d}const lf={resolve:df,tokenize:uf},cf={partial:!0,tokenize:mf};function df(e){return Lc(e),e}function uf(e,r){let n;return s;function s(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?i(l):Re(l)?e.check(cf,o,i)(l):(e.consume(l),a)}function i(l){return e.exit("chunkContent"),e.exit("content"),r(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function mf(e,r,n){const s=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),nt(e,i,"linePrefix")}function i(o){if(o===null||Re(o))return n(o);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(o):e.interrupt(s.parser.constructs.flow,n,r)(o)}}function Rc(e,r,n,s,a,i,o,l,c){const d=c||Number.POSITIVE_INFINITY;let u=0;return m;function m(k){return k===60?(e.enter(s),e.enter(a),e.enter(i),e.consume(k),e.exit(i),h):k===null||k===32||k===41||gs(k)?n(k):(e.enter(s),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),x(k))}function h(k){return k===62?(e.enter(i),e.consume(k),e.exit(i),e.exit(a),e.exit(s),r):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===62?(e.exit("chunkString"),e.exit(l),h(k)):k===null||k===60||Re(k)?n(k):(e.consume(k),k===92?g:p)}function g(k){return k===60||k===62||k===92?(e.consume(k),p):p(k)}function x(k){return!u&&(k===null||k===41||dt(k))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(s),r(k)):u<d&&k===40?(e.consume(k),u++,x):k===41?(e.consume(k),u--,x):k===null||k===32||k===40||gs(k)?n(k):(e.consume(k),k===92?b:x)}function b(k){return k===40||k===41||k===92?(e.consume(k),x):x(k)}}function _c(e,r,n,s,a,i){const o=this;let l=0,c;return d;function d(p){return e.enter(s),e.enter(a),e.consume(p),e.exit(a),e.enter(i),u}function u(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(s),r):Re(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||Re(p)||l++>999?(e.exit("chunkString"),u(p)):(e.consume(p),c||(c=!Qe(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,m):m(p)}}function zc(e,r,n,s,a,i){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(s),e.enter(a),e.consume(h),e.exit(a),o=h===40?41:h,c):n(h)}function c(h){return h===o?(e.enter(a),e.consume(h),e.exit(a),e.exit(s),r):(e.enter(i),d(h))}function d(h){return h===o?(e.exit(i),c(o)):h===null?n(h):Re(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),nt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===o||h===null||Re(h)?(e.exit("chunkString"),d(h)):(e.consume(h),h===92?m:u)}function m(h){return h===o||h===92?(e.consume(h),u):u(h)}}function An(e,r){let n;return s;function s(a){return Re(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Qe(a)?nt(e,s,n?"linePrefix":"lineSuffix")(a):r(a)}}const pf={name:"definition",tokenize:ff},hf={partial:!0,tokenize:gf};function ff(e,r,n){const s=this;let a;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return _c.call(s,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return a=sr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return dt(p)?An(e,d)(p):d(p)}function d(p){return Rc(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(hf,m,m)(p)}function m(p){return Qe(p)?nt(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Re(p)?(e.exit("definition"),s.parser.defined.push(a),r(p)):n(p)}}function gf(e,r,n){return s;function s(l){return dt(l)?An(e,a)(l):n(l)}function a(l){return zc(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Qe(l)?nt(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Re(l)?r(l):n(l)}}const xf={name:"hardBreakEscape",tokenize:bf};function bf(e,r,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return Re(i)?(e.exit("hardBreakEscape"),r(i)):n(i)}}const yf={name:"headingAtx",resolve:kf,tokenize:vf};function kf(e,r){let n=e.length-2,s=3,a,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Vt(e,s,n-s+1,[["enter",a,r],["enter",i,r],["exit",i,r],["exit",a,r]])),e}function vf(e,r,n){let s=0;return a;function a(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&s++<6?(e.consume(u),o):u===null||dt(u)?(e.exit("atxHeadingSequence"),l(u)):n(u)}function l(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||Re(u)?(e.exit("atxHeading"),r(u)):Qe(u)?nt(e,l,"whitespace")(u):(e.enter("atxHeadingText"),d(u))}function c(u){return u===35?(e.consume(u),c):(e.exit("atxHeadingSequence"),l(u))}function d(u){return u===null||u===35||dt(u)?(e.exit("atxHeadingText"),l(u)):(e.consume(u),d)}}const wf=["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"],vo=["pre","script","style","textarea"],jf={concrete:!0,name:"htmlFlow",resolveTo:Sf,tokenize:Ef},Nf={partial:!0,tokenize:Af},Cf={partial:!0,tokenize:If};function Sf(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function Ef(e,r,n){const s=this;let a,i,o,l,c;return d;function d(w){return u(w)}function u(w){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(w),m}function m(w){return w===33?(e.consume(w),h):w===47?(e.consume(w),i=!0,x):w===63?(e.consume(w),a=3,s.interrupt?r:v):Pt(w)?(e.consume(w),o=String.fromCharCode(w),b):n(w)}function h(w){return w===45?(e.consume(w),a=2,p):w===91?(e.consume(w),a=5,l=0,g):Pt(w)?(e.consume(w),a=4,s.interrupt?r:v):n(w)}function p(w){return w===45?(e.consume(w),s.interrupt?r:v):n(w)}function g(w){const J="CDATA[";return w===J.charCodeAt(l++)?(e.consume(w),l===J.length?s.interrupt?r:D:g):n(w)}function x(w){return Pt(w)?(e.consume(w),o=String.fromCharCode(w),b):n(w)}function b(w){if(w===null||w===47||w===62||dt(w)){const J=w===47,he=o.toLowerCase();return!J&&!i&&vo.includes(he)?(a=1,s.interrupt?r(w):D(w)):wf.includes(o.toLowerCase())?(a=6,J?(e.consume(w),k):s.interrupt?r(w):D(w)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(w):i?N(w):y(w))}return w===45||It(w)?(e.consume(w),o+=String.fromCharCode(w),b):n(w)}function k(w){return w===62?(e.consume(w),s.interrupt?r:D):n(w)}function N(w){return Qe(w)?(e.consume(w),N):j(w)}function y(w){return w===47?(e.consume(w),j):w===58||w===95||Pt(w)?(e.consume(w),P):Qe(w)?(e.consume(w),y):j(w)}function P(w){return w===45||w===46||w===58||w===95||It(w)?(e.consume(w),P):W(w)}function W(w){return w===61?(e.consume(w),M):Qe(w)?(e.consume(w),W):y(w)}function M(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),c=w,B):Qe(w)?(e.consume(w),M):L(w)}function B(w){return w===c?(e.consume(w),c=null,U):w===null||Re(w)?n(w):(e.consume(w),B)}function L(w){return w===null||w===34||w===39||w===47||w===60||w===61||w===62||w===96||dt(w)?W(w):(e.consume(w),L)}function U(w){return w===47||w===62||Qe(w)?y(w):n(w)}function j(w){return w===62?(e.consume(w),R):n(w)}function R(w){return w===null||Re(w)?D(w):Qe(w)?(e.consume(w),R):n(w)}function D(w){return w===45&&a===2?(e.consume(w),z):w===60&&a===1?(e.consume(w),Z):w===62&&a===4?(e.consume(w),ue):w===63&&a===3?(e.consume(w),v):w===93&&a===5?(e.consume(w),ce):Re(w)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(Nf,fe,_)(w)):w===null||Re(w)?(e.exit("htmlFlowData"),_(w)):(e.consume(w),D)}function _(w){return e.check(Cf,C,fe)(w)}function C(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),V}function V(w){return w===null||Re(w)?_(w):(e.enter("htmlFlowData"),D(w))}function z(w){return w===45?(e.consume(w),v):D(w)}function Z(w){return w===47?(e.consume(w),o="",F):D(w)}function F(w){if(w===62){const J=o.toLowerCase();return vo.includes(J)?(e.consume(w),ue):D(w)}return Pt(w)&&o.length<8?(e.consume(w),o+=String.fromCharCode(w),F):D(w)}function ce(w){return w===93?(e.consume(w),v):D(w)}function v(w){return w===62?(e.consume(w),ue):w===45&&a===2?(e.consume(w),v):D(w)}function ue(w){return w===null||Re(w)?(e.exit("htmlFlowData"),fe(w)):(e.consume(w),ue)}function fe(w){return e.exit("htmlFlow"),r(w)}}function If(e,r,n){const s=this;return a;function a(o){return Re(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return s.parser.lazy[s.now().line]?n(o):r(o)}}function Af(e,r,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Un,r,n)}}const Mf={name:"htmlText",tokenize:Tf};function Tf(e,r,n){const s=this;let a,i,o;return l;function l(v){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(v),c}function c(v){return v===33?(e.consume(v),d):v===47?(e.consume(v),W):v===63?(e.consume(v),y):Pt(v)?(e.consume(v),L):n(v)}function d(v){return v===45?(e.consume(v),u):v===91?(e.consume(v),i=0,g):Pt(v)?(e.consume(v),N):n(v)}function u(v){return v===45?(e.consume(v),p):n(v)}function m(v){return v===null?n(v):v===45?(e.consume(v),h):Re(v)?(o=m,Z(v)):(e.consume(v),m)}function h(v){return v===45?(e.consume(v),p):m(v)}function p(v){return v===62?z(v):v===45?h(v):m(v)}function g(v){const ue="CDATA[";return v===ue.charCodeAt(i++)?(e.consume(v),i===ue.length?x:g):n(v)}function x(v){return v===null?n(v):v===93?(e.consume(v),b):Re(v)?(o=x,Z(v)):(e.consume(v),x)}function b(v){return v===93?(e.consume(v),k):x(v)}function k(v){return v===62?z(v):v===93?(e.consume(v),k):x(v)}function N(v){return v===null||v===62?z(v):Re(v)?(o=N,Z(v)):(e.consume(v),N)}function y(v){return v===null?n(v):v===63?(e.consume(v),P):Re(v)?(o=y,Z(v)):(e.consume(v),y)}function P(v){return v===62?z(v):y(v)}function W(v){return Pt(v)?(e.consume(v),M):n(v)}function M(v){return v===45||It(v)?(e.consume(v),M):B(v)}function B(v){return Re(v)?(o=B,Z(v)):Qe(v)?(e.consume(v),B):z(v)}function L(v){return v===45||It(v)?(e.consume(v),L):v===47||v===62||dt(v)?U(v):n(v)}function U(v){return v===47?(e.consume(v),z):v===58||v===95||Pt(v)?(e.consume(v),j):Re(v)?(o=U,Z(v)):Qe(v)?(e.consume(v),U):z(v)}function j(v){return v===45||v===46||v===58||v===95||It(v)?(e.consume(v),j):R(v)}function R(v){return v===61?(e.consume(v),D):Re(v)?(o=R,Z(v)):Qe(v)?(e.consume(v),R):U(v)}function D(v){return v===null||v===60||v===61||v===62||v===96?n(v):v===34||v===39?(e.consume(v),a=v,_):Re(v)?(o=D,Z(v)):Qe(v)?(e.consume(v),D):(e.consume(v),C)}function _(v){return v===a?(e.consume(v),a=void 0,V):v===null?n(v):Re(v)?(o=_,Z(v)):(e.consume(v),_)}function C(v){return v===null||v===34||v===39||v===60||v===61||v===96?n(v):v===47||v===62||dt(v)?U(v):(e.consume(v),C)}function V(v){return v===47||v===62||dt(v)?U(v):n(v)}function z(v){return v===62?(e.consume(v),e.exit("htmlTextData"),e.exit("htmlText"),r):n(v)}function Z(v){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),F}function F(v){return Qe(v)?nt(e,ce,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):ce(v)}function ce(v){return e.enter("htmlTextData"),o(v)}}const pi={name:"labelEnd",resolveAll:Rf,resolveTo:_f,tokenize:zf},Df={tokenize:Ff},Pf={tokenize:$f},Lf={tokenize:Of};function Rf(e){let r=-1;const n=[];for(;++r<e.length;){const s=e[r][1];if(n.push(e[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",r+=a}}return e.length!==n.length&&Vt(e,0,e.length,n),e}function _f(e,r){let n=e.length,s=0,a,i,o,l;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,r],["enter",d,r]],l=Xt(l,e.slice(i+1,i+s+3)),l=Xt(l,[["enter",u,r]]),l=Xt(l,As(r.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),r)),l=Xt(l,[["exit",u,r],e[o-2],e[o-1],["exit",d,r]]),l=Xt(l,e.slice(o+1)),l=Xt(l,[["exit",c,r]]),Vt(e,i,e.length,l),e}function zf(e,r,n){const s=this;let a=s.events.length,i,o;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){i=s.events[a][1];break}return l;function l(h){return i?i._inactive?m(h):(o=s.parser.defined.includes(sr(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),c):n(h)}function c(h){return h===40?e.attempt(Df,u,o?u:m)(h):h===91?e.attempt(Pf,u,o?d:m)(h):o?u(h):m(h)}function d(h){return e.attempt(Lf,u,m)(h)}function u(h){return r(h)}function m(h){return i._balanced=!0,n(h)}}function Ff(e,r,n){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return dt(m)?An(e,i)(m):i(m)}function i(m){return m===41?u(m):Rc(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return dt(m)?An(e,c)(m):u(m)}function l(m){return n(m)}function c(m){return m===34||m===39||m===40?zc(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):u(m)}function d(m){return dt(m)?An(e,u)(m):u(m)}function u(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),r):n(m)}}function $f(e,r,n){const s=this;return a;function a(l){return _c.call(s,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return s.parser.defined.includes(sr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(l):n(l)}function o(l){return n(l)}}function Of(e,r,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),r):n(i)}}const Bf={name:"labelStartImage",resolveAll:pi.resolveAll,tokenize:Wf};function Wf(e,r,n){const s=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(l):r(l)}}const Uf={name:"labelStartLink",resolveAll:pi.resolveAll,tokenize:Hf};function Hf(e,r,n){const s=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(o):r(o)}}const Gs={name:"lineEnding",tokenize:qf};function qf(e,r){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),nt(e,r,"linePrefix")}}const us={name:"thematicBreak",tokenize:Vf};function Vf(e,r,n){let s=0,a;return i;function i(d){return e.enter("thematicBreak"),o(d)}function o(d){return a=d,l(d)}function l(d){return d===a?(e.enter("thematicBreakSequence"),c(d)):s>=3&&(d===null||Re(d))?(e.exit("thematicBreak"),r(d)):n(d)}function c(d){return d===a?(e.consume(d),s++,c):(e.exit("thematicBreakSequence"),Qe(d)?nt(e,l,"whitespace")(d):l(d))}}const Ft={continuation:{tokenize:Yf},exit:Xf,name:"list",tokenize:Jf},Gf={partial:!0,tokenize:Zf},Kf={partial:!0,tokenize:Qf};function Jf(e,r,n){const s=this,a=s.events[s.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return l;function l(p){const g=s.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!s.containerState.marker||p===s.containerState.marker:Aa(p)){if(s.containerState.type||(s.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(us,n,d)(p):d(p);if(!s.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return Aa(p)&&++o<10?(e.consume(p),c):(!s.interrupt||o<2)&&(s.containerState.marker?p===s.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),d(p)):n(p)}function d(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||p,e.check(Un,s.interrupt?n:u,e.attempt(Gf,h,m))}function u(p){return s.containerState.initialBlankLine=!0,i++,h(p)}function m(p){return Qe(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(p)}}function Yf(e,r,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Un,a,i);function a(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,nt(e,r,"listItemIndent",s.containerState.size+1)(l)}function i(l){return s.containerState.furtherBlankLines||!Qe(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(Kf,r,o)(l))}function o(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,nt(e,e.attempt(Ft,r,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Qf(e,r,n){const s=this;return nt(e,a,"listItemIndent",s.containerState.size+1);function a(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?r(i):n(i)}}function Xf(e){e.exit(this.containerState.type)}function Zf(e,r,n){const s=this;return nt(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=s.events[s.events.length-1];return!Qe(i)&&o&&o[1].type==="listItemPrefixWhitespace"?r(i):n(i)}}const wo={name:"setextUnderline",resolveTo:eg,tokenize:tg};function eg(e,r){let n=e.length,s,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",o,r]),e.splice(i+1,0,["exit",e[s][1],r]),e[s][1].end={...e[i][1].end}):e[s][1]=o,e.push(["exit",o,r]),e}function tg(e,r,n){const s=this;let a;return i;function i(d){let u=s.events.length,m;for(;u--;)if(s.events[u][1].type!=="lineEnding"&&s.events[u][1].type!=="linePrefix"&&s.events[u][1].type!=="content"){m=s.events[u][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),a=d,o(d)):n(d)}function o(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===a?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),Qe(d)?nt(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||Re(d)?(e.exit("setextHeadingLine"),r(d)):n(d)}}const rg={tokenize:ng};function ng(e){const r=this,n=e.attempt(Un,s,e.attempt(this.parser.constructs.flowInitial,a,nt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(lf,a)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),r.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r.currentConstruct=void 0,n}}const sg={resolveAll:$c()},ag=Fc("string"),ig=Fc("text");function Fc(e){return{resolveAll:$c(e==="text"?og:void 0),tokenize:r};function r(n){const s=this,a=this.parser.constructs[e],i=n.attempt(a,o,l);return o;function o(u){return d(u)?i(u):l(u)}function l(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),c}function c(u){return d(u)?(n.exit("data"),i(u)):(n.consume(u),c)}function d(u){if(u===null)return!0;const m=a[u];let h=-1;if(m)for(;++h<m.length;){const p=m[h];if(!p.previous||p.previous.call(s,s.previous))return!0}return!1}}}function $c(e){return r;function r(n,s){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,s):n}}function og(e,r){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=r.sliceStream(s);let i=a.length,o=-1,l=0,c;for(;i--;){const d=a[i];if(typeof d=="string"){for(o=d.length;d.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(d===-2)c=!0,l++;else if(d!==-1){i++;break}}if(r._contentTypeTextTrailing&&n===e.length&&(l=0),l){const d={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...d.start},s.start.offset===s.end.offset?Object.assign(s,d):(e.splice(n,0,["enter",d,r],["exit",d,r]),n+=2)}n++}return e}const lg={42:Ft,43:Ft,45:Ft,48:Ft,49:Ft,50:Ft,51:Ft,52:Ft,53:Ft,54:Ft,55:Ft,56:Ft,57:Ft,62:Tc},cg={91:pf},dg={[-2]:Vs,[-1]:Vs,32:Vs},ug={35:yf,42:us,45:[wo,us],60:jf,61:wo,95:us,96:ko,126:ko},mg={38:Pc,92:Dc},pg={[-5]:Gs,[-4]:Gs,[-3]:Gs,33:Bf,38:Pc,42:Ma,60:[W0,Mf],91:Uf,92:[xf,Dc],93:pi,95:Ma,96:tf},hg={null:[Ma,sg]},fg={null:[42,95]},gg={null:[]},xg=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:fg,contentInitial:cg,disable:gg,document:lg,flow:ug,flowInitial:dg,insideSpan:hg,string:mg,text:pg},Symbol.toStringTag,{value:"Module"}));function bg(e,r,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let o=[],l=[];const c={attempt:B(W),check:B(M),consume:N,enter:y,exit:P,interrupt:B(M,{interrupt:!0})},d={code:null,containerState:{},defineSkip:x,events:[],now:g,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:m};let u=r.tokenize.call(d,c);return r.resolveAll&&i.push(r),d;function m(R){return o=Xt(o,R),b(),o[o.length-1]!==null?[]:(L(r,0),d.events=As(i,d.events,d),d.events)}function h(R,D){return kg(p(R),D)}function p(R){return yg(o,R)}function g(){const{_bufferIndex:R,_index:D,line:_,column:C,offset:V}=s;return{_bufferIndex:R,_index:D,line:_,column:C,offset:V}}function x(R){a[R.line]=R.column,j()}function b(){let R;for(;s._index<o.length;){const D=o[s._index];if(typeof D=="string")for(R=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===R&&s._bufferIndex<D.length;)k(D.charCodeAt(s._bufferIndex));else k(D)}}function k(R){u=u(R)}function N(R){Re(R)?(s.line++,s.column=1,s.offset+=R===-3?2:1,j()):R!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),d.previous=R}function y(R,D){const _=D||{};return _.type=R,_.start=g(),d.events.push(["enter",_,d]),l.push(_),_}function P(R){const D=l.pop();return D.end=g(),d.events.push(["exit",D,d]),D}function W(R,D){L(R,D.from)}function M(R,D){D.restore()}function B(R,D){return _;function _(C,V,z){let Z,F,ce,v;return Array.isArray(C)?fe(C):"tokenize"in C?fe([C]):ue(C);function ue(ye){return re;function re(Pe){const X=Pe!==null&&ye[Pe],le=Pe!==null&&ye.null,ke=[...Array.isArray(X)?X:X?[X]:[],...Array.isArray(le)?le:le?[le]:[]];return fe(ke)(Pe)}}function fe(ye){return Z=ye,F=0,ye.length===0?z:w(ye[F])}function w(ye){return re;function re(Pe){return v=U(),ce=ye,ye.partial||(d.currentConstruct=ye),ye.name&&d.parser.constructs.disable.null.includes(ye.name)?he():ye.tokenize.call(D?Object.assign(Object.create(d),D):d,c,J,he)(Pe)}}function J(ye){return R(ce,v),V}function he(ye){return v.restore(),++F<Z.length?w(Z[F]):z}}}function L(R,D){R.resolveAll&&!i.includes(R)&&i.push(R),R.resolve&&Vt(d.events,D,d.events.length-D,R.resolve(d.events.slice(D),d)),R.resolveTo&&(d.events=R.resolveTo(d.events,d))}function U(){const R=g(),D=d.previous,_=d.currentConstruct,C=d.events.length,V=Array.from(l);return{from:C,restore:z};function z(){s=R,d.previous=D,d.currentConstruct=_,d.events.length=C,l=V,j()}}function j(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function yg(e,r){const n=r.start._index,s=r.start._bufferIndex,a=r.end._index,i=r.end._bufferIndex;let o;if(n===a)o=[e[n].slice(s,i)];else{if(o=e.slice(n,a),s>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(s):o.shift()}i>0&&o.push(e[a].slice(0,i))}return o}function kg(e,r){let n=-1;const s=[];let a;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
388
+ `;break}case-3:{o=`\r
389
+ `;break}case-2:{o=r?" ":" ";break}case-1:{if(!r&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,s.push(o)}return s.join("")}function vg(e){const s={constructs:Ac([xg,...(e||{}).extensions||[]]),content:a(R0),defined:[],document:a(z0),flow:a(rg),lazy:{},string:a(ag),text:a(ig)};return s;function a(i){return o;function o(l){return bg(s,i,l)}}}function wg(e){for(;!Lc(e););return e}const jo=/[\0\t\n\r]/g;function jg(){let e=1,r="",n=!0,s;return a;function a(i,o,l){const c=[];let d,u,m,h,p;for(i=r+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),m=0,r="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(jo.lastIndex=m,d=jo.exec(i),h=d&&d.index!==void 0?d.index:i.length,p=i.charCodeAt(h),!d){r=i.slice(m);break}if(p===10&&m===h&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),m<h&&(c.push(i.slice(m,h)),e+=h-m),p){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:s=!0,e=1}m=h+1}return l&&(s&&c.push(-5),r&&c.push(r),c.push(null)),c}}const Ng=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Cg(e){return e.replace(Ng,Sg)}function Sg(e,r,n){if(r)return r;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Mc(n.slice(i?2:1),i?16:10)}return mi(n)||e}const Oc={}.hasOwnProperty;function Eg(e,r,n){return typeof r!="string"&&(n=r,r=void 0),Ig(n)(wg(vg(n).document().write(jg()(e,r,!0))))}function Ig(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(xe),autolinkProtocol:U,autolinkEmail:U,atxHeading:i(et),blockQuote:i(le),characterEscape:U,characterReference:U,codeFenced:i(ke),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(ke,o),codeText:i(ge,o),codeTextData:U,data:U,codeFlowValue:U,definition:i(Ie),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ke),hardBreakEscape:i(st),hardBreakTrailing:i(st),htmlFlow:i(ft,o),htmlFlowData:U,htmlText:i(ft,o),htmlTextData:U,image:i(tt),label:o,link:i(xe),listItem:i(it),listItemValue:h,listOrdered:i(qe,m),listUnordered:i(qe),paragraph:i(ve),reference:w,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(et),strong:i(Ct),thematicBreak:i(de)},exit:{atxHeading:c(),atxHeadingSequence:W,autolink:c(),autolinkEmail:X,autolinkProtocol:Pe,blockQuote:c(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:he,characterReferenceMarkerNumeric:he,characterReferenceValue:ye,characterReference:re,codeFenced:c(b),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:j,codeIndented:c(k),codeText:c(V),codeTextData:j,data:j,definition:c(),definitionDestinationString:P,definitionLabelString:N,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(_),htmlFlowData:j,htmlText:c(C),htmlTextData:j,image:c(Z),label:ce,labelText:F,lineEnding:R,link:c(z),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:J,resourceDestinationString:v,resourceTitleString:ue,resource:fe,setextHeading:c(L),setextHeadingLineSequence:B,setextHeadingText:M,strong:c(),thematicBreak:c()}};Bc(r,(e||{}).mdastExtensions||[]);const n={};return s;function s(T){let O={type:"root",children:[]};const ne={stack:[O],tokenStack:[],config:r,enter:l,exit:d,buffer:o,resume:u,data:n},Ce=[];let De=-1;for(;++De<T.length;)if(T[De][1].type==="listOrdered"||T[De][1].type==="listUnordered")if(T[De][0]==="enter")Ce.push(De);else{const ee=Ce.pop();De=a(T,ee,De)}for(De=-1;++De<T.length;){const ee=r[T[De][0]];Oc.call(ee,T[De][1].type)&&ee[T[De][1].type].call(Object.assign({sliceSerialize:T[De][2].sliceSerialize},ne),T[De][1])}if(ne.tokenStack.length>0){const ee=ne.tokenStack[ne.tokenStack.length-1];(ee[1]||No).call(ne,void 0,ee[0])}for(O.position={start:jr(T.length>0?T[0][1].start:{line:1,column:1,offset:0}),end:jr(T.length>0?T[T.length-2][1].end:{line:1,column:1,offset:0})},De=-1;++De<r.transforms.length;)O=r.transforms[De](O)||O;return O}function a(T,O,ne){let Ce=O-1,De=-1,ee=!1,me,oe,we,Ee;for(;++Ce<=ne;){const Be=T[Ce];switch(Be[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Be[0]==="enter"?De++:De--,Ee=void 0;break}case"lineEndingBlank":{Be[0]==="enter"&&(me&&!Ee&&!De&&!we&&(we=Ce),Ee=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ee=void 0}if(!De&&Be[0]==="enter"&&Be[1].type==="listItemPrefix"||De===-1&&Be[0]==="exit"&&(Be[1].type==="listUnordered"||Be[1].type==="listOrdered")){if(me){let ze=Ce;for(oe=void 0;ze--;){const Xe=T[ze];if(Xe[1].type==="lineEnding"||Xe[1].type==="lineEndingBlank"){if(Xe[0]==="exit")continue;oe&&(T[oe][1].type="lineEndingBlank",ee=!0),Xe[1].type="lineEnding",oe=ze}else if(!(Xe[1].type==="linePrefix"||Xe[1].type==="blockQuotePrefix"||Xe[1].type==="blockQuotePrefixWhitespace"||Xe[1].type==="blockQuoteMarker"||Xe[1].type==="listItemIndent"))break}we&&(!oe||we<oe)&&(me._spread=!0),me.end=Object.assign({},oe?T[oe][1].start:Be[1].end),T.splice(oe||Ce,0,["exit",me,Be[2]]),Ce++,ne++}if(Be[1].type==="listItemPrefix"){const ze={type:"listItem",_spread:!1,start:Object.assign({},Be[1].start),end:void 0};me=ze,T.splice(Ce,0,["enter",ze,Be[2]]),Ce++,ne++,we=void 0,Ee=!0}}}return T[O][1]._spread=ee,ne}function i(T,O){return ne;function ne(Ce){l.call(this,T(Ce),Ce),O&&O.call(this,Ce)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(T,O,ne){this.stack[this.stack.length-1].children.push(T),this.stack.push(T),this.tokenStack.push([O,ne||void 0]),T.position={start:jr(O.start),end:void 0}}function c(T){return O;function O(ne){T&&T.call(this,ne),d.call(this,ne)}}function d(T,O){const ne=this.stack.pop(),Ce=this.tokenStack.pop();if(Ce)Ce[0].type!==T.type&&(O?O.call(this,T,Ce[0]):(Ce[1]||No).call(this,T,Ce[0]));else throw new Error("Cannot close `"+T.type+"` ("+In({start:T.start,end:T.end})+"): it’s not open");ne.position.end=jr(T.end)}function u(){return ui(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(T){if(this.data.expectingFirstListItemValue){const O=this.stack[this.stack.length-2];O.start=Number.parseInt(this.sliceSerialize(T),10),this.data.expectingFirstListItemValue=void 0}}function p(){const T=this.resume(),O=this.stack[this.stack.length-1];O.lang=T}function g(){const T=this.resume(),O=this.stack[this.stack.length-1];O.meta=T}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const T=this.resume(),O=this.stack[this.stack.length-1];O.value=T.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const T=this.resume(),O=this.stack[this.stack.length-1];O.value=T.replace(/(\r?\n|\r)$/g,"")}function N(T){const O=this.resume(),ne=this.stack[this.stack.length-1];ne.label=O,ne.identifier=sr(this.sliceSerialize(T)).toLowerCase()}function y(){const T=this.resume(),O=this.stack[this.stack.length-1];O.title=T}function P(){const T=this.resume(),O=this.stack[this.stack.length-1];O.url=T}function W(T){const O=this.stack[this.stack.length-1];if(!O.depth){const ne=this.sliceSerialize(T).length;O.depth=ne}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function B(T){const O=this.stack[this.stack.length-1];O.depth=this.sliceSerialize(T).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function U(T){const ne=this.stack[this.stack.length-1].children;let Ce=ne[ne.length-1];(!Ce||Ce.type!=="text")&&(Ce=Q(),Ce.position={start:jr(T.start),end:void 0},ne.push(Ce)),this.stack.push(Ce)}function j(T){const O=this.stack.pop();O.value+=this.sliceSerialize(T),O.position.end=jr(T.end)}function R(T){const O=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ne=O.children[O.children.length-1];ne.position.end=jr(T.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(O.type)&&(U.call(this,T),j.call(this,T))}function D(){this.data.atHardBreak=!0}function _(){const T=this.resume(),O=this.stack[this.stack.length-1];O.value=T}function C(){const T=this.resume(),O=this.stack[this.stack.length-1];O.value=T}function V(){const T=this.resume(),O=this.stack[this.stack.length-1];O.value=T}function z(){const T=this.stack[this.stack.length-1];if(this.data.inReference){const O=this.data.referenceType||"shortcut";T.type+="Reference",T.referenceType=O,delete T.url,delete T.title}else delete T.identifier,delete T.label;this.data.referenceType=void 0}function Z(){const T=this.stack[this.stack.length-1];if(this.data.inReference){const O=this.data.referenceType||"shortcut";T.type+="Reference",T.referenceType=O,delete T.url,delete T.title}else delete T.identifier,delete T.label;this.data.referenceType=void 0}function F(T){const O=this.sliceSerialize(T),ne=this.stack[this.stack.length-2];ne.label=Cg(O),ne.identifier=sr(O).toLowerCase()}function ce(){const T=this.stack[this.stack.length-1],O=this.resume(),ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,ne.type==="link"){const Ce=T.children;ne.children=Ce}else ne.alt=O}function v(){const T=this.resume(),O=this.stack[this.stack.length-1];O.url=T}function ue(){const T=this.resume(),O=this.stack[this.stack.length-1];O.title=T}function fe(){this.data.inReference=void 0}function w(){this.data.referenceType="collapsed"}function J(T){const O=this.resume(),ne=this.stack[this.stack.length-1];ne.label=O,ne.identifier=sr(this.sliceSerialize(T)).toLowerCase(),this.data.referenceType="full"}function he(T){this.data.characterReferenceType=T.type}function ye(T){const O=this.sliceSerialize(T),ne=this.data.characterReferenceType;let Ce;ne?(Ce=Mc(O,ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ce=mi(O);const De=this.stack[this.stack.length-1];De.value+=Ce}function re(T){const O=this.stack.pop();O.position.end=jr(T.end)}function Pe(T){j.call(this,T);const O=this.stack[this.stack.length-1];O.url=this.sliceSerialize(T)}function X(T){j.call(this,T);const O=this.stack[this.stack.length-1];O.url="mailto:"+this.sliceSerialize(T)}function le(){return{type:"blockquote",children:[]}}function ke(){return{type:"code",lang:null,meta:null,value:""}}function ge(){return{type:"inlineCode",value:""}}function Ie(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ke(){return{type:"emphasis",children:[]}}function et(){return{type:"heading",depth:0,children:[]}}function st(){return{type:"break"}}function ft(){return{type:"html",value:""}}function tt(){return{type:"image",title:null,url:"",alt:null}}function xe(){return{type:"link",title:null,url:"",children:[]}}function qe(T){return{type:"list",ordered:T.type==="listOrdered",start:null,spread:T._spread,children:[]}}function it(T){return{type:"listItem",spread:T._spread,checked:null,children:[]}}function ve(){return{type:"paragraph",children:[]}}function Ct(){return{type:"strong",children:[]}}function Q(){return{type:"text",value:""}}function de(){return{type:"thematicBreak"}}}function jr(e){return{line:e.line,column:e.column,offset:e.offset}}function Bc(e,r){let n=-1;for(;++n<r.length;){const s=r[n];Array.isArray(s)?Bc(e,s):Ag(e,s)}}function Ag(e,r){let n;for(n in r)if(Oc.call(r,n))switch(n){case"canContainEols":{const s=r[n];s&&e[n].push(...s);break}case"transforms":{const s=r[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=r[n];s&&Object.assign(e[n],s);break}}}function No(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+In({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+In({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+In({start:r.start,end:r.end})+") is still open")}function Mg(e){const r=this;r.parser=n;function n(s){return Eg(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function Tg(e,r){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,n),e.applyData(r,n)}function Dg(e,r){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,n),[e.applyData(r,n),{type:"text",value:`
390
+ `}]}function Pg(e,r){const n=r.value?r.value+`
391
+ `:"",s={};r.lang&&(s.className=["language-"+r.lang]);let a={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return r.meta&&(a.data={meta:r.meta}),e.patch(r,a),a=e.applyData(r,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(r,a),a}function Lg(e,r){const n={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}function Rg(e,r){const n={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}function _g(e,r){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),a=hn(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(s,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(r,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(r,d),e.applyData(r,d)}function zg(e,r){const n={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}function Fg(e,r){if(e.options.allowDangerousHtml){const n={type:"raw",value:r.value};return e.patch(r,n),e.applyData(r,n)}}function Wc(e,r){const n=r.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+s}];const a=e.all(r),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&o.type==="text"?o.value+=s:a.push({type:"text",value:s}),a}function $g(e,r){const n=String(r.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Wc(e,r);const a={src:hn(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(r,i),e.applyData(r,i)}function Og(e,r){const n={src:hn(r.url)};r.alt!==null&&r.alt!==void 0&&(n.alt=r.alt),r.title!==null&&r.title!==void 0&&(n.title=r.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(r,s),e.applyData(r,s)}function Bg(e,r){const n={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(r,s),e.applyData(r,s)}function Wg(e,r){const n=String(r.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Wc(e,r);const a={href:hn(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const i={type:"element",tagName:"a",properties:a,children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Ug(e,r){const n={href:hn(r.url)};r.title!==null&&r.title!==void 0&&(n.title=r.title);const s={type:"element",tagName:"a",properties:n,children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function Hg(e,r,n){const s=e.all(r),a=n?qg(n):Uc(r),i={},o=[];if(typeof r.checked=="boolean"){const u=s[0];let m;u&&u.type==="element"&&u.tagName==="p"?m=u:(m={type:"element",tagName:"p",properties:{},children:[]},s.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<s.length;){const u=s[l];(a||l!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
392
+ `}),u.type==="element"&&u.tagName==="p"&&!a?o.push(...u.children):o.push(u)}const c=s[s.length-1];c&&(a||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
393
+ `});const d={type:"element",tagName:"li",properties:i,children:o};return e.patch(r,d),e.applyData(r,d)}function qg(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const n=e.children;let s=-1;for(;!r&&++s<n.length;)r=Uc(n[s])}return r}function Uc(e){const r=e.spread;return r??e.children.length>1}function Vg(e,r){const n={},s=e.all(r);let a=-1;for(typeof r.start=="number"&&r.start!==1&&(n.start=r.start);++a<s.length;){const o=s[a];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:r.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(r,i),e.applyData(r,i)}function Gg(e,r){const n={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}function Kg(e,r){const n={type:"root",children:e.wrap(e.all(r))};return e.patch(r,n),e.applyData(r,n)}function Jg(e,r){const n={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}function Yg(e,r){const n=e.all(r),s=n.shift(),a=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(r.children[0],o),a.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=oi(r.children[1]),c=wc(r.children[r.children.length-1]);l&&c&&(o.position={start:l,end:c}),a.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(r,i),e.applyData(r,i)}function Qg(e,r,n){const s=n?n.children:void 0,i=(s?s.indexOf(r):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:r.children.length;let c=-1;const d=[];for(;++c<l;){const m=r.children[c],h={},p=o?o[c]:void 0;p&&(h.align=p);let g={type:"element",tagName:i,properties:h,children:[]};m&&(g.children=e.all(m),e.patch(m,g),g=e.applyData(m,g)),d.push(g)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(r,u),e.applyData(r,u)}function Xg(e,r){const n={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,n),e.applyData(r,n)}const Co=9,So=32;function Zg(e){const r=String(e),n=/\r?\n|\r/g;let s=n.exec(r),a=0;const i=[];for(;s;)i.push(Eo(r.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(r);return i.push(Eo(r.slice(a),a>0,!1)),i.join("")}function Eo(e,r,n){let s=0,a=e.length;if(r){let i=e.codePointAt(s);for(;i===Co||i===So;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(a-1);for(;i===Co||i===So;)a--,i=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function ex(e,r){const n={type:"text",value:Zg(String(r.value))};return e.patch(r,n),e.applyData(r,n)}function tx(e,r){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,n),e.applyData(r,n)}const rx={blockquote:Tg,break:Dg,code:Pg,delete:Lg,emphasis:Rg,footnoteReference:_g,heading:zg,html:Fg,imageReference:$g,image:Og,inlineCode:Bg,linkReference:Wg,link:Ug,listItem:Hg,list:Vg,paragraph:Gg,root:Kg,strong:Jg,table:Yg,tableCell:Xg,tableRow:Qg,text:ex,thematicBreak:tx,toml:rs,yaml:rs,definition:rs,footnoteDefinition:rs};function rs(){}const Hc=-1,Ms=0,Mn=1,xs=2,hi=3,fi=4,gi=5,xi=6,qc=7,Vc=8,Io=typeof self=="object"?self:globalThis,nx=(e,r)=>{const n=(a,i)=>(e.set(i,a),a),s=a=>{if(e.has(a))return e.get(a);const[i,o]=r[a];switch(i){case Ms:case Hc:return n(o,a);case Mn:{const l=n([],a);for(const c of o)l.push(s(c));return l}case xs:{const l=n({},a);for(const[c,d]of o)l[s(c)]=s(d);return l}case hi:return n(new Date(o),a);case fi:{const{source:l,flags:c}=o;return n(new RegExp(l,c),a)}case gi:{const l=n(new Map,a);for(const[c,d]of o)l.set(s(c),s(d));return l}case xi:{const l=n(new Set,a);for(const c of o)l.add(s(c));return l}case qc:{const{name:l,message:c}=o;return n(new Io[l](c),a)}case Vc:return n(BigInt(o),a);case"BigInt":return n(Object(BigInt(o)),a);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new Io[i](o),a)};return s},Ao=e=>nx(new Map,e)(0),Yr="",{toString:sx}={},{keys:ax}=Object,wn=e=>{const r=typeof e;if(r!=="object"||!e)return[Ms,r];const n=sx.call(e).slice(8,-1);switch(n){case"Array":return[Mn,Yr];case"Object":return[xs,Yr];case"Date":return[hi,Yr];case"RegExp":return[fi,Yr];case"Map":return[gi,Yr];case"Set":return[xi,Yr];case"DataView":return[Mn,n]}return n.includes("Array")?[Mn,n]:n.includes("Error")?[qc,n]:[xs,n]},ns=([e,r])=>e===Ms&&(r==="function"||r==="symbol"),ix=(e,r,n,s)=>{const a=(o,l)=>{const c=s.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=wn(o);switch(l){case Ms:{let u=o;switch(c){case"bigint":l=Vc,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return a([Hc],o)}return a([l,u],o)}case Mn:{if(c){let h=o;return c==="DataView"?h=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(o)),a([c,[...h]],o)}const u=[],m=a([l,u],o);for(const h of o)u.push(i(h));return m}case xs:{if(c)switch(c){case"BigInt":return a([c,o.toString()],o);case"Boolean":case"Number":case"String":return a([c,o.valueOf()],o)}if(r&&"toJSON"in o)return i(o.toJSON());const u=[],m=a([l,u],o);for(const h of ax(o))(e||!ns(wn(o[h])))&&u.push([i(h),i(o[h])]);return m}case hi:return a([l,o.toISOString()],o);case fi:{const{source:u,flags:m}=o;return a([l,{source:u,flags:m}],o)}case gi:{const u=[],m=a([l,u],o);for(const[h,p]of o)(e||!(ns(wn(h))||ns(wn(p))))&&u.push([i(h),i(p)]);return m}case xi:{const u=[],m=a([l,u],o);for(const h of o)(e||!ns(wn(h)))&&u.push(i(h));return m}}const{message:d}=o;return a([l,{name:c,message:d}],o)};return i},Mo=(e,{json:r,lossy:n}={})=>{const s=[];return ix(!(r||n),!!r,new Map,s)(e),s},bs=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?Ao(Mo(e,r)):structuredClone(e):(e,r)=>Ao(Mo(e,r));function ox(e,r){const n=[{type:"text",value:"↩"}];return r>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),n}function lx(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function cx(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||ox,s=e.options.footnoteBackLabel||lx,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[c]);if(!d)continue;const u=e.all(d),m=String(d.identifier).toUpperCase(),h=hn(m.toLowerCase());let p=0;const g=[],x=e.footnoteCounts.get(m);for(;x!==void 0&&++p<=x;){g.length>0&&g.push({type:"text",value:" "});let N=typeof n=="string"?n:n(c,p);typeof N=="string"&&(N={type:"text",value:N}),g.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,p),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const b=u[u.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const N=b.children[b.children.length-1];N&&N.type==="text"?N.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...g)}else u.push(...g);const k={type:"element",tagName:"li",properties:{id:r+"fn-"+h},children:e.wrap(u,!0)};e.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:{...bs(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
394
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
395
+ `}]}}const Ts=function(e){if(e==null)return px;if(typeof e=="function")return Ds(e);if(typeof e=="object")return Array.isArray(e)?dx(e):ux(e);if(typeof e=="string")return mx(e);throw new Error("Expected function, string, or object as test")};function dx(e){const r=[];let n=-1;for(;++n<e.length;)r[n]=Ts(e[n]);return Ds(s);function s(...a){let i=-1;for(;++i<r.length;)if(r[i].apply(this,a))return!0;return!1}}function ux(e){const r=e;return Ds(n);function n(s){const a=s;let i;for(i in e)if(a[i]!==r[i])return!1;return!0}}function mx(e){return Ds(r);function r(n){return n&&n.type===e}}function Ds(e){return r;function r(n,s,a){return!!(hx(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function px(){return!0}function hx(e){return e!==null&&typeof e=="object"&&"type"in e}const Gc=[],fx=!0,Ta=!1,gx="skip";function Kc(e,r,n,s){let a;typeof r=="function"&&typeof n!="function"?(s=n,n=r):a=r;const i=Ts(a),o=s?-1:1;l(e,void 0,[])();function l(c,d,u){const m=c&&typeof c=="object"?c:{};if(typeof m.type=="string"){const p=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=Gc,g,x,b;if((!r||i(c,d,u[u.length-1]||void 0))&&(p=xx(n(c,u)),p[0]===Ta))return p;if("children"in c&&c.children){const k=c;if(k.children&&p[0]!==gx)for(x=(s?k.children.length:-1)+o,b=u.concat(k);x>-1&&x<k.children.length;){const N=k.children[x];if(g=l(N,x,b)(),g[0]===Ta)return g;x=typeof g[1]=="number"?g[1]:x+o}}return p}}}function xx(e){return Array.isArray(e)?e:typeof e=="number"?[fx,e]:e==null?Gc:[e]}function bi(e,r,n,s){let a,i,o;typeof r=="function"&&typeof n!="function"?(i=void 0,o=r,a=n):(i=r,o=n,a=s),Kc(e,i,l,a);function l(c,d){const u=d[d.length-1],m=u?u.children.indexOf(c):void 0;return o(c,m,u)}}const Da={}.hasOwnProperty,bx={};function yx(e,r){const n=r||bx,s=new Map,a=new Map,i=new Map,o={...rx,...n.handlers},l={all:d,applyData:vx,definitionById:s,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:kx,wrap:jx};return bi(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const m=u.type==="definition"?s:a,h=String(u.identifier).toUpperCase();m.has(h)||m.set(h,u)}}),l;function c(u,m){const h=u.type,p=l.handlers[h];if(Da.call(l.handlers,h)&&p)return p(l,u,m);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in u){const{children:x,...b}=u,k=bs(b);return k.children=l.all(u),k}return bs(u)}return(l.options.unknownHandler||wx)(l,u,m)}function d(u){const m=[];if("children"in u){const h=u.children;let p=-1;for(;++p<h.length;){const g=l.one(h[p],u);if(g){if(p&&h[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=To(g.value)),!Array.isArray(g)&&g.type==="element")){const x=g.children[0];x&&x.type==="text"&&(x.value=To(x.value))}Array.isArray(g)?m.push(...g):m.push(g)}}}return m}}function kx(e,r){e.position&&(r.position=o0(e))}function vx(e,r){let n=r;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const o="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,bs(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function wx(e,r){const n=r.data||{},s="value"in r&&!(Da.call(n,"hProperties")||Da.call(n,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function jx(e,r){const n=[];let s=-1;for(r&&n.push({type:"text",value:`
396
+ `});++s<e.length;)s&&n.push({type:"text",value:`
397
+ `}),n.push(e[s]);return r&&e.length>0&&n.push({type:"text",value:`
398
+ `}),n}function To(e){let r=0,n=e.charCodeAt(r);for(;n===9||n===32;)r++,n=e.charCodeAt(r);return e.slice(r)}function Do(e,r){const n=yx(e,r),s=n.one(e,void 0),a=cx(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
399
+ `},a),i}function Nx(e,r){return e&&"run"in e?async function(n,s){const a=Do(n,{file:s,...r});await e.run(a,s)}:function(n,s){return Do(n,{file:s,...e||r})}}function Po(e){if(e)throw e}var Ks,Lo;function Cx(){if(Lo)return Ks;Lo=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(d){return typeof Array.isArray=="function"?Array.isArray(d):r.call(d)==="[object Array]"},i=function(d){if(!d||r.call(d)!=="[object Object]")return!1;var u=e.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!u&&!m)return!1;var h;for(h in d);return typeof h>"u"||e.call(d,h)},o=function(d,u){n&&u.name==="__proto__"?n(d,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):d[u.name]=u.newValue},l=function(d,u){if(u==="__proto__")if(e.call(d,u)){if(s)return s(d,u).value}else return;return d[u]};return Ks=function c(){var d,u,m,h,p,g,x=arguments[0],b=1,k=arguments.length,N=!1;for(typeof x=="boolean"&&(N=x,x=arguments[1]||{},b=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});b<k;++b)if(d=arguments[b],d!=null)for(u in d)m=l(x,u),h=l(d,u),x!==h&&(N&&h&&(i(h)||(p=a(h)))?(p?(p=!1,g=m&&a(m)?m:[]):g=m&&i(m)?m:{},o(x,{name:u,newValue:c(N,g,h)})):typeof h<"u"&&o(x,{name:u,newValue:h}));return x},Ks}var Sx=Cx();const Js=zn(Sx);function Pa(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Ex(){const e=[],r={run:n,use:s};return r;function n(...a){let i=-1;const o=a.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...a);function l(c,...d){const u=e[++i];let m=-1;if(c){o(c);return}for(;++m<a.length;)(d[m]===null||d[m]===void 0)&&(d[m]=a[m]);a=d,u?Ix(u,l)(...d):o(null,...d)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),r}}function Ix(e,r){let n;return s;function s(...o){const l=e.length>o.length;let c;l&&o.push(a);try{c=e.apply(this,o)}catch(d){const u=d;if(l&&n)throw u;return a(u)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,a):c instanceof Error?a(c):i(c))}function a(o,...l){n||(n=!0,r(o,...l))}function i(o){a(null,o)}}const ir={basename:Ax,dirname:Mx,extname:Tx,join:Dx,sep:"/"};function Ax(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Hn(e);let n=0,s=-1,a=e.length,i;if(r===void 0||r.length===0||r.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1);return s<0?"":e.slice(n,s)}if(r===e)return"";let o=-1,l=r.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else o<0&&(i=!0,o=a+1),l>-1&&(e.codePointAt(a)===r.codePointAt(l--)?l<0&&(s=a):(l=-1,s=o));return n===s?s=o:s<0&&(s=e.length),e.slice(n,s)}function Mx(e){if(Hn(e),e.length===0)return".";let r=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){r=n;break}}else s||(s=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function Tx(e){Hn(e);let r=e.length,n=-1,s=0,a=-1,i=0,o;for(;r--;){const l=e.codePointAt(r);if(l===47){if(o){s=r+1;break}continue}n<0&&(o=!0,n=r+1),l===46?a<0?a=r:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function Dx(...e){let r=-1,n;for(;++r<e.length;)Hn(e[r]),e[r]&&(n=n===void 0?e[r]:n+"/"+e[r]);return n===void 0?".":Px(n)}function Px(e){Hn(e);const r=e.codePointAt(0)===47;let n=Lx(e,!r);return n.length===0&&!r&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),r?"/"+n:n}function Lx(e,r){let n="",s=0,a=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(a===o-1||i===1))if(a!==o-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),a=o,i=0;continue}}else if(n.length>0){n="",s=0,a=o,i=0;continue}}r&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,o):n=e.slice(a+1,o),s=o-a-1;a=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function Hn(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Rx={cwd:_x};function _x(){return"/"}function La(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function zx(e){if(typeof e=="string")e=new URL(e);else if(!La(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return Fx(e)}function Fx(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const r=e.pathname;let n=-1;for(;++n<r.length;)if(r.codePointAt(n)===37&&r.codePointAt(n+1)===50){const s=r.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(r)}const Ys=["history","path","basename","stem","extname","dirname"];class Jc{constructor(r){let n;r?La(r)?n={path:r}:typeof r=="string"||$x(r)?n={value:r}:n=r:n={},this.cwd="cwd"in n?"":Rx.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Ys.length;){const i=Ys[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Ys.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?ir.basename(this.path):void 0}set basename(r){Xs(r,"basename"),Qs(r,"basename"),this.path=ir.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?ir.dirname(this.path):void 0}set dirname(r){Ro(this.basename,"dirname"),this.path=ir.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?ir.extname(this.path):void 0}set extname(r){if(Qs(r,"extname"),Ro(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ir.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){La(r)&&(r=zx(r)),Xs(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?ir.basename(this.path,this.extname):void 0}set stem(r){Xs(r,"stem"),Qs(r,"stem"),this.path=ir.join(this.dirname||"",r+(this.extname||""))}fail(r,n,s){const a=this.message(r,n,s);throw a.fatal=!0,a}info(r,n,s){const a=this.message(r,n,s);return a.fatal=void 0,a}message(r,n,s){const a=new At(r,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Qs(e,r){if(e&&e.includes(ir.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+ir.sep+"`")}function Xs(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function Ro(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function $x(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ox=function(e){const s=this.constructor.prototype,a=s[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},Bx={}.hasOwnProperty;class yi extends Ox{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Ex()}copy(){const r=new yi;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];r.use(...s)}return r.data(Js(!0,{},this.namespace)),r}data(r,n){return typeof r=="string"?arguments.length===2?(ta("data",this.frozen),this.namespace[r]=n,this):Bx.call(this.namespace,r)&&this.namespace[r]||void 0:r?(ta("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(r,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const n=ss(r),s=this.parser||this.Parser;return Zs("parse",s),s(String(n),n)}process(r,n){const s=this;return this.freeze(),Zs("process",this.parser||this.Parser),ea("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,o){const l=ss(r),c=s.parse(l);s.run(c,l,function(u,m,h){if(u||!m||!h)return d(u);const p=m,g=s.stringify(p,h);Hx(g)?h.value=g:h.result=g,d(u,h)});function d(u,m){u||!m?o(u):i?i(m):n(void 0,m)}}}processSync(r){let n=!1,s;return this.freeze(),Zs("processSync",this.parser||this.Parser),ea("processSync",this.compiler||this.Compiler),this.process(r,a),zo("processSync","process",n),s;function a(i,o){n=!0,Po(i),s=o}}run(r,n,s){_o(r),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(o,l){const c=ss(n);a.run(r,c,d);function d(u,m,h){const p=m||r;u?l(u):o?o(p):s(void 0,p,h)}}}runSync(r,n){let s=!1,a;return this.run(r,n,i),zo("runSync","run",s),a;function i(o,l){Po(o),a=l,s=!0}}stringify(r,n){this.freeze();const s=ss(n),a=this.compiler||this.Compiler;return ea("stringify",a),_o(r),a(r,s)}use(r,...n){const s=this.attachers,a=this.namespace;if(ta("use",this.frozen),r!=null)if(typeof r=="function")c(r,n);else if(typeof r=="object")Array.isArray(r)?l(r):o(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[u,...m]=d;c(u,m)}else o(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function o(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(a.settings=Js(!0,a.settings,d.settings))}function l(d){let u=-1;if(d!=null)if(Array.isArray(d))for(;++u<d.length;){const m=d[u];i(m)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,u){let m=-1,h=-1;for(;++m<s.length;)if(s[m][0]===d){h=m;break}if(h===-1)s.push([d,...u]);else if(u.length>0){let[p,...g]=u;const x=s[h][1];Pa(x)&&Pa(p)&&(p=Js(!0,x,p)),s[h]=[d,p,...g]}}}}const Wx=new yi().freeze();function Zs(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ea(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ta(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function _o(e){if(!Pa(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function zo(e,r,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function ss(e){return Ux(e)?e:new Jc(e)}function Ux(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Hx(e){return typeof e=="string"||qx(e)}function qx(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vx="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Fo=[],$o={allowDangerousHtml:!0},Gx=/^(https?|ircs?|mailto|xmpp)$/i,Kx=[{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 Jx(e){const r=Yx(e),n=Qx(e);return Xx(r.runSync(r.parse(n),n),e)}function Yx(e){const r=e.rehypePlugins||Fo,n=e.remarkPlugins||Fo,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...$o}:$o;return Wx().use(Mg).use(n).use(Nx,s).use(r)}function Qx(e){const r=e.children||"",n=new Jc;return typeof r=="string"&&(n.value=r),n}function Xx(e,r){const n=r.allowedElements,s=r.allowElement,a=r.components,i=r.disallowedElements,o=r.skipHtml,l=r.unwrapDisallowed,c=r.urlTransform||Zx;for(const u of Kx)Object.hasOwn(r,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+Vx+u.id,void 0);return bi(e,d),m0(e,{Fragment:t.Fragment,components:a,ignoreInvalidStyle:!0,jsx:t.jsx,jsxs:t.jsxs,passKeys:!0,passNode:!0});function d(u,m,h){if(u.type==="raw"&&h&&typeof m=="number")return o?h.children.splice(m,1):h.children[m]={type:"text",value:u.value},m;if(u.type==="element"){let p;for(p in qs)if(Object.hasOwn(qs,p)&&Object.hasOwn(u.properties,p)){const g=u.properties[p],x=qs[p];(x===null||x.includes(u.tagName))&&(u.properties[p]=c(String(g||""),p,u))}}if(u.type==="element"){let p=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!p&&s&&typeof m=="number"&&(p=!s(u,m,h)),p&&h&&typeof m=="number")return l&&u.children?h.children.splice(m,1,...u.children):h.children.splice(m,1),m}}}function Zx(e){const r=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return r===-1||a!==-1&&r>a||n!==-1&&r>n||s!==-1&&r>s||Gx.test(e.slice(0,r))?e:""}function Oo(e,r){const n=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(r);for(;a!==-1;)s++,a=n.indexOf(r,a+r.length);return s}function eb(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function tb(e,r,n){const a=Ts((n||{}).ignore||[]),i=rb(r);let o=-1;for(;++o<i.length;)Kc(e,"text",l);function l(d,u){let m=-1,h;for(;++m<u.length;){const p=u[m],g=h?h.children:void 0;if(a(p,g?g.indexOf(p):void 0,h))return;h=p}if(h)return c(d,u)}function c(d,u){const m=u[u.length-1],h=i[o][0],p=i[o][1];let g=0;const b=m.children.indexOf(d);let k=!1,N=[];h.lastIndex=0;let y=h.exec(d.value);for(;y;){const P=y.index,W={index:y.index,input:y.input,stack:[...u,d]};let M=p(...y,W);if(typeof M=="string"&&(M=M.length>0?{type:"text",value:M}:void 0),M===!1?h.lastIndex=P+1:(g!==P&&N.push({type:"text",value:d.value.slice(g,P)}),Array.isArray(M)?N.push(...M):M&&N.push(M),g=P+y[0].length,k=!0),!h.global)break;y=h.exec(d.value)}return k?(g<d.value.length&&N.push({type:"text",value:d.value.slice(g)}),m.children.splice(b,1,...N)):N=[d],b+N.length}}function rb(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const a=n[s];r.push([nb(a[0]),sb(a[1])])}return r}function nb(e){return typeof e=="string"?new RegExp(eb(e),"g"):e}function sb(e){return typeof e=="function"?e:function(){return e}}const ra="phrasing",na=["autolink","link","image","label"];function ab(){return{transforms:[mb],enter:{literalAutolink:ob,literalAutolinkEmail:sa,literalAutolinkHttp:sa,literalAutolinkWww:sa},exit:{literalAutolink:ub,literalAutolinkEmail:db,literalAutolinkHttp:lb,literalAutolinkWww:cb}}}function ib(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ra,notInConstruct:na},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ra,notInConstruct:na},{character:":",before:"[ps]",after:"\\/",inConstruct:ra,notInConstruct:na}]}}function ob(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function sa(e){this.config.enter.autolinkProtocol.call(this,e)}function lb(e){this.config.exit.autolinkProtocol.call(this,e)}function cb(e){this.config.exit.data.call(this,e);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(e)}function db(e){this.config.exit.autolinkEmail.call(this,e)}function ub(e){this.exit(e)}function mb(e){tb(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,pb],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),hb]],{ignore:["link","linkReference"]})}function pb(e,r,n,s,a){let i="";if(!Yc(a)||(/^w/i.test(r)&&(n=r+n,r="",i="http://"),!fb(n)))return!1;const o=gb(n+s);if(!o[0])return!1;const l={type:"link",title:null,url:i+r+o[0],children:[{type:"text",value:r+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function hb(e,r,n,s){return!Yc(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+n,children:[{type:"text",value:r+"@"+n}]}}function fb(e){const r=e.split(".");return!(r.length<2||r[r.length-1]&&(/_/.test(r[r.length-1])||!/[a-zA-Z\d]/.test(r[r.length-1]))||r[r.length-2]&&(/_/.test(r[r.length-2])||!/[a-zA-Z\d]/.test(r[r.length-2])))}function gb(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let n=r[0],s=n.indexOf(")");const a=Oo(e,"(");let i=Oo(e,")");for(;s!==-1&&a>i;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),i++;return[e,n]}function Yc(e,r){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ur(n)||Is(n))&&(!r||n!==47)}Qc.peek=Cb;function xb(){this.buffer()}function bb(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function yb(){this.buffer()}function kb(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function vb(e){const r=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=sr(this.sliceSerialize(e)).toLowerCase(),n.label=r}function wb(e){this.exit(e)}function jb(e){const r=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=sr(this.sliceSerialize(e)).toLowerCase(),n.label=r}function Nb(e){this.exit(e)}function Cb(){return"["}function Qc(e,r,n,s){const a=n.createTracker(s);let i=a.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return i+=a.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),o(),i+=a.move("]"),i}function Sb(){return{enter:{gfmFootnoteCallString:xb,gfmFootnoteCall:bb,gfmFootnoteDefinitionLabelString:yb,gfmFootnoteDefinition:kb},exit:{gfmFootnoteCallString:vb,gfmFootnoteCall:wb,gfmFootnoteDefinitionLabelString:jb,gfmFootnoteDefinition:Nb}}}function Eb(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:n,footnoteReference:Qc},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,i,o){const l=i.createTracker(o);let c=l.move("[^");const d=i.enter("footnoteDefinition"),u=i.enter("label");return c+=l.move(i.safe(i.associationId(s),{before:c,after:"]"})),u(),c+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),c+=l.move((r?`
400
+ `:" ")+i.indentLines(i.containerFlow(s,l.current()),r?Xc:Ib))),d(),c}}function Ib(e,r,n){return r===0?e:Xc(e,r,n)}function Xc(e,r,n){return(n?"":" ")+e}const Ab=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Zc.peek=Lb;function Mb(){return{canContainEols:["delete"],enter:{strikethrough:Db},exit:{strikethrough:Pb}}}function Tb(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Ab}],handlers:{delete:Zc}}}function Db(e){this.enter({type:"delete",children:[]},e)}function Pb(e){this.exit(e)}function Zc(e,r,n,s){const a=n.createTracker(s),i=n.enter("strikethrough");let o=a.move("~~");return o+=n.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),i(),o}function Lb(){return"~"}function Rb(e){return e.length}function _b(e,r){const n=r||{},s=(n.align||[]).concat(),a=n.stringLength||Rb,i=[],o=[],l=[],c=[];let d=0,u=-1;for(;++u<e.length;){const x=[],b=[];let k=-1;for(e[u].length>d&&(d=e[u].length);++k<e[u].length;){const N=zb(e[u][k]);if(n.alignDelimiters!==!1){const y=a(N);b[k]=y,(c[k]===void 0||y>c[k])&&(c[k]=y)}x.push(N)}o[u]=x,l[u]=b}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<d;)i[m]=Bo(s[m]);else{const x=Bo(s);for(;++m<d;)i[m]=x}m=-1;const h=[],p=[];for(;++m<d;){const x=i[m];let b="",k="";x===99?(b=":",k=":"):x===108?b=":":x===114&&(k=":");let N=n.alignDelimiters===!1?1:Math.max(1,c[m]-b.length-k.length);const y=b+"-".repeat(N)+k;n.alignDelimiters!==!1&&(N=b.length+N+k.length,N>c[m]&&(c[m]=N),p[m]=N),h[m]=y}o.splice(1,0,h),l.splice(1,0,p),u=-1;const g=[];for(;++u<o.length;){const x=o[u],b=l[u];m=-1;const k=[];for(;++m<d;){const N=x[m]||"";let y="",P="";if(n.alignDelimiters!==!1){const W=c[m]-(b[m]||0),M=i[m];M===114?y=" ".repeat(W):M===99?W%2?(y=" ".repeat(W/2+.5),P=" ".repeat(W/2-.5)):(y=" ".repeat(W/2),P=y):P=" ".repeat(W)}n.delimiterStart!==!1&&!m&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||m)&&k.push(" "),n.alignDelimiters!==!1&&k.push(y),k.push(N),n.alignDelimiters!==!1&&k.push(P),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||m!==d-1)&&k.push("|")}g.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return g.join(`
401
+ `)}function zb(e){return e==null?"":String(e)}function Bo(e){const r=typeof e=="string"?e.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function Fb(e,r,n,s){const a=n.enter("blockquote"),i=n.createTracker(s);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),$b);return a(),o}function $b(e,r,n){return">"+(n?"":" ")+e}function Ob(e,r){return Wo(e,r.inConstruct,!0)&&!Wo(e,r.notInConstruct,!1)}function Wo(e,r,n){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return n;let s=-1;for(;++s<r.length;)if(e.includes(r[s]))return!0;return!1}function Uo(e,r,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
402
+ `&&Ob(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
403
+ `}function Bb(e,r){const n=String(e);let s=n.indexOf(r),a=s,i=0,o=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++i>o&&(o=i):i=1,a=s+r.length,s=n.indexOf(r,a);return o}function Wb(e,r){return!!(r.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Ub(e){const r=e.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function Hb(e,r,n,s){const a=Ub(n),i=e.value||"",o=a==="`"?"GraveAccent":"Tilde";if(Wb(e,n)){const m=n.enter("codeIndented"),h=n.indentLines(i,qb);return m(),h}const l=n.createTracker(s),c=a.repeat(Math.max(Bb(i,a)+1,3)),d=n.enter("codeFenced");let u=l.move(c);if(e.lang){const m=n.enter(`codeFencedLang${o}`);u+=l.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...l.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${o}`);u+=l.move(" "),u+=l.move(n.safe(e.meta,{before:u,after:`
404
+ `,encode:["`"],...l.current()})),m()}return u+=l.move(`
405
+ `),i&&(u+=l.move(i+`
406
+ `)),u+=l.move(c),d(),u}function qb(e,r,n){return(n?"":" ")+e}function ki(e){const r=e.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function Vb(e,r,n,s){const a=ki(n),i=a==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(s);let d=c.move("[");return d+=c.move(n.safe(n.associationId(e),{before:d,after:"]",...c.current()})),d+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(e.url,{before:d,after:e.title?" ":`
407
+ `,...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),d+=c.move(" "+a),d+=c.move(n.safe(e.title,{before:d,after:a,...c.current()})),d+=c.move(a),l()),o(),d}function Gb(e){const r=e.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function Ln(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ys(e,r,n){const s=an(e),a=an(r);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ed.peek=Kb;function ed(e,r,n,s){const a=Gb(n),i=n.enter("emphasis"),o=n.createTracker(s),l=o.move(a);let c=o.move(n.containerPhrasing(e,{after:a,before:l,...o.current()}));const d=c.charCodeAt(0),u=ys(s.before.charCodeAt(s.before.length-1),d,a);u.inside&&(c=Ln(d)+c.slice(1));const m=c.charCodeAt(c.length-1),h=ys(s.after.charCodeAt(0),m,a);h.inside&&(c=c.slice(0,-1)+Ln(m));const p=o.move(a);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},l+c+p}function Kb(e,r,n){return n.options.emphasis||"*"}function Jb(e,r){let n=!1;return bi(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Ta}),!!((!e.depth||e.depth<3)&&ui(e)&&(r.options.setext||n))}function Yb(e,r,n,s){const a=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(Jb(e,n)){const u=n.enter("headingSetext"),m=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:`
408
+ `,after:`
409
+ `});return m(),u(),h+`
410
+ `+(a===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
411
+ `))+1))}const o="#".repeat(a),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let d=n.containerPhrasing(e,{before:"# ",after:`
412
+ `,...i.current()});return/^[\t ]/.test(d)&&(d=Ln(d.charCodeAt(0))+d.slice(1)),d=d?o+" "+d:o,n.options.closeAtx&&(d+=" "+o),c(),l(),d}td.peek=Qb;function td(e){return e.value||""}function Qb(){return"<"}rd.peek=Xb;function rd(e,r,n,s){const a=ki(n),i=a==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(s);let d=c.move("![");return d+=c.move(n.safe(e.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),d+=c.move(" "+a),d+=c.move(n.safe(e.title,{before:d,after:a,...c.current()})),d+=c.move(a),l()),d+=c.move(")"),o(),d}function Xb(){return"!"}nd.peek=Zb;function nd(e,r,n,s){const a=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(s);let c=l.move("![");const d=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const m=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=u,i(),a==="full"||!d||d!==m?c+=l.move(m+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Zb(){return"!"}sd.peek=ey;function sd(e,r,n){let s=e.value||"",a="`",i=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++i<n.unsafe.length;){const o=n.unsafe[i],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(s);){let d=c.index;s.charCodeAt(d)===10&&s.charCodeAt(d-1)===13&&d--,s=s.slice(0,d)+" "+s.slice(c.index+1)}}return a+s+a}function ey(){return"`"}function ad(e,r){const n=ui(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}id.peek=ty;function id(e,r,n,s){const a=ki(n),i=a==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let l,c;if(ad(e,n)){const u=n.stack;n.stack=[],l=n.enter("autolink");let m=o.move("<");return m+=o.move(n.containerPhrasing(e,{before:m,after:">",...o.current()})),m+=o.move(">"),l(),n.stack=u,m}l=n.enter("link"),c=n.enter("label");let d=o.move("[");return d+=o.move(n.containerPhrasing(e,{before:d,after:"](",...o.current()})),d+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=o.move("<"),d+=o.move(n.safe(e.url,{before:d,after:">",...o.current()})),d+=o.move(">")):(c=n.enter("destinationRaw"),d+=o.move(n.safe(e.url,{before:d,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),d+=o.move(" "+a),d+=o.move(n.safe(e.title,{before:d,after:a,...o.current()})),d+=o.move(a),c()),d+=o.move(")"),l(),d}function ty(e,r,n){return ad(e,n)?"<":"["}od.peek=ry;function od(e,r,n,s){const a=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(s);let c=l.move("[");const d=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const m=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=u,i(),a==="full"||!d||d!==m?c+=l.move(m+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function ry(){return"["}function vi(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function ny(e){const r=vi(e),n=e.options.bulletOther;if(!n)return r==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+n+"`) to be different");return n}function sy(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function ld(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function ay(e,r,n,s){const a=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?sy(n):vi(n);const l=e.ordered?o==="."?")":".":ny(n);let c=r&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.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),ld(n)===o&&u){let m=-1;for(;++m<e.children.length;){const h=e.children[m];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),n.bulletCurrent=o;const d=n.containerFlow(e,s);return n.bulletLastUsed=o,n.bulletCurrent=i,a(),d}function iy(e){const r=e.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function oy(e,r,n,s){const a=iy(n);let i=n.bulletCurrent||vi(n);r&&r.type==="list"&&r.ordered&&(i=(typeof r.start=="number"&&r.start>-1?r.start:1)+(n.options.incrementListMarker===!1?0:r.children.indexOf(e))+i);let o=i.length+1;(a==="tab"||a==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(s);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,l.current()),u);return c(),d;function u(m,h,p){return h?(p?"":" ".repeat(o))+m:(p?i:i+" ".repeat(o-i.length))+m}}function ly(e,r,n,s){const a=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),a(),o}const cy=Ts(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function dy(e,r,n,s){return(e.children.some(function(o){return cy(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function uy(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}cd.peek=my;function cd(e,r,n,s){const a=uy(n),i=n.enter("strong"),o=n.createTracker(s),l=o.move(a+a);let c=o.move(n.containerPhrasing(e,{after:a,before:l,...o.current()}));const d=c.charCodeAt(0),u=ys(s.before.charCodeAt(s.before.length-1),d,a);u.inside&&(c=Ln(d)+c.slice(1));const m=c.charCodeAt(c.length-1),h=ys(s.after.charCodeAt(0),m,a);h.inside&&(c=c.slice(0,-1)+Ln(m));const p=o.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},l+c+p}function my(e,r,n){return n.options.strong||"*"}function py(e,r,n,s){return n.safe(e.value,s)}function hy(e){const r=e.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function fy(e,r,n){const s=(ld(n)+(n.options.ruleSpaces?" ":"")).repeat(hy(n));return n.options.ruleSpaces?s.slice(0,-1):s}const dd={blockquote:Fb,break:Uo,code:Hb,definition:Vb,emphasis:ed,hardBreak:Uo,heading:Yb,html:td,image:rd,imageReference:nd,inlineCode:sd,link:id,linkReference:od,list:ay,listItem:oy,paragraph:ly,root:dy,strong:cd,text:py,thematicBreak:fy};function gy(){return{enter:{table:xy,tableData:Ho,tableHeader:Ho,tableRow:yy},exit:{codeText:ky,table:by,tableData:aa,tableHeader:aa,tableRow:aa}}}function xy(e){const r=e._align;this.enter({type:"table",align:r.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function by(e){this.exit(e),this.data.inTable=void 0}function yy(e){this.enter({type:"tableRow",children:[]},e)}function aa(e){this.exit(e)}function Ho(e){this.enter({type:"tableCell",children:[]},e)}function ky(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,vy));const n=this.stack[this.stack.length-1];n.type,n.value=r,this.exit(e)}function vy(e,r){return r==="|"?r:e}function wy(e){const r=e||{},n=r.tableCellPadding,s=r.tablePipeAlign,a=r.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
413
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:c,tableRow:l}};function o(p,g,x,b){return d(u(p,x,b),p.align)}function l(p,g,x,b){const k=m(p,x,b),N=d([k]);return N.slice(0,N.indexOf(`
414
+ `))}function c(p,g,x,b){const k=x.enter("tableCell"),N=x.enter("phrasing"),y=x.containerPhrasing(p,{...b,before:i,after:i});return N(),k(),y}function d(p,g){return _b(p,{align:g,alignDelimiters:s,padding:n,stringLength:a})}function u(p,g,x){const b=p.children;let k=-1;const N=[],y=g.enter("table");for(;++k<b.length;)N[k]=m(b[k],g,x);return y(),N}function m(p,g,x){const b=p.children;let k=-1;const N=[],y=g.enter("tableRow");for(;++k<b.length;)N[k]=c(b[k],p,g,x);return y(),N}function h(p,g,x){let b=dd.inlineCode(p,g,x);return x.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function jy(){return{exit:{taskListCheckValueChecked:qo,taskListCheckValueUnchecked:qo,paragraph:Cy}}}function Ny(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Sy}}}function qo(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function Cy(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=r.children;let i=-1,o;for(;++i<a.length;){const l=a[i];if(l.type==="paragraph"){o=l;break}}o===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function Sy(e,r,n,s){const a=e.children[0],i=typeof e.checked=="boolean"&&a&&a.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(s);i&&l.move(o);let c=dd.listItem(e,r,n,{...s,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(u){return u+o}}function Ey(){return[ab(),Sb(),Mb(),gy(),jy()]}function Iy(e){return{extensions:[ib(),Eb(e),Tb(),wy(e),Ny()]}}const Ay={tokenize:Ry,partial:!0},ud={tokenize:_y,partial:!0},md={tokenize:zy,partial:!0},pd={tokenize:Fy,partial:!0},My={tokenize:$y,partial:!0},hd={name:"wwwAutolink",tokenize:Py,previous:gd},fd={name:"protocolAutolink",tokenize:Ly,previous:xd},yr={name:"emailAutolink",tokenize:Dy,previous:bd},dr={};function Ty(){return{text:dr}}let Lr=48;for(;Lr<123;)dr[Lr]=yr,Lr++,Lr===58?Lr=65:Lr===91&&(Lr=97);dr[43]=yr;dr[45]=yr;dr[46]=yr;dr[95]=yr;dr[72]=[yr,fd];dr[104]=[yr,fd];dr[87]=[yr,hd];dr[119]=[yr,hd];function Dy(e,r,n){const s=this;let a,i;return o;function o(m){return!Ra(m)||!bd.call(s,s.previous)||wi(s.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return Ra(m)?(e.consume(m),l):m===64?(e.consume(m),c):n(m)}function c(m){return m===46?e.check(My,u,d)(m):m===45||m===95||It(m)?(i=!0,e.consume(m),c):u(m)}function d(m){return e.consume(m),a=!0,c}function u(m){return i&&a&&Pt(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):n(m)}}function Py(e,r,n){const s=this;return a;function a(o){return o!==87&&o!==119||!gd.call(s,s.previous)||wi(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Ay,e.attempt(ud,e.attempt(md,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(o)}}function Ly(e,r,n){const s=this;let a="",i=!1;return o;function o(m){return(m===72||m===104)&&xd.call(s,s.previous)&&!wi(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(m),e.consume(m),l):n(m)}function l(m){if(Pt(m)&&a.length<5)return a+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const h=a.toLowerCase();if(h==="http"||h==="https")return e.consume(m),c}return n(m)}function c(m){return m===47?(e.consume(m),i?d:(i=!0,c)):n(m)}function d(m){return m===null||gs(m)||dt(m)||Ur(m)||Is(m)?n(m):e.attempt(ud,e.attempt(md,u),n)(m)}function u(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function Ry(e,r,n){let s=0;return a;function a(o){return(o===87||o===119)&&s<3?(s++,e.consume(o),a):o===46&&s===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):r(o)}}function _y(e,r,n){let s,a,i;return o;function o(d){return d===46||d===95?e.check(pd,c,l)(d):d===null||dt(d)||Ur(d)||d!==45&&Is(d)?c(d):(i=!0,e.consume(d),o)}function l(d){return d===95?s=!0:(a=s,s=void 0),e.consume(d),o}function c(d){return a||s||!i?n(d):r(d)}}function zy(e,r){let n=0,s=0;return a;function a(o){return o===40?(n++,e.consume(o),a):o===41&&s<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(pd,r,i)(o):o===null||dt(o)||Ur(o)?r(o):(e.consume(o),a)}function i(o){return o===41&&s++,e.consume(o),a}}function Fy(e,r,n){return s;function s(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),s):l===38?(e.consume(l),i):l===93?(e.consume(l),a):l===60||l===null||dt(l)||Ur(l)?r(l):n(l)}function a(l){return l===null||l===40||l===91||dt(l)||Ur(l)?r(l):s(l)}function i(l){return Pt(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),s):Pt(l)?(e.consume(l),o):n(l)}}function $y(e,r,n){return s;function s(i){return e.consume(i),a}function a(i){return It(i)?n(i):r(i)}}function gd(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||dt(e)}function xd(e){return!Pt(e)}function bd(e){return!(e===47||Ra(e))}function Ra(e){return e===43||e===45||e===46||e===95||It(e)}function wi(e){let r=e.length,n=!1;for(;r--;){const s=e[r][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Oy={tokenize:Ky,partial:!0};function By(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:qy,continuation:{tokenize:Vy},exit:Gy}},text:{91:{name:"gfmFootnoteCall",tokenize:Hy},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Wy,resolveTo:Uy}}}}function Wy(e,r,n){const s=this;let a=s.events.length;const i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o;for(;a--;){const c=s.events[a][1];if(c.type==="labelImage"){o=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(!o||!o._balanced)return n(c);const d=sr(s.sliceSerialize({start:o.end,end:s.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),r(c))}}function Uy(e,r){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[n+1],e[n+2],["enter",s,r],e[n+3],e[n+4],["enter",a,r],["exit",a,r],["enter",i,r],["enter",o,r],["exit",o,r],["exit",i,r],e[e.length-2],e[e.length-1],["exit",s,r]];return e.splice(n,e.length-n+1,...l),e}function Hy(e,r,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i=0,o;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),c}function c(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(m){if(i>999||m===93&&!o||m===null||m===91||dt(m))return n(m);if(m===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return a.includes(sr(s.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):n(m)}return dt(m)||(o=!0),i++,e.consume(m),m===92?u:d}function u(m){return m===91||m===92||m===93?(e.consume(m),i++,d):d(m)}}function qy(e,r,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i,o=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(g)}function u(g){if(o>999||g===93&&!l||g===null||g===91||dt(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return i=sr(s.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return dt(g)||(l=!0),o++,e.consume(g),g===92?m:u}function m(g){return g===91||g===92||g===93?(e.consume(g),o++,u):u(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),a.includes(i)||a.push(i),nt(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return r(g)}}function Vy(e,r,n){return e.check(Un,r,e.attempt(Oy,r,n))}function Gy(e){e.exit("gfmFootnoteDefinition")}function Ky(e,r,n){const s=this;return nt(e,a,"gfmFootnoteDefinitionIndent",5);function a(i){const o=s.events[s.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?r(i):n(i)}}function Jy(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:i,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let d=c;for(;d--;)if(o[d][0]==="exit"&&o[d][1].type==="strikethroughSequenceTemporary"&&o[d][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[d][1].end.offset-o[d][1].start.offset){o[c][1].type="strikethroughSequence",o[d][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[d][1].start),end:Object.assign({},o[c][1].end)},m={type:"strikethroughText",start:Object.assign({},o[d][1].end),end:Object.assign({},o[c][1].start)},h=[["enter",u,l],["enter",o[d][1],l],["exit",o[d][1],l],["enter",m,l]],p=l.parser.constructs.insideSpan.null;p&&Vt(h,h.length,0,As(p,o.slice(d+1,c),l)),Vt(h,h.length,0,[["exit",m,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",u,l]]),Vt(o,d-1,c-d+3,h),c=d+h.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,l,c){const d=this.previous,u=this.events;let m=0;return h;function h(g){return d===126&&u[u.length-1][1].type!=="characterEscape"?c(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const x=an(d);if(g===126)return m>1?c(g):(o.consume(g),m++,p);if(m<2&&!n)return c(g);const b=o.exit("strikethroughSequenceTemporary"),k=an(g);return b._open=!k||k===2&&!!x,b._close=!x||x===2&&!!k,l(g)}}}class Yy{constructor(){this.map=[]}add(r,n,s){Qy(this,r,n,s)}consume(r){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(r.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),r.length=this.map[n][0];s.push(r.slice()),r.length=0;let a=s.pop();for(;a;){for(const i of a)r.push(i);a=s.pop()}this.map.length=0}}function Qy(e,r,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<e.map.length;){if(e.map[a][0]===r){e.map[a][1]+=n,e.map[a][2].push(...s);return}a+=1}e.map.push([r,n,s])}}function Xy(e,r){let n=!1;const s=[];for(;r<e.length;){const a=e[r];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const i=s.length-1;s[i]=s[i]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);r+=1}return s}function Zy(){return{flow:{null:{name:"table",tokenize:ek,resolveAll:tk}}}}function ek(e,r,n){const s=this;let a=0,i=0,o;return l;function l(j){let R=s.events.length-1;for(;R>-1;){const C=s.events[R][1].type;if(C==="lineEnding"||C==="linePrefix")R--;else break}const D=R>-1?s.events[R][1].type:null,_=D==="tableHead"||D==="tableRow"?M:c;return _===M&&s.parser.lazy[s.now().line]?n(j):_(j)}function c(j){return e.enter("tableHead"),e.enter("tableRow"),d(j)}function d(j){return j===124||(o=!0,i+=1),u(j)}function u(j){return j===null?n(j):Re(j)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),p):n(j):Qe(j)?nt(e,u,"whitespace")(j):(i+=1,o&&(o=!1,a+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),m(j)))}function m(j){return j===null||j===124||dt(j)?(e.exit("data"),u(j)):(e.consume(j),j===92?h:m)}function h(j){return j===92||j===124?(e.consume(j),m):m(j)}function p(j){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(j):(e.enter("tableDelimiterRow"),o=!1,Qe(j)?nt(e,g,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):g(j))}function g(j){return j===45||j===58?b(j):j===124?(o=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),x):W(j)}function x(j){return Qe(j)?nt(e,b,"whitespace")(j):b(j)}function b(j){return j===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),k):j===45?(i+=1,k(j)):j===null||Re(j)?P(j):W(j)}function k(j){return j===45?(e.enter("tableDelimiterFiller"),N(j)):W(j)}function N(j){return j===45?(e.consume(j),N):j===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(j))}function y(j){return Qe(j)?nt(e,P,"whitespace")(j):P(j)}function P(j){return j===124?g(j):j===null||Re(j)?!o||a!==i?W(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(j)):W(j)}function W(j){return n(j)}function M(j){return e.enter("tableRow"),B(j)}function B(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),B):j===null||Re(j)?(e.exit("tableRow"),r(j)):Qe(j)?nt(e,B,"whitespace")(j):(e.enter("data"),L(j))}function L(j){return j===null||j===124||dt(j)?(e.exit("data"),B(j)):(e.consume(j),j===92?U:L)}function U(j){return j===92||j===124?(e.consume(j),L):L(j)}}function tk(e,r){let n=-1,s=!0,a=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,d,u,m;const h=new Yy;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(l=!1,c!==0&&(Vo(h,r,c,d,u),u=void 0,c=0),d={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",d,r]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(s=!0,m=void 0,i=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,u={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",u,r]])),a=g.type==="tableDelimiterRow"?2:u?3:1):a&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(s=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],m=as(h,r,i,a,void 0,m),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(s?s=!1:(i[1]!==0&&(o[0]=o[1],m=as(h,r,i,a,void 0,m)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(l=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],m=as(h,r,i,a,n,m)):o[1]!==0&&(m=as(h,r,o,a,n,m)),a=0):a&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&Vo(h,r,c,d,u),h.consume(r.events),n=-1;++n<r.events.length;){const p=r.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=Xy(r.events,n))}return e}function as(e,r,n,s,a,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},Xr(r.events,n[0])),e.add(n[0],0,[["exit",i,r]]));const c=Xr(r.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,r]]),n[2]!==0){const d=Xr(r.events,n[2]),u=Xr(r.events,n[3]),m={type:l,start:Object.assign({},d),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",m,r]]),s!==2){const h=r.events[n[2]],p=r.events[n[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,x=n[3]-n[2]-1;e.add(g,x,[])}}e.add(n[3]+1,0,[["exit",m,r]])}return a!==void 0&&(i.end=Object.assign({},Xr(r.events,a)),e.add(a,0,[["exit",i,r]]),i=void 0),i}function Vo(e,r,n,s,a){const i=[],o=Xr(r.events,n);a&&(a.end=Object.assign({},o),i.push(["exit",a,r])),s.end=Object.assign({},o),i.push(["exit",s,r]),e.add(n+1,0,i)}function Xr(e,r){const n=e[r],s=n[0]==="enter"?"start":"end";return n[1][s]}const rk={name:"tasklistCheck",tokenize:sk};function nk(){return{text:{91:rk}}}function sk(e,r,n){const s=this;return a;function a(c){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return dt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return Re(c)?r(c):Qe(c)?e.check({tokenize:ak},r,n)(c):n(c)}}function ak(e,r,n){return nt(e,s,"whitespace");function s(a){return a===null?n(a):r(a)}}function ik(e){return Ac([Ty(),By(),Jy(e),Zy(),nk()])}const ok={};function lk(e){const r=this,n=e||ok,s=r.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(ik(n)),i.push(Ey()),o.push(Iy(n))}var ia={exports:{}},oa,Go;function ck(){if(Go)return oa;Go=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return oa=e,oa}var la,Ko;function dk(){if(Ko)return la;Ko=1;var e=ck();function r(){}function n(){}return n.resetWarningCache=r,la=function(){function s(o,l,c,d,u,m){if(m!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}s.isRequired=s;function a(){return s}var i={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:a,element:s,elementType:s,instanceOf:a,node:s,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:r};return i.PropTypes=i,i},la}var Jo;function uk(){return Jo||(Jo=1,ia.exports=dk()()),ia.exports}var mk=uk();const lt=zn(mk);function Vr(e,r,n,s){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(m){o(m)}}function c(u){try{d(s.throw(u))}catch(m){o(m)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(e,r||[])).next())})}const pk=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function on(e,r,n){const s=hk(e),{webkitRelativePath:a}=e,i=typeof r=="string"?r:typeof a=="string"&&a.length>0?a:`./${e.name}`;return typeof s.path!="string"&&Yo(s,"path",i),Yo(s,"relativePath",i),s}function hk(e){const{name:r}=e;if(r&&r.lastIndexOf(".")!==-1&&!e.type){const s=r.split(".").pop().toLowerCase(),a=pk.get(s);a&&Object.defineProperty(e,"type",{value:a,writable:!1,configurable:!1,enumerable:!0})}return e}function Yo(e,r,n){Object.defineProperty(e,r,{value:n,writable:!1,configurable:!1,enumerable:!0})}const fk=[".DS_Store","Thumbs.db"];function gk(e){return Vr(this,void 0,void 0,function*(){return ks(e)&&xk(e.dataTransfer)?vk(e.dataTransfer,e.type):bk(e)?yk(e):Array.isArray(e)&&e.every(r=>"getFile"in r&&typeof r.getFile=="function")?kk(e):[]})}function xk(e){return ks(e)}function bk(e){return ks(e)&&ks(e.target)}function ks(e){return typeof e=="object"&&e!==null}function yk(e){return _a(e.target.files).map(r=>on(r))}function kk(e){return Vr(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>on(n))})}function vk(e,r){return Vr(this,void 0,void 0,function*(){if(e.items){const n=_a(e.items).filter(a=>a.kind==="file");if(r!=="drop")return n;const s=yield Promise.all(n.map(wk));return Qo(yd(s))}return Qo(_a(e.files).map(n=>on(n)))})}function Qo(e){return e.filter(r=>fk.indexOf(r.name)===-1)}function _a(e){if(e===null)return[];const r=[];for(let n=0;n<e.length;n++){const s=e[n];r.push(s)}return r}function wk(e){if(typeof e.webkitGetAsEntry!="function")return Xo(e);const r=e.webkitGetAsEntry();return r&&r.isDirectory?kd(r):Xo(e,r)}function yd(e){return e.reduce((r,n)=>[...r,...Array.isArray(n)?yd(n):[n]],[])}function Xo(e,r){return Vr(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const i=yield e.getAsFileSystemHandle();if(i===null)throw new Error(`${e} is not a File`);if(i!==void 0){const o=yield i.getFile();return o.handle=i,on(o)}}const s=e.getAsFile();if(!s)throw new Error(`${e} is not a File`);return on(s,(n=r?.fullPath)!==null&&n!==void 0?n:void 0)})}function jk(e){return Vr(this,void 0,void 0,function*(){return e.isDirectory?kd(e):Nk(e)})}function kd(e){const r=e.createReader();return new Promise((n,s)=>{const a=[];function i(){r.readEntries(o=>Vr(this,void 0,void 0,function*(){if(o.length){const l=Promise.all(o.map(jk));a.push(l),i()}else try{const l=yield Promise.all(a);n(l)}catch(l){s(l)}}),o=>{s(o)})}i()})}function Nk(e){return Vr(this,void 0,void 0,function*(){return new Promise((r,n)=>{e.file(s=>{const a=on(s,e.fullPath);r(a)},s=>{n(s)})})})}var is={},Zo;function Ck(){return Zo||(Zo=1,is.__esModule=!0,is.default=function(e,r){if(e&&r){var n=Array.isArray(r)?r:r.split(",");if(n.length===0)return!0;var s=e.name||"",a=(e.type||"").toLowerCase(),i=a.replace(/\/.*$/,"");return n.some(function(o){var l=o.trim().toLowerCase();return l.charAt(0)==="."?s.toLowerCase().endsWith(l):l.endsWith("/*")?i===l.replace(/\/.*$/,""):a===l})}return!0}),is}var Sk=Ck();const ca=zn(Sk);function el(e){return Ak(e)||Ik(e)||wd(e)||Ek()}function Ek(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
415
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ik(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ak(e){if(Array.isArray(e))return za(e)}function tl(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function rl(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?tl(Object(n),!0).forEach(function(s){vd(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tl(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function vd(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Rn(e,r){return Dk(e)||Tk(e,r)||wd(e,r)||Mk()}function Mk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
416
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wd(e,r){if(e){if(typeof e=="string")return za(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return za(e,r)}}function za(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,s=new Array(r);n<r;n++)s[n]=e[n];return s}function Tk(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s=[],a=!0,i=!1,o,l;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(s.push(o.value),!(r&&s.length===r));a=!0);}catch(c){i=!0,l=c}finally{try{!a&&n.return!=null&&n.return()}finally{if(i)throw l}}return s}}function Dk(e){if(Array.isArray(e))return e}var Pk=typeof ca=="function"?ca:ca.default,Lk="file-invalid-type",Rk="file-too-large",_k="file-too-small",zk="too-many-files",Fk=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=r.split(","),s=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:Lk,message:"File type must be ".concat(s)}},nl=function(r){return{code:Rk,message:"File is larger than ".concat(r," ").concat(r===1?"byte":"bytes")}},sl=function(r){return{code:_k,message:"File is smaller than ".concat(r," ").concat(r===1?"byte":"bytes")}},$k={code:zk,message:"Too many files"};function jd(e,r){var n=e.type==="application/x-moz-file"||Pk(e,r);return[n,n?null:Fk(r)]}function Nd(e,r,n){if(_r(e.size))if(_r(r)&&_r(n)){if(e.size>n)return[!1,nl(n)];if(e.size<r)return[!1,sl(r)]}else{if(_r(r)&&e.size<r)return[!1,sl(r)];if(_r(n)&&e.size>n)return[!1,nl(n)]}return[!0,null]}function _r(e){return e!=null}function Ok(e){var r=e.files,n=e.accept,s=e.minSize,a=e.maxSize,i=e.multiple,o=e.maxFiles,l=e.validator;return!i&&r.length>1||i&&o>=1&&r.length>o?!1:r.every(function(c){var d=jd(c,n),u=Rn(d,1),m=u[0],h=Nd(c,s,a),p=Rn(h,1),g=p[0],x=l?l(c):null;return m&&g&&!x})}function vs(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function os(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(r){return r==="Files"||r==="application/x-moz-file"}):!!e.target&&!!e.target.files}function al(e){e.preventDefault()}function Bk(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function Wk(e){return e.indexOf("Edge/")!==-1}function Uk(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Bk(e)||Wk(e)}function ar(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return function(s){for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;o<a;o++)i[o-1]=arguments[o];return r.some(function(l){return!vs(s)&&l&&l.apply(void 0,[s].concat(i)),vs(s)})}}function Hk(){return"showOpenFilePicker"in window}function qk(e){if(_r(e)){var r=Object.entries(e).filter(function(n){var s=Rn(n,2),a=s[0],i=s[1],o=!0;return Cd(a)||(console.warn('Skipped "'.concat(a,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),o=!1),(!Array.isArray(i)||!i.every(Sd))&&(console.warn('Skipped "'.concat(a,'" because an invalid file extension was provided.')),o=!1),o}).reduce(function(n,s){var a=Rn(s,2),i=a[0],o=a[1];return rl(rl({},n),{},vd({},i,o))},{});return[{description:"Files",accept:r}]}return e}function Vk(e){if(_r(e))return Object.entries(e).reduce(function(r,n){var s=Rn(n,2),a=s[0],i=s[1];return[].concat(el(r),[a],el(i))},[]).filter(function(r){return Cd(r)||Sd(r)}).join(",")}function Gk(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function Kk(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function Cd(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function Sd(e){return/^.*\.[\w]+$/.test(e)}var Jk=["children"],Yk=["open"],Qk=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Xk=["refKey","onChange","onClick"];function Zk(e){return rv(e)||tv(e)||Ed(e)||ev()}function ev(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
417
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tv(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function rv(e){if(Array.isArray(e))return Fa(e)}function da(e,r){return av(e)||sv(e,r)||Ed(e,r)||nv()}function nv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
418
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ed(e,r){if(e){if(typeof e=="string")return Fa(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fa(e,r)}}function Fa(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,s=new Array(r);n<r;n++)s[n]=e[n];return s}function sv(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s=[],a=!0,i=!1,o,l;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(s.push(o.value),!(r&&s.length===r));a=!0);}catch(c){i=!0,l=c}finally{try{!a&&n.return!=null&&n.return()}finally{if(i)throw l}}return s}}function av(e){if(Array.isArray(e))return e}function il(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function bt(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?il(Object(n),!0).forEach(function(s){$a(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):il(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function $a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function ws(e,r){if(e==null)return{};var n=iv(e,r),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function iv(e,r){if(e==null)return{};var n={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(r.indexOf(a)>=0)&&(n[a]=e[a]);return n}var ji=f.forwardRef(function(e,r){var n=e.children,s=ws(e,Jk),a=Ad(s),i=a.open,o=ws(a,Yk);return f.useImperativeHandle(r,function(){return{open:i}},[i]),fr.createElement(f.Fragment,null,n(bt(bt({},o),{},{open:i})))});ji.displayName="Dropzone";var Id={disabled:!1,getFilesFromEvent:gk,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};ji.defaultProps=Id;ji.propTypes={children:lt.func,accept:lt.objectOf(lt.arrayOf(lt.string)),multiple:lt.bool,preventDropOnDocument:lt.bool,noClick:lt.bool,noKeyboard:lt.bool,noDrag:lt.bool,noDragEventsBubbling:lt.bool,minSize:lt.number,maxSize:lt.number,maxFiles:lt.number,disabled:lt.bool,getFilesFromEvent:lt.func,onFileDialogCancel:lt.func,onFileDialogOpen:lt.func,useFsAccessApi:lt.bool,autoFocus:lt.bool,onDragEnter:lt.func,onDragLeave:lt.func,onDragOver:lt.func,onDrop:lt.func,onDropAccepted:lt.func,onDropRejected:lt.func,onError:lt.func,validator:lt.func};var Oa={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Ad(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=bt(bt({},Id),e),n=r.accept,s=r.disabled,a=r.getFilesFromEvent,i=r.maxSize,o=r.minSize,l=r.multiple,c=r.maxFiles,d=r.onDragEnter,u=r.onDragLeave,m=r.onDragOver,h=r.onDrop,p=r.onDropAccepted,g=r.onDropRejected,x=r.onFileDialogCancel,b=r.onFileDialogOpen,k=r.useFsAccessApi,N=r.autoFocus,y=r.preventDropOnDocument,P=r.noClick,W=r.noKeyboard,M=r.noDrag,B=r.noDragEventsBubbling,L=r.onError,U=r.validator,j=f.useMemo(function(){return Vk(n)},[n]),R=f.useMemo(function(){return qk(n)},[n]),D=f.useMemo(function(){return typeof b=="function"?b:ol},[b]),_=f.useMemo(function(){return typeof x=="function"?x:ol},[x]),C=f.useRef(null),V=f.useRef(null),z=f.useReducer(ov,Oa),Z=da(z,2),F=Z[0],ce=Z[1],v=F.isFocused,ue=F.isFileDialogActive,fe=f.useRef(typeof window<"u"&&window.isSecureContext&&k&&Hk()),w=function(){!fe.current&&ue&&setTimeout(function(){if(V.current){var de=V.current.files;de.length||(ce({type:"closeDialog"}),_())}},300)};f.useEffect(function(){return window.addEventListener("focus",w,!1),function(){window.removeEventListener("focus",w,!1)}},[V,ue,_,fe]);var J=f.useRef([]),he=function(de){C.current&&C.current.contains(de.target)||(de.preventDefault(),J.current=[])};f.useEffect(function(){return y&&(document.addEventListener("dragover",al,!1),document.addEventListener("drop",he,!1)),function(){y&&(document.removeEventListener("dragover",al),document.removeEventListener("drop",he))}},[C,y]),f.useEffect(function(){return!s&&N&&C.current&&C.current.focus(),function(){}},[C,N,s]);var ye=f.useCallback(function(Q){L?L(Q):console.error(Q)},[L]),re=f.useCallback(function(Q){Q.preventDefault(),Q.persist(),qe(Q),J.current=[].concat(Zk(J.current),[Q.target]),os(Q)&&Promise.resolve(a(Q)).then(function(de){if(!(vs(Q)&&!B)){var T=de.length,O=T>0&&Ok({files:de,accept:j,minSize:o,maxSize:i,multiple:l,maxFiles:c,validator:U}),ne=T>0&&!O;ce({isDragAccept:O,isDragReject:ne,isDragActive:!0,type:"setDraggedFiles"}),d&&d(Q)}}).catch(function(de){return ye(de)})},[a,d,ye,B,j,o,i,l,c,U]),Pe=f.useCallback(function(Q){Q.preventDefault(),Q.persist(),qe(Q);var de=os(Q);if(de&&Q.dataTransfer)try{Q.dataTransfer.dropEffect="copy"}catch{}return de&&m&&m(Q),!1},[m,B]),X=f.useCallback(function(Q){Q.preventDefault(),Q.persist(),qe(Q);var de=J.current.filter(function(O){return C.current&&C.current.contains(O)}),T=de.indexOf(Q.target);T!==-1&&de.splice(T,1),J.current=de,!(de.length>0)&&(ce({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),os(Q)&&u&&u(Q))},[C,u,B]),le=f.useCallback(function(Q,de){var T=[],O=[];Q.forEach(function(ne){var Ce=jd(ne,j),De=da(Ce,2),ee=De[0],me=De[1],oe=Nd(ne,o,i),we=da(oe,2),Ee=we[0],Be=we[1],ze=U?U(ne):null;if(ee&&Ee&&!ze)T.push(ne);else{var Xe=[me,Be];ze&&(Xe=Xe.concat(ze)),O.push({file:ne,errors:Xe.filter(function(gt){return gt})})}}),(!l&&T.length>1||l&&c>=1&&T.length>c)&&(T.forEach(function(ne){O.push({file:ne,errors:[$k]})}),T.splice(0)),ce({acceptedFiles:T,fileRejections:O,isDragReject:O.length>0,type:"setFiles"}),h&&h(T,O,de),O.length>0&&g&&g(O,de),T.length>0&&p&&p(T,de)},[ce,l,j,o,i,c,h,p,g,U]),ke=f.useCallback(function(Q){Q.preventDefault(),Q.persist(),qe(Q),J.current=[],os(Q)&&Promise.resolve(a(Q)).then(function(de){vs(Q)&&!B||le(de,Q)}).catch(function(de){return ye(de)}),ce({type:"reset"})},[a,le,ye,B]),ge=f.useCallback(function(){if(fe.current){ce({type:"openDialog"}),D();var Q={multiple:l,types:R};window.showOpenFilePicker(Q).then(function(de){return a(de)}).then(function(de){le(de,null),ce({type:"closeDialog"})}).catch(function(de){Gk(de)?(_(de),ce({type:"closeDialog"})):Kk(de)?(fe.current=!1,V.current?(V.current.value=null,V.current.click()):ye(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):ye(de)});return}V.current&&(ce({type:"openDialog"}),D(),V.current.value=null,V.current.click())},[ce,D,_,k,le,ye,R,l]),Ie=f.useCallback(function(Q){!C.current||!C.current.isEqualNode(Q.target)||(Q.key===" "||Q.key==="Enter"||Q.keyCode===32||Q.keyCode===13)&&(Q.preventDefault(),ge())},[C,ge]),Ke=f.useCallback(function(){ce({type:"focus"})},[]),et=f.useCallback(function(){ce({type:"blur"})},[]),st=f.useCallback(function(){P||(Uk()?setTimeout(ge,0):ge())},[P,ge]),ft=function(de){return s?null:de},tt=function(de){return W?null:ft(de)},xe=function(de){return M?null:ft(de)},qe=function(de){B&&de.stopPropagation()},it=f.useMemo(function(){return function(){var Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},de=Q.refKey,T=de===void 0?"ref":de,O=Q.role,ne=Q.onKeyDown,Ce=Q.onFocus,De=Q.onBlur,ee=Q.onClick,me=Q.onDragEnter,oe=Q.onDragOver,we=Q.onDragLeave,Ee=Q.onDrop,Be=ws(Q,Qk);return bt(bt($a({onKeyDown:tt(ar(ne,Ie)),onFocus:tt(ar(Ce,Ke)),onBlur:tt(ar(De,et)),onClick:ft(ar(ee,st)),onDragEnter:xe(ar(me,re)),onDragOver:xe(ar(oe,Pe)),onDragLeave:xe(ar(we,X)),onDrop:xe(ar(Ee,ke)),role:typeof O=="string"&&O!==""?O:"presentation"},T,C),!s&&!W?{tabIndex:0}:{}),Be)}},[C,Ie,Ke,et,st,re,Pe,X,ke,W,M,s]),ve=f.useCallback(function(Q){Q.stopPropagation()},[]),Ct=f.useMemo(function(){return function(){var Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},de=Q.refKey,T=de===void 0?"ref":de,O=Q.onChange,ne=Q.onClick,Ce=ws(Q,Xk),De=$a({accept:j,multiple:l,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:ft(ar(O,ke)),onClick:ft(ar(ne,ve)),tabIndex:-1},T,V);return bt(bt({},De),Ce)}},[V,n,l,ke,s]);return bt(bt({},F),{},{isFocused:v&&!s,getRootProps:it,getInputProps:Ct,rootRef:C,inputRef:V,open:ft(ge)})}function ov(e,r){switch(r.type){case"focus":return bt(bt({},e),{},{isFocused:!0});case"blur":return bt(bt({},e),{},{isFocused:!1});case"openDialog":return bt(bt({},Oa),{},{isFileDialogActive:!0});case"closeDialog":return bt(bt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return bt(bt({},e),{},{isDragActive:r.isDragActive,isDragAccept:r.isDragAccept,isDragReject:r.isDragReject});case"setFiles":return bt(bt({},e),{},{acceptedFiles:r.acceptedFiles,fileRejections:r.fileRejections,isDragReject:r.isDragReject});case"reset":return bt({},Oa);default:return e}}function ol(){}const ua=({todos:e,isResult:r=!1})=>{if(!e||!Array.isArray(e))return null;const n=i=>{switch(i){case"completed":return t.jsx(Nm,{className:"w-4 h-4 text-green-500 dark:text-green-400"});case"in_progress":return t.jsx(Tn,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"});case"pending":default:return t.jsx(Zr,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"})}},s=i=>{switch(i){case"completed":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-200 border-green-200 dark:border-green-800";case"in_progress":return"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-200 border-blue-200 dark:border-blue-800";case"pending":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}},a=i=>{switch(i){case"high":return"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 border-red-200 dark:border-red-800";case"medium":return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800";case"low":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}};return t.jsxs("div",{className:"space-y-3",children:[r&&t.jsxs("div",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Todo List (",e.length," ",e.length===1?"item":"items",")"]}),e.map((i,o)=>t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm hover:shadow-md dark:shadow-gray-900/50 transition-shadow",children:[t.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n(i.status)}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[t.jsx("p",{className:`text-sm font-medium ${i.status==="completed"?"line-through text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100"}`,children:i.content}),t.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[t.jsx(Or,{variant:"outline",className:`text-xs px-2 py-0.5 ${a(i.priority)}`,children:i.priority}),t.jsx(Or,{variant:"outline",className:`text-xs px-2 py-0.5 ${s(i.status)}`,children:i.status.replace("_"," ")})]})]})})]},i.id||`todo-${o}`))]})};var lv=Ju(),cv=Yu(),dv=Qu(),uv=Xu();const mv=`
419
+ .xterm .xterm-screen {
420
+ outline: none !important;
421
+ }
422
+ .xterm:focus .xterm-screen {
423
+ outline: none !important;
424
+ }
425
+ .xterm-screen:focus {
426
+ outline: none !important;
427
+ }
428
+ `;if(typeof document<"u"){const e=document.createElement("style");e.type="text/css",e.innerText=mv,document.head.appendChild(e)}const Rr=new Map;function Ni({selectedProject:e,selectedSession:r,isActive:n,initialCommand:s,isPlainShell:a=!1,onProcessComplete:i}){const o=f.useRef(null),l=f.useRef(null),c=f.useRef(null),d=f.useRef(null),[u,m]=f.useState(!1),[h,p]=f.useState(!1),[g,x]=f.useState(!1),[b,k]=f.useState(null),[N,y]=f.useState(!1),P=()=>{!h||u||N||(y(!0),B())},W=()=>{d.current&&(d.current.close(),d.current=null),l.current&&(l.current.clear(),l.current.write("\x1B[2J\x1B[H")),m(!1),y(!1)},M=()=>{x(!0),Array.from(Rr.keys()).filter(U=>U.includes(e.name)).forEach(U=>Rr.delete(U)),d.current&&(d.current.close(),d.current=null),l.current&&(l.current.dispose(),l.current=null,c.current=null),m(!1),p(!1),setTimeout(()=>{x(!1)},200)};f.useEffect(()=>{const L=r?.id||null;b!==null&&b!==L&&h&&(W(),Array.from(Rr.keys()).forEach(j=>{j.includes(e.name)&&Rr.delete(j)})),k(L)},[r?.id,h]),f.useEffect(()=>{if(!o.current||!e||g)return;const L=r?.id||`project-${e.name}`,U=Rr.get(L);if(U&&!l.current)try{l.current=U.terminal,c.current=U.fitAddon,d.current=U.ws,m(U.isConnected),l.current.element&&l.current.element.parentNode&&l.current.element.parentNode.removeChild(l.current.element),l.current.open(o.current),setTimeout(()=>{c.current&&(c.current.fit(),d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows})))},100),p(!0);return}catch{Rr.delete(L),l.current=null,c.current=null,d.current=null}if(l.current)return;l.current=new lv.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!1,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff",extendedAnsi:["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"]}}),c.current=new cv.FitAddon;const j=new dv.ClipboardAddon,R=new uv.WebglAddon;l.current.loadAddon(c.current),l.current.loadAddon(j);try{l.current.loadAddon(R)}catch{}l.current.open(o.current),setTimeout(()=>{c.current&&c.current.fit()},50),l.current.attachCustomKeyEventHandler(_=>(_.ctrlKey||_.metaKey)&&_.key==="c"&&l.current.hasSelection()?(document.execCommand("copy"),!1):(_.ctrlKey||_.metaKey)&&_.key==="v"?(navigator.clipboard.readText().then(C=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:C}))}).catch(C=>{}),!1):!0),setTimeout(()=>{c.current&&(c.current.fit(),l.current&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows})))},100),p(!0),l.current.onData(_=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:_}))});const D=new ResizeObserver(()=>{c.current&&l.current&&setTimeout(()=>{c.current.fit(),d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows}))},50)});return o.current&&D.observe(o.current),()=>{if(D.disconnect(),l.current&&e){const _=r?.id||`project-${e.name}`;try{Rr.set(_,{terminal:l.current,fitAddon:c.current,ws:d.current,isConnected:u})}catch{}}}},[o.current,e,r,g]),f.useEffect(()=>{!n||!h||setTimeout(()=>{c.current&&(c.current.fit(),l.current&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows})))},100)},[n,h]);const B=async()=>{if(!(N||u))try{const L=localStorage.getItem("auth-token");if(!L){console.error("No authentication token found for Shell WebSocket connection");return}let U;try{if(U=(await(await fetch("/api/config",{headers:{Authorization:`Bearer ${L}`}})).json()).wsUrl,U.includes("localhost")&&!window.location.hostname.includes("localhost")){const _=window.location.protocol==="https:"?"wss:":"ws:",C=window.location.port==="3001"?"3002":window.location.port;U=`${_}//${window.location.hostname}:${C}`}}catch{const D=window.location.protocol==="https:"?"wss:":"ws:",_=window.location.port==="3001"?"3002":window.location.port;U=`${D}//${window.location.hostname}:${_}`}const j=`${U}/shell?token=${encodeURIComponent(L)}`;d.current=new WebSocket(j),d.current.onopen=()=>{m(!0),y(!1),setTimeout(()=>{c.current&&l.current&&(c.current.fit(),setTimeout(()=>{const R={type:"init",projectPath:e.fullPath||e.path,sessionId:a?null:r?.id,hasSession:a?!1:!!r,provider:a?"plain-shell":r?.__provider||"claude",cols:l.current.cols,rows:l.current.rows,initialCommand:s,isPlainShell:a};console.log("Shell init payload:",R),d.current.send(JSON.stringify(R)),setTimeout(()=>{l.current&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:l.current.cols,rows:l.current.rows}))},100)},50))},200)},d.current.onmessage=R=>{try{const D=JSON.parse(R.data);if(D.type==="output"){const _=/(https?:\/\/[^\s\x1b\x07]+)/g;let C=D.data;const V=[];let z;for(;(z=_.exec(C.replace(/\x1b\[[0-9;]*m/g,"")))!==null;)V.push(z[1]);if(a&&i){const Z=C.replace(/\x1b\[[0-9;]*m/g,"");if(Z.includes("Process exited with code 0"))i(0);else if(Z.match(/Process exited with code (\d+)/)){const F=parseInt(Z.match(/Process exited with code (\d+)/)[1]);F!==0&&i(F)}}l.current.write(C)}else D.type==="url_open"&&window.open(D.url,"_blank")}catch{}},d.current.onclose=R=>{m(!1),y(!1),l.current&&(l.current.clear(),l.current.write("\x1B[2J\x1B[H"))},d.current.onerror=R=>{m(!1),y(!1)}}catch{m(!1),y(!1)}};return e?t.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[t.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("div",{className:`w-2 h-2 rounded-full ${u?"bg-green-500":"bg-red-500"}`}),r&&(()=>{const L=r.__provider==="cursor"?r.name||"Untitled Session":r.summary||"New Session";return t.jsxs("span",{className:"text-xs text-blue-300",children:["(",L.slice(0,30),"...)"]})})(),!r&&t.jsx("span",{className:"text-xs text-gray-400",children:"(New Session)"}),!h&&t.jsx("span",{className:"text-xs text-yellow-400",children:"(Initializing...)"}),g&&t.jsx("span",{className:"text-xs text-blue-400",children:"(Restarting...)"})]}),t.jsxs("div",{className:"flex items-center space-x-3",children:[u&&t.jsxs("button",{onClick:W,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:"Disconnect from shell",children:[t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),t.jsx("span",{children:"Disconnect"})]}),t.jsxs("button",{onClick:M,disabled:g||u,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:"Restart Shell (disconnect first)",children:[t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t.jsx("span",{children:"Restart"})]})]})]})}),t.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[t.jsx("div",{ref:o,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!h&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:t.jsx("div",{className:"text-white",children:"Loading terminal..."})}),h&&!u&&!N&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:t.jsxs("div",{className:"text-center max-w-sm w-full",children:[t.jsxs("button",{onClick:P,className:"px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",title:"Connect to shell",children:[t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),t.jsx("span",{children:"Continue in Shell"})]}),t.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:a?`Run ${s||"command"} in ${e.displayName}`:r?`Resume session: ${(r.__provider==="cursor"?r.name||"Untitled Session":r.summary||"New Session").slice(0,50)}...`:"Start a new Claude session"})]})}),N&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:t.jsxs("div",{className:"text-center max-w-sm w-full",children:[t.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[t.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),t.jsx("span",{className:"text-base font-medium",children:"Connecting to shell..."})]}),t.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:a?`Running ${s||"command"} in ${e.displayName}`:`Starting Claude CLI in ${e.displayName}`})]})})]})]}):t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[t.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Select a Project"}),t.jsx("p",{children:"Choose a project to open an interactive shell in that directory"})]})})}const Md=({task:e,onClose:r,onEdit:n,onStatusChange:s,onTaskClick:a,isOpen:i=!0,className:o=""})=>{const[l,c]=f.useState(!1),[d,u]=f.useState(e||{}),[m,h]=f.useState(!1),[p,g]=f.useState(!1),[x,b]=f.useState(!1),{currentProject:k,refreshTasks:N}=On();if(!i||!e)return null;const y=async()=>{if(k){h(!0);try{const j={};if(d.title!==e.title&&(j.title=d.title),d.description!==e.description&&(j.description=d.description),d.details!==e.details&&(j.details=d.details),Object.keys(j).length>0){const R=await Ue.taskmaster.updateTask(k.name,e.id,j);if(R.ok)N?.(),n?.(d),c(!1);else{const D=await R.json();console.error("Failed to update task:",D),alert(`Failed to update task: ${D.message}`)}}else c(!1)}catch(j){console.error("Error updating task:",j),alert("Error updating task. Please try again.")}finally{h(!1)}}},P=()=>{navigator.clipboard.writeText(e.id.toString())},W=j=>{switch(j){case"done":return{icon:Fn,color:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-950"};case"in-progress":return{icon:Tn,color:"text-blue-600 dark:text-blue-400",bg:"bg-blue-50 dark:bg-blue-950"};case"review":return{icon:ti,color:"text-amber-600 dark:text-amber-400",bg:"bg-amber-50 dark:bg-amber-950"};case"deferred":return{icon:Yl,color:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800"};case"cancelled":return{icon:ct,color:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-950"};default:return{icon:Zr,color:"text-slate-500 dark:text-slate-400",bg:"bg-slate-50 dark:bg-slate-800"}}},M=W(e.status),B=M.icon,L=j=>{switch(j){case"high":return"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-950";case"medium":return"text-yellow-600 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-950";case"low":return"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-950";default:return"text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-800"}},U=[{value:"pending",label:"Pending"},{value:"in-progress",label:"In Progress"},{value:"review",label:"Review"},{value:"done",label:"Done"},{value:"deferred",label:"Deferred"},{value:"cancelled",label:"Cancelled"}];return t.jsx("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[100] md:p-4 bg-black/50",children:t.jsxs("div",{className:Me("bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 md:rounded-lg shadow-xl","w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",o),children:[t.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[t.jsx(B,{className:Me("w-6 h-6",M.color)}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsxs("button",{onClick:P,className:"flex items-center gap-1 px-2 py-1 text-xs bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 rounded hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:"Click to copy task ID",children:[t.jsxs("span",{children:["Task ",e.id]}),t.jsx(Vl,{className:"w-3 h-3"})]}),e.parentId&&t.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Subtask of Task ",e.parentId]})]}),l?t.jsx("input",{type:"text",value:d.title||"",onChange:j=>u({...d,title:j.target.value}),className:"w-full text-lg font-semibold bg-transparent border-b-2 border-blue-500 focus:outline-none text-gray-900 dark:text-white",placeholder:"Task title"}):t.jsx("h1",{className:"text-lg md:text-xl font-semibold text-gray-900 dark:text-white line-clamp-2",children:e.title})]})]}),t.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[l?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:y,disabled:m,className:"p-2 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:m?"Saving...":"Save changes",children:t.jsx(fs,{className:Me("w-5 h-5",m&&"animate-spin")})}),t.jsx("button",{onClick:()=>{c(!1),u(e)},disabled:m,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Cancel editing",children:t.jsx(ct,{className:"w-5 h-5"})})]}):t.jsx("button",{onClick:()=>c(!0),className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors",title:"Edit task",children:t.jsx(zp,{className:"w-5 h-5"})}),t.jsx("button",{onClick:r,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors",title:"Close",children:t.jsx(ct,{className:"w-5 h-5"})})]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto p-4 md:p-6 space-y-6 min-h-0",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Status"}),t.jsx("div",{className:Me("w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600",M.bg,M.color),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(B,{className:"w-4 h-4"}),t.jsx("span",{className:"font-medium capitalize",children:U.find(j=>j.value===e.status)?.label||e.status})]})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Priority"}),t.jsxs("div",{className:Me("px-3 py-2 rounded-md text-sm font-medium capitalize",L(e.priority)),children:[t.jsx(Gl,{className:"w-4 h-4 inline mr-2"}),e.priority||"Not set"]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Dependencies"}),e.dependencies&&e.dependencies.length>0?t.jsx("div",{className:"flex flex-wrap gap-1",children:e.dependencies.map(j=>t.jsxs("button",{onClick:()=>a&&a({id:j}),className:"px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded text-sm hover:bg-blue-200 dark:hover:bg-blue-800 transition-colors cursor-pointer disabled:cursor-default disabled:opacity-50",disabled:!a,title:a?`Click to view Task ${j}`:`Task ${j}`,children:[t.jsx(ei,{className:"w-3 h-3 inline mr-1"}),j]},j))}):t.jsx("span",{className:"text-gray-500 dark:text-gray-400 text-sm",children:"No dependencies"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Description"}),l?t.jsx("textarea",{value:d.description||"",onChange:j=>u({...d,description:j.target.value}),rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",placeholder:"Task description"}):t.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:e.description||"No description provided"})]}),e.details&&t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg",children:[t.jsxs("button",{onClick:()=>g(!p),className:"w-full flex items-center justify-between p-4 text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Implementation Details"}),p?t.jsx(Zt,{className:"w-4 h-4 text-gray-500"}):t.jsx(Er,{className:"w-4 h-4 text-gray-500"})]}),p&&t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:l?t.jsx("textarea",{value:d.details||"",onChange:j=>u({...d,details:j.target.value}),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",placeholder:"Implementation details"}):t.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-4",children:t.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:e.details})})})]}),e.testStrategy&&t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg",children:[t.jsxs("button",{onClick:()=>b(!x),className:"w-full flex items-center justify-between p-4 text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Test Strategy"}),x?t.jsx(Zt,{className:"w-4 h-4 text-gray-500"}):t.jsx(Er,{className:"w-4 h-4 text-gray-500"})]}),x&&t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:t.jsx("div",{className:"bg-blue-50 dark:bg-blue-950 rounded-md p-4",children:t.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:e.testStrategy})})})]}),e.subtasks&&e.subtasks.length>0&&t.jsxs("div",{className:"space-y-3",children:[t.jsxs("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Subtasks (",e.subtasks.length,")"]}),t.jsx("div",{className:"space-y-2",children:e.subtasks.map(j=>{const R=W(j.status),D=R.icon;return t.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[t.jsx(D,{className:Me("w-4 h-4",R.color)}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white truncate",children:j.title}),j.description&&t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 truncate",children:j.description})]}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:j.id})]},j.id)})})]})]}),t.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:[t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Task ID: ",e.id]}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("button",{onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Close"})})]})]})})},ll=({onShowAllTasks:e,onStartTask:r,className:n=""})=>{const{nextTask:s,tasks:a,currentProject:i,isLoadingTasks:o,projectTaskMaster:l,refreshTasks:c,refreshProjects:d}=On(),[u,m]=f.useState(!1),[h,p]=f.useState(!1),[g,x]=f.useState(!1),[b,k]=f.useState(!1),[N,y]=f.useState(!1),[P,W]=f.useState(!1),[M,B]=f.useState(!1),L=()=>{x(!0),p(!1)},U=()=>{k(!0),p(!1)};if(!i||o)return null;let j;if((!a||a.length===0)&&!l?.hasTaskmaster)j=t.jsxs("div",{className:Me("bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg p-3 mb-4",n),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(hs,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"TaskMaster AI is not configured"}),t.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-0.5"})]})]}),t.jsx("div",{className:"flex items-center gap-1",children:t.jsxs("button",{onClick:()=>p(!h),className:"text-xs px-2 py-1 bg-blue-600 hover:bg-blue-700 text-white rounded transition-colors flex items-center gap-1",children:[t.jsx(Wr,{className:"w-3 h-3"}),"Initialize TaskMaster AI"]})})]}),h&&t.jsxs("div",{className:"mt-3 pt-3 border-t border-blue-200 dark:border-blue-800",children:[!l?.hasTaskmaster&&t.jsxs("div",{className:"mb-3 p-3 bg-blue-50 dark:bg-blue-900/50 rounded-lg",children:[t.jsx("h4",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-2",children:"🎯 What is TaskMaster?"}),t.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[t.jsxs("p",{children:["• ",t.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"PRD Templates:"})," Generate tasks from Product Requirements Documents"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"Progress Visualization:"})," Kanban boards and detailed task analytics"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"CLI Integration:"})," Use taskmaster commands for advanced workflows"]})]})]}),t.jsx("div",{className:"flex flex-col gap-2",children:l?.hasTaskmaster?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-2 p-2 bg-green-50 dark:bg-green-900/30 rounded text-xs text-green-800 dark:text-green-200",children:[t.jsx("strong",{children:"Add more tasks:"})," Create additional tasks manually or generate them from a PRD template"]}),t.jsxs("button",{className:"text-xs px-3 py-2 bg-green-100 dark:bg-green-900 hover:bg-green-200 dark:hover:bg-green-800 text-green-800 dark:text-green-200 rounded transition-colors text-left flex items-center gap-2 disabled:opacity-50",onClick:L,disabled:M,children:[t.jsx(Dt,{className:"w-3 h-3"}),"Create a new task manually"]}),t.jsxs("button",{className:"text-xs px-3 py-2 bg-purple-100 dark:bg-purple-900 hover:bg-purple-200 dark:hover:bg-purple-800 text-purple-800 dark:text-purple-200 rounded transition-colors text-left flex items-center gap-2 disabled:opacity-50",onClick:U,disabled:M,children:[t.jsx($t,{className:"w-3 h-3"}),M?"Parsing...":"Generate tasks from PRD template"]})]}):t.jsxs("button",{className:"text-xs px-3 py-2 bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 text-slate-800 dark:text-slate-200 rounded transition-colors text-left flex items-center gap-2",onClick:()=>y(!0),children:[t.jsx(sn,{className:"w-3 h-3"}),"Initialize TaskMaster"]})})]})]});else if(s)j=t.jsx("div",{className:Me("bg-slate-50 dark:bg-slate-900/30 border border-slate-200 dark:border-slate-700 rounded-lg p-3 mb-4",n),children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("div",{className:"w-5 h-5 bg-blue-100 dark:bg-blue-900/50 rounded-full flex items-center justify-center flex-shrink-0",children:t.jsx(Up,{className:"w-3 h-3 text-blue-600 dark:text-blue-400"})}),t.jsxs("span",{className:"text-xs text-slate-600 dark:text-slate-400 font-medium",children:["Task ",s.id]}),s.priority==="high"&&t.jsx("div",{className:"w-4 h-4 rounded bg-red-100 dark:bg-red-900/50 flex items-center justify-center",title:"High Priority",children:t.jsx(va,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})}),s.priority==="medium"&&t.jsx("div",{className:"w-4 h-4 rounded bg-amber-100 dark:bg-amber-900/50 flex items-center justify-center",title:"Medium Priority",children:t.jsx(Gl,{className:"w-2.5 h-2.5 text-amber-600 dark:text-amber-400"})}),s.priority==="low"&&t.jsx("div",{className:"w-4 h-4 rounded bg-gray-100 dark:bg-gray-800 flex items-center justify-center",title:"Low Priority",children:t.jsx(Zr,{className:"w-2.5 h-2.5 text-gray-400 dark:text-gray-500"})})]}),t.jsx("p",{className:"text-sm font-medium text-slate-900 dark:text-slate-100 line-clamp-1",children:s.title})]}),t.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.jsxs("button",{onClick:()=>r?.(),className:"text-xs px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded-md font-medium transition-colors shadow-sm flex items-center gap-1",children:[t.jsx(jp,{className:"w-3 h-3"}),"Start Task"]}),t.jsx("button",{onClick:()=>W(!0),className:"text-xs px-2 py-1.5 border border-slate-300 dark:border-slate-600 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-600 dark:text-slate-300 rounded-md transition-colors flex items-center gap-1",title:"View task details",children:t.jsx($n,{className:"w-3 h-3"})}),e&&t.jsx("button",{onClick:e,className:"text-xs px-2 py-1.5 border border-slate-300 dark:border-slate-600 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-600 dark:text-slate-300 rounded-md transition-colors flex items-center gap-1",title:"View all tasks",children:t.jsx(hs,{className:"w-3 h-3"})})]})]})});else if(a&&a.length>0){const R=a.filter(_=>_.status==="done").length,D=a.length;j=t.jsx("div",{className:Me("bg-purple-50 dark:bg-purple-950 border border-purple-200 dark:border-purple-800 rounded-lg p-3 mb-4",n),children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Fn,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"}),t.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:R===D?"All done! 🎉":"No pending tasks"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:[R,"/",D]}),t.jsx("button",{onClick:e,className:"text-xs px-2 py-1 bg-purple-600 hover:bg-purple-700 text-white rounded transition-colors",children:"Review"})]})]})})}else j=null;return t.jsxs(t.Fragment,{children:[j,g&&t.jsx(pv,{currentProject:i,onClose:()=>x(!1),onTaskCreated:()=>{c(),x(!1)}}),b&&t.jsx(hv,{currentProject:i,onClose:()=>k(!1),onTemplateApplied:()=>{c(),k(!1)}}),N&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:t.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl h-[600px] flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:t.jsx(sn,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"TaskMaster Setup"}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Interactive CLI for ",i?.displayName]})]})]}),t.jsx("button",{onClick:()=>y(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800",children:t.jsx(ct,{className:"w-5 h-5"})})]}),t.jsx("div",{className:"flex-1 p-4",children:t.jsx("div",{className:"h-full bg-black rounded-lg overflow-hidden",children:t.jsx(Ni,{selectedProject:i,selectedSession:null,isActive:!0,initialCommand:"npx task-master init",isPlainShell:!0})})}),t.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"TaskMaster initialization will start automatically"}),t.jsx("button",{onClick:()=>y(!1),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Close"})]})})]})}),P&&s&&t.jsx(Md,{task:s,isOpen:P,onClose:()=>W(!1),onStatusChange:()=>c?.(),onTaskClick:null})]})},pv=({currentProject:e,onClose:r,onTaskCreated:n})=>{const[s,a]=f.useState({title:"",description:"",priority:"medium",useAI:!1,prompt:""}),[i,o]=f.useState(!1),l=async c=>{if(c.preventDefault(),!!e){o(!0);try{const d=s.useAI?{prompt:s.prompt,priority:s.priority}:{title:s.title,description:s.description,priority:s.priority},u=await Ue.taskmaster.addTask(e.name,d);if(u.ok)n();else{const m=await u.json();console.error("Failed to create task:",m),alert(`Failed to create task: ${m.message}`)}}catch(d){console.error("Error creating task:",d),alert("Error creating task. Please try again.")}finally{o(!1)}}};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Create New Task"}),t.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:t.jsx(ct,{className:"w-4 h-4"})})]}),t.jsxs("form",{onSubmit:l,className:"space-y-4",children:[t.jsx("div",{children:t.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[t.jsx("input",{type:"checkbox",checked:s.useAI,onChange:c=>a(d=>({...d,useAI:c.target.checked}))}),"Use AI to generate task details"]})}),s.useAI?t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Task Description (AI will generate details)"}),t.jsx("textarea",{value:s.prompt,onChange:c=>a(d=>({...d,prompt:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",rows:"3",placeholder:"Describe what you want to accomplish...",required:!0})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Task Title"}),t.jsx("input",{type:"text",value:s.title,onChange:c=>a(d=>({...d,title:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"Enter task title...",required:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Description"}),t.jsx("textarea",{value:s.description,onChange:c=>a(d=>({...d,description:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",rows:"3",placeholder:"Describe the task...",required:!0})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Priority"}),t.jsxs("select",{value:s.priority,onChange:c=>a(d=>({...d,priority:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"low",children:"Low"}),t.jsx("option",{value:"medium",children:"Medium"}),t.jsx("option",{value:"high",children:"High"})]})]}),t.jsxs("div",{className:"flex gap-2 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",disabled:i,children:"Cancel"}),t.jsx("button",{type:"submit",className:"flex-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded disabled:opacity-50",disabled:i||s.useAI&&!s.prompt.trim()||!s.useAI&&(!s.title.trim()||!s.description.trim()),children:i?"Creating...":"Create Task"})]})]})]})})},hv=({currentProject:e,onClose:r,onTemplateApplied:n})=>{const[s,a]=f.useState([]),[i,o]=f.useState(null),[l,c]=f.useState({}),[d,u]=f.useState("prd.txt"),[m,h]=f.useState(!0),[p,g]=f.useState(!1),[x,b]=f.useState("select");useEffect(()=>{(async()=>{try{const P=await Ue.taskmaster.getTemplates();if(P.ok){const W=await P.json();a(W.templates)}}catch(P){console.error("Error loading templates:",P)}finally{h(!1)}})()},[]);const k=y=>{o(y);const P=y.content.match(/\[([^\]]+)\]/g)||[],W=[...new Set(P.map(B=>B.slice(1,-1)))],M={};W.forEach(B=>{M[B]=""}),c(M),b("customize")},N=async()=>{if(!(!i||!e)){g(!0);try{const y=await Ue.taskmaster.applyTemplate(e.name,{templateId:i.id,fileName:d,customizations:l});if(!y.ok){const W=await y.json();throw new Error(W.message||"Failed to apply template")}const P=await Ue.taskmaster.parsePRD(e.name,{fileName:d,numTasks:10});if(!P.ok){const W=await P.json();throw new Error(W.message||"Failed to generate tasks")}b("generate"),setTimeout(()=>{n()},2e3)}catch(y){console.error("Error applying template:",y),alert(`Error: ${y.message}`),g(!1)}}};return m?t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),t.jsx("span",{className:"text-gray-900 dark:text-white",children:"Loading templates..."})]})})}):t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-2xl max-h-[80vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:x==="select"?"Select PRD Template":x==="customize"?"Customize Template":"Generating Tasks"}),t.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:t.jsx(ct,{className:"w-4 h-4"})})]}),x==="select"&&t.jsx("div",{className:"space-y-3",children:s.map(y=>t.jsx("div",{className:"p-4 border border-gray-200 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer transition-colors",onClick:()=>k(y),children:t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white",children:y.name}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:y.description}),t.jsx("span",{className:"inline-block text-xs bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 px-2 py-1 rounded mt-2",children:y.category})]}),t.jsx(ei,{className:"w-4 h-4 text-gray-400 mt-1"})]})},y.id))}),x==="customize"&&i&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"File Name"}),t.jsx("input",{type:"text",value:d,onChange:y=>u(y.target.value),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"prd.txt"})]}),Object.keys(l).length>0&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Customize Template"}),t.jsx("div",{className:"space-y-3",children:Object.entries(l).map(([y,P])=>t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-gray-600 dark:text-gray-400 mb-1",children:y.replace(/([A-Z])/g," $1").replace(/^./,W=>W.toUpperCase())}),t.jsx("input",{type:"text",value:P,onChange:W=>c(M=>({...M,[y]:W.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:`Enter ${y.toLowerCase()}`})]},y))})]}),t.jsxs("div",{className:"flex gap-2 pt-4",children:[t.jsx("button",{onClick:()=>b("select"),className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",children:"Back"}),t.jsx("button",{onClick:N,className:"flex-1 px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded disabled:opacity-50",disabled:p,children:p?"Applying...":"Apply & Generate Tasks"})]})]}),x==="generate"&&t.jsxs("div",{className:"text-center py-8",children:[t.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900 rounded-full flex items-center justify-center mx-auto mb-4",children:t.jsx(Fn,{className:"w-8 h-8 text-green-600 dark:text-green-400"})}),t.jsx("h4",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"Template Applied Successfully!"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Your PRD has been created and tasks are being generated..."})]})]})})};function fv({status:e,onAbort:r,isLoading:n,provider:s="claude"}){const[a,i]=f.useState(0),[o,l]=f.useState(0),[c,d]=f.useState(0);if(f.useEffect(()=>{if(!n){i(0),d(0);return}const k=Date.now(),N=30+Math.random()*20,y=setInterval(()=>{const P=Math.floor((Date.now()-k)/1e3);i(P),d(Math.floor(P*N))},1e3);return()=>clearInterval(y)},[n]),f.useEffect(()=>{if(!n)return;const k=setInterval(()=>{l(N=>(N+1)%4)},500);return()=>clearInterval(k)},[n]),!n)return null;const u=["Thinking","Processing","Analyzing","Working","Computing","Reasoning"],m=Math.floor(a/3)%u.length,h=e?.text||u[m],p=e?.tokens||c,g=e?.can_interrupt!==!1,b=["✻","✹","✸","✶"][o];return t.jsx("div",{className:"w-full mb-6 animate-in slide-in-from-bottom duration-300",children:t.jsxs("div",{className:"flex items-center justify-between max-w-4xl mx-auto bg-gray-900 dark:bg-gray-950 text-white rounded-lg shadow-lg px-4 py-3",children:[t.jsx("div",{className:"flex-1",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:Me("text-xl transition-all duration-500",o%2===0?"text-blue-400 scale-110":"text-blue-300"),children:b}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"font-medium text-sm",children:[h,"..."]}),t.jsxs("span",{className:"text-gray-400 text-sm",children:["(",a,"s)"]}),p>0&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-gray-400",children:"·"}),t.jsxs("span",{className:"text-gray-300 text-sm hidden sm:inline",children:["⚒ ",p.toLocaleString()," tokens"]}),t.jsxs("span",{className:"text-gray-300 text-sm sm:hidden",children:["⚒ ",p.toLocaleString()]})]}),t.jsx("span",{className:"text-gray-400 hidden sm:inline",children:"·"}),t.jsx("span",{className:"text-gray-300 text-sm hidden sm:inline",children:"esc to interrupt"})]}),t.jsx("div",{className:"text-xs text-gray-400 sm:hidden mt-1",children:"esc to interrupt"})]})]})}),g&&r&&t.jsxs("button",{onClick:r,className:"ml-3 text-xs bg-red-600 hover:bg-red-700 text-white px-2.5 py-1 sm:px-3 sm:py-1.5 rounded-md transition-colors flex items-center gap-1.5 flex-shrink-0",children:[t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),t.jsx("span",{className:"hidden sm:inline",children:"Stop"})]})]})})}function gv({used:e,total:r}){if(e==null||r==null||r<=0)return null;const n=Math.min(100,e/r*100),s=10,a=2*Math.PI*s,i=a-n/100*a,o=()=>n<50?"#3b82f6":n<75?"#f59e0b":"#ef4444";return t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"transform -rotate-90",children:[t.jsx("circle",{cx:"12",cy:"12",r:s,fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-gray-300 dark:text-gray-600"}),t.jsx("circle",{cx:"12",cy:"12",r:s,fill:"none",stroke:o(),strokeWidth:"2",strokeDasharray:a,strokeDashoffset:i,strokeLinecap:"round"})]}),t.jsxs("span",{title:`${e.toLocaleString()} / ${r.toLocaleString()} tokens`,children:[n.toFixed(1),"%"]})]})}async function xv(e,r){const n=new FormData,s=`recording_${Date.now()}.webm`,a=new File([e],s,{type:e.type});n.append("audio",a);const i=window.localStorage.getItem("whisperMode")||"default";n.append("mode",i);try{const o=await Ue.transcribe(n);if(!o.ok){const c=await o.json().catch(()=>({}));throw new Error(c.error||`Transcription error: ${o.status} ${o.statusText}`)}return(await o.json()).text||""}catch(o){throw o.name==="TypeError"&&o.message.includes("fetch")?new Error("Cannot connect to server. Please ensure the backend is running."):o}}function Td({onTranscript:e,className:r=""}){const[n,s]=f.useState("idle"),[a,i]=f.useState(null),[o,l]=f.useState(!0),c=f.useRef(null),d=f.useRef(null),u=f.useRef([]),m=f.useRef(0);f.useEffect(()=>{(()=>{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){l(!1),i("Microphone not supported. Please use HTTPS or a modern browser.");return}if(location.protocol!=="https:"&&location.hostname!=="localhost"){l(!1),i("Microphone requires HTTPS. Please use a secure connection.");return}l(!0),i(null)})()},[]);const h=async()=>{try{if(console.log("Starting recording..."),i(null),u.current=[],!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Microphone access not available. Please use HTTPS or a supported browser.");const y=await navigator.mediaDevices.getUserMedia({audio:!0});d.current=y;const P=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",W=new MediaRecorder(y,{mimeType:P});c.current=W,W.ondataavailable=M=>{M.data.size>0&&u.current.push(M.data)},W.onstop=async()=>{console.log("Recording stopped, creating blob...");const M=new Blob(u.current,{type:P});d.current&&(d.current.getTracks().forEach(j=>j.stop()),d.current=null),s("transcribing");const B=window.localStorage.getItem("whisperMode")||"default",L=B==="prompt"||B==="vibe"||B==="instructions"||B==="architect";let U;L&&(U=setTimeout(()=>{s("processing")},2e3));try{const j=await xv(M);j&&e&&e(j)}catch(j){console.error("Transcription error:",j),i(j.message)}finally{U&&clearTimeout(U),s("idle")}},W.start(),s("recording"),console.log("Recording started successfully")}catch(y){console.error("Failed to start recording:",y);let P="Microphone access failed";y.name==="NotAllowedError"?P="Microphone access denied. Please allow microphone permissions.":y.name==="NotFoundError"?P="No microphone found. Please check your audio devices.":y.name==="NotSupportedError"?P="Microphone not supported by this browser.":y.name==="NotReadableError"?P="Microphone is being used by another application.":y.message.includes("HTTPS")&&(P=y.message),i(P),s("idle")}},p=()=>{console.log("Stopping recording..."),c.current&&c.current.state==="recording"?c.current.stop():(console.log("Recorder not in recording state, forcing cleanup"),d.current&&(d.current.getTracks().forEach(y=>y.stop()),d.current=null),s("idle"))},g=y=>{if(y&&(y.preventDefault(),y.stopPropagation()),!o)return;const P=Date.now();if(P-m.current<300){console.log("Ignoring rapid tap");return}m.current=P,console.log("Button clicked, current state:",n),n==="idle"?h():n==="recording"&&p()};f.useEffect(()=>()=>{d.current&&d.current.getTracks().forEach(y=>y.stop())},[]);const x=()=>{if(!o)return{icon:t.jsx(ds,{className:"w-5 h-5"}),className:"bg-gray-400 cursor-not-allowed",disabled:!0};switch(n){case"recording":return{icon:t.jsx(ds,{className:"w-5 h-5 text-white"}),className:"bg-red-500 hover:bg-red-600 animate-pulse",disabled:!1};case"transcribing":return{icon:t.jsx(cp,{className:"w-5 h-5 animate-spin"}),className:"bg-blue-500 hover:bg-blue-600",disabled:!0};case"processing":return{icon:t.jsx(ql,{className:"w-5 h-5 animate-pulse"}),className:"bg-purple-500 hover:bg-purple-600",disabled:!0};default:return{icon:t.jsx(ds,{className:"w-5 h-5"}),className:"bg-gray-700 hover:bg-gray-600",disabled:!1}}},{icon:b,className:k,disabled:N}=x();return t.jsxs("div",{className:"relative",children:[t.jsx("button",{type:"button",style:{backgroundColor:n==="recording"?"#ef4444":n==="transcribing"?"#3b82f6":n==="processing"?"#a855f7":"#374151"},className:`
429
+ flex items-center justify-center
430
+ w-12 h-12 rounded-full
431
+ text-white transition-all duration-200
432
+ focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500
433
+ dark:ring-offset-gray-800
434
+ touch-action-manipulation
435
+ ${N?"cursor-not-allowed opacity-75":"cursor-pointer"}
436
+ ${n==="recording"?"animate-pulse":""}
437
+ hover:opacity-90
438
+ ${r}
439
+ `,onClick:g,disabled:N,children:b}),a&&t.jsx("div",{className:`absolute top-full mt-2 left-1/2 transform -translate-x-1/2
440
+ bg-red-500 text-white text-xs px-2 py-1 rounded whitespace-nowrap z-10
441
+ animate-fade-in`,children:a}),n==="recording"&&t.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-red-500 animate-ping pointer-events-none"}),n==="processing"&&t.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-purple-500 animate-ping pointer-events-none"})]})}function gr(e){return Array.isArray?Array.isArray(e):Ld(e)==="[object Array]"}function bv(e){if(typeof e=="string")return e;let r=e+"";return r=="0"&&1/e==-1/0?"-0":r}function yv(e){return e==null?"":bv(e)}function cr(e){return typeof e=="string"}function Dd(e){return typeof e=="number"}function kv(e){return e===!0||e===!1||vv(e)&&Ld(e)=="[object Boolean]"}function Pd(e){return typeof e=="object"}function vv(e){return Pd(e)&&e!==null}function qt(e){return e!=null}function ma(e){return!e.trim().length}function Ld(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const wv="Incorrect 'index' type",jv=e=>`Invalid value for key ${e}`,Nv=e=>`Pattern length exceeds max of ${e}.`,Cv=e=>`Missing ${e} property in key`,Sv=e=>`Property 'weight' in key '${e}' must be a positive integer`,cl=Object.prototype.hasOwnProperty;class Ev{constructor(r){this._keys=[],this._keyMap={};let n=0;r.forEach(s=>{let a=Rd(s);this._keys.push(a),this._keyMap[a.id]=a,n+=a.weight}),this._keys.forEach(s=>{s.weight/=n})}get(r){return this._keyMap[r]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Rd(e){let r=null,n=null,s=null,a=1,i=null;if(cr(e)||gr(e))s=e,r=dl(e),n=Ba(e);else{if(!cl.call(e,"name"))throw new Error(Cv("name"));const o=e.name;if(s=o,cl.call(e,"weight")&&(a=e.weight,a<=0))throw new Error(Sv(o));r=dl(o),n=Ba(o),i=e.getFn}return{path:r,id:n,weight:a,src:s,getFn:i}}function dl(e){return gr(e)?e:e.split(".")}function Ba(e){return gr(e)?e.join("."):e}function Iv(e,r){let n=[],s=!1;const a=(i,o,l)=>{if(qt(i))if(!o[l])n.push(i);else{let c=o[l];const d=i[c];if(!qt(d))return;if(l===o.length-1&&(cr(d)||Dd(d)||kv(d)))n.push(yv(d));else if(gr(d)){s=!0;for(let u=0,m=d.length;u<m;u+=1)a(d[u],o,l+1)}else o.length&&a(d,o,l+1)}};return a(e,cr(r)?r.split("."):r,0),s?n:n[0]}const Av={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Mv={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,r)=>e.score===r.score?e.idx<r.idx?-1:1:e.score<r.score?-1:1},Tv={location:0,threshold:.6,distance:100},Dv={useExtendedSearch:!1,getFn:Iv,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var $e={...Mv,...Av,...Tv,...Dv};const Pv=/[^ ]+/g;function Lv(e=1,r=3){const n=new Map,s=Math.pow(10,r);return{get(a){const i=a.match(Pv).length;if(n.has(i))return n.get(i);const o=1/Math.pow(i,.5*e),l=parseFloat(Math.round(o*s)/s);return n.set(i,l),l},clear(){n.clear()}}}class Ci{constructor({getFn:r=$e.getFn,fieldNormWeight:n=$e.fieldNormWeight}={}){this.norm=Lv(n,3),this.getFn=r,this.isCreated=!1,this.setIndexRecords()}setSources(r=[]){this.docs=r}setIndexRecords(r=[]){this.records=r}setKeys(r=[]){this.keys=r,this._keysMap={},r.forEach((n,s)=>{this._keysMap[n.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,cr(this.docs[0])?this.docs.forEach((r,n)=>{this._addString(r,n)}):this.docs.forEach((r,n)=>{this._addObject(r,n)}),this.norm.clear())}add(r){const n=this.size();cr(r)?this._addString(r,n):this._addObject(r,n)}removeAt(r){this.records.splice(r,1);for(let n=r,s=this.size();n<s;n+=1)this.records[n].i-=1}getValueForItemAtKeyId(r,n){return r[this._keysMap[n]]}size(){return this.records.length}_addString(r,n){if(!qt(r)||ma(r))return;let s={v:r,i:n,n:this.norm.get(r)};this.records.push(s)}_addObject(r,n){let s={i:n,$:{}};this.keys.forEach((a,i)=>{let o=a.getFn?a.getFn(r):this.getFn(r,a.path);if(qt(o)){if(gr(o)){let l=[];const c=[{nestedArrIndex:-1,value:o}];for(;c.length;){const{nestedArrIndex:d,value:u}=c.pop();if(qt(u))if(cr(u)&&!ma(u)){let m={v:u,i:d,n:this.norm.get(u)};l.push(m)}else gr(u)&&u.forEach((m,h)=>{c.push({nestedArrIndex:h,value:m})})}s.$[i]=l}else if(cr(o)&&!ma(o)){let l={v:o,n:this.norm.get(o)};s.$[i]=l}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function _d(e,r,{getFn:n=$e.getFn,fieldNormWeight:s=$e.fieldNormWeight}={}){const a=new Ci({getFn:n,fieldNormWeight:s});return a.setKeys(e.map(Rd)),a.setSources(r),a.create(),a}function Rv(e,{getFn:r=$e.getFn,fieldNormWeight:n=$e.fieldNormWeight}={}){const{keys:s,records:a}=e,i=new Ci({getFn:r,fieldNormWeight:n});return i.setKeys(s),i.setIndexRecords(a),i}function ls(e,{errors:r=0,currentLocation:n=0,expectedLocation:s=0,distance:a=$e.distance,ignoreLocation:i=$e.ignoreLocation}={}){const o=r/e.length;if(i)return o;const l=Math.abs(s-n);return a?o+l/a:l?1:o}function _v(e=[],r=$e.minMatchCharLength){let n=[],s=-1,a=-1,i=0;for(let o=e.length;i<o;i+=1){let l=e[i];l&&s===-1?s=i:!l&&s!==-1&&(a=i-1,a-s+1>=r&&n.push([s,a]),s=-1)}return e[i-1]&&i-s>=r&&n.push([s,i-1]),n}const zr=32;function zv(e,r,n,{location:s=$e.location,distance:a=$e.distance,threshold:i=$e.threshold,findAllMatches:o=$e.findAllMatches,minMatchCharLength:l=$e.minMatchCharLength,includeMatches:c=$e.includeMatches,ignoreLocation:d=$e.ignoreLocation}={}){if(r.length>zr)throw new Error(Nv(zr));const u=r.length,m=e.length,h=Math.max(0,Math.min(s,m));let p=i,g=h;const x=l>1||c,b=x?Array(m):[];let k;for(;(k=e.indexOf(r,g))>-1;){let B=ls(r,{currentLocation:k,expectedLocation:h,distance:a,ignoreLocation:d});if(p=Math.min(B,p),g=k+u,x){let L=0;for(;L<u;)b[k+L]=1,L+=1}}g=-1;let N=[],y=1,P=u+m;const W=1<<u-1;for(let B=0;B<u;B+=1){let L=0,U=P;for(;L<U;)ls(r,{errors:B,currentLocation:h+U,expectedLocation:h,distance:a,ignoreLocation:d})<=p?L=U:P=U,U=Math.floor((P-L)/2+L);P=U;let j=Math.max(1,h-U+1),R=o?m:Math.min(h+U,m)+u,D=Array(R+2);D[R+1]=(1<<B)-1;for(let C=R;C>=j;C-=1){let V=C-1,z=n[e.charAt(V)];if(x&&(b[V]=+!!z),D[C]=(D[C+1]<<1|1)&z,B&&(D[C]|=(N[C+1]|N[C])<<1|1|N[C+1]),D[C]&W&&(y=ls(r,{errors:B,currentLocation:V,expectedLocation:h,distance:a,ignoreLocation:d}),y<=p)){if(p=y,g=V,g<=h)break;j=Math.max(1,2*h-g)}}if(ls(r,{errors:B+1,currentLocation:h,expectedLocation:h,distance:a,ignoreLocation:d})>p)break;N=D}const M={isMatch:g>=0,score:Math.max(.001,y)};if(x){const B=_v(b,l);B.length?c&&(M.indices=B):M.isMatch=!1}return M}function Fv(e){let r={};for(let n=0,s=e.length;n<s;n+=1){const a=e.charAt(n);r[a]=(r[a]||0)|1<<s-n-1}return r}const js=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class zd{constructor(r,{location:n=$e.location,threshold:s=$e.threshold,distance:a=$e.distance,includeMatches:i=$e.includeMatches,findAllMatches:o=$e.findAllMatches,minMatchCharLength:l=$e.minMatchCharLength,isCaseSensitive:c=$e.isCaseSensitive,ignoreDiacritics:d=$e.ignoreDiacritics,ignoreLocation:u=$e.ignoreLocation}={}){if(this.options={location:n,threshold:s,distance:a,includeMatches:i,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:u},r=c?r:r.toLowerCase(),r=d?js(r):r,this.pattern=r,this.chunks=[],!this.pattern.length)return;const m=(p,g)=>{this.chunks.push({pattern:p,alphabet:Fv(p),startIndex:g})},h=this.pattern.length;if(h>zr){let p=0;const g=h%zr,x=h-g;for(;p<x;)m(this.pattern.substr(p,zr),p),p+=zr;if(g){const b=h-zr;m(this.pattern.substr(b),b)}}else m(this.pattern,0)}searchIn(r){const{isCaseSensitive:n,ignoreDiacritics:s,includeMatches:a}=this.options;if(r=n?r:r.toLowerCase(),r=s?js(r):r,this.pattern===r){let x={isMatch:!0,score:0};return a&&(x.indices=[[0,r.length-1]]),x}const{location:i,distance:o,threshold:l,findAllMatches:c,minMatchCharLength:d,ignoreLocation:u}=this.options;let m=[],h=0,p=!1;this.chunks.forEach(({pattern:x,alphabet:b,startIndex:k})=>{const{isMatch:N,score:y,indices:P}=zv(r,x,b,{location:i+k,distance:o,threshold:l,findAllMatches:c,minMatchCharLength:d,includeMatches:a,ignoreLocation:u});N&&(p=!0),h+=y,N&&P&&(m=[...m,...P])});let g={isMatch:p,score:p?h/this.chunks.length:1};return p&&a&&(g.indices=m),g}}class Mr{constructor(r){this.pattern=r}static isMultiMatch(r){return ul(r,this.multiRegex)}static isSingleMatch(r){return ul(r,this.singleRegex)}search(){}}function ul(e,r){const n=e.match(r);return n?n[1]:null}class $v extends Mr{constructor(r){super(r)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(r){const n=r===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class Ov extends Mr{constructor(r){super(r)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(r){const s=r.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,r.length-1]}}}class Bv extends Mr{constructor(r){super(r)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(r){const n=r.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class Wv extends Mr{constructor(r){super(r)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(r){const n=!r.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,r.length-1]}}}class Uv extends Mr{constructor(r){super(r)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(r){const n=r.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[r.length-this.pattern.length,r.length-1]}}}class Hv extends Mr{constructor(r){super(r)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(r){const n=!r.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,r.length-1]}}}class Fd extends Mr{constructor(r,{location:n=$e.location,threshold:s=$e.threshold,distance:a=$e.distance,includeMatches:i=$e.includeMatches,findAllMatches:o=$e.findAllMatches,minMatchCharLength:l=$e.minMatchCharLength,isCaseSensitive:c=$e.isCaseSensitive,ignoreDiacritics:d=$e.ignoreDiacritics,ignoreLocation:u=$e.ignoreLocation}={}){super(r),this._bitapSearch=new zd(r,{location:n,threshold:s,distance:a,includeMatches:i,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(r){return this._bitapSearch.searchIn(r)}}class $d extends Mr{constructor(r){super(r)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(r){let n=0,s;const a=[],i=this.pattern.length;for(;(s=r.indexOf(this.pattern,n))>-1;)n=s+i,a.push([s,n-1]);const o=!!a.length;return{isMatch:o,score:o?0:1,indices:a}}}const Wa=[$v,$d,Bv,Wv,Hv,Uv,Ov,Fd],ml=Wa.length,qv=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Vv="|";function Gv(e,r={}){return e.split(Vv).map(n=>{let s=n.trim().split(qv).filter(i=>i&&!!i.trim()),a=[];for(let i=0,o=s.length;i<o;i+=1){const l=s[i];let c=!1,d=-1;for(;!c&&++d<ml;){const u=Wa[d];let m=u.isMultiMatch(l);m&&(a.push(new u(m,r)),c=!0)}if(!c)for(d=-1;++d<ml;){const u=Wa[d];let m=u.isSingleMatch(l);if(m){a.push(new u(m,r));break}}}return a})}const Kv=new Set([Fd.type,$d.type]);class Jv{constructor(r,{isCaseSensitive:n=$e.isCaseSensitive,ignoreDiacritics:s=$e.ignoreDiacritics,includeMatches:a=$e.includeMatches,minMatchCharLength:i=$e.minMatchCharLength,ignoreLocation:o=$e.ignoreLocation,findAllMatches:l=$e.findAllMatches,location:c=$e.location,threshold:d=$e.threshold,distance:u=$e.distance}={}){this.query=null,this.options={isCaseSensitive:n,ignoreDiacritics:s,includeMatches:a,minMatchCharLength:i,findAllMatches:l,ignoreLocation:o,location:c,threshold:d,distance:u},r=n?r:r.toLowerCase(),r=s?js(r):r,this.pattern=r,this.query=Gv(this.pattern,this.options)}static condition(r,n){return n.useExtendedSearch}searchIn(r){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:a,ignoreDiacritics:i}=this.options;r=a?r:r.toLowerCase(),r=i?js(r):r;let o=0,l=[],c=0;for(let d=0,u=n.length;d<u;d+=1){const m=n[d];l.length=0,o=0;for(let h=0,p=m.length;h<p;h+=1){const g=m[h],{isMatch:x,indices:b,score:k}=g.search(r);if(x){if(o+=1,c+=k,s){const N=g.constructor.type;Kv.has(N)?l=[...l,...b]:l.push(b)}}else{c=0,o=0,l.length=0;break}}if(o){let h={isMatch:!0,score:c/o};return s&&(h.indices=l),h}}return{isMatch:!1,score:1}}}const Ua=[];function Yv(...e){Ua.push(...e)}function Ha(e,r){for(let n=0,s=Ua.length;n<s;n+=1){let a=Ua[n];if(a.condition(e,r))return new a(e,r)}return new zd(e,r)}const Ns={AND:"$and",OR:"$or"},qa={PATH:"$path",PATTERN:"$val"},Va=e=>!!(e[Ns.AND]||e[Ns.OR]),Qv=e=>!!e[qa.PATH],Xv=e=>!gr(e)&&Pd(e)&&!Va(e),pl=e=>({[Ns.AND]:Object.keys(e).map(r=>({[r]:e[r]}))});function Od(e,r,{auto:n=!0}={}){const s=a=>{let i=Object.keys(a);const o=Qv(a);if(!o&&i.length>1&&!Va(a))return s(pl(a));if(Xv(a)){const c=o?a[qa.PATH]:i[0],d=o?a[qa.PATTERN]:a[c];if(!cr(d))throw new Error(jv(c));const u={keyId:Ba(c),pattern:d};return n&&(u.searcher=Ha(d,r)),u}let l={children:[],operator:i[0]};return i.forEach(c=>{const d=a[c];gr(d)&&d.forEach(u=>{l.children.push(s(u))})}),l};return Va(e)||(e=pl(e)),s(e)}function Zv(e,{ignoreFieldNorm:r=$e.ignoreFieldNorm}){e.forEach(n=>{let s=1;n.matches.forEach(({key:a,norm:i,score:o})=>{const l=a?a.weight:null;s*=Math.pow(o===0&&l?Number.EPSILON:o,(l||1)*(r?1:i))}),n.score=s})}function ew(e,r){const n=e.matches;r.matches=[],qt(n)&&n.forEach(s=>{if(!qt(s.indices)||!s.indices.length)return;const{indices:a,value:i}=s;let o={indices:a,value:i};s.key&&(o.key=s.key.src),s.idx>-1&&(o.refIndex=s.idx),r.matches.push(o)})}function tw(e,r){r.score=e.score}function rw(e,r,{includeMatches:n=$e.includeMatches,includeScore:s=$e.includeScore}={}){const a=[];return n&&a.push(ew),s&&a.push(tw),e.map(i=>{const{idx:o}=i,l={item:r[o],refIndex:o};return a.length&&a.forEach(c=>{c(i,l)}),l})}class fn{constructor(r,n={},s){this.options={...$e,...n},this.options.useExtendedSearch,this._keyStore=new Ev(this.options.keys),this.setCollection(r,s)}setCollection(r,n){if(this._docs=r,n&&!(n instanceof Ci))throw new Error(wv);this._myIndex=n||_d(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(r){qt(r)&&(this._docs.push(r),this._myIndex.add(r))}remove(r=()=>!1){const n=[];for(let s=0,a=this._docs.length;s<a;s+=1){const i=this._docs[s];r(i,s)&&(this.removeAt(s),s-=1,a-=1,n.push(i))}return n}removeAt(r){this._docs.splice(r,1),this._myIndex.removeAt(r)}getIndex(){return this._myIndex}search(r,{limit:n=-1}={}){const{includeMatches:s,includeScore:a,shouldSort:i,sortFn:o,ignoreFieldNorm:l}=this.options;let c=cr(r)?cr(this._docs[0])?this._searchStringList(r):this._searchObjectList(r):this._searchLogical(r);return Zv(c,{ignoreFieldNorm:l}),i&&c.sort(o),Dd(n)&&n>-1&&(c=c.slice(0,n)),rw(c,this._docs,{includeMatches:s,includeScore:a})}_searchStringList(r){const n=Ha(r,this.options),{records:s}=this._myIndex,a=[];return s.forEach(({v:i,i:o,n:l})=>{if(!qt(i))return;const{isMatch:c,score:d,indices:u}=n.searchIn(i);c&&a.push({item:i,idx:o,matches:[{score:d,value:i,norm:l,indices:u}]})}),a}_searchLogical(r){const n=Od(r,this.options),s=(l,c,d)=>{if(!l.children){const{keyId:m,searcher:h}=l,p=this._findMatches({key:this._keyStore.get(m),value:this._myIndex.getValueForItemAtKeyId(c,m),searcher:h});return p&&p.length?[{idx:d,item:c,matches:p}]:[]}const u=[];for(let m=0,h=l.children.length;m<h;m+=1){const p=l.children[m],g=s(p,c,d);if(g.length)u.push(...g);else if(l.operator===Ns.AND)return[]}return u},a=this._myIndex.records,i={},o=[];return a.forEach(({$:l,i:c})=>{if(qt(l)){let d=s(n,l,c);d.length&&(i[c]||(i[c]={idx:c,item:l,matches:[]},o.push(i[c])),d.forEach(({matches:u})=>{i[c].matches.push(...u)}))}}),o}_searchObjectList(r){const n=Ha(r,this.options),{keys:s,records:a}=this._myIndex,i=[];return a.forEach(({$:o,i:l})=>{if(!qt(o))return;let c=[];s.forEach((d,u)=>{c.push(...this._findMatches({key:d,value:o[u],searcher:n}))}),c.length&&i.push({idx:l,item:o,matches:c})}),i}_findMatches({key:r,value:n,searcher:s}){if(!qt(n))return[];let a=[];if(gr(n))n.forEach(({v:i,i:o,n:l})=>{if(!qt(i))return;const{isMatch:c,score:d,indices:u}=s.searchIn(i);c&&a.push({score:d,key:r,value:i,idx:o,norm:l,indices:u})});else{const{v:i,n:o}=n,{isMatch:l,score:c,indices:d}=s.searchIn(i);l&&a.push({score:c,key:r,value:i,norm:o,indices:d})}return a}}fn.version="7.1.0";fn.createIndex=_d;fn.parseIndex=Rv;fn.config=$e;fn.parseQuery=Od;Yv(Jv);const nw=({commands:e=[],selectedIndex:r=-1,onSelect:n,onClose:s,position:a={top:0,left:0},isOpen:i=!1,frequentCommands:o=[]})=>{const l=f.useRef(null),c=f.useRef(null),u=(()=>{const N=window.innerWidth<640,y=window.innerHeight;return N?{position:"fixed",bottom:`${a.bottom||90}px`,left:"16px",right:"16px",width:"auto",maxWidth:"calc(100vw - 32px)",maxHeight:"min(50vh, 300px)"}:{position:"fixed",top:`${Math.max(16,Math.min(a.top,y-316))}px`,left:`${a.left}px`,width:"min(400px, calc(100vw - 32px))",maxWidth:"calc(100vw - 32px)",maxHeight:"300px"}})();if(f.useEffect(()=>{const N=y=>{l.current&&!l.current.contains(y.target)&&i&&s()};if(i)return document.addEventListener("mousedown",N),()=>{document.removeEventListener("mousedown",N)}},[i,s]),f.useEffect(()=>{if(c.current&&l.current){const N=l.current.getBoundingClientRect(),y=c.current.getBoundingClientRect();y.bottom>N.bottom?c.current.scrollIntoView({block:"nearest",behavior:"smooth"}):y.top<N.top&&c.current.scrollIntoView({block:"nearest",behavior:"smooth"})}},[r]),!i)return null;if(e.length===0)return t.jsx("div",{ref:l,className:"command-menu command-menu-empty",style:{...u,maxHeight:"300px",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"20px",opacity:1,transform:"translateY(0)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out",textAlign:"center"},children:"No commands available"});const m=o.length>0,h=e.reduce((N,y)=>{const P=y.namespace||y.type||"other";return N[P]||(N[P]=[]),N[P].push(y),N},{});m&&(h.frequent=o);const g=(m?["frequent","builtin","project","user","other"]:["builtin","project","user","other"]).filter(N=>h[N]),x={frequent:"⭐ Frequently Used",builtin:"Built-in Commands",project:"Project Commands",user:"User Commands",other:"Other Commands"};let b=0;const k=[];return g.forEach(N=>{h[N].forEach(y=>{k.push({...y,globalIndex:b++,namespace:N})})}),t.jsxs("div",{ref:l,role:"listbox","aria-label":"Available commands",className:"command-menu",style:{...u,maxHeight:"300px",overflowY:"auto",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"8px",opacity:i?1:0,transform:i?"translateY(0)":"translateY(-10px)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out"},children:[g.map(N=>t.jsxs("div",{className:"command-group",children:[g.length>1&&t.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",color:"#6b7280",padding:"8px 12px 4px",letterSpacing:"0.05em"},children:x[N]||N}),h[N].map(y=>{const P=k.find(M=>M.name===y.name&&M.namespace===N),W=P&&P.globalIndex===r;return t.jsxs("div",{ref:W?c:null,role:"option","aria-selected":W,className:"command-item",onMouseEnter:()=>n&&n(y,P.globalIndex,!0),onClick:()=>n&&n(y,P.globalIndex,!1),style:{display:"flex",alignItems:"flex-start",padding:"10px 12px",borderRadius:"6px",cursor:"pointer",backgroundColor:W?"#eff6ff":"transparent",transition:"background-color 100ms ease-in-out",marginBottom:"2px"},onMouseDown:M=>M.preventDefault(),children:[t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:y.description?"4px":0},children:[t.jsxs("span",{style:{fontSize:"16px",flexShrink:0},children:[N==="builtin"&&"⚡",N==="project"&&"📁",N==="user"&&"👤",N==="other"&&"📝"]}),t.jsx("span",{style:{fontWeight:600,fontSize:"14px",color:"#111827",fontFamily:"monospace"},children:y.name}),y.metadata?.type&&t.jsx("span",{className:"command-metadata-badge",style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#f3f4f6",color:"#6b7280",fontWeight:500},children:y.metadata.type})]}),y.description&&t.jsx("div",{style:{fontSize:"13px",color:"#6b7280",marginLeft:"24px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:y.description})]}),W&&t.jsx("span",{style:{marginLeft:"8px",color:"#3b82f6",fontSize:"12px",fontWeight:600},children:"↵"})]},`${N}-${y.name}`)})]},N)),t.jsx("style",{children:`
442
+ .command-menu {
443
+ background-color: white;
444
+ border: 1px solid #e5e7eb;
445
+ }
446
+ .command-menu-empty {
447
+ color: #6b7280;
448
+ }
449
+
450
+ @media (prefers-color-scheme: dark) {
451
+ .command-menu {
452
+ background-color: #1f2937 !important;
453
+ border: 1px solid #374151 !important;
454
+ }
455
+ .command-menu-empty {
456
+ color: #9ca3af !important;
457
+ }
458
+ .command-item[aria-selected="true"] {
459
+ background-color: #1e40af !important;
460
+ }
461
+ .command-item span:not(.command-metadata-badge) {
462
+ color: #f3f4f6 !important;
463
+ }
464
+ .command-metadata-badge {
465
+ background-color: #f3f4f6 !important;
466
+ color: #6b7280 !important;
467
+ }
468
+ .command-item div {
469
+ color: #d1d5db !important;
470
+ }
471
+ .command-group > div:first-child {
472
+ color: #9ca3af !important;
473
+ }
474
+ }
475
+ `})]})};function Nr(e){return e&&e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}function sw(e){if(!e||typeof e!="string")return e;try{return e.replace(/```\s*([^\n\r]+?)\s*```/g,"`$1`")}catch{return e}}const jn=({children:e,className:r})=>{const n=sw(String(e??""));return t.jsx("div",{className:r,children:t.jsx(Jx,{remarkPlugins:[lk],components:aw,children:n})})};function Ga(e){try{return typeof e!="string"?e:e.replace(/Claude AI usage limit reached\|(\d{10,13})/g,(r,n)=>{let s=parseInt(n,10);if(!Number.isFinite(s))return r;s<1e12&&(s*=1e3);const a=new Date(s),i=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(a),o=-a.getTimezoneOffset(),l=o>=0?"+":"-",c=Math.abs(o),d=Math.floor(c/60),u=c%60,m=`GMT${l}${d}${u?":"+String(u).padStart(2,"0"):""}`,g=((Intl.DateTimeFormat().resolvedOptions().timeZone||"").split("/").pop()||"").replace(/_/g," ").toLowerCase().replace(/\b\w/g,N=>N.toUpperCase()),x=g?`${m} (${g})`:m,b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],k=`${a.getDate()} ${b[a.getMonth()]} ${a.getFullYear()}`;return`Claude usage limit reached. Your limit will reset at **${i} ${x}** - ${k}`})}catch{return e}}const zt={setItem:(e,r)=>{try{if(e.startsWith("chat_messages_")&&typeof r=="string")try{const n=JSON.parse(r);if(Array.isArray(n)&&n.length>50){console.warn(`Truncating chat history for ${e} from ${n.length} to 50 messages`);const s=n.slice(-50);r=JSON.stringify(s)}}catch(n){console.warn("Could not parse chat messages for truncation:",n)}localStorage.setItem(e,r)}catch(n){if(n.name==="QuotaExceededError"){console.warn("localStorage quota exceeded, clearing old data");const s=Object.keys(localStorage),a=s.filter(o=>o.startsWith("chat_messages_")).sort();a.length>3&&a.slice(0,a.length-3).forEach(o=>{localStorage.removeItem(o),console.log(`Removed old chat data: ${o}`)}),s.filter(o=>o.startsWith("draft_input_")).forEach(o=>{localStorage.removeItem(o)});try{localStorage.setItem(e,r)}catch(o){if(console.error("Failed to save to localStorage even after cleanup:",o),e.startsWith("chat_messages_")&&typeof r=="string")try{const l=JSON.parse(r);if(Array.isArray(l)&&l.length>10){const c=l.slice(-10);localStorage.setItem(e,JSON.stringify(c)),console.warn("Saved only last 10 messages due to quota constraints")}}catch(l){console.error("Final save attempt failed:",l)}}}else console.error("localStorage error:",n)}},getItem:e=>{try{return localStorage.getItem(e)}catch(r){return console.error("localStorage getItem error:",r),null}},removeItem:e=>{try{localStorage.removeItem(e)}catch(r){console.error("localStorage removeItem error:",r)}}},aw={code:({node:e,inline:r,className:n,children:s,...a})=>{const[i,o]=fr.useState(!1),l=Array.isArray(s)?s.join(""):String(s??""),c=/[\r\n]/.test(l);if(r||e&&e.type==="inlineCode"||!c)return t.jsx("code",{className:`font-mono text-[0.9em] px-1.5 py-0.5 rounded-md bg-gray-100 text-gray-900 border border-gray-200 dark:bg-gray-800/60 dark:text-gray-100 dark:border-gray-700 whitespace-pre-wrap break-words ${n||""}`,...a,children:s});const m=l,h=()=>{const p=()=>{o(!0),setTimeout(()=>o(!1),1500)};try{if(navigator&&navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(m).then(p).catch(()=>{const g=document.createElement("textarea");g.value=m,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select();try{document.execCommand("copy")}catch{}document.body.removeChild(g),p()});else{const g=document.createElement("textarea");g.value=m,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select();try{document.execCommand("copy")}catch{}document.body.removeChild(g),p()}}catch{}};return t.jsxs("div",{className:"relative group my-2",children:[t.jsx("button",{type:"button",onClick:h,className:"absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 focus:opacity-100 active:opacity-100 transition-opacity text-xs px-2 py-1 rounded-md bg-gray-700/80 hover:bg-gray-700 text-white border border-gray-600",title:i?"Copied":"Copy code","aria-label":i?"Copied":"Copy code",children:i?t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Copied"]}):t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})}),t.jsx("pre",{className:"bg-gray-900 dark:bg-gray-900 border border-gray-700/40 rounded-lg p-3 overflow-x-auto",children:t.jsx("code",{className:`text-gray-100 dark:text-gray-100 text-sm font-mono ${n||""}`,...a,children:s})})]})},blockquote:({children:e})=>t.jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic text-gray-600 dark:text-gray-400 my-2",children:e}),a:({href:e,children:r})=>t.jsx("a",{href:e,className:"text-blue-600 dark:text-blue-400 hover:underline",target:"_blank",rel:"noopener noreferrer",children:r}),p:({children:e})=>t.jsx("div",{className:"mb-2 last:mb-0",children:e}),table:({children:e})=>t.jsx("div",{className:"overflow-x-auto my-2",children:t.jsx("table",{className:"min-w-full border-collapse border border-gray-200 dark:border-gray-700",children:e})}),thead:({children:e})=>t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:e}),th:({children:e})=>t.jsx("th",{className:"px-3 py-2 text-left text-sm font-semibold border border-gray-200 dark:border-gray-700",children:e}),td:({children:e})=>t.jsx("td",{className:"px-3 py-2 align-top text-sm border border-gray-200 dark:border-gray-700",children:e})},iw=f.memo(({message:e,index:r,prevMessage:n,createDiff:s,onFileOpen:a,onShowSettings:i,autoExpandTools:o,showRawParameters:l,showThinking:c,selectedProject:d})=>{const u=n&&n.type===e.type&&(n.type==="assistant"||n.type==="user"||n.type==="tool"||n.type==="error"),m=fr.useRef(null),[h,p]=fr.useState(!1);return fr.useEffect(()=>{if(!o||!m.current||!e.isToolUse)return;const g=new IntersectionObserver(x=>{x.forEach(b=>{b.isIntersecting&&!h&&(p(!0),m.current.querySelectorAll("details").forEach(N=>{N.open=!0}))})},{threshold:.1});return g.observe(m.current),()=>{m.current&&g.unobserve(m.current)}},[o,h,e.isToolUse]),t.jsx("div",{ref:m,className:`chat-message ${e.type} ${u?"grouped":""} ${e.type==="user"?"flex justify-end px-3 sm:px-0":"px-3 sm:px-0"}`,children:e.type==="user"?t.jsxs("div",{className:"flex items-end space-x-0 sm:space-x-3 w-full sm:w-auto sm:max-w-[85%] md:max-w-md lg:max-w-lg xl:max-w-xl",children:[t.jsxs("div",{className:"bg-blue-600 text-white rounded-2xl rounded-br-md px-3 sm:px-4 py-2 shadow-sm flex-1 sm:flex-initial",children:[t.jsx("div",{className:"text-sm whitespace-pre-wrap break-words",children:e.content}),e.images&&e.images.length>0&&t.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:e.images.map((g,x)=>t.jsx("img",{src:g.data,alt:g.name,className:"rounded-lg max-w-full h-auto cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>window.open(g.data,"_blank")},x))}),t.jsx("div",{className:"text-xs text-blue-100 mt-1 text-right",children:new Date(e.timestamp).toLocaleTimeString()})]}),!u&&t.jsx("div",{className:"hidden sm:flex w-8 h-8 bg-blue-600 rounded-full items-center justify-center text-white text-sm flex-shrink-0",children:"U"})]}):t.jsxs("div",{className:"w-full",children:[!u&&t.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.type==="error"?t.jsx("div",{className:"w-8 h-8 bg-red-600 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"!"}):e.type==="tool"?t.jsx("div",{className:"w-8 h-8 bg-gray-600 dark:bg-gray-700 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"🔧"}):t.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?t.jsx(hr,{className:"w-full h-full"}):t.jsx(lr,{className:"w-full h-full"})}),t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e.type==="error"?"Error":e.type==="tool"?"Tool":(localStorage.getItem("selected-provider")||"claude")==="cursor"?"Cursor":"Claude"})]}),t.jsxs("div",{className:"w-full",children:[e.isToolUse&&!["Read","TodoWrite","TodoRead"].includes(e.toolName)?["Grep","Glob"].includes(e.toolName)?t.jsx(t.Fragment,{children:t.jsx("div",{className:"group relative bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-blue-400 dark:border-blue-500 pl-3 py-2 my-2",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400 flex-1 min-w-0",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-blue-500 dark:text-blue-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),t.jsx("span",{className:"font-medium flex-shrink-0",children:e.toolName}),t.jsx("span",{className:"text-gray-400 dark:text-gray-500 flex-shrink-0",children:"•"}),e.toolInput&&(()=>{try{const x=JSON.parse(e.toolInput);return t.jsxs("span",{className:"font-mono truncate flex-1 min-w-0",children:[x.pattern&&t.jsxs("span",{children:["pattern: ",t.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:x.pattern})]}),x.path&&t.jsxs("span",{className:"ml-2",children:["in: ",x.path]})]})}catch{return null}})()]}),e.toolResult&&t.jsxs("a",{href:`#tool-result-${e.toolId}`,className:"flex-shrink-0 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors flex items-center gap-1",children:[t.jsx("span",{children:"results"}),t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]})})}):t.jsxs("div",{className:"group relative bg-gradient-to-br from-blue-50/50 to-indigo-50/50 dark:from-blue-950/20 dark:to-indigo-950/20 border border-blue-100/30 dark:border-blue-800/30 rounded-lg p-3 mb-2",children:[t.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-500/3 to-indigo-500/3 dark:from-blue-400/3 dark:to-indigo-400/3 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),t.jsxs("div",{className:"relative flex items-center justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"relative w-8 h-8 bg-gradient-to-br from-blue-500 to-indigo-600 dark:from-blue-400 dark:to-indigo-500 rounded-lg flex items-center justify-center shadow-lg shadow-blue-500/20 dark:shadow-blue-400/20",children:[t.jsxs("svg",{className:"w-4 h-4 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),t.jsx("div",{className:"absolute inset-0 rounded-lg bg-blue-500 dark:bg-blue-400 animate-pulse opacity-20"})]}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"font-semibold text-gray-900 dark:text-white text-sm",children:e.toolName}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:e.toolId})]})]}),i&&t.jsx("button",{onClick:x=>{x.stopPropagation(),i()},className:"p-2 rounded-lg hover:bg-white/60 dark:hover:bg-gray-800/60 transition-all duration-200 group/btn backdrop-blur-sm",title:"Tool Settings",children:t.jsxs("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-400 group-hover/btn:text-blue-600 dark:group-hover/btn:text-blue-400 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})]}),e.toolInput&&e.toolName==="Edit"&&(()=>{try{const x=JSON.parse(e.toolInput);if(x.file_path&&x.old_string&&x.new_string)return t.jsxs("details",{className:"relative mt-3 group/details",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/details:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),t.jsx("span",{className:"flex items-center gap-2",children:t.jsx("span",{children:"View edit diff for"})}),t.jsx("button",{onClick:async b=>{if(b.preventDefault(),b.stopPropagation(),!!a)try{const k=await Ue.readFile(d?.name,x.file_path),N=await k.json();if(!k.ok||N.error){console.error("Failed to fetch file:",N.error),a(x.file_path);return}const y=N.content||"",P=y.replace(x.new_string,x.old_string);a(x.file_path,{old_string:P,new_string:y})}catch(k){console.error("Error preparing diff:",k),a(x.file_path)}},className:"px-2.5 py-1 rounded-md bg-white/60 dark:bg-gray-800/60 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 font-mono text-xs font-medium transition-all duration-200 shadow-sm",children:x.file_path.split("/").pop()})]}),t.jsxs("div",{className:"mt-3 pl-6",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-900/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden shadow-sm",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 bg-gradient-to-r from-gray-50 to-gray-100/50 dark:from-gray-800/80 dark:to-gray-800/40 border-b border-gray-200/60 dark:border-gray-700/60 backdrop-blur-sm",children:[t.jsx("button",{onClick:async()=>{if(a)try{const b=await Ue.readFile(d?.name,x.file_path),k=await b.json();if(!b.ok||k.error){console.error("Failed to fetch file:",k.error),a(x.file_path);return}const N=k.content||"",y=N.replace(x.new_string,x.old_string);a(x.file_path,{old_string:y,new_string:N})}catch(b){console.error("Error preparing diff:",b),a(x.file_path)}},className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 truncate cursor-pointer font-medium transition-colors",children:x.file_path}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium px-2 py-0.5 bg-gray-100 dark:bg-gray-700/50 rounded",children:"Diff"})]}),t.jsx("div",{className:"text-xs font-mono",children:s(x.old_string,x.new_string).map((b,k)=>t.jsxs("div",{className:"flex",children:[t.jsx("span",{className:`w-8 text-center border-r ${b.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:b.type==="removed"?"-":"+"}),t.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${b.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:b.content})]},k))})]}),l&&t.jsxs("details",{className:"relative mt-3 pl-6 group/raw",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-xs font-medium text-gray-600 dark:text-gray-400 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-3 h-3 transition-transform duration-200 group-open/raw:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View raw parameters"]}),t.jsx("pre",{className:"mt-2 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})]})]})}catch{}return t.jsxs("details",{className:"relative mt-3 group/params",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/params:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View input parameters"]}),t.jsx("pre",{className:"mt-3 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})})(),e.toolInput&&e.toolName!=="Edit"&&(()=>{if(e.toolName==="Write")try{let x;if(typeof e.toolInput=="string"?x=JSON.parse(e.toolInput):x=e.toolInput,x.file_path&&x.content!==void 0)return t.jsxs("details",{className:"relative mt-3 group/details",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/details:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-lg leading-none",children:"📄"}),t.jsx("span",{children:"Creating new file:"})]}),t.jsx("button",{onClick:async b=>{if(b.preventDefault(),b.stopPropagation(),!!a)try{const k=await Ue.readFile(d?.name,x.file_path),N=await k.json(),y=k.ok&&!N.error?N.content||"":x.content||"";a(x.file_path,{old_string:"",new_string:y})}catch(k){console.error("Error preparing diff:",k),a(x.file_path,{old_string:"",new_string:x.content||""})}},className:"px-2.5 py-1 rounded-md bg-white/60 dark:bg-gray-800/60 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 font-mono text-xs font-medium transition-all duration-200 shadow-sm",children:x.file_path.split("/").pop()})]}),t.jsxs("div",{className:"mt-3 pl-6",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-900/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden shadow-sm",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 bg-gradient-to-r from-gray-50 to-gray-100/50 dark:from-gray-800/80 dark:to-gray-800/40 border-b border-gray-200/60 dark:border-gray-700/60 backdrop-blur-sm",children:[t.jsx("button",{onClick:async()=>{if(a)try{const b=await Ue.readFile(d?.name,x.file_path),k=await b.json(),N=b.ok&&!k.error?k.content||"":x.content||"";a(x.file_path,{old_string:"",new_string:N})}catch(b){console.error("Error preparing diff:",b),a(x.file_path,{old_string:"",new_string:x.content||""})}},className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 truncate cursor-pointer font-medium transition-colors",children:x.file_path}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium px-2 py-0.5 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded",children:"New File"})]}),t.jsx("div",{className:"text-xs font-mono",children:s("",x.content).map((b,k)=>t.jsxs("div",{className:"flex",children:[t.jsx("span",{className:`w-8 text-center border-r ${b.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:b.type==="removed"?"-":"+"}),t.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${b.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:b.content})]},k))})]}),l&&t.jsxs("details",{className:"relative mt-3 pl-6 group/raw",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-xs font-medium text-gray-600 dark:text-gray-400 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-3 h-3 transition-transform duration-200 group-open/raw:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View raw parameters"]}),t.jsx("pre",{className:"mt-2 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})]})]})}catch{}if(e.toolName==="TodoWrite")try{const x=JSON.parse(e.toolInput);if(x.todos&&Array.isArray(x.todos))return t.jsxs("details",{className:"relative mt-3 group/todo",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/todo:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-lg leading-none",children:"✓"}),t.jsx("span",{children:"Updating Todo List"})]})]}),t.jsxs("div",{className:"mt-3",children:[t.jsx(ua,{todos:x.todos}),l&&t.jsxs("details",{className:"relative mt-3 group/raw",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-xs font-medium text-gray-600 dark:text-gray-400 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-3 h-3 transition-transform duration-200 group-open/raw:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View raw parameters"]}),t.jsx("pre",{className:"mt-2 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg overflow-x-auto text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})]})]})}catch{}if(e.toolName==="Bash")try{const x=JSON.parse(e.toolInput);return t.jsxs("div",{className:"my-2",children:[t.jsxs("div",{className:"bg-gray-900 dark:bg-gray-950 rounded-md px-3 py-2 font-mono text-sm",children:[t.jsx("span",{className:"text-green-400",children:"$"}),t.jsx("span",{className:"text-gray-100 ml-2",children:x.command})]}),x.description&&t.jsx("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400 italic ml-1",children:x.description})]})}catch{}if(e.toolName==="Read")try{const x=JSON.parse(e.toolInput);if(x.file_path){const b=x.file_path.split("/").pop();return t.jsxs("div",{className:"mt-2 text-sm text-blue-700 dark:text-blue-300",children:["Read"," ",t.jsx("button",{onClick:()=>a&&a(x.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-mono",children:b})]})}}catch{}if(e.toolName==="exit_plan_mode")try{const x=JSON.parse(e.toolInput);if(x.plan){const b=x.plan.replace(/\\n/g,`
476
+ `);return t.jsxs("details",{className:"mt-2",open:o,children:[t.jsxs("summary",{className:"text-sm text-blue-700 dark:text-blue-300 cursor-pointer hover:text-blue-800 dark:hover:text-blue-200 flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"📋 View implementation plan"]}),t.jsx(jn,{className:"mt-3 prose prose-sm max-w-none dark:prose-invert",children:b})]})}}catch{}return t.jsxs("details",{className:"relative mt-3 group/params",open:o,children:[t.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/params:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View input parameters"]}),t.jsx("pre",{className:"mt-3 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})})(),e.toolResult&&(!e.toolResult.isError&&(e.toolName==="Edit"||e.toolName==="Write"||e.toolName==="ApplyPatch"||e.toolName==="Bash")?null:t.jsxs("div",{id:`tool-result-${e.toolId}`,className:`relative mt-4 p-4 rounded-lg border backdrop-blur-sm scroll-mt-4 ${e.toolResult.isError?"bg-gradient-to-br from-red-50 to-rose-50 dark:from-red-950/20 dark:to-rose-950/20 border-red-200/60 dark:border-red-800/60":"bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-950/20 dark:to-emerald-950/20 border-green-200/60 dark:border-green-800/60"}`,children:[t.jsx("div",{className:`absolute inset-0 rounded-lg opacity-50 ${e.toolResult.isError?"bg-gradient-to-br from-red-500/5 to-rose-500/5 dark:from-red-400/5 dark:to-rose-400/5":"bg-gradient-to-br from-green-500/5 to-emerald-500/5 dark:from-green-400/5 dark:to-emerald-400/5"}`}),t.jsxs("div",{className:"relative flex items-center gap-2.5 mb-3",children:[t.jsx("div",{className:`w-6 h-6 rounded-lg flex items-center justify-center shadow-md ${e.toolResult.isError?"bg-gradient-to-br from-red-500 to-rose-600 dark:from-red-400 dark:to-rose-500 shadow-red-500/20":"bg-gradient-to-br from-green-500 to-emerald-600 dark:from-green-400 dark:to-emerald-500 shadow-green-500/20"}`,children:t.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.toolResult.isError?t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M6 18L18 6M6 6l12 12"}):t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})})}),t.jsx("span",{className:`text-sm font-semibold ${e.toolResult.isError?"text-red-800 dark:text-red-200":"text-green-800 dark:text-green-200"}`,children:e.toolResult.isError?"Tool Error":"Tool Result"})]}),t.jsx("div",{className:`relative text-sm ${e.toolResult.isError?"text-red-900 dark:text-red-100":"text-green-900 dark:text-green-100"}`,children:(()=>{const b=String(e.toolResult.content||"");if((e.toolName==="TodoWrite"||e.toolName==="TodoRead")&&(b.includes("Todos have been modified successfully")||b.includes("Todo list")||b.startsWith("[")&&b.includes('"content"')&&b.includes('"status"')))try{let y=null;if(b.startsWith("["))y=JSON.parse(b);else if(b.includes("Todos have been modified successfully"))return t.jsx("div",{children:t.jsx("div",{className:"flex items-center gap-2 mb-2",children:t.jsx("span",{className:"font-medium",children:"Todo list has been updated successfully"})})});if(y&&Array.isArray(y))return t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center gap-2 mb-3",children:t.jsx("span",{className:"font-medium",children:"Current Todo List"})}),t.jsx(ua,{todos:y,isResult:!0})]})}catch{}if(e.toolName==="exit_plan_mode")try{const y=JSON.parse(b);if(y.plan){const P=y.plan.replace(/\\n/g,`
477
+ `);return t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center gap-2 mb-3",children:t.jsx("span",{className:"font-medium",children:"Implementation Plan"})}),t.jsx(jn,{className:"prose prose-sm max-w-none dark:prose-invert",children:P})]})}}catch{}if((e.toolName==="Grep"||e.toolName==="Glob")&&e.toolResult?.toolUseResult){const y=e.toolResult.toolUseResult;if(y.filenames&&Array.isArray(y.filenames)&&y.filenames.length>0)return t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center gap-2 mb-3",children:t.jsxs("span",{className:"font-medium",children:["Found ",y.numFiles||y.filenames.length," ",y.numFiles===1||y.filenames.length===1?"file":"files"]})}),t.jsx("div",{className:"space-y-1 max-h-96 overflow-y-auto",children:y.filenames.map((P,W)=>{const M=P.split("/").pop(),B=P.substring(0,P.lastIndexOf("/"));return t.jsxs("div",{onClick:()=>{a&&a(P)},className:"group flex items-center gap-2 px-2 py-1.5 rounded hover:bg-green-100/50 dark:hover:bg-green-800/20 cursor-pointer transition-colors",children:[t.jsx("svg",{className:"w-4 h-4 text-green-600 dark:text-green-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-mono text-sm font-medium text-green-800 dark:text-green-200 truncate group-hover:text-green-900 dark:group-hover:text-green-100",children:M}),t.jsx("div",{className:"font-mono text-xs text-green-600/70 dark:text-green-400/70 truncate",children:B})]}),t.jsx("svg",{className:"w-4 h-4 text-green-600 dark:text-green-400 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},W)})})]})}if(b.includes("Do you want to proceed?")&&e.toolName==="Bash"){const y=b.split(`
478
+ `),P=y.findIndex(R=>R.includes("Do you want to proceed?")),W=y.slice(0,P).join(`
479
+ `),M=y.slice(P),B=M.find(R=>R.includes("Do you want to proceed?"))||"",L=[];M.forEach(R=>{const D=R.match(/^\s*(\d+)\.\s+(.+)$/);D&&L.push({number:D[1],text:D[2].trim()})});const U=b.match(/>\s*(\d+)/),j=U?U[1]:null;return t.jsxs("div",{className:"space-y-3",children:[W&&t.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 text-gray-100 rounded-lg p-3 font-mono text-xs overflow-x-auto",children:t.jsx("pre",{className:"whitespace-pre-wrap break-words",children:W})}),t.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-2",children:"Interactive Prompt"}),t.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:B}),t.jsx("div",{className:"space-y-2 mb-4",children:L.map(R=>t.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${j===R.number?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700 hover:border-amber-400 dark:hover:border-amber-600 hover:shadow-sm"} ${j?"cursor-default":"cursor-not-allowed opacity-75"}`,disabled:!0,children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${j===R.number?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:R.number}),t.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:R.text}),j===R.number&&t.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})]})},R.number))}),j&&t.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[t.jsxs("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:["✓ Claude selected option ",j]}),t.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"In the CLI, you would select this option interactively using arrow keys or by typing the number."})]})]})]})})]})}const k=b.match(/The file (.+?) has been updated\./);if(k)return t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center gap-2 mb-2",children:t.jsx("span",{className:"font-medium",children:"File updated successfully"})}),t.jsx("button",{onClick:async()=>{if(a)try{const P=await(await Fe(`/api/git/file-with-diff?project=${encodeURIComponent(d?.name)}&file=${encodeURIComponent(k[1])}`)).json();!P.error&&P.oldContent!==void 0&&P.currentContent!==void 0?a(k[1],{old_string:P.oldContent||"",new_string:P.currentContent||""}):a(k[1])}catch(y){console.error("Error fetching file diff:",y),a(k[1])}},className:"text-xs font-mono bg-green-100 dark:bg-green-800/30 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline cursor-pointer",children:k[1]})]});const N=b.match(/(?:The file|File) (.+?) has been (?:created|written)(?: successfully)?\.?/);return N?t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center gap-2 mb-2",children:t.jsx("span",{className:"font-medium",children:"File created successfully"})}),t.jsx("button",{onClick:async()=>{if(a)try{const P=await(await Fe(`/api/git/file-with-diff?project=${encodeURIComponent(d?.name)}&file=${encodeURIComponent(N[1])}`)).json();!P.error&&P.oldContent!==void 0&&P.currentContent!==void 0?a(N[1],{old_string:P.oldContent||"",new_string:P.currentContent||""}):a(N[1])}catch(y){console.error("Error fetching file diff:",y),a(N[1])}},className:"text-xs font-mono bg-green-100 dark:bg-green-800/30 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline cursor-pointer",children:N[1]})]}):e.toolName==="Write"&&!e.toolResult.isError?t.jsxs("div",{className:"text-green-700 dark:text-green-300",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),t.jsx("span",{className:"font-medium",children:"File written successfully"})]}),t.jsx("p",{className:"text-xs mt-1 text-green-600 dark:text-green-400",children:"The file content is displayed in the diff view above"})]}):b.includes("cat -n")&&b.includes("→")?t.jsxs("details",{open:o,children:[t.jsxs("summary",{className:"text-sm text-green-700 dark:text-green-300 cursor-pointer hover:text-green-800 dark:hover:text-green-200 mb-2 flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View file content"]}),t.jsx("div",{className:"mt-2 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:t.jsx("div",{className:"text-xs font-mono p-3 whitespace-pre-wrap break-words overflow-hidden",children:b})})]}):b.length>300?t.jsxs("details",{open:o,children:[t.jsxs("summary",{className:"text-sm text-green-700 dark:text-green-300 cursor-pointer hover:text-green-800 dark:hover:text-green-200 mb-2 flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View full output (",b.length," chars)"]}),t.jsx(jn,{className:"mt-2 prose prose-sm max-w-none prose-green dark:prose-invert",children:b})]}):t.jsx(jn,{className:"prose prose-sm max-w-none prose-green dark:prose-invert",children:b})})()})]}))]}):e.isInteractivePrompt?t.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-3",children:"Interactive Prompt"}),(()=>{const g=e.content.split(`
480
+ `).filter(k=>k.trim()),x=g.find(k=>k.includes("?"))||g[0]||"",b=[];return g.forEach(k=>{const N=k.match(/[❯\s]*(\d+)\.\s+(.+)/);if(N){const y=k.includes("❯");b.push({number:N[1],text:N[2].trim(),isSelected:y})}}),t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:x}),t.jsx("div",{className:"space-y-2 mb-4",children:b.map(k=>t.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${k.isSelected?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700"} cursor-not-allowed opacity-75`,disabled:!0,children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${k.isSelected?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:k.number}),t.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:k.text}),k.isSelected&&t.jsx("span",{className:"text-lg",children:"❯"})]})},k.number))}),t.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[t.jsx("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:"⏳ Waiting for your response in the CLI"}),t.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"Please select an option in your terminal where Claude is running."})]})]})})()]})]})}):e.isToolUse&&e.toolName==="Read"?(()=>{try{const g=JSON.parse(e.toolInput);if(g.file_path){const x=g.file_path.split("/").pop();return t.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),t.jsx("span",{className:"font-medium",children:"Read"}),t.jsx("button",{onClick:()=>a&&a(g.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-mono transition-colors",children:x})]})})}}catch{return t.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),t.jsx("span",{className:"font-medium",children:"Read file"})]})})}})():e.isToolUse&&e.toolName==="TodoWrite"?(()=>{try{const g=JSON.parse(e.toolInput);if(g.todos&&Array.isArray(g.todos))return t.jsxs("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400 mb-2",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),t.jsx("span",{className:"font-medium",children:"Update todo list"})]}),t.jsx(ua,{todos:g.todos})]})}catch{return t.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),t.jsx("span",{className:"font-medium",children:"Update todo list"})]})})}})():e.isToolUse&&e.toolName==="TodoRead"?t.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),t.jsx("span",{className:"font-medium",children:"Read todo list"})]})}):t.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:[c&&e.reasoning&&t.jsxs("details",{className:"mb-3",children:[t.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 font-medium",children:"💭 Thinking..."}),t.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-300 dark:border-gray-600 italic text-gray-600 dark:text-gray-400 text-sm",children:t.jsx("div",{className:"whitespace-pre-wrap",children:e.reasoning})})]}),(()=>{const g=Ga(String(e.content||"")),x=g.trim();if((x.startsWith("{")||x.startsWith("["))&&(x.endsWith("}")||x.endsWith("]")))try{const b=JSON.parse(x),k=JSON.stringify(b,null,2);return t.jsxs("div",{className:"my-2",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-gray-600 dark:text-gray-400",children:[t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),t.jsx("span",{className:"font-medium",children:"JSON Response"})]}),t.jsx("div",{className:"bg-gray-800 dark:bg-gray-900 border border-gray-600/30 dark:border-gray-700 rounded-lg overflow-hidden",children:t.jsx("pre",{className:"p-4 overflow-x-auto",children:t.jsx("code",{className:"text-gray-100 dark:text-gray-200 text-sm font-mono block whitespace-pre",children:k})})})]})}catch{}return e.type==="assistant"?t.jsx(jn,{className:"prose prose-sm max-w-none dark:prose-invert prose-gray",children:g}):t.jsx("div",{className:"whitespace-pre-wrap",children:g})})()]}),t.jsx("div",{className:`text-xs text-gray-500 dark:text-gray-400 mt-1 ${u?"opacity-0 group-hover:opacity-100":""}`,children:new Date(e.timestamp).toLocaleTimeString()})]})]})})}),ow=({file:e,onRemove:r,uploadProgress:n,error:s})=>{const[a,i]=f.useState(null);return f.useEffect(()=>{const o=URL.createObjectURL(e);return i(o),()=>URL.revokeObjectURL(o)},[e]),t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:a,alt:e.name,className:"w-20 h-20 object-cover rounded"}),n!==void 0&&n<100&&t.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:t.jsxs("div",{className:"text-white text-xs",children:[n,"%"]})}),s&&t.jsx("div",{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:t.jsx("svg",{className:"w-6 h-6 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),t.jsx("button",{onClick:r,className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 opacity-0 group-hover:opacity-100",children:t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};function lw({selectedProject:e,selectedSession:r,ws:n,sendMessage:s,messages:a,onFileOpen:i,onInputFocusChange:o,onSessionActive:l,onSessionInactive:c,onSessionProcessing:d,onSessionNotProcessing:u,processingSessions:m,onReplaceTemporarySession:h,onNavigateToSession:p,onShowSettings:g,autoExpandTools:x,showRawParameters:b,showThinking:k,autoScrollToBottom:N,sendByCtrlEnter:y,externalMessageUpdate:P,onTaskClick:W,onShowAllTasks:M}){const{tasksEnabled:B}=Bn(),[L,U]=f.useState(()=>typeof window<"u"&&e&&zt.getItem(`draft_input_${e.name}`)||""),[j,R]=f.useState(()=>{if(typeof window<"u"&&e){const S=zt.getItem(`chat_messages_${e.name}`);return S?JSON.parse(S):[]}return[]}),[D,_]=f.useState(!1),[C,V]=f.useState(r?.id||null),[z,Z]=f.useState(!1),[F,ce]=f.useState([]),[v,ue]=f.useState(!1),[fe,w]=f.useState(!1),[J,he]=f.useState(0),[ye,re]=f.useState(!1),[Pe,X]=f.useState(0),le=20,[ke,ge]=f.useState(!1),[Ie,Ke]=f.useState("default"),[et,st]=f.useState([]),[ft,tt]=f.useState(new Map),[xe,qe]=f.useState(new Map),it=f.useRef(null),ve=f.useRef(null),Ct=f.useRef(null),Q=f.useRef(null),de=f.useRef(!1),T=f.useRef(""),O=f.useRef(null),ne=f.useRef(null),[Ce,De]=f.useState(""),[ee,me]=f.useState(!1),[oe,we]=f.useState([]),[Ee,Be]=f.useState([]),[ze,Xe]=f.useState(-1),[gt,ot]=f.useState(0),[vt,Gt]=f.useState(-1),[Kt,Nt]=f.useState(!1),[Wt,Jt]=f.useState(!1),Rt=f.useRef({height:0,top:0}),[I,E]=f.useState(!1),[$,ae]=f.useState([]),[q,_e]=f.useState([]),[at,St]=f.useState(""),[Tr,wt]=f.useState(!1),[Mt,_t]=f.useState(null),[xt,Tt]=f.useState(-1),[qn,A]=f.useState(-1),[ie,Oe]=f.useState(100),[ut,pt]=f.useState(null),[ht,Yt]=f.useState(()=>localStorage.getItem("selected-provider")||"claude"),[Gr,Di]=f.useState(()=>localStorage.getItem("cursor-model")||"gpt-5");f.useEffect(()=>{if(r?.id){const S=localStorage.getItem(`permissionMode-${r.id}`);Ke(S||"default")}},[r?.id]),f.useEffect(()=>{r&&r.__provider&&r.__provider!==ht&&(Yt(r.__provider),localStorage.setItem("selected-provider",r.__provider))},[r]),f.useEffect(()=>{ht==="cursor"&&fetch("/api/cursor/config",{headers:{Authorization:`Bearer ${localStorage.getItem("auth-token")}`}}).then(S=>S.json()).then(S=>{if(S.success&&S.config?.model?.modelId){const G={"gpt-5":"gpt-5","claude-4-sonnet":"sonnet-4","sonnet-4":"sonnet-4","claude-4-opus":"opus-4.1","opus-4.1":"opus-4.1"}[S.config.model.modelId]||S.config.model.modelId;localStorage.getItem("cursor-model")||Di(G)}}).catch(S=>console.error("Error loading Cursor config:",S))},[ht]),f.useEffect(()=>{(async()=>{if(e)try{const K=await Fe("/api/commands/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.path})});if(!K.ok)throw new Error("Failed to fetch commands");const G=await K.json(),H=[...(G.builtIn||[]).map(Ae=>({...Ae,type:"built-in"})),...(G.custom||[]).map(Ae=>({...Ae,type:"custom"}))];ae(H);const te=`command_history_${e.name}`,Se=zt.getItem(te);if(Se)try{const Ae=JSON.parse(Se),Ye=H.sort((Te,Y)=>{const be=Ae[Te.name]||0;return(Ae[Y.name]||0)-be});ae(Ye)}catch(Ae){console.error("Error parsing command history:",Ae)}}catch(K){console.error("Error fetching slash commands:",K),ae([])}})()},[e]);const Ls=f.useMemo(()=>$.length?new fn($,{keys:[{name:"name",weight:2},{name:"description",weight:1}],threshold:.4,includeScore:!0,minMatchCharLength:1}):null,[$]);f.useEffect(()=>{if(!at){_e($);return}if(!Ls){_e([]);return}const S=Ls.search(at);_e(S.map(K=>K.item))},[at,$,Ls]);const lu=f.useMemo(()=>{if(!e||$.length===0)return[];const S=`command_history_${e.name}`,K=zt.getItem(S);if(!K)return[];try{const G=JSON.parse(K);return $.map(te=>({...te,usageCount:G[te.name]||0})).filter(te=>te.usageCount>0).sort((te,Se)=>Se.usageCount-te.usageCount).slice(0,5)}catch(G){return console.error("Error parsing command history:",G),[]}},[e,$]),cu=f.useCallback((S,K,G)=>{if(!S||!e)return;if(G){Tt(K);return}const H=`command_history_${e.name}`,te=zt.getItem(H);let Se={};try{Se=te?JSON.parse(te):{}}catch(Ae){console.error("Error parsing command history:",Ae)}Se[S.name]=(Se[S.name]||0)+1,zt.setItem(H,JSON.stringify(Se)),Pi(S)},[e]),du=f.useCallback(S=>{const{action:K,data:G}=S;switch(K){case"clear":R([]),ce([]);break;case"help":R(H=>[...H,{role:"assistant",content:G.content,timestamp:Date.now()}]);break;case"model":R(H=>[...H,{role:"assistant",content:`**Current Model**: ${G.current.model}
481
+
482
+ **Available Models**:
483
+
484
+ Claude: ${G.available.claude.join(", ")}
485
+
486
+ Cursor: ${G.available.cursor.join(", ")}`,timestamp:Date.now()}]);break;case"cost":{const H=`**Token Usage**: ${G.tokenUsage.used.toLocaleString()} / ${G.tokenUsage.total.toLocaleString()} (${G.tokenUsage.percentage}%)
487
+
488
+ **Estimated Cost**:
489
+ - Input: $${G.cost.input}
490
+ - Output: $${G.cost.output}
491
+ - **Total**: $${G.cost.total}
492
+
493
+ **Model**: ${G.model}`;R(te=>[...te,{role:"assistant",content:H,timestamp:Date.now()}]);break}case"status":{const H=`**System Status**
494
+
495
+ - Version: ${G.version}
496
+ - Uptime: ${G.uptime}
497
+ - Model: ${G.model}
498
+ - Provider: ${G.provider}
499
+ - Node.js: ${G.nodeVersion}
500
+ - Platform: ${G.platform}`;R(te=>[...te,{role:"assistant",content:H,timestamp:Date.now()}]);break}case"memory":G.error?R(H=>[...H,{role:"assistant",content:`⚠️ ${G.message}`,timestamp:Date.now()}]):(R(H=>[...H,{role:"assistant",content:`📝 ${G.message}
501
+
502
+ Path: \`${G.path}\``,timestamp:Date.now()}]),G.exists&&i&&i(G.path));break;case"config":g&&g();break;case"rewind":G.error?R(H=>[...H,{role:"assistant",content:`⚠️ ${G.message}`,timestamp:Date.now()}]):(R(H=>H.slice(0,-G.steps*2)),R(H=>[...H,{role:"assistant",content:`⏪ ${G.message}`,timestamp:Date.now()}]));break;default:console.warn("Unknown built-in command action:",K)}},[i,g]),Rs=f.useRef(null),uu=f.useCallback(async(S,K)=>{const{content:G,hasBashCommands:H,hasFileIncludes:te}=S;if(H&&!window.confirm("This command contains bash commands that will be executed. Do you want to proceed?")){R(Ae=>[...Ae,{role:"assistant",content:"❌ Command execution cancelled",timestamp:Date.now()}]);return}U(G),setTimeout(()=>{if(Rs.current){const Se={preventDefault:()=>{}};Rs.current(Se)}},50)},[]),Pi=f.useCallback(async S=>{if(!(!S||!e))try{const K=L.match(new RegExp(`${S.name}\\s*(.*)`)),G=K&&K[1]?K[1].trim().split(/\s+/):[],H={projectPath:e.path,projectName:e.name,sessionId:C,provider:ht,model:ht==="cursor"?Gr:"claude-sonnet-4.5",tokenUsage:Mt},te=await Fe("/api/commands/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandName:S.name,commandPath:S.path,args:G,context:H})});if(!te.ok)throw new Error("Failed to execute command");const Se=await te.json();Se.type==="builtin"?du(Se):Se.type==="custom"&&await uu(Se,G),U(""),E(!1),A(-1),St(""),Tt(-1)}catch(K){console.error("Error executing command:",K),R(G=>[...G,{role:"assistant",content:`Error executing command: ${K.message}`,timestamp:Date.now()}])}},[L,e,C,ht,Gr,Mt]),mu=f.useMemo(()=>{const S=new Map;return(K,G)=>{const H=`${K.length}-${G.length}-${K.slice(0,50)}`;if(S.has(H))return S.get(H);const te=pu(K,G);if(S.set(H,te),S.size>100){const Se=S.keys().next().value;S.delete(Se)}return te}},[]),gn=f.useCallback(async(S,K,G=!1)=>{if(!S||!K)return[];const H=!G;H?ue(!0):w(!0);try{const te=G?J:0,Se=await Ue.sessionMessages(S,K,le,te);if(!Se.ok)throw new Error("Failed to load session messages");const Ae=await Se.json();if(Ae.hasMore!==void 0)return re(Ae.hasMore),X(Ae.total),he(te+(Ae.messages?.length||0)),Ae.messages||[];{const Ye=Ae.messages||[];return re(!1),X(Ye.length),Ye}}catch(te){return console.error("Error loading session messages:",te),[]}finally{H?ue(!1):w(!1)}},[J]),Vn=f.useCallback(async(S,K)=>{if(!S||!K)return[];ue(!0);try{const G=`/api/cursor/sessions/${encodeURIComponent(K)}?projectPath=${encodeURIComponent(S)}`,H=await Fe(G);if(!H.ok)return[];const Se=(await H.json())?.session?.messages||[],Ae=[],Ye={};for(let Te=0;Te<Se.length;Te++){const Y=Se[Te],be=Y.content;let We="",rt="assistant",Ze=null;try{if(be?.role&&be?.content){if(be.role==="system")continue;if(be.role==="tool"){if(Array.isArray(be.content)){for(const Ve of be.content)if(Ve?.type==="tool-result"){let Je=Ve.toolName||"Unknown Tool";Je==="ApplyPatch"&&(Je="Edit");const Qt=Ve.toolCallId||be.id,kr=Ve.result||"";Ye[Qt]?Ye[Qt].toolResult={content:kr,isError:!1}:Ae.push({type:"assistant",content:"",timestamp:new Date(Date.now()+Te*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid,isToolUse:!0,toolName:Je,toolId:Qt,toolInput:null,toolResult:{content:kr,isError:!1}})}}continue}else if(rt=be.role==="user"?"user":"assistant",Array.isArray(be.content)){const Ve=[];for(const Je of be.content)if(Je?.type==="text"&&Je?.text)Ve.push(Nr(Je.text));else if(Je?.type==="reasoning"&&Je?.text)Ze=Nr(Je.text);else if(Je?.type==="tool-call"){(Ve.length>0||Ze)&&(Ae.push({type:rt,content:Ve.join(`
503
+ `),reasoning:Ze,timestamp:new Date(Date.now()+Te*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid}),Ve.length=0,Ze=null);let Qt=Je.toolName||"Unknown Tool";Qt==="ApplyPatch"&&(Qt="Edit");const kr=Je.toolCallId||`tool_${Te}`;let mr=Je.args;if(Qt==="Edit"&&Je.args)if(Je.args.patch){const rr=Je.args.patch.split(`
504
+ `);let xn=[],Fs=[],$i=!1;for(const vr of rr)vr.startsWith("@@")?$i=!0:$i&&(vr.startsWith("-")?xn.push(vr.substring(1)):vr.startsWith("+")?Fs.push(vr.substring(1)):vr.startsWith(" ")&&(xn.push(vr.substring(1)),Fs.push(vr.substring(1))));const Jn=Je.args.file_path;mr={file_path:Jn&&!Jn.startsWith("/")?`${S}/${Jn}`:Jn,old_string:xn.join(`
505
+ `)||Je.args.patch,new_string:Fs.join(`
506
+ `)||Je.args.patch}}else mr=Je.args;else if(Qt==="Read"&&Je.args){const rr=Je.args.path||Je.args.file_path;mr={file_path:rr&&!rr.startsWith("/")?`${S}/${rr}`:rr}}else if(Qt==="Write"&&Je.args){const rr=Je.args.path||Je.args.file_path;mr={file_path:rr&&!rr.startsWith("/")?`${S}/${rr}`:rr,content:Je.args.contents||Je.args.content}}const Fi={type:"assistant",content:"",timestamp:new Date(Date.now()+Te*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid,isToolUse:!0,toolName:Qt,toolId:kr,toolInput:mr?JSON.stringify(mr):null,toolResult:null};Ae.push(Fi),Ye[kr]=Fi}else if(Je?.type==="tool_use"){(Ve.length>0||Ze)&&(Ae.push({type:rt,content:Ve.join(`
507
+ `),reasoning:Ze,timestamp:new Date(Date.now()+Te*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid}),Ve.length=0,Ze=null);const Qt=Je.name||"Unknown Tool",kr=Je.id||`tool_${Te}`,mr={type:"assistant",content:"",timestamp:new Date(Date.now()+Te*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid,isToolUse:!0,toolName:Qt,toolId:kr,toolInput:Je.input?JSON.stringify(Je.input):null,toolResult:null};Ae.push(mr),Ye[kr]=mr}else typeof Je=="string"&&Ve.push(Je);Ve.length>0?(We=Ve.join(`
508
+ `),Ze&&!We&&(Ae.push({type:rt,content:"",reasoning:Ze,timestamp:new Date(Date.now()+Te*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid}),We="")):We=""}else typeof be.content=="string"&&(We=be.content)}else if(be?.message?.role&&be?.message?.content){if(be.message.role==="system")continue;rt=be.message.role==="user"?"user":"assistant",Array.isArray(be.message.content)?We=be.message.content.map(Ve=>typeof Ve=="string"?Ve:Ve?.text||"").filter(Boolean).join(`
509
+ `):typeof be.message.content=="string"&&(We=be.message.content)}}catch(Ve){console.log("Error parsing blob content:",Ve)}if(We&&We.trim()){const Ve={type:rt,content:We,timestamp:new Date(Date.now()+Te*1e3),blobId:Y.id,sequence:Y.sequence,rowid:Y.rowid};Ze&&(Ve.reasoning=Ze),Ae.push(Ve)}}return Ae.sort((Te,Y)=>Te.sequence!==void 0&&Y.sequence!==void 0?Te.sequence-Y.sequence:Te.rowid!==void 0&&Y.rowid!==void 0?Te.rowid-Y.rowid:new Date(Te.timestamp)-new Date(Y.timestamp)),Ae}catch(G){return console.error("Error loading Cursor session messages:",G),[]}finally{ue(!1)}},[]),pu=(S,K)=>{const G=S.split(`
510
+ `),H=K.split(`
511
+ `),te=[];let Se=0,Ae=0;for(;Se<G.length||Ae<H.length;){const Ye=G[Se],Te=H[Ae];Se>=G.length?(te.push({type:"added",content:Te,lineNum:Ae+1}),Ae++):Ae>=H.length?(te.push({type:"removed",content:Ye,lineNum:Se+1}),Se++):Ye===Te?(Se++,Ae++):(te.push({type:"removed",content:Ye,lineNum:Se+1}),te.push({type:"added",content:Te,lineNum:Ae+1}),Se++,Ae++)}return te},hu=S=>{const K=[],G=new Map;for(const H of S)if(H.message?.role==="user"&&Array.isArray(H.message?.content))for(const te of H.message.content)te.type==="tool_result"&&G.set(te.tool_use_id,{content:te.content,isError:te.is_error,timestamp:new Date(H.timestamp||Date.now()),toolUseResult:H.toolUseResult||null});for(const H of S)if(H.message?.role==="user"&&H.message?.content){let te="",Se="user";if(Array.isArray(H.message.content)){const Ye=[];for(const Te of H.message.content)Te.type==="text"&&Ye.push(Nr(Te.text));te=Ye.join(`
512
+ `)}else typeof H.message.content=="string"?te=Nr(H.message.content):te=Nr(String(H.message.content));!te||te.startsWith("<command-name>")||te.startsWith("<command-message>")||te.startsWith("<command-args>")||te.startsWith("<local-command-stdout>")||te.startsWith("<system-reminder>")||te.startsWith("Caveat:")||te.startsWith("This session is being continued from a previous")||te.startsWith("[Request interrupted")||(te=te.replace(/\\n/g,`
513
+ `).replace(/\\t/g," ").replace(/\\r/g,"\r"),K.push({type:Se,content:te,timestamp:H.timestamp||new Date().toISOString()}))}else if(H.message?.role==="assistant"&&H.message?.content){if(Array.isArray(H.message.content)){for(const te of H.message.content)if(te.type==="text"){let Se=te.text;typeof Se=="string"&&(Se=Se.replace(/\\n/g,`
514
+ `).replace(/\\t/g," ").replace(/\\r/g,"\r")),K.push({type:"assistant",content:Se,timestamp:H.timestamp||new Date().toISOString()})}else if(te.type==="tool_use"){const Se=G.get(te.id);K.push({type:"assistant",content:"",timestamp:H.timestamp||new Date().toISOString(),isToolUse:!0,toolName:te.name,toolInput:JSON.stringify(te.input),toolResult:Se?{content:typeof Se.content=="string"?Se.content:JSON.stringify(Se.content),isError:Se.isError,toolUseResult:Se.toolUseResult}:null,toolError:Se?.isError||!1,toolResultTimestamp:Se?.timestamp||new Date})}}else if(typeof H.message.content=="string"){let te=H.message.content;te=te.replace(/\\n/g,`
515
+ `).replace(/\\t/g," ").replace(/\\r/g,"\r"),K.push({type:"assistant",content:te,timestamp:H.timestamp||new Date().toISOString()})}}return K},Li=f.useMemo(()=>hu(F),[F]),ur=f.useCallback(()=>{Q.current&&(Q.current.scrollTop=Q.current.scrollHeight)},[]),Gn=f.useCallback(()=>{if(!Q.current)return!1;const{scrollTop:S,scrollHeight:K,clientHeight:G}=Q.current;return K-S-G<50},[]),_s=f.useCallback(async()=>{if(Q.current){const S=Q.current,K=Gn();Jt(!K);const G=S.scrollTop<100,H=localStorage.getItem("selected-provider")||"claude";if(G&&ye&&!fe&&r&&e&&H!=="cursor"){const te=S.scrollHeight,Se=S.scrollTop,Ae=await gn(e.name,r.id,!0);Ae.length>0&&(ce(Ye=>[...Ae,...Ye]),setTimeout(()=>{if(Q.current){const Te=Q.current.scrollHeight-te;Q.current.scrollTop=Se+Te}},0))}}},[Gn,ye,fe,r,e,gn]);f.useEffect(()=>{(async()=>{if(r&&e){const K=localStorage.getItem("selected-provider")||"claude";if(de.current=!0,C!==null&&C!==r.id?(he(0),re(!1),X(0),_t(null),_(!1),n&&s&&s({type:"check-session-status",sessionId:r.id,provider:K})):C===null&&(he(0),re(!1),X(0),n&&s&&s({type:"check-session-status",sessionId:r.id,provider:K})),K==="cursor")if(V(r.id),sessionStorage.setItem("cursorSessionId",r.id),ke)ge(!1);else{const H=e.fullPath||e.path,te=await Vn(H,r.id);ce([]),R(te)}else if(V(r.id),ke)ge(!1);else{const H=await gn(e.name,r.id,!1);ce(H)}}else!ke&&!D&&(R([]),ce([])),V(null),sessionStorage.removeItem("cursorSessionId"),he(0),re(!1),X(0);setTimeout(()=>{de.current=!1},250)})()},[r,e,Vn,ur,ke]),f.useEffect(()=>{P>0&&r&&e&&(async()=>{try{if((localStorage.getItem("selected-provider")||"claude")==="cursor"){const G=e.fullPath||e.path,H=await Vn(G,r.id);ce([]),R(H)}else{const G=await gn(e.name,r.id,!1);ce(G),Gn&&N&&setTimeout(()=>ur(),200)}}catch(K){console.error("Error reloading messages from external update:",K)}})()},[P,r,e,Vn,gn,Gn,N,ur]),f.useEffect(()=>{F.length>0&&R(Li)},[Li,F]),f.useEffect(()=>{o&&o(z)},[z,o]),f.useEffect(()=>{e&&L!==""?zt.setItem(`draft_input_${e.name}`,L):e&&L===""&&zt.removeItem(`draft_input_${e.name}`)},[L,e]),f.useEffect(()=>{e&&j.length>0&&zt.setItem(`chat_messages_${e.name}`,JSON.stringify(j))},[j,e]),f.useEffect(()=>{if(e){const S=zt.getItem(`draft_input_${e.name}`)||"";S!==L&&U(S)}},[e?.name]),f.useEffect(()=>{C&&D&&d&&d(C)},[D,C,d]),f.useEffect(()=>{C&&m&&m.has(C)&&!D&&(_(!0),Nt(!0))},[C,m]),f.useEffect(()=>{if(a.length>0){const S=a[a.length-1];if(!["projects_updated","taskmaster-project-updated","session-created","claude-complete"].includes(S.type)&&S.sessionId&&C&&S.sessionId!==C){console.log("⏭️ Skipping message for different session:",S.sessionId,"current:",C);return}switch(S.type){case"session-created":S.sessionId&&!C&&(sessionStorage.setItem("pendingSessionId",S.sessionId),h&&h(S.sessionId));break;case"token-budget":break;case"claude-response":const H=S.data.message||S.data;if(H&&typeof H=="object"&&H.type){if(H.type==="content_block_delta"&&H.delta?.text){const Y=Nr(H.delta.text);T.current+=Y,O.current||(O.current=setTimeout(()=>{const be=T.current;T.current="",O.current=null,be&&R(We=>{const rt=[...We],Ze=rt[rt.length-1];return Ze&&Ze.type==="assistant"&&!Ze.isToolUse&&Ze.isStreaming?Ze.content=(Ze.content||"")+be:rt.push({type:"assistant",content:be,timestamp:new Date,isStreaming:!0}),rt})},100));return}if(H.type==="content_block_stop"){O.current&&(clearTimeout(O.current),O.current=null);const Y=T.current;T.current="",Y&&R(be=>{const We=[...be],rt=We[We.length-1];return rt&&rt.type==="assistant"&&!rt.isToolUse&&rt.isStreaming?rt.content=(rt.content||"")+Y:We.push({type:"assistant",content:Y,timestamp:new Date,isStreaming:!0}),We}),R(be=>{const We=[...be],rt=We[We.length-1];return rt&&rt.type==="assistant"&&rt.isStreaming&&(rt.isStreaming=!1),We});return}}if(S.data.type==="system"&&S.data.subtype==="init"&&S.data.session_id&&C&&S.data.session_id!==C){console.log("🔄 Claude CLI session duplication detected:",{originalSession:C,newSession:S.data.session_id}),ge(!0),p&&p(S.data.session_id);return}if(S.data.type==="system"&&S.data.subtype==="init"&&S.data.session_id&&!C){console.log("🔄 New session init detected:",{newSession:S.data.session_id}),ge(!0),p&&p(S.data.session_id);return}if(S.data.type==="system"&&S.data.subtype==="init"&&S.data.session_id&&C&&S.data.session_id===C){console.log("🔄 System init message for current session, ignoring");return}if(Array.isArray(H.content)){for(const Y of H.content)if(Y.type==="tool_use"){const be=Y.input?JSON.stringify(Y.input,null,2):"";R(We=>[...We,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:Y.name,toolInput:be,toolId:Y.id,toolResult:null}])}else if(Y.type==="text"&&Y.text?.trim()){let be=Nr(Y.text);be=Ga(be),R(We=>[...We,{type:"assistant",content:be,timestamp:new Date}])}}else if(typeof H.content=="string"&&H.content.trim()){let Y=Nr(H.content);Y=Ga(Y),R(be=>[...be,{type:"assistant",content:Y,timestamp:new Date}])}if(H.role==="user"&&Array.isArray(H.content))for(const Y of H.content)Y.type==="tool_result"&&R(be=>be.map(We=>We.isToolUse&&We.toolId===Y.tool_use_id?{...We,toolResult:{content:Y.content,isError:Y.is_error,timestamp:new Date}}:We));break;case"claude-output":{const Y=String(S.data||"");Y.trim()&&(T.current+=T.current?`
516
+ ${Y}`:Y,O.current||(O.current=setTimeout(()=>{const be=T.current;T.current="",O.current=null,be&&R(We=>{const rt=[...We],Ze=rt[rt.length-1];return Ze&&Ze.type==="assistant"&&!Ze.isToolUse&&Ze.isStreaming?Ze.content=Ze.content?`${Ze.content}
517
+ ${be}`:be:rt.push({type:"assistant",content:be,timestamp:new Date,isStreaming:!0}),rt})},100)))}break;case"claude-interactive-prompt":R(Y=>[...Y,{type:"assistant",content:S.data,timestamp:new Date,isInteractivePrompt:!0}]);break;case"claude-error":R(Y=>[...Y,{type:"error",content:`Error: ${S.error}`,timestamp:new Date}]);break;case"cursor-system":try{const Y=S.data;if(Y&&Y.type==="system"&&Y.subtype==="init"&&Y.session_id){if(C&&Y.session_id!==C){console.log("🔄 Cursor session switch detected:",{originalSession:C,newSession:Y.session_id}),ge(!0),p&&p(Y.session_id);return}if(!C){console.log("🔄 Cursor new session init detected:",{newSession:Y.session_id}),ge(!0),p&&p(Y.session_id);return}}}catch(Y){console.warn("Error handling cursor-system message:",Y)}break;case"cursor-user":break;case"cursor-tool-use":R(Y=>[...Y,{type:"assistant",content:`Using tool: ${S.tool} ${S.input?`with ${S.input}`:""}`,timestamp:new Date,isToolUse:!0,toolName:S.tool,toolInput:S.input}]);break;case"cursor-error":R(Y=>[...Y,{type:"error",content:`Cursor error: ${S.error||"Unknown error"}`,timestamp:new Date}]);break;case"cursor-result":const te=S.sessionId||C;if(te===C&&(_(!1),Nt(!1),pt(null)),te&&(c&&c(te),u&&u(te)),te===C)try{const Y=S.data||{},be=typeof Y.result=="string"?Y.result:"";O.current&&(clearTimeout(O.current),O.current=null);const We=T.current;T.current="",R(rt=>{const Ze=[...rt],Ve=Ze[Ze.length-1];if(Ve&&Ve.type==="assistant"&&!Ve.isToolUse&&Ve.isStreaming){const Je=be&&be.trim()?be:(Ve.content||"")+(We||"");Ve.content=Je,Ve.isStreaming=!1}else be&&be.trim()&&Ze.push({type:Y.is_error?"error":"assistant",content:be,timestamp:new Date,isStreaming:!1});return Ze})}catch(Y){console.warn("Error handling cursor-result message:",Y)}const Se=sessionStorage.getItem("pendingSessionId");te&&!C&&te===Se&&(V(te),sessionStorage.removeItem("pendingSessionId"),window.refreshProjects&&setTimeout(()=>window.refreshProjects(),500));break;case"cursor-output":try{const be=String(S.data??"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"").trim();be&&(T.current+=T.current?`
518
+ ${be}`:be,O.current||(O.current=setTimeout(()=>{const We=T.current;T.current="",O.current=null,We&&R(rt=>{const Ze=[...rt],Ve=Ze[Ze.length-1];return Ve&&Ve.type==="assistant"&&!Ve.isToolUse&&Ve.isStreaming?Ve.content=Ve.content?`${Ve.content}
519
+ ${We}`:We:Ze.push({type:"assistant",content:We,timestamp:new Date,isStreaming:!0}),Ze})},100)))}catch(Y){console.warn("Error handling cursor-output message:",Y)}break;case"claude-complete":const Ae=S.sessionId||C||sessionStorage.getItem("pendingSessionId");(Ae===C||!C)&&(_(!1),Nt(!1),pt(null),e&&r?.id&&(async()=>{try{const be=`/api/projects/${e.name}/sessions/${r.id}/token-usage`,We=await Fe(be);if(We.ok){const rt=await We.json();_t(rt)}}catch(be){console.error("Failed to fetch updated token usage:",be)}})()),Ae&&(c&&c(Ae),u&&u(Ae));const Ye=sessionStorage.getItem("pendingSessionId");Ye&&!C&&S.exitCode===0&&(V(Ye),sessionStorage.removeItem("pendingSessionId"),console.log("✅ New session complete, ID set to:",Ye)),e&&S.exitCode===0&&zt.removeItem(`chat_messages_${e.name}`);break;case"session-aborted":{const Y=S.sessionId||C;Y===C&&(_(!1),Nt(!1),pt(null)),Y&&(c&&c(Y),u&&u(Y)),R(be=>[...be,{type:"assistant",content:"Session interrupted by user.",timestamp:new Date}]);break}case"session-status":{const Y=S.sessionId;(Y===C||r&&Y===r.id)&&S.isProcessing&&(_(!0),Nt(!0),d&&d(Y));break}case"claude-status":const Te=S.data;if(Te){let Y={text:"Working...",tokens:0,can_interrupt:!0};Te.message?Y.text=Te.message:Te.status?Y.text=Te.status:typeof Te=="string"&&(Y.text=Te),Te.tokens?Y.tokens=Te.tokens:Te.token_count&&(Y.tokens=Te.token_count),Te.can_interrupt!==void 0&&(Y.can_interrupt=Te.can_interrupt),pt(Y),_(!0),Nt(Y.can_interrupt)}break}}},[a]),f.useEffect(()=>{e&&fu()},[e]);const fu=async()=>{try{const S=await Ue.getFiles(e.name);if(S.ok){const K=await S.json(),G=Ri(K);we(G)}}catch(S){console.error("Error fetching files:",S)}},Ri=(S,K="")=>{let G=[];for(const H of S){const te=K?`${K}/${H.name}`:H.name;H.type==="directory"&&H.children?G=G.concat(Ri(H.children,te)):H.type==="file"&&G.push({name:H.name,path:te,relativePath:H.path})}return G};f.useEffect(()=>{const S=L.slice(0,gt),K=S.lastIndexOf("@");if(K!==-1){const G=S.slice(K+1);if(G.includes(" "))me(!1),Gt(-1);else{Gt(K),me(!0);const H=oe.filter(te=>te.name.toLowerCase().includes(G.toLowerCase())||te.path.toLowerCase().includes(G.toLowerCase())).slice(0,10);Be(H),Xe(-1)}}else me(!1),Gt(-1)},[L,gt,oe]),f.useEffect(()=>{const S=setTimeout(()=>{De(L)},150);return()=>clearTimeout(S)},[L]);const _i=f.useMemo(()=>j.length<=ie?j:j.slice(-ie),[j,ie]);f.useEffect(()=>{if(!N&&Q.current){const S=Q.current;Rt.current={height:S.scrollHeight,top:S.scrollTop}}}),f.useEffect(()=>{if(Q.current&&j.length>0)if(N)Wt||setTimeout(()=>ur(),50);else{const S=Q.current,K=Rt.current.height,G=Rt.current.top,te=S.scrollHeight-K;te>0&&G>0&&(S.scrollTop=G+te)}},[j.length,Wt,ur,N]),f.useEffect(()=>{Q.current&&j.length>0&&!de.current&&(Jt(!1),setTimeout(()=>{ur()},200))},[r?.id,e?.name]),f.useEffect(()=>{const S=Q.current;if(S)return S.addEventListener("scroll",_s),()=>S.removeEventListener("scroll",_s)},[_s]),f.useEffect(()=>{if(ve.current){ve.current.style.height="auto",ve.current.style.height=ve.current.scrollHeight+"px";const S=parseInt(window.getComputedStyle(ve.current).lineHeight),K=ve.current.scrollHeight>S*2;wt(K)}},[]),f.useEffect(()=>{ve.current&&!L.trim()&&(ve.current.style.height="auto",wt(!1))},[L]),f.useEffect(()=>{if(!e||!r?.id||r.id.startsWith("new-session-")){_t(null);return}(async()=>{try{const K=`/api/projects/${e.name}/sessions/${r.id}/token-usage`,G=await Fe(K);if(G.ok){const H=await G.json();_t(H)}else _t(null)}catch(K){console.error("Failed to fetch initial token usage:",K)}})()},[r?.id,e?.path]);const gu=f.useCallback(S=>{S.trim()&&U(K=>{const G=K.trim()?`${K} ${S}`:S;return setTimeout(()=>{if(ve.current){ve.current.style.height="auto",ve.current.style.height=ve.current.scrollHeight+"px";const H=parseInt(window.getComputedStyle(ve.current).lineHeight),te=ve.current.scrollHeight>H*2;wt(te)}},0),G})},[]),xu=f.useCallback(()=>{Oe(S=>S+100)},[]),Kn=f.useCallback(S=>{const K=S.filter(G=>{try{if(!G||typeof G!="object")return console.warn("Invalid file object:",G),!1;if(!G.type||!G.type.startsWith("image/"))return!1;if(!G.size||G.size>5242880){const H=G.name||"Unknown file";return qe(te=>{const Se=new Map(te);return Se.set(H,"File too large (max 5MB)"),Se}),!1}return!0}catch(H){return console.error("Error validating file:",H,G),!1}});K.length>0&&st(G=>[...G,...K].slice(0,5))},[]),bu=f.useCallback(async S=>{const K=Array.from(S.clipboardData.items);for(const G of K)if(G.type.startsWith("image/")){const H=G.getAsFile();H&&Kn([H])}if(K.length===0&&S.clipboardData.files.length>0){const H=Array.from(S.clipboardData.files).filter(te=>te.type.startsWith("image/"));H.length>0&&Kn(H)}},[Kn]),{getRootProps:yu,getInputProps:ku,isDragActive:vu,open:wu}=Ad({accept:{"image/*":[".png",".jpg",".jpeg",".gif",".webp",".svg"]},maxSize:5*1024*1024,maxFiles:5,onDrop:Kn,noClick:!0,noKeyboard:!0}),Dr=f.useCallback(async S=>{if(S.preventDefault(),!L.trim()||D||!e)return;let K=[];if(et.length>0){const Ye=new FormData;et.forEach(Te=>{Ye.append("images",Te)});try{const Te=zt.getItem("auth-token"),Y={};Te&&(Y.Authorization=`Bearer ${Te}`);const be=await fetch(`/api/projects/${e.name}/upload-images`,{method:"POST",headers:Y,body:Ye});if(!be.ok)throw new Error("Failed to upload images");K=(await be.json()).images}catch(Te){console.error("Image upload failed:",Te),R(Y=>[...Y,{type:"error",content:`Failed to upload images: ${Te.message}`,timestamp:new Date}]);return}}const G={type:"user",content:L,images:K,timestamp:new Date};R(Ye=>[...Ye,G]),_(!0),Nt(!0),pt({text:"Processing",tokens:0,can_interrupt:!0}),Jt(!1),setTimeout(()=>ur(),100);const H=C||r?.id||sessionStorage.getItem("cursorSessionId"),te=H||`new-session-${Date.now()}`;l&&l(te);const Ae=(()=>{try{const Ye=ht==="cursor"?"cursor-tools-settings":"claude-settings",Te=zt.getItem(Ye);if(Te)return JSON.parse(Te)}catch(Ye){console.error("Error loading tools settings:",Ye)}return{allowedTools:[],disallowedTools:[],skipPermissions:!1}})();s(ht==="cursor"?{type:"cursor-command",command:L,sessionId:H,options:{cwd:e.fullPath||e.path,projectPath:e.fullPath||e.path,sessionId:H,resume:!!H,model:Gr,skipPermissions:Ae?.skipPermissions||!1,toolsSettings:Ae}}:{type:"claude-command",command:L,options:{projectPath:e.path,cwd:e.fullPath,sessionId:C,resume:!!C,toolsSettings:Ae,permissionMode:Ie,images:K}}),U(""),st([]),tt(new Map),qe(new Map),wt(!1),ve.current&&(ve.current.style.height="auto"),e&&zt.removeItem(`draft_input_${e.name}`)},[L,D,e,et,C,r,ht,Ie,l,Gr,s,U,st,tt,qe,wt,ve,R,_,Nt,pt,Jt,ur]);f.useEffect(()=>{Rs.current=Dr},[Dr]);const zi=S=>{if(!S)return;const K=L.slice(0,qn),G=L.slice(qn),H=G.indexOf(" "),te=H!==-1?G.slice(H):"",Se=K+S.name+" "+te;U(Se),E(!1),A(-1),St(""),Tt(-1),ne.current&&clearTimeout(ne.current),Pi(S)},ju=S=>{if(I&&q.length>0){if(S.key==="ArrowDown"){S.preventDefault(),Tt(K=>K<q.length-1?K+1:0);return}if(S.key==="ArrowUp"){S.preventDefault(),Tt(K=>K>0?K-1:q.length-1);return}if(S.key==="Tab"||S.key==="Enter"){S.preventDefault(),xt>=0?zi(q[xt]):q.length>0&&zi(q[0]);return}if(S.key==="Escape"){S.preventDefault(),E(!1),A(-1),St(""),Tt(-1),ne.current&&clearTimeout(ne.current);return}}if(ee&&Ee.length>0){if(S.key==="ArrowDown"){S.preventDefault(),Xe(K=>K<Ee.length-1?K+1:0);return}if(S.key==="ArrowUp"){S.preventDefault(),Xe(K=>K>0?K-1:Ee.length-1);return}if(S.key==="Tab"||S.key==="Enter"){S.preventDefault(),ze>=0?zs(Ee[ze]):Ee.length>0&&zs(Ee[0]);return}if(S.key==="Escape"){S.preventDefault(),me(!1);return}}if(S.key==="Tab"&&!ee&&!I){S.preventDefault();const K=["default","acceptEdits","bypassPermissions","plan"],H=(K.indexOf(Ie)+1)%K.length,te=K[H];Ke(te),r?.id&&localStorage.setItem(`permissionMode-${r.id}`,te);return}if(S.key==="Enter"){if(S.nativeEvent.isComposing)return;(S.ctrlKey||S.metaKey)&&!S.shiftKey?(S.preventDefault(),Dr(S)):!S.shiftKey&&!S.ctrlKey&&!S.metaKey&&(y||(S.preventDefault(),Dr(S)))}},zs=S=>{const K=L.slice(0,vt),G=L.slice(vt),H=G.indexOf(" "),te=H!==-1?G.slice(H):"",Se=K+"@"+S.path+" "+te,Ae=K.length+1+S.path.length+1;ve.current&&!ve.current.matches(":focus")&&ve.current.focus(),U(Se),ot(Ae),me(!1),Gt(-1),ve.current&&requestAnimationFrame(()=>{ve.current&&(ve.current.setSelectionRange(Ae,Ae),ve.current.matches(":focus")||ve.current.focus())})},Nu=S=>{const K=S.target.value,G=S.target.selectionStart;if(!C&&K.trim(),U(K),ot(G),!K.trim()){S.target.style.height="auto",wt(!1),E(!1),A(-1),St("");return}const H=K.slice(0,G);if((H.match(/```/g)||[]).length%2===1){E(!1),A(-1),St("");return}const Ae=/(^|\s)\/(\S*)$/,Ye=H.match(Ae);if(Ye){const Te=Ye.index+Ye[1].length,Y=Ye[2];A(Te),E(!0),Tt(-1),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>{St(Y)},150)}else E(!1),A(-1),St(""),ne.current&&clearTimeout(ne.current)},Cu=S=>{ot(S.target.selectionStart)},Su=()=>{C&&Kt&&s({type:"abort-session",sessionId:C,provider:ht})},Eu=()=>{const S=["default","acceptEdits","bypassPermissions","plan"],G=(S.indexOf(Ie)+1)%S.length,H=S[G];Ke(H),r?.id&&localStorage.setItem(`permissionMode-${r.id}`,H)};return e?t.jsxs(t.Fragment,{children:[t.jsx("style",{children:`
520
+ details[open] .details-chevron {
521
+ transform: rotate(180deg);
522
+ }
523
+ `}),t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{ref:Q,className:"flex-1 overflow-y-auto overflow-x-hidden px-0 py-3 sm:p-4 space-y-3 sm:space-y-4 relative",children:[v&&j.length===0?t.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-8",children:t.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[t.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),t.jsx("p",{children:"Loading session messages..."})]})}):j.length===0?t.jsxs("div",{className:"flex items-center justify-center h-full",children:[!r&&!C&&t.jsxs("div",{className:"text-center px-6 sm:px-4 py-8",children:[t.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:"Choose Your AI Assistant"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-8",children:"Select a provider to start a new conversation"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center mb-8",children:[t.jsxs("button",{onClick:()=>{Yt("claude"),localStorage.setItem("selected-provider","claude"),setTimeout(()=>ve.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${ht==="claude"?"border-blue-500 shadow-lg ring-2 ring-blue-500/20":"border-gray-200 dark:border-gray-700 hover:border-blue-400"}`,children:[t.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[t.jsx(lr,{className:"w-10 h-10"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Claude"}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"by Anthropic"})]})]}),ht==="claude"&&t.jsx("div",{className:"absolute top-2 right-2",children:t.jsx("div",{className:"w-5 h-5 bg-blue-500 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]}),t.jsxs("button",{onClick:()=>{Yt("cursor"),localStorage.setItem("selected-provider","cursor"),setTimeout(()=>ve.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${ht==="cursor"?"border-purple-500 shadow-lg ring-2 ring-purple-500/20":"border-gray-200 dark:border-gray-700 hover:border-purple-400"}`,children:[t.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[t.jsx(hr,{className:"w-10 h-10"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Cursor"}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"AI Code Editor"})]})]}),ht==="cursor"&&t.jsx("div",{className:"absolute top-2 right-2",children:t.jsx("div",{className:"w-5 h-5 bg-purple-500 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]})]}),t.jsxs("div",{className:`mb-6 transition-opacity duration-200 ${ht==="cursor"?"opacity-100":"opacity-0 pointer-events-none"}`,children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:ht==="cursor"?"Select Model":" "}),t.jsxs("select",{value:Gr,onChange:S=>{const K=S.target.value;Di(K),localStorage.setItem("cursor-model",K)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 min-w-[140px]",disabled:ht!=="cursor",children:[t.jsx("option",{value:"gpt-5",children:"GPT-5"}),t.jsx("option",{value:"sonnet-4",children:"Sonnet-4"}),t.jsx("option",{value:"opus-4.1",children:"Opus 4.1"})]})]}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:ht==="claude"?"Ready to use Claude AI. Start typing your message below.":ht==="cursor"?`Ready to use Cursor with ${Gr}. Start typing your message below.`:"Select a provider above to begin"}),ht&&B&&t.jsx("div",{className:"mt-4 px-4 sm:px-0",children:t.jsx(ll,{onStartTask:()=>U("Start the next task"),onShowAllTasks:M})})]}),r&&t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 px-6 sm:px-4",children:[t.jsx("p",{className:"font-bold text-lg sm:text-xl mb-3",children:"Continue your conversation"}),t.jsx("p",{className:"text-sm sm:text-base leading-relaxed",children:"Ask questions about your code, request changes, or get help with development tasks"}),B&&t.jsx("div",{className:"mt-4 px-4 sm:px-0",children:t.jsx(ll,{onStartTask:()=>U("Start the next task"),onShowAllTasks:M})})]})]}):t.jsxs(t.Fragment,{children:[fe&&t.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 py-3",children:t.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[t.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),t.jsx("p",{className:"text-sm",children:"Loading older messages..."})]})}),ye&&!fe&&t.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:Pe>0&&t.jsxs("span",{children:["Showing ",F.length," of ",Pe," messages •",t.jsx("span",{className:"text-xs",children:"Scroll up to load more"})]})}),!ye&&j.length>ie&&t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:["Showing last ",ie," messages (",j.length," total) •",t.jsx("button",{className:"ml-1 text-blue-600 hover:text-blue-700 underline",onClick:xu,children:"Load earlier messages"})]}),_i.map((S,K)=>{const G=K>0?_i[K-1]:null;return t.jsx(iw,{message:S,index:K,prevMessage:G,createDiff:mu,onFileOpen:i,onShowSettings:g,autoExpandTools:x,showRawParameters:b,showThinking:k,selectedProject:e},K)})]}),D&&t.jsx("div",{className:"chat-message assistant",children:t.jsxs("div",{className:"w-full",children:[t.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[t.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1 bg-transparent",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?t.jsx(hr,{className:"w-full h-full"}):t.jsx(lr,{className:"w-full h-full"})}),t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?"Cursor":"Claude"})]}),t.jsx("div",{className:"w-full text-sm text-gray-500 dark:text-gray-400 pl-3 sm:pl-0",children:t.jsxs("div",{className:"flex items-center space-x-1",children:[t.jsx("div",{className:"animate-pulse",children:"●"}),t.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.2s"},children:"●"}),t.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.4s"},children:"●"}),t.jsx("span",{className:"ml-2",children:"Thinking..."})]})})]})}),t.jsx("div",{ref:it})]}),t.jsxs("div",{className:"p-2 sm:p-4 md:p-4 flex-shrink-0 pb-2 sm:pb-4 md:pb-6",children:[t.jsx("div",{className:"flex-1",children:t.jsx(fv,{status:ut,isLoading:D,onAbort:Su,provider:ht,showThinking:k})}),t.jsx("div",{ref:Ct,className:"max-w-4xl mx-auto mb-3",children:t.jsxs("div",{className:"flex items-center justify-center gap-3",children:[t.jsx("button",{type:"button",onClick:Eu,className:`px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 ${Ie==="default"?"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-600":Ie==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 border-green-300 dark:border-green-600 hover:bg-green-100 dark:hover:bg-green-900/30":Ie==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300 border-orange-300 dark:border-orange-600 hover:bg-orange-100 dark:hover:bg-orange-900/30":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-600 hover:bg-blue-100 dark:hover:bg-blue-900/30"}`,title:"Click to change permission mode (or press Tab in input)",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:`w-2 h-2 rounded-full ${Ie==="default"?"bg-gray-500":Ie==="acceptEdits"?"bg-green-500":Ie==="bypassPermissions"?"bg-orange-500":"bg-blue-500"}`}),t.jsxs("span",{children:[Ie==="default"&&"Default Mode",Ie==="acceptEdits"&&"Accept Edits",Ie==="bypassPermissions"&&"Bypass Permissions",Ie==="plan"&&"Plan Mode"]})]})}),t.jsx(gv,{used:Mt?.used||0,total:Mt?.total||parseInt(void 0)||16e4}),L.trim()&&t.jsx("button",{type:"button",onClick:S=>{S.preventDefault(),S.stopPropagation(),U(""),ve.current&&(ve.current.style.height="auto",ve.current.focus()),wt(!1)},className:"w-8 h-8 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-full flex items-center justify-center transition-all duration-200 group shadow-sm",title:"Clear input",children:t.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300 group-hover:text-gray-800 dark:group-hover:text-gray-100 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),Wt&&j.length>0&&t.jsx("button",{onClick:ur,className:"w-8 h-8 bg-blue-600 hover:bg-blue-700 text-white rounded-full shadow-lg flex items-center justify-center transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",title:"Scroll to bottom",children:t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})}),t.jsxs("form",{onSubmit:Dr,className:"relative max-w-4xl mx-auto",children:[vu&&t.jsx("div",{className:"absolute inset-0 bg-blue-500/20 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center z-50",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4 shadow-lg",children:[t.jsx("svg",{className:"w-8 h-8 text-blue-500 mx-auto mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),t.jsx("p",{className:"text-sm font-medium",children:"Drop images here"})]})}),et.length>0&&t.jsx("div",{className:"mb-2 p-2 bg-gray-50 dark:bg-gray-800 rounded-lg",children:t.jsx("div",{className:"flex flex-wrap gap-2",children:et.map((S,K)=>t.jsx(ow,{file:S,onRemove:()=>{st(G=>G.filter((H,te)=>te!==K))},uploadProgress:ft.get(S.name),error:xe.get(S.name)},K))})}),ee&&Ee.length>0&&t.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg max-h-48 overflow-y-auto z-50 backdrop-blur-sm",children:Ee.map((S,K)=>t.jsxs("div",{className:`px-4 py-3 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 touch-manipulation ${K===ze?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,onMouseDown:G=>{G.preventDefault(),G.stopPropagation()},onClick:G=>{G.preventDefault(),G.stopPropagation(),zs(S)},children:[t.jsx("div",{className:"font-medium text-sm",children:S.name}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:S.path})]},S.path))}),t.jsx(nw,{commands:q,selectedIndex:xt,onSelect:cu,onClose:()=>{E(!1),A(-1),St(""),Tt(-1)},position:{top:ve.current?Math.max(16,ve.current.getBoundingClientRect().top-316):0,left:ve.current?ve.current.getBoundingClientRect().left:16,bottom:ve.current?window.innerHeight-ve.current.getBoundingClientRect().top+8:90},isOpen:I,frequentCommands:at?[]:lu}),t.jsxs("div",{...yu(),className:`relative bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 dark:focus-within:ring-blue-500 focus-within:border-blue-500 transition-all duration-200 overflow-hidden ${Tr?"chat-input-expanded":""}`,children:[t.jsx("input",{...ku()}),t.jsx("textarea",{ref:ve,value:L,onChange:Nu,onClick:Cu,onKeyDown:ju,onPaste:bu,onFocus:()=>Z(!0),onBlur:()=>Z(!1),onInput:S=>{S.target.style.height="auto",S.target.style.height=S.target.scrollHeight+"px",ot(S.target.selectionStart);const K=parseInt(window.getComputedStyle(S.target).lineHeight),G=S.target.scrollHeight>K*2;wt(G)},placeholder:`Type / for commands, @ for files, or ask ${ht==="cursor"?"Cursor":"Claude"} anything...`,disabled:D,className:"chat-input-placeholder block w-full pl-12 pr-20 sm:pr-40 py-1.5 sm:py-4 bg-transparent rounded-2xl focus:outline-none text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 disabled:opacity-50 resize-none min-h-[50px] sm:min-h-[80px] max-h-[40vh] sm:max-h-[300px] overflow-y-auto text-sm sm:text-base leading-[21px] sm:leading-6 transition-all duration-200",style:{height:"50px"}}),t.jsx("button",{type:"button",onClick:wu,className:"absolute left-2 top-1/2 transform -translate-y-1/2 p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Attach images",children:t.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),t.jsx("div",{className:"absolute right-16 sm:right-16 top-1/2 transform -translate-y-1/2",style:{display:"none"},children:t.jsx(Td,{onTranscript:gu,className:"w-10 h-10 sm:w-10 sm:h-10"})}),t.jsxs("button",{type:"button",onClick:()=>{const S=!I;E(S),St(""),Tt(-1),S&&_e($),ve.current&&ve.current.focus()},className:"absolute right-14 sm:right-36 top-1/2 transform -translate-y-1/2 w-10 h-10 sm:w-10 sm:h-10 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800 relative z-10",title:"Show all commands",children:[t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),$.length>0&&t.jsx("span",{className:"absolute -top-1 -right-1 bg-blue-600 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center",style:{fontSize:"10px"},children:$.length})]}),t.jsx("button",{type:"submit",disabled:!L.trim()||D,onMouseDown:S=>{S.preventDefault(),Dr(S)},onTouchStart:S=>{S.preventDefault(),Dr(S)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 w-12 h-12 sm:w-12 sm:h-12 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",children:t.jsx("svg",{className:"w-4 h-4 sm:w-5 sm:h-5 text-white transform rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})}),t.jsx("div",{className:"absolute bottom-1 left-12 right-14 sm:right-40 text-xs text-gray-400 dark:text-gray-500 pointer-events-none hidden sm:block",children:y?"Ctrl+Enter to send • Shift+Enter for new line • Tab to change modes • / for slash commands":"Enter to send • Shift+Enter for new line • Tab to change modes • / for slash commands"}),t.jsx("div",{className:`absolute bottom-1 left-12 right-14 text-xs text-gray-400 dark:text-gray-500 pointer-events-none sm:hidden transition-opacity duration-200 ${z?"opacity-100":"opacity-0"}`,children:y?"Ctrl+Enter to send • Tab for modes • / for commands":"Enter to send • Tab for modes • / for commands"})]})]})]})]})]}):t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:t.jsx("p",{children:"Select a project to start chatting with Claude"})})})}const cw=fr.memo(lw);class kt{constructor(r,n,s,a){this.fromA=r,this.toA=n,this.fromB=s,this.toB=a}offset(r,n=r){return new kt(this.fromA+r,this.toA+r,this.fromB+n,this.toB+n)}}function Hr(e,r,n,s,a,i){if(e==s)return[];let o=Ei(e,r,n,s,a,i),l=Ii(e,r+o,n,s,a+o,i);r+=o,n-=l,a+=o,i-=l;let c=n-r,d=i-a;if(!c||!d)return[new kt(r,n,a,i)];if(c>d){let m=e.slice(r,n).indexOf(s.slice(a,i));if(m>-1)return[new kt(r,r+m,a,a),new kt(r+m+d,n,i,i)]}else if(d>c){let m=s.slice(a,i).indexOf(e.slice(r,n));if(m>-1)return[new kt(r,r,a,a+m),new kt(n,n,a+m+c,i)]}if(c==1||d==1)return[new kt(r,n,a,i)];let u=Ud(e,r,n,s,a,i);if(u){let[m,h,p]=u;return Hr(e,r,m,s,a,h).concat(Hr(e,m+p,n,s,h+p,i))}return dw(e,r,n,s,a,i)}let Nn=1e9,Cn=0,Si=!1;function dw(e,r,n,s,a,i){let o=n-r,l=i-a;if(Nn<1e9&&Math.min(o,l)>Nn*16||Cn>0&&Date.now()>Cn)return Math.min(o,l)>Nn*64?[new kt(r,n,a,i)]:hl(e,r,n,s,a,i);let c=Math.ceil((o+l)/2);pa.reset(c),ha.reset(c);let d=(p,g)=>e.charCodeAt(r+p)==s.charCodeAt(a+g),u=(p,g)=>e.charCodeAt(n-p-1)==s.charCodeAt(i-g-1),m=(o-l)%2!=0?ha:null,h=m?null:pa;for(let p=0;p<c;p++){if(p>Nn||Cn>0&&!(p&63)&&Date.now()>Cn)return hl(e,r,n,s,a,i);let g=pa.advance(p,o,l,c,m,!1,d)||ha.advance(p,o,l,c,h,!0,u);if(g)return uw(e,r,n,r+g[0],s,a,i,a+g[1])}return[new kt(r,n,a,i)]}class Bd{constructor(){this.vec=[]}reset(r){this.len=r<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[r+1]=0,this.start=this.end=0}advance(r,n,s,a,i,o,l){for(let c=-r+this.start;c<=r-this.end;c+=2){let d=a+c,u=c==-r||c!=r&&this.vec[d-1]<this.vec[d+1]?this.vec[d+1]:this.vec[d-1]+1,m=u-c;for(;u<n&&m<s&&l(u,m);)u++,m++;if(this.vec[d]=u,u>n)this.end+=2;else if(m>s)this.start+=2;else if(i){let h=a+(n-s)-c;if(h>=0&&h<this.len&&i.vec[h]!=-1)if(o){let p=i.vec[h];if(p>=n-u)return[p,a+p-h]}else{let p=n-i.vec[h];if(u>=p)return[u,m]}}}return null}}const pa=new Bd,ha=new Bd;function uw(e,r,n,s,a,i,o,l){let c=!1;return!ln(e,s)&&++s==n&&(c=!0),!ln(a,l)&&++l==o&&(c=!0),c?[new kt(r,n,i,o)]:Hr(e,r,s,a,i,l).concat(Hr(e,s,n,a,l,o))}function Wd(e,r){let n=1,s=Math.min(e,r);for(;n<s;)n=n<<1;return n}function Ei(e,r,n,s,a,i){if(r==n||r==i||e.charCodeAt(r)!=s.charCodeAt(a))return 0;let o=Wd(n-r,i-a);for(let l=r,c=a;;){let d=l+o,u=c+o;if(d>n||u>i||e.slice(l,d)!=s.slice(c,u)){if(o==1)return l-r-(ln(e,l)?0:1);o=o>>1}else{if(d==n||u==i)return d-r;l=d,c=u}}}function Ii(e,r,n,s,a,i){if(r==n||a==i||e.charCodeAt(n-1)!=s.charCodeAt(i-1))return 0;let o=Wd(n-r,i-a);for(let l=n,c=i;;){let d=l-o,u=c-o;if(d<r||u<a||e.slice(d,l)!=s.slice(u,c)){if(o==1)return n-l-(ln(e,l)?0:1);o=o>>1}else{if(d==r||u==a)return n-d;l=d,c=u}}}function Ka(e,r,n,s,a,i,o,l){let c=s.slice(a,i),d=null;for(;;){if(d||o<l)return d;for(let u=r+o;;){ln(e,u)||u++;let m=u+o;if(ln(e,m)||(m+=m==u+1?1:-1),m>=n)break;let h=e.slice(u,m),p=-1;for(;(p=c.indexOf(h,p+1))!=-1;){let g=Ei(e,m,n,s,a+p+h.length,i),x=Ii(e,r,u,s,a,a+p),b=h.length+g+x;(!d||d[2]<b)&&(d=[u-x,a+p-x,b])}u=m}if(l<0)return d;o=o>>1}}function Ud(e,r,n,s,a,i){let o=n-r,l=i-a;if(o<l){let c=Ud(s,a,i,e,r,n);return c&&[c[1],c[0],c[2]]}return o<4||l*2<o?null:Ka(e,r,n,s,a,i,Math.floor(o/4),-1)}function hl(e,r,n,s,a,i){Si=!0;let o=n-r,l=i-a,c;if(o<l){let h=Ka(s,a,i,e,r,n,Math.floor(o/6),50);c=h&&[h[1],h[0],h[2]]}else c=Ka(e,r,n,s,a,i,Math.floor(l/6),50);if(!c)return[new kt(r,n,a,i)];let[d,u,m]=c;return Hr(e,r,d,s,a,u).concat(Hr(e,d+m,n,s,u+m,i))}function Hd(e,r){for(let n=1;n<e.length;n++){let s=e[n-1],a=e[n];s.toA>a.fromA-r&&s.toB>a.fromB-r&&(e[n-1]=new kt(s.fromA,a.toA,s.fromB,a.toB),e.splice(n--,1))}}function mw(e,r,n){for(;;){Hd(n,1);let s=!1;for(let a=0;a<n.length;a++){let i=n[a],o,l;(o=Ei(e,i.fromA,i.toA,r,i.fromB,i.toB))&&(i=n[a]=new kt(i.fromA+o,i.toA,i.fromB+o,i.toB)),(l=Ii(e,i.fromA,i.toA,r,i.fromB,i.toB))&&(i=n[a]=new kt(i.fromA,i.toA-l,i.fromB,i.toB-l));let c=i.toA-i.fromA,d=i.toB-i.fromB;if(c&&d)continue;let u=i.fromA-(a?n[a-1].toA:0),m=(a<n.length-1?n[a+1].fromA:e.length)-i.toA;if(!u||!m)continue;let h=c?e.slice(i.fromA,i.toA):r.slice(i.fromB,i.toB);u<=h.length&&e.slice(i.fromA-u,i.fromA)==h.slice(h.length-u)?(n[a]=new kt(i.fromA-u,i.toA-u,i.fromB-u,i.toB-u),s=!0):m<=h.length&&e.slice(i.toA,i.toA+m)==h.slice(0,m)&&(n[a]=new kt(i.fromA+m,i.toA+m,i.fromB+m,i.toB+m),s=!0)}if(!s)break}return n}function pw(e,r,n){for(let s=0,a=0;a<e.length;a++){let i=e[a],o=i.toA-i.fromA,l=i.toB-i.fromB;if(o&&l||o>3||l>3){let c=a==e.length-1?r.length:e[a+1].fromA,d=i.fromA-s,u=c-i.toA,m=gl(r,i.fromA,d),h=fl(r,i.toA,u),p=i.fromA-m,g=h-i.toA;if((!o||!l)&&p&&g){let x=Math.max(o,l),[b,k,N]=o?[r,i.fromA,i.toA]:[n,i.fromB,i.toB];x>p&&r.slice(m,i.fromA)==b.slice(N-p,N)?(i=e[a]=new kt(m,m+o,i.fromB-p,i.toB-p),m=i.fromA,h=fl(r,i.toA,c-i.toA)):x>g&&r.slice(i.toA,h)==b.slice(k,k+g)&&(i=e[a]=new kt(h-o,h,i.fromB+g,i.toB+g),h=i.toA,m=gl(r,i.fromA,i.fromA-s)),p=i.fromA-m,g=h-i.toA}if(p||g)i=e[a]=new kt(i.fromA-p,i.toA+g,i.fromB-p,i.toB+g);else if(o){if(!l){let x=bl(r,i.fromA,i.toA),b,k=x<0?-1:xl(r,i.toA,i.fromA);x>-1&&(b=x-i.fromA)<=u&&r.slice(i.fromA,x)==r.slice(i.toA,i.toA+b)?i=e[a]=i.offset(b):k>-1&&(b=i.toA-k)<=d&&r.slice(i.fromA-b,i.fromA)==r.slice(k,i.toA)&&(i=e[a]=i.offset(-b))}}else{let x=bl(n,i.fromB,i.toB),b,k=x<0?-1:xl(n,i.toB,i.fromB);x>-1&&(b=x-i.fromB)<=u&&n.slice(i.fromB,x)==n.slice(i.toB,i.toB+b)?i=e[a]=i.offset(b):k>-1&&(b=i.toB-k)<=d&&n.slice(i.fromB-b,i.fromB)==n.slice(k,i.toB)&&(i=e[a]=i.offset(-b))}}s=i.toA}return Hd(e,3),e}let Br;try{Br=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function qd(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Vd(e,r){if(r==e.length)return 0;let n=e.charCodeAt(r);return n<192?qd(n)?1:0:Br?!Jd(n)||r==e.length-1?Br.test(String.fromCharCode(n))?1:0:Br.test(e.slice(r,r+2))?2:0:0}function Gd(e,r){if(!r)return 0;let n=e.charCodeAt(r-1);return n<192?qd(n)?1:0:Br?!Yd(n)||r==1?Br.test(String.fromCharCode(n))?1:0:Br.test(e.slice(r-2,r))?2:0:0}const Kd=8;function fl(e,r,n){if(r==e.length||!Gd(e,r))return r;for(let s=r,a=r+n,i=0;i<Kd;i++){let o=Vd(e,s);if(!o||s+o>a)return s;s+=o}return r}function gl(e,r,n){if(!r||!Vd(e,r))return r;for(let s=r,a=r-n,i=0;i<Kd;i++){let o=Gd(e,s);if(!o||s-o<a)return s;s-=o}return r}function xl(e,r,n){for(;r!=n;r--)if(e.charCodeAt(r-1)==10)return r;return-1}function bl(e,r,n){for(;r!=n;r++)if(e.charCodeAt(r)==10)return r;return-1}const Jd=e=>e>=55296&&e<=56319,Yd=e=>e>=56320&&e<=57343;function ln(e,r){return!r||r==e.length||!Jd(e.charCodeAt(r-1))||!Yd(e.charCodeAt(r))}function hw(e,r,n){var s;return Nn=((s=n?.scanLimit)!==null&&s!==void 0?s:1e9)>>1,Cn=n?.timeout?Date.now()+n.timeout:0,Si=!1,mw(e,r,Hr(e,0,e.length,r,0,r.length))}function Qd(){return!Si}function Xd(e,r,n){return pw(hw(e,r,n),e,r)}const xr=Cs.define({combine:e=>e[0]}),fw=Qa.define(),Zd=Cs.define(),tr=_n.define({create(e){return null},update(e,r){for(let n of r.effects)n.is(fw)&&(e=n.value);for(let n of r.state.facet(Zd))e=n(e,r);return e}});function fa(e){let r=e.field(tr,!1);if(!r)return null;let n=e.facet(xr);return{chunks:r,side:n?n.side:null}}class tn{constructor(r,n,s,a,i,o=!0){this.changes=r,this.fromA=n,this.toA=s,this.fromB=a,this.toB=i,this.precise=o}offset(r,n){return r||n?new tn(this.changes,this.fromA+r,this.toA+r,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(r,n,s){let a=Xd(r.toString(),n.toString(),s);return eu(a,r,n,0,0,Qd())}static updateA(r,n,s,a,i){return jl(wl(r,a,!0,s.length),r,n,s,i)}static updateB(r,n,s,a,i){return jl(wl(r,a,!1,n.length),r,n,s,i)}}function yl(e,r,n,s){let a=n.lineAt(e),i=s.lineAt(r);return a.to==e&&i.to==r&&e<n.length&&r<s.length?[e+1,r+1]:[a.from,i.from]}function kl(e,r,n,s){let a=n.lineAt(e),i=s.lineAt(r);return a.from==e&&i.from==r?[e,r]:[a.to+1,i.to+1]}function eu(e,r,n,s,a,i){let o=[];for(let l=0;l<e.length;l++){let c=e[l],[d,u]=yl(c.fromA+s,c.fromB+a,r,n),[m,h]=kl(c.toA+s,c.toB+a,r,n),p=[c.offset(-d+s,-u+a)];for(;l<e.length-1;){let g=e[l+1],[x,b]=yl(g.fromA+s,g.fromB+a,r,n);if(x>m+1&&b>h+1)break;p.push(g.offset(-d+s,-u+a)),[m,h]=kl(g.toA+s,g.toB+a,r,n),l++}o.push(new tn(p,d,Math.max(d,m),u,Math.max(u,h),i))}return o}const cs=1e3;function vl(e,r,n,s){let a=0,i=e.length;for(;;){if(a==i){let u=0,m=0;a&&({toA:u,toB:m}=e[a-1]);let h=r-(n?u:m);return[u+h,m+h]}let o=a+i>>1,l=e[o],[c,d]=n?[l.fromA,l.toA]:[l.fromB,l.toB];if(c>r)i=o;else if(d<=r)a=o+1;else return s?[l.fromA,l.fromB]:[l.toA,l.toB]}}function wl(e,r,n,s){let a=[];return r.iterChangedRanges((i,o,l,c)=>{let d=0,u=n?r.length:s,m=0,h=n?s:r.length;i>cs&&([d,m]=vl(e,i-cs,n,!0)),o<r.length-cs&&([u,h]=vl(e,o+cs,n,!1));let p=c-l-(o-i),g,[x,b]=n?[p,0]:[0,p];a.length&&(g=a[a.length-1]).toA>=d?a[a.length-1]={fromA:g.fromA,fromB:g.fromB,toA:u,toB:h,diffA:g.diffA+x,diffB:g.diffB+b}:a.push({fromA:d,toA:u,fromB:m,toB:h,diffA:x,diffB:b})}),a}function jl(e,r,n,s,a){if(!e.length)return r;let i=[];for(let o=0,l=0,c=0,d=0;;o++){let u=o==e.length?null:e[o],m=u?u.fromA+l:n.length,h=u?u.fromB+c:s.length;for(;d<r.length;){let b=r[d];if(b.toA+l>m||b.toB+c>h)break;i.push(b.offset(l,c)),d++}if(!u)break;let p=u.toA+l+u.diffA,g=u.toB+c+u.diffB,x=Xd(n.sliceString(m,p),s.sliceString(h,g),a);for(let b of eu(x,n,s,m,h,Qd()))i.push(b);for(l+=u.diffA,c+=u.diffB;d<r.length;){let b=r[d];if(b.fromA+l>p&&b.fromB+c>g)break;d++}}return i}const gw={scanLimit:500},tu=Ss.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Sl(e))}update(e){(e.docChanged||e.viewportChanged||xw(e.startState,e.state)||bw(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Sl(e.view))}},{decorations:e=>e.deco});function xw(e,r){return e.field(tr,!1)!=r.field(tr,!1)}function bw(e,r){return e.facet(xr)!=r.facet(xr)}const Nl=br.line({class:"cm-changedLine"}),ru=br.mark({class:"cm-changedText"}),yw=br.mark({tagName:"ins",class:"cm-insertedLine"}),kw=br.mark({tagName:"del",class:"cm-deletedLine"}),Cl=new class extends Xa{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function vw(e,r,n,s,a,i){let o=n?e.fromA:e.fromB,l=n?e.toA:e.toB,c=0;if(o!=l){a.add(o,o,Nl),a.add(o,l,n?kw:yw),i&&i.add(o,o,Cl);for(let d=r.iterRange(o,l-1),u=o;!d.next().done;){if(d.lineBreak){u++,a.add(u,u,Nl),i&&i.add(u,u,Cl);continue}let m=u+d.value.length;if(s)for(;c<e.changes.length;){let h=e.changes[c],p=o+(n?h.fromA:h.fromB),g=o+(n?h.toA:h.toB),x=Math.max(u,p),b=Math.min(m,g);if(x<b&&a.add(x,b,ru),g<m)c++;else break}u=m}}}function Sl(e){let r=e.state.field(tr),{side:n,highlightChanges:s,markGutter:a,overrideChunk:i}=e.state.facet(xr),o=n=="a",l=new ms,c=a?new ms:null,{from:d,to:u}=e.viewport;for(let m of r){if((o?m.fromA:m.fromB)>=u)break;(o?m.toA:m.toB)>d&&(!i||!i(e.state,m,l,c))&&vw(m,e.state.doc,o,s,l,c)}return{deco:l.finish(),gutter:c&&c.finish()}}const Ja=Qa.define({map:(e,r)=>r.mapPos(e)});class ww extends Za{constructor(r){super(),this.lines=r}eq(r){return this.lines==r.lines}toDOM(r){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=r.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",s=>{let a=r.posAtDOM(s.target);r.dispatch({effects:Ja.of(a)});let{side:i,sibling:o}=r.state.facet(xr);o&&o().dispatch({effects:Ja.of(jw(a,r.state.field(tr),i=="a"))})}),n}ignoreEvent(r){return r instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function jw(e,r,n){let s=0,a=0;for(let i=0;;i++){let o=i<r.length?r[i]:null;if(!o||(n?o.fromA:o.fromB)>=e)return a+(e-s);[s,a]=n?[o.toA,o.toB]:[o.toB,o.toA]}}const Nw=_n.define({create(e){return br.none},update(e,r){e=e.map(r.changes);for(let n of r.effects)n.is(Ja)&&(e=e.update({filter:s=>s!=n.value}));return e},provide:e=>er.decorations.from(e)});function Cw({margin:e=3,minSize:r=4}){return Nw.init(n=>Sw(n,e,r))}function Sw(e,r,n){let s=new ms,a=e.facet(xr).side=="a",i=e.field(tr),o=1;for(let l=0;;l++){let c=l<i.length?i[l]:null,d=l?o+r:1,u=c?e.doc.lineAt(a?c.fromA:c.fromB).number-1-r:e.doc.lines,m=u-d+1;if(m>=n&&s.add(e.doc.line(d).from,e.doc.line(u).to,br.replace({widget:new ww(m),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,a?c.toA:c.toB)).number}return s.finish()}const Ew=er.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Iw=new class extends Xa{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},Aw=zl.low(Iu({class:"cm-changeGutter",markers:e=>{var r;return((r=e.plugin(tu))===null||r===void 0?void 0:r.gutter)||Au.empty},widgetMarker:(e,r)=>r instanceof nu?Iw:null}));function Mw(e){var r;let n=typeof e.original=="string"?_l.of(e.original.split(/\r?\n/)):e.original,s=e.diffConfig||gw;return[zl.low(tu),Lw,Ew,er.editorAttributes.of({class:"cm-merge-b"}),Zd.of((a,i)=>{let o=i.effects.find(l=>l.is(Ai));return o&&(a=tn.updateA(a,o.value.doc,i.startState.doc,o.value.changes,s)),i.docChanged&&(a=tn.updateB(a,i.state.field(cn),i.newDoc,i.changes,s)),a}),xr.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(r=e.mergeControls)!==null&&r!==void 0?r:!0,overrideChunk:e.allowInlineDiffs?Fw:void 0,side:"b"}),cn.init(()=>n),e.gutter!==!1?Aw:[],e.collapseUnchanged?Cw(e.collapseUnchanged):[],tr.init(a=>tn.build(n,a.doc,s))]}const Ai=Qa.define(),cn=_n.define({create:()=>_l.empty,update(e,r){for(let n of r.effects)n.is(Ai)&&(e=n.value.doc);return e}}),El=new WeakMap;class nu extends Za{constructor(r){super(),this.buildDOM=r,this.dom=null}eq(r){return this.dom==r.dom}toDOM(r){return this.dom||(this.dom=this.buildDOM(r))}}function Tw(e,r,n){let s=El.get(r.changes);if(s)return s;let a=o=>{let{highlightChanges:l,syntaxHighlightDeletions:c,syntaxHighlightDeletionsMaxLength:d,mergeControls:u}=e.facet(xr),m=document.createElement("div");if(m.className="cm-deletedChunk",u){let P=m.appendChild(document.createElement("div"));P.className="cm-chunkButtons";let W=B=>{B.preventDefault(),Dw(o,o.posAtDOM(m))},M=B=>{B.preventDefault(),Pw(o,o.posAtDOM(m))};if(typeof u=="function")P.appendChild(u("accept",W)),P.appendChild(u("reject",M));else{let B=P.appendChild(document.createElement("button"));B.name="accept",B.textContent=e.phrase("Accept"),B.onmousedown=W;let L=P.appendChild(document.createElement("button"));L.name="reject",L.textContent=e.phrase("Reject"),L.onmousedown=M}}if(n||r.fromA>=r.toA)return m;let h=o.state.field(cn).sliceString(r.fromA,r.endA),p=c&&e.facet(Fl),g=N(),x=r.changes,b=0,k=!1;function N(){let P=m.appendChild(document.createElement("div"));return P.className="cm-deletedLine",P.appendChild(document.createElement("del"))}function y(P,W,M){for(let B=P;B<W;){if(h.charAt(B)==`
524
+ `){g.firstChild||g.appendChild(document.createElement("br")),g=N(),B++;continue}let L=W,U=M+(k?" cm-deletedText":""),j=!1,R=h.indexOf(`
525
+ `,B);if(R>-1&&R<W&&(L=R),l&&b<x.length){let D=Math.max(0,k?x[b].toA:x[b].fromA);D<=L&&(L=D,k&&b++,j=!0)}if(L>B){let D=document.createTextNode(h.slice(B,L));if(U){let _=g.appendChild(document.createElement("span"));_.className=U,_.appendChild(D)}else g.appendChild(D);B=L}j&&(k=!k)}}if(p&&r.toA-r.fromA<=d){let P=p.parser.parse(h),W=0;ga(P,{style:M=>$l(e,M)},(M,B,L)=>{M>W&&y(W,M,""),y(M,B,L),W=B}),y(W,h.length,"")}else y(0,h.length,"");return g.firstChild||g.appendChild(document.createElement("br")),m},i=br.widget({block:!0,side:-1,widget:new nu(a)});return El.set(r.changes,i),i}function Dw(e,r){let{state:n}=e,s=r??n.selection.main.head,a=e.state.field(tr).find(c=>c.fromB<=s&&c.endB>=s);if(!a)return!1;let i=e.state.sliceDoc(a.fromB,Math.max(a.fromB,a.toB-1)),o=e.state.field(cn);a.fromB!=a.toB&&a.toA<=o.length&&(i+=e.state.lineBreak);let l=Mu.of({from:a.fromA,to:Math.min(o.length,a.toA),insert:i},o.length);return e.dispatch({effects:Ai.of({doc:l.apply(o),changes:l}),userEvent:"accept"}),!0}function Pw(e,r){let{state:n}=e,s=r??n.selection.main.head,a=n.field(tr).find(l=>l.fromB<=s&&l.endB>=s);if(!a)return!1;let o=n.field(cn).sliceString(a.fromA,Math.max(a.fromA,a.toA-1));return a.fromA!=a.toA&&a.toB<=n.doc.length&&(o+=n.lineBreak),e.dispatch({changes:{from:a.fromB,to:Math.min(n.doc.length,a.toB),insert:o},userEvent:"revert"}),!0}function Il(e){let r=new ms;for(let n of e.field(tr)){let s=e.facet(xr).overrideChunk&&su(e,n);r.add(n.fromB,n.fromB,Tw(e,n,!!s))}return r.finish()}const Lw=_n.define({create:e=>Il(e),update(e,r){return r.state.field(tr,!1)!=r.startState.field(tr,!1)?Il(r.state):e},provide:e=>er.decorations.from(e)}),Al=new WeakMap;function su(e,r){let n=Al.get(r);if(n!==void 0)return n;n=null;let s=e.field(cn),a=e.doc,i=s.lineAt(r.endA).number-s.lineAt(r.fromA).number+1,o=a.lineAt(r.endB).number-a.lineAt(r.fromB).number+1;e:if(i==o&&i<10){let l=[],c=0,d=r.fromA,u=r.fromB;for(let m of r.changes){if(m.fromA<m.toA){c+=m.toA-m.fromA;let h=s.sliceString(d+m.fromA,d+m.toA);if(/\n/.test(h))break e;l.push(br.widget({widget:new Rw(h),side:-1}).range(u+m.fromB))}m.fromB<m.toB&&l.push(ru.range(u+m.fromB,u+m.toB))}c<r.endA-r.fromA-i*2&&(n=l)}return Al.set(r,n),n}class Rw extends Za{constructor(r){super(),this.text=r}eq(r){return this.text==r.text}toDOM(r){let n=document.createElement("del");return n.className="cm-deletedText",n.textContent=this.text,n}}const _w=new class extends Xa{constructor(){super(...arguments),this.elementClass="cm-inlineChangedLineGutter"}},zw=br.line({class:"cm-inlineChangedLine"});function Fw(e,r,n,s){let a=su(e,r),i=0;if(!a)return!1;for(let o=e.doc.lineAt(r.fromB);;){for(s&&s.add(o.from,o.from,_w),n.add(o.from,o.from,zw);i<a.length&&a[i].to<=o.to;){let l=a[i++];n.add(l.from,l.to,l.value)}if(o.to>=r.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var $w=function(e,r){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&r.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(e);a<s.length;a++)r.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(n[s[a]]=e[s[a]]);return n};const Lt=Cs.define({combine:e=>{const r=[];for(let n of e){if(!n)continue;const{create:s,gutters:a}=n,i=$w(n,["create","gutters"]);r.push(Object.assign(Object.assign({},i),{enabled:!0,gutters:a?a.filter(o=>Object.keys(o).length>0):void 0}))}return Tu(r,{enabled:r.length>0,displayText:"characters",eventHandlers:{},showOverlay:"always",gutters:[]})}}),Ht={PixelMultiplier:2,SizeRatio:4,MaxWidth:120},Ow=er.theme({".cm-minimap-overlay-container":{position:"absolute",top:0,height:"100%",width:"100%","&.cm-minimap-overlay-mouse-over":{opacity:0,transition:"visibility 0s linear 300ms, opacity 300ms"},"&.cm-minimap-overlay-mouse-over:hover":{opacity:1,transition:"visibility 0s linear 0ms, opacity 300ms"},"&.cm-minimap-overlay-off":{display:"none"},"& .cm-minimap-overlay":{background:"rgb(121, 121, 121)",opacity:"0.2",position:"absolute",right:0,top:0,width:"100%",transition:"top 0s ease-in 0ms","&:hover":{opacity:"0.3"}},"&.cm-minimap-overlay-active":{opacity:1,visibility:"visible",transition:"visibility 0s linear 0ms, opacity 300ms","& .cm-minimap-overlay":{opacity:"0.4"}}}}),Cr=Ht.PixelMultiplier*Ht.SizeRatio,Bw=Ss.fromClass(class{constructor(e){this.view=e,this._isDragging=!1,e.state.facet(Lt).enabled&&this.create(e)}create(e){this.container=rn("div",{class:"cm-minimap-overlay-container"}),this.dom=rn("div",{class:"cm-minimap-overlay"}),this.container.appendChild(this.dom),this.container.addEventListener("mousedown",this.onMouseDown.bind(this)),window.addEventListener("mouseup",this.onMouseUp.bind(this)),window.addEventListener("mousemove",this.onMouseMove.bind(this));const r=e.dom.querySelector(".cm-minimap-inner");r&&r.appendChild(this.container),this.computeShowOverlay(),this.computeHeight(),this.computeTop()}remove(){this.container&&(this.container.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),this.container.remove())}update(e){const r=e.startState.facet(Lt).enabled,n=e.state.facet(Lt).enabled;if(r&&!n){this.remove();return}!r&&n&&this.create(e.view),n&&(this.computeShowOverlay(),e.geometryChanged&&(this.computeHeight(),this.computeTop()))}computeHeight(){if(!this.dom)return;const e=this.view.dom.clientHeight/Cr;this.dom.style.height=e+"px"}computeTop(){if(!this._isDragging&&this.dom){const{clientHeight:e,scrollHeight:r,scrollTop:n}=this.view.scrollDOM,s=r-e,a=n/Cr,i=e/Cr,o=e-i;let l=n/s;isNaN(l)&&(l=0);const c=o*l,d=Math.min(c,a);this.dom.style.top=d+"px"}}computeShowOverlay(){if(!this.container)return;const{showOverlay:e}=this.view.state.facet(Lt);e==="mouse-over"?this.container.classList.add("cm-minimap-overlay-mouse-over"):this.container.classList.remove("cm-minimap-overlay-mouse-over");const{clientHeight:r,scrollHeight:n}=this.view.scrollDOM;r===n?this.container.classList.add("cm-minimap-overlay-off"):this.container.classList.remove("cm-minimap-overlay-off")}onMouseDown(e){if(!this.container||e.button===2)return;const{clientY:r,target:n}=e;if(n===this.dom){this._dragStartY=e.clientY,this._isDragging=!0,this.container.classList.add("cm-minimap-overlay-active");return}const{clientHeight:s,scrollHeight:a,scrollTop:i}=this.view.scrollDOM,o=n.getBoundingClientRect().top,l=(r-o)*Cr,c=i/(a-s),u=(s*Cr-s)*c,m=Math.max(0,i-u);this.view.scrollDOM.scrollTop=m+l-s/2}onMouseUp(e){this._isDragging&&this.container&&(this._dragStartY=void 0,this._isDragging=!1,this.container.classList.remove("cm-minimap-overlay-active"))}onMouseMove(e){if(!this._isDragging||!this.dom)return;if(e.preventDefault(),e.stopPropagation(),!this._dragStartY){this._dragStartY=e.clientY;return}const r=e.clientY-this._dragStartY,n=r<0,s=r>0;this._dragStartY=e.clientY;const a=this.dom.getBoundingClientRect().height,i=this.dom.getBoundingClientRect().y,o=i+a,l=parseFloat(this.dom.style.top),c=this.view.scrollDOM.scrollTop,d=this.view.scrollDOM.clientHeight,u=this.view.scrollDOM.scrollHeight,m=c===0,h=Math.round(c)>=Math.round(u-d);if(m&&n||m&&e.clientY<i||h&&s||h&&e.clientY>o)return;const p=this.view.scrollDOM.scrollHeight,g=this.view.scrollDOM.clientHeight,x=(p-g)/Cr,b=g-g/Cr,k=l+r,N=k/b,y=(p-g)*N,P=k*Cr;this.view.scrollDOM.scrollTop=Math.max(y,P);const W=Math.min(Math.max(0,k),Math.min(b,x));this.dom.style.top=W+"px"}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.computeTop())}}}),Ww=[Ow,Bw];class Mi{constructor(r){this.map=new Map,this.view=r}get(r){return this.map.get(r)}set(r,n){this.map.set(r,n)}}function Ml(e){var r;if(!e.facet(Lt).enabled)return[];const n=[],s=e.doc.iterLines(),a=Du(e).iter();let i=0;for(s.next();!s.done;){const o=s.value;let l=i,c=l+o.length;for(;a.value&&a.to<l;)a.next();const{from:d,to:u}=a,m=l>=d&&l<u,h=c>d&&c<=u;if(m){let p=(r=n.pop())!==null&&r!==void 0?r:[],g=p.pop();g&&g.folded&&(g.to=u),g&&p.push(g),(!g||!g.folded)&&p.push({from:d,to:u,folded:!0}),h||p.push({from:u,to:c,folded:!1}),n.push(p)}else h?n.push([{from:l,to:d,folded:!1},{from:d,to:u,folded:!0}]):n.push([{from:l,to:c,folded:!1}]);i=c+1,s.next()}return n}const dn=_n.define({create:e=>Ml(e),update:(e,r)=>Ps([r])||r.docChanged?Ml(r.state):e});function Ps(e){return e.find(r=>r.effects.find(n=>n.is(Pu)||n.is(Lu)))}class Uw extends Mi{constructor(r){super(r),this.count=void 0}shouldUpdate(r){if(!r.state.facet(Lt).enabled)return!1;if(r.docChanged)return!0;for(const n of r.transactions)for(const s of n.effects)if(s.is(Ru))return!0;return!!(Ps(r.transactions)||this.count===void 0)}update(r){if(!this.shouldUpdate(r))return;this.map.clear();const n=r.state.field(dn);this.count=_u(r.state),zu(r.state,(s,a,i)=>{const o=this.findLine(a,n),l=this.findLine(i,n);let c=s.severity;for(let d=o;d<=l;d++){const u=this.get(d);u&&(c=[c,u].sort(this.sort.bind(this)).slice(0,1)[0]),this.set(d,c)}})}drawLine(r,n){const{context:s,lineHeight:a,offsetX:i,offsetY:o}=r,l=this.get(n);l&&(s.globalAlpha=.65,s.beginPath(),s.rect(i,o,s.canvas.width-i,a),s.fillStyle=this.color(l),s.fill())}findLine(r,n){return n.findIndex(a=>{const i=a.slice(0,1)[0],o=a.slice(-1)[0];return!i||!o?!1:i.from<=r&&r<=o.to})+1}color(r){return r==="error"?"#d11":r==="warning"?"orange":"#999"}sort(r,n){return this.score(n)-this.score(r)}score(r){switch(r){case"error":return 3;case"warning":return 2;default:return 1}}}function Hw(e){return new Uw(e)}class qw extends Mi{constructor(r){super(r),this.getDrawInfo(),this._themeClasses=r.dom.classList.value}shouldUpdate(r){return r.state.facet(Lt).enabled?!!(r.docChanged||r.selectionSet||this._themeClasses!==this.view.dom.classList.value||Ps(r.transactions)):!1}update(r){if(!this.shouldUpdate(r))return;this.map.clear(),this._themeClasses!==this.view.dom.classList.value&&(this._drawInfo=void 0,this._themeClasses=this.view.dom.classList.value);const{ranges:n}=r.state.selection;let s=0;for(const[a,i]of r.state.field(dn).entries()){const o=[];let l=0;for(const d of i){do{if(s>=n.length||d.to<n[s].from)continue;if(n[s].from===n[s].to){s++;continue}const u=n[s],m={from:l+Math.max(d.from,u.from)-d.from,to:l+Math.min(d.to,u.to)-d.from,extends:u.to>d.to},h=o.slice(-1)[0];if(h&&h.to===m.from){let{to:p}=m;d.folded&&m.extends?p=m.from+1:d.folded&&!m.extends&&(p=h.to),o[o.length-1]=Object.assign(Object.assign({},h),{to:p,extends:m.extends})}else d.folded||o.push(m);if(m.extends)break;s++}while(s<n.length&&d.to>=n[s].from);l+=d.folded?1:d.to-d.from}if(o.length===0)continue;const c=a+1;this.map.set(c,o)}}drawLine(r,n){let{context:s,lineHeight:a,charWidth:i,offsetX:o,offsetY:l}=r;const c=this.get(n);if(c)for(const d of c){const u=o+d.from*i,m=(d.to-d.from)*i,h=s.canvas.width-u;d.extends&&(s.globalAlpha=.65,s.beginPath(),s.rect(u,l,h,a),s.fillStyle=this.getDrawInfo().backgroundColor,s.fill()),s.globalAlpha=1,s.beginPath(),s.rect(u,l,m,a),s.fillStyle=this.getDrawInfo().backgroundColor,s.fill()}}getDrawInfo(){if(this._drawInfo)return this._drawInfo;const r=document.createElement("span");r.setAttribute("class","cm-selectionBackground"),this.view.dom.appendChild(r);const s={backgroundColor:window.getComputedStyle(r).backgroundColor};return this._drawInfo=s,this.view.dom.removeChild(r),s}}function Vw(e){return new qw(e)}class Gw extends Mi{constructor(r){super(r),this._fontInfoMap=new Map,this._themeClasses=new Set(r.dom.classList.values()),r.state.facet(Lt).enabled&&this.updateImpl(r.state)}shouldUpdate(r){return!!(r.docChanged||r.state.facet(Lt)!==r.startState.facet(Lt)||this.themeChanged()||Ps(r.transactions))}update(r){this.shouldUpdate(r)&&(this._highlightingCallbackId&&(typeof window.requestIdleCallback<"u"?cancelIdleCallback(this._highlightingCallbackId):clearTimeout(this._highlightingCallbackId)),this.updateImpl(r.state,r.changes))}updateImpl(r,n){var s;this.map.clear(),this._displayText=r.facet(Lt).displayText,this.themeChanged()&&this._fontInfoMap.clear();let a;if(this._previousTree&&n){const m=Oi.addTree(this._previousTree),h=[];n.iterChangedRanges((p,g,x,b)=>h.push({fromA:p,toA:g,fromB:x,toB:b})),a=Oi.applyChanges(m,h)}const i=r.doc.toString(),o=(s=r.facet(Fl))===null||s===void 0?void 0:s.parser,l=o?o.parse(i,a):void 0;this._previousTree=l;const c={style:m=>$l(r,m)};let d=[];if(l){const m=r.doc.lineAt(this.view.viewport.from).number,h=r.doc.lineAt(this.view.viewport.to).number,p=h-m,g=m/(r.doc.lines-p),{SizeRatio:x,PixelMultiplier:b}=Ht,k=p*x*b,N=g*k,y=Math.max(1,Math.floor(m-N)),P=Math.min(h+Math.floor(k-N),r.doc.lines);ga(l,c,(W,M,B)=>{d.push({from:W,to:M,tags:B})},r.doc.line(y).from,r.doc.line(P).to)}this.updateMapImpl(r,d),d=[];const u=()=>{l&&(ga(l,c,(m,h,p)=>{d.push({from:m,to:h,tags:p})}),this.updateMapImpl(r,d),this._highlightingCallbackId=void 0)};this._highlightingCallbackId=typeof window.requestIdleCallback<"u"?requestIdleCallback(u):setTimeout(u)}updateMapImpl(r,n){this.map.clear();const s=r.doc.toString(),a=n.values();let i=a.next();for(const[o,l]of r.field(dn).entries()){const c=[];for(const u of l){if(u.from===u.to)continue;if(u.folded){c.push({text:"…",tags:""});continue}let m=u.from;for(;!i.done&&i.value.from<u.to;){const{from:h,to:p,tags:g}=i.value;if(p<m){i=a.next();continue}h>m&&c.push({text:s.slice(m,h),tags:""});const x=Math.max(h,u.from),b=Math.min(p,u.to);if(c.push({text:s.slice(x,b),tags:g}),m=b,p>b)break;i=a.next()}m!==u.to&&c.push({text:s.slice(m,u.to),tags:""})}const d=o+1;this.map.set(d,c)}}measure(r){const{color:n,font:s,lineHeight:a}=this.getFontInfo("");return r.textBaseline="ideographic",r.fillStyle=n,r.font=s,{charWidth:r.measureText("_").width,lineHeight:a}}beforeDraw(){this._fontInfoMap.clear()}drawLine(r,n){const s=this.get(n);if(!s)return;let{context:a,charWidth:i,lineHeight:o,offsetX:l,offsetY:c}=r,d;a.textBaseline="ideographic";for(const u of s){const m=this.getFontInfo(u.tags);switch((!d||d.color!==m.color)&&(a.fillStyle=m.color),(!d||d.font!==m.font)&&(a.font=m.font),d=m,o=Math.max(o,m.lineHeight),this._displayText){case"characters":{a.fillText(u.text,l,c+o),l+=u.text.length*i;break}case"blocks":{const h=/\S+/g;let p;for(;(p=h.exec(u.text))!==null;){const g=l+p.index*i;let x=(h.lastIndex-p.index)*i;if(g>a.canvas.width)break;g+x>a.canvas.width&&(x=a.canvas.width-g);const b=2/Ht.SizeRatio,k=o-b;a.fillStyle=m.color,a.globalAlpha=.65,a.beginPath(),a.rect(g,c,x,k),a.fill()}l+=u.text.length*i;break}}}}getFontInfo(r){const n=this._fontInfoMap.get(r);if(n)return n;const s=rn("span",{class:r}),a=rn("div",{class:"cm-line",style:"display: none"},s);this.view.contentDOM.appendChild(a);const i=window.getComputedStyle(s),o=parseFloat(i.lineHeight)/Ht.SizeRatio,l={color:i.color,font:`${i.fontStyle} ${i.fontWeight} ${o}px ${i.fontFamily}`,lineHeight:o};return this._fontInfoMap.set(r,l),this.view.contentDOM.removeChild(a),l}themeChanged(){const r=this._themeClasses,n=new Set(this.view.dom.classList.values());if(this._themeClasses=n,!r||(r.delete("cm-focused"),n.delete("cm-focused"),r.size!==n.size))return!0;let s=!0;return r.forEach(a=>{n.has(a)||(s=!1)}),!s}}function Kw(e){return new Gw(e)}const au=4;function Jw(e,r,n){const s=e[n];s&&(r.context.fillStyle=s,r.context.globalAlpha=1,r.context.beginPath(),r.context.rect(r.offsetX,r.offsetY,au,r.lineHeight),r.context.fill())}const Yw=er.theme({"&":{height:"100%",overflowY:"auto"},"& .cm-minimap-gutter":{borderRight:0,flexShrink:0,left:"unset",position:"sticky",right:0,top:0},"& .cm-minimap-inner":{height:"100%",position:"absolute",right:0,top:0,overflowY:"hidden","& canvas":{display:"block"}},"& .cm-minimap-box-shadow":{boxShadow:"12px 0px 20px 5px #6c6c6c"}}),Tl=6,Qw=Ss.fromClass(class{constructor(e){this.view=e,this.text=Kw(e),this.selection=Vw(e),this.diagnostic=Hw(e),e.state.facet(Sn)&&this.create(e)}create(e){const r=e.state.facet(Sn);if(!r)throw Error("Expected nonnull");this.inner=rn("div",{class:"cm-minimap-inner"}),this.canvas=rn("canvas"),this.dom=r.create(e).dom,this.dom.classList.add("cm-gutters"),this.dom.classList.add("cm-minimap-gutter"),this.inner.appendChild(this.canvas),this.dom.appendChild(this.inner),this.view.scrollDOM.insertBefore(this.dom,this.view.contentDOM.nextSibling);for(const n in this.view.state.facet(Lt).eventHandlers){const s=this.view.state.facet(Lt).eventHandlers[n];s&&this.dom.addEventListener(n,a=>s(a,this.view))}}remove(){this.dom&&this.dom.remove()}update(e){const r=e.startState.facet(Sn),n=e.state.facet(Sn);if(r&&!n){this.remove();return}!r&&n&&this.create(e.view),n&&(this.text.update(e),this.selection.update(e),this.diagnostic.update(e),this.render())}getWidth(){const e=this.view.dom.clientWidth;if(e<=Ht.MaxWidth*Tl){const r=e/(Ht.MaxWidth*Tl);return Ht.MaxWidth*r}return Ht.MaxWidth}render(){if(!this.dom||!this.canvas||!this.inner)return;this.text.beforeDraw(),this.updateBoxShadow(),this.dom.style.width=this.getWidth()+"px",this.canvas.style.maxWidth=this.getWidth()+"px",this.canvas.width=this.getWidth()*Ht.PixelMultiplier;const e=this.view.dom.getBoundingClientRect().height;this.inner.style.minHeight=e+"px",this.canvas.height=e*Ht.PixelMultiplier,this.canvas.style.height=e+"px";const r=this.canvas.getContext("2d");if(!r)return;r.clearRect(0,0,this.canvas.width,this.canvas.height);const{charWidth:n,lineHeight:s}=this.text.measure(r);let{startIndex:a,endIndex:i,offsetY:o}=this.canvasStartAndEndIndex(r,s);const l=this.view.state.facet(Lt).gutters;for(let c=a;c<i;c++){const d=this.view.state.field(dn);if(c>=d.length)break;const u={offsetX:0,offsetY:o,context:r,lineHeight:s,charWidth:n};if(l.length){u.offsetX+=2;for(let m of l)Jw(m,u,c+1),u.offsetX+=au;u.offsetX+=2}this.text.drawLine(u,c+1),this.selection.drawLine(u,c+1),this.diagnostic.drawLine(u,c+1),o+=s}r.restore()}canvasStartAndEndIndex(e,r){let{top:n,bottom:s}=this.view.documentPadding;n/=Ht.SizeRatio,s/=Ht.SizeRatio;const a=e.canvas.height,{clientHeight:i,scrollHeight:o,scrollTop:l}=this.view.scrollDOM;let c=l/(o-i);isNaN(c)&&(c=0);const d=this.view.state.field(dn).length,u=n+s+d*r,m=Math.max(0,c*(u-a)),h=Math.max(0,n-m),p=Math.round(Math.max(0,m-n)/r),g=Math.round((a-h)/r);return{startIndex:p,endIndex:p+g,offsetY:h}}updateBoxShadow(){if(!this.canvas)return;const{clientWidth:e,scrollWidth:r,scrollLeft:n}=this.view.scrollDOM;e+n<r?this.canvas.classList.add("cm-minimap-box-shadow"):this.canvas.classList.remove("cm-minimap-box-shadow")}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.render())}},provide:e=>er.scrollMargins.of(r=>{var n;const s=(n=r.plugin(e))===null||n===void 0?void 0:n.getWidth();return s?{right:s}:null})}),Sn=Cs.define({combine:e=>{var r;return(r=e.find(n=>n!==null))!==null&&r!==void 0?r:null},enables:e=>[[Lt.compute([e],r=>r.facet(e)),Yw,dn,Qw,Ww]]});function Ya({file:e,onClose:r,projectPath:n,isSidebar:s=!1,isExpanded:a=!1,onToggleExpand:i=null}){const[o,l]=f.useState(""),[c,d]=f.useState(!0),[u,m]=f.useState(!1),[h,p]=f.useState(!1),[g,x]=f.useState(()=>{const v=localStorage.getItem("codeEditorTheme");return v?v==="dark":!0}),[b,k]=f.useState(!1),[N,y]=f.useState(!!e.diffInfo),[P,W]=f.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[M,B]=f.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[L,U]=f.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[j,R]=f.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),D=f.useRef(null),_=f.useMemo(()=>{if(!e.diffInfo||!N||!M)return[];const v={};return[Sn.compute(["doc"],ue=>{const w=fa(ue)?.chunks||[];return Object.keys(v).forEach(J=>delete v[J]),w.forEach(J=>{const he=ue.doc.lineAt(J.fromB).number,ye=ue.doc.lineAt(Math.min(J.toB,ue.doc.length)).number;for(let re=he;re<=ye;re++)v[re]=g?"rgba(34, 197, 94, 0.8)":"rgba(34, 197, 94, 1)"}),{create:()=>({dom:document.createElement("div")}),displayText:"blocks",showOverlay:"always",gutters:[v]}})]},[e.diffInfo,N,M,g]),C=f.useMemo(()=>!e.diffInfo||!N?[]:[Ss.fromClass(class{constructor(v){setTimeout(()=>{const fe=fa(v.state)?.chunks||[];if(fe.length>0){const w=fe[0];v.dispatch({effects:er.scrollIntoView(w.fromB,{y:"center"})})}},100)}update(){}destroy(){}})],[e.diffInfo,N]),V=f.useMemo(()=>{const v=ue=>{const fe=document.createElement("div");fe.className="cm-editor-toolbar-panel";let w=0;const J=()=>{const he=e.diffInfo&&N,re=(he?fa(ue.state):null)?.chunks||[],Pe=re.length;let X='<div style="display: flex; align-items: center; justify-content: space-between; width: 100%;">';if(X+='<div style="display: flex; align-items: center; gap: 8px;">',he&&(X+=`
526
+ <span style="font-weight: 500;">${Pe>0?`${w+1}/${Pe}`:"0"} changes</span>
527
+ <button class="cm-diff-nav-btn cm-diff-nav-prev" title="Previous change" ${Pe===0?"disabled":""}>
528
+ <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
529
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7" />
530
+ </svg>
531
+ </button>
532
+ <button class="cm-diff-nav-btn cm-diff-nav-next" title="Next change" ${Pe===0?"disabled":""}>
533
+ <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
534
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
535
+ </svg>
536
+ </button>
537
+ `),X+="</div>",X+='<div style="display: flex; align-items: center; gap: 4px;">',e.diffInfo&&(X+=`
538
+ <button class="cm-toolbar-btn cm-toggle-diff-btn" title="${N?"Hide diff highlighting":"Show diff highlighting"}">
539
+ <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
540
+ ${N?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />':'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />'}
541
+ </svg>
542
+ </button>
543
+ `),X+=`
544
+ <button class="cm-toolbar-btn cm-settings-btn" title="Editor Settings">
545
+ <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
546
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
547
+ </svg>
548
+ </button>
549
+ `,s&&i&&(X+=`
550
+ <button class="cm-toolbar-btn cm-expand-btn" title="${a?"Collapse editor":"Expand editor to full width"}">
551
+ <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
552
+ ${a?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" />':'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" />'}
553
+ </svg>
554
+ </button>
555
+ `),X+="</div>",X+="</div>",fe.innerHTML=X,he){const ke=fe.querySelector(".cm-diff-nav-prev"),ge=fe.querySelector(".cm-diff-nav-next");ke?.addEventListener("click",()=>{if(re.length===0)return;w=w>0?w-1:re.length-1;const Ie=re[w];Ie&&ue.dispatch({effects:er.scrollIntoView(Ie.fromB,{y:"center"})}),J()}),ge?.addEventListener("click",()=>{if(re.length===0)return;w=w<re.length-1?w+1:0;const Ie=re[w];Ie&&ue.dispatch({effects:er.scrollIntoView(Ie.fromB,{y:"center"})}),J()})}e.diffInfo&&fe.querySelector(".cm-toggle-diff-btn")?.addEventListener("click",()=>{y(!N)}),fe.querySelector(".cm-settings-btn")?.addEventListener("click",()=>{window.openSettings&&window.openSettings("appearance")}),s&&i&&fe.querySelector(".cm-expand-btn")?.addEventListener("click",()=>{i()})};return J(),{top:!0,dom:fe,update:J}};return[Fu.of(v)]},[e.diffInfo,N,s,a,i]),z=v=>{const ue=v.split(".").pop()?.toLowerCase();switch(ue){case"js":case"jsx":case"ts":case"tsx":return[Uu({jsx:!0,typescript:ue.includes("ts")})];case"py":return[Wu()];case"html":case"htm":return[Bu()];case"css":case"scss":case"less":return[Ou()];case"json":return[$u()];case"md":case"markdown":return[Wl()];default:return[]}};f.useEffect(()=>{(async()=>{try{if(d(!0),e.diffInfo&&e.diffInfo.new_string!==void 0&&e.diffInfo.old_string!==void 0){l(e.diffInfo.new_string),d(!1);return}const ue=await Ue.readFile(e.projectName,e.path);if(!ue.ok)throw new Error(`Failed to load file: ${ue.status} ${ue.statusText}`);const fe=await ue.json();l(fe.content)}catch(ue){console.error("Error loading file:",ue),l(`// Error loading file: ${ue.message}
556
+ // File: ${e.name}
557
+ // Path: ${e.path}`)}finally{d(!1)}})()},[e,n]);const Z=async()=>{m(!0);try{console.log("Saving file:",{projectName:e.projectName,path:e.path,contentLength:o?.length});const v=await Ue.saveFile(e.projectName,e.path,o);if(console.log("Save response:",{status:v.status,ok:v.ok,contentType:v.headers.get("content-type")}),!v.ok){const fe=v.headers.get("content-type");if(fe&&fe.includes("application/json")){const w=await v.json();throw new Error(w.error||`Save failed: ${v.status}`)}else{const w=await v.text();throw console.error("Non-JSON error response:",w),new Error(`Save failed: ${v.status} ${v.statusText}`)}}const ue=await v.json();console.log("Save successful:",ue),k(!0),setTimeout(()=>k(!1),2e3)}catch(v){console.error("Error saving file:",v),alert(`Error saving file: ${v.message}`)}finally{m(!1)}},F=()=>{const v=new Blob([o],{type:"text/plain"}),ue=URL.createObjectURL(v),fe=document.createElement("a");fe.href=ue,fe.download=e.name,document.body.appendChild(fe),fe.click(),document.body.removeChild(fe),URL.revokeObjectURL(ue)},ce=()=>{p(!h)};return f.useEffect(()=>{localStorage.setItem("codeEditorTheme",g?"dark":"light")},[g]),f.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",P.toString())},[P]),f.useEffect(()=>{const v=()=>{const ue=localStorage.getItem("codeEditorTheme");ue&&x(ue==="dark");const fe=localStorage.getItem("codeEditorWordWrap");fe!==null&&W(fe==="true");const w=localStorage.getItem("codeEditorShowMinimap");w!==null&&B(w!=="false");const J=localStorage.getItem("codeEditorLineNumbers");J!==null&&U(J!=="false");const he=localStorage.getItem("codeEditorFontSize");he&&R(he)};return window.addEventListener("storage",v),window.addEventListener("codeEditorSettingsChanged",v),()=>{window.removeEventListener("storage",v),window.removeEventListener("codeEditorSettingsChanged",v)}},[]),f.useEffect(()=>{const v=ue=>{(ue.ctrlKey||ue.metaKey)&&(ue.key==="s"?(ue.preventDefault(),Z()):ue.key==="Escape"&&(ue.preventDefault(),r()))};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]),c?t.jsxs(t.Fragment,{children:[t.jsx("style",{children:`
558
+ .code-editor-loading {
559
+ background-color: ${g?"#111827":"#ffffff"} !important;
560
+ }
561
+ .code-editor-loading:hover {
562
+ background-color: ${g?"#111827":"#ffffff"} !important;
563
+ }
564
+ `}),s?t.jsx("div",{className:"w-full h-full flex items-center justify-center bg-white dark:bg-gray-900",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),t.jsxs("span",{className:"text-gray-900 dark:text-white",children:["Loading ",e.name,"..."]})]})}):t.jsx("div",{className:"fixed inset-0 z-40 md:bg-black/50 md:flex md:items-center md:justify-center",children:t.jsx("div",{className:"code-editor-loading w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),t.jsxs("span",{className:"text-gray-900 dark:text-white",children:["Loading ",e.name,"..."]})]})})})]}):t.jsxs(t.Fragment,{children:[t.jsx("style",{children:`
565
+ /* Light background for full line changes */
566
+ .cm-deletedChunk {
567
+ background-color: ${g?"rgba(239, 68, 68, 0.15)":"rgba(255, 235, 235, 1)"} !important;
568
+ border-left: 3px solid ${g?"rgba(239, 68, 68, 0.6)":"rgb(239, 68, 68)"} !important;
569
+ padding-left: 4px !important;
570
+ }
571
+
572
+ .cm-insertedChunk {
573
+ background-color: ${g?"rgba(34, 197, 94, 0.15)":"rgba(230, 255, 237, 1)"} !important;
574
+ border-left: 3px solid ${g?"rgba(34, 197, 94, 0.6)":"rgb(34, 197, 94)"} !important;
575
+ padding-left: 4px !important;
576
+ }
577
+
578
+ /* Override linear-gradient underline and use solid darker background for partial changes */
579
+ .cm-editor.cm-merge-b .cm-changedText {
580
+ background: ${g?"rgba(34, 197, 94, 0.4)":"rgba(34, 197, 94, 0.3)"} !important;
581
+ padding-top: 2px !important;
582
+ padding-bottom: 2px !important;
583
+ margin-top: -2px !important;
584
+ margin-bottom: -2px !important;
585
+ }
586
+
587
+ .cm-editor .cm-deletedChunk .cm-changedText {
588
+ background: ${g?"rgba(239, 68, 68, 0.4)":"rgba(239, 68, 68, 0.3)"} !important;
589
+ padding-top: 2px !important;
590
+ padding-bottom: 2px !important;
591
+ margin-top: -2px !important;
592
+ margin-bottom: -2px !important;
593
+ }
594
+
595
+ /* Minimap gutter styling */
596
+ .cm-gutter.cm-gutter-minimap {
597
+ background-color: ${g?"#1e1e1e":"#f5f5f5"};
598
+ }
599
+
600
+ /* Editor toolbar panel styling */
601
+ .cm-editor-toolbar-panel {
602
+ padding: 8px 12px;
603
+ background-color: ${g?"#1f2937":"#ffffff"};
604
+ border-bottom: 1px solid ${g?"#374151":"#e5e7eb"};
605
+ color: ${g?"#d1d5db":"#374151"};
606
+ font-size: 14px;
607
+ }
608
+
609
+ .cm-diff-nav-btn,
610
+ .cm-toolbar-btn {
611
+ padding: 4px;
612
+ background: transparent;
613
+ border: none;
614
+ cursor: pointer;
615
+ border-radius: 4px;
616
+ display: inline-flex;
617
+ align-items: center;
618
+ justify-content: center;
619
+ color: inherit;
620
+ transition: background-color 0.2s;
621
+ }
622
+
623
+ .cm-diff-nav-btn:hover,
624
+ .cm-toolbar-btn:hover {
625
+ background-color: ${g?"#374151":"#f3f4f6"};
626
+ }
627
+
628
+ .cm-diff-nav-btn:disabled {
629
+ opacity: 0.5;
630
+ cursor: not-allowed;
631
+ }
632
+ `}),t.jsx("div",{className:s?"w-full h-full flex flex-col":`fixed inset-0 z-40 md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${h?"md:p-0":""}`,children:t.jsxs("div",{className:s?"bg-white dark:bg-gray-900 flex flex-col w-full h-full":`bg-white shadow-2xl flex flex-col ${"w-full h-full md:rounded-lg md:shadow-2xl"+(h?" md:w-full md:h-full md:rounded-none":" md:w-full md:max-w-6xl md:h-[80vh] md:max-h-[80vh]")}`,children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0 min-w-0",children:[t.jsx("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("h3",{className:"font-medium text-gray-900 dark:text-white truncate",children:e.name}),e.diffInfo&&t.jsx("span",{className:"text-xs bg-blue-100 dark:bg-blue-900 text-blue-600 dark:text-blue-300 px-2 py-1 rounded whitespace-nowrap",children:"Showing changes"})]}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 truncate",children:e.path})]})}),t.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[t.jsx("button",{onClick:F,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download file",children:t.jsx(ps,{className:"w-5 h-5 md:w-4 md:h-4"})}),t.jsx("button",{onClick:Z,disabled:u,className:`px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors min-h-[44px] md:min-h-0 ${b?"bg-green-600 hover:bg-green-700":"bg-blue-600 hover:bg-blue-700"}`,children:b?t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):t.jsxs(t.Fragment,{children:[t.jsx(fs,{className:"w-5 h-5 md:w-4 md:h-4"}),t.jsx("span",{className:"hidden sm:inline",children:u?"Saving...":"Save"})]})}),!s&&t.jsx("button",{onClick:ce,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:h?"Exit fullscreen":"Fullscreen",children:h?t.jsx(Jl,{className:"w-4 h-4"}):t.jsx(ri,{className:"w-4 h-4"})}),t.jsx("button",{onClick:r,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:t.jsx(ct,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(Ol,{ref:D,value:o,onChange:l,extensions:[...z(e.name),...V,...e.diffInfo&&N&&e.diffInfo.old_string!==void 0?[Mw({original:e.diffInfo.old_string,mergeControls:!1,highlightChanges:!0,syntaxHighlightDeletions:!1,gutter:!0}),..._,...C]:[],...P?[er.lineWrapping]:[]],theme:g?Bl:void 0,height:"100%",style:{fontSize:`${j}px`,height:"100%"},basicSetup:{lineNumbers:L,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),t.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[t.jsxs("span",{children:["Lines: ",o.split(`
633
+ `).length]}),t.jsxs("span",{children:["Characters: ",o.length]})]}),t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]})})]})}function Xw({file:e,onClose:r}){const n=`/api/projects/${e.projectName}/files/content?path=${encodeURIComponent(e.path)}`;return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl max-h-[90vh] w-full mx-4 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:e.name}),t.jsx(Le,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:t.jsx(ct,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"p-4 flex justify-center items-center bg-gray-50 dark:bg-gray-900 min-h-[400px]",children:[t.jsx("img",{src:n,alt:e.name,className:"max-w-full max-h-[70vh] object-contain rounded-lg shadow-md",onError:s=>{s.target.style.display="none",s.target.nextSibling.style.display="block"}}),t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",style:{display:"none"},children:[t.jsx("p",{children:"Unable to load image"}),t.jsx("p",{className:"text-sm mt-2",children:e.path})]})]}),t.jsx("div",{className:"p-4 border-t bg-gray-50 dark:bg-gray-800",children:t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:e.path})})]})})}function Zw({selectedProject:e}){const[r,n]=f.useState([]),[s,a]=f.useState(!1),[i,o]=f.useState(new Set),[l,c]=f.useState(null),[d,u]=f.useState(null),[m,h]=f.useState("detailed"),[p,g]=f.useState(""),[x,b]=f.useState([]);f.useEffect(()=>{e&&N()},[e]),f.useEffect(()=>{const D=localStorage.getItem("file-tree-view-mode");D&&["simple","detailed","compact"].includes(D)&&h(D)},[]),f.useEffect(()=>{if(!p.trim())b(r);else{const D=k(r,p.toLowerCase());b(D);const _=C=>{C.forEach(V=>{V.type==="directory"&&V.children&&V.children.length>0&&(o(z=>new Set(z.add(V.path))),_(V.children))})};_(D)}},[r,p]);const k=(D,_)=>D.reduce((C,V)=>{const z=V.name.toLowerCase().includes(_);let Z=[];return V.type==="directory"&&V.children&&(Z=k(V.children,_)),(z||Z.length>0)&&C.push({...V,children:Z}),C},[]),N=async()=>{a(!0);try{const D=await Ue.getFiles(e.name);if(!D.ok){const C=await D.text();console.error("❌ File fetch failed:",D.status,C),n([]);return}const _=await D.json();n(_)}catch(D){console.error("❌ Error fetching files:",D),n([])}finally{a(!1)}},y=D=>{const _=new Set(i);_.has(D)?_.delete(D):_.add(D),o(_)},P=D=>{h(D),localStorage.setItem("file-tree-view-mode",D)},W=D=>{if(!D||D===0)return"0 B";const _=1024,C=["B","KB","MB","GB"],V=Math.floor(Math.log(D)/Math.log(_));return parseFloat((D/Math.pow(_,V)).toFixed(1))+" "+C[V]},M=D=>{if(!D)return"-";const _=new Date,C=new Date(D),V=Math.floor((_-C)/1e3);return V<60?"just now":V<3600?`${Math.floor(V/60)} min ago`:V<86400?`${Math.floor(V/3600)} hours ago`:V<2592e3?`${Math.floor(V/86400)} days ago`:C.toLocaleDateString()},B=(D,_=0)=>D.map(C=>t.jsxs("div",{className:"select-none",children:[t.jsx(Le,{variant:"ghost",className:Me("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent"),style:{paddingLeft:`${_*16+12}px`},onClick:()=>{C.type==="directory"?y(C.path):L(C.name)?u({name:C.name,path:C.path,projectPath:e.path,projectName:e.name}):c({name:C.name,path:C.path,projectPath:e.path,projectName:e.name})},children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[C.type==="directory"?i.has(C.path)?t.jsx($r,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):t.jsx(or,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):U(C.name),t.jsx("span",{className:"text-sm truncate text-foreground",children:C.name})]})}),C.type==="directory"&&i.has(C.path)&&C.children&&C.children.length>0&&t.jsx("div",{children:B(C.children,_+1)})]},C.path)),L=D=>{const _=D.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(_)},U=D=>{const _=D.split(".").pop()?.toLowerCase(),C=["js","jsx","ts","tsx","py","java","cpp","c","php","rb","go","rs"],V=["md","txt","doc","pdf"],z=["png","jpg","jpeg","gif","svg","webp","ico","bmp"];return C.includes(_)?t.jsx($m,{className:"w-4 h-4 text-green-500 flex-shrink-0"}):V.includes(_)?t.jsx($t,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):z.includes(_)?t.jsx(Hi,{className:"w-4 h-4 text-purple-500 flex-shrink-0"}):t.jsx(Hi,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"})},j=(D,_=0)=>D.map(C=>t.jsxs("div",{className:"select-none",children:[t.jsxs("div",{className:Me("grid grid-cols-12 gap-2 p-2 hover:bg-accent cursor-pointer items-center"),style:{paddingLeft:`${_*16+12}px`},onClick:()=>{C.type==="directory"?y(C.path):L(C.name)?u({name:C.name,path:C.path,projectPath:e.path,projectName:e.name}):c({name:C.name,path:C.path,projectPath:e.path,projectName:e.name})},children:[t.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[C.type==="directory"?i.has(C.path)?t.jsx($r,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):t.jsx(or,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):U(C.name),t.jsx("span",{className:"text-sm truncate text-foreground",children:C.name})]}),t.jsx("div",{className:"col-span-2 text-sm text-muted-foreground",children:C.type==="file"?W(C.size):"-"}),t.jsx("div",{className:"col-span-3 text-sm text-muted-foreground",children:M(C.modified)}),t.jsx("div",{className:"col-span-2 text-sm text-muted-foreground font-mono",children:C.permissionsRwx||"-"})]}),C.type==="directory"&&i.has(C.path)&&C.children&&j(C.children,_+1)]},C.path)),R=(D,_=0)=>D.map(C=>t.jsxs("div",{className:"select-none",children:[t.jsxs("div",{className:Me("flex items-center justify-between p-2 hover:bg-accent cursor-pointer"),style:{paddingLeft:`${_*16+12}px`},onClick:()=>{C.type==="directory"?y(C.path):L(C.name)?u({name:C.name,path:C.path,projectPath:e.path,projectName:e.name}):c({name:C.name,path:C.path,projectPath:e.path,projectName:e.name})},children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[C.type==="directory"?i.has(C.path)?t.jsx($r,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):t.jsx(or,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):U(C.name),t.jsx("span",{className:"text-sm truncate text-foreground",children:C.name})]}),t.jsx("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:C.type==="file"&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:W(C.size)}),t.jsx("span",{className:"font-mono",children:C.permissionsRwx})]})})]}),C.type==="directory"&&i.has(C.path)&&C.children&&R(C.children,_+1)]},C.path));return s?t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading files..."})}):t.jsxs("div",{className:"h-full flex flex-col bg-card",children:[t.jsxs("div",{className:"p-4 border-b border-border space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Files"}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(Le,{variant:m==="simple"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>P("simple"),title:"Simple view",children:t.jsx(hs,{className:"w-4 h-4"})}),t.jsx(Le,{variant:m==="compact"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>P("compact"),title:"Compact view",children:t.jsx($n,{className:"w-4 h-4"})}),t.jsx(Le,{variant:m==="detailed"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>P("detailed"),title:"Detailed view",children:t.jsx(Bp,{className:"w-4 h-4"})})]})]}),t.jsxs("div",{className:"relative",children:[t.jsx(nn,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),t.jsx(Et,{type:"text",placeholder:"Search files and folders...",value:p,onChange:D=>g(D.target.value),className:"pl-8 pr-8 h-8 text-sm"}),p&&t.jsx(Le,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-accent",onClick:()=>g(""),title:"Clear search",children:t.jsx(ct,{className:"w-3 h-3"})})]})]}),m==="detailed"&&x.length>0&&t.jsx("div",{className:"px-4 pt-2 pb-1 border-b border-border",children:t.jsxs("div",{className:"grid grid-cols-12 gap-2 px-2 text-xs font-medium text-muted-foreground",children:[t.jsx("div",{className:"col-span-5",children:"Name"}),t.jsx("div",{className:"col-span-2",children:"Size"}),t.jsx("div",{className:"col-span-3",children:"Modified"}),t.jsx("div",{className:"col-span-2",children:"Permissions"})]})}),t.jsx(si,{className:"flex-1 p-4",children:r.length===0?t.jsxs("div",{className:"text-center py-8",children:[t.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:t.jsx(or,{className:"w-6 h-6 text-muted-foreground"})}),t.jsx("h4",{className:"font-medium text-foreground mb-1",children:"No files found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Check if the project path is accessible"})]}):x.length===0&&p?t.jsxs("div",{className:"text-center py-8",children:[t.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:t.jsx(nn,{className:"w-6 h-6 text-muted-foreground"})}),t.jsx("h4",{className:"font-medium text-foreground mb-1",children:"No matches found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Try a different search term or clear the search"})]}):t.jsxs("div",{className:m==="detailed"?"":"space-y-1",children:[m==="simple"&&B(x),m==="compact"&&R(x),m==="detailed"&&j(x)]})}),l&&t.jsx(Ya,{file:l,onClose:()=>c(null),projectPath:l.projectPath}),d&&t.jsx(Xw,{file:d,onClose:()=>u(null)})]})}function iu({project:e,session:r=null,command:n=null,isActive:s=!0,isPlainShell:a=null,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:d="",showHeader:u=!0,compact:m=!1}){const[h,p]=f.useState(!1),g=a!==null?a:n!==null,x=b=>{p(!0),o&&o(b)};return e?t.jsxs("div",{className:`h-full flex flex-col ${d}`,children:[u&&c&&t.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-200",children:c}),h&&t.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),l&&t.jsx("button",{onClick:l,className:"text-gray-400 hover:text-white",title:"Close",children:t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),t.jsx("div",{className:"flex-1",children:t.jsx(Ni,{selectedProject:e,selectedSession:r,isActive:s,initialCommand:n,isPlainShell:g,onProcessComplete:x})})]}):t.jsx("div",{className:`h-full flex items-center justify-center ${d}`,children:t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[t.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),t.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Project Selected"}),t.jsx("p",{children:"A project is required to open a shell"})]})})}function Dl({diff:e,fileName:r,isMobile:n,wrapText:s}){if(!e)return t.jsx("div",{className:"p-4 text-center text-gray-500 dark:text-gray-400 text-sm",children:"No diff available"});const a=(i,o)=>{const l=i.startsWith("+")&&!i.startsWith("+++"),c=i.startsWith("-")&&!i.startsWith("---"),d=i.startsWith("@@");return t.jsx("div",{className:`font-mono text-xs p-2 ${n&&s?"whitespace-pre-wrap break-all":"whitespace-pre overflow-x-auto"} ${l?"bg-green-50 dark:bg-green-950 text-green-700 dark:text-green-300":c?"bg-red-50 dark:bg-red-950 text-red-700 dark:text-red-300":d?"bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400"}`,children:i},o)};return t.jsx("div",{className:"diff-viewer",children:e.split(`
634
+ `).map((i,o)=>a(i,o))})}function e1({selectedProject:e,isMobile:r,onFileOpen:n}){const[s,a]=f.useState(null),[i,o]=f.useState({}),[l,c]=f.useState(!1),[d,u]=f.useState(""),[m,h]=f.useState(new Set),[p,g]=f.useState(new Set),[x,b]=f.useState(!1),[k,N]=f.useState(""),[y,P]=f.useState([]),[W,M]=f.useState(!0),[B,L]=f.useState(!1),[U,j]=f.useState(!1),[R,D]=f.useState(!1),[_,C]=f.useState(""),[V,z]=f.useState(!1),[Z,F]=f.useState("changes"),[ce,v]=f.useState([]),[ue,fe]=f.useState(new Set),[w,J]=f.useState({}),[he,ye]=f.useState(!1),[re,Pe]=f.useState(null),[X,le]=f.useState(!1),[ke,ge]=f.useState(!1),[Ie,Ke]=f.useState(!1),[et,st]=f.useState(!1),[ft,tt]=f.useState(r),[xe,qe]=f.useState(null),it=f.useRef(null),ve=f.useRef(null),[Ct,Q]=f.useState(()=>localStorage.getItem("selected-provider")||"claude");f.useEffect(()=>{const E=()=>{const $=localStorage.getItem("selected-provider")||"claude";Q($)};return window.addEventListener("storage",E),()=>window.removeEventListener("storage",E)},[]),f.useEffect(()=>{e&&(de(),T(),O(),Z==="history"&&gt())},[e,Z]),f.useEffect(()=>{const E=$=>{ve.current&&!ve.current.contains($.target)&&j(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);const de=async()=>{if(e){c(!0);try{const $=await(await Fe(`/api/git/status?project=${encodeURIComponent(e.name)}`)).json();if($.error)console.error("Git status error:",$.error),a({error:$.error,details:$.details});else{a($),N($.branch||"main");const ae=new Set([...$.modified||[],...$.added||[],...$.deleted||[],...$.untracked||[]]);g(ae);for(const q of $.modified||[])ze(q);for(const q of $.added||[])ze(q);for(const q of $.deleted||[])ze(q);for(const q of $.untracked||[])ze(q)}}catch(E){console.error("Error fetching git status:",E)}finally{c(!1)}}},T=async()=>{try{const $=await(await Fe(`/api/git/branches?project=${encodeURIComponent(e.name)}`)).json();!$.error&&$.branches&&P($.branches)}catch(E){console.error("Error fetching branches:",E)}},O=async()=>{if(e)try{const $=await(await Fe(`/api/git/remote-status?project=${encodeURIComponent(e.name)}`)).json();$.error?Pe(null):Pe($)}catch(E){console.error("Error fetching remote status:",E),Pe(null)}},ne=async E=>{try{const ae=await(await Fe("/api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:E})})).json();ae.success?(N(E),j(!1),de()):console.error("Failed to switch branch:",ae.error)}catch($){console.error("Error switching branch:",$)}},Ce=async()=>{if(_.trim()){z(!0);try{const $=await(await Fe("/api/git/create-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:_.trim()})})).json();$.success?(N(_.trim()),D(!1),j(!1),C(""),T(),de()):console.error("Failed to create branch:",$.error)}catch(E){console.error("Error creating branch:",E)}finally{z(!1)}}},De=async()=>{le(!0);try{const $=await(await Fe("/api/git/fetch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();$.success?(de(),O()):console.error("Fetch failed:",$.error)}catch(E){console.error("Error fetching from remote:",E)}finally{le(!1)}},ee=async()=>{ge(!0);try{const $=await(await Fe("/api/git/pull",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();$.success?(de(),O()):console.error("Pull failed:",$.error)}catch(E){console.error("Error pulling from remote:",E)}finally{ge(!1)}},me=async()=>{Ke(!0);try{const $=await(await Fe("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();$.success?(de(),O()):console.error("Push failed:",$.error)}catch(E){console.error("Error pushing to remote:",E)}finally{Ke(!1)}},oe=async()=>{st(!0);try{const $=await(await Fe("/api/git/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:k})})).json();$.success?(de(),O()):console.error("Publish failed:",$.error)}catch(E){console.error("Error publishing branch:",E)}finally{st(!1)}},we=async E=>{try{const ae=await(await Fe("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:E})})).json();ae.success?(g(q=>{const _e=new Set(q);return _e.delete(E),_e}),de()):console.error("Discard failed:",ae.error)}catch($){console.error("Error discarding changes:",$)}},Ee=async E=>{try{const ae=await(await Fe("/api/git/delete-untracked",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:E})})).json();ae.success?(g(q=>{const _e=new Set(q);return _e.delete(E),_e}),de()):console.error("Delete failed:",ae.error)}catch($){console.error("Error deleting untracked file:",$)}},Be=async()=>{if(!xe)return;const{type:E,file:$,message:ae}=xe;qe(null);try{switch(E){case"discard":await we($);break;case"delete":await Ee($);break;case"commit":await Wt();break;case"pull":await ee();break;case"push":await me();break;case"publish":await oe();break}}catch(q){console.error(`Error executing ${E}:`,q)}},ze=async E=>{try{const ae=await(await Fe(`/api/git/diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(E)}`)).json();!ae.error&&ae.diff&&o(q=>({...q,[E]:ae.diff}))}catch($){console.error("Error fetching file diff:",$)}},Xe=async E=>{if(n)try{const ae=await(await Fe(`/api/git/file-with-diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(E)}`)).json();if(ae.error){console.error("Error fetching file with diff:",ae.error),n(E);return}const q={old_string:ae.oldContent||"",new_string:ae.currentContent||""};n(E,q)}catch($){console.error("Error opening file:",$),n(E)}},gt=async()=>{try{const $=await(await Fe(`/api/git/commits?project=${encodeURIComponent(e.name)}&limit=10`)).json();!$.error&&$.commits&&v($.commits)}catch(E){console.error("Error fetching commits:",E)}},ot=async E=>{try{const ae=await(await Fe(`/api/git/commit-diff?project=${encodeURIComponent(e.name)}&commit=${E}`)).json();!ae.error&&ae.diff&&J(q=>({...q,[E]:ae.diff}))}catch($){console.error("Error fetching commit diff:",$)}},vt=async()=>{ye(!0);try{const $=await(await Fe("/api/git/generate-commit-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,files:Array.from(p),provider:Ct})})).json();$.message?u($.message):console.error("Failed to generate commit message:",$.error)}catch(E){console.error("Error generating commit message:",E)}finally{ye(!1)}},Gt=E=>{h($=>{const ae=new Set($);return ae.has(E)?ae.delete(E):ae.add(E),ae})},Kt=E=>{fe($=>{const ae=new Set($);return ae.has(E)?ae.delete(E):(ae.add(E),w[E]||ot(E)),ae})},Nt=E=>{g($=>{const ae=new Set($);return ae.has(E)?ae.delete(E):ae.add(E),ae})},Wt=async()=>{if(!(!d.trim()||p.size===0)){b(!0);try{const $=await(await Fe("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,message:d,files:Array.from(p)})})).json();$.success?(u(""),g(new Set),de(),O()):console.error("Commit failed:",$.error)}catch(E){console.error("Error committing changes:",E)}finally{b(!1)}}},Jt=E=>{switch(E){case"M":return"Modified";case"A":return"Added";case"D":return"Deleted";case"U":return"Untracked";default:return E}},Rt=E=>{const $=ue.has(E.hash),ae=w[E.hash];return t.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[t.jsxs("div",{className:"flex items-start p-3 hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer",onClick:()=>Kt(E.hash),children:[t.jsx("div",{className:"mr-2 mt-1 p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:$?t.jsx(Zt,{className:"w-3 h-3"}):t.jsx(Er,{className:"w-3 h-3"})}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:E.message}),t.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:[E.author," • ",E.date]})]}),t.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 flex-shrink-0",children:E.hash.substring(0,7)})]})})]}),$&&ae&&t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900",children:t.jsxs("div",{className:"max-h-96 overflow-y-auto p-2",children:[t.jsx("div",{className:"text-xs font-mono text-gray-600 dark:text-gray-400 mb-2",children:E.stats}),t.jsx(Dl,{diff:ae,fileName:"commit",isMobile:r,wrapText:W})]})})]},E.hash)},I=(E,$)=>{const ae=m.has(E),q=p.has(E),_e=i[E];return t.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[t.jsxs("div",{className:`flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 ${r?"px-2 py-1.5":"px-3 py-2"}`,children:[t.jsx("input",{type:"checkbox",checked:q,onChange:()=>Nt(E),onClick:at=>at.stopPropagation(),className:`rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600 ${r?"mr-1.5":"mr-2"}`}),t.jsxs("div",{className:"flex items-center flex-1",children:[t.jsx("div",{className:`p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded cursor-pointer ${r?"mr-1":"mr-2"}`,onClick:at=>{at.stopPropagation(),Gt(E)},children:t.jsx(Er,{className:`w-3 h-3 transition-transform duration-200 ease-in-out ${ae?"rotate-90":"rotate-0"}`})}),t.jsx("span",{className:`flex-1 truncate ${r?"text-xs":"text-sm"} cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 hover:underline`,onClick:at=>{at.stopPropagation(),Xe(E)},title:"Click to open file",children:E}),t.jsxs("div",{className:"flex items-center gap-1",children:[($==="M"||$==="D")&&t.jsxs("button",{onClick:at=>{at.stopPropagation(),qe({type:"discard",file:E,message:`Discard all changes to "${E}"? This action cannot be undone.`})},className:`${r?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Discard changes",children:[t.jsx(nr,{className:"w-3 h-3"}),r&&t.jsx("span",{children:"Discard"})]}),$==="U"&&t.jsxs("button",{onClick:at=>{at.stopPropagation(),qe({type:"delete",file:E,message:`Delete untracked file "${E}"? This action cannot be undone.`})},className:`${r?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Delete untracked file",children:[t.jsx(nr,{className:"w-3 h-3"}),r&&t.jsx("span",{children:"Delete"})]}),t.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${$==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":$==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":$==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,title:Jt($),children:$})]})]})]}),t.jsxs("div",{className:`bg-gray-50 dark:bg-gray-900 transition-all duration-400 ease-in-out overflow-hidden ${ae&&_e?"max-h-[600px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-1"}`,children:[t.jsxs("div",{className:"flex items-center justify-between p-2 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${$==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":$==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":$==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,children:$}),t.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:Jt($)})]}),r&&t.jsx("button",{onClick:at=>{at.stopPropagation(),M(!W)},className:"text-xs text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",title:W?"Switch to horizontal scroll":"Switch to text wrap",children:W?"↔️ Scroll":"↩️ Wrap"})]}),t.jsx("div",{className:"max-h-96 overflow-y-auto",children:_e&&t.jsx(Dl,{diff:_e,fileName:E,isMobile:r,wrapText:W})})]})]},E)};return e?t.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[t.jsxs("div",{className:`flex items-center justify-between border-b border-gray-200 dark:border-gray-700 ${r?"px-3 py-2":"px-4 py-3"}`,children:[t.jsxs("div",{className:"relative",ref:ve,children:[t.jsxs("button",{onClick:()=>j(!U),className:`flex items-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors ${r?"space-x-1 px-2 py-1":"space-x-2 px-3 py-1.5"}`,children:[t.jsx(xa,{className:`text-gray-600 dark:text-gray-400 ${r?"w-3 h-3":"w-4 h-4"}`}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:`font-medium ${r?"text-xs":"text-sm"}`,children:k}),re?.hasRemote&&t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[re.ahead>0&&t.jsxs("span",{className:"text-green-600 dark:text-green-400",title:`${re.ahead} commit${re.ahead!==1?"s":""} ahead`,children:["↑",re.ahead]}),re.behind>0&&t.jsxs("span",{className:"text-blue-600 dark:text-blue-400",title:`${re.behind} commit${re.behind!==1?"s":""} behind`,children:["↓",re.behind]}),re.isUpToDate&&t.jsx("span",{className:"text-gray-500 dark:text-gray-400",title:"Up to date with remote",children:"✓"})]})]}),t.jsx(Zt,{className:`w-3 h-3 text-gray-500 transition-transform ${U?"rotate-180":""}`})]}),U&&t.jsxs("div",{className:"absolute top-full left-0 mt-1 w-64 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-50",children:[t.jsx("div",{className:"py-1 max-h-64 overflow-y-auto",children:y.map(E=>t.jsx("button",{onClick:()=>ne(E),className:`w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${E===k?"bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:t.jsxs("div",{className:"flex items-center space-x-2",children:[E===k&&t.jsx(Fr,{className:"w-3 h-3 text-green-600 dark:text-green-400"}),t.jsx("span",{className:E===k?"font-medium":"",children:E})]})},E))}),t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 py-1",children:t.jsxs("button",{onClick:()=>{D(!0),j(!1)},className:"w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center space-x-2",children:[t.jsx(Dt,{className:"w-3 h-3"}),t.jsx("span",{children:"Create new branch"})]})})]})]}),t.jsxs("div",{className:`flex items-center ${r?"gap-1":"gap-2"}`,children:[re?.hasRemote&&t.jsxs(t.Fragment,{children:[!re?.hasUpstream&&t.jsxs("button",{onClick:()=>qe({type:"publish",message:`Publish branch "${k}" to ${re.remoteName}?`}),disabled:et,className:"px-2 py-1 text-xs bg-purple-600 text-white rounded hover:bg-purple-700 disabled:opacity-50 flex items-center gap-1",title:`Publish branch "${k}" to ${re.remoteName}`,children:[t.jsx(Zn,{className:`w-3 h-3 ${et?"animate-pulse":""}`}),t.jsx("span",{children:et?"Publishing...":"Publish"})]}),re?.hasUpstream&&!re?.isUpToDate&&t.jsxs(t.Fragment,{children:[re.behind>0&&t.jsxs("button",{onClick:()=>qe({type:"pull",message:`Pull ${re.behind} commit${re.behind!==1?"s":""} from ${re.remoteName}?`}),disabled:ke,className:"px-2 py-1 text-xs bg-green-600 text-white rounded hover:bg-green-700 disabled:opacity-50 flex items-center gap-1",title:`Pull ${re.behind} commit${re.behind!==1?"s":""} from ${re.remoteName}`,children:[t.jsx(ps,{className:`w-3 h-3 ${ke?"animate-pulse":""}`}),t.jsx("span",{children:ke?"Pulling...":`Pull ${re.behind}`})]}),re.ahead>0&&t.jsxs("button",{onClick:()=>qe({type:"push",message:`Push ${re.ahead} commit${re.ahead!==1?"s":""} to ${re.remoteName}?`}),disabled:Ie,className:"px-2 py-1 text-xs bg-orange-600 text-white rounded hover:bg-orange-700 disabled:opacity-50 flex items-center gap-1",title:`Push ${re.ahead} commit${re.ahead!==1?"s":""} to ${re.remoteName}`,children:[t.jsx(Zn,{className:`w-3 h-3 ${Ie?"animate-pulse":""}`}),t.jsx("span",{children:Ie?"Pushing...":`Push ${re.ahead}`})]}),(re.ahead>0||re.behind>0&&re.ahead>0)&&t.jsxs("button",{onClick:De,disabled:X,className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 flex items-center gap-1",title:`Fetch from ${re.remoteName}`,children:[t.jsx(Sr,{className:`w-3 h-3 ${X?"animate-spin":""}`}),t.jsx("span",{children:X?"Fetching...":"Fetch"})]})]})]}),t.jsx("button",{onClick:()=>{de(),T(),O()},disabled:l,className:`hover:bg-gray-100 dark:hover:bg-gray-800 rounded ${r?"p-1":"p-1.5"}`,children:t.jsx(Sr,{className:`${l?"animate-spin":""} ${r?"w-3 h-3":"w-4 h-4"}`})})]})]}),s?.error?t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-500 dark:text-gray-400 px-6 py-12",children:[t.jsx(xa,{className:"w-20 h-20 mb-6 opacity-30"}),t.jsx("h3",{className:"text-xl font-medium mb-3 text-center",children:s.error}),s.details&&t.jsx("p",{className:"text-sm text-center leading-relaxed mb-6 max-w-md",children:s.details}),t.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800 max-w-md",children:t.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300 text-center",children:[t.jsx("strong",{children:"Tip:"})," Run ",t.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-2 py-1 rounded font-mono text-xs",children:"git init"})," in your project directory to initialize git source control."]})})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`flex border-b border-gray-200 dark:border-gray-700 transition-all duration-300 ease-in-out ${m.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[t.jsx("button",{onClick:()=>F("changes"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${Z==="changes"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:t.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.jsx($t,{className:"w-4 h-4"}),t.jsx("span",{children:"Changes"})]})}),t.jsx("button",{onClick:()=>F("history"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${Z==="history"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:t.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.jsx(Vi,{className:"w-4 h-4"}),t.jsx("span",{children:"History"})]})})]}),Z==="changes"&&t.jsx(t.Fragment,{children:t.jsx("div",{className:`transition-all duration-300 ease-in-out ${m.size===0?"max-h-96 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:r&&ft?t.jsx("div",{className:"px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:t.jsxs("button",{onClick:()=>tt(!1),className:"w-full flex items-center justify-center gap-2 px-3 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700",children:[t.jsx(qi,{className:"w-4 h-4"}),t.jsxs("span",{children:["Commit ",p.size," file",p.size!==1?"s":""]}),t.jsx(Zt,{className:"w-3 h-3"})]})}):t.jsx(t.Fragment,{children:t.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[r&&t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Commit Changes"}),t.jsx("button",{onClick:()=>tt(!0),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded",children:t.jsx(Zt,{className:"w-4 h-4 rotate-180"})})]}),t.jsxs("div",{className:"relative",children:[t.jsx("textarea",{ref:it,value:d,onChange:E=>u(E.target.value),placeholder:"Message (Ctrl+Enter to commit)",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 resize-none pr-20",rows:"3",onKeyDown:E=>{E.key==="Enter"&&(E.ctrlKey||E.metaKey)&&Wt()}}),t.jsxs("div",{className:"absolute right-2 top-2 flex gap-1",children:[t.jsx("button",{onClick:vt,disabled:p.size===0||he,className:"p-1.5 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",title:"Generate commit message",children:he?t.jsx(Sr,{className:"w-4 h-4 animate-spin"}):t.jsx(Ir,{className:"w-4 h-4"})}),t.jsx("div",{style:{display:"none"},children:t.jsx(Td,{onTranscript:E=>u(E),mode:"default",className:"p-1.5"})})]})]}),t.jsxs("div",{className:"flex items-center justify-between mt-2",children:[t.jsxs("span",{className:"text-xs text-gray-500",children:[p.size," file",p.size!==1?"s":""," selected"]}),t.jsxs("button",{onClick:()=>qe({type:"commit",message:`Commit ${p.size} file${p.size!==1?"s":""} with message: "${d.trim()}"?`}),disabled:!d.trim()||p.size===0||x,className:"px-3 py-1 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",children:[t.jsx(Fr,{className:"w-3 h-3"}),t.jsx("span",{children:x?"Committing...":"Commit"})]})]})]})})})}),Z==="changes"&&s&&!s.error&&t.jsxs("div",{className:`border-b border-gray-200 dark:border-gray-700 flex items-center justify-between transition-all duration-300 ease-in-out ${r?"px-3 py-1.5":"px-4 py-2"} ${m.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[t.jsxs("span",{className:"text-gray-600 dark:text-gray-400 text-xs",children:[p.size," of ",(s?.modified?.length||0)+(s?.added?.length||0)+(s?.deleted?.length||0)+(s?.untracked?.length||0)," ",r?"":"files"," selected"]}),t.jsxs("div",{className:`flex ${r?"gap-1":"gap-2"}`,children:[t.jsx("button",{onClick:()=>{const E=new Set([...s?.modified||[],...s?.added||[],...s?.deleted||[],...s?.untracked||[]]);g(E)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:r?"All":"Select All"}),t.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),t.jsx("button",{onClick:()=>g(new Set),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:r?"None":"Deselect All"})]})]}),!s?.error&&!r&&t.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("button",{onClick:()=>L(!B),className:"w-full px-4 py-2 bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-750 text-xs text-gray-600 dark:text-gray-400 flex items-center justify-center gap-1",children:[t.jsx(np,{className:"w-3 h-3"}),t.jsx("span",{children:"File Status Guide"}),B?t.jsx(Zt,{className:"w-3 h-3"}):t.jsx(Er,{className:"w-3 h-3"})]}),B&&t.jsx("div",{className:"px-4 py-3 bg-gray-50 dark:bg-gray-800 text-xs",children:t.jsxs("div",{className:`${r?"grid grid-cols-2 gap-3 justify-items-center":"flex justify-center gap-6"}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 rounded border border-yellow-200 dark:border-yellow-800 font-bold text-xs",children:"M"}),t.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Modified"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 rounded border border-green-200 dark:border-green-800 font-bold text-xs",children:"A"}),t.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Added"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 rounded border border-red-200 dark:border-red-800 font-bold text-xs",children:"D"}),t.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Deleted"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 rounded border border-gray-300 dark:border-gray-600 font-bold text-xs",children:"U"}),t.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Untracked"})]})]})})]})]}),Z==="changes"&&!s?.error&&t.jsx("div",{className:`flex-1 overflow-y-auto ${r?"pb-20":""}`,children:l?t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx(Sr,{className:"w-6 h-6 animate-spin text-gray-400"})}):!s||!s.modified?.length&&!s.added?.length&&!s.deleted?.length&&!s.untracked?.length?t.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[t.jsx(qi,{className:"w-12 h-12 mb-2 opacity-50"}),t.jsx("p",{className:"text-sm",children:"No changes detected"})]}):t.jsxs("div",{className:r?"pb-4":"",children:[s.modified?.map(E=>I(E,"M")),s.added?.map(E=>I(E,"A")),s.deleted?.map(E=>I(E,"D")),s.untracked?.map(E=>I(E,"U"))]})}),Z==="history"&&!s?.error&&t.jsx("div",{className:`flex-1 overflow-y-auto ${r?"pb-20":""}`,children:l?t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx(Sr,{className:"w-6 h-6 animate-spin text-gray-400"})}):ce.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[t.jsx(Vi,{className:"w-12 h-12 mb-2 opacity-50"}),t.jsx("p",{className:"text-sm",children:"No commits found"})]}):t.jsx("div",{className:r?"pb-4":"",children:ce.map(E=>Rt(E))})}),R&&t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>D(!1)}),t.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:t.jsxs("div",{className:"p-6",children:[t.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Create New Branch"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Branch Name"}),t.jsx("input",{type:"text",value:_,onChange:E=>C(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!V&&Ce()},placeholder:"feature/new-feature",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500",autoFocus:!0})]}),t.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:["This will create a new branch from the current branch (",k,")"]}),t.jsxs("div",{className:"flex justify-end space-x-3",children:[t.jsx("button",{onClick:()=>{D(!1),C("")},className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),t.jsx("button",{onClick:Ce,disabled:!_.trim()||V,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2",children:V?t.jsxs(t.Fragment,{children:[t.jsx(Sr,{className:"w-3 h-3 animate-spin"}),t.jsx("span",{children:"Creating..."})]}):t.jsxs(t.Fragment,{children:[t.jsx(Dt,{className:"w-3 h-3"}),t.jsx("span",{children:"Create Branch"})]})})]})]})})]}),xe&&t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>qe(null)}),t.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:t.jsxs("div",{className:"p-6",children:[t.jsxs("div",{className:"flex items-center mb-4",children:[t.jsx("div",{className:`p-2 rounded-full mr-3 ${xe.type==="discard"||xe.type==="delete"?"bg-red-100 dark:bg-red-900":"bg-yellow-100 dark:bg-yellow-900"}`,children:t.jsx(En,{className:`w-5 h-5 ${xe.type==="discard"||xe.type==="delete"?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`})}),t.jsx("h3",{className:"text-lg font-semibold",children:xe.type==="discard"?"Discard Changes":xe.type==="delete"?"Delete File":xe.type==="commit"?"Confirm Commit":xe.type==="pull"?"Confirm Pull":xe.type==="publish"?"Publish Branch":"Confirm Push"})]}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:xe.message}),t.jsxs("div",{className:"flex justify-end space-x-3",children:[t.jsx("button",{onClick:()=>qe(null),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),t.jsx("button",{onClick:Be,className:`px-4 py-2 text-sm text-white rounded-md ${xe.type==="discard"||xe.type==="delete"?"bg-red-600 hover:bg-red-700":xe.type==="commit"?"bg-blue-600 hover:bg-blue-700":xe.type==="pull"?"bg-green-600 hover:bg-green-700":xe.type==="publish"?"bg-purple-600 hover:bg-purple-700":"bg-orange-600 hover:bg-orange-700"} flex items-center space-x-2`,children:xe.type==="discard"?t.jsxs(t.Fragment,{children:[t.jsx(nr,{className:"w-4 h-4"}),t.jsx("span",{children:"Discard"})]}):xe.type==="delete"?t.jsxs(t.Fragment,{children:[t.jsx(nr,{className:"w-4 h-4"}),t.jsx("span",{children:"Delete"})]}):xe.type==="commit"?t.jsxs(t.Fragment,{children:[t.jsx(Fr,{className:"w-4 h-4"}),t.jsx("span",{children:"Commit"})]}):xe.type==="pull"?t.jsxs(t.Fragment,{children:[t.jsx(ps,{className:"w-4 h-4"}),t.jsx("span",{children:"Pull"})]}):xe.type==="publish"?t.jsxs(t.Fragment,{children:[t.jsx(Zn,{className:"w-4 h-4"}),t.jsx("span",{children:"Publish"})]}):t.jsxs(t.Fragment,{children:[t.jsx(Zn,{className:"w-4 h-4"}),t.jsx("span",{children:"Push"})]})})]})]})})]})]}):t.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-gray-400",children:t.jsx("p",{children:"Select a project to view source control"})})}class t1 extends fr.Component{constructor(r){super(r),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(r){return{hasError:!0}}componentDidCatch(r,n){console.error("ErrorBoundary caught an error:",r,n),this.setState({error:r,errorInfo:n})}render(){return this.state.hasError?t.jsx("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:t.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 max-w-md",children:[t.jsxs("div",{className:"flex items-center mb-4",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),t.jsx("h3",{className:"ml-3 text-sm font-medium text-red-800",children:"Something went wrong"})]}),t.jsxs("div",{className:"text-sm text-red-700",children:[t.jsx("p",{className:"mb-2",children:"An error occurred while loading the chat interface."}),this.props.showDetails&&this.state.error&&t.jsxs("details",{className:"mt-4",children:[t.jsx("summary",{className:"cursor-pointer text-xs font-mono",children:"Error Details"}),t.jsxs("pre",{className:"mt-2 text-xs bg-red-100 p-2 rounded overflow-auto max-h-40",children:[this.state.error.toString(),this.state.errorInfo&&this.state.errorInfo.componentStack]})]})]}),t.jsx("div",{className:"mt-4",children:t.jsx("button",{onClick:()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.props.onRetry&&this.props.onRetry()},className:"bg-red-600 text-white px-4 py-2 rounded text-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",children:"Try Again"})})]})}):this.props.children}}const Ot=({children:e,content:r,position:n="top",className:s="",delay:a=500})=>{const[i,o]=f.useState(!1),[l,c]=f.useState(null),d=()=>{const p=setTimeout(()=>{o(!0)},a);c(p)},u=()=>{l&&(clearTimeout(l),c(null)),o(!1)},m=()=>{switch(n){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"right-full top-1/2 transform -translate-y-1/2 mr-2";case"right":return"left-full top-1/2 transform -translate-y-1/2 ml-2";default:return"bottom-full left-1/2 transform -translate-x-1/2 mb-2"}},h=()=>{switch(n){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}};return r?t.jsxs("div",{className:"relative inline-block",onMouseEnter:d,onMouseLeave:u,children:[e,i&&t.jsxs("div",{className:Me("absolute z-50 px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",m(),s),children:[r,t.jsx("div",{className:Me("absolute w-0 h-0 border-4 border-transparent",h())})]})]}):e},Pl=({task:e,onClick:r,showParent:n=!1,className:s=""})=>{const i=(l=>{switch(l){case"done":return{icon:Fn,bgColor:"bg-green-50 dark:bg-green-950",borderColor:"border-green-200 dark:border-green-800",iconColor:"text-green-600 dark:text-green-400",textColor:"text-green-900 dark:text-green-100",statusText:"Done"};case"in-progress":return{icon:Tn,bgColor:"bg-blue-50 dark:bg-blue-950",borderColor:"border-blue-200 dark:border-blue-800",iconColor:"text-blue-600 dark:text-blue-400",textColor:"text-blue-900 dark:text-blue-100",statusText:"In Progress"};case"review":return{icon:ti,bgColor:"bg-amber-50 dark:bg-amber-950",borderColor:"border-amber-200 dark:border-amber-800",iconColor:"text-amber-600 dark:text-amber-400",textColor:"text-amber-900 dark:text-amber-100",statusText:"Review"};case"deferred":return{icon:Yl,bgColor:"bg-gray-50 dark:bg-gray-800",borderColor:"border-gray-200 dark:border-gray-700",iconColor:"text-gray-500 dark:text-gray-400",textColor:"text-gray-700 dark:text-gray-300",statusText:"Deferred"};case"cancelled":return{icon:ct,bgColor:"bg-red-50 dark:bg-red-950",borderColor:"border-red-200 dark:border-red-800",iconColor:"text-red-600 dark:text-red-400",textColor:"text-red-900 dark:text-red-100",statusText:"Cancelled"};case"pending":default:return{icon:Zr,bgColor:"bg-slate-50 dark:bg-slate-800",borderColor:"border-slate-200 dark:border-slate-700",iconColor:"text-slate-500 dark:text-slate-400",textColor:"text-slate-900 dark:text-slate-100",statusText:"Pending"}}})(e.status);i.icon;const o=l=>{switch(l){case"high":return t.jsx(Ot,{content:"High Priority",children:t.jsx("div",{className:"w-4 h-4 bg-red-100 dark:bg-red-900/30 rounded flex items-center justify-center",children:t.jsx(km,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})});case"medium":return t.jsx(Ot,{content:"Medium Priority",children:t.jsx("div",{className:"w-4 h-4 bg-amber-100 dark:bg-amber-900/30 rounded flex items-center justify-center",children:t.jsx(gp,{className:"w-2.5 h-2.5 text-amber-600 dark:text-amber-400"})})});case"low":return t.jsx(Ot,{content:"Low Priority",children:t.jsx("div",{className:"w-4 h-4 bg-blue-100 dark:bg-blue-900/30 rounded flex items-center justify-center",children:t.jsx(Zr,{className:"w-1.5 h-1.5 text-blue-600 dark:text-blue-400 fill-current"})})});default:return t.jsx(Ot,{content:"No Priority Set",children:t.jsx("div",{className:"w-4 h-4 bg-gray-100 dark:bg-gray-800 rounded flex items-center justify-center",children:t.jsx(Zr,{className:"w-1.5 h-1.5 text-gray-400 dark:text-gray-500"})})})}};return t.jsxs("div",{className:Me("bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700","hover:shadow-md hover:border-blue-300 dark:hover:border-blue-600 transition-all duration-200 cursor-pointer","p-3 space-y-3",r&&"hover:-translate-y-0.5",s),onClick:r,children:[t.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx(Ot,{content:`Task ID: ${e.id}`,children:t.jsx("span",{className:"text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:e.id})})}),t.jsx("h3",{className:"font-medium text-sm text-gray-900 dark:text-white line-clamp-2 leading-tight",children:e.title}),n&&e.parentId&&t.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium",children:["Task ",e.parentId]})]}),t.jsx("div",{className:"flex-shrink-0",children:o(e.priority)})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"flex items-center",children:e.dependencies&&Array.isArray(e.dependencies)&&e.dependencies.length>0&&t.jsx(Ot,{content:`Depends on: ${e.dependencies.map(l=>`Task ${l}`).join(", ")}`,children:t.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400",children:[t.jsx(ei,{className:"w-3 h-3"}),t.jsxs("span",{children:["Depends on: ",e.dependencies.join(", ")]})]})})}),t.jsx(Ot,{content:`Status: ${i.statusText}`,children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:Me("w-2 h-2 rounded-full",i.iconColor.replace("text-","bg-"))}),t.jsx("span",{className:Me("text-xs font-medium",i.textColor),children:i.statusText})]})})]}),e.subtasks&&e.subtasks.length>0&&t.jsx("div",{className:"ml-3",children:t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Progress:"}),t.jsx(Ot,{content:`${e.subtasks.filter(l=>l.status==="done").length} of ${e.subtasks.length} subtasks completed`,children:t.jsx("div",{className:"flex-1 bg-gray-200 dark:bg-gray-700 rounded-full h-1.5",children:t.jsx("div",{className:Me("h-full rounded-full transition-all duration-300",e.status==="done"?"bg-green-500":"bg-blue-500"),style:{width:`${Math.round(e.subtasks.filter(l=>l.status==="done").length/e.subtasks.length*100)}%`}})})}),t.jsx(Ot,{content:`${e.subtasks.filter(l=>l.status==="done").length} completed, ${e.subtasks.filter(l=>l.status==="pending").length} pending, ${e.subtasks.filter(l=>l.status==="in-progress").length} in progress`,children:t.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e.subtasks.filter(l=>l.status==="done").length,"/",e.subtasks.length]})})]})})]})},r1=({currentProject:e,onClose:r,onTaskCreated:n})=>t.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:t.jsx(Ir,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Create AI-Generated Task"})]}),t.jsx("button",{onClick:r,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:t.jsx(ct,{className:"w-5 h-5"})})]}),t.jsxs("div",{className:"p-6 space-y-6",children:[t.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx(Ir,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),t.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"You can simply ask Claude Code in the chat to create tasks for you. The AI assistant will automatically generate detailed tasks with research-backed insights."}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-blue-200 dark:border-blue-700 p-3 mb-3",children:[t.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Example:"}),t.jsx("p",{className:"text-sm text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),t.jsxs("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:[t.jsx("strong",{children:"This runs:"})," ",t.jsx("code",{className:"bg-blue-100 dark:bg-blue-900/50 px-1 rounded text-xs",children:'task-master add-task --prompt="Implement user profile image uploads using Cloudinary" --research'})]})]})]})}),t.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),t.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),t.jsx("div",{className:"pt-4",children:t.jsx("button",{onClick:r,className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),n1=({tasks:e=[],onTaskClick:r,className:n="",showParentTasks:s=!1,defaultView:a="kanban",currentProject:i,onTaskCreated:o,onShowPRDEditor:l,existingPRDs:c=[],onRefreshPRDs:d})=>{const[u,m]=f.useState(""),[h,p]=f.useState("all"),[g,x]=f.useState("all"),[b,k]=f.useState("id"),[N,y]=f.useState("asc"),[P,W]=f.useState(a),[M,B]=f.useState(!1),[L,U]=f.useState(!1),[j,R]=f.useState(!1),[D,_]=f.useState(!1),[C,V]=f.useState(!1),[z,Z]=f.useState(!1),{projectTaskMaster:F,refreshProjects:ce,refreshTasks:v,setCurrentProject:ue}=On();f.useEffect(()=>{const X=le=>{z&&!le.target.closest(".relative")&&Z(!1)};return document.addEventListener("mousedown",X),()=>document.removeEventListener("mousedown",X)},[z]);const fe=f.useMemo(()=>{const X=new Set(e.map(le=>le.status).filter(Boolean));return Array.from(X).sort()},[e]),w=f.useMemo(()=>{const X=new Set(e.map(le=>le.priority).filter(Boolean));return Array.from(X).sort()},[e]),J=f.useMemo(()=>{let X=e.filter(le=>{const ke=u.toLowerCase(),ge=!u||le.title.toLowerCase().includes(ke)||le.description?.toLowerCase().includes(ke)||le.id.toString().includes(ke),Ie=h==="all"||le.status===h,Ke=g==="all"||le.priority===g;return ge&&Ie&&Ke});return X.sort((le,ke)=>{let ge,Ie;switch(b){case"title":ge=le.title.toLowerCase(),Ie=ke.title.toLowerCase();break;case"status":const Ke={pending:1,"in-progress":2,done:3,blocked:4,deferred:5,cancelled:6};ge=Ke[le.status]||99,Ie=Ke[ke.status]||99;break;case"priority":const et={high:3,medium:2,low:1};ge=et[le.priority]||0,Ie=et[ke.priority]||0;break;case"updated":ge=new Date(le.updatedAt||le.createdAt||0),Ie=new Date(ke.updatedAt||ke.createdAt||0);break;case"id":default:const st=xe=>xe.toString().split(".").map(it=>parseInt(it,10)),ft=st(le.id),tt=st(ke.id);for(let xe=0;xe<Math.max(ft.length,tt.length);xe++){const qe=ft[xe]||0,it=tt[xe]||0;if(qe!==it){ge=qe,Ie=it;break}}break}return b==="updated"?N==="asc"?ge-Ie:Ie-ge:typeof ge=="string"?N==="asc"?ge.localeCompare(Ie):Ie.localeCompare(ge):N==="asc"?ge-Ie:Ie-ge}),X},[e,u,h,g,b,N]),he=f.useMemo(()=>{const X=[{id:"pending",title:"📋 To Do",status:"pending",color:"bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-700",headerColor:"bg-slate-100 dark:bg-slate-800 text-slate-800 dark:text-slate-200"},{id:"in-progress",title:"🚀 In Progress",status:"in-progress",color:"bg-blue-50 dark:bg-blue-900/50 border-blue-200 dark:border-blue-700",headerColor:"bg-blue-100 dark:bg-blue-800 text-blue-800 dark:text-blue-200"},{id:"done",title:"✅ Done",status:"done",color:"bg-emerald-50 dark:bg-emerald-900/50 border-emerald-200 dark:border-emerald-700",headerColor:"bg-emerald-100 dark:bg-emerald-800 text-emerald-800 dark:text-emerald-200"},{id:"blocked",title:"🚫 Blocked",status:"blocked",color:"bg-red-50 dark:bg-red-900/50 border-red-200 dark:border-red-700",headerColor:"bg-red-100 dark:bg-red-800 text-red-800 dark:text-red-200"},{id:"deferred",title:"⏳ Deferred",status:"deferred",color:"bg-amber-50 dark:bg-amber-900/50 border-amber-200 dark:border-amber-700",headerColor:"bg-amber-100 dark:bg-amber-800 text-amber-800 dark:text-amber-200"},{id:"cancelled",title:"❌ Cancelled",status:"cancelled",color:"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700",headerColor:"bg-gray-100 dark:bg-gray-800 text-gray-800 dark:text-gray-200"}],le=["pending","in-progress","done"];return X.filter(ge=>{const Ie=J.some(et=>et.status===ge.status),Ke=le.includes(ge.status);return Ie||Ke}).map(ge=>({...ge,tasks:J.filter(Ie=>Ie.status===ge.status)}))},[J]),ye=X=>{b===X?y(N==="asc"?"desc":"asc"):(k(X),y("asc"))},re=()=>{m(""),p("all"),x("all")},Pe=X=>b!==X?t.jsx(dm,{className:"w-4 h-4"}):N==="asc"?t.jsx(mm,{className:"w-4 h-4"}):t.jsx(Hl,{className:"w-4 h-4"});if(e.length===0){const X=i?.taskMasterConfigured||i?.taskmaster?.hasTaskmaster||F?.hasTaskmaster;return t.jsxs("div",{className:Me("text-center py-12",n),children:[X?t.jsxs("div",{className:"max-w-4xl mx-auto",children:[t.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-xl border border-blue-200 dark:border-blue-800 p-6 mb-6",children:[t.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:t.jsx($t,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"TaskMaster is initialized! Here's what to do next:"})]})]}),t.jsxs("div",{className:"space-y-4 text-left",children:[t.jsxs("div",{className:"grid gap-3",children:[t.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"1"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Create a Product Requirements Document (PRD)"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Discuss your project idea and create a PRD that describes what you want to build."}),t.jsxs("button",{onClick:()=>{l?.()},className:"inline-flex items-center gap-1 text-xs bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-2 py-1 rounded hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[t.jsx($t,{className:"w-3 h-3"}),"Add PRD"]}),c.length>0&&t.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700",children:[t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"Existing PRDs:"}),t.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(le=>t.jsxs("button",{onClick:async()=>{try{const ke=await Ue.get(`/taskmaster/prd/${encodeURIComponent(i.name)}/${encodeURIComponent(le.name)}`);if(ke.ok){const ge=await ke.json();l?.({name:le.name,content:ge.content,isExisting:!0})}else console.error("Failed to load PRD:",ke.statusText)}catch(ke){console.error("Error loading PRD:",ke)}},className:"inline-flex items-center gap-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 px-2 py-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:[t.jsx($t,{className:"w-3 h-3"}),le.name]},le.name))})]})]})]}),t.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"2"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Generate Tasks from PRD"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."})]})]}),t.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"3"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Analyze & Expand Tasks"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."})]})]}),t.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[t.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"4"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Start Building"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."})]})]})]}),t.jsx("div",{className:"flex gap-3 pt-4 border-t border-blue-200 dark:border-blue-700",children:t.jsxs("button",{onClick:le=>{le.preventDefault(),le.stopPropagation(),l?.()},className:"flex items-center gap-2 px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg font-medium transition-colors cursor-pointer",style:{zIndex:10},children:[t.jsx($t,{className:"w-4 h-4"}),"Add PRD"]})})]})]}),t.jsx("div",{className:"text-center",children:t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 mb-2",children:["💡 ",t.jsx("strong",{children:"Tip:"})," Start with a PRD to get the most out of TaskMaster's AI-powered task generation"]})})]}):t.jsxs("div",{className:"max-w-md mx-auto",children:[t.jsx("div",{className:"text-blue-600 dark:text-blue-400 mb-4",children:t.jsx(Wr,{className:"w-12 h-12 mx-auto mb-4"})}),t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"TaskMaster AI is not configured"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:"TaskMaster helps break down complex projects into manageable tasks with AI-powered assistance"}),t.jsxs("div",{className:"mb-6 p-4 bg-blue-50 dark:bg-blue-950 rounded-lg text-left",children:[t.jsx("h4",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-3",children:"🎯 What is TaskMaster?"}),t.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[t.jsxs("p",{children:["• ",t.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"PRD Templates:"})," Generate tasks from Product Requirements Documents"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"Progress Visualization:"})," Kanban boards and detailed task analytics"]}),t.jsxs("p",{children:["• ",t.jsx("strong",{children:"CLI Integration:"})," Use taskmaster commands for advanced workflows"]})]})]}),t.jsxs("button",{onClick:()=>{V(!1),R(!0)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-medium transition-colors flex items-center gap-2 mx-auto",children:[t.jsx(sn,{className:"w-4 h-4"}),"Initialize TaskMaster AI"]})]}),j&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center p-4 pt-16 bg-black/50 backdrop-blur-sm",children:t.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl h-[600px] flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:t.jsx(sn,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"TaskMaster Setup"}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Interactive CLI for ",i?.displayName]})]})]}),t.jsx("button",{onClick:()=>{R(!1),setTimeout(()=>{ce(),i&&ue(i)},1e3)},className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800",children:t.jsx(Dt,{className:"w-5 h-5 rotate-45"})})]}),t.jsx("div",{className:"flex-1 p-4",children:t.jsx("div",{className:"h-full bg-black rounded-lg overflow-hidden",onClick:le=>{const ke=le.currentTarget.querySelector(".xterm-screen");ke&&ke.focus()},children:t.jsx(Ni,{selectedProject:i,selectedSession:null,isActive:!0,initialCommand:"npx task-master init",isPlainShell:!0,onProcessComplete:le=>{V(!0),le===0&&setTimeout(()=>{ce(),i&&ue(i)},1e3)}})})}),t.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:C?t.jsxs("span",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[t.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),"TaskMaster setup completed! You can now close this window."]}):"TaskMaster initialization will start automatically"}),t.jsx("button",{onClick:()=>{R(!1),V(!1),setTimeout(()=>{ce(),i&&ue(i)},1e3)},className:Me("px-4 py-2 text-sm font-medium rounded-md transition-colors",C?"bg-green-600 hover:bg-green-700 text-white":"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600"),children:C?"Close & Continue":"Close"})]})})]})})]})}return t.jsxs("div",{className:Me("space-y-4",n),children:[t.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 lg:items-center lg:justify-between",children:[t.jsxs("div",{className:"relative flex-1 max-w-md",children:[t.jsx(nn,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),t.jsx("input",{type:"text",placeholder:"Search tasks...",value:u,onChange:X=>m(X.target.value),className:"pl-10 pr-4 py-2 w-full border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("div",{className:"flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[t.jsx("button",{onClick:()=>W("kanban"),className:Me("p-2 rounded-md transition-colors",P==="kanban"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Kanban view",children:t.jsx(Mm,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>W("list"),className:Me("p-2 rounded-md transition-colors",P==="list"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"List view",children:t.jsx(hs,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>W("grid"),className:Me("p-2 rounded-md transition-colors",P==="grid"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Grid view",children:t.jsx(ep,{className:"w-4 h-4"})})]}),t.jsxs("button",{onClick:()=>B(!M),className:Me("flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors",M?"bg-blue-50 dark:bg-blue-900 border-blue-200 dark:border-blue-700 text-blue-700 dark:text-blue-300":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"),children:[t.jsx(Gm,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Filters"}),t.jsx(Zt,{className:Me("w-4 h-4 transition-transform",M&&"rotate-180")})]}),i&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>_(!0),className:"p-2 text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors border border-gray-300 dark:border-gray-600",title:"TaskMaster Getting Started Guide",children:t.jsx(Sm,{className:"w-4 h-4"})}),t.jsx("div",{className:"relative",children:c.length>0?t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>Z(!z),className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:`${c.length} PRD${c.length>1?"s":""} available`,children:[t.jsx($t,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"PRDs"}),t.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-purple-500 rounded-full min-w-[1.25rem] text-center",children:c.length}),t.jsx(Zt,{className:Me("w-3 h-3 transition-transform hidden sm:block",z&&"rotate-180")})]}),z&&t.jsx("div",{className:"absolute right-0 top-full mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-xl z-30",children:t.jsxs("div",{className:"p-2",children:[t.jsxs("button",{onClick:()=>{l?.(),Z(!1)},className:"w-full text-left px-3 py-2 text-sm font-medium text-purple-700 dark:text-purple-300 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded flex items-center gap-2",children:[t.jsx(Dt,{className:"w-4 h-4"}),"Create New PRD"]}),t.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 my-1"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 px-3 py-1 font-medium",children:"Existing PRDs:"}),c.map(X=>t.jsxs("button",{onClick:async()=>{try{const le=await Ue.get(`/taskmaster/prd/${encodeURIComponent(i.name)}/${encodeURIComponent(X.name)}`);if(le.ok){const ke=await le.json();l?.({name:X.name,content:ke.content,isExisting:!0}),Z(!1)}}catch(le){console.error("Error loading PRD:",le)}},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded flex items-center gap-2",title:`Modified: ${new Date(X.modified).toLocaleDateString()}`,children:[t.jsx($t,{className:"w-4 h-4"}),t.jsx("span",{className:"truncate",children:X.name})]},X.name))]})})]}):t.jsxs("button",{onClick:()=>{l?.()},className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:"Create Product Requirements Document",children:[t.jsx($t,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Add PRD"})]})}),(i?.taskMasterConfigured||i?.taskmaster?.hasTaskmaster||F?.hasTaskmaster||e.length>0)&&t.jsxs("button",{onClick:()=>U(!0),className:"flex items-center gap-2 px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium",title:"Add a new task",children:[t.jsx(Dt,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Add Task"})]})]})]})]}),M&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-lg p-4 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),t.jsxs("select",{value:h,onChange:X=>p(X.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"all",children:"All Statuses"}),fe.map(X=>t.jsx("option",{value:X,children:X.charAt(0).toUpperCase()+X.slice(1).replace("-"," ")},X))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Priority"}),t.jsxs("select",{value:g,onChange:X=>x(X.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"all",children:"All Priorities"}),w.map(X=>t.jsx("option",{value:X,children:X.charAt(0).toUpperCase()+X.slice(1)},X))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Sort By"}),t.jsxs("select",{value:`${b}-${N}`,onChange:X=>{const[le,ke]=X.target.value.split("-");k(le),y(ke)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"id-asc",children:"ID (Ascending)"}),t.jsx("option",{value:"id-desc",children:"ID (Descending)"}),t.jsx("option",{value:"title-asc",children:"Title (A-Z)"}),t.jsx("option",{value:"title-desc",children:"Title (Z-A)"}),t.jsx("option",{value:"status-asc",children:"Status (Pending First)"}),t.jsx("option",{value:"status-desc",children:"Status (Done First)"}),t.jsx("option",{value:"priority-asc",children:"Priority (High First)"}),t.jsx("option",{value:"priority-desc",children:"Priority (Low First)"})]})]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Showing ",J.length," of ",e.length," tasks"]}),t.jsx("button",{onClick:re,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:"Clear Filters"})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsxs("button",{onClick:()=>ye("id"),className:Me("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",b==="id"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["ID ",Pe("id")]}),t.jsxs("button",{onClick:()=>ye("status"),className:Me("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",b==="status"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Status ",Pe("status")]}),t.jsxs("button",{onClick:()=>ye("priority"),className:Me("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",b==="priority"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Priority ",Pe("priority")]})]}),J.length===0?t.jsx("div",{className:"text-center py-12",children:t.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:[t.jsx(nn,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tasks match your filters"}),t.jsx("p",{className:"text-sm",children:"Try adjusting your search or filter criteria."})]})}):P==="kanban"?t.jsx("div",{className:Me("grid gap-6",he.length===1&&"grid-cols-1 max-w-md mx-auto",he.length===2&&"grid-cols-1 md:grid-cols-2",he.length===3&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",he.length===4&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-4",he.length===5&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",he.length>=6&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6"),children:he.map(X=>t.jsxs("div",{className:Me("rounded-xl border shadow-sm transition-shadow hover:shadow-md",X.color),children:[t.jsx("div",{className:Me("px-4 py-3 rounded-t-xl border-b",X.headerColor),children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"font-semibold text-sm",children:X.title}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("span",{className:"text-xs font-medium px-2 py-1 bg-white/60 dark:bg-black/20 rounded-full",children:X.tasks.length})})]})}),t.jsx("div",{className:"p-3 space-y-3 min-h-[200px] max-h-[calc(100vh-300px)] overflow-y-auto",children:X.tasks.length===0?t.jsxs("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500",children:[t.jsx("div",{className:"w-8 h-8 mx-auto mb-2 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center",children:t.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-300 dark:bg-gray-600"})}),t.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"No tasks yet"}),t.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:X.status==="pending"?"Tasks will appear here":X.status==="in-progress"?"Move tasks here when started":X.status==="done"?"Completed tasks appear here":"Tasks with this status will appear here"})]}):X.tasks.map(le=>t.jsx("div",{className:"transform transition-transform hover:scale-[1.02]",children:t.jsx(Pl,{task:le,onClick:()=>r?.(le),showParent:s,className:"w-full shadow-sm hover:shadow-md transition-shadow cursor-pointer"})},le.id))})]},X.id))}):t.jsx("div",{className:Me("gap-4",P==="grid"?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3":"space-y-4"),children:J.map(X=>t.jsx(Pl,{task:X,onClick:()=>r?.(X),showParent:s,className:P==="grid"?"h-full":""},X.id))}),L&&t.jsx(r1,{currentProject:i,onClose:()=>U(!1),onTaskCreated:()=>{U(!1),o&&o()}}),D&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:t.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl max-h-[90vh] overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:t.jsx($t,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Your guide to productive task management"})]})]}),t.jsx("button",{onClick:()=>_(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:t.jsx(ct,{className:"w-5 h-5"})})]}),t.jsx("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-120px)]",children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-blue-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"1"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Create a Product Requirements Document (PRD)"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Discuss your project idea and create a PRD that describes what you want to build."}),t.jsxs("button",{onClick:()=>{l?.(),_(!1)},className:"inline-flex items-center gap-2 text-sm bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-3 py-1.5 rounded-lg hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[t.jsx($t,{className:"w-4 h-4"}),"Add PRD"]})]})]}),t.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-950/50 dark:to-emerald-950/50 rounded-lg border border-green-200 dark:border-green-800",children:[t.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-green-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"2"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Generate Tasks from PRD"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."}),t.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-green-200 dark:border-green-700/50 p-3 mb-2",children:[t.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),t.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/prd.txt. Can you help me parse it and set up the initial tasks?"`})]})]})]}),t.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-amber-50 to-orange-50 dark:from-amber-950/50 dark:to-orange-950/50 rounded-lg border border-amber-200 dark:border-amber-800",children:[t.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-amber-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"3"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Analyze & Expand Tasks"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."}),t.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-amber-200 dark:border-amber-700/50 p-3 mb-2",children:[t.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),t.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Task 5 seems complex. Can you break it down into subtasks?"'})]})]})]}),t.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-purple-50 to-pink-50 dark:from-purple-950/50 dark:to-pink-950/50 rounded-lg border border-purple-200 dark:border-purple-800",children:[t.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-purple-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"4"}),t.jsxs("div",{children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Start Building"}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."}),t.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-purple-200 dark:border-purple-700/50 p-3 mb-3",children:[t.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),t.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),t.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"View more examples and usage patterns →"})]})]}),t.jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-3",children:"💡 Pro Tips"}),t.jsxs("ul",{className:"space-y-2 text-sm text-gray-600 dark:text-gray-400",children:[t.jsxs("li",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full mt-2 flex-shrink-0"}),"Use the search bar to quickly find specific tasks"]}),t.jsxs("li",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full mt-2 flex-shrink-0"}),"Switch between Kanban, List, and Grid views using the view toggles"]}),t.jsxs("li",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"w-1.5 h-1.5 bg-purple-500 rounded-full mt-2 flex-shrink-0"}),"Use filters to focus on specific task statuses or priorities"]}),t.jsxs("li",{className:"flex items-start gap-2",children:[t.jsx("span",{className:"w-1.5 h-1.5 bg-orange-500 rounded-full mt-2 flex-shrink-0"}),"Click on any task to view detailed information and manage subtasks"]})]})]}),t.jsxs("div",{className:"mt-6 p-4 bg-blue-50 dark:bg-blue-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-3",children:"📚 Learn More"}),t.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"TaskMaster AI is an advanced task management system built for developers. Get documentation, examples, and contribute to the project."}),t.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded-lg font-medium transition-colors",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.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 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 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.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.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"})})]})]})]})})]})})]})},s1=({file:e,onClose:r,projectPath:n,project:s,initialContent:a="",isNewFile:i=!1,onSave:o})=>{const[l,c]=f.useState(a),[d,u]=f.useState(!i),[m,h]=f.useState(!1),[p,g]=f.useState(!1),[x,b]=f.useState(!0),[k,N]=f.useState(!1),[y,P]=f.useState(!1),[W,M]=f.useState(!0),[B,L]=f.useState(""),[U,j]=f.useState(!1),[R,D]=f.useState(!1),[_,C]=f.useState([]),V=f.useRef(null),z=`# Product Requirements Document - Example Project
635
+
636
+ ## 1. Overview
637
+ **Product Name:** AI-Powered Task Manager
638
+ **Version:** 1.0
639
+ **Date:** 2024-12-27
640
+ **Author:** Development Team
641
+
642
+ This document outlines the requirements for building an AI-powered task management application that integrates with development workflows and provides intelligent task breakdown and prioritization.
643
+
644
+ ## 2. Objectives
645
+ - Create an intuitive task management system that works seamlessly with developer tools
646
+ - Provide AI-powered task generation from high-level requirements
647
+ - Enable real-time collaboration and progress tracking
648
+ - Integrate with popular development environments (VS Code, Cursor, etc.)
649
+
650
+ ### Success Metrics
651
+ - User adoption rate > 80% within development teams
652
+ - Task completion rate improvement of 25%
653
+ - Time-to-delivery reduction of 15%
654
+
655
+ ## 3. User Stories
656
+
657
+ ### Core Functionality
658
+ - As a project manager, I want to create PRDs that automatically generate detailed tasks so I can save time on project planning
659
+ - As a developer, I want to see my next task clearly highlighted so I can maintain focus
660
+ - As a team lead, I want to track progress across multiple projects so I can provide accurate status updates
661
+ - As a developer, I want tasks to be broken down into implementable subtasks so I can work more efficiently
662
+
663
+ ### AI Integration
664
+ - As a user, I want to describe a feature in natural language and get detailed implementation tasks so I can start working immediately
665
+ - As a project manager, I want the AI to analyze task complexity and suggest appropriate time estimates
666
+ - As a developer, I want intelligent task prioritization based on dependencies and deadlines
667
+
668
+ ### Collaboration
669
+ - As a team member, I want to see real-time updates when tasks are completed so I can coordinate my work
670
+ - As a stakeholder, I want to view project progress through intuitive dashboards
671
+ - As a developer, I want to add implementation notes to tasks for future reference
672
+
673
+ ## 4. Functional Requirements
674
+
675
+ ### Task Management
676
+ - Create, edit, and delete tasks with rich metadata (priority, status, dependencies, estimates)
677
+ - Hierarchical task structure with subtasks and sub-subtasks
678
+ - Real-time status updates and progress tracking
679
+ - Dependency management with circular dependency detection
680
+ - Bulk operations (move, update status, assign)
681
+
682
+ ### AI Features
683
+ - Natural language PRD parsing to generate structured tasks
684
+ - Intelligent task breakdown with complexity analysis
685
+ - Automated subtask generation with implementation details
686
+ - Smart dependency suggestion
687
+ - Progress prediction based on historical data
688
+
689
+ ### Integration Features
690
+ - VS Code/Cursor extension for in-editor task management
691
+ - Git integration for linking commits to tasks
692
+ - API for third-party tool integration
693
+ - Webhook support for external notifications
694
+ - CLI tool for command-line task management
695
+
696
+ ### User Interface
697
+ - Responsive web application (desktop and mobile)
698
+ - Multiple view modes (Kanban, list, calendar)
699
+ - Dark/light theme support
700
+ - Drag-and-drop task organization
701
+ - Advanced filtering and search capabilities
702
+ - Keyboard shortcuts for power users
703
+
704
+ ## 5. Technical Requirements
705
+
706
+ ### Frontend
707
+ - React.js with TypeScript for type safety
708
+ - Modern UI framework (Tailwind CSS)
709
+ - State management (Context API or Redux)
710
+ - Real-time updates via WebSockets
711
+ - Progressive Web App (PWA) support
712
+ - Accessibility compliance (WCAG 2.1 AA)
713
+
714
+ ### Backend
715
+ - Node.js with Express.js framework
716
+ - RESTful API design with OpenAPI documentation
717
+ - Real-time communication via Socket.io
718
+ - Background job processing
719
+ - Rate limiting and security middleware
720
+
721
+ ### AI Integration
722
+ - Integration with multiple AI providers (OpenAI, Anthropic, etc.)
723
+ - Fallback model support
724
+ - Context-aware prompt engineering
725
+ - Token usage optimization
726
+ - Model response caching
727
+
728
+ ### Database
729
+ - Primary: PostgreSQL for relational data
730
+ - Cache: Redis for session management and real-time features
731
+ - Full-text search capabilities
732
+ - Database migrations and seeding
733
+ - Backup and recovery procedures
734
+
735
+ ### Infrastructure
736
+ - Docker containerization
737
+ - Cloud deployment (AWS/GCP/Azure)
738
+ - Auto-scaling capabilities
739
+ - Monitoring and logging (structured logging)
740
+ - CI/CD pipeline with automated testing
741
+
742
+ ## 6. Non-Functional Requirements
743
+
744
+ ### Performance
745
+ - Page load time < 2 seconds
746
+ - API response time < 500ms for 95% of requests
747
+ - Support for 1000+ concurrent users
748
+ - Efficient handling of large task lists (10,000+ tasks)
749
+
750
+ ### Security
751
+ - JWT-based authentication with refresh tokens
752
+ - Role-based access control (RBAC)
753
+ - Data encryption at rest and in transit
754
+ - Regular security audits and penetration testing
755
+ - GDPR and privacy compliance
756
+
757
+ ### Reliability
758
+ - 99.9% uptime SLA
759
+ - Graceful error handling and recovery
760
+ - Data backup every 6 hours with point-in-time recovery
761
+ - Disaster recovery plan with RTO < 4 hours
762
+
763
+ ### Scalability
764
+ - Horizontal scaling for both frontend and backend
765
+ - Database read replicas for query optimization
766
+ - CDN for static asset delivery
767
+ - Microservices architecture for future expansion
768
+
769
+ ## 7. User Experience Design
770
+
771
+ ### Information Architecture
772
+ - Intuitive navigation with breadcrumbs
773
+ - Context-aware menus and actions
774
+ - Progressive disclosure of complex features
775
+ - Consistent design patterns throughout
776
+
777
+ ### Interaction Design
778
+ - Smooth animations and transitions
779
+ - Immediate feedback for user actions
780
+ - Undo/redo functionality for critical operations
781
+ - Smart defaults and auto-save features
782
+
783
+ ### Visual Design
784
+ - Modern, clean interface with plenty of whitespace
785
+ - Consistent color scheme and typography
786
+ - Clear visual hierarchy with proper contrast ratios
787
+ - Iconography that supports comprehension
788
+
789
+ ## 8. Integration Requirements
790
+
791
+ ### Development Tools
792
+ - VS Code extension with task panel and quick actions
793
+ - Cursor IDE integration with AI task suggestions
794
+ - Terminal CLI for command-line workflow
795
+ - Browser extension for web-based tools
796
+
797
+ ### Third-Party Services
798
+ - GitHub/GitLab integration for issue sync
799
+ - Slack/Discord notifications
800
+ - Calendar integration (Google Calendar, Outlook)
801
+ - Time tracking tools (Toggl, Harvest)
802
+
803
+ ### APIs and Webhooks
804
+ - RESTful API with comprehensive documentation
805
+ - GraphQL endpoint for complex queries
806
+ - Webhook system for external integrations
807
+ - SDK development for major programming languages
808
+
809
+ ## 9. Implementation Phases
810
+
811
+ ### Phase 1: Core MVP (8-10 weeks)
812
+ - Basic task management (CRUD operations)
813
+ - Simple AI task generation
814
+ - Web interface with essential features
815
+ - User authentication and basic permissions
816
+
817
+ ### Phase 2: Enhanced Features (6-8 weeks)
818
+ - Advanced AI features (complexity analysis, subtask generation)
819
+ - Real-time collaboration
820
+ - Mobile-responsive design
821
+ - Integration with one development tool (VS Code)
822
+
823
+ ### Phase 3: Enterprise Features (4-6 weeks)
824
+ - Advanced user management and permissions
825
+ - API and webhook system
826
+ - Performance optimization
827
+ - Comprehensive testing and security audit
828
+
829
+ ### Phase 4: Ecosystem Expansion (4-6 weeks)
830
+ - Additional tool integrations
831
+ - Mobile app development
832
+ - Advanced analytics and reporting
833
+ - Third-party marketplace preparation
834
+
835
+ ## 10. Risk Assessment
836
+
837
+ ### Technical Risks
838
+ - AI model reliability and cost management
839
+ - Real-time synchronization complexity
840
+ - Database performance with large datasets
841
+ - Integration complexity with multiple tools
842
+
843
+ ### Business Risks
844
+ - User adoption in competitive market
845
+ - AI provider dependency
846
+ - Data privacy and security concerns
847
+ - Feature scope creep and timeline delays
848
+
849
+ ### Mitigation Strategies
850
+ - Implement robust error handling and fallback systems
851
+ - Develop comprehensive testing strategy
852
+ - Create detailed documentation and user guides
853
+ - Establish clear project scope and change management process
854
+
855
+ ## 11. Success Criteria
856
+
857
+ ### Development Milestones
858
+ - Alpha version with core features completed
859
+ - Beta version with selected user group feedback
860
+ - Production-ready version with full feature set
861
+ - Post-launch iterations based on user feedback
862
+
863
+ ### Business Metrics
864
+ - User engagement and retention rates
865
+ - Task completion and productivity metrics
866
+ - Customer satisfaction scores (NPS > 50)
867
+ - Revenue targets and subscription growth
868
+
869
+ ## 12. Appendices
870
+
871
+ ### Glossary
872
+ - **PRD**: Product Requirements Document
873
+ - **AI**: Artificial Intelligence
874
+ - **CRUD**: Create, Read, Update, Delete
875
+ - **API**: Application Programming Interface
876
+ - **CI/CD**: Continuous Integration/Continuous Deployment
877
+
878
+ ### References
879
+ - Industry best practices for task management
880
+ - AI integration patterns and examples
881
+ - Security and compliance requirements
882
+ - Performance benchmarking data
883
+
884
+ ---
885
+
886
+ **Document Control:**
887
+ - Version: 1.0
888
+ - Last Updated: December 27, 2024
889
+ - Next Review: January 15, 2025
890
+ - Approved By: Product Owner, Technical Lead`;f.useEffect(()=>{(async()=>{if(e?.name)L(e.name.replace(/\.(txt|md)$/,""));else if(i){const he=new Date().toISOString().split("T")[0];L(`prd-${he}`)}if(i){c(z),u(!1);return}if(e.content){c(e.content),u(!1);return}try{u(!0);const J=await Ue.readFile(e.projectName,e.path);if(!J.ok)throw new Error(`Failed to load file: ${J.status} ${J.statusText}`);const he=await J.json();c(he.content||z)}catch(J){console.error("Error loading PRD file:",J),c(`# Error Loading PRD
891
+
892
+ Error: ${J.message}
893
+
894
+ File: ${e?.name||"New PRD"}
895
+ Path: ${e?.path||"Not saved yet"}
896
+
897
+ ${z}`)}finally{u(!1)}})()},[e,n,i]),f.useEffect(()=>{(async()=>{if(!s?.name){console.log("No project name available:",s);return}try{console.log("Fetching PRDs for project:",s.name);const J=await Ue.get(`/taskmaster/prd/${encodeURIComponent(s.name)}`);if(J.ok){const he=await J.json();console.log("Fetched existing PRDs:",he.prds),C(he.prds||[])}else console.log("Failed to fetch PRDs:",J.status,J.statusText)}catch(J){console.error("Error fetching existing PRDs:",J)}})()},[s?.name]);const Z=async()=>{if(!l.trim()){alert("Please add content before saving.");return}if(!B.trim()){alert("Please provide a filename for the PRD.");return}const w=B.endsWith(".txt")||B.endsWith(".md")?B:`${B}.txt`,J=_.find(he=>he.name===w);if(console.log("Save check:",{fullFileName:w,existingPRDs:_,existingFile:J,isExisting:e?.isExisting,fileObject:e,shouldShowModal:J&&!e?.isExisting}),J&&!e?.isExisting){console.log("Showing overwrite confirmation modal"),D(!0);return}await F()},F=async()=>{h(!0);try{const w=B.endsWith(".txt")||B.endsWith(".md")?B:`${B}.txt`,J=await Fe(`/api/taskmaster/prd/${encodeURIComponent(s?.name)}`,{method:"POST",body:JSON.stringify({fileName:w,content:l})});if(!J.ok){const ye=await J.json();throw new Error(ye.message||`Save failed: ${J.status}`)}N(!0),setTimeout(()=>N(!1),2e3);const he=await Ue.get(`/taskmaster/prd/${encodeURIComponent(s.name)}`);if(he.ok){const ye=await he.json();C(ye.prds||[])}o&&await o()}catch(w){console.error("Error saving PRD:",w),alert(`Error saving PRD: ${w.message}`)}finally{h(!1)}},ce=()=>{const w=new Blob([l],{type:"text/markdown"}),J=URL.createObjectURL(w),he=document.createElement("a");he.href=J;const ye=B?`${B}.txt`:"prd.txt";he.download=ye,document.body.appendChild(he),he.click(),document.body.removeChild(he),URL.revokeObjectURL(J)},v=async()=>{if(!l.trim()){alert("Please add content to the PRD before generating tasks.");return}j(!0)},ue=()=>{g(!p)};f.useEffect(()=>{const w=J=>{(J.ctrlKey||J.metaKey)&&(J.key==="s"?(J.preventDefault(),Z()):J.key==="Escape"&&(J.preventDefault(),r()))};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]);const fe=w=>w.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/^\- (.*$)/gim,"<li>$1</li>").replace(/(<li>.*<\/li>)/gims,"<ul>$1</ul>").replace(/\n\n/gim,"</p><p>").replace(/^(?!<[h|u|l])(.*$)/gim,"<p>$1</p>").replace(/<\/ul>\s*<ul>/gim,"");return d?t.jsx("div",{className:"fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center",children:t.jsx("div",{className:"w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center bg-white dark:bg-gray-900",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),t.jsx("span",{className:"text-gray-900 dark:text-white",children:"Loading PRD..."})]})})}):t.jsxs("div",{className:`fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${p?"md:p-0":""}`,children:[t.jsxs("div",{className:Me("bg-white dark:bg-gray-900 shadow-2xl flex flex-col","w-full h-full md:rounded-lg md:shadow-2xl",p?"md:w-full md:h-full md:rounded-none":"md:w-full md:max-w-6xl md:h-[85vh] md:max-h-[85vh]"),children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[t.jsx("div",{className:"w-8 h-8 bg-purple-600 rounded flex items-center justify-center flex-shrink-0",children:t.jsx($t,{className:"w-4 h-4 text-white"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center min-w-0 flex-1 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md px-3 py-2 focus-within:ring-2 focus-within:ring-purple-500 focus-within:border-purple-500 dark:focus-within:ring-purple-400 dark:focus-within:border-purple-400",children:[t.jsx("input",{type:"text",value:B,onChange:w=>{const J=w.target.value.replace(/[<>:"/\\|?*]/g,"");L(J)},className:"font-medium text-gray-900 dark:text-white bg-transparent border-none outline-none min-w-0 flex-1 text-base sm:text-sm placeholder-gray-400 dark:placeholder-gray-500",placeholder:"Enter PRD filename",maxLength:100}),t.jsx("span",{className:"text-sm sm:text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap ml-1",children:".txt"})]}),t.jsx("button",{onClick:()=>document.querySelector('input[placeholder="Enter PRD filename"]')?.focus(),className:"p-1 text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 transition-colors",title:"Click to edit filename",children:t.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})})]}),t.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[t.jsx("span",{className:"text-xs bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-300 px-2 py-1 rounded whitespace-nowrap",children:"📋 PRD"}),i&&t.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-300 px-2 py-1 rounded whitespace-nowrap",children:"✨ New"})]})]}),t.jsx("p",{className:"text-xs sm:text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:"Product Requirements Document"})]})]}),t.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[t.jsx("button",{onClick:()=>P(!y),className:Me("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",y?"text-purple-600 dark:text-purple-400 bg-purple-50 dark:bg-purple-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:y?"Switch to edit mode":"Preview markdown",children:t.jsx($n,{className:"w-5 h-5 md:w-4 md:h-4"})}),t.jsx("button",{onClick:()=>M(!W),className:Me("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",W?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:W?"Disable word wrap":"Enable word wrap",children:t.jsx("span",{className:"text-sm md:text-xs font-mono font-bold",children:"↵"})}),t.jsx("button",{onClick:()=>b(!x),className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Toggle theme",children:t.jsx("span",{className:"text-lg md:text-base",children:x?"☀️":"🌙"})}),t.jsx("button",{onClick:ce,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download PRD",children:t.jsx(ps,{className:"w-5 h-5 md:w-4 md:h-4"})}),t.jsxs("button",{onClick:v,disabled:!l.trim(),className:Me("px-3 py-2 rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors text-sm font-medium","bg-purple-600 hover:bg-purple-700 text-white","min-h-[44px] md:min-h-0"),title:"Generate tasks from PRD content",children:[t.jsx(Ir,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden md:inline",children:"Generate Tasks"})]}),t.jsx("button",{onClick:Z,disabled:m,className:Me("px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors","min-h-[44px] md:min-h-0",k?"bg-green-600 hover:bg-green-700":"bg-purple-600 hover:bg-purple-700"),children:k?t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):t.jsxs(t.Fragment,{children:[t.jsx(fs,{className:"w-5 h-5 md:w-4 md:h-4"}),t.jsx("span",{className:"hidden sm:inline",children:m?"Saving...":"Save PRD"})]})}),t.jsx("button",{onClick:ue,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:p?"Exit fullscreen":"Fullscreen",children:p?t.jsx(Jl,{className:"w-4 h-4"}):t.jsx(ri,{className:"w-4 h-4"})}),t.jsx("button",{onClick:r,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:t.jsx(ct,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:y?t.jsx("div",{className:"h-full overflow-y-auto p-6 prose prose-gray dark:prose-invert max-w-none",children:t.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:fe(l)}})}):t.jsx(Ol,{ref:V,value:l,onChange:c,extensions:[Wl(),...W?[er.lineWrapping]:[]],theme:x?Bl:void 0,height:"100%",style:{fontSize:"14px",height:"100%"},basicSetup:{lineNumbers:!0,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),t.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[t.jsxs("span",{children:["Lines: ",l.split(`
898
+ `).length]}),t.jsxs("span",{children:["Characters: ",l.length]}),t.jsxs("span",{children:["Words: ",l.split(/\s+/).filter(w=>w.length>0).length]}),t.jsx("span",{children:"Format: Markdown"})]}),t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]}),U&&t.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center",children:t.jsx(Ir,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Generate Tasks from PRD"})]}),t.jsx("button",{onClick:()=>j(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:t.jsx(ct,{className:"w-5 h-5"})})]}),t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-4 border border-purple-200 dark:border-purple-800",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx(Ir,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),t.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200 mb-3",children:"You can simply ask Claude Code in the chat to parse your PRD and generate tasks. The AI assistant will automatically save your PRD and create detailed tasks with implementation details."}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-purple-200 dark:border-purple-700 p-3 mb-3",children:[t.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),t.jsxs("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:[`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/`,B.endsWith(".txt")||B.endsWith(".md")?B:`${B}.txt`,'. Can you help me parse it and set up the initial tasks?"']})]}),t.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[t.jsx("strong",{children:"This will:"})," Save your PRD, analyze its content, and generate structured tasks with subtasks, dependencies, and implementation details."]})]})]})}),t.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),t.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-purple-600 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),t.jsx("div",{className:"pt-4",children:t.jsx("button",{onClick:()=>j(!1),className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),R&&t.jsxs("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4",children:[t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>D(!1)}),t.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full border border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"p-6",children:[t.jsxs("div",{className:"flex items-center mb-4",children:[t.jsx("div",{className:"p-2 rounded-full mr-3 bg-yellow-100 dark:bg-yellow-900",children:t.jsx(En,{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400"})}),t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"File Already Exists"})]}),t.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:['A PRD file named "',B.endsWith(".txt")||B.endsWith(".md")?B:`${B}.txt`,'" already exists. Do you want to overwrite it with the current content?']}),t.jsxs("div",{className:"flex justify-end space-x-3",children:[t.jsx("button",{onClick:()=>D(!1),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),t.jsxs("button",{onClick:async()=>{D(!1),await F()},className:"px-4 py-2 text-sm text-white bg-yellow-600 hover:bg-yellow-700 rounded-md flex items-center space-x-2 transition-colors",children:[t.jsx(fs,{className:"w-4 h-4"}),t.jsx("span",{children:"Overwrite"})]})]})]})})]})]})};function a1({selectedProject:e,selectedSession:r,activeTab:n,setActiveTab:s,ws:a,sendMessage:i,messages:o,isMobile:l,isPWA:c,onMenuClick:d,isLoading:u,onInputFocusChange:m,onSessionActive:h,onSessionInactive:p,onSessionProcessing:g,onSessionNotProcessing:x,processingSessions:b,onReplaceTemporarySession:k,onNavigateToSession:N,onShowSettings:y,autoExpandTools:P,showRawParameters:W,showThinking:M,autoScrollToBottom:B,sendByCtrlEnter:L,externalMessageUpdate:U}){const[j,R]=f.useState(null),[D,_]=f.useState(null),[C,V]=f.useState(!1),[z,Z]=f.useState(600),[F,ce]=f.useState(!1),[v,ue]=f.useState(!1),fe=f.useRef(null),[w,J]=f.useState(!1),[he,ye]=f.useState(null),[re,Pe]=f.useState([]),[X,le]=f.useState(null),{tasks:ke,currentProject:ge,refreshTasks:Ie,setCurrentProject:Ke}=On(),{tasksEnabled:et,isTaskMasterInstalled:st,isTaskMasterReady:ft}=Bn(),tt=et&&st;f.useEffect(()=>{e&&e!==ge&&Ke(e)},[e,ge,Ke]),f.useEffect(()=>{!tt&&n==="tasks"&&s("chat")},[tt,n,s]),f.useEffect(()=>{(async()=>{if(!ge?.name){Pe([]);return}try{const O=await Ue.get(`/taskmaster/prd/${encodeURIComponent(ge.name)}`);if(O.ok){const ne=await O.json();Pe(ne.prdFiles||[])}else Pe([])}catch(O){console.error("Failed to load existing PRDs:",O),Pe([])}})()},[ge?.name]);const xe=(T,O=null)=>{const ne={name:T.split("/").pop(),path:T,projectName:e?.name,diffInfo:O};R(ne)},qe=()=>{R(null),ue(!1)},it=()=>{ue(!v)},ve=T=>{if(typeof T=="object"&&T.id&&!T.title){const O=ke?.find(ne=>ne.id===T.id);O&&(_(O),V(!0))}else _(T),V(!0)},Ct=()=>{V(!1),_(null)},Q=(T,O)=>{console.log("Update task status:",T,O),Ie?.()},de=T=>{l||(ce(!0),T.preventDefault())};return f.useEffect(()=>{const T=ne=>{if(!F)return;const Ce=fe.current?.parentElement;if(!Ce)return;const De=Ce.getBoundingClientRect(),ee=De.right-ne.clientX,me=300,oe=De.width*.8;ee>=me&&ee<=oe&&Z(ee)},O=()=>{ce(!1)};return F&&(document.addEventListener("mousemove",T),document.addEventListener("mouseup",O),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",O),document.body.style.cursor="",document.body.style.userSelect=""}},[F]),u?t.jsxs("div",{className:"h-full flex flex-col",children:[l&&t.jsx("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-3 sm:p-4 pwa-header-safe flex-shrink-0",children:t.jsx("button",{onClick:d,className:"p-1.5 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[t.jsx("div",{className:"w-12 h-12 mx-auto mb-4",children:t.jsx("div",{className:"w-full h-full rounded-full border-4 border-gray-200 border-t-blue-500",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),t.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Loading Claude Code UI"}),t.jsx("p",{children:"Setting up your workspace..."})]})})]}):e?t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-3 sm:p-4 pwa-header-safe flex-shrink-0",children:t.jsxs("div",{className:"flex items-center justify-between relative",children:[t.jsxs("div",{className:"flex items-center space-x-2 sm:space-x-3",children:[l&&t.jsx("button",{onClick:d,onTouchStart:T=>{T.preventDefault(),d()},className:"p-2.5 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 touch-manipulation active:scale-95 pwa-menu-button",children:t.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),t.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[n==="chat"&&r&&t.jsx("div",{className:"w-6 h-6 flex-shrink-0 flex items-center justify-center",children:r.__provider==="cursor"?t.jsx(hr,{className:"w-5 h-5"}):t.jsx(lr,{className:"w-5 h-5"})}),t.jsx("div",{className:"flex-1 min-w-0",children:n==="chat"&&r?t.jsxs("div",{children:[t.jsx("h2",{className:"text-base sm:text-lg font-semibold text-gray-900 dark:text-white truncate",children:r.__provider==="cursor"?r.name||"Untitled Session":r.summary||"New Session"}),t.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:[e.displayName," ",t.jsxs("span",{className:"hidden sm:inline",children:["• ",r.id]})]})]}):n==="chat"&&!r?t.jsxs("div",{children:[t.jsx("h2",{className:"text-base sm:text-lg font-semibold text-gray-900 dark:text-white",children:"New Session"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):t.jsxs("div",{children:[t.jsx("h2",{className:"text-base sm:text-lg font-semibold text-gray-900 dark:text-white",children:n==="files"?"Project Files":n==="git"?"Source Control":n==="tasks"&&tt?"TaskMaster":"Project"}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]})})]})]}),t.jsx("div",{className:"flex-shrink-0 hidden sm:block",children:t.jsxs("div",{className:"relative flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[t.jsx(Ot,{content:"Chat",position:"bottom",children:t.jsx("button",{onClick:()=>s("chat"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md ${n==="chat"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[t.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),t.jsx("span",{className:"hidden md:hidden lg:inline",children:"Chat"})]})})}),t.jsx(Ot,{content:"Shell",position:"bottom",children:t.jsx("button",{onClick:()=>s("shell"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="shell"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[t.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})}),t.jsx("span",{className:"hidden md:hidden lg:inline",children:"Shell"})]})})}),t.jsx(Ot,{content:"Files",position:"bottom",children:t.jsx("button",{onClick:()=>s("files"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="files"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[t.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})}),t.jsx("span",{className:"hidden md:hidden lg:inline",children:"Files"})]})})}),t.jsx(Ot,{content:"Source Control",position:"bottom",children:t.jsx("button",{onClick:()=>s("git"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="git"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[t.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),t.jsx("span",{className:"hidden md:hidden lg:inline",children:"Source Control"})]})})}),tt&&t.jsx(Ot,{content:"Tasks",position:"bottom",children:t.jsx("button",{onClick:()=>s("tasks"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${n==="tasks"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[t.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),t.jsx("span",{className:"hidden md:hidden lg:inline",children:"Tasks"})]})})})]})})]})}),t.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[t.jsxs("div",{className:`flex-1 flex flex-col min-h-0 overflow-hidden ${j?"mr-0":""} ${v?"hidden":""}`,children:[t.jsx("div",{className:`h-full ${n==="chat"?"block":"hidden"}`,children:t.jsx(t1,{showDetails:!0,children:t.jsx(cw,{selectedProject:e,selectedSession:r,ws:a,sendMessage:i,messages:o,onFileOpen:xe,onInputFocusChange:m,onSessionActive:h,onSessionInactive:p,onSessionProcessing:g,onSessionNotProcessing:x,processingSessions:b,onReplaceTemporarySession:k,onNavigateToSession:N,onShowSettings:y,autoExpandTools:P,showRawParameters:W,showThinking:M,autoScrollToBottom:B,sendByCtrlEnter:L,externalMessageUpdate:U,onShowAllTasks:et?()=>s("tasks"):null})})}),t.jsx("div",{className:`h-full overflow-hidden ${n==="files"?"block":"hidden"}`,children:t.jsx(Zw,{selectedProject:e})}),t.jsx("div",{className:`h-full overflow-hidden ${n==="shell"?"block":"hidden"}`,children:t.jsx(iu,{project:e,session:r,isActive:n==="shell",showHeader:!1})}),t.jsx("div",{className:`h-full overflow-hidden ${n==="git"?"block":"hidden"}`,children:t.jsx(e1,{selectedProject:e,isMobile:l,onFileOpen:xe})}),tt&&t.jsx("div",{className:`h-full ${n==="tasks"?"block":"hidden"}`,children:t.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:t.jsx(n1,{tasks:ke||[],onTaskClick:ve,showParentTasks:!0,className:"flex-1 overflow-y-auto p-4",currentProject:ge,onTaskCreated:Ie,onShowPRDEditor:(T=null)=>{ye(T),J(!0)},existingPRDs:re,onRefreshPRDs:(T=!1)=>{ge?.name&&Ue.get(`/taskmaster/prd/${encodeURIComponent(ge.name)}`).then(O=>O.ok?O.json():Promise.reject()).then(O=>{Pe(O.prdFiles||[]),T&&(le("PRD saved successfully!"),setTimeout(()=>le(null),3e3))}).catch(O=>console.error("Failed to refresh PRDs:",O))}})})}),t.jsx("div",{className:`h-full overflow-hidden ${n==="preview"?"block":"hidden"}`})]}),j&&!l&&t.jsxs(t.Fragment,{children:[!v&&t.jsx("div",{ref:fe,onMouseDown:de,className:"flex-shrink-0 w-1 bg-gray-200 dark:bg-gray-700 hover:bg-blue-500 dark:hover:bg-blue-600 cursor-col-resize transition-colors relative group",title:"Drag to resize",children:t.jsx("div",{className:"absolute inset-y-0 left-1/2 -translate-x-1/2 w-1 bg-blue-500 dark:bg-blue-600 opacity-0 group-hover:opacity-100 transition-opacity"})}),t.jsx("div",{className:`flex-shrink-0 border-l border-gray-200 dark:border-gray-700 h-full overflow-hidden ${v?"flex-1":""}`,style:v?{}:{width:`${z}px`},children:t.jsx(Ya,{file:j,onClose:qe,projectPath:e?.path,isSidebar:!0,isExpanded:v,onToggleExpand:it})})]})]}),j&&l&&t.jsx(Ya,{file:j,onClose:qe,projectPath:e?.path,isSidebar:!1}),tt&&C&&D&&t.jsx(Md,{task:D,isOpen:C,onClose:Ct,onStatusChange:Q,onTaskClick:ve}),w&&t.jsx(s1,{project:ge,projectPath:ge?.fullPath||ge?.path,onClose:()=>{J(!1),ye(null)},isNewFile:!he?.isExisting,file:{name:he?.name||"prd.txt",content:he?.content||""},onSave:async()=>{J(!1),ye(null);try{const T=await Ue.get(`/taskmaster/prd/${encodeURIComponent(ge.name)}`);if(T.ok){const O=await T.json();Pe(O.prdFiles||[]),le("PRD saved successfully!"),setTimeout(()=>le(null),3e3)}}catch(T){console.error("Failed to refresh PRDs:",T)}Ie?.()}}),X&&t.jsx("div",{className:"fixed bottom-4 right-4 z-50 animate-in slide-in-from-bottom-2 duration-300",children:t.jsxs("div",{className:"bg-green-600 text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3",children:[t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t.jsx("span",{className:"font-medium",children:X})]})})]}):t.jsxs("div",{className:"h-full flex flex-col",children:[l&&t.jsx("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-3 sm:p-4 pwa-header-safe flex-shrink-0",children:t.jsx("button",{onClick:d,className:"p-1.5 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 max-w-md mx-auto px-6",children:[t.jsx("div",{className:"w-16 h-16 mx-auto mb-6 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:t.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})})}),t.jsx("h2",{className:"text-2xl font-semibold mb-3 text-gray-900 dark:text-white",children:"Choose Your Project"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-300 mb-6 leading-relaxed",children:"Select a project from the sidebar to start coding with Claude. Each project contains your chat sessions and file history."}),t.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:t.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["💡 ",t.jsx("strong",{children:"Tip:"})," ",l?"Tap the menu button above to access projects":"Create a new project by clicking the folder icon in the sidebar"]})})]})})]})}const i1=fr.memo(a1);function o1({activeTab:e,setActiveTab:r,isInputFocused:n}){const{tasksEnabled:s}=Bn(),a=document.documentElement.classList.contains("dark"),i=[{id:"chat",icon:Dn,onClick:()=>r("chat")},{id:"shell",icon:sn,onClick:()=>r("shell")},{id:"files",icon:or,onClick:()=>r("files")},{id:"git",icon:xa,onClick:()=>r("git")},...s?[{id:"tasks",icon:Rp,onClick:()=>r("tasks")}]:[]];return t.jsxs(t.Fragment,{children:[t.jsx("style",{children:`
899
+ .mobile-nav-container {
900
+ background-color: ${a?"#1f2937":"#ffffff"} !important;
901
+ }
902
+ .mobile-nav-container:hover {
903
+ background-color: ${a?"#1f2937":"#ffffff"} !important;
904
+ }
905
+ `}),t.jsx("div",{className:`mobile-nav-container fixed bottom-0 left-0 right-0 border-t border-gray-200 dark:border-gray-700 z-50 ios-bottom-safe transform transition-transform duration-300 ease-in-out shadow-lg ${n?"translate-y-full":"translate-y-0"}`,children:t.jsx("div",{className:"flex items-center justify-around py-1",children:i.map(o=>{const l=o.icon,c=e===o.id;return t.jsxs("button",{onClick:o.onClick,onTouchStart:d=>{d.preventDefault(),o.onClick()},className:`flex items-center justify-center p-2 rounded-lg min-h-[40px] min-w-[40px] relative touch-manipulation ${c?"text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,"aria-label":o.id,children:[t.jsx(l,{className:"w-5 h-5"}),c&&t.jsx("div",{className:"absolute top-0 left-1/2 transform -translate-x-1/2 w-6 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-full"})]},o.id)})})})]})}const ou=f.createContext(),Ti=()=>{const e=f.useContext(ou);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},l1=({children:e})=>{const[r,n]=f.useState(()=>{const i=localStorage.getItem("theme");return i?i==="dark":window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1});f.useEffect(()=>{if(r){document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark");const i=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');i&&i.setAttribute("content","black-translucent");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#0c1117")}else{document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light");const i=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');i&&i.setAttribute("content","default");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#ffffff")}},[r]),f.useEffect(()=>{if(!window.matchMedia)return;const i=window.matchMedia("(prefers-color-scheme: dark)"),o=l=>{localStorage.getItem("theme")||n(l.matches)};return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[]);const a={isDarkMode:r,toggleDarkMode:()=>{n(i=>!i)}};return t.jsx(ou.Provider,{value:a,children:e})};function c1(){const[e,r]=f.useState([]),[n,s]=f.useState([]),[a,i]=f.useState(!0),[o,l]=f.useState(!1),[c,d]=f.useState(!1),[u,m]=f.useState(""),[h,p]=f.useState(""),[g,x]=f.useState(""),[b,k]=f.useState(""),[N,y]=f.useState({}),[P,W]=f.useState(null),[M,B]=f.useState(null);f.useEffect(()=>{L()},[]);const L=async()=>{try{i(!0);const z=localStorage.getItem("auth-token"),F=await(await fetch("/api/settings/api-keys",{headers:{Authorization:`Bearer ${z}`}})).json();r(F.apiKeys||[]);const v=await(await fetch("/api/settings/credentials?type=github_token",{headers:{Authorization:`Bearer ${z}`}})).json();s(v.credentials||[])}catch(z){console.error("Error fetching settings:",z)}finally{i(!1)}},U=async()=>{if(u.trim())try{const z=localStorage.getItem("auth-token"),F=await(await fetch("/api/settings/api-keys",{method:"POST",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify({keyName:u})})).json();F.success&&(B(F.apiKey),m(""),l(!1),L())}catch(z){console.error("Error creating API key:",z)}},j=async z=>{if(confirm("Are you sure you want to delete this API key?"))try{const Z=localStorage.getItem("auth-token");await fetch(`/api/settings/api-keys/${z}`,{method:"DELETE",headers:{Authorization:`Bearer ${Z}`}}),L()}catch(Z){console.error("Error deleting API key:",Z)}},R=async(z,Z)=>{try{const F=localStorage.getItem("auth-token");await fetch(`/api/settings/api-keys/${z}/toggle`,{method:"PATCH",headers:{Authorization:`Bearer ${F}`,"Content-Type":"application/json"},body:JSON.stringify({isActive:!Z})}),L()}catch(F){console.error("Error toggling API key:",F)}},D=async()=>{if(!(!h.trim()||!g.trim()))try{const z=localStorage.getItem("auth-token");(await(await fetch("/api/settings/credentials",{method:"POST",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify({credentialName:h,credentialType:"github_token",credentialValue:g,description:b})})).json()).success&&(p(""),x(""),k(""),d(!1),L())}catch(z){console.error("Error creating GitHub credential:",z)}},_=async z=>{if(confirm("Are you sure you want to delete this GitHub token?"))try{const Z=localStorage.getItem("auth-token");await fetch(`/api/settings/credentials/${z}`,{method:"DELETE",headers:{Authorization:`Bearer ${Z}`}}),L()}catch(Z){console.error("Error deleting GitHub credential:",Z)}},C=async(z,Z)=>{try{const F=localStorage.getItem("auth-token");await fetch(`/api/settings/credentials/${z}/toggle`,{method:"PATCH",headers:{Authorization:`Bearer ${F}`,"Content-Type":"application/json"},body:JSON.stringify({isActive:!Z})}),L()}catch(F){console.error("Error toggling GitHub credential:",F)}},V=(z,Z)=>{navigator.clipboard.writeText(z),W(Z),setTimeout(()=>W(null),2e3)};return a?t.jsx("div",{className:"text-muted-foreground",children:"Loading..."}):t.jsxs("div",{className:"space-y-8",children:[M&&t.jsxs("div",{className:"p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:[t.jsx("h4",{className:"font-semibold text-yellow-500 mb-2",children:"⚠️ Save Your API Key"}),t.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"This is the only time you'll see this key. Store it securely."}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("code",{className:"flex-1 px-3 py-2 bg-background/50 rounded font-mono text-sm break-all",children:M.apiKey}),t.jsx(Le,{size:"sm",variant:"outline",onClick:()=>V(M.apiKey,"new"),children:P==="new"?t.jsx(Fr,{className:"h-4 w-4"}):t.jsx(Vl,{className:"h-4 w-4"})})]}),t.jsx(Le,{size:"sm",variant:"ghost",className:"mt-3",onClick:()=>B(null),children:"I've saved it"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Kl,{className:"h-5 w-5"}),t.jsx("h3",{className:"text-lg font-semibold",children:"API Keys"})]}),t.jsxs(Le,{size:"sm",onClick:()=>l(!o),children:[t.jsx(Dt,{className:"h-4 w-4 mr-1"}),"New API Key"]})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Generate API keys to access the external API from other applications."}),t.jsxs("a",{href:"/api-docs.html",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:["API Documentation",t.jsx(Lm,{className:"h-3 w-3"})]})]}),o&&t.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card",children:[t.jsx(Et,{placeholder:"API Key Name (e.g., Production Server)",value:u,onChange:z=>m(z.target.value),className:"mb-2"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Le,{onClick:U,children:"Create"}),t.jsx(Le,{variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]}),t.jsx("div",{className:"space-y-2",children:e.length===0?t.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No API keys created yet."}):e.map(z=>t.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium",children:z.key_name}),t.jsx("code",{className:"text-xs text-muted-foreground",children:z.api_key}),t.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Created: ",new Date(z.created_at).toLocaleDateString(),z.last_used&&` • Last used: ${new Date(z.last_used).toLocaleDateString()}`]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Le,{size:"sm",variant:z.is_active?"outline":"secondary",onClick:()=>R(z.id,z.is_active),children:z.is_active?"Active":"Inactive"}),t.jsx(Le,{size:"sm",variant:"ghost",onClick:()=>j(z.id),children:t.jsx(nr,{className:"h-4 w-4"})})]})]},z.id))})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Qm,{className:"h-5 w-5"}),t.jsx("h3",{className:"text-lg font-semibold",children:"GitHub Credentials"})]}),t.jsxs(Le,{size:"sm",onClick:()=>d(!c),children:[t.jsx(Dt,{className:"h-4 w-4 mr-1"}),"Add Token"]})]}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add GitHub Personal Access Tokens to clone private repositories. You can also pass tokens directly in API requests without storing them."}),c&&t.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card space-y-3",children:[t.jsx(Et,{placeholder:"Token Name (e.g., Personal Repos)",value:h,onChange:z=>p(z.target.value)}),t.jsxs("div",{className:"relative",children:[t.jsx(Et,{type:N.new?"text":"password",placeholder:"GitHub Personal Access Token (ghp_...)",value:g,onChange:z=>x(z.target.value),className:"pr-10"}),t.jsx("button",{type:"button",onClick:()=>y({...N,new:!N.new}),className:"absolute right-3 top-2.5 text-muted-foreground hover:text-foreground",children:N.new?t.jsx(zm,{className:"h-4 w-4"}):t.jsx($n,{className:"h-4 w-4"})})]}),t.jsx(Et,{placeholder:"Description (optional)",value:b,onChange:z=>k(z.target.value)}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Le,{onClick:D,children:"Add Token"}),t.jsx(Le,{variant:"outline",onClick:()=>{d(!1),p(""),x(""),k("")},children:"Cancel"})]}),t.jsx("a",{href:"https://github.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline block",children:"How to create a GitHub Personal Access Token →"})]}),t.jsx("div",{className:"space-y-2",children:n.length===0?t.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No GitHub tokens added yet."}):n.map(z=>t.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium",children:z.credential_name}),z.description&&t.jsx("div",{className:"text-xs text-muted-foreground",children:z.description}),t.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Added: ",new Date(z.created_at).toLocaleDateString()]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Le,{size:"sm",variant:z.is_active?"outline":"secondary",onClick:()=>C(z.id,z.is_active),children:z.is_active?"Active":"Inactive"}),t.jsx(Le,{size:"sm",variant:"ghost",onClick:()=>_(z.id),children:t.jsx(nr,{className:"h-4 w-4"})})]})]},z.id))})]})]})}function d1({isOpen:e,onClose:r,projects:n=[],initialTab:s="tools"}){const{isDarkMode:a,toggleDarkMode:i}=Ti(),{tasksEnabled:o,setTasksEnabled:l,isTaskMasterInstalled:c,isTaskMasterReady:d,installationStatus:u,isCheckingInstallation:m}=Bn(),[h,p]=f.useState([]),[g,x]=f.useState([]),[b,k]=f.useState(""),[N,y]=f.useState(""),[P,W]=f.useState(!1),[M,B]=f.useState(!1),[L,U]=f.useState(null),[j,R]=f.useState("name"),[D,_]=f.useState([]),[C,V]=f.useState(!1),[z,Z]=f.useState(null),[F,ce]=f.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[v,ue]=f.useState(!1),[fe,w]=f.useState({}),[J,he]=f.useState({}),[ye,re]=f.useState({}),[Pe,X]=f.useState(s),[le,ke]=f.useState(""),[ge,Ie]=f.useState("claude"),[Ke,et]=f.useState(()=>localStorage.getItem("codeEditorTheme")||"dark"),[st,ft]=f.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[tt,xe]=f.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[qe,it]=f.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[ve,Ct]=f.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),[Q,de]=f.useState([]),[T,O]=f.useState([]),[ne,Ce]=f.useState(!1),[De,ee]=f.useState(""),[me,oe]=f.useState(""),[we,Ee]=f.useState([]),[Be,ze]=f.useState(!1),[Xe,gt]=f.useState(""),[ot,vt]=f.useState(null),Gt=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"],Kt=["Shell(ls)","Shell(mkdir)","Shell(cd)","Shell(cat)","Shell(echo)","Shell(git status)","Shell(git diff)","Shell(git log)","Shell(npm install)","Shell(npm run)","Shell(python)","Shell(node)"],Nt=async()=>{try{const A=localStorage.getItem("auth-token"),ie=await fetch("/api/cursor/mcp",{headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"}});if(ie.ok){const Oe=await ie.json();Ee(Oe.servers||[])}else console.error("Failed to fetch Cursor MCP servers")}catch(A){console.error("Error fetching Cursor MCP servers:",A)}},Wt=async()=>{try{const A=localStorage.getItem("auth-token"),ie=await fetch("/api/mcp/config/read",{headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"}});if(ie.ok){const pt=await ie.json();if(pt.success&&pt.servers){_(pt.servers);return}}const Oe=await fetch("/api/mcp/cli/list",{headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"}});if(Oe.ok){const pt=await Oe.json();if(pt.success&&pt.servers){const ht=pt.servers.map(Yt=>({id:Yt.name,name:Yt.name,type:Yt.type,scope:"user",config:{command:Yt.command||"",args:Yt.args||[],env:Yt.env||{},url:Yt.url||"",headers:Yt.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));_(ht);return}}const ut=await fetch("/api/mcp/servers?scope=user",{headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"}});if(ut.ok){const pt=await ut.json();_(pt.servers||[])}else console.error("Failed to fetch MCP servers")}catch(A){console.error("Error fetching MCP servers:",A)}},Jt=async A=>{try{const ie=localStorage.getItem("auth-token");z&&await Rt(z.id,"user");const Oe=await fetch("/api/mcp/cli/add",{method:"POST",headers:{Authorization:`Bearer ${ie}`,"Content-Type":"application/json"},body:JSON.stringify({name:A.name,type:A.type,scope:A.scope,projectPath:A.projectPath,command:A.config?.command,args:A.config?.args||[],url:A.config?.url,headers:A.config?.headers||{},env:A.config?.env||{}})});if(Oe.ok){const ut=await Oe.json();if(ut.success)return await Wt(),!0;throw new Error(ut.error||"Failed to save server via Claude CLI")}else{const ut=await Oe.json();throw new Error(ut.error||"Failed to save server")}}catch(ie){throw console.error("Error saving MCP server:",ie),ie}},Rt=async(A,ie="user")=>{try{const Oe=localStorage.getItem("auth-token"),ut=await fetch(`/api/mcp/cli/remove/${A}?scope=${ie}`,{method:"DELETE",headers:{Authorization:`Bearer ${Oe}`,"Content-Type":"application/json"}});if(ut.ok){const pt=await ut.json();if(pt.success)return await Wt(),!0;throw new Error(pt.error||"Failed to delete server via Claude CLI")}else{const pt=await ut.json();throw new Error(pt.error||"Failed to delete server")}}catch(Oe){throw console.error("Error deleting MCP server:",Oe),Oe}};f.useEffect(()=>{e&&(I(),X(s))},[e,s]),f.useEffect(()=>{localStorage.setItem("codeEditorTheme",Ke),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Ke]),f.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",st.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[st]),f.useEffect(()=>{localStorage.setItem("codeEditorShowMinimap",tt.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[tt]),f.useEffect(()=>{localStorage.setItem("codeEditorLineNumbers",qe.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[qe]),f.useEffect(()=>{localStorage.setItem("codeEditorFontSize",ve),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[ve]);const I=async()=>{try{const A=localStorage.getItem("claude-settings");if(A){const Oe=JSON.parse(A);p(Oe.allowedTools||[]),x(Oe.disallowedTools||[]),W(Oe.skipPermissions||!1),R(Oe.projectSortOrder||"name")}else p([]),x([]),W(!1),R("name");const ie=localStorage.getItem("cursor-tools-settings");if(ie){const Oe=JSON.parse(ie);de(Oe.allowedCommands||[]),O(Oe.disallowedCommands||[]),Ce(Oe.skipPermissions||!1)}else de([]),O([]),Ce(!1);await Wt(),await Nt()}catch(A){console.error("Error loading tool settings:",A),p([]),x([]),W(!1),R("name")}},E=()=>{gt("claude"),vt(n?.[0]||{name:"default",fullPath:process.cwd()}),ze(!0)},$=()=>{gt("cursor"),vt(n?.[0]||{name:"default",fullPath:process.cwd()}),ze(!0)},ae=A=>{ze(!1)},q=()=>{B(!0),U(null);try{const A={allowedTools:h,disallowedTools:g,skipPermissions:P,projectSortOrder:j,lastUpdated:new Date().toISOString()},ie={allowedCommands:Q,disallowedCommands:T,skipPermissions:ne,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(A)),localStorage.setItem("cursor-tools-settings",JSON.stringify(ie)),U("success"),setTimeout(()=>{r()},1e3)}catch(A){console.error("Error saving tool settings:",A),U("error")}finally{B(!1)}},_e=A=>{A&&!h.includes(A)&&(p([...h,A]),k(""))},at=A=>{p(h.filter(ie=>ie!==A))},St=A=>{A&&!g.includes(A)&&(x([...g,A]),y(""))},Tr=A=>{x(g.filter(ie=>ie!==A))},wt=()=>{ce({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),Z(null),V(!1),ke("")},Mt=(A=null)=>{A?(Z(A),ce({name:A.name,type:A.type,scope:A.scope,projectPath:A.projectPath||"",config:{...A.config},raw:A.raw,importMode:"form",jsonInput:""})):wt(),V(!0)},_t=async A=>{A.preventDefault(),ue(!0);try{if(F.importMode==="json"){const ie=localStorage.getItem("auth-token"),Oe=await fetch("/api/mcp/cli/add-json",{method:"POST",headers:{Authorization:`Bearer ${ie}`,"Content-Type":"application/json"},body:JSON.stringify({name:F.name,jsonConfig:F.jsonInput,scope:F.scope,projectPath:F.projectPath})});if(Oe.ok){const ut=await Oe.json();if(ut.success)await Wt(),wt(),U("success");else throw new Error(ut.error||"Failed to add server via JSON")}else{const ut=await Oe.json();throw new Error(ut.error||"Failed to add server")}}else await Jt(F),wt(),U("success")}catch(ie){alert(`Error: ${ie.message}`),U("error")}finally{ue(!1)}},xt=async(A,ie)=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await Rt(A,ie),U("success")}catch(Oe){alert(`Error: ${Oe.message}`),U("error")}},Tt=(A,ie)=>{ce(Oe=>({...Oe,config:{...Oe.config,[A]:ie}}))},qn=A=>{switch(A){case"stdio":return t.jsx(sn,{className:"w-4 h-4"});case"sse":return t.jsx(va,{className:"w-4 h-4"});case"http":return t.jsx($s,{className:"w-4 h-4"});default:return t.jsx(Gi,{className:"w-4 h-4"})}};return e?t.jsxs("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:[t.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Wr,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),t.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:"Settings"})]}),t.jsx(Le,{variant:"ghost",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:t.jsx(ct,{className:"w-5 h-5"})})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[t.jsx("div",{className:"border-b border-border",children:t.jsxs("div",{className:"flex px-4 md:px-6",children:[t.jsx("button",{onClick:()=>X("tools"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Pe==="tools"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Tools"}),t.jsx("button",{onClick:()=>X("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Pe==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Appearance"}),t.jsx("button",{onClick:()=>X("tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Pe==="tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Tasks"}),t.jsxs("button",{onClick:()=>X("api"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Pe==="api"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[t.jsx(Kl,{className:"w-4 h-4 inline mr-2"}),"API & Tokens"]})]})}),t.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[Pe==="appearance"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:Pe==="appearance"&&t.jsxs("div",{className:"space-y-6 md:space-y-8",children:[t.jsx("div",{className:"space-y-4",children:t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Dark Mode"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Toggle between light and dark themes"})]}),t.jsxs("button",{onClick:i,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":a,"aria-label":"Toggle dark mode",children:[t.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),t.jsx("span",{className:`${a?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:a?t.jsx(ba,{className:"w-3.5 h-3.5 text-gray-700"}):t.jsx(ka,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),t.jsx("div",{className:"space-y-4",children:t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Project Sorting"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"How projects are ordered in the sidebar"})]}),t.jsxs("select",{value:j,onChange:A=>R(A.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[t.jsx("option",{value:"name",children:"Alphabetical"}),t.jsx("option",{value:"date",children:"Recent Activity"})]})]})})}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Code Editor"}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Editor Theme"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Default theme for the code editor"})]}),t.jsxs("button",{onClick:()=>et(Ke==="dark"?"light":"dark"),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":Ke==="dark","aria-label":"Toggle editor theme",children:[t.jsx("span",{className:"sr-only",children:"Toggle editor theme"}),t.jsx("span",{className:`${Ke==="dark"?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:Ke==="dark"?t.jsx(ba,{className:"w-3.5 h-3.5 text-gray-700"}):t.jsx(ka,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Word Wrap"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Enable word wrapping by default in the editor"})]}),t.jsxs("button",{onClick:()=>ft(!st),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":st,"aria-label":"Toggle word wrap",children:[t.jsx("span",{className:"sr-only",children:"Toggle word wrap"}),t.jsx("span",{className:`${st?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Show Minimap"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Display a minimap for easier navigation in diff view"})]}),t.jsxs("button",{onClick:()=>xe(!tt),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":tt,"aria-label":"Toggle minimap",children:[t.jsx("span",{className:"sr-only",children:"Toggle minimap"}),t.jsx("span",{className:`${tt?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Show Line Numbers"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Display line numbers in the editor"})]}),t.jsxs("button",{onClick:()=>it(!qe),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":qe,"aria-label":"Toggle line numbers",children:[t.jsx("span",{className:"sr-only",children:"Toggle line numbers"}),t.jsx("span",{className:`${qe?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Font Size"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Editor font size in pixels"})]}),t.jsxs("select",{value:ve,onChange:A=>Ct(A.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-24",children:[t.jsx("option",{value:"10",children:"10px"}),t.jsx("option",{value:"11",children:"11px"}),t.jsx("option",{value:"12",children:"12px"}),t.jsx("option",{value:"13",children:"13px"}),t.jsx("option",{value:"14",children:"14px"}),t.jsx("option",{value:"15",children:"15px"}),t.jsx("option",{value:"16",children:"16px"}),t.jsx("option",{value:"18",children:"18px"}),t.jsx("option",{value:"20",children:"20px"})]})]})})]})]})}),Pe==="tools"&&t.jsxs("div",{className:"space-y-6 md:space-y-8",children:[t.jsx("div",{className:"border-b border-gray-300 dark:border-gray-600",children:t.jsxs("div",{className:"flex gap-4",children:[t.jsx("button",{onClick:()=>Ie("claude"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${ge==="claude"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(lr,{className:"w-4 h-4"}),t.jsx("span",{children:"Claude"})]})}),t.jsx("button",{onClick:()=>Ie("cursor"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${ge==="cursor"?"border-purple-600 text-purple-600 dark:text-purple-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(hr,{className:"w-4 h-4"}),t.jsx("span",{children:"Cursor"})]})})]})}),ge==="claude"&&t.jsxs("div",{className:"space-y-6 md:space-y-8",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(En,{className:"w-5 h-5 text-orange-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Permission Settings"})]}),t.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:t.jsxs("label",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"checkbox",checked:P,onChange:A=>W(A.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2 checked:bg-blue-600 dark:checked:bg-blue-600"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"Skip permission prompts (use with caution)"}),t.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"Equivalent to --dangerously-skip-permissions flag"})]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Xn,{className:"w-5 h-5 text-blue-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Authentication"})]}),t.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100",children:"Claude CLI Login"}),t.jsx("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:"Sign in to your Claude account to enable AI features"})]}),t.jsxs(Le,{onClick:E,className:"bg-blue-600 hover:bg-blue-700 text-white",size:"sm",children:[t.jsx(Xn,{className:"w-4 h-4 mr-2"}),"Login"]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Os,{className:"w-5 h-5 text-green-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Allowed Tools"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Tools that are automatically allowed without prompting for permission"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(Et,{value:b,onChange:A=>k(A.target.value),placeholder:'e.g., "Bash(git log:*)" or "Write"',onKeyPress:A=>{A.key==="Enter"&&_e(b)},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Le,{onClick:()=>_e(b),disabled:!b,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Tool"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Quick add common tools:"}),t.jsx("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-2",children:Gt.map(A=>t.jsx(Le,{variant:"outline",size:"sm",onClick:()=>_e(A),disabled:h.includes(A),className:"text-xs h-8 touch-manipulation truncate",children:A},A))})]}),t.jsxs("div",{className:"space-y-2",children:[h.map(A=>t.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:A}),t.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>at(A),className:"text-green-600 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",children:t.jsx(ct,{className:"w-4 h-4"})})]},A)),h.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No allowed tools configured"})]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(En,{className:"w-5 h-5 text-red-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Disallowed Tools"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Tools that are automatically blocked without prompting for permission"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(Et,{value:N,onChange:A=>y(A.target.value),placeholder:'e.g., "Bash(rm:*)" or "Write"',onKeyPress:A=>{A.key==="Enter"&&St(N)},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Le,{onClick:()=>St(N),disabled:!N,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Tool"})]})]}),t.jsxs("div",{className:"space-y-2",children:[g.map(A=>t.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:A}),t.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>Tr(A),className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(ct,{className:"w-4 h-4"})})]},A)),g.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No disallowed tools configured"})]})]}),t.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[t.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Tool Pattern Examples:"}),t.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[t.jsxs("li",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," - Allow all git log commands"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," - Allow all git diff commands"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," - Allow all Write tool usage"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Read"'})," - Allow all Read tool usage"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," - Block all rm commands (dangerous)"]})]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Gi,{className:"w-5 h-5 text-purple-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"MCP Servers"})]}),t.jsx("div",{className:"space-y-2",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"Model Context Protocol servers provide additional tools and data sources to Claude"})}),t.jsx("div",{className:"flex justify-between items-center",children:t.jsxs(Le,{onClick:()=>Mt(),className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[t.jsx(Dt,{className:"w-4 h-4 mr-2"}),"Add MCP Server"]})}),t.jsxs("div",{className:"space-y-2",children:[D.map(A=>t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[qn(A.type),t.jsx("span",{className:"font-medium text-foreground",children:A.name}),t.jsx(Or,{variant:"outline",className:"text-xs",children:A.type}),t.jsx(Or,{variant:"outline",className:"text-xs",children:A.scope==="local"?"📁 local":A.scope==="user"?"👤 user":A.scope}),A.projectPath&&t.jsx(Or,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20",title:A.projectPath,children:A.projectPath.split("/").pop()})]}),t.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[A.type==="stdio"&&A.config.command&&t.jsxs("div",{children:["Command: ",t.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:A.config.command})]}),(A.type==="sse"||A.type==="http")&&A.config.url&&t.jsxs("div",{children:["URL: ",t.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:A.config.url})]}),A.config.args&&A.config.args.length>0&&t.jsxs("div",{children:["Args: ",t.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:A.config.args.join(" ")})]}),A.config.env&&Object.keys(A.config.env).length>0&&t.jsxs("div",{children:["Environment: ",t.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:Object.entries(A.config.env).map(([ie,Oe])=>`${ie}=${Oe}`).join(", ")})]}),A.raw&&t.jsxs("details",{className:"mt-2",children:[t.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"View full config"}),t.jsx("pre",{className:"mt-1 text-xs bg-gray-100 dark:bg-gray-800 p-2 rounded overflow-x-auto",children:JSON.stringify(A.raw,null,2)})]})]}),fe[A.id]&&t.jsxs("div",{className:`mt-2 p-2 rounded text-xs ${fe[A.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:[t.jsx("div",{className:"font-medium",children:fe[A.id].message}),fe[A.id].details&&fe[A.id].details.length>0&&t.jsx("ul",{className:"mt-1 space-y-0.5",children:fe[A.id].details.map((ie,Oe)=>t.jsxs("li",{children:["• ",ie]},Oe))})]}),J[A.id]&&t.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200 border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"font-medium mb-2",children:"Available Tools & Resources"}),J[A.id].tools&&J[A.id].tools.length>0&&t.jsxs("div",{className:"mb-2",children:[t.jsxs("div",{className:"font-medium text-xs mb-1",children:["Tools (",J[A.id].tools.length,"):"]}),t.jsx("ul",{className:"space-y-0.5",children:J[A.id].tools.map((ie,Oe)=>t.jsxs("li",{className:"flex items-start gap-1",children:[t.jsx("span",{className:"text-blue-400 mt-0.5",children:"•"}),t.jsxs("div",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:ie.name}),ie.description&&ie.description!=="No description provided"&&t.jsxs("span",{className:"ml-1 text-xs opacity-75",children:["- ",ie.description]})]})]},Oe))})]}),J[A.id].resources&&J[A.id].resources.length>0&&t.jsxs("div",{className:"mb-2",children:[t.jsxs("div",{className:"font-medium text-xs mb-1",children:["Resources (",J[A.id].resources.length,"):"]}),t.jsx("ul",{className:"space-y-0.5",children:J[A.id].resources.map((ie,Oe)=>t.jsxs("li",{className:"flex items-start gap-1",children:[t.jsx("span",{className:"text-blue-400 mt-0.5",children:"•"}),t.jsxs("div",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:ie.name}),ie.description&&ie.description!=="No description provided"&&t.jsxs("span",{className:"ml-1 text-xs opacity-75",children:["- ",ie.description]})]})]},Oe))})]}),J[A.id].prompts&&J[A.id].prompts.length>0&&t.jsxs("div",{children:[t.jsxs("div",{className:"font-medium text-xs mb-1",children:["Prompts (",J[A.id].prompts.length,"):"]}),t.jsx("ul",{className:"space-y-0.5",children:J[A.id].prompts.map((ie,Oe)=>t.jsxs("li",{className:"flex items-start gap-1",children:[t.jsx("span",{className:"text-blue-400 mt-0.5",children:"•"}),t.jsxs("div",{children:[t.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:ie.name}),ie.description&&ie.description!=="No description provided"&&t.jsxs("span",{className:"ml-1 text-xs opacity-75",children:["- ",ie.description]})]})]},Oe))})]}),(!J[A.id].tools||J[A.id].tools.length===0)&&(!J[A.id].resources||J[A.id].resources.length===0)&&(!J[A.id].prompts||J[A.id].prompts.length===0)&&t.jsx("div",{className:"text-xs opacity-75",children:"No tools, resources, or prompts discovered"})]})]}),t.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[t.jsx(Le,{onClick:()=>Mt(A),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",title:"Edit server",children:t.jsx(ya,{className:"w-4 h-4"})}),t.jsx(Le,{onClick:()=>xt(A.id,A.scope),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",title:"Delete server",children:t.jsx(nr,{className:"w-4 h-4"})})]})]})},A.id)),D.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No MCP servers configured"})]})]}),C&&t.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:t.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[t.jsx("h3",{className:"text-lg font-medium text-foreground",children:z?"Edit MCP Server":"Add MCP Server"}),t.jsx(Le,{variant:"ghost",size:"sm",onClick:wt,children:t.jsx(ct,{className:"w-4 h-4"})})]}),t.jsxs("form",{onSubmit:_t,className:"p-4 space-y-4",children:[!z&&t.jsxs("div",{className:"flex gap-2 mb-4",children:[t.jsx("button",{type:"button",onClick:()=>ce(A=>({...A,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${F.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"Form Input"}),t.jsx("button",{type:"button",onClick:()=>ce(A=>({...A,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${F.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"JSON Import"})]}),F.importMode==="form"&&z&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Scope"}),t.jsxs("div",{className:"flex items-center gap-2",children:[F.scope==="user"?t.jsx($s,{className:"w-4 h-4"}):t.jsx($r,{className:"w-4 h-4"}),t.jsx("span",{className:"text-sm",children:F.scope==="user"?"User (Global)":"Project (Local)"}),F.scope==="local"&&F.projectPath&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",F.projectPath]})]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Scope cannot be changed when editing an existing server"})]}),F.importMode==="form"&&!z&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Scope *"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{type:"button",onClick:()=>ce(A=>({...A,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${F.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.jsx($s,{className:"w-4 h-4"}),t.jsx("span",{children:"User (Global)"})]})}),t.jsx("button",{type:"button",onClick:()=>ce(A=>({...A,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${F.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:t.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.jsx($r,{className:"w-4 h-4"}),t.jsx("span",{children:"Project (Local)"})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:F.scope==="user"?"User scope: Available across all projects on your machine":"Local scope: Only available in the selected project"})]}),F.scope==="local"&&!z&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Project *"}),t.jsxs("select",{value:F.projectPath,onChange:A=>ce(ie=>({...ie,projectPath:A.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:F.scope==="local",children:[t.jsx("option",{value:"",children:"Select a project..."}),n.map(A=>t.jsx("option",{value:A.path||A.fullPath,children:A.displayName||A.name},A.name))]}),F.projectPath&&t.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Path: ",F.projectPath]})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{className:F.importMode==="json"?"md:col-span-2":"",children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Server Name *"}),t.jsx(Et,{value:F.name,onChange:A=>{ce(ie=>({...ie,name:A.target.value}))},placeholder:"my-server",required:!0})]}),F.importMode==="form"&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Transport Type *"}),t.jsxs("select",{value:F.type,onChange:A=>{ce(ie=>({...ie,type:A.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[t.jsx("option",{value:"stdio",children:"stdio"}),t.jsx("option",{value:"sse",children:"SSE"}),t.jsx("option",{value:"http",children:"HTTP"})]})]})]}),z&&F.raw&&F.importMode==="form"&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[t.jsxs("h4",{className:"text-sm font-medium text-foreground mb-2",children:["Configuration Details (from ",z.scope==="global"?"~/.claude.json":"project config",")"]}),t.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify(F.raw,null,2)})]}),F.importMode==="json"&&t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"JSON Configuration *"}),t.jsx("textarea",{value:F.jsonInput,onChange:A=>{ce(ie=>({...ie,jsonInput:A.target.value}));try{if(A.target.value.trim()){const ie=JSON.parse(A.target.value);ie.type?ie.type==="stdio"&&!ie.command?ke("stdio type requires a command field"):(ie.type==="http"||ie.type==="sse")&&!ie.url?ke(`${ie.type} type requires a url field`):ke(""):ke("Missing required field: type")}}catch{A.target.value.trim()?ke("Invalid JSON format"):ke("")}},className:`w-full px-3 py-2 border ${le?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
906
+ "type": "stdio",
907
+ "command": "/path/to/server",
908
+ "args": ["--api-key", "abc123"],
909
+ "env": {
910
+ "CACHE_DIR": "/tmp"
911
+ }
912
+ }`,required:!0}),le&&t.jsx("p",{className:"text-xs text-red-500 mt-1",children:le}),t.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Paste your MCP server configuration in JSON format. Example formats:",t.jsx("br",{}),"• stdio: ",'{"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',t.jsx("br",{}),"• http/sse: ",'{"type":"http","url":"https://api.example.com/mcp"}']})]})}),F.importMode==="form"&&F.type==="stdio"&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Command *"}),t.jsx(Et,{value:F.config.command,onChange:A=>Tt("command",A.target.value),placeholder:"/path/to/mcp-server",required:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Arguments (one per line)"}),t.jsx("textarea",{value:Array.isArray(F.config.args)?F.config.args.join(`
913
+ `):"",onChange:A=>Tt("args",A.target.value.split(`
914
+ `).filter(ie=>ie.trim())),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`--api-key
915
+ abc123`})]})]}),F.importMode==="form"&&(F.type==="sse"||F.type==="http")&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"URL *"}),t.jsx(Et,{value:F.config.url,onChange:A=>Tt("url",A.target.value),placeholder:"https://api.example.com/mcp",type:"url",required:!0})]}),F.importMode==="form"&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Environment Variables (KEY=value, one per line)"}),t.jsx("textarea",{value:Object.entries(F.config.env||{}).map(([A,ie])=>`${A}=${ie}`).join(`
916
+ `),onChange:A=>{const ie={};A.target.value.split(`
917
+ `).forEach(Oe=>{const[ut,...pt]=Oe.split("=");ut&&ut.trim()&&(ie[ut.trim()]=pt.join("=").trim())}),Tt("env",ie)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`API_KEY=your-key
918
+ DEBUG=true`})]}),F.importMode==="form"&&(F.type==="sse"||F.type==="http")&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Headers (KEY=value, one per line)"}),t.jsx("textarea",{value:Object.entries(F.config.headers||{}).map(([A,ie])=>`${A}=${ie}`).join(`
919
+ `),onChange:A=>{const ie={};A.target.value.split(`
920
+ `).forEach(Oe=>{const[ut,...pt]=Oe.split("=");ut&&ut.trim()&&(ie[ut.trim()]=pt.join("=").trim())}),Tt("headers",ie)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`Authorization=Bearer token
921
+ X-API-Key=your-key`})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[t.jsx(Le,{type:"button",variant:"outline",onClick:wt,children:"Cancel"}),t.jsx(Le,{type:"submit",disabled:v,className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50",children:v?"Saving...":z?"Update Server":"Add Server"})]})]})]})})]}),ge==="cursor"&&t.jsxs("div",{className:"space-y-6 md:space-y-8",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(En,{className:"w-5 h-5 text-orange-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Cursor Permission Settings"})]}),t.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:t.jsxs("label",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"checkbox",checked:ne,onChange:A=>Ce(A.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2 checked:bg-blue-600 dark:checked:bg-blue-600"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"Skip permission prompts (use with caution)"}),t.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"Equivalent to -f flag in Cursor CLI"})]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Xn,{className:"w-5 h-5 text-purple-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Authentication"})]}),t.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-purple-900 dark:text-purple-100",children:"Cursor CLI Login"}),t.jsx("div",{className:"text-sm text-purple-700 dark:text-purple-300",children:"Sign in to your Cursor account to enable AI features"})]}),t.jsxs(Le,{onClick:$,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[t.jsx(Xn,{className:"w-4 h-4 mr-2"}),"Login"]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Os,{className:"w-5 h-5 text-green-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Allowed Shell Commands"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that are automatically allowed without prompting for permission"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(Et,{value:De,onChange:A=>ee(A.target.value),placeholder:'e.g., "Shell(ls)" or "Shell(git status)"',onKeyPress:A=>{A.key==="Enter"&&De&&!Q.includes(De)&&(de([...Q,De]),ee(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Le,{onClick:()=>{De&&!Q.includes(De)&&(de([...Q,De]),ee(""))},disabled:!De,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Command"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Quick add common commands:"}),t.jsx("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-2",children:Kt.map(A=>t.jsx(Le,{variant:"outline",size:"sm",onClick:()=>{Q.includes(A)||de([...Q,A])},disabled:Q.includes(A),className:"text-xs h-8 touch-manipulation truncate",children:A},A))})]}),t.jsxs("div",{className:"space-y-2",children:[Q.map(A=>t.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:A}),t.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>de(Q.filter(ie=>ie!==A)),className:"text-green-600 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",children:t.jsx(ct,{className:"w-4 h-4"})})]},A)),Q.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No allowed shell commands configured"})]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Os,{className:"w-5 h-5 text-red-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Disallowed Shell Commands"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that should always be denied"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(Et,{value:me,onChange:A=>oe(A.target.value),placeholder:'e.g., "Shell(rm -rf)" or "Shell(sudo)"',onKeyPress:A=>{A.key==="Enter"&&me&&!T.includes(me)&&(O([...T,me]),oe(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Le,{onClick:()=>{me&&!T.includes(me)&&(O([...T,me]),oe(""))},disabled:!me,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Command"})]})]}),t.jsxs("div",{className:"space-y-2",children:[T.map(A=>t.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:A}),t.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>O(T.filter(ie=>ie!==A)),className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(ct,{className:"w-4 h-4"})})]},A)),T.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No disallowed shell commands configured"})]})]}),t.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[t.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:"Cursor Shell Command Examples:"}),t.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," - Allow ls command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," - Allow git status command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(mkdir)"'})," - Allow mkdir command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"-f"'})," flag - Skip all permission prompts (dangerous)"]})]})]})]})]}),Pe==="tasks"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:m?t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Checking TaskMaster installation..."})]})}):t.jsxs(t.Fragment,{children:[!c&&t.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:"TaskMaster AI CLI Not Installed"}),t.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[t.jsx("p",{children:"TaskMaster CLI is required to use task management features. Install it to get started:"}),t.jsxs("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:[t.jsx("code",{children:"npm install -g task-master-ai"}),t.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.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 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 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.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.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"})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"font-medium",children:"After installation:"}),t.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[t.jsx("li",{children:"Restart this application"}),t.jsx("li",{children:"TaskMaster features will automatically become available"}),t.jsxs("li",{children:["Use ",t.jsx("code",{className:"bg-orange-100 dark:bg-orange-800 px-1 rounded",children:"task-master init"})," in your project directory"]})]})]})]})]})]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Enable TaskMaster Integration"}),t.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:"Show TaskMaster tasks, banners, and sidebar indicators across the interface"}),!c&&t.jsx("div",{className:"text-xs text-orange-600 dark:text-orange-400 mt-1",children:"TaskMaster CLI must be installed first"})]}),t.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:o,onChange:A=>l(A.target.checked),disabled:!c,className:"sr-only peer"}),t.jsx("div",{className:`w-11 h-6 ${c?"bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800":"bg-gray-300 dark:bg-gray-600"} rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600`})]})]})}),t.jsx("div",{className:"bg-blue-50 dark:bg-blue-950/50 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx(va,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"🎯 About TaskMaster AI"}),t.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[t.jsxs("p",{children:[t.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks with AI assistance"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"PRD:"})," Generate structured tasks from Product Requirements Documents"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"Progress Visualization:"})," Kanban boards, and detailed task views"]})]})]}),t.jsx("div",{className:"mt-4 pt-4 border-t border-blue-200 dark:border-blue-700",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-6 h-6 bg-blue-100 dark:bg-blue-800 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-3 h-3 text-blue-600 dark:text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M12.586 4.586a2 2 0 112.828 2.828l-3 3a2 2 0 01-2.828 0 1 1 0 00-1.414 1.414 4 4 0 005.656 0l3-3a4 4 0 00-5.656-5.656l-1.5 1.5a1 1 0 101.414 1.414l1.5-1.5zm-5 5a2 2 0 012.828 0 1 1 0 101.414-1.414 4 4 0 00-5.656 0l-3 3a4 4 0 105.656 5.656l1.5-1.5a1 1 0 10-1.414-1.414l-1.5 1.5a2 2 0 11-2.828-2.828l3-3z",clipRule:"evenodd"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"📚 Learn More & Tutorial"}),t.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[t.jsxs("p",{children:["TaskMaster AI (aka ",t.jsx("strong",{children:"claude-task-master"})," ) is an advanced AI-powered task management system built for developers."]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.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 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 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.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.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"})})]}),t.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:"Find documentation, setup guides, and examples for advanced TaskMaster workflows"})]})]})]})]})})]})})]})]})}),Pe==="api"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:t.jsx(c1,{})})]})]}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-4 md:p-6 border-t border-border flex-shrink-0 gap-3 pb-safe-area-inset-bottom",children:[t.jsxs("div",{className:"flex items-center justify-center sm:justify-start gap-2 order-2 sm:order-1",children:[L==="success"&&t.jsxs("div",{className:"text-green-600 dark:text-green-400 text-sm flex items-center gap-1",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Settings saved successfully!"]}),L==="error"&&t.jsxs("div",{className:"text-red-600 dark:text-red-400 text-sm flex items-center gap-1",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),"Failed to save settings"]})]}),t.jsxs("div",{className:"flex items-center gap-3 order-1 sm:order-2",children:[t.jsx(Le,{variant:"outline",onClick:r,disabled:M,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:"Cancel"}),t.jsx(Le,{onClick:q,disabled:M,className:"flex-1 sm:flex-none h-10 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 touch-manipulation",children:M?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),"Saving..."]}):"Save Settings"})]})]})]}),Be&&t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 max-md:items-stretch max-md:justify-stretch",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:Xe==="claude"?"Claude CLI Login":"Cursor CLI Login"}),t.jsx("button",{onClick:()=>ze(!1),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:t.jsx(ct,{className:"w-6 h-6"})})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(iu,{project:ot,command:Xe==="claude"?"claude /login":"cursor-agent login",onComplete:ae,showHeader:!1})})]})})]}):null}function u1(){const{isDarkMode:e,toggleDarkMode:r}=Ti();return t.jsxs("button",{onClick:r,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":e,"aria-label":"Toggle dark mode",children:[t.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),t.jsx("span",{className:`${e?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:e?t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})}):t.jsx("svg",{className:"w-3.5 h-3.5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})})})]})}const m1=({isOpen:e,onToggle:r,autoExpandTools:n,onAutoExpandChange:s,showRawParameters:a,onShowRawParametersChange:i,showThinking:o,onShowThinkingChange:l,autoScrollToBottom:c,onAutoScrollChange:d,sendByCtrlEnter:u,onSendByCtrlEnterChange:m,isMobile:h})=>{const[p,g]=f.useState(e),[x,b]=f.useState(()=>localStorage.getItem("whisperMode")||"default"),{isDarkMode:k}=Ti();f.useEffect(()=>{g(e)},[e]);const N=()=>{const y=!p;g(y),r(y)};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`fixed ${h?"bottom-44":"top-1/2 -translate-y-1/2"} ${p?"right-64":"right-0"} z-50 transition-all duration-150 ease-out`,children:t.jsx("button",{onClick:N,className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-l-md p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shadow-lg","aria-label":p?"Close settings panel":"Open settings panel",children:p?t.jsx(Er,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):t.jsx(xm,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})}),t.jsx("div",{className:`fixed top-0 right-0 h-full w-64 bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 shadow-xl transform transition-transform duration-150 ease-out z-40 ${p?"translate-x-0":"translate-x-full"} ${h?"h-screen":""}`,children:t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:t.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[t.jsx(Tp,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),"Quick Settings"]})}),t.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-6 bg-white dark:bg-gray-900 ${h?"pb-20":""}`,children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Appearance"}),t.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[k?t.jsx(ba,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}):t.jsx(ka,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Dark Mode"]}),t.jsx(u1,{})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Tool Display"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(ri,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-expand tools"]}),t.jsx("input",{type:"checkbox",checked:n,onChange:y=>s(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx($n,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show raw parameters"]}),t.jsx("input",{type:"checkbox",checked:a,onChange:y=>i(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(ql,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show thinking"]}),t.jsx("input",{type:"checkbox",checked:o,onChange:y=>l(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"View Options"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(Hl,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-scroll to bottom"]}),t.jsx("input",{type:"checkbox",checked:c,onChange:y=>d(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Input Settings"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(ip,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Send by Ctrl+Enter"]}),t.jsx("input",{type:"checkbox",checked:u,onChange:y=>m(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 ml-3",children:"When enabled, pressing Ctrl+Enter will send the message instead of just Enter. This is useful for IME users to avoid accidental sends."})]}),t.jsxs("div",{className:"space-y-2",style:{display:"none"},children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Whisper Dictation"}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"default",checked:x==="default",onChange:()=>{b("default"),localStorage.setItem("whisperMode","default"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx(ds,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Default Mode"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Direct transcription of your speech"})]})]}),t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"prompt",checked:x==="prompt",onChange:()=>{b("prompt"),localStorage.setItem("whisperMode","prompt"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx(Ir,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Prompt Enhancement"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Transform rough ideas into clear, detailed AI prompts"})]})]}),t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"vibe",checked:x==="vibe"||x==="instructions"||x==="architect",onChange:()=>{b("vibe"),localStorage.setItem("whisperMode","vibe"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx($t,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Vibe Mode"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Format ideas as clear agent instructions with details"})]})]})]})]})]})]})}),p&&t.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm z-30 transition-opacity duration-150 ease-out",onClick:N})]})},p1=()=>{const[e,r]=f.useState(""),[n,s]=f.useState(""),[a,i]=f.useState(""),[o,l]=f.useState(!1),[c,d]=f.useState(""),{register:u}=Es(),m=async h=>{if(h.preventDefault(),d(""),n!==a){d("Passwords do not match");return}if(e.length<3){d("Username must be at least 3 characters long");return}if(n.length<6){d("Password must be at least 6 characters long");return}l(!0);const p=await u(e,n);p.success||d(p.error),l(!1)};return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsx("div",{className:"w-full max-w-md",children:t.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(lr,{size:64})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome to Claude Code UI"}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Set up your account to get started"})]}),t.jsxs("form",{onSubmit:m,className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),t.jsx("input",{type:"text",id:"username",value:e,onChange:h=>r(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:o})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),t.jsx("input",{type:"password",id:"password",value:n,onChange:h=>s(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:o})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),t.jsx("input",{type:"password",id:"confirmPassword",value:a,onChange:h=>i(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:o})]}),c&&t.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:t.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:c})}),t.jsx("button",{type:"submit",disabled:o,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:o?"Setting up...":"Create Account"})]}),t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"This is a single-user system. Only one account can be created."})})]})})})},h1=()=>{const[e,r]=f.useState(""),[n,s]=f.useState(""),[a,i]=f.useState(!1),[o,l]=f.useState(""),{login:c}=Es(),d=async u=>{if(u.preventDefault(),l(""),!e||!n){l("Please enter both username and password");return}i(!0);const m=await c(e,n);m.success||l(m.error),i(!1)};return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsx("div",{className:"w-full max-w-md",children:t.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:t.jsx(Dn,{className:"w-8 h-8 text-primary-foreground"})})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome Back"}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Sign in to your Claude Code UI account"})]}),t.jsxs("form",{onSubmit:d,className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),t.jsx("input",{type:"text",id:"username",value:e,onChange:u=>r(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:a})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),t.jsx("input",{type:"password",id:"password",value:n,onChange:u=>s(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:a})]}),o&&t.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:t.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:o})}),t.jsx("button",{type:"submit",disabled:a,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:a?"Signing in...":"Sign In"})]}),t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your credentials to access Claude Code UI"})})]})})})},f1=()=>t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:t.jsx(Dn,{className:"w-8 h-8 text-primary-foreground"})})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Claude Code UI"}),t.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Loading..."})]})}),g1=({children:e})=>{const{user:r,isLoading:n,needsSetup:s}=Es();return n?t.jsx(f1,{}):s?t.jsx(p1,{}):r?e:t.jsx(h1,{})},Ll="1.10.4",x1=(e,r)=>{const[n,s]=f.useState(!1),[a,i]=f.useState(null),[o,l]=f.useState(null);return f.useEffect(()=>{const c=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${r}/releases/latest`)).json();if(m.tag_name){const h=m.tag_name.replace(/^v/,"");i(h),s(Ll!==h),l({title:m.name||m.tag_name,body:m.body||"",htmlUrl:m.html_url||`https://github.com/${e}/${r}/releases/latest`,publishedAt:m.published_at})}else s(!1),i(null),l(null)}catch(u){console.error("Version check failed:",u),s(!1),i(null),l(null)}};c();const d=setInterval(c,300*1e3);return()=>clearInterval(d)},[e,r]),{updateAvailable:n,latestVersion:a,currentVersion:Ll,releaseInfo:o}};function Qr(e,r){const[n,s]=f.useState(()=>{if(typeof window>"u")return r;try{const i=window.localStorage.getItem(e);return i?JSON.parse(i):r}catch(i){return console.log(i),r}});return[n,i=>{if(!(typeof window>"u"))try{const o=i instanceof Function?i(n):i;window.localStorage.setItem(e,JSON.stringify(o)),s(o)}catch(o){console.log(o)}}]}function Rl(){const e=Gu(),{sessionId:r}=Ku(),{updateAvailable:n,latestVersion:s,currentVersion:a,releaseInfo:i}=x1("siteboon","claudecodeui"),[o,l]=f.useState(!1),[c,d]=f.useState([]),[u,m]=f.useState(null),[h,p]=f.useState(null),[g,x]=f.useState("chat"),[b,k]=f.useState(!1),[N,y]=f.useState(!1),[P,W]=f.useState(!0),[M,B]=f.useState(!1),[L,U]=f.useState(!1),[j,R]=f.useState("tools"),[D,_]=f.useState(!1),[C,V]=Qr("autoExpandTools",!1),[z,Z]=Qr("showRawParameters",!1),[F,ce]=Qr("showThinking",!0),[v,ue]=Qr("autoScrollToBottom",!0),[fe,w]=Qr("sendByCtrlEnter",!1),[J,he]=Qr("sidebarVisible",!0),[ye,re]=f.useState(new Set),[Pe,X]=f.useState(new Set),[le,ke]=f.useState(0),{ws:ge,sendMessage:Ie,messages:Ke}=mc(),[et,st]=f.useState(!1);f.useEffect(()=>{const ee=()=>{const me=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone||document.referrer.includes("android-app://");st(me),me?(document.documentElement.classList.add("pwa-mode"),document.body.classList.add("pwa-mode")):(document.documentElement.classList.remove("pwa-mode"),document.body.classList.remove("pwa-mode"))};return ee(),window.matchMedia("(display-mode: standalone)").addEventListener("change",ee),()=>{window.matchMedia("(display-mode: standalone)").removeEventListener("change",ee)}},[]),f.useEffect(()=>{const ee=()=>{k(window.innerWidth<768)};return ee(),window.addEventListener("resize",ee),()=>window.removeEventListener("resize",ee)},[]),f.useEffect(()=>{tt()},[]);const ft=(ee,me,oe,we)=>{if(!oe||!we)return!0;const Ee=ee?.find(ot=>ot.name===oe.name),Be=me?.find(ot=>ot.name===oe.name);if(!Ee||!Be)return!1;const ze=Ee.sessions?.find(ot=>ot.id===we.id),Xe=Be.sessions?.find(ot=>ot.id===we.id);return!ze||!Xe?!1:ze.id===Xe.id&&ze.title===Xe.title&&ze.created_at===Xe.created_at&&ze.updated_at===Xe.updated_at};f.useEffect(()=>{if(Ke.length>0){const ee=Ke[Ke.length-1];if(ee.type==="projects_updated"){if(ee.changedFile&&h&&u){const we=ee.changedFile.split("/");we.length>=2&&we[we.length-1].replace(".jsonl","")===h.id&&(ye.has(h.id)||ke(Xe=>Xe+1))}if(h&&ye.has(h.id)||ye.size>0&&Array.from(ye).some(we=>we.startsWith("new-session-"))){const we=ee.projects;if(!ft(c,we,u,h))return}const oe=ee.projects;if(d(oe),u){const we=oe.find(Ee=>Ee.name===u.name);we&&(JSON.stringify(we)!==JSON.stringify(u)&&m(we),h&&(we.sessions?.find(Be=>Be.id===h.id)||p(null)))}}}},[Ke,u,h,ye]);const tt=async()=>{try{W(!0);const me=await(await Ue.projects()).json();for(let oe of me)try{const we=`/api/cursor/sessions?projectPath=${encodeURIComponent(oe.fullPath||oe.path)}`,Ee=await Fe(we);if(Ee.ok){const Be=await Ee.json();Be.success&&Be.sessions?oe.cursorSessions=Be.sessions:oe.cursorSessions=[]}else oe.cursorSessions=[]}catch(we){console.error(`Error fetching Cursor sessions for project ${oe.name}:`,we),oe.cursorSessions=[]}d(oe=>oe.length===0||me.some((Ee,Be)=>{const ze=oe[Be];return ze?Ee.name!==ze.name||Ee.displayName!==ze.displayName||Ee.fullPath!==ze.fullPath||JSON.stringify(Ee.sessionMeta)!==JSON.stringify(ze.sessionMeta)||JSON.stringify(Ee.sessions)!==JSON.stringify(ze.sessions)||JSON.stringify(Ee.cursorSessions)!==JSON.stringify(ze.cursorSessions):!0})||me.length!==oe.length?me:oe)}catch(ee){console.error("Error fetching projects:",ee)}finally{W(!1)}};window.refreshProjects=tt,window.openSettings=f.useCallback((ee="tools")=>{R(ee),U(!0)},[]),f.useEffect(()=>{if(r&&c.length>0){const ee=!h||h.id!==r;for(const me of c){let oe=me.sessions?.find(Ee=>Ee.id===r);if(oe){m(me),p({...oe,__provider:"claude"}),ee&&x("chat");return}const we=me.cursorSessions?.find(Ee=>Ee.id===r);if(we){m(me),p({...we,__provider:"cursor"}),ee&&x("chat");return}}}},[r,c,e]);const xe=ee=>{m(ee),p(null),e("/"),b&&y(!1)},qe=ee=>{if(p(ee),g!=="git"&&g!=="preview"&&x("chat"),(localStorage.getItem("selected-provider")||"claude")==="cursor"&&sessionStorage.setItem("cursorSessionId",ee.id),b){const oe=ee.__projectName,we=u?.name;oe!==we&&y(!1)}e(`/session/${ee.id}`)},it=ee=>{m(ee),p(null),x("chat"),e("/"),b&&y(!1)},ve=ee=>{h?.id===ee&&(p(null),e("/")),d(me=>me.map(oe=>({...oe,sessions:oe.sessions?.filter(we=>we.id!==ee)||[],sessionMeta:{...oe.sessionMeta,total:Math.max(0,(oe.sessionMeta?.total||0)-1)}})))},Ct=async()=>{try{const me=await(await Ue.projects()).json();if(d(oe=>me.some((Ee,Be)=>{const ze=oe[Be];return ze?Ee.name!==ze.name||Ee.displayName!==ze.displayName||Ee.fullPath!==ze.fullPath||JSON.stringify(Ee.sessionMeta)!==JSON.stringify(ze.sessionMeta)||JSON.stringify(Ee.sessions)!==JSON.stringify(ze.sessions):!0})||me.length!==oe.length?me:oe),u){const oe=me.find(we=>we.name===u.name);if(oe&&(JSON.stringify(oe)!==JSON.stringify(u)&&m(oe),h)){const we=oe.sessions?.find(Ee=>Ee.id===h.id);we&&JSON.stringify(we)!==JSON.stringify(h)&&p(we)}}}catch(ee){console.error("Error refreshing sidebar:",ee)}},Q=ee=>{u?.name===ee&&(m(null),p(null),e("/")),d(me=>me.filter(oe=>oe.name!==ee))},de=f.useCallback(ee=>{ee&&re(me=>new Set([...me,ee]))},[]),T=f.useCallback(ee=>{ee&&re(me=>{const oe=new Set(me);return oe.delete(ee),oe})},[]),O=f.useCallback(ee=>{ee&&X(me=>new Set([...me,ee]))},[]),ne=f.useCallback(ee=>{ee&&X(me=>{const oe=new Set(me);return oe.delete(ee),oe})},[]),Ce=f.useCallback(ee=>{ee&&re(me=>{const oe=new Set;for(const we of me)we.startsWith("new-session-")||oe.add(we);return oe.add(ee),oe})},[]),De=()=>{const[ee,me]=f.useState(!1),[oe,we]=f.useState(""),[Ee,Be]=f.useState("");if(!o)return null;const ze=gt=>gt?gt.replace(/\b[0-9a-f]{40}\b/gi,"").replace(/(?:^|\s|-)([0-9a-f]{7,10})\b/gi,"").replace(/\*\*Full Changelog\*\*:.*$/gim,"").replace(/https?:\/\/github\.com\/[^\/]+\/[^\/]+\/compare\/[^\s)]+/gi,"").replace(/\n\s*\n\s*\n/g,`
922
+
923
+ `).trim():"",Xe=async()=>{me(!0),we(`Starting update...
924
+ `),Be("");try{const gt=await Fe("/api/system/update",{method:"POST"}),ot=await gt.json();gt.ok?(we(vt=>vt+ot.output+`
925
+ `),we(vt=>vt+`
926
+ ✅ Update completed successfully!
927
+ `),we(vt=>vt+`Please restart the server to apply changes.
928
+ `)):(Be(ot.error||"Update failed"),we(vt=>vt+`
929
+ ❌ Update failed: `+(ot.error||"Unknown error")+`
930
+ `))}catch(gt){Be(gt.message),we(ot=>ot+`
931
+ ❌ Update failed: `+gt.message+`
932
+ `)}finally{me(!1)}};return t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[t.jsx("button",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>l(!1),"aria-label":"Close version upgrade modal"}),t.jsxs("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-2xl mx-4 p-6 space-y-4 max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-lg flex items-center justify-center",children:t.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Update Available"}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:i?.title||"A new version is ready"})]})]}),t.jsx("button",{onClick:()=>l(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex justify-between items-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Current Version"}),t.jsx("span",{className:"text-sm text-gray-900 dark:text-white font-mono",children:a})]}),t.jsxs("div",{className:"flex justify-between items-center p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-700",children:[t.jsx("span",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:"Latest Version"}),t.jsx("span",{className:"text-sm text-blue-900 dark:text-blue-100 font-mono",children:s})]})]}),i?.body&&t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"What's New:"}),i?.htmlUrl&&t.jsxs("a",{href:i.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:underline flex items-center gap-1",children:["View full release",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.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"})})]})]}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 border border-gray-200 dark:border-gray-600 max-h-64 overflow-y-auto",children:t.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap prose prose-sm dark:prose-invert max-w-none",children:ze(i.body)})})]}),oe&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Update Progress:"}),t.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 rounded-lg p-4 border border-gray-700 max-h-48 overflow-y-auto",children:t.jsx("pre",{className:"text-xs text-green-400 font-mono whitespace-pre-wrap",children:oe})})]}),!ee&&!oe&&t.jsxs("div",{className:"space-y-3",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Manual upgrade:"}),t.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-lg p-3 border",children:t.jsx("code",{className:"text-sm text-gray-800 dark:text-gray-200 font-mono",children:"git checkout main && git pull && npm install"})}),t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:'Or click "Update Now" to run the update automatically.'})]}),t.jsxs("div",{className:"flex gap-2 pt-2",children:[t.jsx("button",{onClick:()=>l(!1),className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors",children:oe?"Close":"Later"}),!oe&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>{navigator.clipboard.writeText("git checkout main && git pull && npm install")},className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors",children:"Copy Command"}),t.jsx("button",{onClick:Xe,disabled:ee,className:"flex-1 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed rounded-md transition-colors flex items-center justify-center gap-2",children:ee?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Updating..."]}):"Update Now"})]})]})]})]})};return t.jsxs("div",{className:"fixed inset-0 flex bg-background",children:[!b&&t.jsx("div",{className:`flex-shrink-0 border-r border-border bg-card transition-all duration-300 ${J?"w-80":"w-14"}`,children:t.jsx("div",{className:"h-full overflow-hidden",children:J?t.jsx(ro,{projects:c,selectedProject:u,selectedSession:h,onProjectSelect:xe,onSessionSelect:qe,onNewSession:it,onSessionDelete:ve,onProjectDelete:Q,isLoading:P,onRefresh:Ct,onShowSettings:()=>U(!0),updateAvailable:n,latestVersion:s,currentVersion:a,releaseInfo:i,onShowVersionModal:()=>l(!0),isPWA:et,isMobile:b,onToggleSidebar:()=>he(!1)}):t.jsxs("div",{className:"h-full flex flex-col items-center py-4 gap-4",children:[t.jsx("button",{onClick:()=>he(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200 group","aria-label":"Show sidebar",title:"Show sidebar",children:t.jsx("svg",{className:"w-5 h-5 text-foreground group-hover:scale-110 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})})}),t.jsx("button",{onClick:()=>U(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":"Settings",title:"Settings",children:t.jsx(Wr,{className:"w-5 h-5 text-muted-foreground hover:text-foreground transition-colors"})}),n&&t.jsxs("button",{onClick:()=>l(!0),className:"relative p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":"Update available",title:"Update available",children:[t.jsx(Ir,{className:"w-5 h-5 text-blue-500"}),t.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]})]})})}),b&&t.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${N?"opacity-100 visible":"opacity-0 invisible"}`,children:[t.jsx("button",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:ee=>{ee.stopPropagation(),y(!1)},onTouchStart:ee=>{ee.preventDefault(),ee.stopPropagation(),y(!1)},"aria-label":"Close sidebar"}),t.jsx("div",{className:`relative w-[85vw] max-w-sm sm:w-80 bg-card border-r border-border transform transition-transform duration-150 ease-out ${N?"translate-x-0":"-translate-x-full"}`,style:{height:"calc(100vh - 80px)"},onClick:ee=>ee.stopPropagation(),onTouchStart:ee=>ee.stopPropagation(),children:t.jsx(ro,{projects:c,selectedProject:u,selectedSession:h,onProjectSelect:xe,onSessionSelect:qe,onNewSession:it,onSessionDelete:ve,onProjectDelete:Q,isLoading:P,onRefresh:Ct,onShowSettings:()=>U(!0),updateAvailable:n,latestVersion:s,currentVersion:a,releaseInfo:i,onShowVersionModal:()=>l(!0),isPWA:et,isMobile:b,onToggleSidebar:()=>he(!1)})})]}),t.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${b&&!M?"pb-16":""}`,children:t.jsx(i1,{selectedProject:u,selectedSession:h,activeTab:g,setActiveTab:x,ws:ge,sendMessage:Ie,messages:Ke,isMobile:b,isPWA:et,onMenuClick:()=>y(!0),isLoading:P,onInputFocusChange:B,onSessionActive:de,onSessionInactive:T,onSessionProcessing:O,onSessionNotProcessing:ne,processingSessions:Pe,onReplaceTemporarySession:Ce,onNavigateToSession:ee=>e(`/session/${ee}`),onShowSettings:()=>U(!0),autoExpandTools:C,showRawParameters:z,showThinking:F,autoScrollToBottom:v,sendByCtrlEnter:fe,externalMessageUpdate:le})}),b&&t.jsx(o1,{activeTab:g,setActiveTab:x,isInputFocused:M}),g==="chat"&&t.jsx(m1,{isOpen:D,onToggle:_,autoExpandTools:C,onAutoExpandChange:V,showRawParameters:z,onShowRawParametersChange:Z,showThinking:F,onShowThinkingChange:ce,autoScrollToBottom:v,onAutoScrollChange:ue,sendByCtrlEnter:fe,onSendByCtrlEnterChange:w,isMobile:b}),t.jsx(d1,{isOpen:L,onClose:()=>U(!1),projects:c,initialTab:j}),t.jsx(De,{})]})}function b1(){return t.jsx(l1,{children:t.jsx(Ph,{children:t.jsx(Rh,{children:t.jsx(zh,{children:t.jsx(_h,{children:t.jsx(g1,{children:t.jsx(qu,{children:t.jsxs(Vu,{children:[t.jsx(Bi,{path:"/",element:t.jsx(Rl,{})}),t.jsx(Bi,{path:"/session/:sessionId",element:t.jsx(Rl,{})})]})})})})})})})})}"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(e=>{e.forEach(r=>{r.unregister()})}).catch(e=>{console.warn("Failed to unregister service workers:",e)});tm.createRoot(document.getElementById("root")).render(t.jsx(fr.StrictMode,{children:t.jsx(b1,{})}));